1
0

slh_dsa.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Copyright 2024-2025 The OpenSSL Project Authors. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License 2.0 (the "License"). You may not use
  5. * this file except in compliance with the License. You can obtain a copy
  6. * in the file LICENSE in the source distribution or at
  7. * https://www.openssl.org/source/license.html
  8. */
  9. /* Internal SLH_DSA functions for other submodules, not for application use */
  10. #ifndef OSSL_CRYPTO_SLH_DSA_H
  11. # define OSSL_CRYPTO_SLH_DSA_H
  12. # pragma once
  13. # include <openssl/e_os2.h>
  14. # include <openssl/types.h>
  15. # include "crypto/types.h"
  16. # define SLH_DSA_MAX_CONTEXT_STRING_LEN 255
  17. # define SLH_DSA_MAX_N 32
  18. typedef struct slh_dsa_hash_ctx_st SLH_DSA_HASH_CTX;
  19. typedef struct slh_dsa_key_st SLH_DSA_KEY;
  20. __owur OSSL_LIB_CTX *ossl_slh_dsa_key_get0_libctx(const SLH_DSA_KEY *key);
  21. __owur SLH_DSA_KEY *ossl_slh_dsa_key_new(OSSL_LIB_CTX *libctx, const char *propq,
  22. const char *alg);
  23. void ossl_slh_dsa_key_free(SLH_DSA_KEY *key);
  24. void ossl_slh_dsa_key_reset(SLH_DSA_KEY *key);
  25. __owur SLH_DSA_KEY *ossl_slh_dsa_key_dup(const SLH_DSA_KEY *src, int selection);
  26. __owur int ossl_slh_dsa_key_equal(const SLH_DSA_KEY *key1, const SLH_DSA_KEY *key2,
  27. int selection);
  28. __owur int ossl_slh_dsa_key_has(const SLH_DSA_KEY *key, int selection);
  29. __owur int ossl_slh_dsa_key_pairwise_check(const SLH_DSA_KEY *key);
  30. __owur int ossl_slh_dsa_key_fromdata(SLH_DSA_KEY *key, const OSSL_PARAM *params,
  31. int include_private);
  32. __owur int ossl_slh_dsa_generate_key(SLH_DSA_HASH_CTX *ctx, SLH_DSA_KEY *out,
  33. OSSL_LIB_CTX *libctx,
  34. const uint8_t *entropy, size_t entropy_len);
  35. __owur int ossl_slh_dsa_key_to_text(BIO *out, const SLH_DSA_KEY *key, int selection);
  36. __owur const uint8_t *ossl_slh_dsa_key_get_pub(const SLH_DSA_KEY *key);
  37. __owur const uint8_t *ossl_slh_dsa_key_get_priv(const SLH_DSA_KEY *key);
  38. __owur size_t ossl_slh_dsa_key_get_pub_len(const SLH_DSA_KEY *key);
  39. __owur int ossl_slh_dsa_set_priv(SLH_DSA_KEY *key, const uint8_t *priv,
  40. size_t priv_len);
  41. __owur int ossl_slh_dsa_set_pub(SLH_DSA_KEY *key, const uint8_t *pub,
  42. size_t pub_len);
  43. __owur size_t ossl_slh_dsa_key_get_priv_len(const SLH_DSA_KEY *key);
  44. __owur size_t ossl_slh_dsa_key_get_n(const SLH_DSA_KEY *key);
  45. __owur size_t ossl_slh_dsa_key_get_sig_len(const SLH_DSA_KEY *key);
  46. __owur const char *ossl_slh_dsa_key_get_name(const SLH_DSA_KEY *key);
  47. __owur int ossl_slh_dsa_key_get_type(const SLH_DSA_KEY *key);
  48. __owur int ossl_slh_dsa_key_type_matches(const SLH_DSA_KEY *key, const char *alg);
  49. __owur SLH_DSA_HASH_CTX *ossl_slh_dsa_hash_ctx_new(const SLH_DSA_KEY *key);
  50. void ossl_slh_dsa_hash_ctx_free(SLH_DSA_HASH_CTX *ctx);
  51. __owur SLH_DSA_HASH_CTX *ossl_slh_dsa_hash_ctx_dup(const SLH_DSA_HASH_CTX *src);
  52. __owur int ossl_slh_dsa_sign(SLH_DSA_HASH_CTX *slh_ctx,
  53. const uint8_t *msg, size_t msg_len,
  54. const uint8_t *ctx, size_t ctx_len,
  55. const uint8_t *add_rand, int encode,
  56. unsigned char *sig, size_t *siglen, size_t sigsize);
  57. __owur int ossl_slh_dsa_verify(SLH_DSA_HASH_CTX *slh_ctx,
  58. const uint8_t *msg, size_t msg_len,
  59. const uint8_t *ctx, size_t ctx_len, int encode,
  60. const uint8_t *sig, size_t sig_len);
  61. #endif /* OSSL_CRYPTO_SLH_DSA_H */