| 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 |
|
| 10 |
/* Internal SLH_DSA functions for other submodules, not for application use */ |
| 11 |
|
| 12 |
#ifndef OSSL_CRYPTO_SLH_DSA_H |
| 13 |
#define OSSL_CRYPTO_SLH_DSA_H |
| 14 |
|
| 15 |
#pragma once |
| 16 |
#include <openssl/e_os2.h> |
| 17 |
#include <openssl/types.h> |
| 18 |
#include "crypto/types.h" |
| 19 |
|
| 20 |
#define SLH_DSA_MAX_CONTEXT_STRING_LEN 255 |
| 21 |
#define SLH_DSA_MAX_N 32 |
| 22 |
|
| 23 |
typedef struct slh_dsa_hash_ctx_st SLH_DSA_HASH_CTX; |
| 24 |
typedef struct slh_dsa_key_st SLH_DSA_KEY; |
| 25 |
|
| 26 |
__owur OSSL_LIB_CTX *ossl_slh_dsa_key_get0_libctx(const SLH_DSA_KEY *key); |
| 27 |
__owur SLH_DSA_KEY *ossl_slh_dsa_key_new(OSSL_LIB_CTX *libctx, const char *propq, |
| 28 |
const char *alg); |
| 29 |
void ossl_slh_dsa_key_free(SLH_DSA_KEY *key); |
| 30 |
void ossl_slh_dsa_key_reset(SLH_DSA_KEY *key); |
| 31 |
__owur SLH_DSA_KEY *ossl_slh_dsa_key_dup(const SLH_DSA_KEY *src, int selection); |
| 32 |
__owur int ossl_slh_dsa_key_equal(const SLH_DSA_KEY *key1, const SLH_DSA_KEY *key2, |
| 33 |
int selection); |
| 34 |
__owur int ossl_slh_dsa_key_has(const SLH_DSA_KEY *key, int selection); |
| 35 |
__owur int ossl_slh_dsa_key_pairwise_check(const SLH_DSA_KEY *key); |
| 36 |
__owur int ossl_slh_dsa_key_fromdata(SLH_DSA_KEY *key, const OSSL_PARAM *pub, |
| 37 |
const OSSL_PARAM *param_priv, |
| 38 |
int include_private); |
| 39 |
__owur int ossl_slh_dsa_generate_key(SLH_DSA_HASH_CTX *ctx, SLH_DSA_KEY *out, |
| 40 |
OSSL_LIB_CTX *libctx, |
| 41 |
const uint8_t *entropy, size_t entropy_len); |
| 42 |
__owur int ossl_slh_dsa_key_to_text(BIO *out, const SLH_DSA_KEY *key, int selection); |
| 43 |
__owur const uint8_t *ossl_slh_dsa_key_get_pub(const SLH_DSA_KEY *key); |
| 44 |
__owur const uint8_t *ossl_slh_dsa_key_get_priv(const SLH_DSA_KEY *key); |
| 45 |
__owur size_t ossl_slh_dsa_key_get_pub_len(const SLH_DSA_KEY *key); |
| 46 |
__owur int ossl_slh_dsa_set_priv(SLH_DSA_KEY *key, const uint8_t *priv, |
| 47 |
size_t priv_len); |
| 48 |
__owur int ossl_slh_dsa_set_pub(SLH_DSA_KEY *key, const uint8_t *pub, |
| 49 |
size_t pub_len); |
| 50 |
__owur size_t ossl_slh_dsa_key_get_priv_len(const SLH_DSA_KEY *key); |
| 51 |
__owur size_t ossl_slh_dsa_key_get_n(const SLH_DSA_KEY *key); |
| 52 |
__owur int ossl_slh_dsa_key_get_security_category(const SLH_DSA_KEY *key); |
| 53 |
__owur size_t ossl_slh_dsa_key_get_sig_len(const SLH_DSA_KEY *key); |
| 54 |
__owur const char *ossl_slh_dsa_key_get_name(const SLH_DSA_KEY *key); |
| 55 |
__owur int ossl_slh_dsa_key_get_type(const SLH_DSA_KEY *key); |
| 56 |
__owur int ossl_slh_dsa_key_type_matches(const SLH_DSA_KEY *key, const char *alg); |
| 57 |
__owur SLH_DSA_HASH_CTX *ossl_slh_dsa_hash_ctx_new(const SLH_DSA_KEY *key); |
| 58 |
void ossl_slh_dsa_hash_ctx_free(SLH_DSA_HASH_CTX *ctx); |
| 59 |
__owur SLH_DSA_HASH_CTX *ossl_slh_dsa_hash_ctx_dup(const SLH_DSA_HASH_CTX *src); |
| 60 |
|
| 61 |
__owur int ossl_slh_dsa_sign(SLH_DSA_HASH_CTX *slh_ctx, |
| 62 |
const uint8_t *msg, size_t msg_len, |
| 63 |
const uint8_t *ctx, size_t ctx_len, |
| 64 |
const uint8_t *add_rand, int encode, |
| 65 |
unsigned char *sig, size_t *siglen, size_t sigsize); |
| 66 |
__owur int ossl_slh_dsa_verify(SLH_DSA_HASH_CTX *slh_ctx, |
| 67 |
const uint8_t *msg, size_t msg_len, |
| 68 |
const uint8_t *ctx, size_t ctx_len, int encode, |
| 69 |
const uint8_t *sig, size_t sig_len); |
| 70 |
|
| 71 |
#endif /* OSSL_CRYPTO_SLH_DSA_H */ |