diff --git a/.github/workflows/coding_style.yml b/.github/workflows/coding_style.yml index a254c63a..e4304be6 100644 --- a/.github/workflows/coding_style.yml +++ b/.github/workflows/coding_style.yml @@ -8,7 +8,7 @@ jobs: strategy: fail-fast: false container: - image: openquantumsafe/ci-ubuntu-jammy:latest + image: openquantumsafe/ci-ubuntu-latest:latest steps: - name: Install dependencies run: apt-get update && apt-get install -y clang-format @@ -17,4 +17,4 @@ jobs: uses: actions/checkout@v2 - name: Check coding style using clang-format - run: find . -type f -and '(' -name '*.h' -or -name '*.c' -or -name '*.inc' ')' | xargs clang-format --dry-run --Werror \ No newline at end of file + run: ./scripts/do_code_format.sh diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 679c7971..9bbb3db6 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -69,7 +69,7 @@ jobs: export LIBOQS_SRC_DIR=`pwd`/liboqs && \ ! pip3 install -r oqs-template/requirements.txt 2>&1 | grep ERROR && \ python3 oqs-template/generate.py && \ - find . -type f -and '(' -name '*.h' -or -name '*.c' -or -name '*.inc' ')' | xargs clang-format -i && \ + ./scripts/do_code_format.sh --no-dry-run && \ git diff && \ ! git status | grep modified - name: Build .deb install package diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1c4902a7..81bc08b7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -30,16 +30,15 @@ Thus, any PR should revisit and possibly update this file suitably. ### Coding style -This project has adopted the [OpenSSL coding style](https://www.openssl.org/policies/technical/coding-style.html). +This project has adopted the LLVM coding style. To check adherence of any new code to this, it therefore is highly recommended to run the following commands in the project main directory prior to finishing a PR: - find oqsprov -type f -and '(' -name '*.h' -or -name '*.c' -or -name '*.inc' ')' | xargs clang-format --dry-run --Werror - find test -type f -and '(' -name '*.h' -or -name '*.c' -or -name '*.inc' ')' | xargs clang-format --dry-run --Werror + ./scripts/do_code_format.sh -If errors are reported, consider replacing `--dry-run --Werror` with `-i` to -enable in-place correction of the coding errors, or correct the code manually -to pass this CI acceptance test. +If errors/deviations are reported, review the code or consider running the utility +script `scripts/format_code.sh` if you'd like to get the code changed to use the +exact same code style check used in CI. ### Running CI locally diff --git a/oqsprov/oqs_decode_der2key.c b/oqsprov/oqs_decode_der2key.c index 86c6c45c..49cd2b99 100644 --- a/oqsprov/oqs_decode_der2key.c +++ b/oqsprov/oqs_decode_der2key.c @@ -26,19 +26,19 @@ int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb); // TBD: OK to use? #include "oqs_endecoder_local.h" #ifdef NDEBUG -# define OQS_DEC_PRINTF(a) -# define OQS_DEC_PRINTF2(a, b) -# define OQS_DEC_PRINTF3(a, b, c) +#define OQS_DEC_PRINTF(a) +#define OQS_DEC_PRINTF2(a, b) +#define OQS_DEC_PRINTF3(a, b, c) #else -# define OQS_DEC_PRINTF(a) \ - if (getenv("OQSDEC")) \ - printf(a) -# define OQS_DEC_PRINTF2(a, b) \ - if (getenv("OQSDEC")) \ - printf(a, b) -# define OQS_DEC_PRINTF3(a, b, c) \ - if (getenv("OQSDEC")) \ - printf(a, b, c) +#define OQS_DEC_PRINTF(a) \ + if (getenv("OQSDEC")) \ + printf(a) +#define OQS_DEC_PRINTF2(a, b) \ + if (getenv("OQSDEC")) \ + printf(a, b) +#define OQS_DEC_PRINTF3(a, b, c) \ + if (getenv("OQSDEC")) \ + printf(a, b, c) #endif // NDEBUG struct der2key_ctx_st; /* Forward declaration */ @@ -108,17 +108,16 @@ struct X509_pubkey_st { unsigned int flag_force_legacy : 1; }; -ASN1_SEQUENCE(X509_PUBKEY_INTERNAL) - = {ASN1_SIMPLE(X509_PUBKEY, algor, X509_ALGOR), - ASN1_SIMPLE( - X509_PUBKEY, public_key, - ASN1_BIT_STRING)} static_ASN1_SEQUENCE_END_name(X509_PUBKEY, - X509_PUBKEY_INTERNAL) - - X509_PUBKEY - * oqsx_d2i_X509_PUBKEY_INTERNAL(const unsigned char **pp, long len, - OSSL_LIB_CTX *libctx) -{ +ASN1_SEQUENCE(X509_PUBKEY_INTERNAL) = + {ASN1_SIMPLE(X509_PUBKEY, algor, X509_ALGOR), + ASN1_SIMPLE( + X509_PUBKEY, public_key, + ASN1_BIT_STRING)} static_ASN1_SEQUENCE_END_name(X509_PUBKEY, + X509_PUBKEY_INTERNAL) + + X509_PUBKEY + * oqsx_d2i_X509_PUBKEY_INTERNAL(const unsigned char **pp, long len, + OSSL_LIB_CTX *libctx) { X509_PUBKEY *xpub = OPENSSL_zalloc(sizeof(*xpub)); if (xpub == NULL) @@ -142,8 +141,7 @@ struct der2key_ctx_st { }; int oqs_read_der(PROV_OQS_CTX *provctx, OSSL_CORE_BIO *cin, - unsigned char **data, long *len) -{ + unsigned char **data, long *len) { OQS_DEC_PRINTF("OQS DEC provider: oqs_read_der called.\n"); BUF_MEM *mem = NULL; @@ -164,8 +162,7 @@ typedef void *key_from_pkcs8_t(const PKCS8_PRIV_KEY_INFO *p8inf, static void *oqs_der2key_decode_p8(const unsigned char **input_der, long input_der_len, struct der2key_ctx_st *ctx, - key_from_pkcs8_t *key_from_pkcs8) -{ + key_from_pkcs8_t *key_from_pkcs8) { PKCS8_PRIV_KEY_INFO *p8inf = NULL; const X509_ALGOR *alg = NULL; void *key = NULL; @@ -174,18 +171,17 @@ static void *oqs_der2key_decode_p8(const unsigned char **input_der, "OQS DEC provider: oqs_der2key_decode_p8 called. Keytype: %d.\n", ctx->desc->evp_type); - if ((p8inf = d2i_PKCS8_PRIV_KEY_INFO(NULL, input_der, input_der_len)) - != NULL - && PKCS8_pkey_get0(NULL, NULL, NULL, &alg, p8inf) - && OBJ_obj2nid(alg->algorithm) == ctx->desc->evp_type) + if ((p8inf = d2i_PKCS8_PRIV_KEY_INFO(NULL, input_der, input_der_len)) != + NULL && + PKCS8_pkey_get0(NULL, NULL, NULL, &alg, p8inf) && + OBJ_obj2nid(alg->algorithm) == ctx->desc->evp_type) key = key_from_pkcs8(p8inf, PROV_OQS_LIBCTX_OF(ctx->provctx), NULL); PKCS8_PRIV_KEY_INFO_free(p8inf); return key; } -OQSX_KEY *oqsx_d2i_PUBKEY(OQSX_KEY **a, const unsigned char **pp, long length) -{ +OQSX_KEY *oqsx_d2i_PUBKEY(OQSX_KEY **a, const unsigned char **pp, long length) { OQSX_KEY *key = NULL; // taken from internal code for d2i_PUBKEY_int: X509_PUBKEY *xpk; @@ -217,49 +213,46 @@ static OSSL_FUNC_decoder_export_object_fn der2key_export_object; static struct der2key_ctx_st *der2key_newctx(void *provctx, struct keytype_desc_st *desc, - const char *tls_name) -{ + const char *tls_name) { struct der2key_ctx_st *ctx = OPENSSL_zalloc(sizeof(*ctx)); - OQS_DEC_PRINTF3( - "OQS DEC provider: der2key_newctx called with tls_name %s. Keytype: %d\n", - tls_name, desc->evp_type); + OQS_DEC_PRINTF3("OQS DEC provider: der2key_newctx called with tls_name %s. " + "Keytype: %d\n", + tls_name, desc->evp_type); if (ctx != NULL) { ctx->provctx = provctx; ctx->desc = desc; if (desc->evp_type == 0) { ctx->desc->evp_type = OBJ_sn2nid(tls_name); - OQS_DEC_PRINTF2( - "OQS DEC provider: der2key_newctx set evp_type to %d\n", - ctx->desc->evp_type); + OQS_DEC_PRINTF2("OQS DEC provider: der2key_newctx set " + "evp_type to %d\n", + ctx->desc->evp_type); } } return ctx; } -static void der2key_freectx(void *vctx) -{ +static void der2key_freectx(void *vctx) { struct der2key_ctx_st *ctx = vctx; OPENSSL_free(ctx); } static int der2key_check_selection(int selection, - const struct keytype_desc_st *desc) -{ + const struct keytype_desc_st *desc) { /* * The selections are kinda sorta "levels", i.e. each selection given * here is assumed to include those following. */ - int checks[] - = {OSSL_KEYMGMT_SELECT_PRIVATE_KEY, OSSL_KEYMGMT_SELECT_PUBLIC_KEY, - OSSL_KEYMGMT_SELECT_ALL_PARAMETERS}; + int checks[] = {OSSL_KEYMGMT_SELECT_PRIVATE_KEY, + OSSL_KEYMGMT_SELECT_PUBLIC_KEY, + OSSL_KEYMGMT_SELECT_ALL_PARAMETERS}; size_t i; - OQS_DEC_PRINTF3( - "OQS DEC provider: der2key_check_selection called with selection %d (%d).\n", - selection, desc->selection_mask); + OQS_DEC_PRINTF3("OQS DEC provider: der2key_check_selection called with " + "selection %d (%d).\n", + selection, desc->selection_mask); /* The decoder implementations made here support guessing */ if (selection == 0) @@ -273,9 +266,9 @@ static int der2key_check_selection(int selection, * If the caller asked for the currently checked bit(s), return * whether the decoder description says it's supported. */ - OQS_DEC_PRINTF3( - "OQS DEC provider: der2key_check_selection returning %d (%d).\n", - check1, check2); + OQS_DEC_PRINTF3("OQS DEC provider: der2key_check_selection " + "returning %d (%d).\n", + check1, check2); if (check1) return check2; @@ -287,8 +280,7 @@ static int der2key_check_selection(int selection, static int oqs_der2key_decode(void *vctx, OSSL_CORE_BIO *cin, int selection, OSSL_CALLBACK *data_cb, void *data_cbarg, - OSSL_PASSPHRASE_CALLBACK *pw_cb, void *pw_cbarg) -{ + OSSL_PASSPHRASE_CALLBACK *pw_cb, void *pw_cbarg) { struct der2key_ctx_st *ctx = vctx; unsigned char *der = NULL; const unsigned char *derp; @@ -356,8 +348,8 @@ static int oqs_der2key_decode(void *vctx, OSSL_CORE_BIO *cin, int selection, * classes of key types that have subtle variants, like RSA-PSS keys as * opposed to plain RSA keys. */ - if (key != NULL && ctx->desc->check_key != NULL - && !ctx->desc->check_key(key, ctx)) { + if (key != NULL && ctx->desc->check_key != NULL && + !ctx->desc->check_key(key, ctx)) { ctx->desc->free_key(key); key = NULL; } @@ -384,8 +376,8 @@ static int oqs_der2key_decode(void *vctx, OSSL_CORE_BIO *cin, int selection, OSSL_PARAM params[4]; int object_type = OSSL_OBJECT_PKEY; - params[0] - = OSSL_PARAM_construct_int(OSSL_OBJECT_PARAM_TYPE, &object_type); + params[0] = + OSSL_PARAM_construct_int(OSSL_OBJECT_PARAM_TYPE, &object_type); params[1] = OSSL_PARAM_construct_utf8_string( OSSL_OBJECT_PARAM_DATA_TYPE, (char *)ctx->desc->keytype_name, 0); /* The address of the key becomes the octet string */ @@ -405,11 +397,10 @@ static int oqs_der2key_decode(void *vctx, OSSL_CORE_BIO *cin, int selection, static int der2key_export_object(void *vctx, const void *reference, size_t reference_sz, OSSL_CALLBACK *export_cb, - void *export_cbarg) -{ + void *export_cbarg) { struct der2key_ctx_st *ctx = vctx; - OSSL_FUNC_keymgmt_export_fn *export - = oqs_prov_get_keymgmt_export(ctx->desc->fns); + OSSL_FUNC_keymgmt_export_fn *export = + oqs_prov_get_keymgmt_export(ctx->desc->fns); void *keydata; OQS_DEC_PRINTF("OQS DEC provider: der2key_export_object called.\n"); @@ -426,16 +417,14 @@ static int der2key_export_object(void *vctx, const void *reference, /* ---------------------------------------------------------------------- */ static void *oqsx_d2i_PKCS8(void **key, const unsigned char **der, long der_len, - struct der2key_ctx_st *ctx) -{ + struct der2key_ctx_st *ctx) { OQS_DEC_PRINTF("OQS DEC provider: oqsx_d2i_PKCS8 called.\n"); return oqs_der2key_decode_p8(der, der_len, ctx, (key_from_pkcs8_t *)oqsx_key_from_pkcs8); } -static void oqsx_key_adjust(void *key, struct der2key_ctx_st *ctx) -{ +static void oqsx_key_adjust(void *key, struct der2key_ctx_st *ctx) { OQS_DEC_PRINTF("OQS DEC provider: oqsx_key_adjust called.\n"); oqsx_key_set0_libctx(key, PROV_OQS_LIBCTX_OF(ctx->provctx)); @@ -454,37 +443,37 @@ static void oqsx_key_adjust(void *key, struct der2key_ctx_st *ctx) "type-specific", 0, (OSSL_KEYMGMT_SELECT_KEYPAIR), NULL, NULL, NULL, NULL, \ NULL, NULL, oqsx_key_adjust, (free_key_fn *)oqsx_key_free -#define DO_type_specific_pub(keytype) \ - "type-specific", 0, (OSSL_KEYMGMT_SELECT_PUBLIC_KEY), NULL, NULL, NULL, \ +#define DO_type_specific_pub(keytype) \ + "type-specific", 0, (OSSL_KEYMGMT_SELECT_PUBLIC_KEY), NULL, NULL, NULL, \ NULL, NULL, NULL, oqsx_key_adjust, (free_key_fn *)oqsx_key_free -#define DO_type_specific_priv(keytype) \ - "type-specific", 0, (OSSL_KEYMGMT_SELECT_PRIVATE_KEY), NULL, NULL, NULL, \ +#define DO_type_specific_priv(keytype) \ + "type-specific", 0, (OSSL_KEYMGMT_SELECT_PRIVATE_KEY), NULL, NULL, NULL, \ NULL, NULL, NULL, oqsx_key_adjust, (free_key_fn *)oqsx_key_free -#define DO_type_specific_params(keytype) \ - "type-specific", 0, (OSSL_KEYMGMT_SELECT_ALL_PARAMETERS), NULL, NULL, \ +#define DO_type_specific_params(keytype) \ + "type-specific", 0, (OSSL_KEYMGMT_SELECT_ALL_PARAMETERS), NULL, NULL, \ NULL, NULL, NULL, NULL, oqsx_key_adjust, (free_key_fn *)oqsx_key_free -#define DO_type_specific(keytype) \ - "type-specific", 0, (OSSL_KEYMGMT_SELECT_ALL), NULL, NULL, NULL, NULL, \ +#define DO_type_specific(keytype) \ + "type-specific", 0, (OSSL_KEYMGMT_SELECT_ALL), NULL, NULL, NULL, NULL, \ NULL, NULL, oqsx_key_adjust, (free_key_fn *)oqsx_key_free -#define DO_type_specific_no_pub(keytype) \ - "type-specific", 0, \ - (OSSL_KEYMGMT_SELECT_PRIVATE_KEY \ - | OSSL_KEYMGMT_SELECT_ALL_PARAMETERS), \ - NULL, NULL, NULL, NULL, NULL, NULL, oqsx_key_adjust, \ +#define DO_type_specific_no_pub(keytype) \ + "type-specific", 0, \ + (OSSL_KEYMGMT_SELECT_PRIVATE_KEY | \ + OSSL_KEYMGMT_SELECT_ALL_PARAMETERS), \ + NULL, NULL, NULL, NULL, NULL, NULL, oqsx_key_adjust, \ (free_key_fn *)oqsx_key_free -#define DO_PrivateKeyInfo(keytype) \ - "PrivateKeyInfo", 0, (OSSL_KEYMGMT_SELECT_PRIVATE_KEY), NULL, NULL, NULL, \ - oqsx_d2i_PKCS8, NULL, NULL, oqsx_key_adjust, \ +#define DO_PrivateKeyInfo(keytype) \ + "PrivateKeyInfo", 0, (OSSL_KEYMGMT_SELECT_PRIVATE_KEY), NULL, NULL, NULL, \ + oqsx_d2i_PKCS8, NULL, NULL, oqsx_key_adjust, \ (free_key_fn *)oqsx_key_free -#define DO_SubjectPublicKeyInfo(keytype) \ - "SubjectPublicKeyInfo", 0, (OSSL_KEYMGMT_SELECT_PUBLIC_KEY), NULL, NULL, \ - NULL, NULL, (d2i_of_void *)oqsx_d2i_PUBKEY, NULL, oqsx_key_adjust, \ +#define DO_SubjectPublicKeyInfo(keytype) \ + "SubjectPublicKeyInfo", 0, (OSSL_KEYMGMT_SELECT_PUBLIC_KEY), NULL, NULL, \ + NULL, NULL, (d2i_of_void *)oqsx_d2i_PUBKEY, NULL, oqsx_key_adjust, \ (free_key_fn *)oqsx_key_free /* @@ -506,35 +495,33 @@ static void oqsx_key_adjust(void *key, struct der2key_ctx_st *ctx) * structure. */ // reverted const to be able to change NID/evp_type after assignment -#define MAKE_DECODER(oqskemhyb, keytype_name, keytype, type, kind) \ - static struct keytype_desc_st kind##_##keytype##_desc \ - = {keytype_name, oqs##oqskemhyb##_##keytype##_keymgmt_functions, \ - DO_##kind(keytype)}; \ - \ - static OSSL_FUNC_decoder_newctx_fn kind##_der2##keytype##_newctx; \ - \ - static void *kind##_der2##keytype##_newctx(void *provctx) \ - { \ - OQS_DEC_PRINTF("OQS DEC provider: _newctx called.\n"); \ - return der2key_newctx(provctx, &kind##_##keytype##_desc, \ - keytype_name); \ - } \ - static int kind##_der2##keytype##_does_selection(void *provctx, \ - int selection) \ - { \ - OQS_DEC_PRINTF("OQS DEC provider: _does_selection called.\n"); \ - return der2key_check_selection(selection, &kind##_##keytype##_desc); \ - } \ - const OSSL_DISPATCH oqs_##kind##_der_to_##keytype##_decoder_functions[] \ - = {{OSSL_FUNC_DECODER_NEWCTX, \ - (void (*)(void))kind##_der2##keytype##_newctx}, \ - {OSSL_FUNC_DECODER_FREECTX, (void (*)(void))der2key_freectx}, \ - {OSSL_FUNC_DECODER_DOES_SELECTION, \ - (void (*)(void))kind##_der2##keytype##_does_selection}, \ - {OSSL_FUNC_DECODER_DECODE, (void (*)(void))oqs_der2key_decode}, \ - {OSSL_FUNC_DECODER_EXPORT_OBJECT, \ - (void (*)(void))der2key_export_object}, \ - {0, NULL}} +#define MAKE_DECODER(oqskemhyb, keytype_name, keytype, type, kind) \ + static struct keytype_desc_st kind##_##keytype##_desc = { \ + keytype_name, oqs##oqskemhyb##_##keytype##_keymgmt_functions, \ + DO_##kind(keytype)}; \ + \ + static OSSL_FUNC_decoder_newctx_fn kind##_der2##keytype##_newctx; \ + \ + static void *kind##_der2##keytype##_newctx(void *provctx) { \ + OQS_DEC_PRINTF("OQS DEC provider: _newctx called.\n"); \ + return der2key_newctx(provctx, &kind##_##keytype##_desc, \ + keytype_name); \ + } \ + static int kind##_der2##keytype##_does_selection(void *provctx, \ + int selection) { \ + OQS_DEC_PRINTF("OQS DEC provider: _does_selection called.\n"); \ + return der2key_check_selection(selection, &kind##_##keytype##_desc); \ + } \ + const OSSL_DISPATCH oqs_##kind##_der_to_##keytype##_decoder_functions[] = \ + {{OSSL_FUNC_DECODER_NEWCTX, \ + (void (*)(void))kind##_der2##keytype##_newctx}, \ + {OSSL_FUNC_DECODER_FREECTX, (void (*)(void))der2key_freectx}, \ + {OSSL_FUNC_DECODER_DOES_SELECTION, \ + (void (*)(void))kind##_der2##keytype##_does_selection}, \ + {OSSL_FUNC_DECODER_DECODE, (void (*)(void))oqs_der2key_decode}, \ + {OSSL_FUNC_DECODER_EXPORT_OBJECT, \ + (void (*)(void))der2key_export_object}, \ + {0, NULL}} ///// OQS_TEMPLATE_FRAGMENT_DECODER_MAKE_START #ifdef OQS_KEM_ENCODERS diff --git a/oqsprov/oqs_encode_key2any.c b/oqsprov/oqs_encode_key2any.c index 975f79ce..eb887b38 100644 --- a/oqsprov/oqs_encode_key2any.c +++ b/oqsprov/oqs_encode_key2any.c @@ -8,9 +8,8 @@ * ToDo: Adding hybrid alg support */ -#include "oqs_endecoder_local.h" -#include "oqs_prov.h" #include +#include #include #include #include @@ -20,26 +19,27 @@ #include #include /* PKCS8_encrypt() */ #include +#include #include #include -#include -#include +#include "oqs_endecoder_local.h" +#include "oqs_prov.h" #ifdef NDEBUG -# define OQS_ENC_PRINTF(a) -# define OQS_ENC_PRINTF2(a, b) -# define OQS_ENC_PRINTF3(a, b, c) +#define OQS_ENC_PRINTF(a) +#define OQS_ENC_PRINTF2(a, b) +#define OQS_ENC_PRINTF3(a, b, c) #else -# define OQS_ENC_PRINTF(a) \ - if (getenv("OQSENC")) \ - printf(a) -# define OQS_ENC_PRINTF2(a, b) \ - if (getenv("OQSENC")) \ - printf(a, b) -# define OQS_ENC_PRINTF3(a, b, c) \ - if (getenv("OQSENC")) \ - printf(a, b, c) +#define OQS_ENC_PRINTF(a) \ + if (getenv("OQSENC")) \ + printf(a) +#define OQS_ENC_PRINTF2(a, b) \ + if (getenv("OQSENC")) \ + printf(a, b) +#define OQS_ENC_PRINTF3(a, b, c) \ + if (getenv("OQSENC")) \ + printf(a, b, c) #endif // NDEBUG struct key2any_ctx_st { @@ -66,8 +66,7 @@ typedef int key_to_der_fn(BIO *out, const void *key, int key_nid, typedef int write_bio_of_void_fn(BIO *bp, const void *x); /* Free the blob allocated during key_to_paramstring_fn */ -static void free_asn1_data(int type, void *data) -{ +static void free_asn1_data(int type, void *data) { switch (type) { case V_ASN1_OBJECT: ASN1_OBJECT_free(data); @@ -80,8 +79,7 @@ static void free_asn1_data(int type, void *data) static PKCS8_PRIV_KEY_INFO *key_to_p8info(const void *key, int key_nid, void *params, int params_type, - i2d_of_void *k2d) -{ + i2d_of_void *k2d) { /* der, derlen store the key DER output and its length */ unsigned char *der = NULL; int derlen; @@ -90,13 +88,13 @@ static PKCS8_PRIV_KEY_INFO *key_to_p8info(const void *key, int key_nid, OQS_ENC_PRINTF("OQS ENC provider: key_to_p8info called\n"); - if ((p8info = PKCS8_PRIV_KEY_INFO_new()) == NULL - || (derlen = k2d(key, &der)) <= 0 - || !PKCS8_pkey_set0(p8info, OBJ_nid2obj(key_nid), 0, - // doesn't work with oqs-openssl: - // params_type, params, - // does work/interop: - V_ASN1_UNDEF, NULL, der, derlen)) { + if ((p8info = PKCS8_PRIV_KEY_INFO_new()) == NULL || + (derlen = k2d(key, &der)) <= 0 || + !PKCS8_pkey_set0(p8info, OBJ_nid2obj(key_nid), 0, + // doesn't work with oqs-openssl: + // params_type, params, + // does work/interop: + V_ASN1_UNDEF, NULL, der, derlen)) { ERR_raise(ERR_LIB_USER, ERR_R_MALLOC_FAILURE); PKCS8_PRIV_KEY_INFO_free(p8info); OPENSSL_free(der); @@ -107,8 +105,7 @@ static PKCS8_PRIV_KEY_INFO *key_to_p8info(const void *key, int key_nid, } static X509_SIG *p8info_to_encp8(PKCS8_PRIV_KEY_INFO *p8info, - struct key2any_ctx_st *ctx) -{ + struct key2any_ctx_st *ctx) { X509_SIG *p8 = NULL; char kstr[PEM_BUFSIZE]; size_t klen = 0; @@ -132,10 +129,9 @@ static X509_SIG *p8info_to_encp8(PKCS8_PRIV_KEY_INFO *p8info, static X509_SIG *key_to_encp8(const void *key, int key_nid, void *params, int params_type, i2d_of_void *k2d, - struct key2any_ctx_st *ctx) -{ - PKCS8_PRIV_KEY_INFO *p8info - = key_to_p8info(key, key_nid, params, params_type, k2d); + struct key2any_ctx_st *ctx) { + PKCS8_PRIV_KEY_INFO *p8info = + key_to_p8info(key, key_nid, params, params_type, k2d); X509_SIG *p8 = NULL; OQS_ENC_PRINTF("OQS ENC provider: key_to_encp8 called\n"); @@ -151,8 +147,7 @@ static X509_SIG *key_to_encp8(const void *key, int key_nid, void *params, static X509_PUBKEY *oqsx_key_to_pubkey(const void *key, int key_nid, void *params, int params_type, - i2d_of_void k2d) -{ + i2d_of_void k2d) { /* der, derlen store the key DER output and its length */ unsigned char *der = NULL; int derlen; @@ -162,8 +157,8 @@ static X509_PUBKEY *oqsx_key_to_pubkey(const void *key, int key_nid, OQS_ENC_PRINTF2("OQS ENC provider: oqsx_key_to_pubkey called for NID %d\n", key_nid); - if ((xpk = X509_PUBKEY_new()) == NULL || (derlen = k2d(key, &der)) <= 0 - || !X509_PUBKEY_set0_param( + if ((xpk = X509_PUBKEY_new()) == NULL || (derlen = k2d(key, &der)) <= 0 || + !X509_PUBKEY_set0_param( xpk, OBJ_nid2obj(key_nid), V_ASN1_UNDEF, NULL, // as per logic in oqs_meth.c in oqs-openssl der, derlen)) { @@ -199,8 +194,7 @@ static int key_to_epki_der_priv_bio(BIO *out, const void *key, int key_nid, ossl_unused const char *pemname, key_to_paramstring_fn *p2s, i2d_of_void *k2d, - struct key2any_ctx_st *ctx) -{ + struct key2any_ctx_st *ctx) { int ret = 0; void *str = NULL; int strtype = V_ASN1_UNDEF; @@ -227,8 +221,7 @@ static int key_to_epki_pem_priv_bio(BIO *out, const void *key, int key_nid, ossl_unused const char *pemname, key_to_paramstring_fn *p2s, i2d_of_void *k2d, - struct key2any_ctx_st *ctx) -{ + struct key2any_ctx_st *ctx) { int ret = 0; void *str = NULL; int strtype = V_ASN1_UNDEF; @@ -254,8 +247,7 @@ static int key_to_epki_pem_priv_bio(BIO *out, const void *key, int key_nid, static int key_to_pki_der_priv_bio(BIO *out, const void *key, int key_nid, ossl_unused const char *pemname, key_to_paramstring_fn *p2s, i2d_of_void *k2d, - struct key2any_ctx_st *ctx) -{ + struct key2any_ctx_st *ctx) { int ret = 0; void *str = NULL; int strtype = V_ASN1_UNDEF; @@ -285,8 +277,7 @@ static int key_to_pki_der_priv_bio(BIO *out, const void *key, int key_nid, static int key_to_pki_pem_priv_bio(BIO *out, const void *key, int key_nid, ossl_unused const char *pemname, key_to_paramstring_fn *p2s, i2d_of_void *k2d, - struct key2any_ctx_st *ctx) -{ + struct key2any_ctx_st *ctx) { int ret = 0, cmp_len = 0; void *str = NULL; int strtype = V_ASN1_UNDEF; @@ -315,8 +306,7 @@ static int key_to_pki_pem_priv_bio(BIO *out, const void *key, int key_nid, static int key_to_spki_der_pub_bio(BIO *out, const void *key, int key_nid, ossl_unused const char *pemname, key_to_paramstring_fn *p2s, i2d_of_void *k2d, - struct key2any_ctx_st *ctx) -{ + struct key2any_ctx_st *ctx) { int ret = 0; OQSX_KEY *okey = (OQSX_KEY *)key; X509_PUBKEY *xpk = NULL; @@ -340,8 +330,7 @@ static int key_to_spki_der_pub_bio(BIO *out, const void *key, int key_nid, static int key_to_spki_pem_pub_bio(BIO *out, const void *key, int key_nid, ossl_unused const char *pemname, key_to_paramstring_fn *p2s, i2d_of_void *k2d, - struct key2any_ctx_st *ctx) -{ + struct key2any_ctx_st *ctx) { int ret = 0; X509_PUBKEY *xpk = NULL; void *str = NULL; @@ -462,14 +451,13 @@ called\n"); /* ---------------------------------------------------------------------- */ static int prepare_oqsx_params(const void *oqsxkey, int nid, int save, - void **pstr, int *pstrtype) -{ + void **pstr, int *pstrtype) { ASN1_OBJECT *params = NULL; OQSX_KEY *k = (OQSX_KEY *)oqsxkey; - OQS_ENC_PRINTF3( - "OQS ENC provider: prepare_oqsx_params called with nid %d (tlsname: %s)\n", - nid, k->tls_name); + OQS_ENC_PRINTF3("OQS ENC provider: prepare_oqsx_params called with nid %d " + "(tlsname: %s)\n", + nid, k->tls_name); if (k->tls_name && OBJ_sn2nid(k->tls_name) != nid) { ERR_raise(ERR_LIB_USER, OQSPROV_R_INVALID_KEY); @@ -496,8 +484,7 @@ static int prepare_oqsx_params(const void *oqsxkey, int nid, int save, return 1; } -static int oqsx_spki_pub_to_der(const void *vxkey, unsigned char **pder) -{ +static int oqsx_spki_pub_to_der(const void *vxkey, unsigned char **pder) { const OQSX_KEY *oqsxkey = vxkey; unsigned char *keyblob, *buf; int keybloblen, nid, buflen = 0; @@ -522,12 +509,12 @@ static int oqsx_spki_pub_to_der(const void *vxkey, unsigned char **pder) } else { if ((sk = sk_ASN1_TYPE_new_null()) == NULL) return -1; - ASN1_TYPE **aType - = OPENSSL_malloc(oqsxkey->numkeys * sizeof(ASN1_TYPE *)); - ASN1_BIT_STRING **aString - = OPENSSL_malloc(oqsxkey->numkeys * sizeof(ASN1_BIT_STRING *)); - unsigned char **temp - = OPENSSL_malloc(oqsxkey->numkeys * sizeof(unsigned char *)); + ASN1_TYPE **aType = + OPENSSL_malloc(oqsxkey->numkeys * sizeof(ASN1_TYPE *)); + ASN1_BIT_STRING **aString = + OPENSSL_malloc(oqsxkey->numkeys * sizeof(ASN1_BIT_STRING *)); + unsigned char **temp = + OPENSSL_malloc(oqsxkey->numkeys * sizeof(unsigned char *)); size_t *templen = OPENSSL_malloc(oqsxkey->numkeys * sizeof(size_t)); int i; @@ -586,8 +573,7 @@ static int oqsx_spki_pub_to_der(const void *vxkey, unsigned char **pder) } } -static int oqsx_pki_priv_to_der(const void *vxkey, unsigned char **pder) -{ +static int oqsx_pki_priv_to_der(const void *vxkey, unsigned char **pder) { OQSX_KEY *oqsxkey = (OQSX_KEY *)vxkey; unsigned char *buf = NULL; uint32_t buflen = 0, privkeylen = 0; @@ -599,9 +585,9 @@ static int oqsx_pki_priv_to_der(const void *vxkey, unsigned char **pder) OQS_ENC_PRINTF("OQS ENC provider: oqsx_pki_priv_to_der called\n"); // Encoding private _and_ public key concatenated ... seems unlogical and - // unnecessary, but is what oqs-openssl does, so we repeat it for interop... - // also from a security perspective not really smart to copy key material - // (side channel attacks, anyone?), but so be it for now (TBC). + // unnecessary, but is what oqs-openssl does, so we repeat it for + // interop... also from a security perspective not really smart to copy key + // material (side channel attacks, anyone?), but so be it for now (TBC). if (oqsxkey == NULL || oqsxkey->privkey == NULL #ifndef NOPUBKEY_IN_PRIVKEY || oqsxkey->pubkey == NULL @@ -617,18 +603,18 @@ static int oqsx_pki_priv_to_der(const void *vxkey, unsigned char **pder) privkeylen = oqsxkey->privkeylen; if (oqsxkey->numkeys > 1) { // hybrid uint32_t actualprivkeylen = 0; - size_t fixed_pq_privkeylen - = oqsxkey->oqsx_provider_ctx.oqsx_qs_ctx.kem->length_secret_key; - size_t space_for_classical_privkey - = privkeylen - SIZE_OF_UINT32 - fixed_pq_privkeylen; + size_t fixed_pq_privkeylen = + oqsxkey->oqsx_provider_ctx.oqsx_qs_ctx.kem->length_secret_key; + size_t space_for_classical_privkey = + privkeylen - SIZE_OF_UINT32 - fixed_pq_privkeylen; DECODE_UINT32(actualprivkeylen, oqsxkey->privkey); - if ((actualprivkeylen > oqsxkey->evp_info->length_private_key) - || (actualprivkeylen > space_for_classical_privkey)) { + if ((actualprivkeylen > oqsxkey->evp_info->length_private_key) || + (actualprivkeylen > space_for_classical_privkey)) { ERR_raise(ERR_LIB_USER, OQSPROV_R_INVALID_ENCODING); return 0; } - privkeylen - -= (oqsxkey->evp_info->length_private_key - actualprivkeylen); + privkeylen -= + (oqsxkey->evp_info->length_private_key - actualprivkeylen); } #ifdef NOPUBKEY_IN_PRIVKEY buflen = privkeylen; @@ -668,12 +654,12 @@ static int oqsx_pki_priv_to_der(const void *vxkey, unsigned char **pder) } OPENSSL_secure_clear_free(buf, buflen); } else { - ASN1_TYPE **aType - = OPENSSL_malloc(oqsxkey->numkeys * sizeof(ASN1_TYPE *)); - ASN1_OCTET_STRING **aString - = OPENSSL_malloc(oqsxkey->numkeys * sizeof(ASN1_OCTET_STRING *)); - unsigned char **temp - = OPENSSL_malloc(oqsxkey->numkeys * sizeof(unsigned char *)); + ASN1_TYPE **aType = + OPENSSL_malloc(oqsxkey->numkeys * sizeof(ASN1_TYPE *)); + ASN1_OCTET_STRING **aString = + OPENSSL_malloc(oqsxkey->numkeys * sizeof(ASN1_OCTET_STRING *)); + unsigned char **temp = + OPENSSL_malloc(oqsxkey->numkeys * sizeof(unsigned char *)); size_t *templen = OPENSSL_malloc(oqsxkey->numkeys * sizeof(size_t)); PKCS8_PRIV_KEY_INFO *p8inf_internal = NULL; int i; @@ -689,8 +675,8 @@ static int oqsx_pki_priv_to_der(const void *vxkey, unsigned char **pder) int nid, version; void *pval; - if ((name = get_cmpname(OBJ_sn2nid(oqsxkey->tls_name), i)) - == NULL) { + if ((name = get_cmpname(OBJ_sn2nid(oqsxkey->tls_name), i)) == + NULL) { for (int j = 0; j <= i; j++) { OPENSSL_cleanse(aString[j]->data, aString[j]->length); ASN1_OCTET_STRING_free(aString[j]); @@ -714,12 +700,11 @@ static int oqsx_pki_priv_to_der(const void *vxkey, unsigned char **pder) } if (get_oqsname_fromtls(name) == 0) { - - nid = oqsxkey->oqsx_provider_ctx.oqsx_evp_ctx->evp_info - ->keytype; + nid = + oqsxkey->oqsx_provider_ctx.oqsx_evp_ctx->evp_info->keytype; if (nid == EVP_PKEY_RSA) { // get the RSA real key size - unsigned char *enc_len - = OPENSSL_strndup(oqsxkey->comp_privkey[i], 4); + unsigned char *enc_len = + OPENSSL_strndup(oqsxkey->comp_privkey[i], 4); OPENSSL_cleanse(enc_len, 2); DECODE_UINT32(buflen, enc_len); buflen += 4; @@ -780,16 +765,17 @@ static int oqsx_pki_priv_to_der(const void *vxkey, unsigned char **pder) ERR_raise(ERR_LIB_USER, ERR_R_MALLOC_FAILURE); return -1; } - if (get_oqsname_fromtls(name) - != 0) { // include pubkey in privkey for PQC + if (get_oqsname_fromtls(name) != + 0) { // include pubkey in privkey for PQC memcpy(buf, oqsxkey->comp_privkey[i], oqsxkey->privkeylen_cmp[i]); memcpy(buf + oqsxkey->privkeylen_cmp[i], oqsxkey->comp_pubkey[i], oqsxkey->pubkeylen_cmp[i]); } else { memcpy(buf, oqsxkey->comp_privkey[i], - buflen); // buflen for classical (RSA) might be different - // from oqsxkey->privkeylen_cmp[ + buflen); // buflen for classical (RSA) + // might be different from + // oqsxkey->privkeylen_cmp[ } if (nid == EVP_PKEY_EC) { // add the curve OID with the ECPubkey OID @@ -816,17 +802,18 @@ static int oqsx_pki_priv_to_der(const void *vxkey, unsigned char **pder) OPENSSL_free(aString); OPENSSL_free(temp); OPENSSL_free(templen); - OPENSSL_cleanse( - buf, - buflen); // buf is part of p8inf_internal so we cant free - // now, we cleanse it to remove pkey from memory + OPENSSL_cleanse(buf, + buflen); // buf is part of p8inf_internal so we + // cant free now, we cleanse it to + // remove pkey from memory PKCS8_PRIV_KEY_INFO_free(p8inf_internal); // this also free buf return -1; } - templen[i] = i2d_PKCS8_PRIV_KEY_INFO( - p8inf_internal, - &temp[i]); // create the privkey info for each individual key + templen[i] = + i2d_PKCS8_PRIV_KEY_INFO(p8inf_internal, + &temp[i]); // create the privkey info + // for each individual key ASN1_STRING_set(aString[i], temp[i], templen[i]); // add privkey info as ASN1_STRING ASN1_TYPE_set1(aType[i], V_ASN1_SEQUENCE, @@ -848,10 +835,10 @@ static int oqsx_pki_priv_to_der(const void *vxkey, unsigned char **pder) OPENSSL_free(aString); OPENSSL_free(temp); OPENSSL_free(templen); - OPENSSL_cleanse( - buf, - buflen); // buf is part of p8inf_internal so we cant free - // now, we cleanse it to remove pkey from memory + OPENSSL_cleanse(buf, + buflen); // buf is part of p8inf_internal so we + // cant free now, we cleanse it to + // remove pkey from memory PKCS8_PRIV_KEY_INFO_free(p8inf_internal); // this also free buf return -1; } @@ -892,353 +879,353 @@ static int oqsx_pki_priv_to_der(const void *vxkey, unsigned char **pder) // OQS provider uses NIDs generated at load time as EVP_type identifiers // so initially this must be 0 and set to a real value by OBJ_sn2nid later ///// OQS_TEMPLATE_FRAGMENT_ENCODER_DEFINES_START -#define frodo640aes_evp_type 0 +#define frodo640aes_evp_type 0 #define frodo640aes_input_type "frodo640aes" -#define frodo640aes_pem_type "frodo640aes" +#define frodo640aes_pem_type "frodo640aes" -#define p256_frodo640aes_evp_type 0 -#define p256_frodo640aes_input_type "p256_frodo640aes" -#define p256_frodo640aes_pem_type "p256_frodo640aes" -#define x25519_frodo640aes_evp_type 0 +#define p256_frodo640aes_evp_type 0 +#define p256_frodo640aes_input_type "p256_frodo640aes" +#define p256_frodo640aes_pem_type "p256_frodo640aes" +#define x25519_frodo640aes_evp_type 0 #define x25519_frodo640aes_input_type "x25519_frodo640aes" -#define x25519_frodo640aes_pem_type "x25519_frodo640aes" -#define frodo640shake_evp_type 0 -#define frodo640shake_input_type "frodo640shake" -#define frodo640shake_pem_type "frodo640shake" - -#define p256_frodo640shake_evp_type 0 -#define p256_frodo640shake_input_type "p256_frodo640shake" -#define p256_frodo640shake_pem_type "p256_frodo640shake" -#define x25519_frodo640shake_evp_type 0 +#define x25519_frodo640aes_pem_type "x25519_frodo640aes" +#define frodo640shake_evp_type 0 +#define frodo640shake_input_type "frodo640shake" +#define frodo640shake_pem_type "frodo640shake" + +#define p256_frodo640shake_evp_type 0 +#define p256_frodo640shake_input_type "p256_frodo640shake" +#define p256_frodo640shake_pem_type "p256_frodo640shake" +#define x25519_frodo640shake_evp_type 0 #define x25519_frodo640shake_input_type "x25519_frodo640shake" -#define x25519_frodo640shake_pem_type "x25519_frodo640shake" -#define frodo976aes_evp_type 0 -#define frodo976aes_input_type "frodo976aes" -#define frodo976aes_pem_type "frodo976aes" +#define x25519_frodo640shake_pem_type "x25519_frodo640shake" +#define frodo976aes_evp_type 0 +#define frodo976aes_input_type "frodo976aes" +#define frodo976aes_pem_type "frodo976aes" -#define p384_frodo976aes_evp_type 0 +#define p384_frodo976aes_evp_type 0 #define p384_frodo976aes_input_type "p384_frodo976aes" -#define p384_frodo976aes_pem_type "p384_frodo976aes" -#define x448_frodo976aes_evp_type 0 +#define p384_frodo976aes_pem_type "p384_frodo976aes" +#define x448_frodo976aes_evp_type 0 #define x448_frodo976aes_input_type "x448_frodo976aes" -#define x448_frodo976aes_pem_type "x448_frodo976aes" -#define frodo976shake_evp_type 0 -#define frodo976shake_input_type "frodo976shake" -#define frodo976shake_pem_type "frodo976shake" +#define x448_frodo976aes_pem_type "x448_frodo976aes" +#define frodo976shake_evp_type 0 +#define frodo976shake_input_type "frodo976shake" +#define frodo976shake_pem_type "frodo976shake" -#define p384_frodo976shake_evp_type 0 +#define p384_frodo976shake_evp_type 0 #define p384_frodo976shake_input_type "p384_frodo976shake" -#define p384_frodo976shake_pem_type "p384_frodo976shake" -#define x448_frodo976shake_evp_type 0 +#define p384_frodo976shake_pem_type "p384_frodo976shake" +#define x448_frodo976shake_evp_type 0 #define x448_frodo976shake_input_type "x448_frodo976shake" -#define x448_frodo976shake_pem_type "x448_frodo976shake" -#define frodo1344aes_evp_type 0 -#define frodo1344aes_input_type "frodo1344aes" -#define frodo1344aes_pem_type "frodo1344aes" +#define x448_frodo976shake_pem_type "x448_frodo976shake" +#define frodo1344aes_evp_type 0 +#define frodo1344aes_input_type "frodo1344aes" +#define frodo1344aes_pem_type "frodo1344aes" -#define p521_frodo1344aes_evp_type 0 +#define p521_frodo1344aes_evp_type 0 #define p521_frodo1344aes_input_type "p521_frodo1344aes" -#define p521_frodo1344aes_pem_type "p521_frodo1344aes" -#define frodo1344shake_evp_type 0 -#define frodo1344shake_input_type "frodo1344shake" -#define frodo1344shake_pem_type "frodo1344shake" +#define p521_frodo1344aes_pem_type "p521_frodo1344aes" +#define frodo1344shake_evp_type 0 +#define frodo1344shake_input_type "frodo1344shake" +#define frodo1344shake_pem_type "frodo1344shake" -#define p521_frodo1344shake_evp_type 0 +#define p521_frodo1344shake_evp_type 0 #define p521_frodo1344shake_input_type "p521_frodo1344shake" -#define p521_frodo1344shake_pem_type "p521_frodo1344shake" -#define kyber512_evp_type 0 -#define kyber512_input_type "kyber512" -#define kyber512_pem_type "kyber512" - -#define p256_kyber512_evp_type 0 -#define p256_kyber512_input_type "p256_kyber512" -#define p256_kyber512_pem_type "p256_kyber512" -#define x25519_kyber512_evp_type 0 +#define p521_frodo1344shake_pem_type "p521_frodo1344shake" +#define kyber512_evp_type 0 +#define kyber512_input_type "kyber512" +#define kyber512_pem_type "kyber512" + +#define p256_kyber512_evp_type 0 +#define p256_kyber512_input_type "p256_kyber512" +#define p256_kyber512_pem_type "p256_kyber512" +#define x25519_kyber512_evp_type 0 #define x25519_kyber512_input_type "x25519_kyber512" -#define x25519_kyber512_pem_type "x25519_kyber512" -#define kyber768_evp_type 0 -#define kyber768_input_type "kyber768" -#define kyber768_pem_type "kyber768" - -#define p384_kyber768_evp_type 0 -#define p384_kyber768_input_type "p384_kyber768" -#define p384_kyber768_pem_type "p384_kyber768" -#define x448_kyber768_evp_type 0 -#define x448_kyber768_input_type "x448_kyber768" -#define x448_kyber768_pem_type "x448_kyber768" -#define x25519_kyber768_evp_type 0 +#define x25519_kyber512_pem_type "x25519_kyber512" +#define kyber768_evp_type 0 +#define kyber768_input_type "kyber768" +#define kyber768_pem_type "kyber768" + +#define p384_kyber768_evp_type 0 +#define p384_kyber768_input_type "p384_kyber768" +#define p384_kyber768_pem_type "p384_kyber768" +#define x448_kyber768_evp_type 0 +#define x448_kyber768_input_type "x448_kyber768" +#define x448_kyber768_pem_type "x448_kyber768" +#define x25519_kyber768_evp_type 0 #define x25519_kyber768_input_type "x25519_kyber768" -#define x25519_kyber768_pem_type "x25519_kyber768" -#define p256_kyber768_evp_type 0 -#define p256_kyber768_input_type "p256_kyber768" -#define p256_kyber768_pem_type "p256_kyber768" -#define kyber1024_evp_type 0 -#define kyber1024_input_type "kyber1024" -#define kyber1024_pem_type "kyber1024" - -#define p521_kyber1024_evp_type 0 +#define x25519_kyber768_pem_type "x25519_kyber768" +#define p256_kyber768_evp_type 0 +#define p256_kyber768_input_type "p256_kyber768" +#define p256_kyber768_pem_type "p256_kyber768" +#define kyber1024_evp_type 0 +#define kyber1024_input_type "kyber1024" +#define kyber1024_pem_type "kyber1024" + +#define p521_kyber1024_evp_type 0 #define p521_kyber1024_input_type "p521_kyber1024" -#define p521_kyber1024_pem_type "p521_kyber1024" -#define mlkem512_evp_type 0 -#define mlkem512_input_type "mlkem512" -#define mlkem512_pem_type "mlkem512" - -#define p256_mlkem512_evp_type 0 -#define p256_mlkem512_input_type "p256_mlkem512" -#define p256_mlkem512_pem_type "p256_mlkem512" -#define x25519_mlkem512_evp_type 0 +#define p521_kyber1024_pem_type "p521_kyber1024" +#define mlkem512_evp_type 0 +#define mlkem512_input_type "mlkem512" +#define mlkem512_pem_type "mlkem512" + +#define p256_mlkem512_evp_type 0 +#define p256_mlkem512_input_type "p256_mlkem512" +#define p256_mlkem512_pem_type "p256_mlkem512" +#define x25519_mlkem512_evp_type 0 #define x25519_mlkem512_input_type "x25519_mlkem512" -#define x25519_mlkem512_pem_type "x25519_mlkem512" -#define mlkem768_evp_type 0 -#define mlkem768_input_type "mlkem768" -#define mlkem768_pem_type "mlkem768" - -#define p384_mlkem768_evp_type 0 -#define p384_mlkem768_input_type "p384_mlkem768" -#define p384_mlkem768_pem_type "p384_mlkem768" -#define x448_mlkem768_evp_type 0 -#define x448_mlkem768_input_type "x448_mlkem768" -#define x448_mlkem768_pem_type "x448_mlkem768" -#define x25519_mlkem768_evp_type 0 +#define x25519_mlkem512_pem_type "x25519_mlkem512" +#define mlkem768_evp_type 0 +#define mlkem768_input_type "mlkem768" +#define mlkem768_pem_type "mlkem768" + +#define p384_mlkem768_evp_type 0 +#define p384_mlkem768_input_type "p384_mlkem768" +#define p384_mlkem768_pem_type "p384_mlkem768" +#define x448_mlkem768_evp_type 0 +#define x448_mlkem768_input_type "x448_mlkem768" +#define x448_mlkem768_pem_type "x448_mlkem768" +#define x25519_mlkem768_evp_type 0 #define x25519_mlkem768_input_type "x25519_mlkem768" -#define x25519_mlkem768_pem_type "x25519_mlkem768" -#define p256_mlkem768_evp_type 0 -#define p256_mlkem768_input_type "p256_mlkem768" -#define p256_mlkem768_pem_type "p256_mlkem768" -#define mlkem1024_evp_type 0 -#define mlkem1024_input_type "mlkem1024" -#define mlkem1024_pem_type "mlkem1024" - -#define p521_mlkem1024_evp_type 0 +#define x25519_mlkem768_pem_type "x25519_mlkem768" +#define p256_mlkem768_evp_type 0 +#define p256_mlkem768_input_type "p256_mlkem768" +#define p256_mlkem768_pem_type "p256_mlkem768" +#define mlkem1024_evp_type 0 +#define mlkem1024_input_type "mlkem1024" +#define mlkem1024_pem_type "mlkem1024" + +#define p521_mlkem1024_evp_type 0 #define p521_mlkem1024_input_type "p521_mlkem1024" -#define p521_mlkem1024_pem_type "p521_mlkem1024" -#define p384_mlkem1024_evp_type 0 +#define p521_mlkem1024_pem_type "p521_mlkem1024" +#define p384_mlkem1024_evp_type 0 #define p384_mlkem1024_input_type "p384_mlkem1024" -#define p384_mlkem1024_pem_type "p384_mlkem1024" -#define bikel1_evp_type 0 -#define bikel1_input_type "bikel1" -#define bikel1_pem_type "bikel1" - -#define p256_bikel1_evp_type 0 -#define p256_bikel1_input_type "p256_bikel1" -#define p256_bikel1_pem_type "p256_bikel1" -#define x25519_bikel1_evp_type 0 +#define p384_mlkem1024_pem_type "p384_mlkem1024" +#define bikel1_evp_type 0 +#define bikel1_input_type "bikel1" +#define bikel1_pem_type "bikel1" + +#define p256_bikel1_evp_type 0 +#define p256_bikel1_input_type "p256_bikel1" +#define p256_bikel1_pem_type "p256_bikel1" +#define x25519_bikel1_evp_type 0 #define x25519_bikel1_input_type "x25519_bikel1" -#define x25519_bikel1_pem_type "x25519_bikel1" -#define bikel3_evp_type 0 -#define bikel3_input_type "bikel3" -#define bikel3_pem_type "bikel3" +#define x25519_bikel1_pem_type "x25519_bikel1" +#define bikel3_evp_type 0 +#define bikel3_input_type "bikel3" +#define bikel3_pem_type "bikel3" -#define p384_bikel3_evp_type 0 +#define p384_bikel3_evp_type 0 #define p384_bikel3_input_type "p384_bikel3" -#define p384_bikel3_pem_type "p384_bikel3" -#define x448_bikel3_evp_type 0 +#define p384_bikel3_pem_type "p384_bikel3" +#define x448_bikel3_evp_type 0 #define x448_bikel3_input_type "x448_bikel3" -#define x448_bikel3_pem_type "x448_bikel3" -#define bikel5_evp_type 0 -#define bikel5_input_type "bikel5" -#define bikel5_pem_type "bikel5" +#define x448_bikel3_pem_type "x448_bikel3" +#define bikel5_evp_type 0 +#define bikel5_input_type "bikel5" +#define bikel5_pem_type "bikel5" -#define p521_bikel5_evp_type 0 +#define p521_bikel5_evp_type 0 #define p521_bikel5_input_type "p521_bikel5" -#define p521_bikel5_pem_type "p521_bikel5" -#define hqc128_evp_type 0 -#define hqc128_input_type "hqc128" -#define hqc128_pem_type "hqc128" - -#define p256_hqc128_evp_type 0 -#define p256_hqc128_input_type "p256_hqc128" -#define p256_hqc128_pem_type "p256_hqc128" -#define x25519_hqc128_evp_type 0 +#define p521_bikel5_pem_type "p521_bikel5" +#define hqc128_evp_type 0 +#define hqc128_input_type "hqc128" +#define hqc128_pem_type "hqc128" + +#define p256_hqc128_evp_type 0 +#define p256_hqc128_input_type "p256_hqc128" +#define p256_hqc128_pem_type "p256_hqc128" +#define x25519_hqc128_evp_type 0 #define x25519_hqc128_input_type "x25519_hqc128" -#define x25519_hqc128_pem_type "x25519_hqc128" -#define hqc192_evp_type 0 -#define hqc192_input_type "hqc192" -#define hqc192_pem_type "hqc192" +#define x25519_hqc128_pem_type "x25519_hqc128" +#define hqc192_evp_type 0 +#define hqc192_input_type "hqc192" +#define hqc192_pem_type "hqc192" -#define p384_hqc192_evp_type 0 +#define p384_hqc192_evp_type 0 #define p384_hqc192_input_type "p384_hqc192" -#define p384_hqc192_pem_type "p384_hqc192" -#define x448_hqc192_evp_type 0 +#define p384_hqc192_pem_type "p384_hqc192" +#define x448_hqc192_evp_type 0 #define x448_hqc192_input_type "x448_hqc192" -#define x448_hqc192_pem_type "x448_hqc192" -#define hqc256_evp_type 0 -#define hqc256_input_type "hqc256" -#define hqc256_pem_type "hqc256" +#define x448_hqc192_pem_type "x448_hqc192" +#define hqc256_evp_type 0 +#define hqc256_input_type "hqc256" +#define hqc256_pem_type "hqc256" -#define p521_hqc256_evp_type 0 +#define p521_hqc256_evp_type 0 #define p521_hqc256_input_type "p521_hqc256" -#define p521_hqc256_pem_type "p521_hqc256" - -#define dilithium2_evp_type 0 -#define dilithium2_input_type "dilithium2" -#define dilithium2_pem_type "dilithium2" -#define p256_dilithium2_evp_type 0 -#define p256_dilithium2_input_type "p256_dilithium2" -#define p256_dilithium2_pem_type "p256_dilithium2" -#define rsa3072_dilithium2_evp_type 0 -#define rsa3072_dilithium2_input_type "rsa3072_dilithium2" -#define rsa3072_dilithium2_pem_type "rsa3072_dilithium2" -#define dilithium3_evp_type 0 -#define dilithium3_input_type "dilithium3" -#define dilithium3_pem_type "dilithium3" -#define p384_dilithium3_evp_type 0 -#define p384_dilithium3_input_type "p384_dilithium3" -#define p384_dilithium3_pem_type "p384_dilithium3" -#define dilithium5_evp_type 0 -#define dilithium5_input_type "dilithium5" -#define dilithium5_pem_type "dilithium5" -#define p521_dilithium5_evp_type 0 -#define p521_dilithium5_input_type "p521_dilithium5" -#define p521_dilithium5_pem_type "p521_dilithium5" -#define mldsa44_evp_type 0 -#define mldsa44_input_type "mldsa44" -#define mldsa44_pem_type "mldsa44" -#define p256_mldsa44_evp_type 0 -#define p256_mldsa44_input_type "p256_mldsa44" -#define p256_mldsa44_pem_type "p256_mldsa44" -#define rsa3072_mldsa44_evp_type 0 -#define rsa3072_mldsa44_input_type "rsa3072_mldsa44" -#define rsa3072_mldsa44_pem_type "rsa3072_mldsa44" -#define mldsa44_pss2048_evp_type 0 -#define mldsa44_pss2048_input_type "mldsa44_pss2048" -#define mldsa44_pss2048_pem_type "mldsa44_pss2048" -#define mldsa44_rsa2048_evp_type 0 -#define mldsa44_rsa2048_input_type "mldsa44_rsa2048" -#define mldsa44_rsa2048_pem_type "mldsa44_rsa2048" -#define mldsa44_ed25519_evp_type 0 -#define mldsa44_ed25519_input_type "mldsa44_ed25519" -#define mldsa44_ed25519_pem_type "mldsa44_ed25519" -#define mldsa44_p256_evp_type 0 -#define mldsa44_p256_input_type "mldsa44_p256" -#define mldsa44_p256_pem_type "mldsa44_p256" -#define mldsa44_bp256_evp_type 0 -#define mldsa44_bp256_input_type "mldsa44_bp256" -#define mldsa44_bp256_pem_type "mldsa44_bp256" -#define mldsa65_evp_type 0 -#define mldsa65_input_type "mldsa65" -#define mldsa65_pem_type "mldsa65" -#define p384_mldsa65_evp_type 0 -#define p384_mldsa65_input_type "p384_mldsa65" -#define p384_mldsa65_pem_type "p384_mldsa65" -#define mldsa65_pss3072_evp_type 0 -#define mldsa65_pss3072_input_type "mldsa65_pss3072" -#define mldsa65_pss3072_pem_type "mldsa65_pss3072" -#define mldsa65_rsa3072_evp_type 0 -#define mldsa65_rsa3072_input_type "mldsa65_rsa3072" -#define mldsa65_rsa3072_pem_type "mldsa65_rsa3072" -#define mldsa65_p256_evp_type 0 -#define mldsa65_p256_input_type "mldsa65_p256" -#define mldsa65_p256_pem_type "mldsa65_p256" -#define mldsa65_bp256_evp_type 0 -#define mldsa65_bp256_input_type "mldsa65_bp256" -#define mldsa65_bp256_pem_type "mldsa65_bp256" -#define mldsa65_ed25519_evp_type 0 -#define mldsa65_ed25519_input_type "mldsa65_ed25519" -#define mldsa65_ed25519_pem_type "mldsa65_ed25519" -#define mldsa87_evp_type 0 -#define mldsa87_input_type "mldsa87" -#define mldsa87_pem_type "mldsa87" -#define p521_mldsa87_evp_type 0 -#define p521_mldsa87_input_type "p521_mldsa87" -#define p521_mldsa87_pem_type "p521_mldsa87" -#define mldsa87_p384_evp_type 0 -#define mldsa87_p384_input_type "mldsa87_p384" -#define mldsa87_p384_pem_type "mldsa87_p384" -#define mldsa87_bp384_evp_type 0 -#define mldsa87_bp384_input_type "mldsa87_bp384" -#define mldsa87_bp384_pem_type "mldsa87_bp384" -#define mldsa87_ed448_evp_type 0 -#define mldsa87_ed448_input_type "mldsa87_ed448" -#define mldsa87_ed448_pem_type "mldsa87_ed448" -#define falcon512_evp_type 0 -#define falcon512_input_type "falcon512" -#define falcon512_pem_type "falcon512" -#define p256_falcon512_evp_type 0 -#define p256_falcon512_input_type "p256_falcon512" -#define p256_falcon512_pem_type "p256_falcon512" -#define rsa3072_falcon512_evp_type 0 -#define rsa3072_falcon512_input_type "rsa3072_falcon512" -#define rsa3072_falcon512_pem_type "rsa3072_falcon512" -#define falconpadded512_evp_type 0 -#define falconpadded512_input_type "falconpadded512" -#define falconpadded512_pem_type "falconpadded512" -#define p256_falconpadded512_evp_type 0 -#define p256_falconpadded512_input_type "p256_falconpadded512" -#define p256_falconpadded512_pem_type "p256_falconpadded512" -#define rsa3072_falconpadded512_evp_type 0 -#define rsa3072_falconpadded512_input_type "rsa3072_falconpadded512" -#define rsa3072_falconpadded512_pem_type "rsa3072_falconpadded512" -#define falcon1024_evp_type 0 -#define falcon1024_input_type "falcon1024" -#define falcon1024_pem_type "falcon1024" -#define p521_falcon1024_evp_type 0 -#define p521_falcon1024_input_type "p521_falcon1024" -#define p521_falcon1024_pem_type "p521_falcon1024" -#define falconpadded1024_evp_type 0 -#define falconpadded1024_input_type "falconpadded1024" -#define falconpadded1024_pem_type "falconpadded1024" -#define p521_falconpadded1024_evp_type 0 -#define p521_falconpadded1024_input_type "p521_falconpadded1024" -#define p521_falconpadded1024_pem_type "p521_falconpadded1024" -#define sphincssha2128fsimple_evp_type 0 -#define sphincssha2128fsimple_input_type "sphincssha2128fsimple" -#define sphincssha2128fsimple_pem_type "sphincssha2128fsimple" -#define p256_sphincssha2128fsimple_evp_type 0 -#define p256_sphincssha2128fsimple_input_type "p256_sphincssha2128fsimple" -#define p256_sphincssha2128fsimple_pem_type "p256_sphincssha2128fsimple" -#define rsa3072_sphincssha2128fsimple_evp_type 0 +#define p521_hqc256_pem_type "p521_hqc256" + +#define dilithium2_evp_type 0 +#define dilithium2_input_type "dilithium2" +#define dilithium2_pem_type "dilithium2" +#define p256_dilithium2_evp_type 0 +#define p256_dilithium2_input_type "p256_dilithium2" +#define p256_dilithium2_pem_type "p256_dilithium2" +#define rsa3072_dilithium2_evp_type 0 +#define rsa3072_dilithium2_input_type "rsa3072_dilithium2" +#define rsa3072_dilithium2_pem_type "rsa3072_dilithium2" +#define dilithium3_evp_type 0 +#define dilithium3_input_type "dilithium3" +#define dilithium3_pem_type "dilithium3" +#define p384_dilithium3_evp_type 0 +#define p384_dilithium3_input_type "p384_dilithium3" +#define p384_dilithium3_pem_type "p384_dilithium3" +#define dilithium5_evp_type 0 +#define dilithium5_input_type "dilithium5" +#define dilithium5_pem_type "dilithium5" +#define p521_dilithium5_evp_type 0 +#define p521_dilithium5_input_type "p521_dilithium5" +#define p521_dilithium5_pem_type "p521_dilithium5" +#define mldsa44_evp_type 0 +#define mldsa44_input_type "mldsa44" +#define mldsa44_pem_type "mldsa44" +#define p256_mldsa44_evp_type 0 +#define p256_mldsa44_input_type "p256_mldsa44" +#define p256_mldsa44_pem_type "p256_mldsa44" +#define rsa3072_mldsa44_evp_type 0 +#define rsa3072_mldsa44_input_type "rsa3072_mldsa44" +#define rsa3072_mldsa44_pem_type "rsa3072_mldsa44" +#define mldsa44_pss2048_evp_type 0 +#define mldsa44_pss2048_input_type "mldsa44_pss2048" +#define mldsa44_pss2048_pem_type "mldsa44_pss2048" +#define mldsa44_rsa2048_evp_type 0 +#define mldsa44_rsa2048_input_type "mldsa44_rsa2048" +#define mldsa44_rsa2048_pem_type "mldsa44_rsa2048" +#define mldsa44_ed25519_evp_type 0 +#define mldsa44_ed25519_input_type "mldsa44_ed25519" +#define mldsa44_ed25519_pem_type "mldsa44_ed25519" +#define mldsa44_p256_evp_type 0 +#define mldsa44_p256_input_type "mldsa44_p256" +#define mldsa44_p256_pem_type "mldsa44_p256" +#define mldsa44_bp256_evp_type 0 +#define mldsa44_bp256_input_type "mldsa44_bp256" +#define mldsa44_bp256_pem_type "mldsa44_bp256" +#define mldsa65_evp_type 0 +#define mldsa65_input_type "mldsa65" +#define mldsa65_pem_type "mldsa65" +#define p384_mldsa65_evp_type 0 +#define p384_mldsa65_input_type "p384_mldsa65" +#define p384_mldsa65_pem_type "p384_mldsa65" +#define mldsa65_pss3072_evp_type 0 +#define mldsa65_pss3072_input_type "mldsa65_pss3072" +#define mldsa65_pss3072_pem_type "mldsa65_pss3072" +#define mldsa65_rsa3072_evp_type 0 +#define mldsa65_rsa3072_input_type "mldsa65_rsa3072" +#define mldsa65_rsa3072_pem_type "mldsa65_rsa3072" +#define mldsa65_p256_evp_type 0 +#define mldsa65_p256_input_type "mldsa65_p256" +#define mldsa65_p256_pem_type "mldsa65_p256" +#define mldsa65_bp256_evp_type 0 +#define mldsa65_bp256_input_type "mldsa65_bp256" +#define mldsa65_bp256_pem_type "mldsa65_bp256" +#define mldsa65_ed25519_evp_type 0 +#define mldsa65_ed25519_input_type "mldsa65_ed25519" +#define mldsa65_ed25519_pem_type "mldsa65_ed25519" +#define mldsa87_evp_type 0 +#define mldsa87_input_type "mldsa87" +#define mldsa87_pem_type "mldsa87" +#define p521_mldsa87_evp_type 0 +#define p521_mldsa87_input_type "p521_mldsa87" +#define p521_mldsa87_pem_type "p521_mldsa87" +#define mldsa87_p384_evp_type 0 +#define mldsa87_p384_input_type "mldsa87_p384" +#define mldsa87_p384_pem_type "mldsa87_p384" +#define mldsa87_bp384_evp_type 0 +#define mldsa87_bp384_input_type "mldsa87_bp384" +#define mldsa87_bp384_pem_type "mldsa87_bp384" +#define mldsa87_ed448_evp_type 0 +#define mldsa87_ed448_input_type "mldsa87_ed448" +#define mldsa87_ed448_pem_type "mldsa87_ed448" +#define falcon512_evp_type 0 +#define falcon512_input_type "falcon512" +#define falcon512_pem_type "falcon512" +#define p256_falcon512_evp_type 0 +#define p256_falcon512_input_type "p256_falcon512" +#define p256_falcon512_pem_type "p256_falcon512" +#define rsa3072_falcon512_evp_type 0 +#define rsa3072_falcon512_input_type "rsa3072_falcon512" +#define rsa3072_falcon512_pem_type "rsa3072_falcon512" +#define falconpadded512_evp_type 0 +#define falconpadded512_input_type "falconpadded512" +#define falconpadded512_pem_type "falconpadded512" +#define p256_falconpadded512_evp_type 0 +#define p256_falconpadded512_input_type "p256_falconpadded512" +#define p256_falconpadded512_pem_type "p256_falconpadded512" +#define rsa3072_falconpadded512_evp_type 0 +#define rsa3072_falconpadded512_input_type "rsa3072_falconpadded512" +#define rsa3072_falconpadded512_pem_type "rsa3072_falconpadded512" +#define falcon1024_evp_type 0 +#define falcon1024_input_type "falcon1024" +#define falcon1024_pem_type "falcon1024" +#define p521_falcon1024_evp_type 0 +#define p521_falcon1024_input_type "p521_falcon1024" +#define p521_falcon1024_pem_type "p521_falcon1024" +#define falconpadded1024_evp_type 0 +#define falconpadded1024_input_type "falconpadded1024" +#define falconpadded1024_pem_type "falconpadded1024" +#define p521_falconpadded1024_evp_type 0 +#define p521_falconpadded1024_input_type "p521_falconpadded1024" +#define p521_falconpadded1024_pem_type "p521_falconpadded1024" +#define sphincssha2128fsimple_evp_type 0 +#define sphincssha2128fsimple_input_type "sphincssha2128fsimple" +#define sphincssha2128fsimple_pem_type "sphincssha2128fsimple" +#define p256_sphincssha2128fsimple_evp_type 0 +#define p256_sphincssha2128fsimple_input_type "p256_sphincssha2128fsimple" +#define p256_sphincssha2128fsimple_pem_type "p256_sphincssha2128fsimple" +#define rsa3072_sphincssha2128fsimple_evp_type 0 #define rsa3072_sphincssha2128fsimple_input_type "rsa3072_sphincssha2128fsimple" -#define rsa3072_sphincssha2128fsimple_pem_type "rsa3072_sphincssha2128fsimple" -#define sphincssha2128ssimple_evp_type 0 -#define sphincssha2128ssimple_input_type "sphincssha2128ssimple" -#define sphincssha2128ssimple_pem_type "sphincssha2128ssimple" -#define p256_sphincssha2128ssimple_evp_type 0 -#define p256_sphincssha2128ssimple_input_type "p256_sphincssha2128ssimple" -#define p256_sphincssha2128ssimple_pem_type "p256_sphincssha2128ssimple" -#define rsa3072_sphincssha2128ssimple_evp_type 0 +#define rsa3072_sphincssha2128fsimple_pem_type "rsa3072_sphincssha2128fsimple" +#define sphincssha2128ssimple_evp_type 0 +#define sphincssha2128ssimple_input_type "sphincssha2128ssimple" +#define sphincssha2128ssimple_pem_type "sphincssha2128ssimple" +#define p256_sphincssha2128ssimple_evp_type 0 +#define p256_sphincssha2128ssimple_input_type "p256_sphincssha2128ssimple" +#define p256_sphincssha2128ssimple_pem_type "p256_sphincssha2128ssimple" +#define rsa3072_sphincssha2128ssimple_evp_type 0 #define rsa3072_sphincssha2128ssimple_input_type "rsa3072_sphincssha2128ssimple" -#define rsa3072_sphincssha2128ssimple_pem_type "rsa3072_sphincssha2128ssimple" -#define sphincssha2192fsimple_evp_type 0 -#define sphincssha2192fsimple_input_type "sphincssha2192fsimple" -#define sphincssha2192fsimple_pem_type "sphincssha2192fsimple" -#define p384_sphincssha2192fsimple_evp_type 0 -#define p384_sphincssha2192fsimple_input_type "p384_sphincssha2192fsimple" -#define p384_sphincssha2192fsimple_pem_type "p384_sphincssha2192fsimple" -#define sphincsshake128fsimple_evp_type 0 -#define sphincsshake128fsimple_input_type "sphincsshake128fsimple" -#define sphincsshake128fsimple_pem_type "sphincsshake128fsimple" -#define p256_sphincsshake128fsimple_evp_type 0 -#define p256_sphincsshake128fsimple_input_type "p256_sphincsshake128fsimple" -#define p256_sphincsshake128fsimple_pem_type "p256_sphincsshake128fsimple" -#define rsa3072_sphincsshake128fsimple_evp_type 0 -#define rsa3072_sphincsshake128fsimple_input_type \ +#define rsa3072_sphincssha2128ssimple_pem_type "rsa3072_sphincssha2128ssimple" +#define sphincssha2192fsimple_evp_type 0 +#define sphincssha2192fsimple_input_type "sphincssha2192fsimple" +#define sphincssha2192fsimple_pem_type "sphincssha2192fsimple" +#define p384_sphincssha2192fsimple_evp_type 0 +#define p384_sphincssha2192fsimple_input_type "p384_sphincssha2192fsimple" +#define p384_sphincssha2192fsimple_pem_type "p384_sphincssha2192fsimple" +#define sphincsshake128fsimple_evp_type 0 +#define sphincsshake128fsimple_input_type "sphincsshake128fsimple" +#define sphincsshake128fsimple_pem_type "sphincsshake128fsimple" +#define p256_sphincsshake128fsimple_evp_type 0 +#define p256_sphincsshake128fsimple_input_type "p256_sphincsshake128fsimple" +#define p256_sphincsshake128fsimple_pem_type "p256_sphincsshake128fsimple" +#define rsa3072_sphincsshake128fsimple_evp_type 0 +#define rsa3072_sphincsshake128fsimple_input_type \ "rsa3072_sphincsshake128fsimple" #define rsa3072_sphincsshake128fsimple_pem_type "rsa3072_sphincsshake128fsimple" -#define mayo1_evp_type 0 -#define mayo1_input_type "mayo1" -#define mayo1_pem_type "mayo1" -#define p256_mayo1_evp_type 0 -#define p256_mayo1_input_type "p256_mayo1" -#define p256_mayo1_pem_type "p256_mayo1" -#define mayo2_evp_type 0 -#define mayo2_input_type "mayo2" -#define mayo2_pem_type "mayo2" -#define p256_mayo2_evp_type 0 -#define p256_mayo2_input_type "p256_mayo2" -#define p256_mayo2_pem_type "p256_mayo2" -#define mayo3_evp_type 0 -#define mayo3_input_type "mayo3" -#define mayo3_pem_type "mayo3" -#define p384_mayo3_evp_type 0 -#define p384_mayo3_input_type "p384_mayo3" -#define p384_mayo3_pem_type "p384_mayo3" -#define mayo5_evp_type 0 -#define mayo5_input_type "mayo5" -#define mayo5_pem_type "mayo5" -#define p521_mayo5_evp_type 0 -#define p521_mayo5_input_type "p521_mayo5" -#define p521_mayo5_pem_type "p521_mayo5" +#define mayo1_evp_type 0 +#define mayo1_input_type "mayo1" +#define mayo1_pem_type "mayo1" +#define p256_mayo1_evp_type 0 +#define p256_mayo1_input_type "p256_mayo1" +#define p256_mayo1_pem_type "p256_mayo1" +#define mayo2_evp_type 0 +#define mayo2_input_type "mayo2" +#define mayo2_pem_type "mayo2" +#define p256_mayo2_evp_type 0 +#define p256_mayo2_input_type "p256_mayo2" +#define p256_mayo2_pem_type "p256_mayo2" +#define mayo3_evp_type 0 +#define mayo3_input_type "mayo3" +#define mayo3_pem_type "mayo3" +#define p384_mayo3_evp_type 0 +#define p384_mayo3_input_type "p384_mayo3" +#define p384_mayo3_pem_type "p384_mayo3" +#define mayo5_evp_type 0 +#define mayo5_input_type "mayo5" +#define mayo5_pem_type "mayo5" +#define p521_mayo5_evp_type 0 +#define p521_mayo5_input_type "p521_mayo5" +#define p521_mayo5_pem_type "p521_mayo5" ///// OQS_TEMPLATE_FRAGMENT_ENCODER_DEFINES_END /* ---------------------------------------------------------------------- */ @@ -1246,8 +1233,7 @@ static int oqsx_pki_priv_to_der(const void *vxkey, unsigned char **pder) static OSSL_FUNC_decoder_newctx_fn key2any_newctx; static OSSL_FUNC_decoder_freectx_fn key2any_freectx; -static void *key2any_newctx(void *provctx) -{ +static void *key2any_newctx(void *provctx) { struct key2any_ctx_st *ctx = OPENSSL_zalloc(sizeof(*ctx)); OQS_ENC_PRINTF("OQS ENC provider: key2any_newctx called\n"); @@ -1260,8 +1246,7 @@ static void *key2any_newctx(void *provctx) return ctx; } -static void key2any_freectx(void *vctx) -{ +static void key2any_freectx(void *vctx) { struct key2any_ctx_st *ctx = vctx; OQS_ENC_PRINTF("OQS ENC provider: key2any_freectx called\n"); @@ -1270,8 +1255,8 @@ static void key2any_freectx(void *vctx) OPENSSL_free(ctx); } -static const OSSL_PARAM *key2any_settable_ctx_params(ossl_unused void *provctx) -{ +static const OSSL_PARAM * +key2any_settable_ctx_params(ossl_unused void *provctx) { static const OSSL_PARAM settables[] = { OSSL_PARAM_utf8_string(OSSL_ENCODER_PARAM_CIPHER, NULL, 0), OSSL_PARAM_utf8_string(OSSL_ENCODER_PARAM_PROPERTIES, NULL, 0), @@ -1283,16 +1268,15 @@ static const OSSL_PARAM *key2any_settable_ctx_params(ossl_unused void *provctx) return settables; } -static int key2any_set_ctx_params(void *vctx, const OSSL_PARAM params[]) -{ +static int key2any_set_ctx_params(void *vctx, const OSSL_PARAM params[]) { struct key2any_ctx_st *ctx = vctx; OSSL_LIB_CTX *libctx = ctx->provctx->libctx; - const OSSL_PARAM *cipherp - = OSSL_PARAM_locate_const(params, OSSL_ENCODER_PARAM_CIPHER); - const OSSL_PARAM *propsp - = OSSL_PARAM_locate_const(params, OSSL_ENCODER_PARAM_PROPERTIES); - const OSSL_PARAM *save_paramsp - = OSSL_PARAM_locate_const(params, OSSL_ENCODER_PARAM_SAVE_PARAMETERS); + const OSSL_PARAM *cipherp = + OSSL_PARAM_locate_const(params, OSSL_ENCODER_PARAM_CIPHER); + const OSSL_PARAM *propsp = + OSSL_PARAM_locate_const(params, OSSL_ENCODER_PARAM_PROPERTIES); + const OSSL_PARAM *save_paramsp = + OSSL_PARAM_locate_const(params, OSSL_ENCODER_PARAM_SAVE_PARAMETERS); OQS_ENC_PRINTF("OQS ENC provider: key2any_set_ctx_params called\n"); @@ -1309,9 +1293,8 @@ static int key2any_set_ctx_params(void *vctx, const OSSL_PARAM params[]) EVP_CIPHER_free(ctx->cipher); ctx->cipher = NULL; ctx->cipher_intent = ciphername != NULL; - if (ciphername != NULL - && ((ctx->cipher = EVP_CIPHER_fetch(libctx, ciphername, props)) - == NULL)) { + if (ciphername != NULL && ((ctx->cipher = EVP_CIPHER_fetch( + libctx, ciphername, props)) == NULL)) { return 0; } } @@ -1326,20 +1309,19 @@ static int key2any_set_ctx_params(void *vctx, const OSSL_PARAM params[]) return 1; } -static int key2any_check_selection(int selection, int selection_mask) -{ +static int key2any_check_selection(int selection, int selection_mask) { /* * The selections are kinda sorta "levels", i.e. each selection given * here is assumed to include those following. */ - int checks[] - = {OSSL_KEYMGMT_SELECT_PRIVATE_KEY, OSSL_KEYMGMT_SELECT_PUBLIC_KEY, - OSSL_KEYMGMT_SELECT_ALL_PARAMETERS}; + int checks[] = {OSSL_KEYMGMT_SELECT_PRIVATE_KEY, + OSSL_KEYMGMT_SELECT_PUBLIC_KEY, + OSSL_KEYMGMT_SELECT_ALL_PARAMETERS}; size_t i; - OQS_ENC_PRINTF3( - "OQS ENC provider: key2any_check_selection called with selection %d (%d)\n", - selection, selection_mask); + OQS_ENC_PRINTF3("OQS ENC provider: key2any_check_selection called with " + "selection %d (%d)\n", + selection, selection_mask); /* The decoder implementations made here support guessing */ if (selection == 0) @@ -1354,9 +1336,9 @@ static int key2any_check_selection(int selection, int selection_mask) * whether the decoder description says it's supported. */ if (check1) { - OQS_ENC_PRINTF2( - "OQS ENC provider: key2any_check_selection returns %d\n", - check2); + OQS_ENC_PRINTF2("OQS ENC provider: " + "key2any_check_selection returns %d\n", + check2); return check2; } } @@ -1370,8 +1352,7 @@ static int key2any_encode(struct key2any_ctx_st *ctx, OSSL_CORE_BIO *cout, const char *pemname, key_to_der_fn *writer, OSSL_PASSPHRASE_CALLBACK *pwcb, void *pwcbarg, key_to_paramstring_fn *key2paramstring, - i2d_of_void *key2der) -{ + i2d_of_void *key2der) { int ret = 0; int type = OBJ_sn2nid(typestr); OQSX_KEY *oqsk = (OQSX_KEY *)key; @@ -1393,8 +1374,8 @@ static int key2any_encode(struct key2any_ctx_st *ctx, OSSL_CORE_BIO *cout, ctx->pwcb = pwcb; ctx->pwcbarg = pwcbarg; - ret = writer(out, key, type, pemname, key2paramstring, key2der, - ctx); + ret = + writer(out, key, type, pemname, key2paramstring, key2der, ctx); } BIO_free(out); @@ -1406,27 +1387,27 @@ static int key2any_encode(struct key2any_ctx_st *ctx, OSSL_CORE_BIO *cout, } #define DO_PRIVATE_KEY_selection_mask OSSL_KEYMGMT_SELECT_PRIVATE_KEY -#define DO_PRIVATE_KEY(impl, type, kind, output) \ - if ((selection & DO_PRIVATE_KEY_selection_mask) != 0) \ - return key2any_encode( \ - ctx, cout, key, impl##_pem_type, impl##_pem_type " PRIVATE KEY", \ - key_to_##kind##_##output##_priv_bio, cb, cbarg, \ +#define DO_PRIVATE_KEY(impl, type, kind, output) \ + if ((selection & DO_PRIVATE_KEY_selection_mask) != 0) \ + return key2any_encode( \ + ctx, cout, key, impl##_pem_type, impl##_pem_type " PRIVATE KEY", \ + key_to_##kind##_##output##_priv_bio, cb, cbarg, \ prepare_##type##_params, type##_##kind##_priv_to_der); #define DO_PUBLIC_KEY_selection_mask OSSL_KEYMGMT_SELECT_PUBLIC_KEY -#define DO_PUBLIC_KEY(impl, type, kind, output) \ - if ((selection & DO_PUBLIC_KEY_selection_mask) != 0) \ - return key2any_encode( \ - ctx, cout, key, impl##_pem_type, impl##_pem_type " PUBLIC KEY", \ - key_to_##kind##_##output##_pub_bio, cb, cbarg, \ +#define DO_PUBLIC_KEY(impl, type, kind, output) \ + if ((selection & DO_PUBLIC_KEY_selection_mask) != 0) \ + return key2any_encode( \ + ctx, cout, key, impl##_pem_type, impl##_pem_type " PUBLIC KEY", \ + key_to_##kind##_##output##_pub_bio, cb, cbarg, \ prepare_##type##_params, type##_##kind##_pub_to_der); #define DO_PARAMETERS_selection_mask OSSL_KEYMGMT_SELECT_ALL_PARAMETERS -#define DO_PARAMETERS(impl, type, kind, output) \ - if ((selection & DO_PARAMETERS_selection_mask) != 0) \ - return key2any_encode(ctx, cout, key, impl##_pem_type, \ - impl##_pem_type " PARAMETERS", \ - key_to_##kind##_##output##_param_bio, NULL, \ +#define DO_PARAMETERS(impl, type, kind, output) \ + if ((selection & DO_PARAMETERS_selection_mask) != 0) \ + return key2any_encode(ctx, cout, key, impl##_pem_type, \ + impl##_pem_type " PARAMETERS", \ + key_to_##kind##_##output##_param_bio, NULL, \ NULL, NULL, type##_##kind##_params_to_der); /*- @@ -1463,16 +1444,16 @@ static int key2any_encode(struct key2any_ctx_st *ctx, OSSL_CORE_BIO *cout, * passphrase callback has been passed to them. */ #define DO_PrivateKeyInfo_selection_mask DO_PRIVATE_KEY_selection_mask -#define DO_PrivateKeyInfo(impl, type, output) \ +#define DO_PrivateKeyInfo(impl, type, output) \ DO_PRIVATE_KEY(impl, type, pki, output) #define DO_EncryptedPrivateKeyInfo_selection_mask DO_PRIVATE_KEY_selection_mask -#define DO_EncryptedPrivateKeyInfo(impl, type, output) \ +#define DO_EncryptedPrivateKeyInfo(impl, type, output) \ DO_PRIVATE_KEY(impl, type, epki, output) /* SubjectPublicKeyInfo is a structure for public keys only */ #define DO_SubjectPublicKeyInfo_selection_mask DO_PUBLIC_KEY_selection_mask -#define DO_SubjectPublicKeyInfo(impl, type, output) \ +#define DO_SubjectPublicKeyInfo(impl, type, output) \ DO_PUBLIC_KEY(impl, type, spki, output) /* @@ -1491,23 +1472,23 @@ static int key2any_encode(struct key2any_ctx_st *ctx, OSSL_CORE_BIO *cout, * except public key */ #define DO_type_specific_params_selection_mask DO_PARAMETERS_selection_mask -#define DO_type_specific_params(impl, type, output) \ +#define DO_type_specific_params(impl, type, output) \ DO_PARAMETERS(impl, type, type_specific, output) -#define DO_type_specific_keypair_selection_mask \ +#define DO_type_specific_keypair_selection_mask \ (DO_PRIVATE_KEY_selection_mask | DO_PUBLIC_KEY_selection_mask) -#define DO_type_specific_keypair(impl, type, output) \ - DO_PRIVATE_KEY(impl, type, type_specific, output) \ +#define DO_type_specific_keypair(impl, type, output) \ + DO_PRIVATE_KEY(impl, type, type_specific, output) \ DO_PUBLIC_KEY(impl, type, type_specific, output) -#define DO_type_specific_selection_mask \ - (DO_type_specific_keypair_selection_mask \ - | DO_type_specific_params_selection_mask) -#define DO_type_specific(impl, type, output) \ - DO_type_specific_keypair(impl, type, output) \ +#define DO_type_specific_selection_mask \ + (DO_type_specific_keypair_selection_mask | \ + DO_type_specific_params_selection_mask) +#define DO_type_specific(impl, type, output) \ + DO_type_specific_keypair(impl, type, output) \ DO_type_specific_params(impl, type, output) -#define DO_type_specific_no_pub_selection_mask \ +#define DO_type_specific_no_pub_selection_mask \ (DO_PRIVATE_KEY_selection_mask | DO_PARAMETERS_selection_mask) -#define DO_type_specific_no_pub(impl, type, output) \ - DO_PRIVATE_KEY(impl, type, type_specific, output) \ +#define DO_type_specific_no_pub(impl, type, output) \ + DO_PRIVATE_KEY(impl, type, type_specific, output) \ DO_type_specific_params(impl, type, output) /* @@ -1536,8 +1517,7 @@ static int key2any_encode(struct key2any_ctx_st *ctx, OSSL_CORE_BIO *cout, static OSSL_FUNC_encoder_encode_fn impl##_to_##kind##_##output##_encode; \ \ static void *impl##_to_##kind##_##output##_import_object( \ - void *vctx, int selection, const OSSL_PARAM params[]) \ - { \ + void *vctx, int selection, const OSSL_PARAM params[]) { \ struct key2any_ctx_st *ctx = vctx; \ \ OQS_ENC_PRINTF("OQS ENC provider: _import_object called\n"); \ @@ -1545,22 +1525,19 @@ static int key2any_encode(struct key2any_ctx_st *ctx, OSSL_CORE_BIO *cout, oqs##oqskemhyb##_##impl##_keymgmt_functions, ctx->provctx, \ selection, params); \ } \ - static void impl##_to_##kind##_##output##_free_object(void *key) \ - { \ + static void impl##_to_##kind##_##output##_free_object(void *key) { \ OQS_ENC_PRINTF("OQS ENC provider: _free_object called\n"); \ oqs_prov_free_key(oqs##oqskemhyb##_##impl##_keymgmt_functions, key); \ } \ static int impl##_to_##kind##_##output##_does_selection(void *ctx, \ - int selection) \ - { \ + int selection) { \ OQS_ENC_PRINTF("OQS ENC provider: _does_selection called\n"); \ return key2any_check_selection(selection, DO_##kind##_selection_mask); \ } \ static int impl##_to_##kind##_##output##_encode( \ void *ctx, OSSL_CORE_BIO *cout, const void *key, \ const OSSL_PARAM key_abstract[], int selection, \ - OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg) \ - { \ + OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg) { \ /* We don't deal with abstract objects */ \ OQS_ENC_PRINTF("OQS ENC provider: _encode called\n"); \ if (key_abstract != NULL) { \ @@ -1573,22 +1550,22 @@ static int key2any_encode(struct key2any_ctx_st *ctx, OSSL_CORE_BIO *cout, return 0; \ } \ const OSSL_DISPATCH \ - oqs_##impl##_to_##kind##_##output##_encoder_functions[] \ - = {{OSSL_FUNC_ENCODER_NEWCTX, (void (*)(void))key2any_newctx}, \ - {OSSL_FUNC_ENCODER_FREECTX, (void (*)(void))key2any_freectx}, \ - {OSSL_FUNC_ENCODER_SETTABLE_CTX_PARAMS, \ - (void (*)(void))key2any_settable_ctx_params}, \ - {OSSL_FUNC_ENCODER_SET_CTX_PARAMS, \ - (void (*)(void))key2any_set_ctx_params}, \ - {OSSL_FUNC_ENCODER_DOES_SELECTION, \ - (void (*)(void))impl##_to_##kind##_##output##_does_selection}, \ - {OSSL_FUNC_ENCODER_IMPORT_OBJECT, \ - (void (*)(void))impl##_to_##kind##_##output##_import_object}, \ - {OSSL_FUNC_ENCODER_FREE_OBJECT, \ - (void (*)(void))impl##_to_##kind##_##output##_free_object}, \ - {OSSL_FUNC_ENCODER_ENCODE, \ - (void (*)(void))impl##_to_##kind##_##output##_encode}, \ - {0, NULL}} + oqs_##impl##_to_##kind##_##output##_encoder_functions[] = { \ + {OSSL_FUNC_ENCODER_NEWCTX, (void (*)(void))key2any_newctx}, \ + {OSSL_FUNC_ENCODER_FREECTX, (void (*)(void))key2any_freectx}, \ + {OSSL_FUNC_ENCODER_SETTABLE_CTX_PARAMS, \ + (void (*)(void))key2any_settable_ctx_params}, \ + {OSSL_FUNC_ENCODER_SET_CTX_PARAMS, \ + (void (*)(void))key2any_set_ctx_params}, \ + {OSSL_FUNC_ENCODER_DOES_SELECTION, \ + (void (*)(void))impl##_to_##kind##_##output##_does_selection}, \ + {OSSL_FUNC_ENCODER_IMPORT_OBJECT, \ + (void (*)(void))impl##_to_##kind##_##output##_import_object}, \ + {OSSL_FUNC_ENCODER_FREE_OBJECT, \ + (void (*)(void))impl##_to_##kind##_##output##_free_object}, \ + {OSSL_FUNC_ENCODER_ENCODE, \ + (void (*)(void))impl##_to_##kind##_##output##_encode}, \ + {0, NULL}} /* ---------------------------------------------------------------------- */ @@ -1598,8 +1575,7 @@ static int key2any_encode(struct key2any_ctx_st *ctx, OSSL_CORE_BIO *cout, #define LABELED_BUF_PRINT_WIDTH 15 static int print_labeled_buf(BIO *out, const char *label, - const unsigned char *buf, size_t buflen) -{ + const unsigned char *buf, size_t buflen) { size_t i; if (BIO_printf(out, "%s\n", label) <= 0) @@ -1613,8 +1589,8 @@ static int print_labeled_buf(BIO *out, const char *label, return 0; } - if (BIO_printf(out, "%02x%s", buf[i], (i == buflen - 1) ? "" : ":") - <= 0) + if (BIO_printf(out, "%02x%s", buf[i], (i == buflen - 1) ? "" : ":") <= + 0) return 0; } if (BIO_printf(out, "\n") <= 0) @@ -1623,8 +1599,7 @@ static int print_labeled_buf(BIO *out, const char *label, return 1; } -static int oqsx_to_text(BIO *out, const void *key, int selection) -{ +static int oqsx_to_text(BIO *out, const void *key, int selection) { OQSX_KEY *okey = (OQSX_KEY *)key; if (out == NULL || okey == NULL) { @@ -1647,13 +1622,13 @@ static int oqsx_to_text(BIO *out, const void *key, int selection) case KEY_TYPE_ECP_HYB_KEM: case KEY_TYPE_ECX_HYB_KEM: case KEY_TYPE_HYB_SIG: - if (BIO_printf(out, "%s hybrid private key:\n", okey->tls_name) - <= 0) + if (BIO_printf(out, "%s hybrid private key:\n", okey->tls_name) <= + 0) return 0; break; case KEY_TYPE_CMP_SIG: - if (BIO_printf(out, "%s composite private key:\n", okey->tls_name) - <= 0) + if (BIO_printf(out, "%s composite private key:\n", + okey->tls_name) <= 0) return 0; break; default: @@ -1679,8 +1654,8 @@ static int oqsx_to_text(BIO *out, const void *key, int selection) return 0; break; case KEY_TYPE_CMP_SIG: - if (BIO_printf(out, "%s composite public key:\n", okey->tls_name) - <= 0) + if (BIO_printf(out, "%s composite public key:\n", okey->tls_name) <= + 0) return 0; break; default: @@ -1697,8 +1672,8 @@ static int oqsx_to_text(BIO *out, const void *key, int selection) int i; uint32_t privlen = 0; for (i = 0; i < okey->numkeys; i++) { - if ((name = get_cmpname(OBJ_sn2nid(okey->tls_name), i)) - == NULL) { + if ((name = get_cmpname(OBJ_sn2nid(okey->tls_name), i)) == + NULL) { ERR_raise(ERR_LIB_USER, OQSPROV_R_INVALID_KEY); return 0; } @@ -1706,10 +1681,10 @@ static int oqsx_to_text(BIO *out, const void *key, int selection) if (get_oqsname_fromtls(name) == 0 // classical key && okey->oqsx_provider_ctx.oqsx_evp_ctx->evp_info - ->keytype - == EVP_PKEY_RSA) { // get the RSA real key size - unsigned char *enc_len - = OPENSSL_strndup(okey->comp_privkey[i], 4); + ->keytype == + EVP_PKEY_RSA) { // get the RSA real key size + unsigned char *enc_len = + OPENSSL_strndup(okey->comp_privkey[i], 4); OPENSSL_cleanse(enc_len, 2); DECODE_UINT32(privlen, enc_len); privlen += 4; @@ -1731,12 +1706,12 @@ static int oqsx_to_text(BIO *out, const void *key, int selection) if (okey->numkeys > 1) { // hybrid key char classic_label[200]; uint32_t classic_key_len = 0; - size_t fixed_pq_privkey_len - = okey->oqsx_provider_ctx.oqsx_qs_ctx.kem - ->length_secret_key; - size_t space_for_classical_privkey = okey->privkeylen - - SIZE_OF_UINT32 - - fixed_pq_privkey_len; + size_t fixed_pq_privkey_len = + okey->oqsx_provider_ctx.oqsx_qs_ctx.kem + ->length_secret_key; + size_t space_for_classical_privkey = okey->privkeylen - + SIZE_OF_UINT32 - + fixed_pq_privkey_len; sprintf(classic_label, "%s key material:", OBJ_nid2sn(okey->evp_info->nid)); DECODE_UINT32(classic_key_len, okey->privkey); @@ -1752,8 +1727,8 @@ static int oqsx_to_text(BIO *out, const void *key, int selection) if (!print_labeled_buf( out, "PQ key material:", okey->comp_privkey[okey->numkeys - 1], - okey->privkeylen - classic_key_len - - SIZE_OF_UINT32)) + okey->privkeylen - classic_key_len - + SIZE_OF_UINT32)) return 0; } else { // plain PQ key if (!print_labeled_buf( @@ -1772,8 +1747,8 @@ static int oqsx_to_text(BIO *out, const void *key, int selection) char label[200]; int i; for (i = 0; i < okey->numkeys; i++) { - if ((name = get_cmpname(OBJ_sn2nid(okey->tls_name), i)) - == NULL) { + if ((name = get_cmpname(OBJ_sn2nid(okey->tls_name), i)) == + NULL) { ERR_raise(ERR_LIB_USER, OQSPROV_R_INVALID_KEY); return 0; } @@ -1789,12 +1764,11 @@ static int oqsx_to_text(BIO *out, const void *key, int selection) if (okey->numkeys > 1) { // hybrid key char classic_label[200]; uint32_t classic_key_len = 0; - size_t fixed_pq_pubkey_len - = okey->oqsx_provider_ctx.oqsx_qs_ctx.kem - ->length_public_key; - size_t space_for_classical_pubkey = okey->pubkeylen - - SIZE_OF_UINT32 - - fixed_pq_pubkey_len; + size_t fixed_pq_pubkey_len = + okey->oqsx_provider_ctx.oqsx_qs_ctx.kem + ->length_public_key; + size_t space_for_classical_pubkey = + okey->pubkeylen - SIZE_OF_UINT32 - fixed_pq_pubkey_len; DECODE_UINT32(classic_key_len, okey->pubkey); if (classic_key_len > space_for_classical_pubkey) { ERR_raise(ERR_LIB_USER, OQSPROV_R_INVALID_ENCODING); @@ -1809,8 +1783,8 @@ static int oqsx_to_text(BIO *out, const void *key, int selection) /* finally print pure PQ key */ if (!print_labeled_buf(out, "PQ key material:", okey->comp_pubkey[okey->numkeys - 1], - okey->pubkeylen - classic_key_len - - SIZE_OF_UINT32)) + okey->pubkeylen - classic_key_len - + SIZE_OF_UINT32)) return 0; } else { // PQ key only if (!print_labeled_buf(out, "PQ key material:", @@ -1825,20 +1799,14 @@ static int oqsx_to_text(BIO *out, const void *key, int selection) return 1; } -static void *key2text_newctx(void *provctx) -{ - return provctx; -} +static void *key2text_newctx(void *provctx) { return provctx; } -static void key2text_freectx(ossl_unused void *vctx) -{ -} +static void key2text_freectx(ossl_unused void *vctx) {} static int key2text_encode(void *vctx, const void *key, int selection, OSSL_CORE_BIO *cout, int (*key2text)(BIO *out, const void *key, int selection), - OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg) -{ + OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg) { BIO *out = oqs_bio_new_from_core_bio(vctx, cout); int ret; @@ -1851,44 +1819,41 @@ key2text_encode(void *vctx, const void *key, int selection, OSSL_CORE_BIO *cout, return ret; } -#define MAKE_TEXT_ENCODER(oqskemhyb, impl) \ - static OSSL_FUNC_encoder_import_object_fn impl##2text_import_object; \ - static OSSL_FUNC_encoder_free_object_fn impl##2text_free_object; \ - static OSSL_FUNC_encoder_encode_fn impl##2text_encode; \ - \ - static void *impl##2text_import_object(void *ctx, int selection, \ - const OSSL_PARAM params[]) \ - { \ - return oqs_prov_import_key( \ - oqs##oqskemhyb##_##impl##_keymgmt_functions, ctx, selection, \ - params); \ - } \ - static void impl##2text_free_object(void *key) \ - { \ - oqs_prov_free_key(oqs##oqskemhyb##_##impl##_keymgmt_functions, key); \ - } \ - static int impl##2text_encode( \ - void *vctx, OSSL_CORE_BIO *cout, const void *key, \ - const OSSL_PARAM key_abstract[], int selection, \ - OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg) \ - { \ - /* We don't deal with abstract objects */ \ - if (key_abstract != NULL) { \ - ERR_raise(ERR_LIB_USER, ERR_R_PASSED_INVALID_ARGUMENT); \ - return 0; \ - } \ - return key2text_encode(vctx, key, selection, cout, oqsx_to_text, cb, \ - cbarg); \ - } \ - const OSSL_DISPATCH oqs_##impl##_to_text_encoder_functions[] \ - = {{OSSL_FUNC_ENCODER_NEWCTX, (void (*)(void))key2text_newctx}, \ - {OSSL_FUNC_ENCODER_FREECTX, (void (*)(void))key2text_freectx}, \ - {OSSL_FUNC_ENCODER_IMPORT_OBJECT, \ - (void (*)(void))impl##2text_import_object}, \ - {OSSL_FUNC_ENCODER_FREE_OBJECT, \ - (void (*)(void))impl##2text_free_object}, \ - {OSSL_FUNC_ENCODER_ENCODE, (void (*)(void))impl##2text_encode}, \ - {0, NULL}} +#define MAKE_TEXT_ENCODER(oqskemhyb, impl) \ + static OSSL_FUNC_encoder_import_object_fn impl##2text_import_object; \ + static OSSL_FUNC_encoder_free_object_fn impl##2text_free_object; \ + static OSSL_FUNC_encoder_encode_fn impl##2text_encode; \ + \ + static void *impl##2text_import_object(void *ctx, int selection, \ + const OSSL_PARAM params[]) { \ + return oqs_prov_import_key( \ + oqs##oqskemhyb##_##impl##_keymgmt_functions, ctx, selection, \ + params); \ + } \ + static void impl##2text_free_object(void *key) { \ + oqs_prov_free_key(oqs##oqskemhyb##_##impl##_keymgmt_functions, key); \ + } \ + static int impl##2text_encode( \ + void *vctx, OSSL_CORE_BIO *cout, const void *key, \ + const OSSL_PARAM key_abstract[], int selection, \ + OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg) { \ + /* We don't deal with abstract objects */ \ + if (key_abstract != NULL) { \ + ERR_raise(ERR_LIB_USER, ERR_R_PASSED_INVALID_ARGUMENT); \ + return 0; \ + } \ + return key2text_encode(vctx, key, selection, cout, oqsx_to_text, cb, \ + cbarg); \ + } \ + const OSSL_DISPATCH oqs_##impl##_to_text_encoder_functions[] = { \ + {OSSL_FUNC_ENCODER_NEWCTX, (void (*)(void))key2text_newctx}, \ + {OSSL_FUNC_ENCODER_FREECTX, (void (*)(void))key2text_freectx}, \ + {OSSL_FUNC_ENCODER_IMPORT_OBJECT, \ + (void (*)(void))impl##2text_import_object}, \ + {OSSL_FUNC_ENCODER_FREE_OBJECT, \ + (void (*)(void))impl##2text_free_object}, \ + {OSSL_FUNC_ENCODER_ENCODE, (void (*)(void))impl##2text_encode}, \ + {0, NULL}} /* * Replacements for i2d_{TYPE}PrivateKey, i2d_{TYPE}PublicKey, diff --git a/oqsprov/oqs_endecoder_common.c b/oqsprov/oqs_endecoder_common.c index c0fa423c..512f360b 100644 --- a/oqsprov/oqs_endecoder_common.c +++ b/oqsprov/oqs_endecoder_common.c @@ -8,13 +8,13 @@ * ToDo: Adding hybrid alg support */ -#include "oqs_endecoder_local.h" #include #include #include -OSSL_FUNC_keymgmt_new_fn *oqs_prov_get_keymgmt_new(const OSSL_DISPATCH *fns) -{ +#include "oqs_endecoder_local.h" + +OSSL_FUNC_keymgmt_new_fn *oqs_prov_get_keymgmt_new(const OSSL_DISPATCH *fns) { /* Pilfer the keymgmt dispatch table */ for (; fns->function_id != 0; fns++) if (fns->function_id == OSSL_FUNC_KEYMGMT_NEW) @@ -23,8 +23,7 @@ OSSL_FUNC_keymgmt_new_fn *oqs_prov_get_keymgmt_new(const OSSL_DISPATCH *fns) return NULL; } -OSSL_FUNC_keymgmt_free_fn *oqs_prov_get_keymgmt_free(const OSSL_DISPATCH *fns) -{ +OSSL_FUNC_keymgmt_free_fn *oqs_prov_get_keymgmt_free(const OSSL_DISPATCH *fns) { /* Pilfer the keymgmt dispatch table */ for (; fns->function_id != 0; fns++) if (fns->function_id == OSSL_FUNC_KEYMGMT_FREE) @@ -34,8 +33,7 @@ OSSL_FUNC_keymgmt_free_fn *oqs_prov_get_keymgmt_free(const OSSL_DISPATCH *fns) } OSSL_FUNC_keymgmt_import_fn * -oqs_prov_get_keymgmt_import(const OSSL_DISPATCH *fns) -{ +oqs_prov_get_keymgmt_import(const OSSL_DISPATCH *fns) { /* Pilfer the keymgmt dispatch table */ for (; fns->function_id != 0; fns++) if (fns->function_id == OSSL_FUNC_KEYMGMT_IMPORT) @@ -45,8 +43,7 @@ oqs_prov_get_keymgmt_import(const OSSL_DISPATCH *fns) } OSSL_FUNC_keymgmt_export_fn * -oqs_prov_get_keymgmt_export(const OSSL_DISPATCH *fns) -{ +oqs_prov_get_keymgmt_export(const OSSL_DISPATCH *fns) { /* Pilfer the keymgmt dispatch table */ for (; fns->function_id != 0; fns++) if (fns->function_id == OSSL_FUNC_KEYMGMT_EXPORT) @@ -56,17 +53,16 @@ oqs_prov_get_keymgmt_export(const OSSL_DISPATCH *fns) } void *oqs_prov_import_key(const OSSL_DISPATCH *fns, void *provctx, - int selection, const OSSL_PARAM params[]) -{ + int selection, const OSSL_PARAM params[]) { OSSL_FUNC_keymgmt_new_fn *kmgmt_new = oqs_prov_get_keymgmt_new(fns); OSSL_FUNC_keymgmt_free_fn *kmgmt_free = oqs_prov_get_keymgmt_free(fns); - OSSL_FUNC_keymgmt_import_fn *kmgmt_import - = oqs_prov_get_keymgmt_import(fns); + OSSL_FUNC_keymgmt_import_fn *kmgmt_import = + oqs_prov_get_keymgmt_import(fns); void *key = NULL; if (kmgmt_new != NULL && kmgmt_import != NULL && kmgmt_free != NULL) { - if ((key = kmgmt_new(provctx)) == NULL - || !kmgmt_import(key, selection, params)) { + if ((key = kmgmt_new(provctx)) == NULL || + !kmgmt_import(key, selection, params)) { kmgmt_free(key); key = NULL; } @@ -74,8 +70,7 @@ void *oqs_prov_import_key(const OSSL_DISPATCH *fns, void *provctx, return key; } -void oqs_prov_free_key(const OSSL_DISPATCH *fns, void *key) -{ +void oqs_prov_free_key(const OSSL_DISPATCH *fns, void *key) { OSSL_FUNC_keymgmt_free_fn *kmgmt_free = oqs_prov_get_keymgmt_free(fns); if (kmgmt_free != NULL) diff --git a/oqsprov/oqs_endecoder_local.h b/oqsprov/oqs_endecoder_local.h index 0253eca2..5b5f61e2 100644 --- a/oqsprov/oqs_endecoder_local.h +++ b/oqsprov/oqs_endecoder_local.h @@ -7,11 +7,12 @@ * */ -#include "oqs_prov.h" #include #include #include +#include "oqs_prov.h" + OSSL_FUNC_keymgmt_new_fn *oqs_prov_get_keymgmt_new(const OSSL_DISPATCH *fns); OSSL_FUNC_keymgmt_free_fn *oqs_prov_get_keymgmt_free(const OSSL_DISPATCH *fns); OSSL_FUNC_keymgmt_import_fn * diff --git a/oqsprov/oqs_hyb_kem.c b/oqsprov/oqs_hyb_kem.c index 98c87d1d..16be6a6f 100644 --- a/oqsprov/oqs_hyb_kem.c +++ b/oqsprov/oqs_hyb_kem.c @@ -14,8 +14,7 @@ static OSSL_FUNC_kem_decapsulate_fn oqs_hyb_kem_decaps; static int oqs_evp_kem_encaps_keyslot(void *vpkemctx, unsigned char *ct, size_t *ctlen, unsigned char *secret, - size_t *secretlen, int keyslot) -{ + size_t *secretlen, int keyslot) { int ret = OQS_SUCCESS, ret2 = 0; const PROV_OQSKEM_CTX *pkemctx = (PROV_OQSKEM_CTX *)vpkemctx; @@ -91,8 +90,7 @@ static int oqs_evp_kem_encaps_keyslot(void *vpkemctx, unsigned char *ct, static int oqs_evp_kem_decaps_keyslot(void *vpkemctx, unsigned char *secret, size_t *secretlen, const unsigned char *ct, size_t ctlen, - int keyslot) -{ + int keyslot) { OQS_KEM_PRINTF("OQS KEM provider called: oqs_hyb_kem_decaps\n"); int ret = OQS_SUCCESS, ret2 = 0; @@ -152,8 +150,7 @@ static int oqs_evp_kem_decaps_keyslot(void *vpkemctx, unsigned char *secret, /// Hybrid KEM functions static int oqs_hyb_kem_encaps(void *vpkemctx, unsigned char *ct, size_t *ctlen, - unsigned char *secret, size_t *secretlen) -{ + unsigned char *secret, size_t *secretlen) { int ret = OQS_SUCCESS; const PROV_OQSKEM_CTX *pkemctx = (PROV_OQSKEM_CTX *)vpkemctx; size_t secretLen0 = 0, secretLen1 = 0; @@ -195,8 +192,7 @@ static int oqs_hyb_kem_encaps(void *vpkemctx, unsigned char *ct, size_t *ctlen, static int oqs_hyb_kem_decaps(void *vpkemctx, unsigned char *secret, size_t *secretlen, const unsigned char *ct, - size_t ctlen) -{ + size_t ctlen) { int ret = OQS_SUCCESS; const PROV_OQSKEM_CTX *pkemctx = (PROV_OQSKEM_CTX *)vpkemctx; const OQSX_EVP_CTX *evp_ctx = pkemctx->kem->oqsx_provider_ctx.oqsx_evp_ctx; diff --git a/oqsprov/oqs_kem.c b/oqsprov/oqs_kem.c index a1e27b4d..84ac17d0 100644 --- a/oqsprov/oqs_kem.c +++ b/oqsprov/oqs_kem.c @@ -8,7 +8,6 @@ * ToDo: Adding hybrid alg support; More testing with more key types. */ -#include "oqs_prov.h" #include #include #include @@ -18,20 +17,22 @@ #include #include +#include "oqs_prov.h" + #ifdef NDEBUG -# define OQS_KEM_PRINTF(a) -# define OQS_KEM_PRINTF2(a, b) -# define OQS_KEM_PRINTF3(a, b, c) +#define OQS_KEM_PRINTF(a) +#define OQS_KEM_PRINTF2(a, b) +#define OQS_KEM_PRINTF3(a, b, c) #else -# define OQS_KEM_PRINTF(a) \ - if (getenv("OQSKEM")) \ - printf(a) -# define OQS_KEM_PRINTF2(a, b) \ - if (getenv("OQSKEM")) \ - printf(a, b) -# define OQS_KEM_PRINTF3(a, b, c) \ - if (getenv("OQSKEM")) \ - printf(a, b, c) +#define OQS_KEM_PRINTF(a) \ + if (getenv("OQSKEM")) \ + printf(a) +#define OQS_KEM_PRINTF2(a, b) \ + if (getenv("OQSKEM")) \ + printf(a, b) +#define OQS_KEM_PRINTF3(a, b, c) \ + if (getenv("OQSKEM")) \ + printf(a, b, c) #endif // NDEBUG static OSSL_FUNC_kem_newctx_fn oqs_kem_newctx; @@ -50,8 +51,7 @@ typedef struct { /// Common KEM functions -static void *oqs_kem_newctx(void *provctx) -{ +static void *oqs_kem_newctx(void *provctx) { PROV_OQSKEM_CTX *pkemctx = OPENSSL_zalloc(sizeof(PROV_OQSKEM_CTX)); OQS_KEM_PRINTF("OQS KEM provider called: newctx\n"); @@ -63,8 +63,7 @@ static void *oqs_kem_newctx(void *provctx) return pkemctx; } -static void oqs_kem_freectx(void *vpkemctx) -{ +static void oqs_kem_freectx(void *vpkemctx) { PROV_OQSKEM_CTX *pkemctx = (PROV_OQSKEM_CTX *)vpkemctx; OQS_KEM_PRINTF("OQS KEM provider called: freectx\n"); @@ -72,8 +71,8 @@ static void oqs_kem_freectx(void *vpkemctx) OPENSSL_free(pkemctx); } -static int oqs_kem_decapsencaps_init(void *vpkemctx, void *vkem, int operation) -{ +static int oqs_kem_decapsencaps_init(void *vpkemctx, void *vkem, + int operation) { PROV_OQSKEM_CTX *pkemctx = (PROV_OQSKEM_CTX *)vpkemctx; OQS_KEM_PRINTF3("OQS KEM provider called: _init : New: %p; old: %p \n", @@ -87,15 +86,13 @@ static int oqs_kem_decapsencaps_init(void *vpkemctx, void *vkem, int operation) } static int oqs_kem_encaps_init(void *vpkemctx, void *vkem, - const OSSL_PARAM params[]) -{ + const OSSL_PARAM params[]) { OQS_KEM_PRINTF("OQS KEM provider called: encaps_init\n"); return oqs_kem_decapsencaps_init(vpkemctx, vkem, EVP_PKEY_OP_ENCAPSULATE); } static int oqs_kem_decaps_init(void *vpkemctx, void *vkem, - const OSSL_PARAM params[]) -{ + const OSSL_PARAM params[]) { OQS_KEM_PRINTF("OQS KEM provider called: decaps_init\n"); return oqs_kem_decapsencaps_init(vpkemctx, vkem, EVP_PKEY_OP_DECAPSULATE); } @@ -104,8 +101,7 @@ static int oqs_kem_decaps_init(void *vpkemctx, void *vkem, static int oqs_qs_kem_encaps_keyslot(void *vpkemctx, unsigned char *out, size_t *outlen, unsigned char *secret, - size_t *secretlen, int keyslot) -{ + size_t *secretlen, int keyslot) { const PROV_OQSKEM_CTX *pkemctx = (PROV_OQSKEM_CTX *)vpkemctx; const OQS_KEM *kem_ctx = pkemctx->kem->oqsx_provider_ctx.oqsx_qs_ctx.kem; @@ -114,8 +110,8 @@ static int oqs_qs_kem_encaps_keyslot(void *vpkemctx, unsigned char *out, OQS_KEM_PRINTF("OQS Warning: OQS_KEM not initialized\n"); return -1; } - if (pkemctx->kem->comp_pubkey == NULL - || pkemctx->kem->comp_pubkey[keyslot] == NULL) { + if (pkemctx->kem->comp_pubkey == NULL || + pkemctx->kem->comp_pubkey[keyslot] == NULL) { OQS_KEM_PRINTF("OQS Warning: public key is NULL\n"); return -1; } @@ -150,15 +146,13 @@ static int oqs_qs_kem_encaps_keyslot(void *vpkemctx, unsigned char *out, *outlen = kem_ctx->length_ciphertext; *secretlen = kem_ctx->length_shared_secret; - return OQS_SUCCESS - == OQS_KEM_encaps(kem_ctx, out, secret, - pkemctx->kem->comp_pubkey[keyslot]); + return OQS_SUCCESS == OQS_KEM_encaps(kem_ctx, out, secret, + pkemctx->kem->comp_pubkey[keyslot]); } static int oqs_qs_kem_decaps_keyslot(void *vpkemctx, unsigned char *out, size_t *outlen, const unsigned char *in, - size_t inlen, int keyslot) -{ + size_t inlen, int keyslot) { const PROV_OQSKEM_CTX *pkemctx = (PROV_OQSKEM_CTX *)vpkemctx; const OQS_KEM *kem_ctx = pkemctx->kem->oqsx_provider_ctx.oqsx_qs_ctx.kem; @@ -167,8 +161,8 @@ static int oqs_qs_kem_decaps_keyslot(void *vpkemctx, unsigned char *out, OQS_KEM_PRINTF("OQS Warning: OQS_KEM not initialized\n"); return -1; } - if (pkemctx->kem->comp_privkey == NULL - || pkemctx->kem->comp_privkey[keyslot] == NULL) { + if (pkemctx->kem->comp_privkey == NULL || + pkemctx->kem->comp_privkey[keyslot] == NULL) { OQS_KEM_PRINTF("OQS Warning: private key is NULL\n"); return -1; } @@ -198,21 +192,18 @@ static int oqs_qs_kem_decaps_keyslot(void *vpkemctx, unsigned char *out, } *outlen = kem_ctx->length_shared_secret; - return OQS_SUCCESS - == OQS_KEM_decaps(kem_ctx, out, in, - pkemctx->kem->comp_privkey[keyslot]); + return OQS_SUCCESS == OQS_KEM_decaps(kem_ctx, out, in, + pkemctx->kem->comp_privkey[keyslot]); } static int oqs_qs_kem_encaps(void *vpkemctx, unsigned char *out, size_t *outlen, - unsigned char *secret, size_t *secretlen) -{ + unsigned char *secret, size_t *secretlen) { return oqs_qs_kem_encaps_keyslot(vpkemctx, out, outlen, secret, secretlen, 0); } static int oqs_qs_kem_decaps(void *vpkemctx, unsigned char *out, size_t *outlen, - const unsigned char *in, size_t inlen) -{ + const unsigned char *in, size_t inlen) { return oqs_qs_kem_decaps_keyslot(vpkemctx, out, outlen, in, inlen, 0); } diff --git a/oqsprov/oqs_kmgmt.c b/oqsprov/oqs_kmgmt.c index 84b789ce..c24ccaaf 100644 --- a/oqsprov/oqs_kmgmt.c +++ b/oqsprov/oqs_kmgmt.c @@ -9,9 +9,6 @@ */ #include - -#include "openssl/param_build.h" -#include "oqs_prov.h" #include #include #include @@ -20,14 +17,16 @@ #include #include +#include "openssl/param_build.h" +#include "oqs_prov.h" + // stolen from openssl/crypto/param_build_set.c as // ossl_param_build_set_octet_string not public API: int oqsx_param_build_set_octet_string(OSSL_PARAM_BLD *bld, OSSL_PARAM *p, const char *key, const unsigned char *data, - size_t data_len) -{ + size_t data_len) { if (bld != NULL) return OSSL_PARAM_BLD_push_octet_string(bld, key, data, data_len); @@ -38,19 +37,19 @@ int oqsx_param_build_set_octet_string(OSSL_PARAM_BLD *bld, OSSL_PARAM *p, } #ifdef NDEBUG -# define OQS_KM_PRINTF(a) -# define OQS_KM_PRINTF2(a, b) -# define OQS_KM_PRINTF3(a, b, c) +#define OQS_KM_PRINTF(a) +#define OQS_KM_PRINTF2(a, b) +#define OQS_KM_PRINTF3(a, b, c) #else -# define OQS_KM_PRINTF(a) \ - if (getenv("OQSKM")) \ - printf(a) -# define OQS_KM_PRINTF2(a, b) \ - if (getenv("OQSKM")) \ - printf(a, b) -# define OQS_KM_PRINTF3(a, b, c) \ - if (getenv("OQSKM")) \ - printf(a, b, c) +#define OQS_KM_PRINTF(a) \ + if (getenv("OQSKM")) \ + printf(a) +#define OQS_KM_PRINTF2(a, b) \ + if (getenv("OQSKM")) \ + printf(a, b) +#define OQS_KM_PRINTF3(a, b, c) \ + if (getenv("OQSKM")) \ + printf(a, b, c) #endif // NDEBUG // our own error codes: @@ -81,8 +80,7 @@ struct oqsx_gen_ctx { int alg_idx; }; -static int oqsx_has(const void *keydata, int selection) -{ +static int oqsx_has(const void *keydata, int selection) { const OQSX_KEY *key = keydata; int ok = 0; @@ -118,14 +116,15 @@ static int oqsx_has(const void *keydata, int selection) * considered a mismatch 2) Public keys are matched binary if available in both * keys; only one key having public key material will NOT be considered a * mismatch if both private keys are present and match: The latter logic will - * only be triggered if domain parameter matching is requested to distinguish - * between a pure-play public key match/test and one checking OpenSSL-type - * "EVP-PKEY-equality". This is possible as domain parameters don't really play - * a role in OQS, so we consider them as a proxy for private key matching. + * only be triggered if domain parameter matching is requested to + * distinguish between a pure-play public key match/test and one checking + * OpenSSL-type "EVP-PKEY-equality". This is possible as domain parameters + * don't really play a role in OQS, so we consider them as a proxy for private + * key matching. */ -static int oqsx_match(const void *keydata1, const void *keydata2, int selection) -{ +static int oqsx_match(const void *keydata1, const void *keydata2, + int selection) { const OQSX_KEY *key1 = keydata1; const OQSX_KEY *key2 = keydata2; int ok = 1; @@ -147,53 +146,49 @@ static int oqsx_match(const void *keydata1, const void *keydata2, int selection) * at least the key type name matches. Potential actual key mismatches will * only be discovered later. */ - if (((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0) - && ((selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) != 0)) { - if ((key1->privkey == NULL && key2->pubkey == NULL) - || (key1->pubkey == NULL && key2->privkey == NULL) - || ((key1->tls_name != NULL && key2->tls_name != NULL) - && !strcmp(key1->tls_name, key2->tls_name))) { + if (((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0) && + ((selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) != 0)) { + if ((key1->privkey == NULL && key2->pubkey == NULL) || + (key1->pubkey == NULL && key2->privkey == NULL) || + ((key1->tls_name != NULL && key2->tls_name != NULL) && + !strcmp(key1->tls_name, key2->tls_name))) { OQS_KM_PRINTF("OQSKEYMGMT: leap-of-faith match\n"); return 1; } } #endif - if (((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0) - && ((selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) == 0)) { - if ((key1->privkey == NULL && key2->privkey != NULL) - || (key1->privkey != NULL && key2->privkey == NULL) - || ((key1->tls_name != NULL && key2->tls_name != NULL) - && strcmp(key1->tls_name, key2->tls_name))) { + if (((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0) && + ((selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) == 0)) { + if ((key1->privkey == NULL && key2->privkey != NULL) || + (key1->privkey != NULL && key2->privkey == NULL) || + ((key1->tls_name != NULL && key2->tls_name != NULL) && + strcmp(key1->tls_name, key2->tls_name))) { ok = 0; } else { - ok = ((key1->privkey == NULL && key2->privkey == NULL) - || ((key1->privkey != NULL) - && CRYPTO_memcmp(key1->privkey, key2->privkey, - key1->privkeylen) - == 0)); + ok = ((key1->privkey == NULL && key2->privkey == NULL) || + ((key1->privkey != NULL) && + CRYPTO_memcmp(key1->privkey, key2->privkey, + key1->privkeylen) == 0)); } } if ((selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) != 0) { - if ((key1->pubkey == NULL && key2->pubkey != NULL) - || (key1->pubkey != NULL && key2->pubkey == NULL) - || ((key1->tls_name != NULL && key2->tls_name != NULL) - && strcmp(key1->tls_name, key2->tls_name))) { - // special case now: If domain parameter matching requested, - // consider private key match sufficient: - ok = ((selection & OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) != 0) - && (key1->privkey != NULL && key2->privkey != NULL) - && (CRYPTO_memcmp(key1->privkey, key2->privkey, - key1->privkeylen) - == 0); + if ((key1->pubkey == NULL && key2->pubkey != NULL) || + (key1->pubkey != NULL && key2->pubkey == NULL) || + ((key1->tls_name != NULL && key2->tls_name != NULL) && + strcmp(key1->tls_name, key2->tls_name))) { + // special case now: If domain parameter matching + // requested, consider private key match sufficient: + ok = ((selection & OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) != 0) && + (key1->privkey != NULL && key2->privkey != NULL) && + (CRYPTO_memcmp(key1->privkey, key2->privkey, + key1->privkeylen) == 0); } else { - ok = ok - && ((key1->pubkey == NULL && key2->pubkey == NULL) - || ((key1->pubkey != NULL) - && CRYPTO_memcmp(key1->pubkey, key2->pubkey, - key1->pubkeylen) - == 0)); + ok = ok && ((key1->pubkey == NULL && key2->pubkey == NULL) || + ((key1->pubkey != NULL) && + CRYPTO_memcmp(key1->pubkey, key2->pubkey, + key1->pubkeylen) == 0)); } } if (!ok) @@ -201,8 +196,8 @@ static int oqsx_match(const void *keydata1, const void *keydata2, int selection) return ok; } -static int oqsx_import(void *keydata, int selection, const OSSL_PARAM params[]) -{ +static int oqsx_import(void *keydata, int selection, + const OSSL_PARAM params[]) { OQSX_KEY *key = keydata; int ok = 0; @@ -212,15 +207,14 @@ static int oqsx_import(void *keydata, int selection, const OSSL_PARAM params[]) return ok; } - if (((selection & OSSL_KEYMGMT_SELECT_ALL_PARAMETERS) != 0) - && (oqsx_key_fromdata(key, params, 1))) + if (((selection & OSSL_KEYMGMT_SELECT_ALL_PARAMETERS) != 0) && + (oqsx_key_fromdata(key, params, 1))) ok = 1; return ok; } int oqsx_key_to_params(const OQSX_KEY *key, OSSL_PARAM_BLD *tmpl, - OSSL_PARAM params[], int include_private) -{ + OSSL_PARAM params[], int include_private) { int ret = 0; if (key == NULL) @@ -234,10 +228,9 @@ int oqsx_key_to_params(const OQSX_KEY *key, OSSL_PARAM_BLD *tmpl, } if (p != NULL || tmpl != NULL) { - if (key->pubkeylen == 0 - || !oqsx_param_build_set_octet_string( - tmpl, p, OSSL_PKEY_PARAM_PUB_KEY, key->pubkey, - key->pubkeylen)) + if (key->pubkeylen == 0 || !oqsx_param_build_set_octet_string( + tmpl, p, OSSL_PKEY_PARAM_PUB_KEY, + key->pubkey, key->pubkeylen)) goto err; } } @@ -256,10 +249,9 @@ int oqsx_key_to_params(const OQSX_KEY *key, OSSL_PARAM_BLD *tmpl, } if (p != NULL || tmpl != NULL) { - if (key->privkeylen == 0 - || !oqsx_param_build_set_octet_string( - tmpl, p, OSSL_PKEY_PARAM_PRIV_KEY, key->privkey, - key->privkeylen)) + if (key->privkeylen == 0 || !oqsx_param_build_set_octet_string( + tmpl, p, OSSL_PKEY_PARAM_PRIV_KEY, + key->privkey, key->privkeylen)) goto err; } } @@ -270,8 +262,7 @@ int oqsx_key_to_params(const OQSX_KEY *key, OSSL_PARAM_BLD *tmpl, } static int oqsx_export(void *keydata, int selection, OSSL_CALLBACK *param_cb, - void *cbarg) -{ + void *cbarg) { OQSX_KEY *key = keydata; OSSL_PARAM_BLD *tmpl; OSSL_PARAM *params = NULL; @@ -296,8 +287,8 @@ static int oqsx_export(void *keydata, int selection, OSSL_CALLBACK *param_cb, } if ((selection & OSSL_KEYMGMT_SELECT_KEYPAIR) != 0) { - int include_private - = selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY ? 1 : 0; + int include_private = + selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY ? 1 : 0; ok = ok && oqsx_key_to_params(key, tmpl, NULL, include_private); } @@ -322,14 +313,13 @@ static int oqsx_export(void *keydata, int selection, OSSL_CALLBACK *param_cb, OSSL_PARAM_octet_string(OQS_HYBRID_PKEY_PARAM_PQ_PUB_KEY, NULL, 0), \ OSSL_PARAM_octet_string(OQS_HYBRID_PKEY_PARAM_PQ_PRIV_KEY, NULL, 0) -#define OQS_KEY_TYPES() \ - OSSL_PARAM_octet_string(OSSL_PKEY_PARAM_PUB_KEY, NULL, 0), \ - OSSL_PARAM_octet_string(OSSL_PKEY_PARAM_PRIV_KEY, NULL, 0), \ +#define OQS_KEY_TYPES() \ + OSSL_PARAM_octet_string(OSSL_PKEY_PARAM_PUB_KEY, NULL, 0), \ + OSSL_PARAM_octet_string(OSSL_PKEY_PARAM_PRIV_KEY, NULL, 0), \ OQS_HYBRID_KEY_TYPES() static const OSSL_PARAM oqsx_key_types[] = {OQS_KEY_TYPES(), OSSL_PARAM_END}; -static const OSSL_PARAM *oqs_imexport_types(int selection) -{ +static const OSSL_PARAM *oqs_imexport_types(int selection) { OQS_KM_PRINTF("OQSKEYMGMT: imexport called\n"); if ((selection & OSSL_KEYMGMT_SELECT_KEYPAIR) != 0) return oqsx_key_types; @@ -340,12 +330,11 @@ static const OSSL_PARAM *oqs_imexport_types(int selection) // hybrid algorithm. // // Returns 1 if hybrid, else 0. -static int oqsx_key_is_hybrid(const OQSX_KEY *oqsxk) -{ - if ((oqsxk->keytype == KEY_TYPE_ECP_HYB_KEM - || oqsxk->keytype == KEY_TYPE_ECX_HYB_KEM - || oqsxk->keytype == KEY_TYPE_HYB_SIG) - && oqsxk->numkeys == 2 && oqsxk->classical_pkey != NULL) { +static int oqsx_key_is_hybrid(const OQSX_KEY *oqsxk) { + if ((oqsxk->keytype == KEY_TYPE_ECP_HYB_KEM || + oqsxk->keytype == KEY_TYPE_ECX_HYB_KEM || + oqsxk->keytype == KEY_TYPE_HYB_SIG) && + oqsxk->numkeys == 2 && oqsxk->classical_pkey != NULL) { OQS_KM_PRINTF("OQSKEYMGMT: key is hybrid\n"); return 1; } @@ -357,8 +346,7 @@ static int oqsx_key_is_hybrid(const OQSX_KEY *oqsxk) // Gets hybrid params. // // Returns 0 on success. -static int oqsx_get_hybrid_params(OQSX_KEY *key, OSSL_PARAM params[]) -{ +static int oqsx_get_hybrid_params(OQSX_KEY *key, OSSL_PARAM params[]) { OSSL_PARAM *p; const void *classical_pubkey = NULL; const void *classical_privkey = NULL; @@ -394,36 +382,33 @@ static int oqsx_get_hybrid_params(OQSX_KEY *key, OSSL_PARAM params[]) } if (key->comp_privkey != NULL) { pq_privkey = key->comp_privkey[1]; - pq_privkey_len - = key->privkeylen - classical_privkey_len - SIZE_OF_UINT32; + pq_privkey_len = + key->privkeylen - classical_privkey_len - SIZE_OF_UINT32; } - if ((p = OSSL_PARAM_locate(params, OQS_HYBRID_PKEY_PARAM_CLASSICAL_PUB_KEY)) - != NULL - && !OSSL_PARAM_set_octet_string(p, classical_pubkey, - classical_pubkey_len)) + if ((p = OSSL_PARAM_locate( + params, OQS_HYBRID_PKEY_PARAM_CLASSICAL_PUB_KEY)) != NULL && + !OSSL_PARAM_set_octet_string(p, classical_pubkey, classical_pubkey_len)) return -1; - if ((p - = OSSL_PARAM_locate(params, OQS_HYBRID_PKEY_PARAM_CLASSICAL_PRIV_KEY)) - != NULL - && !OSSL_PARAM_set_octet_string(p, classical_privkey, - classical_privkey_len)) + if ((p = OSSL_PARAM_locate( + params, OQS_HYBRID_PKEY_PARAM_CLASSICAL_PRIV_KEY)) != NULL && + !OSSL_PARAM_set_octet_string(p, classical_privkey, + classical_privkey_len)) return -1; - if ((p = OSSL_PARAM_locate(params, OQS_HYBRID_PKEY_PARAM_PQ_PUB_KEY)) - != NULL - && !OSSL_PARAM_set_octet_string(p, pq_pubkey, pq_pubkey_len)) + if ((p = OSSL_PARAM_locate(params, OQS_HYBRID_PKEY_PARAM_PQ_PUB_KEY)) != + NULL && + !OSSL_PARAM_set_octet_string(p, pq_pubkey, pq_pubkey_len)) return -1; - if ((p = OSSL_PARAM_locate(params, OQS_HYBRID_PKEY_PARAM_PQ_PRIV_KEY)) - != NULL - && !OSSL_PARAM_set_octet_string(p, pq_privkey, pq_privkey_len)) + if ((p = OSSL_PARAM_locate(params, OQS_HYBRID_PKEY_PARAM_PQ_PRIV_KEY)) != + NULL && + !OSSL_PARAM_set_octet_string(p, pq_privkey, pq_privkey_len)) return -1; return 0; } // must handle param requests for KEM and SIG keys... -static int oqsx_get_params(void *key, OSSL_PARAM params[]) -{ +static int oqsx_get_params(void *key, OSSL_PARAM params[]) { OQSX_KEY *oqsxk = key; OSSL_PARAM *p; @@ -433,32 +418,34 @@ static int oqsx_get_params(void *key, OSSL_PARAM params[]) } OQS_KM_PRINTF2("OQSKEYMGMT: get_params called for %s\n", params[0].key); - if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_BITS)) != NULL - && !OSSL_PARAM_set_int(p, oqsx_key_secbits(oqsxk))) + if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_BITS)) != NULL && + !OSSL_PARAM_set_int(p, oqsx_key_secbits(oqsxk))) return 0; - if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_SECURITY_BITS)) != NULL - && !OSSL_PARAM_set_int(p, oqsx_key_secbits(oqsxk))) + if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_SECURITY_BITS)) != + NULL && + !OSSL_PARAM_set_int(p, oqsx_key_secbits(oqsxk))) return 0; - if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_MAX_SIZE)) != NULL - && !OSSL_PARAM_set_int(p, oqsx_key_maxsize(oqsxk))) + if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_MAX_SIZE)) != NULL && + !OSSL_PARAM_set_int(p, oqsx_key_maxsize(oqsxk))) return 0; /* add as temporary workaround TBC */ - if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_DEFAULT_DIGEST)) != NULL - && !OSSL_PARAM_set_utf8_string(p, SN_undef)) + if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_DEFAULT_DIGEST)) != + NULL && + !OSSL_PARAM_set_utf8_string(p, SN_undef)) return 0; - if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_MANDATORY_DIGEST)) - != NULL - && !OSSL_PARAM_set_utf8_string(p, SN_undef)) + if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_MANDATORY_DIGEST)) != + NULL && + !OSSL_PARAM_set_utf8_string(p, SN_undef)) return 0; /* end workaround */ - if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY)) - != NULL) { - // hybrid KEMs are special in that the classic length information shall - // not be passed out: - if (oqsxk->keytype == KEY_TYPE_ECP_HYB_KEM - || oqsxk->keytype == KEY_TYPE_ECX_HYB_KEM) { + if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY)) != + NULL) { + // hybrid KEMs are special in that the classic length information + // shall not be passed out: + if (oqsxk->keytype == KEY_TYPE_ECP_HYB_KEM || + oqsxk->keytype == KEY_TYPE_ECX_HYB_KEM) { if (!OSSL_PARAM_set_octet_string( p, (char *)oqsxk->pubkey + SIZE_OF_UINT32, oqsxk->pubkeylen - SIZE_OF_UINT32)) @@ -485,22 +472,20 @@ static int oqsx_get_params(void *key, OSSL_PARAM params[]) return 1; } -static const OSSL_PARAM oqsx_gettable_params[] - = {OSSL_PARAM_int(OSSL_PKEY_PARAM_BITS, NULL), - OSSL_PARAM_int(OSSL_PKEY_PARAM_SECURITY_BITS, NULL), - OSSL_PARAM_int(OSSL_PKEY_PARAM_MAX_SIZE, NULL), - OSSL_PARAM_octet_string(OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY, NULL, 0), - OQS_KEY_TYPES(), - OSSL_PARAM_END}; +static const OSSL_PARAM oqsx_gettable_params[] = { + OSSL_PARAM_int(OSSL_PKEY_PARAM_BITS, NULL), + OSSL_PARAM_int(OSSL_PKEY_PARAM_SECURITY_BITS, NULL), + OSSL_PARAM_int(OSSL_PKEY_PARAM_MAX_SIZE, NULL), + OSSL_PARAM_octet_string(OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY, NULL, 0), + OQS_KEY_TYPES(), + OSSL_PARAM_END}; -static const OSSL_PARAM *oqs_gettable_params(void *provctx) -{ +static const OSSL_PARAM *oqs_gettable_params(void *provctx) { OQS_KM_PRINTF("OQSKEYMGMT: gettable_params called\n"); return oqsx_gettable_params; } -static int set_property_query(OQSX_KEY *oqsxkey, const char *propq) -{ +static int set_property_query(OQSX_KEY *oqsxkey, const char *propq) { OPENSSL_free(oqsxkey->propq); oqsxkey->propq = NULL; OQS_KM_PRINTF("OQSKEYMGMT: property_query called\n"); @@ -514,8 +499,7 @@ static int set_property_query(OQSX_KEY *oqsxkey, const char *propq) return 1; } -static int oqsx_set_params(void *key, const OSSL_PARAM params[]) -{ +static int oqsx_set_params(void *key, const OSSL_PARAM params[]) { OQSX_KEY *oqsxkey = key; const OSSL_PARAM *p; @@ -528,20 +512,20 @@ static int oqsx_set_params(void *key, const OSSL_PARAM params[]) if (p != NULL) { size_t used_len; int classic_pubkey_len; - if (oqsxkey->keytype == KEY_TYPE_ECP_HYB_KEM - || oqsxkey->keytype == KEY_TYPE_ECX_HYB_KEM) { - // classic key len already stored by key setup; only data needs to - // be filled in - if (p->data_size != oqsxkey->pubkeylen - SIZE_OF_UINT32 - || !OSSL_PARAM_get_octet_string( + if (oqsxkey->keytype == KEY_TYPE_ECP_HYB_KEM || + oqsxkey->keytype == KEY_TYPE_ECX_HYB_KEM) { + // classic key len already stored by key setup; only data + // needs to be filled in + if (p->data_size != oqsxkey->pubkeylen - SIZE_OF_UINT32 || + !OSSL_PARAM_get_octet_string( p, &oqsxkey->comp_pubkey[0], oqsxkey->pubkeylen - SIZE_OF_UINT32, &used_len)) { return 0; } } else { - if (p->data_size != oqsxkey->pubkeylen - || !OSSL_PARAM_get_octet_string( - p, &oqsxkey->pubkey, oqsxkey->pubkeylen, &used_len)) { + if (p->data_size != oqsxkey->pubkeylen || + !OSSL_PARAM_get_octet_string(p, &oqsxkey->pubkey, + oqsxkey->pubkeylen, &used_len)) { return 0; } } @@ -550,8 +534,8 @@ static int oqsx_set_params(void *key, const OSSL_PARAM params[]) } p = OSSL_PARAM_locate_const(params, OSSL_PKEY_PARAM_PROPERTIES); if (p != NULL) { - if (p->data_type != OSSL_PARAM_UTF8_STRING - || !set_property_query(oqsxkey, p->data)) { + if (p->data_type != OSSL_PARAM_UTF8_STRING || + !set_property_query(oqsxkey, p->data)) { return 0; } } @@ -560,21 +544,19 @@ static int oqsx_set_params(void *key, const OSSL_PARAM params[]) return 1; } -static const OSSL_PARAM oqs_settable_params[] - = {OSSL_PARAM_octet_string(OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY, NULL, 0), - OSSL_PARAM_utf8_string(OSSL_PKEY_PARAM_PROPERTIES, NULL, 0), - OSSL_PARAM_END}; +static const OSSL_PARAM oqs_settable_params[] = { + OSSL_PARAM_octet_string(OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY, NULL, 0), + OSSL_PARAM_utf8_string(OSSL_PKEY_PARAM_PROPERTIES, NULL, 0), + OSSL_PARAM_END}; -static const OSSL_PARAM *oqsx_settable_params(void *provctx) -{ +static const OSSL_PARAM *oqsx_settable_params(void *provctx) { OQS_KM_PRINTF("OQSKEYMGMT: settable_params called\n"); return oqs_settable_params; } static void *oqsx_gen_init(void *provctx, int selection, char *oqs_name, char *tls_name, int primitive, int bit_security, - int alg_idx) -{ + int alg_idx) { OSSL_LIB_CTX *libctx = PROV_OQS_LIBCTX_OF(provctx); struct oqsx_gen_ctx *gctx = NULL; @@ -593,8 +575,7 @@ static void *oqsx_gen_init(void *provctx, int selection, char *oqs_name, return gctx; } -static void *oqsx_genkey(struct oqsx_gen_ctx *gctx) -{ +static void *oqsx_genkey(struct oqsx_gen_ctx *gctx) { OQSX_KEY *key; if (gctx == NULL) @@ -603,8 +584,7 @@ static void *oqsx_genkey(struct oqsx_gen_ctx *gctx) gctx->tls_name); if ((key = oqsx_key_new(gctx->libctx, gctx->oqs_name, gctx->tls_name, gctx->primitive, gctx->propq, gctx->bit_security, - gctx->alg_idx)) - == NULL) { + gctx->alg_idx)) == NULL) { OQS_KM_PRINTF2("OQSKM: Error generating key for %s\n", gctx->tls_name); ERR_raise(ERR_LIB_USER, ERR_R_MALLOC_FAILURE); return NULL; @@ -617,8 +597,7 @@ static void *oqsx_genkey(struct oqsx_gen_ctx *gctx) return key; } -static void *oqsx_gen(void *genctx, OSSL_CALLBACK *osslcb, void *cbarg) -{ +static void *oqsx_gen(void *genctx, OSSL_CALLBACK *osslcb, void *cbarg) { struct oqsx_gen_ctx *gctx = genctx; OQS_KM_PRINTF("OQSKEYMGMT: gen called\n"); @@ -626,8 +605,7 @@ static void *oqsx_gen(void *genctx, OSSL_CALLBACK *osslcb, void *cbarg) return oqsx_genkey(gctx); } -static void oqsx_gen_cleanup(void *genctx) -{ +static void oqsx_gen_cleanup(void *genctx) { struct oqsx_gen_ctx *gctx = genctx; OQS_KM_PRINTF("OQSKEYMGMT: gen_cleanup called\n"); @@ -637,8 +615,7 @@ static void oqsx_gen_cleanup(void *genctx) OPENSSL_free(gctx); } -void *oqsx_load(const void *reference, size_t reference_sz) -{ +void *oqsx_load(const void *reference, size_t reference_sz) { OQSX_KEY *key = NULL; OQS_KM_PRINTF("OQSKEYMGMT: load called\n"); @@ -652,17 +629,15 @@ void *oqsx_load(const void *reference, size_t reference_sz) return NULL; } -static const OSSL_PARAM *oqsx_gen_settable_params(void *provctx) -{ - static OSSL_PARAM settable[] - = {OSSL_PARAM_utf8_string(OSSL_PKEY_PARAM_GROUP_NAME, NULL, 0), - OSSL_PARAM_utf8_string(OSSL_KDF_PARAM_PROPERTIES, NULL, 0), - OSSL_PARAM_END}; +static const OSSL_PARAM *oqsx_gen_settable_params(void *provctx) { + static OSSL_PARAM settable[] = { + OSSL_PARAM_utf8_string(OSSL_PKEY_PARAM_GROUP_NAME, NULL, 0), + OSSL_PARAM_utf8_string(OSSL_KDF_PARAM_PROPERTIES, NULL, 0), + OSSL_PARAM_END}; return settable; } -static int oqsx_gen_set_params(void *genctx, const OSSL_PARAM params[]) -{ +static int oqsx_gen_set_params(void *genctx, const OSSL_PARAM params[]) { struct oqsx_gen_ctx *gctx = genctx; const OSSL_PARAM *p; @@ -686,743 +661,629 @@ static int oqsx_gen_set_params(void *genctx, const OSSL_PARAM params[]) if (gctx->propq == NULL) return 0; } - // not passing in params is no error; subsequent operations may fail, though + // not passing in params is no error; subsequent operations may fail, + // though return 1; } ///// OQS_TEMPLATE_FRAGMENT_KEYMGMT_CONSTRUCTORS_START -static void *dilithium2_new_key(void *provctx) -{ +static void *dilithium2_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_dilithium_2, "dilithium2", KEY_TYPE_SIG, NULL, 128, 0); } -static void *dilithium2_gen_init(void *provctx, int selection) -{ +static void *dilithium2_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_dilithium_2, "dilithium2", 0, 128, 0); } -static void *p256_dilithium2_new_key(void *provctx) -{ +static void *p256_dilithium2_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_dilithium_2, "p256_dilithium2", KEY_TYPE_HYB_SIG, NULL, 128, 1); } -static void *p256_dilithium2_gen_init(void *provctx, int selection) -{ +static void *p256_dilithium2_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_dilithium_2, "p256_dilithium2", KEY_TYPE_HYB_SIG, 128, 1); } -static void *rsa3072_dilithium2_new_key(void *provctx) -{ +static void *rsa3072_dilithium2_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_dilithium_2, "rsa3072_dilithium2", KEY_TYPE_HYB_SIG, NULL, 128, 2); } -static void *rsa3072_dilithium2_gen_init(void *provctx, int selection) -{ +static void *rsa3072_dilithium2_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_dilithium_2, "rsa3072_dilithium2", KEY_TYPE_HYB_SIG, 128, 2); } -static void *dilithium3_new_key(void *provctx) -{ +static void *dilithium3_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_dilithium_3, "dilithium3", KEY_TYPE_SIG, NULL, 192, 3); } -static void *dilithium3_gen_init(void *provctx, int selection) -{ +static void *dilithium3_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_dilithium_3, "dilithium3", 0, 192, 3); } -static void *p384_dilithium3_new_key(void *provctx) -{ +static void *p384_dilithium3_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_dilithium_3, "p384_dilithium3", KEY_TYPE_HYB_SIG, NULL, 192, 4); } -static void *p384_dilithium3_gen_init(void *provctx, int selection) -{ +static void *p384_dilithium3_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_dilithium_3, "p384_dilithium3", KEY_TYPE_HYB_SIG, 192, 4); } -static void *dilithium5_new_key(void *provctx) -{ +static void *dilithium5_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_dilithium_5, "dilithium5", KEY_TYPE_SIG, NULL, 256, 5); } -static void *dilithium5_gen_init(void *provctx, int selection) -{ +static void *dilithium5_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_dilithium_5, "dilithium5", 0, 256, 5); } -static void *p521_dilithium5_new_key(void *provctx) -{ +static void *p521_dilithium5_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_dilithium_5, "p521_dilithium5", KEY_TYPE_HYB_SIG, NULL, 256, 6); } -static void *p521_dilithium5_gen_init(void *provctx, int selection) -{ +static void *p521_dilithium5_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_dilithium_5, "p521_dilithium5", KEY_TYPE_HYB_SIG, 256, 6); } -static void *mldsa44_new_key(void *provctx) -{ +static void *mldsa44_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_ml_dsa_44, "mldsa44", KEY_TYPE_SIG, NULL, 128, 7); } -static void *mldsa44_gen_init(void *provctx, int selection) -{ +static void *mldsa44_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_ml_dsa_44, "mldsa44", 0, 128, 7); } -static void *p256_mldsa44_new_key(void *provctx) -{ +static void *p256_mldsa44_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_ml_dsa_44, "p256_mldsa44", KEY_TYPE_HYB_SIG, NULL, 128, 8); } -static void *p256_mldsa44_gen_init(void *provctx, int selection) -{ +static void *p256_mldsa44_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_ml_dsa_44, "p256_mldsa44", KEY_TYPE_HYB_SIG, 128, 8); } -static void *rsa3072_mldsa44_new_key(void *provctx) -{ +static void *rsa3072_mldsa44_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_ml_dsa_44, "rsa3072_mldsa44", KEY_TYPE_HYB_SIG, NULL, 128, 9); } -static void *rsa3072_mldsa44_gen_init(void *provctx, int selection) -{ +static void *rsa3072_mldsa44_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_ml_dsa_44, "rsa3072_mldsa44", KEY_TYPE_HYB_SIG, 128, 9); } -static void *mldsa44_pss2048_new_key(void *provctx) -{ +static void *mldsa44_pss2048_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_ml_dsa_44, "mldsa44_pss2048", KEY_TYPE_CMP_SIG, NULL, 112, 10); } -static void *mldsa44_pss2048_gen_init(void *provctx, int selection) -{ +static void *mldsa44_pss2048_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_ml_dsa_44, "mldsa44_pss2048", KEY_TYPE_CMP_SIG, 112, 10); } -static void *mldsa44_rsa2048_new_key(void *provctx) -{ +static void *mldsa44_rsa2048_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_ml_dsa_44, "mldsa44_rsa2048", KEY_TYPE_CMP_SIG, NULL, 112, 11); } -static void *mldsa44_rsa2048_gen_init(void *provctx, int selection) -{ +static void *mldsa44_rsa2048_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_ml_dsa_44, "mldsa44_rsa2048", KEY_TYPE_CMP_SIG, 112, 11); } -static void *mldsa44_ed25519_new_key(void *provctx) -{ +static void *mldsa44_ed25519_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_ml_dsa_44, "mldsa44_ed25519", KEY_TYPE_CMP_SIG, NULL, 128, 12); } -static void *mldsa44_ed25519_gen_init(void *provctx, int selection) -{ +static void *mldsa44_ed25519_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_ml_dsa_44, "mldsa44_ed25519", KEY_TYPE_CMP_SIG, 128, 12); } -static void *mldsa44_p256_new_key(void *provctx) -{ +static void *mldsa44_p256_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_ml_dsa_44, "mldsa44_p256", KEY_TYPE_CMP_SIG, NULL, 128, 13); } -static void *mldsa44_p256_gen_init(void *provctx, int selection) -{ +static void *mldsa44_p256_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_ml_dsa_44, "mldsa44_p256", KEY_TYPE_CMP_SIG, 128, 13); } -static void *mldsa44_bp256_new_key(void *provctx) -{ +static void *mldsa44_bp256_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_ml_dsa_44, "mldsa44_bp256", KEY_TYPE_CMP_SIG, NULL, 256, 14); } -static void *mldsa44_bp256_gen_init(void *provctx, int selection) -{ +static void *mldsa44_bp256_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_ml_dsa_44, "mldsa44_bp256", KEY_TYPE_CMP_SIG, 256, 14); } -static void *mldsa65_new_key(void *provctx) -{ +static void *mldsa65_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_ml_dsa_65, "mldsa65", KEY_TYPE_SIG, NULL, 192, 15); } -static void *mldsa65_gen_init(void *provctx, int selection) -{ +static void *mldsa65_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_ml_dsa_65, "mldsa65", 0, 192, 15); } -static void *p384_mldsa65_new_key(void *provctx) -{ +static void *p384_mldsa65_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_ml_dsa_65, "p384_mldsa65", KEY_TYPE_HYB_SIG, NULL, 192, 16); } -static void *p384_mldsa65_gen_init(void *provctx, int selection) -{ +static void *p384_mldsa65_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_ml_dsa_65, "p384_mldsa65", KEY_TYPE_HYB_SIG, 192, 16); } -static void *mldsa65_pss3072_new_key(void *provctx) -{ +static void *mldsa65_pss3072_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_ml_dsa_65, "mldsa65_pss3072", KEY_TYPE_CMP_SIG, NULL, 128, 17); } -static void *mldsa65_pss3072_gen_init(void *provctx, int selection) -{ +static void *mldsa65_pss3072_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_ml_dsa_65, "mldsa65_pss3072", KEY_TYPE_CMP_SIG, 128, 17); } -static void *mldsa65_rsa3072_new_key(void *provctx) -{ +static void *mldsa65_rsa3072_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_ml_dsa_65, "mldsa65_rsa3072", KEY_TYPE_CMP_SIG, NULL, 128, 18); } -static void *mldsa65_rsa3072_gen_init(void *provctx, int selection) -{ +static void *mldsa65_rsa3072_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_ml_dsa_65, "mldsa65_rsa3072", KEY_TYPE_CMP_SIG, 128, 18); } -static void *mldsa65_p256_new_key(void *provctx) -{ +static void *mldsa65_p256_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_ml_dsa_65, "mldsa65_p256", KEY_TYPE_CMP_SIG, NULL, 128, 19); } -static void *mldsa65_p256_gen_init(void *provctx, int selection) -{ +static void *mldsa65_p256_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_ml_dsa_65, "mldsa65_p256", KEY_TYPE_CMP_SIG, 128, 19); } -static void *mldsa65_bp256_new_key(void *provctx) -{ +static void *mldsa65_bp256_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_ml_dsa_65, "mldsa65_bp256", KEY_TYPE_CMP_SIG, NULL, 256, 20); } -static void *mldsa65_bp256_gen_init(void *provctx, int selection) -{ +static void *mldsa65_bp256_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_ml_dsa_65, "mldsa65_bp256", KEY_TYPE_CMP_SIG, 256, 20); } -static void *mldsa65_ed25519_new_key(void *provctx) -{ +static void *mldsa65_ed25519_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_ml_dsa_65, "mldsa65_ed25519", KEY_TYPE_CMP_SIG, NULL, 128, 21); } -static void *mldsa65_ed25519_gen_init(void *provctx, int selection) -{ +static void *mldsa65_ed25519_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_ml_dsa_65, "mldsa65_ed25519", KEY_TYPE_CMP_SIG, 128, 21); } -static void *mldsa87_new_key(void *provctx) -{ +static void *mldsa87_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_ml_dsa_87, "mldsa87", KEY_TYPE_SIG, NULL, 256, 22); } -static void *mldsa87_gen_init(void *provctx, int selection) -{ +static void *mldsa87_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_ml_dsa_87, "mldsa87", 0, 256, 22); } -static void *p521_mldsa87_new_key(void *provctx) -{ +static void *p521_mldsa87_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_ml_dsa_87, "p521_mldsa87", KEY_TYPE_HYB_SIG, NULL, 256, 23); } -static void *p521_mldsa87_gen_init(void *provctx, int selection) -{ +static void *p521_mldsa87_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_ml_dsa_87, "p521_mldsa87", KEY_TYPE_HYB_SIG, 256, 23); } -static void *mldsa87_p384_new_key(void *provctx) -{ +static void *mldsa87_p384_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_ml_dsa_87, "mldsa87_p384", KEY_TYPE_CMP_SIG, NULL, 192, 24); } -static void *mldsa87_p384_gen_init(void *provctx, int selection) -{ +static void *mldsa87_p384_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_ml_dsa_87, "mldsa87_p384", KEY_TYPE_CMP_SIG, 192, 24); } -static void *mldsa87_bp384_new_key(void *provctx) -{ +static void *mldsa87_bp384_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_ml_dsa_87, "mldsa87_bp384", KEY_TYPE_CMP_SIG, NULL, 384, 25); } -static void *mldsa87_bp384_gen_init(void *provctx, int selection) -{ +static void *mldsa87_bp384_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_ml_dsa_87, "mldsa87_bp384", KEY_TYPE_CMP_SIG, 384, 25); } -static void *mldsa87_ed448_new_key(void *provctx) -{ +static void *mldsa87_ed448_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_ml_dsa_87, "mldsa87_ed448", KEY_TYPE_CMP_SIG, NULL, 192, 26); } -static void *mldsa87_ed448_gen_init(void *provctx, int selection) -{ +static void *mldsa87_ed448_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_ml_dsa_87, "mldsa87_ed448", KEY_TYPE_CMP_SIG, 192, 26); } -static void *falcon512_new_key(void *provctx) -{ +static void *falcon512_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_falcon_512, "falcon512", KEY_TYPE_SIG, NULL, 128, 27); } -static void *falcon512_gen_init(void *provctx, int selection) -{ +static void *falcon512_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_falcon_512, "falcon512", 0, 128, 27); } -static void *p256_falcon512_new_key(void *provctx) -{ +static void *p256_falcon512_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_falcon_512, "p256_falcon512", KEY_TYPE_HYB_SIG, NULL, 128, 28); } -static void *p256_falcon512_gen_init(void *provctx, int selection) -{ +static void *p256_falcon512_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_falcon_512, "p256_falcon512", KEY_TYPE_HYB_SIG, 128, 28); } -static void *rsa3072_falcon512_new_key(void *provctx) -{ +static void *rsa3072_falcon512_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_falcon_512, "rsa3072_falcon512", KEY_TYPE_HYB_SIG, NULL, 128, 29); } -static void *rsa3072_falcon512_gen_init(void *provctx, int selection) -{ +static void *rsa3072_falcon512_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_falcon_512, "rsa3072_falcon512", KEY_TYPE_HYB_SIG, 128, 29); } -static void *falconpadded512_new_key(void *provctx) -{ +static void *falconpadded512_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_falcon_padded_512, "falconpadded512", KEY_TYPE_SIG, NULL, 128, 30); } -static void *falconpadded512_gen_init(void *provctx, int selection) -{ +static void *falconpadded512_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_falcon_padded_512, "falconpadded512", 0, 128, 30); } -static void *p256_falconpadded512_new_key(void *provctx) -{ +static void *p256_falconpadded512_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_falcon_padded_512, "p256_falconpadded512", KEY_TYPE_HYB_SIG, NULL, 128, 31); } -static void *p256_falconpadded512_gen_init(void *provctx, int selection) -{ +static void *p256_falconpadded512_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_falcon_padded_512, "p256_falconpadded512", KEY_TYPE_HYB_SIG, 128, 31); } -static void *rsa3072_falconpadded512_new_key(void *provctx) -{ +static void *rsa3072_falconpadded512_new_key(void *provctx) { return oqsx_key_new( PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_falcon_padded_512, "rsa3072_falconpadded512", KEY_TYPE_HYB_SIG, NULL, 128, 32); } -static void *rsa3072_falconpadded512_gen_init(void *provctx, int selection) -{ +static void *rsa3072_falconpadded512_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_falcon_padded_512, "rsa3072_falconpadded512", KEY_TYPE_HYB_SIG, 128, 32); } -static void *falcon1024_new_key(void *provctx) -{ +static void *falcon1024_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_falcon_1024, "falcon1024", KEY_TYPE_SIG, NULL, 256, 33); } -static void *falcon1024_gen_init(void *provctx, int selection) -{ +static void *falcon1024_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_falcon_1024, "falcon1024", 0, 256, 33); } -static void *p521_falcon1024_new_key(void *provctx) -{ +static void *p521_falcon1024_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_falcon_1024, "p521_falcon1024", KEY_TYPE_HYB_SIG, NULL, 256, 34); } -static void *p521_falcon1024_gen_init(void *provctx, int selection) -{ +static void *p521_falcon1024_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_falcon_1024, "p521_falcon1024", KEY_TYPE_HYB_SIG, 256, 34); } -static void *falconpadded1024_new_key(void *provctx) -{ +static void *falconpadded1024_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_falcon_padded_1024, "falconpadded1024", KEY_TYPE_SIG, NULL, 256, 35); } -static void *falconpadded1024_gen_init(void *provctx, int selection) -{ +static void *falconpadded1024_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_falcon_padded_1024, "falconpadded1024", 0, 256, 35); } -static void *p521_falconpadded1024_new_key(void *provctx) -{ +static void *p521_falconpadded1024_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_falcon_padded_1024, "p521_falconpadded1024", KEY_TYPE_HYB_SIG, NULL, 256, 36); } -static void *p521_falconpadded1024_gen_init(void *provctx, int selection) -{ +static void *p521_falconpadded1024_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_falcon_padded_1024, "p521_falconpadded1024", KEY_TYPE_HYB_SIG, 256, 36); } -static void *sphincssha2128fsimple_new_key(void *provctx) -{ +static void *sphincssha2128fsimple_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_sphincs_sha2_128f_simple, "sphincssha2128fsimple", KEY_TYPE_SIG, NULL, 128, 37); } -static void *sphincssha2128fsimple_gen_init(void *provctx, int selection) -{ +static void *sphincssha2128fsimple_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_sphincs_sha2_128f_simple, "sphincssha2128fsimple", 0, 128, 37); } -static void *p256_sphincssha2128fsimple_new_key(void *provctx) -{ +static void *p256_sphincssha2128fsimple_new_key(void *provctx) { return oqsx_key_new( PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_sphincs_sha2_128f_simple, "p256_sphincssha2128fsimple", KEY_TYPE_HYB_SIG, NULL, 128, 38); } -static void *p256_sphincssha2128fsimple_gen_init(void *provctx, int selection) -{ +static void *p256_sphincssha2128fsimple_gen_init(void *provctx, int selection) { return oqsx_gen_init( provctx, selection, OQS_SIG_alg_sphincs_sha2_128f_simple, "p256_sphincssha2128fsimple", KEY_TYPE_HYB_SIG, 128, 38); } -static void *rsa3072_sphincssha2128fsimple_new_key(void *provctx) -{ +static void *rsa3072_sphincssha2128fsimple_new_key(void *provctx) { return oqsx_key_new( PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_sphincs_sha2_128f_simple, "rsa3072_sphincssha2128fsimple", KEY_TYPE_HYB_SIG, NULL, 128, 39); } static void *rsa3072_sphincssha2128fsimple_gen_init(void *provctx, - int selection) -{ + int selection) { return oqsx_gen_init( provctx, selection, OQS_SIG_alg_sphincs_sha2_128f_simple, "rsa3072_sphincssha2128fsimple", KEY_TYPE_HYB_SIG, 128, 39); } -static void *sphincssha2128ssimple_new_key(void *provctx) -{ +static void *sphincssha2128ssimple_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_sphincs_sha2_128s_simple, "sphincssha2128ssimple", KEY_TYPE_SIG, NULL, 128, 40); } -static void *sphincssha2128ssimple_gen_init(void *provctx, int selection) -{ +static void *sphincssha2128ssimple_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_sphincs_sha2_128s_simple, "sphincssha2128ssimple", 0, 128, 40); } -static void *p256_sphincssha2128ssimple_new_key(void *provctx) -{ +static void *p256_sphincssha2128ssimple_new_key(void *provctx) { return oqsx_key_new( PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_sphincs_sha2_128s_simple, "p256_sphincssha2128ssimple", KEY_TYPE_HYB_SIG, NULL, 128, 41); } -static void *p256_sphincssha2128ssimple_gen_init(void *provctx, int selection) -{ +static void *p256_sphincssha2128ssimple_gen_init(void *provctx, int selection) { return oqsx_gen_init( provctx, selection, OQS_SIG_alg_sphincs_sha2_128s_simple, "p256_sphincssha2128ssimple", KEY_TYPE_HYB_SIG, 128, 41); } -static void *rsa3072_sphincssha2128ssimple_new_key(void *provctx) -{ +static void *rsa3072_sphincssha2128ssimple_new_key(void *provctx) { return oqsx_key_new( PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_sphincs_sha2_128s_simple, "rsa3072_sphincssha2128ssimple", KEY_TYPE_HYB_SIG, NULL, 128, 42); } static void *rsa3072_sphincssha2128ssimple_gen_init(void *provctx, - int selection) -{ + int selection) { return oqsx_gen_init( provctx, selection, OQS_SIG_alg_sphincs_sha2_128s_simple, "rsa3072_sphincssha2128ssimple", KEY_TYPE_HYB_SIG, 128, 42); } -static void *sphincssha2192fsimple_new_key(void *provctx) -{ +static void *sphincssha2192fsimple_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_sphincs_sha2_192f_simple, "sphincssha2192fsimple", KEY_TYPE_SIG, NULL, 192, 43); } -static void *sphincssha2192fsimple_gen_init(void *provctx, int selection) -{ +static void *sphincssha2192fsimple_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_sphincs_sha2_192f_simple, "sphincssha2192fsimple", 0, 192, 43); } -static void *p384_sphincssha2192fsimple_new_key(void *provctx) -{ +static void *p384_sphincssha2192fsimple_new_key(void *provctx) { return oqsx_key_new( PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_sphincs_sha2_192f_simple, "p384_sphincssha2192fsimple", KEY_TYPE_HYB_SIG, NULL, 192, 44); } -static void *p384_sphincssha2192fsimple_gen_init(void *provctx, int selection) -{ +static void *p384_sphincssha2192fsimple_gen_init(void *provctx, int selection) { return oqsx_gen_init( provctx, selection, OQS_SIG_alg_sphincs_sha2_192f_simple, "p384_sphincssha2192fsimple", KEY_TYPE_HYB_SIG, 192, 44); } -static void *sphincsshake128fsimple_new_key(void *provctx) -{ +static void *sphincsshake128fsimple_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_sphincs_shake_128f_simple, "sphincsshake128fsimple", KEY_TYPE_SIG, NULL, 128, 45); } -static void *sphincsshake128fsimple_gen_init(void *provctx, int selection) -{ +static void *sphincsshake128fsimple_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_sphincs_shake_128f_simple, "sphincsshake128fsimple", 0, 128, 45); } -static void *p256_sphincsshake128fsimple_new_key(void *provctx) -{ +static void *p256_sphincsshake128fsimple_new_key(void *provctx) { return oqsx_key_new( PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_sphincs_shake_128f_simple, "p256_sphincsshake128fsimple", KEY_TYPE_HYB_SIG, NULL, 128, 46); } -static void *p256_sphincsshake128fsimple_gen_init(void *provctx, int selection) -{ +static void *p256_sphincsshake128fsimple_gen_init(void *provctx, + int selection) { return oqsx_gen_init( provctx, selection, OQS_SIG_alg_sphincs_shake_128f_simple, "p256_sphincsshake128fsimple", KEY_TYPE_HYB_SIG, 128, 46); } -static void *rsa3072_sphincsshake128fsimple_new_key(void *provctx) -{ +static void *rsa3072_sphincsshake128fsimple_new_key(void *provctx) { return oqsx_key_new( PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_sphincs_shake_128f_simple, "rsa3072_sphincsshake128fsimple", KEY_TYPE_HYB_SIG, NULL, 128, 47); } static void *rsa3072_sphincsshake128fsimple_gen_init(void *provctx, - int selection) -{ + int selection) { return oqsx_gen_init( provctx, selection, OQS_SIG_alg_sphincs_shake_128f_simple, "rsa3072_sphincsshake128fsimple", KEY_TYPE_HYB_SIG, 128, 47); } -static void *mayo1_new_key(void *provctx) -{ +static void *mayo1_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_mayo_1, "mayo1", KEY_TYPE_SIG, NULL, 128, 48); } -static void *mayo1_gen_init(void *provctx, int selection) -{ +static void *mayo1_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_mayo_1, "mayo1", 0, 128, 48); } -static void *p256_mayo1_new_key(void *provctx) -{ +static void *p256_mayo1_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_mayo_1, "p256_mayo1", KEY_TYPE_HYB_SIG, NULL, 128, 49); } -static void *p256_mayo1_gen_init(void *provctx, int selection) -{ +static void *p256_mayo1_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_mayo_1, "p256_mayo1", KEY_TYPE_HYB_SIG, 128, 49); } -static void *mayo2_new_key(void *provctx) -{ +static void *mayo2_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_mayo_2, "mayo2", KEY_TYPE_SIG, NULL, 128, 50); } -static void *mayo2_gen_init(void *provctx, int selection) -{ +static void *mayo2_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_mayo_2, "mayo2", 0, 128, 50); } -static void *p256_mayo2_new_key(void *provctx) -{ +static void *p256_mayo2_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_mayo_2, "p256_mayo2", KEY_TYPE_HYB_SIG, NULL, 128, 51); } -static void *p256_mayo2_gen_init(void *provctx, int selection) -{ +static void *p256_mayo2_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_mayo_2, "p256_mayo2", KEY_TYPE_HYB_SIG, 128, 51); } -static void *mayo3_new_key(void *provctx) -{ +static void *mayo3_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_mayo_3, "mayo3", KEY_TYPE_SIG, NULL, 192, 52); } -static void *mayo3_gen_init(void *provctx, int selection) -{ +static void *mayo3_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_mayo_3, "mayo3", 0, 192, 52); } -static void *p384_mayo3_new_key(void *provctx) -{ +static void *p384_mayo3_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_mayo_3, "p384_mayo3", KEY_TYPE_HYB_SIG, NULL, 192, 53); } -static void *p384_mayo3_gen_init(void *provctx, int selection) -{ +static void *p384_mayo3_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_mayo_3, "p384_mayo3", KEY_TYPE_HYB_SIG, 192, 53); } -static void *mayo5_new_key(void *provctx) -{ +static void *mayo5_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_mayo_5, "mayo5", KEY_TYPE_SIG, NULL, 256, 54); } -static void *mayo5_gen_init(void *provctx, int selection) -{ +static void *mayo5_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_mayo_5, "mayo5", 0, 256, 54); } -static void *p521_mayo5_new_key(void *provctx) -{ +static void *p521_mayo5_new_key(void *provctx) { return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_mayo_5, "p521_mayo5", KEY_TYPE_HYB_SIG, NULL, 256, 55); } -static void *p521_mayo5_gen_init(void *provctx, int selection) -{ +static void *p521_mayo5_gen_init(void *provctx, int selection) { return oqsx_gen_init(provctx, selection, OQS_SIG_alg_mayo_5, "p521_mayo5", KEY_TYPE_HYB_SIG, 256, 55); } ///// OQS_TEMPLATE_FRAGMENT_KEYMGMT_CONSTRUCTORS_END -#define MAKE_SIG_KEYMGMT_FUNCTIONS(alg) \ - \ - const OSSL_DISPATCH oqs_##alg##_keymgmt_functions[] = { \ - {OSSL_FUNC_KEYMGMT_NEW, (void (*)(void))alg##_new_key}, \ - {OSSL_FUNC_KEYMGMT_FREE, (void (*)(void))oqsx_key_free}, \ - {OSSL_FUNC_KEYMGMT_GET_PARAMS, (void (*)(void))oqsx_get_params}, \ - {OSSL_FUNC_KEYMGMT_SETTABLE_PARAMS, \ - (void (*)(void))oqsx_settable_params}, \ - {OSSL_FUNC_KEYMGMT_GETTABLE_PARAMS, \ - (void (*)(void))oqs_gettable_params}, \ - {OSSL_FUNC_KEYMGMT_SET_PARAMS, (void (*)(void))oqsx_set_params}, \ - {OSSL_FUNC_KEYMGMT_HAS, (void (*)(void))oqsx_has}, \ - {OSSL_FUNC_KEYMGMT_MATCH, (void (*)(void))oqsx_match}, \ - {OSSL_FUNC_KEYMGMT_IMPORT, (void (*)(void))oqsx_import}, \ - {OSSL_FUNC_KEYMGMT_IMPORT_TYPES, (void (*)(void))oqs_imexport_types}, \ - {OSSL_FUNC_KEYMGMT_EXPORT, (void (*)(void))oqsx_export}, \ - {OSSL_FUNC_KEYMGMT_EXPORT_TYPES, (void (*)(void))oqs_imexport_types}, \ - {OSSL_FUNC_KEYMGMT_GEN_INIT, (void (*)(void))alg##_gen_init}, \ - {OSSL_FUNC_KEYMGMT_GEN, (void (*)(void))oqsx_gen}, \ - {OSSL_FUNC_KEYMGMT_GEN_CLEANUP, (void (*)(void))oqsx_gen_cleanup}, \ - {OSSL_FUNC_KEYMGMT_GEN_SET_PARAMS, \ - (void (*)(void))oqsx_gen_set_params}, \ - {OSSL_FUNC_KEYMGMT_GEN_SETTABLE_PARAMS, \ - (void (*)(void))oqsx_gen_settable_params}, \ - {OSSL_FUNC_KEYMGMT_LOAD, (void (*)(void))oqsx_load}, \ +#define MAKE_SIG_KEYMGMT_FUNCTIONS(alg) \ + \ + const OSSL_DISPATCH oqs_##alg##_keymgmt_functions[] = { \ + {OSSL_FUNC_KEYMGMT_NEW, (void (*)(void))alg##_new_key}, \ + {OSSL_FUNC_KEYMGMT_FREE, (void (*)(void))oqsx_key_free}, \ + {OSSL_FUNC_KEYMGMT_GET_PARAMS, (void (*)(void))oqsx_get_params}, \ + {OSSL_FUNC_KEYMGMT_SETTABLE_PARAMS, \ + (void (*)(void))oqsx_settable_params}, \ + {OSSL_FUNC_KEYMGMT_GETTABLE_PARAMS, \ + (void (*)(void))oqs_gettable_params}, \ + {OSSL_FUNC_KEYMGMT_SET_PARAMS, (void (*)(void))oqsx_set_params}, \ + {OSSL_FUNC_KEYMGMT_HAS, (void (*)(void))oqsx_has}, \ + {OSSL_FUNC_KEYMGMT_MATCH, (void (*)(void))oqsx_match}, \ + {OSSL_FUNC_KEYMGMT_IMPORT, (void (*)(void))oqsx_import}, \ + {OSSL_FUNC_KEYMGMT_IMPORT_TYPES, (void (*)(void))oqs_imexport_types}, \ + {OSSL_FUNC_KEYMGMT_EXPORT, (void (*)(void))oqsx_export}, \ + {OSSL_FUNC_KEYMGMT_EXPORT_TYPES, (void (*)(void))oqs_imexport_types}, \ + {OSSL_FUNC_KEYMGMT_GEN_INIT, (void (*)(void))alg##_gen_init}, \ + {OSSL_FUNC_KEYMGMT_GEN, (void (*)(void))oqsx_gen}, \ + {OSSL_FUNC_KEYMGMT_GEN_CLEANUP, (void (*)(void))oqsx_gen_cleanup}, \ + {OSSL_FUNC_KEYMGMT_GEN_SET_PARAMS, \ + (void (*)(void))oqsx_gen_set_params}, \ + {OSSL_FUNC_KEYMGMT_GEN_SETTABLE_PARAMS, \ + (void (*)(void))oqsx_gen_settable_params}, \ + {OSSL_FUNC_KEYMGMT_LOAD, (void (*)(void))oqsx_load}, \ {0, NULL}}; -#define MAKE_KEM_KEYMGMT_FUNCTIONS(tokalg, tokoqsalg, bit_security) \ - \ - static void *tokalg##_new_key(void *provctx) \ - { \ - return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), tokoqsalg, \ - "" #tokalg "", KEY_TYPE_KEM, NULL, bit_security, \ - -1); \ - } \ - \ - static void *tokalg##_gen_init(void *provctx, int selection) \ - { \ - return oqsx_gen_init(provctx, selection, tokoqsalg, "" #tokalg "", \ - KEY_TYPE_KEM, bit_security, -1); \ - } \ - \ - const OSSL_DISPATCH oqs_##tokalg##_keymgmt_functions[] = { \ - {OSSL_FUNC_KEYMGMT_NEW, (void (*)(void))tokalg##_new_key}, \ - {OSSL_FUNC_KEYMGMT_FREE, (void (*)(void))oqsx_key_free}, \ - {OSSL_FUNC_KEYMGMT_GET_PARAMS, (void (*)(void))oqsx_get_params}, \ - {OSSL_FUNC_KEYMGMT_SETTABLE_PARAMS, \ - (void (*)(void))oqsx_settable_params}, \ - {OSSL_FUNC_KEYMGMT_GETTABLE_PARAMS, \ - (void (*)(void))oqs_gettable_params}, \ - {OSSL_FUNC_KEYMGMT_SET_PARAMS, (void (*)(void))oqsx_set_params}, \ - {OSSL_FUNC_KEYMGMT_HAS, (void (*)(void))oqsx_has}, \ - {OSSL_FUNC_KEYMGMT_MATCH, (void (*)(void))oqsx_match}, \ - {OSSL_FUNC_KEYMGMT_IMPORT, (void (*)(void))oqsx_import}, \ - {OSSL_FUNC_KEYMGMT_IMPORT_TYPES, (void (*)(void))oqs_imexport_types}, \ - {OSSL_FUNC_KEYMGMT_EXPORT, (void (*)(void))oqsx_export}, \ - {OSSL_FUNC_KEYMGMT_EXPORT_TYPES, (void (*)(void))oqs_imexport_types}, \ - {OSSL_FUNC_KEYMGMT_GEN_INIT, (void (*)(void))tokalg##_gen_init}, \ - {OSSL_FUNC_KEYMGMT_GEN, (void (*)(void))oqsx_gen}, \ - {OSSL_FUNC_KEYMGMT_GEN_CLEANUP, (void (*)(void))oqsx_gen_cleanup}, \ - {OSSL_FUNC_KEYMGMT_GEN_SET_PARAMS, \ - (void (*)(void))oqsx_gen_set_params}, \ - {OSSL_FUNC_KEYMGMT_GEN_SETTABLE_PARAMS, \ - (void (*)(void))oqsx_gen_settable_params}, \ - {OSSL_FUNC_KEYMGMT_LOAD, (void (*)(void))oqsx_load}, \ +#define MAKE_KEM_KEYMGMT_FUNCTIONS(tokalg, tokoqsalg, bit_security) \ + \ + static void *tokalg##_new_key(void *provctx) { \ + return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), tokoqsalg, \ + "" #tokalg "", KEY_TYPE_KEM, NULL, bit_security, \ + -1); \ + } \ + \ + static void *tokalg##_gen_init(void *provctx, int selection) { \ + return oqsx_gen_init(provctx, selection, tokoqsalg, "" #tokalg "", \ + KEY_TYPE_KEM, bit_security, -1); \ + } \ + \ + const OSSL_DISPATCH oqs_##tokalg##_keymgmt_functions[] = { \ + {OSSL_FUNC_KEYMGMT_NEW, (void (*)(void))tokalg##_new_key}, \ + {OSSL_FUNC_KEYMGMT_FREE, (void (*)(void))oqsx_key_free}, \ + {OSSL_FUNC_KEYMGMT_GET_PARAMS, (void (*)(void))oqsx_get_params}, \ + {OSSL_FUNC_KEYMGMT_SETTABLE_PARAMS, \ + (void (*)(void))oqsx_settable_params}, \ + {OSSL_FUNC_KEYMGMT_GETTABLE_PARAMS, \ + (void (*)(void))oqs_gettable_params}, \ + {OSSL_FUNC_KEYMGMT_SET_PARAMS, (void (*)(void))oqsx_set_params}, \ + {OSSL_FUNC_KEYMGMT_HAS, (void (*)(void))oqsx_has}, \ + {OSSL_FUNC_KEYMGMT_MATCH, (void (*)(void))oqsx_match}, \ + {OSSL_FUNC_KEYMGMT_IMPORT, (void (*)(void))oqsx_import}, \ + {OSSL_FUNC_KEYMGMT_IMPORT_TYPES, (void (*)(void))oqs_imexport_types}, \ + {OSSL_FUNC_KEYMGMT_EXPORT, (void (*)(void))oqsx_export}, \ + {OSSL_FUNC_KEYMGMT_EXPORT_TYPES, (void (*)(void))oqs_imexport_types}, \ + {OSSL_FUNC_KEYMGMT_GEN_INIT, (void (*)(void))tokalg##_gen_init}, \ + {OSSL_FUNC_KEYMGMT_GEN, (void (*)(void))oqsx_gen}, \ + {OSSL_FUNC_KEYMGMT_GEN_CLEANUP, (void (*)(void))oqsx_gen_cleanup}, \ + {OSSL_FUNC_KEYMGMT_GEN_SET_PARAMS, \ + (void (*)(void))oqsx_gen_set_params}, \ + {OSSL_FUNC_KEYMGMT_GEN_SETTABLE_PARAMS, \ + (void (*)(void))oqsx_gen_settable_params}, \ + {OSSL_FUNC_KEYMGMT_LOAD, (void (*)(void))oqsx_load}, \ {0, NULL}}; #define MAKE_KEM_ECP_KEYMGMT_FUNCTIONS(tokalg, tokoqsalg, bit_security) \ \ - static void *ecp_##tokalg##_new_key(void *provctx) \ - { \ + static void *ecp_##tokalg##_new_key(void *provctx) { \ return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), tokoqsalg, \ "" #tokalg "", KEY_TYPE_ECP_HYB_KEM, NULL, \ bit_security, -1); \ } \ \ - static void *ecp_##tokalg##_gen_init(void *provctx, int selection) \ - { \ + static void *ecp_##tokalg##_gen_init(void *provctx, int selection) { \ return oqsx_gen_init(provctx, selection, tokoqsalg, "" #tokalg "", \ KEY_TYPE_ECP_HYB_KEM, bit_security, -1); \ } \ @@ -1453,15 +1314,13 @@ static void *p521_mayo5_gen_init(void *provctx, int selection) {0, NULL}}; #define MAKE_KEM_ECX_KEYMGMT_FUNCTIONS(tokalg, tokoqsalg, bit_security) \ - static void *ecx_##tokalg##_new_key(void *provctx) \ - { \ + static void *ecx_##tokalg##_new_key(void *provctx) { \ return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), tokoqsalg, \ "" #tokalg "", KEY_TYPE_ECX_HYB_KEM, NULL, \ bit_security, -1); \ } \ \ - static void *ecx_##tokalg##_gen_init(void *provctx, int selection) \ - { \ + static void *ecx_##tokalg##_gen_init(void *provctx, int selection) { \ return oqsx_gen_init(provctx, selection, tokoqsalg, "" #tokalg "", \ KEY_TYPE_ECX_HYB_KEM, bit_security, -1); \ } \ diff --git a/oqsprov/oqs_prov.h b/oqsprov/oqs_prov.h index a4338d07..30816e93 100644 --- a/oqsprov/oqs_prov.h +++ b/oqsprov/oqs_prov.h @@ -12,7 +12,7 @@ #define OQSX_H #ifndef OQS_PROVIDER_NOATOMIC -# include +#include #endif #include @@ -27,34 +27,34 @@ #define OSSL_NELEM(x) (sizeof(x) / sizeof((x)[0])) #ifdef _MSC_VER -# define strncasecmp _strnicmp -# define strcasecmp _stricmp +#define strncasecmp _strnicmp +#define strcasecmp _stricmp #endif /* oqsprovider error codes */ -#define OQSPROV_R_INVALID_DIGEST 1 -#define OQSPROV_R_INVALID_SIZE 2 -#define OQSPROV_R_INVALID_KEY 3 -#define OQSPROV_R_UNSUPPORTED 4 -#define OQSPROV_R_MISSING_OID 5 -#define OQSPROV_R_OBJ_CREATE_ERR 6 -#define OQSPROV_R_INVALID_ENCODING 7 -#define OQSPROV_R_SIGN_ERROR 8 -#define OQSPROV_R_LIB_CREATE_ERR 9 -#define OQSPROV_R_NO_PRIVATE_KEY 10 +#define OQSPROV_R_INVALID_DIGEST 1 +#define OQSPROV_R_INVALID_SIZE 2 +#define OQSPROV_R_INVALID_KEY 3 +#define OQSPROV_R_UNSUPPORTED 4 +#define OQSPROV_R_MISSING_OID 5 +#define OQSPROV_R_OBJ_CREATE_ERR 6 +#define OQSPROV_R_INVALID_ENCODING 7 +#define OQSPROV_R_SIGN_ERROR 8 +#define OQSPROV_R_LIB_CREATE_ERR 9 +#define OQSPROV_R_NO_PRIVATE_KEY 10 #define OQSPROV_R_BUFFER_LENGTH_WRONG 11 -#define OQSPROV_R_SIGNING_FAILED 12 -#define OQSPROV_R_WRONG_PARAMETERS 13 -#define OQSPROV_R_VERIFY_ERROR 14 -#define OQSPROV_R_EVPINFO_MISSING 15 -#define OQSPROV_R_INTERNAL_ERROR 16 +#define OQSPROV_R_SIGNING_FAILED 12 +#define OQSPROV_R_WRONG_PARAMETERS 13 +#define OQSPROV_R_VERIFY_ERROR 14 +#define OQSPROV_R_EVPINFO_MISSING 15 +#define OQSPROV_R_INTERNAL_ERROR 16 /* Extra OpenSSL parameters for hybrid EVP_PKEY. */ -#define OQS_HYBRID_PKEY_PARAM_CLASSICAL_PUB_KEY \ +#define OQS_HYBRID_PKEY_PARAM_CLASSICAL_PUB_KEY \ "hybrid_classical_" OSSL_PKEY_PARAM_PUB_KEY -#define OQS_HYBRID_PKEY_PARAM_CLASSICAL_PRIV_KEY \ +#define OQS_HYBRID_PKEY_PARAM_CLASSICAL_PRIV_KEY \ "hybrid_classical_" OSSL_PKEY_PARAM_PRIV_KEY -#define OQS_HYBRID_PKEY_PARAM_PQ_PUB_KEY "hybrid_pq_" OSSL_PKEY_PARAM_PUB_KEY +#define OQS_HYBRID_PKEY_PARAM_PQ_PUB_KEY "hybrid_pq_" OSSL_PKEY_PARAM_PUB_KEY #define OQS_HYBRID_PKEY_PARAM_PQ_PRIV_KEY "hybrid_pq_" OSSL_PKEY_PARAM_PRIV_KEY /* Extras for OQS extension */ @@ -74,15 +74,15 @@ i |= ((uint32_t)((unsigned char *)pbuf)[3]) // clang-format on -#define ON_ERR_SET_GOTO(condition, ret, code, gt) \ - if ((condition)) { \ - (ret) = (code); \ - goto gt; \ +#define ON_ERR_SET_GOTO(condition, ret, code, gt) \ + if ((condition)) { \ + (ret) = (code); \ + goto gt; \ } -#define ON_ERR_GOTO(condition, gt) \ - if ((condition)) { \ - goto gt; \ +#define ON_ERR_GOTO(condition, gt) \ + if ((condition)) { \ + goto gt; \ } typedef struct prov_oqs_ctx_st { @@ -94,7 +94,7 @@ typedef struct prov_oqs_ctx_st { PROV_OQS_CTX *oqsx_newprovctx(OSSL_LIB_CTX *libctx, const OSSL_CORE_HANDLE *handle, BIO_METHOD *bm); void oqsx_freeprovctx(PROV_OQS_CTX *ctx); -#define PROV_OQS_LIBCTX_OF(provctx) \ +#define PROV_OQS_LIBCTX_OF(provctx) \ provctx ? (((PROV_OQS_CTX *)provctx)->libctx) : NULL #include "oqs/oqs.h" @@ -171,10 +171,10 @@ struct oqsx_key_st { #endif int references; - /* point to actual priv key material -- if is a hydrid, the classic key will - * be present first, i.e., OQS key always at comp_*key[numkeys-1] - if is a - * composite, the classic key will be presented second, i.e., OQS key always - * at comp_*key[0] + /* point to actual priv key material -- if is a hydrid, the classic key + * will be present first, i.e., OQS key always at comp_*key[numkeys-1] - if + * is a composite, the classic key will be presented second, i.e., OQS key + * always at comp_*key[0] */ void **comp_privkey; void **comp_pubkey; diff --git a/oqsprov/oqs_sig.c b/oqsprov/oqs_sig.c index 2e48eaa3..e63d4747 100644 --- a/oqsprov/oqs_sig.c +++ b/oqsprov/oqs_sig.c @@ -7,12 +7,8 @@ * */ -#include "oqs/sig.h" - -#include - -#include "oqs_prov.h" #include +#include #include #include #include @@ -20,30 +16,32 @@ #include #include #include +#include #include +#include -#include -#include +#include "oqs/sig.h" +#include "oqs_prov.h" // TBD: Review what we really need/want: For now go with OSSL settings: -#define OSSL_MAX_NAME_SIZE 50 -#define OSSL_MAX_PROPQUERY_SIZE 256 /* Property query strings */ +#define OSSL_MAX_NAME_SIZE 50 +#define OSSL_MAX_PROPQUERY_SIZE 256 /* Property query strings */ #define COMPOSITE_OID_PREFIX_LEN 26 #ifdef NDEBUG -# define OQS_SIG_PRINTF(a) -# define OQS_SIG_PRINTF2(a, b) -# define OQS_SIG_PRINTF3(a, b, c) +#define OQS_SIG_PRINTF(a) +#define OQS_SIG_PRINTF2(a, b) +#define OQS_SIG_PRINTF3(a, b, c) #else -# define OQS_SIG_PRINTF(a) \ - if (getenv("OQSSIG")) \ - printf(a) -# define OQS_SIG_PRINTF2(a, b) \ - if (getenv("OQSSIG")) \ - printf(a, b) -# define OQS_SIG_PRINTF3(a, b, c) \ - if (getenv("OQSSIG")) \ - printf(a, b, c) +#define OQS_SIG_PRINTF(a) \ + if (getenv("OQSSIG")) \ + printf(a) +#define OQS_SIG_PRINTF2(a, b) \ + if (getenv("OQSSIG")) \ + printf(a, b) +#define OQS_SIG_PRINTF3(a, b, c) \ + if (getenv("OQSSIG")) \ + printf(a, b, c) #endif // NDEBUG static OSSL_FUNC_signature_newctx_fn oqs_sig_newctx; @@ -73,8 +71,7 @@ static OSSL_FUNC_signature_settable_ctx_md_params_fn oqs_sig_settable_ctx_md_params; // OIDS: -static int get_aid(unsigned char **oidbuf, const char *tls_name) -{ +static int get_aid(unsigned char **oidbuf, const char *tls_name) { X509_ALGOR *algor = X509_ALGOR_new(); int aidlen = 0; @@ -87,19 +84,19 @@ static int get_aid(unsigned char **oidbuf, const char *tls_name) DECLARE_ASN1_FUNCTIONS(CompositeSignature) -ASN1_NDEF_SEQUENCE(CompositeSignature) = { - ASN1_SIMPLE(CompositeSignature, sig1, ASN1_BIT_STRING), - ASN1_SIMPLE(CompositeSignature, sig2, ASN1_BIT_STRING), +ASN1_NDEF_SEQUENCE(CompositeSignature) = + { + ASN1_SIMPLE(CompositeSignature, sig1, ASN1_BIT_STRING), + ASN1_SIMPLE(CompositeSignature, sig2, ASN1_BIT_STRING), } ASN1_NDEF_SEQUENCE_END(CompositeSignature) -IMPLEMENT_ASN1_FUNCTIONS(CompositeSignature) + IMPLEMENT_ASN1_FUNCTIONS(CompositeSignature) -/* - * What's passed as an actual key is defined by the KEYMGMT interface. - */ + /* + * What's passed as an actual key is defined by the KEYMGMT interface. + */ -typedef struct -{ + typedef struct { OSSL_LIB_CTX *libctx; char *propq; OQSX_KEY *sig; @@ -127,8 +124,7 @@ typedef struct int operation; } PROV_OQSSIG_CTX; -static void *oqs_sig_newctx(void *provctx, const char *propq) -{ +static void *oqs_sig_newctx(void *provctx, const char *propq) { PROV_OQSSIG_CTX *poqs_sigctx; OQS_SIG_PRINTF2("OQS SIG provider: newctx called with propq %s\n", propq); @@ -147,8 +143,7 @@ static void *oqs_sig_newctx(void *provctx, const char *propq) } static int oqs_sig_setup_md(PROV_OQSSIG_CTX *ctx, const char *mdname, - const char *mdprops) -{ + const char *mdprops) { OQS_SIG_PRINTF3("OQS SIG provider: setup_md called for MD %s (alg %s)\n", mdname, ctx->sig->tls_name); if (mdprops == NULL) @@ -182,8 +177,7 @@ static int oqs_sig_setup_md(PROV_OQSSIG_CTX *ctx, const char *mdname, } static int oqs_sig_signverify_init(void *vpoqs_sigctx, void *voqssig, - int operation) -{ + int operation) { PROV_OQSSIG_CTX *poqs_sigctx = (PROV_OQSSIG_CTX *)vpoqs_sigctx; OQS_SIG_PRINTF("OQS SIG provider: signverify_init called\n"); @@ -193,8 +187,8 @@ static int oqs_sig_signverify_init(void *vpoqs_sigctx, void *voqssig, poqs_sigctx->sig = voqssig; poqs_sigctx->operation = operation; poqs_sigctx->flag_allow_md = 1; /* change permitted until first use */ - if ((operation == EVP_PKEY_OP_SIGN && !poqs_sigctx->sig->privkey) - || (operation == EVP_PKEY_OP_VERIFY && !poqs_sigctx->sig->pubkey)) { + if ((operation == EVP_PKEY_OP_SIGN && !poqs_sigctx->sig->privkey) || + (operation == EVP_PKEY_OP_VERIFY && !poqs_sigctx->sig->pubkey)) { ERR_raise(ERR_LIB_USER, OQSPROV_R_INVALID_KEY); return 0; } @@ -202,15 +196,13 @@ static int oqs_sig_signverify_init(void *vpoqs_sigctx, void *voqssig, } static int oqs_sig_sign_init(void *vpoqs_sigctx, void *voqssig, - const OSSL_PARAM params[]) -{ + const OSSL_PARAM params[]) { OQS_SIG_PRINTF("OQS SIG provider: sign_init called\n"); return oqs_sig_signverify_init(vpoqs_sigctx, voqssig, EVP_PKEY_OP_SIGN); } static int oqs_sig_verify_init(void *vpoqs_sigctx, void *voqssig, - const OSSL_PARAM params[]) -{ + const OSSL_PARAM params[]) { OQS_SIG_PRINTF("OQS SIG provider: verify_init called\n"); return oqs_sig_signverify_init(vpoqs_sigctx, voqssig, EVP_PKEY_OP_VERIFY); } @@ -253,8 +245,7 @@ static const unsigned char *composite_OID_prefix[] = { }; /*put the chars on in into memory on out*/ -void composite_prefix_conversion(char *out, const unsigned char *in) -{ +void composite_prefix_conversion(char *out, const unsigned char *in) { int temp; for (int i = 0; i < COMPOSITE_OID_PREFIX_LEN / 2; i++) { temp = OPENSSL_hexchar2int(in[2 * i]); @@ -269,8 +260,8 @@ void composite_prefix_conversion(char *out, const unsigned char *in) * NULL, we have to hash in case of hybrid signatures */ static int oqs_sig_sign(void *vpoqs_sigctx, unsigned char *sig, size_t *siglen, - size_t sigsize, const unsigned char *tbs, size_t tbslen) -{ + size_t sigsize, const unsigned char *tbs, + size_t tbslen) { PROV_OQSSIG_CTX *poqs_sigctx = (PROV_OQSSIG_CTX *)vpoqs_sigctx; OQSX_KEY *oqsxkey = poqs_sigctx->sig; OQS_SIG *oqs_key = poqs_sigctx->sig->oqsx_provider_ctx.oqsx_qs_ctx.sig; @@ -317,15 +308,14 @@ static int oqs_sig_sign(void *vpoqs_sigctx, unsigned char *sig, size_t *siglen, } if (is_hybrid) { - if ((classical_ctx_sign = EVP_PKEY_CTX_new(evpkey, NULL)) == NULL - || EVP_PKEY_sign_init(classical_ctx_sign) <= 0) { + if ((classical_ctx_sign = EVP_PKEY_CTX_new(evpkey, NULL)) == NULL || + EVP_PKEY_sign_init(classical_ctx_sign) <= 0) { ERR_raise(ERR_LIB_USER, ERR_R_FATAL); goto endsign; } if (oqsxkey->evp_info->keytype == EVP_PKEY_RSA) { if (EVP_PKEY_CTX_set_rsa_padding(classical_ctx_sign, - RSA_PKCS1_PADDING) - <= 0) { + RSA_PKCS1_PADDING) <= 0) { ERR_raise(ERR_LIB_USER, ERR_R_FATAL); goto endsign; } @@ -339,7 +329,8 @@ static int oqs_sig_sign(void *vpoqs_sigctx, unsigned char *sig, size_t *siglen, int digest_len; unsigned char digest[SHA512_DIGEST_LENGTH]; /* init with max length */ - /* classical schemes can't sign arbitrarily large data; we hash it first + /* classical schemes can't sign arbitrarily large data; we hash it + * first */ switch (oqs_key->claimed_nist_level) { case 1: @@ -361,11 +352,11 @@ static int oqs_sig_sign(void *vpoqs_sigctx, unsigned char *sig, size_t *siglen, SHA512(tbs, tbslen, (unsigned char *)&digest); break; } - if ((EVP_PKEY_CTX_set_signature_md(classical_ctx_sign, classical_md) - <= 0) - || (EVP_PKEY_sign(classical_ctx_sign, sig + SIZE_OF_UINT32, - &actual_classical_sig_len, digest, digest_len) - <= 0)) { + if ((EVP_PKEY_CTX_set_signature_md(classical_ctx_sign, classical_md) <= + 0) || + (EVP_PKEY_sign(classical_ctx_sign, sig + SIZE_OF_UINT32, + &actual_classical_sig_len, digest, + digest_len) <= 0)) { ERR_raise(ERR_LIB_USER, ERR_R_FATAL); goto endsign; } @@ -399,11 +390,10 @@ static int oqs_sig_sign(void *vpoqs_sigctx, unsigned char *sig, size_t *siglen, const unsigned char *oid_prefix = composite_OID_prefix[comp_idx - 1]; char *final_tbs; CompositeSignature *compsig = CompositeSignature_new(); - size_t final_tbslen - = COMPOSITE_OID_PREFIX_LEN - / 2; // COMPOSITE_OID_PREFIX_LEN stores the size of the *char, but - // the prefix will be on memory, so each 2 chars will - // translate into one byte + size_t final_tbslen = COMPOSITE_OID_PREFIX_LEN / + 2; // COMPOSITE_OID_PREFIX_LEN stores the size of + // the *char, but the prefix will be on memory, + // so each 2 chars will translate into one byte int aux = 0; unsigned char *tbs_hash; @@ -418,10 +408,10 @@ static int oqs_sig_sign(void *vpoqs_sigctx, unsigned char *sig, size_t *siglen, } upcase_name = get_oqsname_fromtls(name); - if ((upcase_name != 0) - && ((!strcmp(upcase_name, OQS_SIG_alg_ml_dsa_65)) - || (!strcmp(upcase_name, OQS_SIG_alg_ml_dsa_87))) - || (name[0] == 'e')) { + if ((upcase_name != 0) && + ((!strcmp(upcase_name, OQS_SIG_alg_ml_dsa_65)) || + (!strcmp(upcase_name, OQS_SIG_alg_ml_dsa_87))) || + (name[0] == 'e')) { aux = 1; OPENSSL_free(name); break; @@ -465,8 +455,8 @@ static int oqs_sig_sign(void *vpoqs_sigctx, unsigned char *sig, size_t *siglen, ->length_signature; buf = OPENSSL_malloc(oqs_sig_len); if (OQS_SIG_sign(oqs_key, buf, &oqs_sig_len, final_tbs, - final_tbslen, oqsxkey->comp_privkey[i]) - != OQS_SUCCESS) { + final_tbslen, + oqsxkey->comp_privkey[i]) != OQS_SUCCESS) { ERR_raise(ERR_LIB_USER, OQSPROV_R_SIGNING_FAILED); CompositeSignature_free(compsig); OPENSSL_free(final_tbs); @@ -481,17 +471,15 @@ static int oqs_sig_sign(void *vpoqs_sigctx, unsigned char *sig, size_t *siglen, buf = OPENSSL_malloc(oqs_sig_len); const EVP_MD *classical_md; int digest_len; - unsigned char - digest[SHA512_DIGEST_LENGTH]; /* init with max length */ + unsigned char digest[SHA512_DIGEST_LENGTH]; /* init with max + length */ if (name[0] == 'e') { // ed25519 or ed448 EVP_MD_CTX *evp_ctx = EVP_MD_CTX_new(); if ((EVP_DigestSignInit(evp_ctx, NULL, NULL, NULL, - oqs_key_classic) - <= 0) - || (EVP_DigestSign(evp_ctx, buf, &oqs_sig_len, - final_tbs, final_tbslen) - <= 0)) { + oqs_key_classic) <= 0) || + (EVP_DigestSign(evp_ctx, buf, &oqs_sig_len, final_tbs, + final_tbslen) <= 0)) { ERR_raise(ERR_LIB_USER, ERR_R_FATAL); CompositeSignature_free(compsig); OPENSSL_free(final_tbs); @@ -502,10 +490,9 @@ static int oqs_sig_sign(void *vpoqs_sigctx, unsigned char *sig, size_t *siglen, } EVP_MD_CTX_free(evp_ctx); } else { - if ((classical_ctx_sign - = EVP_PKEY_CTX_new(oqs_key_classic, NULL)) - == NULL - || (EVP_PKEY_sign_init(classical_ctx_sign) <= 0)) { + if ((classical_ctx_sign = + EVP_PKEY_CTX_new(oqs_key_classic, NULL)) == NULL || + (EVP_PKEY_sign_init(classical_ctx_sign) <= 0)) { ERR_raise(ERR_LIB_USER, ERR_R_FATAL); CompositeSignature_free(compsig); OPENSSL_free(final_tbs); @@ -533,15 +520,13 @@ static int oqs_sig_sign(void *vpoqs_sigctx, unsigned char *sig, size_t *siglen, goto endsign; } } - if ((EVP_PKEY_CTX_set_rsa_padding(classical_ctx_sign, - RSA_PKCS1_PSS_PADDING) - <= 0) - || (EVP_PKEY_CTX_set_rsa_pss_saltlen( - classical_ctx_sign, salt) - <= 0) - || (EVP_PKEY_CTX_set_rsa_mgf1_md(classical_ctx_sign, - pss_mgf1) - <= 0)) { + if ((EVP_PKEY_CTX_set_rsa_padding( + classical_ctx_sign, RSA_PKCS1_PSS_PADDING) <= + 0) || + (EVP_PKEY_CTX_set_rsa_pss_saltlen( + classical_ctx_sign, salt) <= 0) || + (EVP_PKEY_CTX_set_rsa_mgf1_md(classical_ctx_sign, + pss_mgf1) <= 0)) { ERR_raise(ERR_LIB_USER, ERR_R_FATAL); CompositeSignature_free(compsig); OPENSSL_free(final_tbs); @@ -550,11 +535,9 @@ static int oqs_sig_sign(void *vpoqs_sigctx, unsigned char *sig, size_t *siglen, goto endsign; } } else if (oqsxkey->oqsx_provider_ctx.oqsx_evp_ctx->evp_info - ->keytype - == EVP_PKEY_RSA) { - if (EVP_PKEY_CTX_set_rsa_padding(classical_ctx_sign, - RSA_PKCS1_PADDING) - <= 0) { + ->keytype == EVP_PKEY_RSA) { + if (EVP_PKEY_CTX_set_rsa_padding( + classical_ctx_sign, RSA_PKCS1_PADDING) <= 0) { ERR_raise(ERR_LIB_USER, ERR_R_FATAL); CompositeSignature_free(compsig); OPENSSL_free(final_tbs); @@ -576,11 +559,9 @@ static int oqs_sig_sign(void *vpoqs_sigctx, unsigned char *sig, size_t *siglen, } if ((EVP_PKEY_CTX_set_signature_md(classical_ctx_sign, - classical_md) - <= 0) - || (EVP_PKEY_sign(classical_ctx_sign, buf, &oqs_sig_len, - digest, digest_len) - <= 0)) { + classical_md) <= 0) || + (EVP_PKEY_sign(classical_ctx_sign, buf, &oqs_sig_len, + digest, digest_len) <= 0)) { ERR_raise(ERR_LIB_USER, ERR_R_FATAL); CompositeSignature_free(compsig); OPENSSL_free(final_tbs); @@ -605,13 +586,13 @@ static int oqs_sig_sign(void *vpoqs_sigctx, unsigned char *sig, size_t *siglen, if (i == 0) { compsig->sig1->data = OPENSSL_memdup(buf, oqs_sig_len); compsig->sig1->length = oqs_sig_len; - compsig->sig1->flags - = 8; // set as 8 to not check for unused bits + compsig->sig1->flags = + 8; // set as 8 to not check for unused bits } else { compsig->sig2->data = OPENSSL_memdup(buf, oqs_sig_len); compsig->sig2->length = oqs_sig_len; - compsig->sig2->flags - = 8; // set as 8 to not check for unused bits + compsig->sig2->flags = + 8; // set as 8 to not check for unused bits } OPENSSL_free(buf); @@ -622,8 +603,8 @@ static int oqs_sig_sign(void *vpoqs_sigctx, unsigned char *sig, size_t *siglen, CompositeSignature_free(compsig); OPENSSL_free(final_tbs); } else if (OQS_SIG_sign(oqs_key, sig + index, &oqs_sig_len, tbs, tbslen, - oqsxkey->comp_privkey[oqsxkey->numkeys - 1]) - != OQS_SUCCESS) { + oqsxkey->comp_privkey[oqsxkey->numkeys - 1]) != + OQS_SUCCESS) { ERR_raise(ERR_LIB_USER, OQSPROV_R_SIGNING_FAILED); goto endsign; } @@ -642,8 +623,7 @@ static int oqs_sig_sign(void *vpoqs_sigctx, unsigned char *sig, size_t *siglen, static int oqs_sig_verify(void *vpoqs_sigctx, const unsigned char *sig, size_t siglen, const unsigned char *tbs, - size_t tbslen) -{ + size_t tbslen) { PROV_OQSSIG_CTX *poqs_sigctx = (PROV_OQSSIG_CTX *)vpoqs_sigctx; OQSX_KEY *oqsxkey = poqs_sigctx->sig; OQS_SIG *oqs_key = poqs_sigctx->sig->oqsx_provider_ctx.oqsx_qs_ctx.sig; @@ -657,12 +637,12 @@ static int oqs_sig_verify(void *vpoqs_sigctx, const unsigned char *sig, int rv = 0; ASN1_BIT_STRING *comp_sig; - OQS_SIG_PRINTF3( - "OQS SIG provider: verify called with siglen %ld bytes and tbslen %ld\n", - siglen, tbslen); + OQS_SIG_PRINTF3("OQS SIG provider: verify called with siglen %ld bytes and " + "tbslen %ld\n", + siglen, tbslen); - if (!oqsxkey || !oqs_key || !oqsxkey->pubkey || sig == NULL - || (tbs == NULL && tbslen > 0)) { + if (!oqsxkey || !oqs_key || !oqsxkey->pubkey || sig == NULL || + (tbs == NULL && tbslen > 0)) { ERR_raise(ERR_LIB_USER, OQSPROV_R_WRONG_PARAMETERS); goto endverify; } @@ -672,20 +652,20 @@ static int oqs_sig_verify(void *vpoqs_sigctx, const unsigned char *sig, uint32_t actual_classical_sig_len = 0; int digest_len; unsigned char digest[SHA512_DIGEST_LENGTH]; /* init with max length */ - size_t max_pq_sig_len - = oqsxkey->oqsx_provider_ctx.oqsx_qs_ctx.sig->length_signature; - size_t max_classical_sig_len = oqsxkey->oqsx_provider_ctx.oqsx_evp_ctx - ->evp_info->length_signature; - - if ((ctx_verify = EVP_PKEY_CTX_new(oqsxkey->classical_pkey, NULL)) - == NULL - || EVP_PKEY_verify_init(ctx_verify) <= 0) { + size_t max_pq_sig_len = + oqsxkey->oqsx_provider_ctx.oqsx_qs_ctx.sig->length_signature; + size_t max_classical_sig_len = + oqsxkey->oqsx_provider_ctx.oqsx_evp_ctx->evp_info->length_signature; + + if ((ctx_verify = EVP_PKEY_CTX_new(oqsxkey->classical_pkey, NULL)) == + NULL || + EVP_PKEY_verify_init(ctx_verify) <= 0) { ERR_raise(ERR_LIB_USER, OQSPROV_R_VERIFY_ERROR); goto endverify; } if (oqsxkey->evp_info->keytype == EVP_PKEY_RSA) { - if (EVP_PKEY_CTX_set_rsa_padding(ctx_verify, RSA_PKCS1_PADDING) - <= 0) { + if (EVP_PKEY_CTX_set_rsa_padding(ctx_verify, RSA_PKCS1_PADDING) <= + 0) { ERR_raise(ERR_LIB_USER, OQSPROV_R_WRONG_PARAMETERS); goto endverify; } @@ -693,11 +673,11 @@ static int oqs_sig_verify(void *vpoqs_sigctx, const unsigned char *sig, if (siglen > SIZE_OF_UINT32) { size_t actual_pq_sig_len = 0; DECODE_UINT32(actual_classical_sig_len, sig); - actual_pq_sig_len - = siglen - SIZE_OF_UINT32 - actual_classical_sig_len; - if (siglen <= (SIZE_OF_UINT32 + actual_classical_sig_len) - || actual_classical_sig_len > max_classical_sig_len - || actual_pq_sig_len > max_pq_sig_len) { + actual_pq_sig_len = + siglen - SIZE_OF_UINT32 - actual_classical_sig_len; + if (siglen <= (SIZE_OF_UINT32 + actual_classical_sig_len) || + actual_classical_sig_len > max_classical_sig_len || + actual_pq_sig_len > max_pq_sig_len) { ERR_raise(ERR_LIB_USER, OQSPROV_R_INVALID_ENCODING); goto endverify; } @@ -729,10 +709,10 @@ static int oqs_sig_verify(void *vpoqs_sigctx, const unsigned char *sig, SHA512(tbs, tbslen, (unsigned char *)&digest); break; } - if ((EVP_PKEY_CTX_set_signature_md(ctx_verify, classical_md) <= 0) - || (EVP_PKEY_verify(ctx_verify, sig + SIZE_OF_UINT32, - actual_classical_sig_len, digest, digest_len) - <= 0)) { + if ((EVP_PKEY_CTX_set_signature_md(ctx_verify, classical_md) <= 0) || + (EVP_PKEY_verify(ctx_verify, sig + SIZE_OF_UINT32, + actual_classical_sig_len, digest, + digest_len) <= 0)) { ERR_raise(ERR_LIB_USER, OQSPROV_R_VERIFY_ERROR); goto endverify; } else { @@ -783,10 +763,10 @@ static int oqs_sig_verify(void *vpoqs_sigctx, const unsigned char *sig, } upcase_name = get_oqsname_fromtls(name); - if ((upcase_name != 0) - && ((!strcmp(upcase_name, OQS_SIG_alg_ml_dsa_65)) - || (!strcmp(upcase_name, OQS_SIG_alg_ml_dsa_87))) - || (name[0] == 'e')) { + if ((upcase_name != 0) && + ((!strcmp(upcase_name, OQS_SIG_alg_ml_dsa_65)) || + (!strcmp(upcase_name, OQS_SIG_alg_ml_dsa_87))) || + (name[0] == 'e')) { aux = 1; OPENSSL_free(name); break; @@ -835,8 +815,8 @@ static int oqs_sig_verify(void *vpoqs_sigctx, const unsigned char *sig, if (get_oqsname_fromtls(name)) { if (OQS_SIG_verify(oqs_key, final_tbs, final_tbslen, buf, - buf_len, oqsxkey->comp_pubkey[i]) - != OQS_SUCCESS) { + buf_len, + oqsxkey->comp_pubkey[i]) != OQS_SUCCESS) { ERR_raise(ERR_LIB_USER, OQSPROV_R_VERIFY_ERROR); OPENSSL_free(name); CompositeSignature_free(compsig); @@ -847,17 +827,15 @@ static int oqs_sig_verify(void *vpoqs_sigctx, const unsigned char *sig, const EVP_MD *classical_md; int digest_len; int aux; - unsigned char - digest[SHA512_DIGEST_LENGTH]; /* init with max length */ + unsigned char digest[SHA512_DIGEST_LENGTH]; /* init with max + length */ if (name[0] == 'e') { // ed25519 or ed448 EVP_MD_CTX *evp_ctx = EVP_MD_CTX_new(); if ((EVP_DigestVerifyInit(evp_ctx, NULL, NULL, NULL, - oqsxkey->classical_pkey) - <= 0) - || (EVP_DigestVerify(evp_ctx, buf, buf_len, final_tbs, - final_tbslen) - <= 0)) { + oqsxkey->classical_pkey) <= 0) || + (EVP_DigestVerify(evp_ctx, buf, buf_len, final_tbs, + final_tbslen) <= 0)) { ERR_raise(ERR_LIB_USER, OQSPROV_R_VERIFY_ERROR); OPENSSL_free(name); EVP_MD_CTX_free(evp_ctx); @@ -867,10 +845,9 @@ static int oqs_sig_verify(void *vpoqs_sigctx, const unsigned char *sig, } EVP_MD_CTX_free(evp_ctx); } else { - if (((ctx_verify - = EVP_PKEY_CTX_new(oqsxkey->classical_pkey, NULL)) - == NULL) - || (EVP_PKEY_verify_init(ctx_verify) <= 0)) { + if (((ctx_verify = EVP_PKEY_CTX_new(oqsxkey->classical_pkey, + NULL)) == NULL) || + (EVP_PKEY_verify_init(ctx_verify) <= 0)) { ERR_raise(ERR_LIB_USER, OQSPROV_R_VERIFY_ERROR); OPENSSL_free(name); CompositeSignature_free(compsig); @@ -895,15 +872,12 @@ static int oqs_sig_verify(void *vpoqs_sigctx, const unsigned char *sig, goto endverify; } } - if ((EVP_PKEY_CTX_set_rsa_padding(ctx_verify, - RSA_PKCS1_PSS_PADDING) - <= 0) - || (EVP_PKEY_CTX_set_rsa_pss_saltlen(ctx_verify, - salt) - <= 0) - || (EVP_PKEY_CTX_set_rsa_mgf1_md(ctx_verify, - pss_mgf1) - <= 0)) { + if ((EVP_PKEY_CTX_set_rsa_padding( + ctx_verify, RSA_PKCS1_PSS_PADDING) <= 0) || + (EVP_PKEY_CTX_set_rsa_pss_saltlen(ctx_verify, + salt) <= 0) || + (EVP_PKEY_CTX_set_rsa_mgf1_md(ctx_verify, + pss_mgf1) <= 0)) { ERR_raise(ERR_LIB_USER, OQSPROV_R_WRONG_PARAMETERS); OPENSSL_free(name); CompositeSignature_free(compsig); @@ -911,11 +885,9 @@ static int oqs_sig_verify(void *vpoqs_sigctx, const unsigned char *sig, goto endverify; } } else if (oqsxkey->oqsx_provider_ctx.oqsx_evp_ctx->evp_info - ->keytype - == EVP_PKEY_RSA) { - if (EVP_PKEY_CTX_set_rsa_padding(ctx_verify, - RSA_PKCS1_PADDING) - <= 0) { + ->keytype == EVP_PKEY_RSA) { + if (EVP_PKEY_CTX_set_rsa_padding( + ctx_verify, RSA_PKCS1_PADDING) <= 0) { ERR_raise(ERR_LIB_USER, OQSPROV_R_WRONG_PARAMETERS); OPENSSL_free(name); CompositeSignature_free(compsig); @@ -935,11 +907,10 @@ static int oqs_sig_verify(void *vpoqs_sigctx, const unsigned char *sig, (unsigned char *)&digest); } - if ((EVP_PKEY_CTX_set_signature_md(ctx_verify, classical_md) - <= 0) - || (EVP_PKEY_verify(ctx_verify, buf, buf_len, digest, - digest_len) - <= 0)) { + if ((EVP_PKEY_CTX_set_signature_md(ctx_verify, + classical_md) <= 0) || + (EVP_PKEY_verify(ctx_verify, buf, buf_len, digest, + digest_len) <= 0)) { ERR_raise(ERR_LIB_USER, OQSPROV_R_VERIFY_ERROR); OPENSSL_free(name); CompositeSignature_free(compsig); @@ -958,10 +929,9 @@ static int oqs_sig_verify(void *vpoqs_sigctx, const unsigned char *sig, ERR_raise(ERR_LIB_USER, OQSPROV_R_WRONG_PARAMETERS); goto endverify; } - if (OQS_SIG_verify(oqs_key, tbs, tbslen, sig + index, - siglen - classical_sig_len, - oqsxkey->comp_pubkey[oqsxkey->numkeys - 1]) - != OQS_SUCCESS) { + if (OQS_SIG_verify( + oqs_key, tbs, tbslen, sig + index, siglen - classical_sig_len, + oqsxkey->comp_pubkey[oqsxkey->numkeys - 1]) != OQS_SUCCESS) { ERR_raise(ERR_LIB_USER, OQSPROV_R_VERIFY_ERROR); goto endverify; } @@ -978,8 +948,7 @@ static int oqs_sig_verify(void *vpoqs_sigctx, const unsigned char *sig, static int oqs_sig_digest_signverify_init(void *vpoqs_sigctx, const char *mdname, void *voqssig, - int operation) -{ + int operation) { PROV_OQSSIG_CTX *poqs_sigctx = (PROV_OQSSIG_CTX *)vpoqs_sigctx; OQS_SIG_PRINTF2( @@ -1014,24 +983,23 @@ static int oqs_sig_digest_signverify_init(void *vpoqs_sigctx, } static int oqs_sig_digest_sign_init(void *vpoqs_sigctx, const char *mdname, - void *voqssig, const OSSL_PARAM params[]) -{ + void *voqssig, const OSSL_PARAM params[]) { OQS_SIG_PRINTF("OQS SIG provider: digest_sign_init called\n"); return oqs_sig_digest_signverify_init(vpoqs_sigctx, mdname, voqssig, EVP_PKEY_OP_SIGN); } static int oqs_sig_digest_verify_init(void *vpoqs_sigctx, const char *mdname, - void *voqssig, const OSSL_PARAM params[]) -{ + void *voqssig, + const OSSL_PARAM params[]) { OQS_SIG_PRINTF("OQS SIG provider: sig_digest_verify called\n"); return oqs_sig_digest_signverify_init(vpoqs_sigctx, mdname, voqssig, EVP_PKEY_OP_VERIFY); } int oqs_sig_digest_signverify_update(void *vpoqs_sigctx, - const unsigned char *data, size_t datalen) -{ + const unsigned char *data, + size_t datalen) { PROV_OQSSIG_CTX *poqs_sigctx = (PROV_OQSSIG_CTX *)vpoqs_sigctx; OQS_SIG_PRINTF("OQS SIG provider: digest_signverify_update called\n"); @@ -1060,16 +1028,15 @@ int oqs_sig_digest_signverify_update(void *vpoqs_sigctx, poqs_sigctx->mdsize = datalen; memcpy(poqs_sigctx->mddata, data, poqs_sigctx->mdsize); } - OQS_SIG_PRINTF2( - "OQS SIG provider: digest_signverify_update collected %ld bytes...\n", - poqs_sigctx->mdsize); + OQS_SIG_PRINTF2("OQS SIG provider: digest_signverify_update collected " + "%ld bytes...\n", + poqs_sigctx->mdsize); } return 1; } int oqs_sig_digest_sign_final(void *vpoqs_sigctx, unsigned char *sig, - size_t *siglen, size_t sigsize) -{ + size_t *siglen, size_t sigsize) { PROV_OQSSIG_CTX *poqs_sigctx = (PROV_OQSSIG_CTX *)vpoqs_sigctx; unsigned char digest[EVP_MAX_MD_SIZE]; unsigned int dlen = 0; @@ -1084,9 +1051,10 @@ int oqs_sig_digest_sign_final(void *vpoqs_sigctx, unsigned char *sig, */ if (sig != NULL) { /* - * TODO(3.0): There is the possibility that some externally provided - * digests exceed EVP_MAX_MD_SIZE. We should probably handle that - * somehow - but that problem is much larger than just here. + * TODO(3.0): There is the possibility that some externally + * provided digests exceed EVP_MAX_MD_SIZE. We should probably + * handle that somehow - but that problem is much larger than just + * here. */ if (poqs_sigctx->mdctx != NULL) if (!EVP_DigestFinal_ex(poqs_sigctx->mdctx, digest, &dlen)) @@ -1104,8 +1072,7 @@ int oqs_sig_digest_sign_final(void *vpoqs_sigctx, unsigned char *sig, } int oqs_sig_digest_verify_final(void *vpoqs_sigctx, const unsigned char *sig, - size_t siglen) -{ + size_t siglen) { PROV_OQSSIG_CTX *poqs_sigctx = (PROV_OQSSIG_CTX *)vpoqs_sigctx; unsigned char digest[EVP_MAX_MD_SIZE]; unsigned int dlen = 0; @@ -1127,8 +1094,7 @@ int oqs_sig_digest_verify_final(void *vpoqs_sigctx, const unsigned char *sig, poqs_sigctx->mdsize); } -static void oqs_sig_freectx(void *vpoqs_sigctx) -{ +static void oqs_sig_freectx(void *vpoqs_sigctx) { PROV_OQSSIG_CTX *ctx = (PROV_OQSSIG_CTX *)vpoqs_sigctx; OQS_SIG_PRINTF("OQS SIG provider: freectx called\n"); @@ -1148,8 +1114,7 @@ static void oqs_sig_freectx(void *vpoqs_sigctx) OPENSSL_free(ctx); } -static void *oqs_sig_dupctx(void *vpoqs_sigctx) -{ +static void *oqs_sig_dupctx(void *vpoqs_sigctx) { PROV_OQSSIG_CTX *srcctx = (PROV_OQSSIG_CTX *)vpoqs_sigctx; PROV_OQSSIG_CTX *dstctx; @@ -1174,8 +1139,8 @@ static void *oqs_sig_dupctx(void *vpoqs_sigctx) if (srcctx->mdctx != NULL) { dstctx->mdctx = EVP_MD_CTX_new(); - if (dstctx->mdctx == NULL - || !EVP_MD_CTX_copy_ex(dstctx->mdctx, srcctx->mdctx)) + if (dstctx->mdctx == NULL || + !EVP_MD_CTX_copy_ex(dstctx->mdctx, srcctx->mdctx)) goto err; } @@ -1205,8 +1170,7 @@ static void *oqs_sig_dupctx(void *vpoqs_sigctx) return NULL; } -static int oqs_sig_get_ctx_params(void *vpoqs_sigctx, OSSL_PARAM *params) -{ +static int oqs_sig_get_ctx_params(void *vpoqs_sigctx, OSSL_PARAM *params) { PROV_OQSSIG_CTX *poqs_sigctx = (PROV_OQSSIG_CTX *)vpoqs_sigctx; OSSL_PARAM *p; @@ -1217,13 +1181,12 @@ static int oqs_sig_get_ctx_params(void *vpoqs_sigctx, OSSL_PARAM *params) p = OSSL_PARAM_locate(params, OSSL_SIGNATURE_PARAM_ALGORITHM_ID); if (poqs_sigctx->aid == NULL) { - poqs_sigctx->aid_len - = get_aid(&(poqs_sigctx->aid), poqs_sigctx->sig->tls_name); + poqs_sigctx->aid_len = + get_aid(&(poqs_sigctx->aid), poqs_sigctx->sig->tls_name); } - if (p != NULL - && !OSSL_PARAM_set_octet_string(p, poqs_sigctx->aid, - poqs_sigctx->aid_len)) + if (p != NULL && + !OSSL_PARAM_set_octet_string(p, poqs_sigctx->aid, poqs_sigctx->aid_len)) return 0; p = OSSL_PARAM_locate(params, OSSL_SIGNATURE_PARAM_DIGEST); @@ -1233,20 +1196,19 @@ static int oqs_sig_get_ctx_params(void *vpoqs_sigctx, OSSL_PARAM *params) return 1; } -static const OSSL_PARAM known_gettable_ctx_params[] - = {OSSL_PARAM_octet_string(OSSL_SIGNATURE_PARAM_ALGORITHM_ID, NULL, 0), - OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_DIGEST, NULL, 0), - OSSL_PARAM_END}; +static const OSSL_PARAM known_gettable_ctx_params[] = { + OSSL_PARAM_octet_string(OSSL_SIGNATURE_PARAM_ALGORITHM_ID, NULL, 0), + OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_DIGEST, NULL, 0), + OSSL_PARAM_END}; static const OSSL_PARAM * oqs_sig_gettable_ctx_params(ossl_unused void *vpoqs_sigctx, - ossl_unused void *vctx) -{ + ossl_unused void *vctx) { OQS_SIG_PRINTF("OQS SIG provider: gettable_ctx_params called\n"); return known_gettable_ctx_params; } -static int oqs_sig_set_ctx_params(void *vpoqs_sigctx, const OSSL_PARAM params[]) -{ +static int oqs_sig_set_ctx_params(void *vpoqs_sigctx, + const OSSL_PARAM params[]) { PROV_OQSSIG_CTX *poqs_sigctx = (PROV_OQSSIG_CTX *)vpoqs_sigctx; const OSSL_PARAM *p; @@ -1261,13 +1223,13 @@ static int oqs_sig_set_ctx_params(void *vpoqs_sigctx, const OSSL_PARAM params[]) if (p != NULL) { char mdname[OSSL_MAX_NAME_SIZE] = "", *pmdname = mdname; char mdprops[OSSL_MAX_PROPQUERY_SIZE] = "", *pmdprops = mdprops; - const OSSL_PARAM *propsp - = OSSL_PARAM_locate_const(params, OSSL_SIGNATURE_PARAM_PROPERTIES); + const OSSL_PARAM *propsp = + OSSL_PARAM_locate_const(params, OSSL_SIGNATURE_PARAM_PROPERTIES); if (!OSSL_PARAM_get_utf8_string(p, &pmdname, sizeof(mdname))) return 0; - if (propsp != NULL - && !OSSL_PARAM_get_utf8_string(propsp, &pmdprops, sizeof(mdprops))) + if (propsp != NULL && + !OSSL_PARAM_get_utf8_string(propsp, &pmdprops, sizeof(mdprops))) return 0; if (!oqs_sig_setup_md(poqs_sigctx, mdname, mdprops)) return 0; @@ -1277,14 +1239,14 @@ static int oqs_sig_set_ctx_params(void *vpoqs_sigctx, const OSSL_PARAM params[]) return 1; } -static const OSSL_PARAM known_settable_ctx_params[] - = {OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_DIGEST, NULL, 0), - OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_PROPERTIES, NULL, 0), - OSSL_PARAM_END}; +static const OSSL_PARAM known_settable_ctx_params[] = { + OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_DIGEST, NULL, 0), + OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_PROPERTIES, NULL, 0), + OSSL_PARAM_END}; -static const OSSL_PARAM *oqs_sig_settable_ctx_params(ossl_unused void *vpsm2ctx, - ossl_unused void *provctx) -{ +static const OSSL_PARAM * +oqs_sig_settable_ctx_params(ossl_unused void *vpsm2ctx, + ossl_unused void *provctx) { /* * TODO(3.0): Should this function return a different set of settable ctx * params if the ctx is being used for a DigestSign/DigestVerify? In that @@ -1301,8 +1263,7 @@ static const OSSL_PARAM *oqs_sig_settable_ctx_params(ossl_unused void *vpsm2ctx, return known_settable_ctx_params; } -static int oqs_sig_get_ctx_md_params(void *vpoqs_sigctx, OSSL_PARAM *params) -{ +static int oqs_sig_get_ctx_md_params(void *vpoqs_sigctx, OSSL_PARAM *params) { PROV_OQSSIG_CTX *poqs_sigctx = (PROV_OQSSIG_CTX *)vpoqs_sigctx; OQS_SIG_PRINTF("OQS SIG provider: get_ctx_md_params called\n"); @@ -1312,8 +1273,7 @@ static int oqs_sig_get_ctx_md_params(void *vpoqs_sigctx, OSSL_PARAM *params) return EVP_MD_CTX_get_params(poqs_sigctx->mdctx, params); } -static const OSSL_PARAM *oqs_sig_gettable_ctx_md_params(void *vpoqs_sigctx) -{ +static const OSSL_PARAM *oqs_sig_gettable_ctx_md_params(void *vpoqs_sigctx) { PROV_OQSSIG_CTX *poqs_sigctx = (PROV_OQSSIG_CTX *)vpoqs_sigctx; OQS_SIG_PRINTF("OQS SIG provider: gettable_ctx_md_params called\n"); @@ -1324,8 +1284,7 @@ static const OSSL_PARAM *oqs_sig_gettable_ctx_md_params(void *vpoqs_sigctx) } static int oqs_sig_set_ctx_md_params(void *vpoqs_sigctx, - const OSSL_PARAM params[]) -{ + const OSSL_PARAM params[]) { PROV_OQSSIG_CTX *poqs_sigctx = (PROV_OQSSIG_CTX *)vpoqs_sigctx; OQS_SIG_PRINTF("OQS SIG provider: set_ctx_md_params called\n"); @@ -1335,8 +1294,7 @@ static int oqs_sig_set_ctx_md_params(void *vpoqs_sigctx, return EVP_MD_CTX_set_params(poqs_sigctx->mdctx, params); } -static const OSSL_PARAM *oqs_sig_settable_ctx_md_params(void *vpoqs_sigctx) -{ +static const OSSL_PARAM *oqs_sig_settable_ctx_md_params(void *vpoqs_sigctx) { PROV_OQSSIG_CTX *poqs_sigctx = (PROV_OQSSIG_CTX *)vpoqs_sigctx; if (poqs_sigctx->md == NULL) @@ -1346,40 +1304,40 @@ static const OSSL_PARAM *oqs_sig_settable_ctx_md_params(void *vpoqs_sigctx) return EVP_MD_settable_ctx_params(poqs_sigctx->md); } -const OSSL_DISPATCH oqs_signature_functions[] - = {{OSSL_FUNC_SIGNATURE_NEWCTX, (void (*)(void))oqs_sig_newctx}, - {OSSL_FUNC_SIGNATURE_SIGN_INIT, (void (*)(void))oqs_sig_sign_init}, - {OSSL_FUNC_SIGNATURE_SIGN, (void (*)(void))oqs_sig_sign}, - {OSSL_FUNC_SIGNATURE_VERIFY_INIT, (void (*)(void))oqs_sig_verify_init}, - {OSSL_FUNC_SIGNATURE_VERIFY, (void (*)(void))oqs_sig_verify}, - {OSSL_FUNC_SIGNATURE_DIGEST_SIGN_INIT, - (void (*)(void))oqs_sig_digest_sign_init}, - {OSSL_FUNC_SIGNATURE_DIGEST_SIGN_UPDATE, - (void (*)(void))oqs_sig_digest_signverify_update}, - {OSSL_FUNC_SIGNATURE_DIGEST_SIGN_FINAL, - (void (*)(void))oqs_sig_digest_sign_final}, - {OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_INIT, - (void (*)(void))oqs_sig_digest_verify_init}, - {OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_UPDATE, - (void (*)(void))oqs_sig_digest_signverify_update}, - {OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_FINAL, - (void (*)(void))oqs_sig_digest_verify_final}, - {OSSL_FUNC_SIGNATURE_FREECTX, (void (*)(void))oqs_sig_freectx}, - {OSSL_FUNC_SIGNATURE_DUPCTX, (void (*)(void))oqs_sig_dupctx}, - {OSSL_FUNC_SIGNATURE_GET_CTX_PARAMS, - (void (*)(void))oqs_sig_get_ctx_params}, - {OSSL_FUNC_SIGNATURE_GETTABLE_CTX_PARAMS, - (void (*)(void))oqs_sig_gettable_ctx_params}, - {OSSL_FUNC_SIGNATURE_SET_CTX_PARAMS, - (void (*)(void))oqs_sig_set_ctx_params}, - {OSSL_FUNC_SIGNATURE_SETTABLE_CTX_PARAMS, - (void (*)(void))oqs_sig_settable_ctx_params}, - {OSSL_FUNC_SIGNATURE_GET_CTX_MD_PARAMS, - (void (*)(void))oqs_sig_get_ctx_md_params}, - {OSSL_FUNC_SIGNATURE_GETTABLE_CTX_MD_PARAMS, - (void (*)(void))oqs_sig_gettable_ctx_md_params}, - {OSSL_FUNC_SIGNATURE_SET_CTX_MD_PARAMS, - (void (*)(void))oqs_sig_set_ctx_md_params}, - {OSSL_FUNC_SIGNATURE_SETTABLE_CTX_MD_PARAMS, - (void (*)(void))oqs_sig_settable_ctx_md_params}, - {0, NULL}}; +const OSSL_DISPATCH oqs_signature_functions[] = { + {OSSL_FUNC_SIGNATURE_NEWCTX, (void (*)(void))oqs_sig_newctx}, + {OSSL_FUNC_SIGNATURE_SIGN_INIT, (void (*)(void))oqs_sig_sign_init}, + {OSSL_FUNC_SIGNATURE_SIGN, (void (*)(void))oqs_sig_sign}, + {OSSL_FUNC_SIGNATURE_VERIFY_INIT, (void (*)(void))oqs_sig_verify_init}, + {OSSL_FUNC_SIGNATURE_VERIFY, (void (*)(void))oqs_sig_verify}, + {OSSL_FUNC_SIGNATURE_DIGEST_SIGN_INIT, + (void (*)(void))oqs_sig_digest_sign_init}, + {OSSL_FUNC_SIGNATURE_DIGEST_SIGN_UPDATE, + (void (*)(void))oqs_sig_digest_signverify_update}, + {OSSL_FUNC_SIGNATURE_DIGEST_SIGN_FINAL, + (void (*)(void))oqs_sig_digest_sign_final}, + {OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_INIT, + (void (*)(void))oqs_sig_digest_verify_init}, + {OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_UPDATE, + (void (*)(void))oqs_sig_digest_signverify_update}, + {OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_FINAL, + (void (*)(void))oqs_sig_digest_verify_final}, + {OSSL_FUNC_SIGNATURE_FREECTX, (void (*)(void))oqs_sig_freectx}, + {OSSL_FUNC_SIGNATURE_DUPCTX, (void (*)(void))oqs_sig_dupctx}, + {OSSL_FUNC_SIGNATURE_GET_CTX_PARAMS, + (void (*)(void))oqs_sig_get_ctx_params}, + {OSSL_FUNC_SIGNATURE_GETTABLE_CTX_PARAMS, + (void (*)(void))oqs_sig_gettable_ctx_params}, + {OSSL_FUNC_SIGNATURE_SET_CTX_PARAMS, + (void (*)(void))oqs_sig_set_ctx_params}, + {OSSL_FUNC_SIGNATURE_SETTABLE_CTX_PARAMS, + (void (*)(void))oqs_sig_settable_ctx_params}, + {OSSL_FUNC_SIGNATURE_GET_CTX_MD_PARAMS, + (void (*)(void))oqs_sig_get_ctx_md_params}, + {OSSL_FUNC_SIGNATURE_GETTABLE_CTX_MD_PARAMS, + (void (*)(void))oqs_sig_gettable_ctx_md_params}, + {OSSL_FUNC_SIGNATURE_SET_CTX_MD_PARAMS, + (void (*)(void))oqs_sig_set_ctx_md_params}, + {OSSL_FUNC_SIGNATURE_SETTABLE_CTX_MD_PARAMS, + (void (*)(void))oqs_sig_settable_ctx_md_params}, + {0, NULL}}; diff --git a/oqsprov/oqsdecoders.inc b/oqsprov/oqsdecoders.inc index a2943dfb..3f32c776 100644 --- a/oqsprov/oqsdecoders.inc +++ b/oqsprov/oqsdecoders.inc @@ -36,411 +36,243 @@ ///// OQS_TEMPLATE_FRAGMENT_MAKE_START #ifdef OQS_KEM_ENCODERS -# ifdef OQS_ENABLE_KEM_frodokem_640_aes +#ifdef OQS_ENABLE_KEM_frodokem_640_aes DECODER_w_structure("frodo640aes", der, PrivateKeyInfo, frodo640aes), - DECODER_w_structure("frodo640aes", der, SubjectPublicKeyInfo, frodo640aes), - DECODER_w_structure("p256_frodo640aes", der, PrivateKeyInfo, - p256_frodo640aes), - DECODER_w_structure("p256_frodo640aes", der, SubjectPublicKeyInfo, - p256_frodo640aes), - DECODER_w_structure("x25519_frodo640aes", der, PrivateKeyInfo, - x25519_frodo640aes), - DECODER_w_structure("x25519_frodo640aes", der, SubjectPublicKeyInfo, - x25519_frodo640aes), -# endif -# ifdef OQS_ENABLE_KEM_frodokem_640_shake - DECODER_w_structure("frodo640shake", der, PrivateKeyInfo, frodo640shake), - DECODER_w_structure("frodo640shake", der, SubjectPublicKeyInfo, - frodo640shake), - DECODER_w_structure("p256_frodo640shake", der, PrivateKeyInfo, - p256_frodo640shake), - DECODER_w_structure("p256_frodo640shake", der, SubjectPublicKeyInfo, - p256_frodo640shake), - DECODER_w_structure("x25519_frodo640shake", der, PrivateKeyInfo, - x25519_frodo640shake), - DECODER_w_structure("x25519_frodo640shake", der, SubjectPublicKeyInfo, - x25519_frodo640shake), -# endif -# ifdef OQS_ENABLE_KEM_frodokem_976_aes - DECODER_w_structure("frodo976aes", der, PrivateKeyInfo, frodo976aes), - DECODER_w_structure("frodo976aes", der, SubjectPublicKeyInfo, frodo976aes), - DECODER_w_structure("p384_frodo976aes", der, PrivateKeyInfo, - p384_frodo976aes), - DECODER_w_structure("p384_frodo976aes", der, SubjectPublicKeyInfo, - p384_frodo976aes), - DECODER_w_structure("x448_frodo976aes", der, PrivateKeyInfo, - x448_frodo976aes), - DECODER_w_structure("x448_frodo976aes", der, SubjectPublicKeyInfo, - x448_frodo976aes), -# endif -# ifdef OQS_ENABLE_KEM_frodokem_976_shake - DECODER_w_structure("frodo976shake", der, PrivateKeyInfo, frodo976shake), - DECODER_w_structure("frodo976shake", der, SubjectPublicKeyInfo, - frodo976shake), - DECODER_w_structure("p384_frodo976shake", der, PrivateKeyInfo, - p384_frodo976shake), - DECODER_w_structure("p384_frodo976shake", der, SubjectPublicKeyInfo, - p384_frodo976shake), - DECODER_w_structure("x448_frodo976shake", der, PrivateKeyInfo, - x448_frodo976shake), - DECODER_w_structure("x448_frodo976shake", der, SubjectPublicKeyInfo, - x448_frodo976shake), -# endif -# ifdef OQS_ENABLE_KEM_frodokem_1344_aes - DECODER_w_structure("frodo1344aes", der, PrivateKeyInfo, frodo1344aes), - DECODER_w_structure("frodo1344aes", der, SubjectPublicKeyInfo, - frodo1344aes), - DECODER_w_structure("p521_frodo1344aes", der, PrivateKeyInfo, - p521_frodo1344aes), - DECODER_w_structure("p521_frodo1344aes", der, SubjectPublicKeyInfo, - p521_frodo1344aes), -# endif -# ifdef OQS_ENABLE_KEM_frodokem_1344_shake - DECODER_w_structure("frodo1344shake", der, PrivateKeyInfo, frodo1344shake), - DECODER_w_structure("frodo1344shake", der, SubjectPublicKeyInfo, - frodo1344shake), - DECODER_w_structure("p521_frodo1344shake", der, PrivateKeyInfo, - p521_frodo1344shake), - DECODER_w_structure("p521_frodo1344shake", der, SubjectPublicKeyInfo, - p521_frodo1344shake), -# endif -# ifdef OQS_ENABLE_KEM_kyber_512 - DECODER_w_structure("kyber512", der, PrivateKeyInfo, kyber512), - DECODER_w_structure("kyber512", der, SubjectPublicKeyInfo, kyber512), - DECODER_w_structure("p256_kyber512", der, PrivateKeyInfo, p256_kyber512), - DECODER_w_structure("p256_kyber512", der, SubjectPublicKeyInfo, - p256_kyber512), - DECODER_w_structure("x25519_kyber512", der, PrivateKeyInfo, - x25519_kyber512), - DECODER_w_structure("x25519_kyber512", der, SubjectPublicKeyInfo, - x25519_kyber512), -# endif -# ifdef OQS_ENABLE_KEM_kyber_768 - DECODER_w_structure("kyber768", der, PrivateKeyInfo, kyber768), - DECODER_w_structure("kyber768", der, SubjectPublicKeyInfo, kyber768), - DECODER_w_structure("p384_kyber768", der, PrivateKeyInfo, p384_kyber768), - DECODER_w_structure("p384_kyber768", der, SubjectPublicKeyInfo, - p384_kyber768), - DECODER_w_structure("x448_kyber768", der, PrivateKeyInfo, x448_kyber768), - DECODER_w_structure("x448_kyber768", der, SubjectPublicKeyInfo, - x448_kyber768), - DECODER_w_structure("x25519_kyber768", der, PrivateKeyInfo, - x25519_kyber768), - DECODER_w_structure("x25519_kyber768", der, SubjectPublicKeyInfo, - x25519_kyber768), - DECODER_w_structure("p256_kyber768", der, PrivateKeyInfo, p256_kyber768), - DECODER_w_structure("p256_kyber768", der, SubjectPublicKeyInfo, - p256_kyber768), -# endif -# ifdef OQS_ENABLE_KEM_kyber_1024 - DECODER_w_structure("kyber1024", der, PrivateKeyInfo, kyber1024), - DECODER_w_structure("kyber1024", der, SubjectPublicKeyInfo, kyber1024), - DECODER_w_structure("p521_kyber1024", der, PrivateKeyInfo, p521_kyber1024), - DECODER_w_structure("p521_kyber1024", der, SubjectPublicKeyInfo, - p521_kyber1024), -# endif -# ifdef OQS_ENABLE_KEM_ml_kem_512 - DECODER_w_structure("mlkem512", der, PrivateKeyInfo, mlkem512), - DECODER_w_structure("mlkem512", der, SubjectPublicKeyInfo, mlkem512), - DECODER_w_structure("p256_mlkem512", der, PrivateKeyInfo, p256_mlkem512), - DECODER_w_structure("p256_mlkem512", der, SubjectPublicKeyInfo, - p256_mlkem512), - DECODER_w_structure("x25519_mlkem512", der, PrivateKeyInfo, - x25519_mlkem512), - DECODER_w_structure("x25519_mlkem512", der, SubjectPublicKeyInfo, - x25519_mlkem512), -# endif -# ifdef OQS_ENABLE_KEM_ml_kem_768 - DECODER_w_structure("mlkem768", der, PrivateKeyInfo, mlkem768), - DECODER_w_structure("mlkem768", der, SubjectPublicKeyInfo, mlkem768), - DECODER_w_structure("p384_mlkem768", der, PrivateKeyInfo, p384_mlkem768), - DECODER_w_structure("p384_mlkem768", der, SubjectPublicKeyInfo, - p384_mlkem768), - DECODER_w_structure("x448_mlkem768", der, PrivateKeyInfo, x448_mlkem768), - DECODER_w_structure("x448_mlkem768", der, SubjectPublicKeyInfo, - x448_mlkem768), - DECODER_w_structure("x25519_mlkem768", der, PrivateKeyInfo, - x25519_mlkem768), - DECODER_w_structure("x25519_mlkem768", der, SubjectPublicKeyInfo, - x25519_mlkem768), - DECODER_w_structure("p256_mlkem768", der, PrivateKeyInfo, p256_mlkem768), - DECODER_w_structure("p256_mlkem768", der, SubjectPublicKeyInfo, - p256_mlkem768), -# endif -# ifdef OQS_ENABLE_KEM_ml_kem_1024 - DECODER_w_structure("mlkem1024", der, PrivateKeyInfo, mlkem1024), - DECODER_w_structure("mlkem1024", der, SubjectPublicKeyInfo, mlkem1024), - DECODER_w_structure("p521_mlkem1024", der, PrivateKeyInfo, p521_mlkem1024), - DECODER_w_structure("p521_mlkem1024", der, SubjectPublicKeyInfo, - p521_mlkem1024), - DECODER_w_structure("p384_mlkem1024", der, PrivateKeyInfo, p384_mlkem1024), - DECODER_w_structure("p384_mlkem1024", der, SubjectPublicKeyInfo, - p384_mlkem1024), -# endif -# ifdef OQS_ENABLE_KEM_bike_l1 - DECODER_w_structure("bikel1", der, PrivateKeyInfo, bikel1), - DECODER_w_structure("bikel1", der, SubjectPublicKeyInfo, bikel1), - DECODER_w_structure("p256_bikel1", der, PrivateKeyInfo, p256_bikel1), - DECODER_w_structure("p256_bikel1", der, SubjectPublicKeyInfo, p256_bikel1), - DECODER_w_structure("x25519_bikel1", der, PrivateKeyInfo, x25519_bikel1), - DECODER_w_structure("x25519_bikel1", der, SubjectPublicKeyInfo, - x25519_bikel1), -# endif -# ifdef OQS_ENABLE_KEM_bike_l3 - DECODER_w_structure("bikel3", der, PrivateKeyInfo, bikel3), - DECODER_w_structure("bikel3", der, SubjectPublicKeyInfo, bikel3), - DECODER_w_structure("p384_bikel3", der, PrivateKeyInfo, p384_bikel3), - DECODER_w_structure("p384_bikel3", der, SubjectPublicKeyInfo, p384_bikel3), - DECODER_w_structure("x448_bikel3", der, PrivateKeyInfo, x448_bikel3), - DECODER_w_structure("x448_bikel3", der, SubjectPublicKeyInfo, x448_bikel3), -# endif -# ifdef OQS_ENABLE_KEM_bike_l5 - DECODER_w_structure("bikel5", der, PrivateKeyInfo, bikel5), - DECODER_w_structure("bikel5", der, SubjectPublicKeyInfo, bikel5), - DECODER_w_structure("p521_bikel5", der, PrivateKeyInfo, p521_bikel5), - DECODER_w_structure("p521_bikel5", der, SubjectPublicKeyInfo, p521_bikel5), -# endif -# ifdef OQS_ENABLE_KEM_hqc_128 - DECODER_w_structure("hqc128", der, PrivateKeyInfo, hqc128), - DECODER_w_structure("hqc128", der, SubjectPublicKeyInfo, hqc128), - DECODER_w_structure("p256_hqc128", der, PrivateKeyInfo, p256_hqc128), - DECODER_w_structure("p256_hqc128", der, SubjectPublicKeyInfo, p256_hqc128), - DECODER_w_structure("x25519_hqc128", der, PrivateKeyInfo, x25519_hqc128), - DECODER_w_structure("x25519_hqc128", der, SubjectPublicKeyInfo, - x25519_hqc128), -# endif -# ifdef OQS_ENABLE_KEM_hqc_192 - DECODER_w_structure("hqc192", der, PrivateKeyInfo, hqc192), - DECODER_w_structure("hqc192", der, SubjectPublicKeyInfo, hqc192), - DECODER_w_structure("p384_hqc192", der, PrivateKeyInfo, p384_hqc192), - DECODER_w_structure("p384_hqc192", der, SubjectPublicKeyInfo, p384_hqc192), - DECODER_w_structure("x448_hqc192", der, PrivateKeyInfo, x448_hqc192), - DECODER_w_structure("x448_hqc192", der, SubjectPublicKeyInfo, x448_hqc192), -# endif -# ifdef OQS_ENABLE_KEM_hqc_256 - DECODER_w_structure("hqc256", der, PrivateKeyInfo, hqc256), - DECODER_w_structure("hqc256", der, SubjectPublicKeyInfo, hqc256), - DECODER_w_structure("p521_hqc256", der, PrivateKeyInfo, p521_hqc256), - DECODER_w_structure("p521_hqc256", der, SubjectPublicKeyInfo, p521_hqc256), -# endif +DECODER_w_structure("frodo640aes", der, SubjectPublicKeyInfo, frodo640aes), +DECODER_w_structure("p256_frodo640aes", der, PrivateKeyInfo, p256_frodo640aes), +DECODER_w_structure("p256_frodo640aes", der, SubjectPublicKeyInfo, p256_frodo640aes),DECODER_w_structure("x25519_frodo640aes", der, PrivateKeyInfo, x25519_frodo640aes), +DECODER_w_structure("x25519_frodo640aes", der, SubjectPublicKeyInfo, x25519_frodo640aes), +#endif +#ifdef OQS_ENABLE_KEM_frodokem_640_shake +DECODER_w_structure("frodo640shake", der, PrivateKeyInfo, frodo640shake), +DECODER_w_structure("frodo640shake", der, SubjectPublicKeyInfo, frodo640shake), +DECODER_w_structure("p256_frodo640shake", der, PrivateKeyInfo, p256_frodo640shake), +DECODER_w_structure("p256_frodo640shake", der, SubjectPublicKeyInfo, p256_frodo640shake),DECODER_w_structure("x25519_frodo640shake", der, PrivateKeyInfo, x25519_frodo640shake), +DECODER_w_structure("x25519_frodo640shake", der, SubjectPublicKeyInfo, x25519_frodo640shake), +#endif +#ifdef OQS_ENABLE_KEM_frodokem_976_aes +DECODER_w_structure("frodo976aes", der, PrivateKeyInfo, frodo976aes), +DECODER_w_structure("frodo976aes", der, SubjectPublicKeyInfo, frodo976aes), +DECODER_w_structure("p384_frodo976aes", der, PrivateKeyInfo, p384_frodo976aes), +DECODER_w_structure("p384_frodo976aes", der, SubjectPublicKeyInfo, p384_frodo976aes),DECODER_w_structure("x448_frodo976aes", der, PrivateKeyInfo, x448_frodo976aes), +DECODER_w_structure("x448_frodo976aes", der, SubjectPublicKeyInfo, x448_frodo976aes), +#endif +#ifdef OQS_ENABLE_KEM_frodokem_976_shake +DECODER_w_structure("frodo976shake", der, PrivateKeyInfo, frodo976shake), +DECODER_w_structure("frodo976shake", der, SubjectPublicKeyInfo, frodo976shake), +DECODER_w_structure("p384_frodo976shake", der, PrivateKeyInfo, p384_frodo976shake), +DECODER_w_structure("p384_frodo976shake", der, SubjectPublicKeyInfo, p384_frodo976shake),DECODER_w_structure("x448_frodo976shake", der, PrivateKeyInfo, x448_frodo976shake), +DECODER_w_structure("x448_frodo976shake", der, SubjectPublicKeyInfo, x448_frodo976shake), +#endif +#ifdef OQS_ENABLE_KEM_frodokem_1344_aes +DECODER_w_structure("frodo1344aes", der, PrivateKeyInfo, frodo1344aes), +DECODER_w_structure("frodo1344aes", der, SubjectPublicKeyInfo, frodo1344aes), +DECODER_w_structure("p521_frodo1344aes", der, PrivateKeyInfo, p521_frodo1344aes), +DECODER_w_structure("p521_frodo1344aes", der, SubjectPublicKeyInfo, p521_frodo1344aes), +#endif +#ifdef OQS_ENABLE_KEM_frodokem_1344_shake +DECODER_w_structure("frodo1344shake", der, PrivateKeyInfo, frodo1344shake), +DECODER_w_structure("frodo1344shake", der, SubjectPublicKeyInfo, frodo1344shake), +DECODER_w_structure("p521_frodo1344shake", der, PrivateKeyInfo, p521_frodo1344shake), +DECODER_w_structure("p521_frodo1344shake", der, SubjectPublicKeyInfo, p521_frodo1344shake), +#endif +#ifdef OQS_ENABLE_KEM_kyber_512 +DECODER_w_structure("kyber512", der, PrivateKeyInfo, kyber512), +DECODER_w_structure("kyber512", der, SubjectPublicKeyInfo, kyber512), +DECODER_w_structure("p256_kyber512", der, PrivateKeyInfo, p256_kyber512), +DECODER_w_structure("p256_kyber512", der, SubjectPublicKeyInfo, p256_kyber512),DECODER_w_structure("x25519_kyber512", der, PrivateKeyInfo, x25519_kyber512), +DECODER_w_structure("x25519_kyber512", der, SubjectPublicKeyInfo, x25519_kyber512), +#endif +#ifdef OQS_ENABLE_KEM_kyber_768 +DECODER_w_structure("kyber768", der, PrivateKeyInfo, kyber768), +DECODER_w_structure("kyber768", der, SubjectPublicKeyInfo, kyber768), +DECODER_w_structure("p384_kyber768", der, PrivateKeyInfo, p384_kyber768), +DECODER_w_structure("p384_kyber768", der, SubjectPublicKeyInfo, p384_kyber768),DECODER_w_structure("x448_kyber768", der, PrivateKeyInfo, x448_kyber768), +DECODER_w_structure("x448_kyber768", der, SubjectPublicKeyInfo, x448_kyber768),DECODER_w_structure("x25519_kyber768", der, PrivateKeyInfo, x25519_kyber768), +DECODER_w_structure("x25519_kyber768", der, SubjectPublicKeyInfo, x25519_kyber768),DECODER_w_structure("p256_kyber768", der, PrivateKeyInfo, p256_kyber768), +DECODER_w_structure("p256_kyber768", der, SubjectPublicKeyInfo, p256_kyber768), +#endif +#ifdef OQS_ENABLE_KEM_kyber_1024 +DECODER_w_structure("kyber1024", der, PrivateKeyInfo, kyber1024), +DECODER_w_structure("kyber1024", der, SubjectPublicKeyInfo, kyber1024), +DECODER_w_structure("p521_kyber1024", der, PrivateKeyInfo, p521_kyber1024), +DECODER_w_structure("p521_kyber1024", der, SubjectPublicKeyInfo, p521_kyber1024), +#endif +#ifdef OQS_ENABLE_KEM_ml_kem_512 +DECODER_w_structure("mlkem512", der, PrivateKeyInfo, mlkem512), +DECODER_w_structure("mlkem512", der, SubjectPublicKeyInfo, mlkem512), +DECODER_w_structure("p256_mlkem512", der, PrivateKeyInfo, p256_mlkem512), +DECODER_w_structure("p256_mlkem512", der, SubjectPublicKeyInfo, p256_mlkem512),DECODER_w_structure("x25519_mlkem512", der, PrivateKeyInfo, x25519_mlkem512), +DECODER_w_structure("x25519_mlkem512", der, SubjectPublicKeyInfo, x25519_mlkem512), +#endif +#ifdef OQS_ENABLE_KEM_ml_kem_768 +DECODER_w_structure("mlkem768", der, PrivateKeyInfo, mlkem768), +DECODER_w_structure("mlkem768", der, SubjectPublicKeyInfo, mlkem768), +DECODER_w_structure("p384_mlkem768", der, PrivateKeyInfo, p384_mlkem768), +DECODER_w_structure("p384_mlkem768", der, SubjectPublicKeyInfo, p384_mlkem768),DECODER_w_structure("x448_mlkem768", der, PrivateKeyInfo, x448_mlkem768), +DECODER_w_structure("x448_mlkem768", der, SubjectPublicKeyInfo, x448_mlkem768),DECODER_w_structure("x25519_mlkem768", der, PrivateKeyInfo, x25519_mlkem768), +DECODER_w_structure("x25519_mlkem768", der, SubjectPublicKeyInfo, x25519_mlkem768),DECODER_w_structure("p256_mlkem768", der, PrivateKeyInfo, p256_mlkem768), +DECODER_w_structure("p256_mlkem768", der, SubjectPublicKeyInfo, p256_mlkem768), +#endif +#ifdef OQS_ENABLE_KEM_ml_kem_1024 +DECODER_w_structure("mlkem1024", der, PrivateKeyInfo, mlkem1024), +DECODER_w_structure("mlkem1024", der, SubjectPublicKeyInfo, mlkem1024), +DECODER_w_structure("p521_mlkem1024", der, PrivateKeyInfo, p521_mlkem1024), +DECODER_w_structure("p521_mlkem1024", der, SubjectPublicKeyInfo, p521_mlkem1024),DECODER_w_structure("p384_mlkem1024", der, PrivateKeyInfo, p384_mlkem1024), +DECODER_w_structure("p384_mlkem1024", der, SubjectPublicKeyInfo, p384_mlkem1024), +#endif +#ifdef OQS_ENABLE_KEM_bike_l1 +DECODER_w_structure("bikel1", der, PrivateKeyInfo, bikel1), +DECODER_w_structure("bikel1", der, SubjectPublicKeyInfo, bikel1), +DECODER_w_structure("p256_bikel1", der, PrivateKeyInfo, p256_bikel1), +DECODER_w_structure("p256_bikel1", der, SubjectPublicKeyInfo, p256_bikel1),DECODER_w_structure("x25519_bikel1", der, PrivateKeyInfo, x25519_bikel1), +DECODER_w_structure("x25519_bikel1", der, SubjectPublicKeyInfo, x25519_bikel1), +#endif +#ifdef OQS_ENABLE_KEM_bike_l3 +DECODER_w_structure("bikel3", der, PrivateKeyInfo, bikel3), +DECODER_w_structure("bikel3", der, SubjectPublicKeyInfo, bikel3), +DECODER_w_structure("p384_bikel3", der, PrivateKeyInfo, p384_bikel3), +DECODER_w_structure("p384_bikel3", der, SubjectPublicKeyInfo, p384_bikel3),DECODER_w_structure("x448_bikel3", der, PrivateKeyInfo, x448_bikel3), +DECODER_w_structure("x448_bikel3", der, SubjectPublicKeyInfo, x448_bikel3), +#endif +#ifdef OQS_ENABLE_KEM_bike_l5 +DECODER_w_structure("bikel5", der, PrivateKeyInfo, bikel5), +DECODER_w_structure("bikel5", der, SubjectPublicKeyInfo, bikel5), +DECODER_w_structure("p521_bikel5", der, PrivateKeyInfo, p521_bikel5), +DECODER_w_structure("p521_bikel5", der, SubjectPublicKeyInfo, p521_bikel5), +#endif +#ifdef OQS_ENABLE_KEM_hqc_128 +DECODER_w_structure("hqc128", der, PrivateKeyInfo, hqc128), +DECODER_w_structure("hqc128", der, SubjectPublicKeyInfo, hqc128), +DECODER_w_structure("p256_hqc128", der, PrivateKeyInfo, p256_hqc128), +DECODER_w_structure("p256_hqc128", der, SubjectPublicKeyInfo, p256_hqc128),DECODER_w_structure("x25519_hqc128", der, PrivateKeyInfo, x25519_hqc128), +DECODER_w_structure("x25519_hqc128", der, SubjectPublicKeyInfo, x25519_hqc128), +#endif +#ifdef OQS_ENABLE_KEM_hqc_192 +DECODER_w_structure("hqc192", der, PrivateKeyInfo, hqc192), +DECODER_w_structure("hqc192", der, SubjectPublicKeyInfo, hqc192), +DECODER_w_structure("p384_hqc192", der, PrivateKeyInfo, p384_hqc192), +DECODER_w_structure("p384_hqc192", der, SubjectPublicKeyInfo, p384_hqc192),DECODER_w_structure("x448_hqc192", der, PrivateKeyInfo, x448_hqc192), +DECODER_w_structure("x448_hqc192", der, SubjectPublicKeyInfo, x448_hqc192), +#endif +#ifdef OQS_ENABLE_KEM_hqc_256 +DECODER_w_structure("hqc256", der, PrivateKeyInfo, hqc256), +DECODER_w_structure("hqc256", der, SubjectPublicKeyInfo, hqc256), +DECODER_w_structure("p521_hqc256", der, PrivateKeyInfo, p521_hqc256), +DECODER_w_structure("p521_hqc256", der, SubjectPublicKeyInfo, p521_hqc256), +#endif #endif /* OQS_KEM_ENCODERS */ + #ifdef OQS_ENABLE_SIG_dilithium_2 - DECODER_w_structure("dilithium2", der, PrivateKeyInfo, dilithium2), - DECODER_w_structure("dilithium2", der, SubjectPublicKeyInfo, dilithium2), - DECODER_w_structure("p256_dilithium2", der, PrivateKeyInfo, - p256_dilithium2), - DECODER_w_structure("p256_dilithium2", der, SubjectPublicKeyInfo, - p256_dilithium2), - DECODER_w_structure("rsa3072_dilithium2", der, PrivateKeyInfo, - rsa3072_dilithium2), - DECODER_w_structure("rsa3072_dilithium2", der, SubjectPublicKeyInfo, - rsa3072_dilithium2), +DECODER_w_structure("dilithium2", der, PrivateKeyInfo, dilithium2), +DECODER_w_structure("dilithium2", der, SubjectPublicKeyInfo, dilithium2),DECODER_w_structure("p256_dilithium2", der, PrivateKeyInfo, p256_dilithium2), +DECODER_w_structure("p256_dilithium2", der, SubjectPublicKeyInfo, p256_dilithium2),DECODER_w_structure("rsa3072_dilithium2", der, PrivateKeyInfo, rsa3072_dilithium2), +DECODER_w_structure("rsa3072_dilithium2", der, SubjectPublicKeyInfo, rsa3072_dilithium2), #endif #ifdef OQS_ENABLE_SIG_dilithium_3 - DECODER_w_structure("dilithium3", der, PrivateKeyInfo, dilithium3), - DECODER_w_structure("dilithium3", der, SubjectPublicKeyInfo, dilithium3), - DECODER_w_structure("p384_dilithium3", der, PrivateKeyInfo, - p384_dilithium3), - DECODER_w_structure("p384_dilithium3", der, SubjectPublicKeyInfo, - p384_dilithium3), +DECODER_w_structure("dilithium3", der, PrivateKeyInfo, dilithium3), +DECODER_w_structure("dilithium3", der, SubjectPublicKeyInfo, dilithium3),DECODER_w_structure("p384_dilithium3", der, PrivateKeyInfo, p384_dilithium3), +DECODER_w_structure("p384_dilithium3", der, SubjectPublicKeyInfo, p384_dilithium3), #endif #ifdef OQS_ENABLE_SIG_dilithium_5 - DECODER_w_structure("dilithium5", der, PrivateKeyInfo, dilithium5), - DECODER_w_structure("dilithium5", der, SubjectPublicKeyInfo, dilithium5), - DECODER_w_structure("p521_dilithium5", der, PrivateKeyInfo, - p521_dilithium5), - DECODER_w_structure("p521_dilithium5", der, SubjectPublicKeyInfo, - p521_dilithium5), +DECODER_w_structure("dilithium5", der, PrivateKeyInfo, dilithium5), +DECODER_w_structure("dilithium5", der, SubjectPublicKeyInfo, dilithium5),DECODER_w_structure("p521_dilithium5", der, PrivateKeyInfo, p521_dilithium5), +DECODER_w_structure("p521_dilithium5", der, SubjectPublicKeyInfo, p521_dilithium5), #endif #ifdef OQS_ENABLE_SIG_ml_dsa_44 - DECODER_w_structure("mldsa44", der, PrivateKeyInfo, mldsa44), - DECODER_w_structure("mldsa44", der, SubjectPublicKeyInfo, mldsa44), - DECODER_w_structure("p256_mldsa44", der, PrivateKeyInfo, p256_mldsa44), - DECODER_w_structure("p256_mldsa44", der, SubjectPublicKeyInfo, - p256_mldsa44), - DECODER_w_structure("rsa3072_mldsa44", der, PrivateKeyInfo, - rsa3072_mldsa44), - DECODER_w_structure("rsa3072_mldsa44", der, SubjectPublicKeyInfo, - rsa3072_mldsa44), - DECODER_w_structure("mldsa44_pss2048", der, PrivateKeyInfo, - mldsa44_pss2048), - DECODER_w_structure("mldsa44_pss2048", der, SubjectPublicKeyInfo, - mldsa44_pss2048), - DECODER_w_structure("mldsa44_rsa2048", der, PrivateKeyInfo, - mldsa44_rsa2048), - DECODER_w_structure("mldsa44_rsa2048", der, SubjectPublicKeyInfo, - mldsa44_rsa2048), - DECODER_w_structure("mldsa44_ed25519", der, PrivateKeyInfo, - mldsa44_ed25519), - DECODER_w_structure("mldsa44_ed25519", der, SubjectPublicKeyInfo, - mldsa44_ed25519), - DECODER_w_structure("mldsa44_p256", der, PrivateKeyInfo, mldsa44_p256), - DECODER_w_structure("mldsa44_p256", der, SubjectPublicKeyInfo, - mldsa44_p256), - DECODER_w_structure("mldsa44_bp256", der, PrivateKeyInfo, mldsa44_bp256), - DECODER_w_structure("mldsa44_bp256", der, SubjectPublicKeyInfo, - mldsa44_bp256), +DECODER_w_structure("mldsa44", der, PrivateKeyInfo, mldsa44), +DECODER_w_structure("mldsa44", der, SubjectPublicKeyInfo, mldsa44),DECODER_w_structure("p256_mldsa44", der, PrivateKeyInfo, p256_mldsa44), +DECODER_w_structure("p256_mldsa44", der, SubjectPublicKeyInfo, p256_mldsa44),DECODER_w_structure("rsa3072_mldsa44", der, PrivateKeyInfo, rsa3072_mldsa44), +DECODER_w_structure("rsa3072_mldsa44", der, SubjectPublicKeyInfo, rsa3072_mldsa44),DECODER_w_structure("mldsa44_pss2048", der, PrivateKeyInfo, mldsa44_pss2048), +DECODER_w_structure("mldsa44_pss2048", der, SubjectPublicKeyInfo, mldsa44_pss2048),DECODER_w_structure("mldsa44_rsa2048", der, PrivateKeyInfo, mldsa44_rsa2048), +DECODER_w_structure("mldsa44_rsa2048", der, SubjectPublicKeyInfo, mldsa44_rsa2048),DECODER_w_structure("mldsa44_ed25519", der, PrivateKeyInfo, mldsa44_ed25519), +DECODER_w_structure("mldsa44_ed25519", der, SubjectPublicKeyInfo, mldsa44_ed25519),DECODER_w_structure("mldsa44_p256", der, PrivateKeyInfo, mldsa44_p256), +DECODER_w_structure("mldsa44_p256", der, SubjectPublicKeyInfo, mldsa44_p256),DECODER_w_structure("mldsa44_bp256", der, PrivateKeyInfo, mldsa44_bp256), +DECODER_w_structure("mldsa44_bp256", der, SubjectPublicKeyInfo, mldsa44_bp256), #endif #ifdef OQS_ENABLE_SIG_ml_dsa_65 - DECODER_w_structure("mldsa65", der, PrivateKeyInfo, mldsa65), - DECODER_w_structure("mldsa65", der, SubjectPublicKeyInfo, mldsa65), - DECODER_w_structure("p384_mldsa65", der, PrivateKeyInfo, p384_mldsa65), - DECODER_w_structure("p384_mldsa65", der, SubjectPublicKeyInfo, - p384_mldsa65), - DECODER_w_structure("mldsa65_pss3072", der, PrivateKeyInfo, - mldsa65_pss3072), - DECODER_w_structure("mldsa65_pss3072", der, SubjectPublicKeyInfo, - mldsa65_pss3072), - DECODER_w_structure("mldsa65_rsa3072", der, PrivateKeyInfo, - mldsa65_rsa3072), - DECODER_w_structure("mldsa65_rsa3072", der, SubjectPublicKeyInfo, - mldsa65_rsa3072), - DECODER_w_structure("mldsa65_p256", der, PrivateKeyInfo, mldsa65_p256), - DECODER_w_structure("mldsa65_p256", der, SubjectPublicKeyInfo, - mldsa65_p256), - DECODER_w_structure("mldsa65_bp256", der, PrivateKeyInfo, mldsa65_bp256), - DECODER_w_structure("mldsa65_bp256", der, SubjectPublicKeyInfo, - mldsa65_bp256), - DECODER_w_structure("mldsa65_ed25519", der, PrivateKeyInfo, - mldsa65_ed25519), - DECODER_w_structure("mldsa65_ed25519", der, SubjectPublicKeyInfo, - mldsa65_ed25519), +DECODER_w_structure("mldsa65", der, PrivateKeyInfo, mldsa65), +DECODER_w_structure("mldsa65", der, SubjectPublicKeyInfo, mldsa65),DECODER_w_structure("p384_mldsa65", der, PrivateKeyInfo, p384_mldsa65), +DECODER_w_structure("p384_mldsa65", der, SubjectPublicKeyInfo, p384_mldsa65),DECODER_w_structure("mldsa65_pss3072", der, PrivateKeyInfo, mldsa65_pss3072), +DECODER_w_structure("mldsa65_pss3072", der, SubjectPublicKeyInfo, mldsa65_pss3072),DECODER_w_structure("mldsa65_rsa3072", der, PrivateKeyInfo, mldsa65_rsa3072), +DECODER_w_structure("mldsa65_rsa3072", der, SubjectPublicKeyInfo, mldsa65_rsa3072),DECODER_w_structure("mldsa65_p256", der, PrivateKeyInfo, mldsa65_p256), +DECODER_w_structure("mldsa65_p256", der, SubjectPublicKeyInfo, mldsa65_p256),DECODER_w_structure("mldsa65_bp256", der, PrivateKeyInfo, mldsa65_bp256), +DECODER_w_structure("mldsa65_bp256", der, SubjectPublicKeyInfo, mldsa65_bp256),DECODER_w_structure("mldsa65_ed25519", der, PrivateKeyInfo, mldsa65_ed25519), +DECODER_w_structure("mldsa65_ed25519", der, SubjectPublicKeyInfo, mldsa65_ed25519), #endif #ifdef OQS_ENABLE_SIG_ml_dsa_87 - DECODER_w_structure("mldsa87", der, PrivateKeyInfo, mldsa87), - DECODER_w_structure("mldsa87", der, SubjectPublicKeyInfo, mldsa87), - DECODER_w_structure("p521_mldsa87", der, PrivateKeyInfo, p521_mldsa87), - DECODER_w_structure("p521_mldsa87", der, SubjectPublicKeyInfo, - p521_mldsa87), - DECODER_w_structure("mldsa87_p384", der, PrivateKeyInfo, mldsa87_p384), - DECODER_w_structure("mldsa87_p384", der, SubjectPublicKeyInfo, - mldsa87_p384), - DECODER_w_structure("mldsa87_bp384", der, PrivateKeyInfo, mldsa87_bp384), - DECODER_w_structure("mldsa87_bp384", der, SubjectPublicKeyInfo, - mldsa87_bp384), - DECODER_w_structure("mldsa87_ed448", der, PrivateKeyInfo, mldsa87_ed448), - DECODER_w_structure("mldsa87_ed448", der, SubjectPublicKeyInfo, - mldsa87_ed448), +DECODER_w_structure("mldsa87", der, PrivateKeyInfo, mldsa87), +DECODER_w_structure("mldsa87", der, SubjectPublicKeyInfo, mldsa87),DECODER_w_structure("p521_mldsa87", der, PrivateKeyInfo, p521_mldsa87), +DECODER_w_structure("p521_mldsa87", der, SubjectPublicKeyInfo, p521_mldsa87),DECODER_w_structure("mldsa87_p384", der, PrivateKeyInfo, mldsa87_p384), +DECODER_w_structure("mldsa87_p384", der, SubjectPublicKeyInfo, mldsa87_p384),DECODER_w_structure("mldsa87_bp384", der, PrivateKeyInfo, mldsa87_bp384), +DECODER_w_structure("mldsa87_bp384", der, SubjectPublicKeyInfo, mldsa87_bp384),DECODER_w_structure("mldsa87_ed448", der, PrivateKeyInfo, mldsa87_ed448), +DECODER_w_structure("mldsa87_ed448", der, SubjectPublicKeyInfo, mldsa87_ed448), #endif #ifdef OQS_ENABLE_SIG_falcon_512 - DECODER_w_structure("falcon512", der, PrivateKeyInfo, falcon512), - DECODER_w_structure("falcon512", der, SubjectPublicKeyInfo, falcon512), - DECODER_w_structure("p256_falcon512", der, PrivateKeyInfo, p256_falcon512), - DECODER_w_structure("p256_falcon512", der, SubjectPublicKeyInfo, - p256_falcon512), - DECODER_w_structure("rsa3072_falcon512", der, PrivateKeyInfo, - rsa3072_falcon512), - DECODER_w_structure("rsa3072_falcon512", der, SubjectPublicKeyInfo, - rsa3072_falcon512), +DECODER_w_structure("falcon512", der, PrivateKeyInfo, falcon512), +DECODER_w_structure("falcon512", der, SubjectPublicKeyInfo, falcon512),DECODER_w_structure("p256_falcon512", der, PrivateKeyInfo, p256_falcon512), +DECODER_w_structure("p256_falcon512", der, SubjectPublicKeyInfo, p256_falcon512),DECODER_w_structure("rsa3072_falcon512", der, PrivateKeyInfo, rsa3072_falcon512), +DECODER_w_structure("rsa3072_falcon512", der, SubjectPublicKeyInfo, rsa3072_falcon512), #endif #ifdef OQS_ENABLE_SIG_falcon_padded_512 - DECODER_w_structure("falconpadded512", der, PrivateKeyInfo, - falconpadded512), - DECODER_w_structure("falconpadded512", der, SubjectPublicKeyInfo, - falconpadded512), - DECODER_w_structure("p256_falconpadded512", der, PrivateKeyInfo, - p256_falconpadded512), - DECODER_w_structure("p256_falconpadded512", der, SubjectPublicKeyInfo, - p256_falconpadded512), - DECODER_w_structure("rsa3072_falconpadded512", der, PrivateKeyInfo, - rsa3072_falconpadded512), - DECODER_w_structure("rsa3072_falconpadded512", der, SubjectPublicKeyInfo, - rsa3072_falconpadded512), +DECODER_w_structure("falconpadded512", der, PrivateKeyInfo, falconpadded512), +DECODER_w_structure("falconpadded512", der, SubjectPublicKeyInfo, falconpadded512),DECODER_w_structure("p256_falconpadded512", der, PrivateKeyInfo, p256_falconpadded512), +DECODER_w_structure("p256_falconpadded512", der, SubjectPublicKeyInfo, p256_falconpadded512),DECODER_w_structure("rsa3072_falconpadded512", der, PrivateKeyInfo, rsa3072_falconpadded512), +DECODER_w_structure("rsa3072_falconpadded512", der, SubjectPublicKeyInfo, rsa3072_falconpadded512), #endif #ifdef OQS_ENABLE_SIG_falcon_1024 - DECODER_w_structure("falcon1024", der, PrivateKeyInfo, falcon1024), - DECODER_w_structure("falcon1024", der, SubjectPublicKeyInfo, falcon1024), - DECODER_w_structure("p521_falcon1024", der, PrivateKeyInfo, - p521_falcon1024), - DECODER_w_structure("p521_falcon1024", der, SubjectPublicKeyInfo, - p521_falcon1024), +DECODER_w_structure("falcon1024", der, PrivateKeyInfo, falcon1024), +DECODER_w_structure("falcon1024", der, SubjectPublicKeyInfo, falcon1024),DECODER_w_structure("p521_falcon1024", der, PrivateKeyInfo, p521_falcon1024), +DECODER_w_structure("p521_falcon1024", der, SubjectPublicKeyInfo, p521_falcon1024), #endif #ifdef OQS_ENABLE_SIG_falcon_padded_1024 - DECODER_w_structure("falconpadded1024", der, PrivateKeyInfo, - falconpadded1024), - DECODER_w_structure("falconpadded1024", der, SubjectPublicKeyInfo, - falconpadded1024), - DECODER_w_structure("p521_falconpadded1024", der, PrivateKeyInfo, - p521_falconpadded1024), - DECODER_w_structure("p521_falconpadded1024", der, SubjectPublicKeyInfo, - p521_falconpadded1024), +DECODER_w_structure("falconpadded1024", der, PrivateKeyInfo, falconpadded1024), +DECODER_w_structure("falconpadded1024", der, SubjectPublicKeyInfo, falconpadded1024),DECODER_w_structure("p521_falconpadded1024", der, PrivateKeyInfo, p521_falconpadded1024), +DECODER_w_structure("p521_falconpadded1024", der, SubjectPublicKeyInfo, p521_falconpadded1024), #endif #ifdef OQS_ENABLE_SIG_sphincs_sha2_128f_simple - DECODER_w_structure("sphincssha2128fsimple", der, PrivateKeyInfo, - sphincssha2128fsimple), - DECODER_w_structure("sphincssha2128fsimple", der, SubjectPublicKeyInfo, - sphincssha2128fsimple), - DECODER_w_structure("p256_sphincssha2128fsimple", der, PrivateKeyInfo, - p256_sphincssha2128fsimple), - DECODER_w_structure("p256_sphincssha2128fsimple", der, SubjectPublicKeyInfo, - p256_sphincssha2128fsimple), - DECODER_w_structure("rsa3072_sphincssha2128fsimple", der, PrivateKeyInfo, - rsa3072_sphincssha2128fsimple), - DECODER_w_structure("rsa3072_sphincssha2128fsimple", der, - SubjectPublicKeyInfo, rsa3072_sphincssha2128fsimple), +DECODER_w_structure("sphincssha2128fsimple", der, PrivateKeyInfo, sphincssha2128fsimple), +DECODER_w_structure("sphincssha2128fsimple", der, SubjectPublicKeyInfo, sphincssha2128fsimple),DECODER_w_structure("p256_sphincssha2128fsimple", der, PrivateKeyInfo, p256_sphincssha2128fsimple), +DECODER_w_structure("p256_sphincssha2128fsimple", der, SubjectPublicKeyInfo, p256_sphincssha2128fsimple),DECODER_w_structure("rsa3072_sphincssha2128fsimple", der, PrivateKeyInfo, rsa3072_sphincssha2128fsimple), +DECODER_w_structure("rsa3072_sphincssha2128fsimple", der, SubjectPublicKeyInfo, rsa3072_sphincssha2128fsimple), #endif #ifdef OQS_ENABLE_SIG_sphincs_sha2_128s_simple - DECODER_w_structure("sphincssha2128ssimple", der, PrivateKeyInfo, - sphincssha2128ssimple), - DECODER_w_structure("sphincssha2128ssimple", der, SubjectPublicKeyInfo, - sphincssha2128ssimple), - DECODER_w_structure("p256_sphincssha2128ssimple", der, PrivateKeyInfo, - p256_sphincssha2128ssimple), - DECODER_w_structure("p256_sphincssha2128ssimple", der, SubjectPublicKeyInfo, - p256_sphincssha2128ssimple), - DECODER_w_structure("rsa3072_sphincssha2128ssimple", der, PrivateKeyInfo, - rsa3072_sphincssha2128ssimple), - DECODER_w_structure("rsa3072_sphincssha2128ssimple", der, - SubjectPublicKeyInfo, rsa3072_sphincssha2128ssimple), +DECODER_w_structure("sphincssha2128ssimple", der, PrivateKeyInfo, sphincssha2128ssimple), +DECODER_w_structure("sphincssha2128ssimple", der, SubjectPublicKeyInfo, sphincssha2128ssimple),DECODER_w_structure("p256_sphincssha2128ssimple", der, PrivateKeyInfo, p256_sphincssha2128ssimple), +DECODER_w_structure("p256_sphincssha2128ssimple", der, SubjectPublicKeyInfo, p256_sphincssha2128ssimple),DECODER_w_structure("rsa3072_sphincssha2128ssimple", der, PrivateKeyInfo, rsa3072_sphincssha2128ssimple), +DECODER_w_structure("rsa3072_sphincssha2128ssimple", der, SubjectPublicKeyInfo, rsa3072_sphincssha2128ssimple), #endif #ifdef OQS_ENABLE_SIG_sphincs_sha2_192f_simple - DECODER_w_structure("sphincssha2192fsimple", der, PrivateKeyInfo, - sphincssha2192fsimple), - DECODER_w_structure("sphincssha2192fsimple", der, SubjectPublicKeyInfo, - sphincssha2192fsimple), - DECODER_w_structure("p384_sphincssha2192fsimple", der, PrivateKeyInfo, - p384_sphincssha2192fsimple), - DECODER_w_structure("p384_sphincssha2192fsimple", der, SubjectPublicKeyInfo, - p384_sphincssha2192fsimple), +DECODER_w_structure("sphincssha2192fsimple", der, PrivateKeyInfo, sphincssha2192fsimple), +DECODER_w_structure("sphincssha2192fsimple", der, SubjectPublicKeyInfo, sphincssha2192fsimple),DECODER_w_structure("p384_sphincssha2192fsimple", der, PrivateKeyInfo, p384_sphincssha2192fsimple), +DECODER_w_structure("p384_sphincssha2192fsimple", der, SubjectPublicKeyInfo, p384_sphincssha2192fsimple), #endif #ifdef OQS_ENABLE_SIG_sphincs_shake_128f_simple - DECODER_w_structure("sphincsshake128fsimple", der, PrivateKeyInfo, - sphincsshake128fsimple), - DECODER_w_structure("sphincsshake128fsimple", der, SubjectPublicKeyInfo, - sphincsshake128fsimple), - DECODER_w_structure("p256_sphincsshake128fsimple", der, PrivateKeyInfo, - p256_sphincsshake128fsimple), - DECODER_w_structure("p256_sphincsshake128fsimple", der, - SubjectPublicKeyInfo, p256_sphincsshake128fsimple), - DECODER_w_structure("rsa3072_sphincsshake128fsimple", der, PrivateKeyInfo, - rsa3072_sphincsshake128fsimple), - DECODER_w_structure("rsa3072_sphincsshake128fsimple", der, - SubjectPublicKeyInfo, rsa3072_sphincsshake128fsimple), +DECODER_w_structure("sphincsshake128fsimple", der, PrivateKeyInfo, sphincsshake128fsimple), +DECODER_w_structure("sphincsshake128fsimple", der, SubjectPublicKeyInfo, sphincsshake128fsimple),DECODER_w_structure("p256_sphincsshake128fsimple", der, PrivateKeyInfo, p256_sphincsshake128fsimple), +DECODER_w_structure("p256_sphincsshake128fsimple", der, SubjectPublicKeyInfo, p256_sphincsshake128fsimple),DECODER_w_structure("rsa3072_sphincsshake128fsimple", der, PrivateKeyInfo, rsa3072_sphincsshake128fsimple), +DECODER_w_structure("rsa3072_sphincsshake128fsimple", der, SubjectPublicKeyInfo, rsa3072_sphincsshake128fsimple), #endif #ifdef OQS_ENABLE_SIG_mayo_1 - DECODER_w_structure("mayo1", der, PrivateKeyInfo, mayo1), - DECODER_w_structure("mayo1", der, SubjectPublicKeyInfo, mayo1), - DECODER_w_structure("p256_mayo1", der, PrivateKeyInfo, p256_mayo1), - DECODER_w_structure("p256_mayo1", der, SubjectPublicKeyInfo, p256_mayo1), +DECODER_w_structure("mayo1", der, PrivateKeyInfo, mayo1), +DECODER_w_structure("mayo1", der, SubjectPublicKeyInfo, mayo1),DECODER_w_structure("p256_mayo1", der, PrivateKeyInfo, p256_mayo1), +DECODER_w_structure("p256_mayo1", der, SubjectPublicKeyInfo, p256_mayo1), #endif #ifdef OQS_ENABLE_SIG_mayo_2 - DECODER_w_structure("mayo2", der, PrivateKeyInfo, mayo2), - DECODER_w_structure("mayo2", der, SubjectPublicKeyInfo, mayo2), - DECODER_w_structure("p256_mayo2", der, PrivateKeyInfo, p256_mayo2), - DECODER_w_structure("p256_mayo2", der, SubjectPublicKeyInfo, p256_mayo2), +DECODER_w_structure("mayo2", der, PrivateKeyInfo, mayo2), +DECODER_w_structure("mayo2", der, SubjectPublicKeyInfo, mayo2),DECODER_w_structure("p256_mayo2", der, PrivateKeyInfo, p256_mayo2), +DECODER_w_structure("p256_mayo2", der, SubjectPublicKeyInfo, p256_mayo2), #endif #ifdef OQS_ENABLE_SIG_mayo_3 - DECODER_w_structure("mayo3", der, PrivateKeyInfo, mayo3), - DECODER_w_structure("mayo3", der, SubjectPublicKeyInfo, mayo3), - DECODER_w_structure("p384_mayo3", der, PrivateKeyInfo, p384_mayo3), - DECODER_w_structure("p384_mayo3", der, SubjectPublicKeyInfo, p384_mayo3), +DECODER_w_structure("mayo3", der, PrivateKeyInfo, mayo3), +DECODER_w_structure("mayo3", der, SubjectPublicKeyInfo, mayo3),DECODER_w_structure("p384_mayo3", der, PrivateKeyInfo, p384_mayo3), +DECODER_w_structure("p384_mayo3", der, SubjectPublicKeyInfo, p384_mayo3), #endif #ifdef OQS_ENABLE_SIG_mayo_5 - DECODER_w_structure("mayo5", der, PrivateKeyInfo, mayo5), - DECODER_w_structure("mayo5", der, SubjectPublicKeyInfo, mayo5), - DECODER_w_structure("p521_mayo5", der, PrivateKeyInfo, p521_mayo5), - DECODER_w_structure("p521_mayo5", der, SubjectPublicKeyInfo, p521_mayo5), +DECODER_w_structure("mayo5", der, PrivateKeyInfo, mayo5), +DECODER_w_structure("mayo5", der, SubjectPublicKeyInfo, mayo5),DECODER_w_structure("p521_mayo5", der, PrivateKeyInfo, p521_mayo5), +DECODER_w_structure("p521_mayo5", der, SubjectPublicKeyInfo, p521_mayo5), #endif - ///// OQS_TEMPLATE_FRAGMENT_MAKE_END +///// OQS_TEMPLATE_FRAGMENT_MAKE_END diff --git a/oqsprov/oqsencoders.inc b/oqsprov/oqsencoders.inc index bfe2035d..f6d277be 100644 --- a/oqsprov/oqsencoders.inc +++ b/oqsprov/oqsencoders.inc @@ -81,1255 +81,844 @@ ///// OQS_TEMPLATE_FRAGMENT_MAKE_START #ifdef OQS_KEM_ENCODERS -# ifdef OQS_ENABLE_KEM_frodokem_640_aes + +#ifdef OQS_ENABLE_KEM_frodokem_640_aes ENCODER_w_structure("frodo640aes", frodo640aes, der, PrivateKeyInfo), - ENCODER_w_structure("frodo640aes", frodo640aes, pem, PrivateKeyInfo), - ENCODER_w_structure("frodo640aes", frodo640aes, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("frodo640aes", frodo640aes, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("frodo640aes", frodo640aes, der, SubjectPublicKeyInfo), - ENCODER_w_structure("frodo640aes", frodo640aes, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("frodo640aes", frodo640aes), - ENCODER_w_structure("p256_frodo640aes", p256_frodo640aes, der, - PrivateKeyInfo), - ENCODER_w_structure("p256_frodo640aes", p256_frodo640aes, pem, - PrivateKeyInfo), - ENCODER_w_structure("p256_frodo640aes", p256_frodo640aes, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p256_frodo640aes", p256_frodo640aes, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p256_frodo640aes", p256_frodo640aes, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("p256_frodo640aes", p256_frodo640aes, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("p256_frodo640aes", p256_frodo640aes), - ENCODER_w_structure("x25519_frodo640aes", x25519_frodo640aes, der, - PrivateKeyInfo), - ENCODER_w_structure("x25519_frodo640aes", x25519_frodo640aes, pem, - PrivateKeyInfo), - ENCODER_w_structure("x25519_frodo640aes", x25519_frodo640aes, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("x25519_frodo640aes", x25519_frodo640aes, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("x25519_frodo640aes", x25519_frodo640aes, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("x25519_frodo640aes", x25519_frodo640aes, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("x25519_frodo640aes", x25519_frodo640aes), -# endif -# ifdef OQS_ENABLE_KEM_frodokem_640_shake - ENCODER_w_structure("frodo640shake", frodo640shake, der, PrivateKeyInfo), - ENCODER_w_structure("frodo640shake", frodo640shake, pem, PrivateKeyInfo), - ENCODER_w_structure("frodo640shake", frodo640shake, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("frodo640shake", frodo640shake, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("frodo640shake", frodo640shake, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("frodo640shake", frodo640shake, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("frodo640shake", frodo640shake), - ENCODER_w_structure("p256_frodo640shake", p256_frodo640shake, der, - PrivateKeyInfo), - ENCODER_w_structure("p256_frodo640shake", p256_frodo640shake, pem, - PrivateKeyInfo), - ENCODER_w_structure("p256_frodo640shake", p256_frodo640shake, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p256_frodo640shake", p256_frodo640shake, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p256_frodo640shake", p256_frodo640shake, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("p256_frodo640shake", p256_frodo640shake, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("p256_frodo640shake", p256_frodo640shake), - ENCODER_w_structure("x25519_frodo640shake", x25519_frodo640shake, der, - PrivateKeyInfo), - ENCODER_w_structure("x25519_frodo640shake", x25519_frodo640shake, pem, - PrivateKeyInfo), - ENCODER_w_structure("x25519_frodo640shake", x25519_frodo640shake, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("x25519_frodo640shake", x25519_frodo640shake, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("x25519_frodo640shake", x25519_frodo640shake, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("x25519_frodo640shake", x25519_frodo640shake, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("x25519_frodo640shake", x25519_frodo640shake), -# endif -# ifdef OQS_ENABLE_KEM_frodokem_976_aes - ENCODER_w_structure("frodo976aes", frodo976aes, der, PrivateKeyInfo), - ENCODER_w_structure("frodo976aes", frodo976aes, pem, PrivateKeyInfo), - ENCODER_w_structure("frodo976aes", frodo976aes, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("frodo976aes", frodo976aes, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("frodo976aes", frodo976aes, der, SubjectPublicKeyInfo), - ENCODER_w_structure("frodo976aes", frodo976aes, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("frodo976aes", frodo976aes), - ENCODER_w_structure("p384_frodo976aes", p384_frodo976aes, der, - PrivateKeyInfo), - ENCODER_w_structure("p384_frodo976aes", p384_frodo976aes, pem, - PrivateKeyInfo), - ENCODER_w_structure("p384_frodo976aes", p384_frodo976aes, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p384_frodo976aes", p384_frodo976aes, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p384_frodo976aes", p384_frodo976aes, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("p384_frodo976aes", p384_frodo976aes, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("p384_frodo976aes", p384_frodo976aes), - ENCODER_w_structure("x448_frodo976aes", x448_frodo976aes, der, - PrivateKeyInfo), - ENCODER_w_structure("x448_frodo976aes", x448_frodo976aes, pem, - PrivateKeyInfo), - ENCODER_w_structure("x448_frodo976aes", x448_frodo976aes, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("x448_frodo976aes", x448_frodo976aes, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("x448_frodo976aes", x448_frodo976aes, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("x448_frodo976aes", x448_frodo976aes, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("x448_frodo976aes", x448_frodo976aes), -# endif -# ifdef OQS_ENABLE_KEM_frodokem_976_shake - ENCODER_w_structure("frodo976shake", frodo976shake, der, PrivateKeyInfo), - ENCODER_w_structure("frodo976shake", frodo976shake, pem, PrivateKeyInfo), - ENCODER_w_structure("frodo976shake", frodo976shake, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("frodo976shake", frodo976shake, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("frodo976shake", frodo976shake, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("frodo976shake", frodo976shake, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("frodo976shake", frodo976shake), - ENCODER_w_structure("p384_frodo976shake", p384_frodo976shake, der, - PrivateKeyInfo), - ENCODER_w_structure("p384_frodo976shake", p384_frodo976shake, pem, - PrivateKeyInfo), - ENCODER_w_structure("p384_frodo976shake", p384_frodo976shake, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p384_frodo976shake", p384_frodo976shake, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p384_frodo976shake", p384_frodo976shake, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("p384_frodo976shake", p384_frodo976shake, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("p384_frodo976shake", p384_frodo976shake), - ENCODER_w_structure("x448_frodo976shake", x448_frodo976shake, der, - PrivateKeyInfo), - ENCODER_w_structure("x448_frodo976shake", x448_frodo976shake, pem, - PrivateKeyInfo), - ENCODER_w_structure("x448_frodo976shake", x448_frodo976shake, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("x448_frodo976shake", x448_frodo976shake, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("x448_frodo976shake", x448_frodo976shake, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("x448_frodo976shake", x448_frodo976shake, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("x448_frodo976shake", x448_frodo976shake), -# endif -# ifdef OQS_ENABLE_KEM_frodokem_1344_aes - ENCODER_w_structure("frodo1344aes", frodo1344aes, der, PrivateKeyInfo), - ENCODER_w_structure("frodo1344aes", frodo1344aes, pem, PrivateKeyInfo), - ENCODER_w_structure("frodo1344aes", frodo1344aes, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("frodo1344aes", frodo1344aes, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("frodo1344aes", frodo1344aes, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("frodo1344aes", frodo1344aes, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("frodo1344aes", frodo1344aes), - ENCODER_w_structure("p521_frodo1344aes", p521_frodo1344aes, der, - PrivateKeyInfo), - ENCODER_w_structure("p521_frodo1344aes", p521_frodo1344aes, pem, - PrivateKeyInfo), - ENCODER_w_structure("p521_frodo1344aes", p521_frodo1344aes, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p521_frodo1344aes", p521_frodo1344aes, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p521_frodo1344aes", p521_frodo1344aes, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("p521_frodo1344aes", p521_frodo1344aes, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("p521_frodo1344aes", p521_frodo1344aes), -# endif -# ifdef OQS_ENABLE_KEM_frodokem_1344_shake - ENCODER_w_structure("frodo1344shake", frodo1344shake, der, PrivateKeyInfo), - ENCODER_w_structure("frodo1344shake", frodo1344shake, pem, PrivateKeyInfo), - ENCODER_w_structure("frodo1344shake", frodo1344shake, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("frodo1344shake", frodo1344shake, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("frodo1344shake", frodo1344shake, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("frodo1344shake", frodo1344shake, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("frodo1344shake", frodo1344shake), - ENCODER_w_structure("p521_frodo1344shake", p521_frodo1344shake, der, - PrivateKeyInfo), - ENCODER_w_structure("p521_frodo1344shake", p521_frodo1344shake, pem, - PrivateKeyInfo), - ENCODER_w_structure("p521_frodo1344shake", p521_frodo1344shake, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p521_frodo1344shake", p521_frodo1344shake, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p521_frodo1344shake", p521_frodo1344shake, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("p521_frodo1344shake", p521_frodo1344shake, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("p521_frodo1344shake", p521_frodo1344shake), -# endif -# ifdef OQS_ENABLE_KEM_kyber_512 - ENCODER_w_structure("kyber512", kyber512, der, PrivateKeyInfo), - ENCODER_w_structure("kyber512", kyber512, pem, PrivateKeyInfo), - ENCODER_w_structure("kyber512", kyber512, der, EncryptedPrivateKeyInfo), - ENCODER_w_structure("kyber512", kyber512, pem, EncryptedPrivateKeyInfo), - ENCODER_w_structure("kyber512", kyber512, der, SubjectPublicKeyInfo), - ENCODER_w_structure("kyber512", kyber512, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("kyber512", kyber512), - ENCODER_w_structure("p256_kyber512", p256_kyber512, der, PrivateKeyInfo), - ENCODER_w_structure("p256_kyber512", p256_kyber512, pem, PrivateKeyInfo), - ENCODER_w_structure("p256_kyber512", p256_kyber512, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p256_kyber512", p256_kyber512, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p256_kyber512", p256_kyber512, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("p256_kyber512", p256_kyber512, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("p256_kyber512", p256_kyber512), - ENCODER_w_structure("x25519_kyber512", x25519_kyber512, der, - PrivateKeyInfo), - ENCODER_w_structure("x25519_kyber512", x25519_kyber512, pem, - PrivateKeyInfo), - ENCODER_w_structure("x25519_kyber512", x25519_kyber512, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("x25519_kyber512", x25519_kyber512, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("x25519_kyber512", x25519_kyber512, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("x25519_kyber512", x25519_kyber512, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("x25519_kyber512", x25519_kyber512), -# endif -# ifdef OQS_ENABLE_KEM_kyber_768 - ENCODER_w_structure("kyber768", kyber768, der, PrivateKeyInfo), - ENCODER_w_structure("kyber768", kyber768, pem, PrivateKeyInfo), - ENCODER_w_structure("kyber768", kyber768, der, EncryptedPrivateKeyInfo), - ENCODER_w_structure("kyber768", kyber768, pem, EncryptedPrivateKeyInfo), - ENCODER_w_structure("kyber768", kyber768, der, SubjectPublicKeyInfo), - ENCODER_w_structure("kyber768", kyber768, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("kyber768", kyber768), - ENCODER_w_structure("p384_kyber768", p384_kyber768, der, PrivateKeyInfo), - ENCODER_w_structure("p384_kyber768", p384_kyber768, pem, PrivateKeyInfo), - ENCODER_w_structure("p384_kyber768", p384_kyber768, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p384_kyber768", p384_kyber768, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p384_kyber768", p384_kyber768, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("p384_kyber768", p384_kyber768, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("p384_kyber768", p384_kyber768), - ENCODER_w_structure("x448_kyber768", x448_kyber768, der, PrivateKeyInfo), - ENCODER_w_structure("x448_kyber768", x448_kyber768, pem, PrivateKeyInfo), - ENCODER_w_structure("x448_kyber768", x448_kyber768, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("x448_kyber768", x448_kyber768, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("x448_kyber768", x448_kyber768, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("x448_kyber768", x448_kyber768, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("x448_kyber768", x448_kyber768), - ENCODER_w_structure("x25519_kyber768", x25519_kyber768, der, - PrivateKeyInfo), - ENCODER_w_structure("x25519_kyber768", x25519_kyber768, pem, - PrivateKeyInfo), - ENCODER_w_structure("x25519_kyber768", x25519_kyber768, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("x25519_kyber768", x25519_kyber768, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("x25519_kyber768", x25519_kyber768, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("x25519_kyber768", x25519_kyber768, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("x25519_kyber768", x25519_kyber768), - ENCODER_w_structure("p256_kyber768", p256_kyber768, der, PrivateKeyInfo), - ENCODER_w_structure("p256_kyber768", p256_kyber768, pem, PrivateKeyInfo), - ENCODER_w_structure("p256_kyber768", p256_kyber768, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p256_kyber768", p256_kyber768, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p256_kyber768", p256_kyber768, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("p256_kyber768", p256_kyber768, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("p256_kyber768", p256_kyber768), -# endif -# ifdef OQS_ENABLE_KEM_kyber_1024 - ENCODER_w_structure("kyber1024", kyber1024, der, PrivateKeyInfo), - ENCODER_w_structure("kyber1024", kyber1024, pem, PrivateKeyInfo), - ENCODER_w_structure("kyber1024", kyber1024, der, EncryptedPrivateKeyInfo), - ENCODER_w_structure("kyber1024", kyber1024, pem, EncryptedPrivateKeyInfo), - ENCODER_w_structure("kyber1024", kyber1024, der, SubjectPublicKeyInfo), - ENCODER_w_structure("kyber1024", kyber1024, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("kyber1024", kyber1024), - ENCODER_w_structure("p521_kyber1024", p521_kyber1024, der, PrivateKeyInfo), - ENCODER_w_structure("p521_kyber1024", p521_kyber1024, pem, PrivateKeyInfo), - ENCODER_w_structure("p521_kyber1024", p521_kyber1024, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p521_kyber1024", p521_kyber1024, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p521_kyber1024", p521_kyber1024, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("p521_kyber1024", p521_kyber1024, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("p521_kyber1024", p521_kyber1024), -# endif -# ifdef OQS_ENABLE_KEM_ml_kem_512 - ENCODER_w_structure("mlkem512", mlkem512, der, PrivateKeyInfo), - ENCODER_w_structure("mlkem512", mlkem512, pem, PrivateKeyInfo), - ENCODER_w_structure("mlkem512", mlkem512, der, EncryptedPrivateKeyInfo), - ENCODER_w_structure("mlkem512", mlkem512, pem, EncryptedPrivateKeyInfo), - ENCODER_w_structure("mlkem512", mlkem512, der, SubjectPublicKeyInfo), - ENCODER_w_structure("mlkem512", mlkem512, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("mlkem512", mlkem512), - ENCODER_w_structure("p256_mlkem512", p256_mlkem512, der, PrivateKeyInfo), - ENCODER_w_structure("p256_mlkem512", p256_mlkem512, pem, PrivateKeyInfo), - ENCODER_w_structure("p256_mlkem512", p256_mlkem512, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p256_mlkem512", p256_mlkem512, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p256_mlkem512", p256_mlkem512, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("p256_mlkem512", p256_mlkem512, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("p256_mlkem512", p256_mlkem512), - ENCODER_w_structure("x25519_mlkem512", x25519_mlkem512, der, - PrivateKeyInfo), - ENCODER_w_structure("x25519_mlkem512", x25519_mlkem512, pem, - PrivateKeyInfo), - ENCODER_w_structure("x25519_mlkem512", x25519_mlkem512, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("x25519_mlkem512", x25519_mlkem512, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("x25519_mlkem512", x25519_mlkem512, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("x25519_mlkem512", x25519_mlkem512, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("x25519_mlkem512", x25519_mlkem512), -# endif -# ifdef OQS_ENABLE_KEM_ml_kem_768 - ENCODER_w_structure("mlkem768", mlkem768, der, PrivateKeyInfo), - ENCODER_w_structure("mlkem768", mlkem768, pem, PrivateKeyInfo), - ENCODER_w_structure("mlkem768", mlkem768, der, EncryptedPrivateKeyInfo), - ENCODER_w_structure("mlkem768", mlkem768, pem, EncryptedPrivateKeyInfo), - ENCODER_w_structure("mlkem768", mlkem768, der, SubjectPublicKeyInfo), - ENCODER_w_structure("mlkem768", mlkem768, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("mlkem768", mlkem768), - ENCODER_w_structure("p384_mlkem768", p384_mlkem768, der, PrivateKeyInfo), - ENCODER_w_structure("p384_mlkem768", p384_mlkem768, pem, PrivateKeyInfo), - ENCODER_w_structure("p384_mlkem768", p384_mlkem768, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p384_mlkem768", p384_mlkem768, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p384_mlkem768", p384_mlkem768, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("p384_mlkem768", p384_mlkem768, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("p384_mlkem768", p384_mlkem768), - ENCODER_w_structure("x448_mlkem768", x448_mlkem768, der, PrivateKeyInfo), - ENCODER_w_structure("x448_mlkem768", x448_mlkem768, pem, PrivateKeyInfo), - ENCODER_w_structure("x448_mlkem768", x448_mlkem768, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("x448_mlkem768", x448_mlkem768, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("x448_mlkem768", x448_mlkem768, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("x448_mlkem768", x448_mlkem768, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("x448_mlkem768", x448_mlkem768), - ENCODER_w_structure("x25519_mlkem768", x25519_mlkem768, der, - PrivateKeyInfo), - ENCODER_w_structure("x25519_mlkem768", x25519_mlkem768, pem, - PrivateKeyInfo), - ENCODER_w_structure("x25519_mlkem768", x25519_mlkem768, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("x25519_mlkem768", x25519_mlkem768, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("x25519_mlkem768", x25519_mlkem768, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("x25519_mlkem768", x25519_mlkem768, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("x25519_mlkem768", x25519_mlkem768), - ENCODER_w_structure("p256_mlkem768", p256_mlkem768, der, PrivateKeyInfo), - ENCODER_w_structure("p256_mlkem768", p256_mlkem768, pem, PrivateKeyInfo), - ENCODER_w_structure("p256_mlkem768", p256_mlkem768, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p256_mlkem768", p256_mlkem768, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p256_mlkem768", p256_mlkem768, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("p256_mlkem768", p256_mlkem768, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("p256_mlkem768", p256_mlkem768), -# endif -# ifdef OQS_ENABLE_KEM_ml_kem_1024 - ENCODER_w_structure("mlkem1024", mlkem1024, der, PrivateKeyInfo), - ENCODER_w_structure("mlkem1024", mlkem1024, pem, PrivateKeyInfo), - ENCODER_w_structure("mlkem1024", mlkem1024, der, EncryptedPrivateKeyInfo), - ENCODER_w_structure("mlkem1024", mlkem1024, pem, EncryptedPrivateKeyInfo), - ENCODER_w_structure("mlkem1024", mlkem1024, der, SubjectPublicKeyInfo), - ENCODER_w_structure("mlkem1024", mlkem1024, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("mlkem1024", mlkem1024), - ENCODER_w_structure("p521_mlkem1024", p521_mlkem1024, der, PrivateKeyInfo), - ENCODER_w_structure("p521_mlkem1024", p521_mlkem1024, pem, PrivateKeyInfo), - ENCODER_w_structure("p521_mlkem1024", p521_mlkem1024, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p521_mlkem1024", p521_mlkem1024, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p521_mlkem1024", p521_mlkem1024, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("p521_mlkem1024", p521_mlkem1024, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("p521_mlkem1024", p521_mlkem1024), - ENCODER_w_structure("p384_mlkem1024", p384_mlkem1024, der, PrivateKeyInfo), - ENCODER_w_structure("p384_mlkem1024", p384_mlkem1024, pem, PrivateKeyInfo), - ENCODER_w_structure("p384_mlkem1024", p384_mlkem1024, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p384_mlkem1024", p384_mlkem1024, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p384_mlkem1024", p384_mlkem1024, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("p384_mlkem1024", p384_mlkem1024, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("p384_mlkem1024", p384_mlkem1024), -# endif -# ifdef OQS_ENABLE_KEM_bike_l1 - ENCODER_w_structure("bikel1", bikel1, der, PrivateKeyInfo), - ENCODER_w_structure("bikel1", bikel1, pem, PrivateKeyInfo), - ENCODER_w_structure("bikel1", bikel1, der, EncryptedPrivateKeyInfo), - ENCODER_w_structure("bikel1", bikel1, pem, EncryptedPrivateKeyInfo), - ENCODER_w_structure("bikel1", bikel1, der, SubjectPublicKeyInfo), - ENCODER_w_structure("bikel1", bikel1, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("bikel1", bikel1), - ENCODER_w_structure("p256_bikel1", p256_bikel1, der, PrivateKeyInfo), - ENCODER_w_structure("p256_bikel1", p256_bikel1, pem, PrivateKeyInfo), - ENCODER_w_structure("p256_bikel1", p256_bikel1, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p256_bikel1", p256_bikel1, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p256_bikel1", p256_bikel1, der, SubjectPublicKeyInfo), - ENCODER_w_structure("p256_bikel1", p256_bikel1, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("p256_bikel1", p256_bikel1), - ENCODER_w_structure("x25519_bikel1", x25519_bikel1, der, PrivateKeyInfo), - ENCODER_w_structure("x25519_bikel1", x25519_bikel1, pem, PrivateKeyInfo), - ENCODER_w_structure("x25519_bikel1", x25519_bikel1, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("x25519_bikel1", x25519_bikel1, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("x25519_bikel1", x25519_bikel1, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("x25519_bikel1", x25519_bikel1, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("x25519_bikel1", x25519_bikel1), -# endif -# ifdef OQS_ENABLE_KEM_bike_l3 - ENCODER_w_structure("bikel3", bikel3, der, PrivateKeyInfo), - ENCODER_w_structure("bikel3", bikel3, pem, PrivateKeyInfo), - ENCODER_w_structure("bikel3", bikel3, der, EncryptedPrivateKeyInfo), - ENCODER_w_structure("bikel3", bikel3, pem, EncryptedPrivateKeyInfo), - ENCODER_w_structure("bikel3", bikel3, der, SubjectPublicKeyInfo), - ENCODER_w_structure("bikel3", bikel3, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("bikel3", bikel3), - ENCODER_w_structure("p384_bikel3", p384_bikel3, der, PrivateKeyInfo), - ENCODER_w_structure("p384_bikel3", p384_bikel3, pem, PrivateKeyInfo), - ENCODER_w_structure("p384_bikel3", p384_bikel3, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p384_bikel3", p384_bikel3, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p384_bikel3", p384_bikel3, der, SubjectPublicKeyInfo), - ENCODER_w_structure("p384_bikel3", p384_bikel3, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("p384_bikel3", p384_bikel3), - ENCODER_w_structure("x448_bikel3", x448_bikel3, der, PrivateKeyInfo), - ENCODER_w_structure("x448_bikel3", x448_bikel3, pem, PrivateKeyInfo), - ENCODER_w_structure("x448_bikel3", x448_bikel3, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("x448_bikel3", x448_bikel3, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("x448_bikel3", x448_bikel3, der, SubjectPublicKeyInfo), - ENCODER_w_structure("x448_bikel3", x448_bikel3, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("x448_bikel3", x448_bikel3), -# endif -# ifdef OQS_ENABLE_KEM_bike_l5 - ENCODER_w_structure("bikel5", bikel5, der, PrivateKeyInfo), - ENCODER_w_structure("bikel5", bikel5, pem, PrivateKeyInfo), - ENCODER_w_structure("bikel5", bikel5, der, EncryptedPrivateKeyInfo), - ENCODER_w_structure("bikel5", bikel5, pem, EncryptedPrivateKeyInfo), - ENCODER_w_structure("bikel5", bikel5, der, SubjectPublicKeyInfo), - ENCODER_w_structure("bikel5", bikel5, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("bikel5", bikel5), - ENCODER_w_structure("p521_bikel5", p521_bikel5, der, PrivateKeyInfo), - ENCODER_w_structure("p521_bikel5", p521_bikel5, pem, PrivateKeyInfo), - ENCODER_w_structure("p521_bikel5", p521_bikel5, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p521_bikel5", p521_bikel5, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p521_bikel5", p521_bikel5, der, SubjectPublicKeyInfo), - ENCODER_w_structure("p521_bikel5", p521_bikel5, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("p521_bikel5", p521_bikel5), -# endif -# ifdef OQS_ENABLE_KEM_hqc_128 - ENCODER_w_structure("hqc128", hqc128, der, PrivateKeyInfo), - ENCODER_w_structure("hqc128", hqc128, pem, PrivateKeyInfo), - ENCODER_w_structure("hqc128", hqc128, der, EncryptedPrivateKeyInfo), - ENCODER_w_structure("hqc128", hqc128, pem, EncryptedPrivateKeyInfo), - ENCODER_w_structure("hqc128", hqc128, der, SubjectPublicKeyInfo), - ENCODER_w_structure("hqc128", hqc128, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("hqc128", hqc128), - ENCODER_w_structure("p256_hqc128", p256_hqc128, der, PrivateKeyInfo), - ENCODER_w_structure("p256_hqc128", p256_hqc128, pem, PrivateKeyInfo), - ENCODER_w_structure("p256_hqc128", p256_hqc128, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p256_hqc128", p256_hqc128, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p256_hqc128", p256_hqc128, der, SubjectPublicKeyInfo), - ENCODER_w_structure("p256_hqc128", p256_hqc128, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("p256_hqc128", p256_hqc128), - ENCODER_w_structure("x25519_hqc128", x25519_hqc128, der, PrivateKeyInfo), - ENCODER_w_structure("x25519_hqc128", x25519_hqc128, pem, PrivateKeyInfo), - ENCODER_w_structure("x25519_hqc128", x25519_hqc128, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("x25519_hqc128", x25519_hqc128, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("x25519_hqc128", x25519_hqc128, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("x25519_hqc128", x25519_hqc128, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("x25519_hqc128", x25519_hqc128), -# endif -# ifdef OQS_ENABLE_KEM_hqc_192 - ENCODER_w_structure("hqc192", hqc192, der, PrivateKeyInfo), - ENCODER_w_structure("hqc192", hqc192, pem, PrivateKeyInfo), - ENCODER_w_structure("hqc192", hqc192, der, EncryptedPrivateKeyInfo), - ENCODER_w_structure("hqc192", hqc192, pem, EncryptedPrivateKeyInfo), - ENCODER_w_structure("hqc192", hqc192, der, SubjectPublicKeyInfo), - ENCODER_w_structure("hqc192", hqc192, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("hqc192", hqc192), - ENCODER_w_structure("p384_hqc192", p384_hqc192, der, PrivateKeyInfo), - ENCODER_w_structure("p384_hqc192", p384_hqc192, pem, PrivateKeyInfo), - ENCODER_w_structure("p384_hqc192", p384_hqc192, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p384_hqc192", p384_hqc192, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p384_hqc192", p384_hqc192, der, SubjectPublicKeyInfo), - ENCODER_w_structure("p384_hqc192", p384_hqc192, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("p384_hqc192", p384_hqc192), - ENCODER_w_structure("x448_hqc192", x448_hqc192, der, PrivateKeyInfo), - ENCODER_w_structure("x448_hqc192", x448_hqc192, pem, PrivateKeyInfo), - ENCODER_w_structure("x448_hqc192", x448_hqc192, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("x448_hqc192", x448_hqc192, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("x448_hqc192", x448_hqc192, der, SubjectPublicKeyInfo), - ENCODER_w_structure("x448_hqc192", x448_hqc192, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("x448_hqc192", x448_hqc192), -# endif -# ifdef OQS_ENABLE_KEM_hqc_256 - ENCODER_w_structure("hqc256", hqc256, der, PrivateKeyInfo), - ENCODER_w_structure("hqc256", hqc256, pem, PrivateKeyInfo), - ENCODER_w_structure("hqc256", hqc256, der, EncryptedPrivateKeyInfo), - ENCODER_w_structure("hqc256", hqc256, pem, EncryptedPrivateKeyInfo), - ENCODER_w_structure("hqc256", hqc256, der, SubjectPublicKeyInfo), - ENCODER_w_structure("hqc256", hqc256, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("hqc256", hqc256), - ENCODER_w_structure("p521_hqc256", p521_hqc256, der, PrivateKeyInfo), - ENCODER_w_structure("p521_hqc256", p521_hqc256, pem, PrivateKeyInfo), - ENCODER_w_structure("p521_hqc256", p521_hqc256, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p521_hqc256", p521_hqc256, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p521_hqc256", p521_hqc256, der, SubjectPublicKeyInfo), - ENCODER_w_structure("p521_hqc256", p521_hqc256, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("p521_hqc256", p521_hqc256), -# endif +ENCODER_w_structure("frodo640aes", frodo640aes, pem, PrivateKeyInfo), +ENCODER_w_structure("frodo640aes", frodo640aes, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("frodo640aes", frodo640aes, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("frodo640aes", frodo640aes, der, SubjectPublicKeyInfo), +ENCODER_w_structure("frodo640aes", frodo640aes, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("frodo640aes", frodo640aes), +ENCODER_w_structure("p256_frodo640aes", p256_frodo640aes, der, PrivateKeyInfo), +ENCODER_w_structure("p256_frodo640aes", p256_frodo640aes, pem, PrivateKeyInfo), +ENCODER_w_structure("p256_frodo640aes", p256_frodo640aes, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p256_frodo640aes", p256_frodo640aes, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p256_frodo640aes", p256_frodo640aes, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p256_frodo640aes", p256_frodo640aes, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p256_frodo640aes", p256_frodo640aes), +ENCODER_w_structure("x25519_frodo640aes", x25519_frodo640aes, der, PrivateKeyInfo), +ENCODER_w_structure("x25519_frodo640aes", x25519_frodo640aes, pem, PrivateKeyInfo), +ENCODER_w_structure("x25519_frodo640aes", x25519_frodo640aes, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("x25519_frodo640aes", x25519_frodo640aes, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("x25519_frodo640aes", x25519_frodo640aes, der, SubjectPublicKeyInfo), +ENCODER_w_structure("x25519_frodo640aes", x25519_frodo640aes, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("x25519_frodo640aes", x25519_frodo640aes), +#endif +#ifdef OQS_ENABLE_KEM_frodokem_640_shake +ENCODER_w_structure("frodo640shake", frodo640shake, der, PrivateKeyInfo), +ENCODER_w_structure("frodo640shake", frodo640shake, pem, PrivateKeyInfo), +ENCODER_w_structure("frodo640shake", frodo640shake, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("frodo640shake", frodo640shake, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("frodo640shake", frodo640shake, der, SubjectPublicKeyInfo), +ENCODER_w_structure("frodo640shake", frodo640shake, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("frodo640shake", frodo640shake), +ENCODER_w_structure("p256_frodo640shake", p256_frodo640shake, der, PrivateKeyInfo), +ENCODER_w_structure("p256_frodo640shake", p256_frodo640shake, pem, PrivateKeyInfo), +ENCODER_w_structure("p256_frodo640shake", p256_frodo640shake, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p256_frodo640shake", p256_frodo640shake, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p256_frodo640shake", p256_frodo640shake, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p256_frodo640shake", p256_frodo640shake, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p256_frodo640shake", p256_frodo640shake), +ENCODER_w_structure("x25519_frodo640shake", x25519_frodo640shake, der, PrivateKeyInfo), +ENCODER_w_structure("x25519_frodo640shake", x25519_frodo640shake, pem, PrivateKeyInfo), +ENCODER_w_structure("x25519_frodo640shake", x25519_frodo640shake, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("x25519_frodo640shake", x25519_frodo640shake, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("x25519_frodo640shake", x25519_frodo640shake, der, SubjectPublicKeyInfo), +ENCODER_w_structure("x25519_frodo640shake", x25519_frodo640shake, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("x25519_frodo640shake", x25519_frodo640shake), +#endif +#ifdef OQS_ENABLE_KEM_frodokem_976_aes +ENCODER_w_structure("frodo976aes", frodo976aes, der, PrivateKeyInfo), +ENCODER_w_structure("frodo976aes", frodo976aes, pem, PrivateKeyInfo), +ENCODER_w_structure("frodo976aes", frodo976aes, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("frodo976aes", frodo976aes, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("frodo976aes", frodo976aes, der, SubjectPublicKeyInfo), +ENCODER_w_structure("frodo976aes", frodo976aes, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("frodo976aes", frodo976aes), +ENCODER_w_structure("p384_frodo976aes", p384_frodo976aes, der, PrivateKeyInfo), +ENCODER_w_structure("p384_frodo976aes", p384_frodo976aes, pem, PrivateKeyInfo), +ENCODER_w_structure("p384_frodo976aes", p384_frodo976aes, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p384_frodo976aes", p384_frodo976aes, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p384_frodo976aes", p384_frodo976aes, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p384_frodo976aes", p384_frodo976aes, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p384_frodo976aes", p384_frodo976aes), +ENCODER_w_structure("x448_frodo976aes", x448_frodo976aes, der, PrivateKeyInfo), +ENCODER_w_structure("x448_frodo976aes", x448_frodo976aes, pem, PrivateKeyInfo), +ENCODER_w_structure("x448_frodo976aes", x448_frodo976aes, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("x448_frodo976aes", x448_frodo976aes, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("x448_frodo976aes", x448_frodo976aes, der, SubjectPublicKeyInfo), +ENCODER_w_structure("x448_frodo976aes", x448_frodo976aes, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("x448_frodo976aes", x448_frodo976aes), +#endif +#ifdef OQS_ENABLE_KEM_frodokem_976_shake +ENCODER_w_structure("frodo976shake", frodo976shake, der, PrivateKeyInfo), +ENCODER_w_structure("frodo976shake", frodo976shake, pem, PrivateKeyInfo), +ENCODER_w_structure("frodo976shake", frodo976shake, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("frodo976shake", frodo976shake, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("frodo976shake", frodo976shake, der, SubjectPublicKeyInfo), +ENCODER_w_structure("frodo976shake", frodo976shake, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("frodo976shake", frodo976shake), +ENCODER_w_structure("p384_frodo976shake", p384_frodo976shake, der, PrivateKeyInfo), +ENCODER_w_structure("p384_frodo976shake", p384_frodo976shake, pem, PrivateKeyInfo), +ENCODER_w_structure("p384_frodo976shake", p384_frodo976shake, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p384_frodo976shake", p384_frodo976shake, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p384_frodo976shake", p384_frodo976shake, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p384_frodo976shake", p384_frodo976shake, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p384_frodo976shake", p384_frodo976shake), +ENCODER_w_structure("x448_frodo976shake", x448_frodo976shake, der, PrivateKeyInfo), +ENCODER_w_structure("x448_frodo976shake", x448_frodo976shake, pem, PrivateKeyInfo), +ENCODER_w_structure("x448_frodo976shake", x448_frodo976shake, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("x448_frodo976shake", x448_frodo976shake, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("x448_frodo976shake", x448_frodo976shake, der, SubjectPublicKeyInfo), +ENCODER_w_structure("x448_frodo976shake", x448_frodo976shake, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("x448_frodo976shake", x448_frodo976shake), +#endif +#ifdef OQS_ENABLE_KEM_frodokem_1344_aes +ENCODER_w_structure("frodo1344aes", frodo1344aes, der, PrivateKeyInfo), +ENCODER_w_structure("frodo1344aes", frodo1344aes, pem, PrivateKeyInfo), +ENCODER_w_structure("frodo1344aes", frodo1344aes, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("frodo1344aes", frodo1344aes, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("frodo1344aes", frodo1344aes, der, SubjectPublicKeyInfo), +ENCODER_w_structure("frodo1344aes", frodo1344aes, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("frodo1344aes", frodo1344aes), +ENCODER_w_structure("p521_frodo1344aes", p521_frodo1344aes, der, PrivateKeyInfo), +ENCODER_w_structure("p521_frodo1344aes", p521_frodo1344aes, pem, PrivateKeyInfo), +ENCODER_w_structure("p521_frodo1344aes", p521_frodo1344aes, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p521_frodo1344aes", p521_frodo1344aes, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p521_frodo1344aes", p521_frodo1344aes, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p521_frodo1344aes", p521_frodo1344aes, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p521_frodo1344aes", p521_frodo1344aes), +#endif +#ifdef OQS_ENABLE_KEM_frodokem_1344_shake +ENCODER_w_structure("frodo1344shake", frodo1344shake, der, PrivateKeyInfo), +ENCODER_w_structure("frodo1344shake", frodo1344shake, pem, PrivateKeyInfo), +ENCODER_w_structure("frodo1344shake", frodo1344shake, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("frodo1344shake", frodo1344shake, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("frodo1344shake", frodo1344shake, der, SubjectPublicKeyInfo), +ENCODER_w_structure("frodo1344shake", frodo1344shake, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("frodo1344shake", frodo1344shake), +ENCODER_w_structure("p521_frodo1344shake", p521_frodo1344shake, der, PrivateKeyInfo), +ENCODER_w_structure("p521_frodo1344shake", p521_frodo1344shake, pem, PrivateKeyInfo), +ENCODER_w_structure("p521_frodo1344shake", p521_frodo1344shake, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p521_frodo1344shake", p521_frodo1344shake, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p521_frodo1344shake", p521_frodo1344shake, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p521_frodo1344shake", p521_frodo1344shake, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p521_frodo1344shake", p521_frodo1344shake), +#endif +#ifdef OQS_ENABLE_KEM_kyber_512 +ENCODER_w_structure("kyber512", kyber512, der, PrivateKeyInfo), +ENCODER_w_structure("kyber512", kyber512, pem, PrivateKeyInfo), +ENCODER_w_structure("kyber512", kyber512, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("kyber512", kyber512, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("kyber512", kyber512, der, SubjectPublicKeyInfo), +ENCODER_w_structure("kyber512", kyber512, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("kyber512", kyber512), +ENCODER_w_structure("p256_kyber512", p256_kyber512, der, PrivateKeyInfo), +ENCODER_w_structure("p256_kyber512", p256_kyber512, pem, PrivateKeyInfo), +ENCODER_w_structure("p256_kyber512", p256_kyber512, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p256_kyber512", p256_kyber512, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p256_kyber512", p256_kyber512, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p256_kyber512", p256_kyber512, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p256_kyber512", p256_kyber512), +ENCODER_w_structure("x25519_kyber512", x25519_kyber512, der, PrivateKeyInfo), +ENCODER_w_structure("x25519_kyber512", x25519_kyber512, pem, PrivateKeyInfo), +ENCODER_w_structure("x25519_kyber512", x25519_kyber512, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("x25519_kyber512", x25519_kyber512, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("x25519_kyber512", x25519_kyber512, der, SubjectPublicKeyInfo), +ENCODER_w_structure("x25519_kyber512", x25519_kyber512, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("x25519_kyber512", x25519_kyber512), +#endif +#ifdef OQS_ENABLE_KEM_kyber_768 +ENCODER_w_structure("kyber768", kyber768, der, PrivateKeyInfo), +ENCODER_w_structure("kyber768", kyber768, pem, PrivateKeyInfo), +ENCODER_w_structure("kyber768", kyber768, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("kyber768", kyber768, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("kyber768", kyber768, der, SubjectPublicKeyInfo), +ENCODER_w_structure("kyber768", kyber768, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("kyber768", kyber768), +ENCODER_w_structure("p384_kyber768", p384_kyber768, der, PrivateKeyInfo), +ENCODER_w_structure("p384_kyber768", p384_kyber768, pem, PrivateKeyInfo), +ENCODER_w_structure("p384_kyber768", p384_kyber768, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p384_kyber768", p384_kyber768, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p384_kyber768", p384_kyber768, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p384_kyber768", p384_kyber768, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p384_kyber768", p384_kyber768), +ENCODER_w_structure("x448_kyber768", x448_kyber768, der, PrivateKeyInfo), +ENCODER_w_structure("x448_kyber768", x448_kyber768, pem, PrivateKeyInfo), +ENCODER_w_structure("x448_kyber768", x448_kyber768, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("x448_kyber768", x448_kyber768, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("x448_kyber768", x448_kyber768, der, SubjectPublicKeyInfo), +ENCODER_w_structure("x448_kyber768", x448_kyber768, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("x448_kyber768", x448_kyber768), +ENCODER_w_structure("x25519_kyber768", x25519_kyber768, der, PrivateKeyInfo), +ENCODER_w_structure("x25519_kyber768", x25519_kyber768, pem, PrivateKeyInfo), +ENCODER_w_structure("x25519_kyber768", x25519_kyber768, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("x25519_kyber768", x25519_kyber768, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("x25519_kyber768", x25519_kyber768, der, SubjectPublicKeyInfo), +ENCODER_w_structure("x25519_kyber768", x25519_kyber768, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("x25519_kyber768", x25519_kyber768), +ENCODER_w_structure("p256_kyber768", p256_kyber768, der, PrivateKeyInfo), +ENCODER_w_structure("p256_kyber768", p256_kyber768, pem, PrivateKeyInfo), +ENCODER_w_structure("p256_kyber768", p256_kyber768, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p256_kyber768", p256_kyber768, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p256_kyber768", p256_kyber768, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p256_kyber768", p256_kyber768, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p256_kyber768", p256_kyber768), +#endif +#ifdef OQS_ENABLE_KEM_kyber_1024 +ENCODER_w_structure("kyber1024", kyber1024, der, PrivateKeyInfo), +ENCODER_w_structure("kyber1024", kyber1024, pem, PrivateKeyInfo), +ENCODER_w_structure("kyber1024", kyber1024, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("kyber1024", kyber1024, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("kyber1024", kyber1024, der, SubjectPublicKeyInfo), +ENCODER_w_structure("kyber1024", kyber1024, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("kyber1024", kyber1024), +ENCODER_w_structure("p521_kyber1024", p521_kyber1024, der, PrivateKeyInfo), +ENCODER_w_structure("p521_kyber1024", p521_kyber1024, pem, PrivateKeyInfo), +ENCODER_w_structure("p521_kyber1024", p521_kyber1024, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p521_kyber1024", p521_kyber1024, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p521_kyber1024", p521_kyber1024, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p521_kyber1024", p521_kyber1024, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p521_kyber1024", p521_kyber1024), +#endif +#ifdef OQS_ENABLE_KEM_ml_kem_512 +ENCODER_w_structure("mlkem512", mlkem512, der, PrivateKeyInfo), +ENCODER_w_structure("mlkem512", mlkem512, pem, PrivateKeyInfo), +ENCODER_w_structure("mlkem512", mlkem512, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mlkem512", mlkem512, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mlkem512", mlkem512, der, SubjectPublicKeyInfo), +ENCODER_w_structure("mlkem512", mlkem512, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("mlkem512", mlkem512), +ENCODER_w_structure("p256_mlkem512", p256_mlkem512, der, PrivateKeyInfo), +ENCODER_w_structure("p256_mlkem512", p256_mlkem512, pem, PrivateKeyInfo), +ENCODER_w_structure("p256_mlkem512", p256_mlkem512, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p256_mlkem512", p256_mlkem512, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p256_mlkem512", p256_mlkem512, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p256_mlkem512", p256_mlkem512, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p256_mlkem512", p256_mlkem512), +ENCODER_w_structure("x25519_mlkem512", x25519_mlkem512, der, PrivateKeyInfo), +ENCODER_w_structure("x25519_mlkem512", x25519_mlkem512, pem, PrivateKeyInfo), +ENCODER_w_structure("x25519_mlkem512", x25519_mlkem512, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("x25519_mlkem512", x25519_mlkem512, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("x25519_mlkem512", x25519_mlkem512, der, SubjectPublicKeyInfo), +ENCODER_w_structure("x25519_mlkem512", x25519_mlkem512, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("x25519_mlkem512", x25519_mlkem512), +#endif +#ifdef OQS_ENABLE_KEM_ml_kem_768 +ENCODER_w_structure("mlkem768", mlkem768, der, PrivateKeyInfo), +ENCODER_w_structure("mlkem768", mlkem768, pem, PrivateKeyInfo), +ENCODER_w_structure("mlkem768", mlkem768, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mlkem768", mlkem768, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mlkem768", mlkem768, der, SubjectPublicKeyInfo), +ENCODER_w_structure("mlkem768", mlkem768, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("mlkem768", mlkem768), +ENCODER_w_structure("p384_mlkem768", p384_mlkem768, der, PrivateKeyInfo), +ENCODER_w_structure("p384_mlkem768", p384_mlkem768, pem, PrivateKeyInfo), +ENCODER_w_structure("p384_mlkem768", p384_mlkem768, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p384_mlkem768", p384_mlkem768, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p384_mlkem768", p384_mlkem768, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p384_mlkem768", p384_mlkem768, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p384_mlkem768", p384_mlkem768), +ENCODER_w_structure("x448_mlkem768", x448_mlkem768, der, PrivateKeyInfo), +ENCODER_w_structure("x448_mlkem768", x448_mlkem768, pem, PrivateKeyInfo), +ENCODER_w_structure("x448_mlkem768", x448_mlkem768, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("x448_mlkem768", x448_mlkem768, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("x448_mlkem768", x448_mlkem768, der, SubjectPublicKeyInfo), +ENCODER_w_structure("x448_mlkem768", x448_mlkem768, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("x448_mlkem768", x448_mlkem768), +ENCODER_w_structure("x25519_mlkem768", x25519_mlkem768, der, PrivateKeyInfo), +ENCODER_w_structure("x25519_mlkem768", x25519_mlkem768, pem, PrivateKeyInfo), +ENCODER_w_structure("x25519_mlkem768", x25519_mlkem768, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("x25519_mlkem768", x25519_mlkem768, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("x25519_mlkem768", x25519_mlkem768, der, SubjectPublicKeyInfo), +ENCODER_w_structure("x25519_mlkem768", x25519_mlkem768, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("x25519_mlkem768", x25519_mlkem768), +ENCODER_w_structure("p256_mlkem768", p256_mlkem768, der, PrivateKeyInfo), +ENCODER_w_structure("p256_mlkem768", p256_mlkem768, pem, PrivateKeyInfo), +ENCODER_w_structure("p256_mlkem768", p256_mlkem768, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p256_mlkem768", p256_mlkem768, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p256_mlkem768", p256_mlkem768, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p256_mlkem768", p256_mlkem768, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p256_mlkem768", p256_mlkem768), +#endif +#ifdef OQS_ENABLE_KEM_ml_kem_1024 +ENCODER_w_structure("mlkem1024", mlkem1024, der, PrivateKeyInfo), +ENCODER_w_structure("mlkem1024", mlkem1024, pem, PrivateKeyInfo), +ENCODER_w_structure("mlkem1024", mlkem1024, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mlkem1024", mlkem1024, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mlkem1024", mlkem1024, der, SubjectPublicKeyInfo), +ENCODER_w_structure("mlkem1024", mlkem1024, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("mlkem1024", mlkem1024), +ENCODER_w_structure("p521_mlkem1024", p521_mlkem1024, der, PrivateKeyInfo), +ENCODER_w_structure("p521_mlkem1024", p521_mlkem1024, pem, PrivateKeyInfo), +ENCODER_w_structure("p521_mlkem1024", p521_mlkem1024, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p521_mlkem1024", p521_mlkem1024, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p521_mlkem1024", p521_mlkem1024, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p521_mlkem1024", p521_mlkem1024, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p521_mlkem1024", p521_mlkem1024), +ENCODER_w_structure("p384_mlkem1024", p384_mlkem1024, der, PrivateKeyInfo), +ENCODER_w_structure("p384_mlkem1024", p384_mlkem1024, pem, PrivateKeyInfo), +ENCODER_w_structure("p384_mlkem1024", p384_mlkem1024, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p384_mlkem1024", p384_mlkem1024, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p384_mlkem1024", p384_mlkem1024, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p384_mlkem1024", p384_mlkem1024, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p384_mlkem1024", p384_mlkem1024), +#endif +#ifdef OQS_ENABLE_KEM_bike_l1 +ENCODER_w_structure("bikel1", bikel1, der, PrivateKeyInfo), +ENCODER_w_structure("bikel1", bikel1, pem, PrivateKeyInfo), +ENCODER_w_structure("bikel1", bikel1, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("bikel1", bikel1, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("bikel1", bikel1, der, SubjectPublicKeyInfo), +ENCODER_w_structure("bikel1", bikel1, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("bikel1", bikel1), +ENCODER_w_structure("p256_bikel1", p256_bikel1, der, PrivateKeyInfo), +ENCODER_w_structure("p256_bikel1", p256_bikel1, pem, PrivateKeyInfo), +ENCODER_w_structure("p256_bikel1", p256_bikel1, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p256_bikel1", p256_bikel1, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p256_bikel1", p256_bikel1, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p256_bikel1", p256_bikel1, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p256_bikel1", p256_bikel1), +ENCODER_w_structure("x25519_bikel1", x25519_bikel1, der, PrivateKeyInfo), +ENCODER_w_structure("x25519_bikel1", x25519_bikel1, pem, PrivateKeyInfo), +ENCODER_w_structure("x25519_bikel1", x25519_bikel1, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("x25519_bikel1", x25519_bikel1, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("x25519_bikel1", x25519_bikel1, der, SubjectPublicKeyInfo), +ENCODER_w_structure("x25519_bikel1", x25519_bikel1, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("x25519_bikel1", x25519_bikel1), +#endif +#ifdef OQS_ENABLE_KEM_bike_l3 +ENCODER_w_structure("bikel3", bikel3, der, PrivateKeyInfo), +ENCODER_w_structure("bikel3", bikel3, pem, PrivateKeyInfo), +ENCODER_w_structure("bikel3", bikel3, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("bikel3", bikel3, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("bikel3", bikel3, der, SubjectPublicKeyInfo), +ENCODER_w_structure("bikel3", bikel3, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("bikel3", bikel3), +ENCODER_w_structure("p384_bikel3", p384_bikel3, der, PrivateKeyInfo), +ENCODER_w_structure("p384_bikel3", p384_bikel3, pem, PrivateKeyInfo), +ENCODER_w_structure("p384_bikel3", p384_bikel3, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p384_bikel3", p384_bikel3, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p384_bikel3", p384_bikel3, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p384_bikel3", p384_bikel3, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p384_bikel3", p384_bikel3), +ENCODER_w_structure("x448_bikel3", x448_bikel3, der, PrivateKeyInfo), +ENCODER_w_structure("x448_bikel3", x448_bikel3, pem, PrivateKeyInfo), +ENCODER_w_structure("x448_bikel3", x448_bikel3, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("x448_bikel3", x448_bikel3, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("x448_bikel3", x448_bikel3, der, SubjectPublicKeyInfo), +ENCODER_w_structure("x448_bikel3", x448_bikel3, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("x448_bikel3", x448_bikel3), +#endif +#ifdef OQS_ENABLE_KEM_bike_l5 +ENCODER_w_structure("bikel5", bikel5, der, PrivateKeyInfo), +ENCODER_w_structure("bikel5", bikel5, pem, PrivateKeyInfo), +ENCODER_w_structure("bikel5", bikel5, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("bikel5", bikel5, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("bikel5", bikel5, der, SubjectPublicKeyInfo), +ENCODER_w_structure("bikel5", bikel5, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("bikel5", bikel5), +ENCODER_w_structure("p521_bikel5", p521_bikel5, der, PrivateKeyInfo), +ENCODER_w_structure("p521_bikel5", p521_bikel5, pem, PrivateKeyInfo), +ENCODER_w_structure("p521_bikel5", p521_bikel5, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p521_bikel5", p521_bikel5, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p521_bikel5", p521_bikel5, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p521_bikel5", p521_bikel5, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p521_bikel5", p521_bikel5), +#endif +#ifdef OQS_ENABLE_KEM_hqc_128 +ENCODER_w_structure("hqc128", hqc128, der, PrivateKeyInfo), +ENCODER_w_structure("hqc128", hqc128, pem, PrivateKeyInfo), +ENCODER_w_structure("hqc128", hqc128, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("hqc128", hqc128, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("hqc128", hqc128, der, SubjectPublicKeyInfo), +ENCODER_w_structure("hqc128", hqc128, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("hqc128", hqc128), +ENCODER_w_structure("p256_hqc128", p256_hqc128, der, PrivateKeyInfo), +ENCODER_w_structure("p256_hqc128", p256_hqc128, pem, PrivateKeyInfo), +ENCODER_w_structure("p256_hqc128", p256_hqc128, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p256_hqc128", p256_hqc128, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p256_hqc128", p256_hqc128, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p256_hqc128", p256_hqc128, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p256_hqc128", p256_hqc128), +ENCODER_w_structure("x25519_hqc128", x25519_hqc128, der, PrivateKeyInfo), +ENCODER_w_structure("x25519_hqc128", x25519_hqc128, pem, PrivateKeyInfo), +ENCODER_w_structure("x25519_hqc128", x25519_hqc128, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("x25519_hqc128", x25519_hqc128, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("x25519_hqc128", x25519_hqc128, der, SubjectPublicKeyInfo), +ENCODER_w_structure("x25519_hqc128", x25519_hqc128, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("x25519_hqc128", x25519_hqc128), +#endif +#ifdef OQS_ENABLE_KEM_hqc_192 +ENCODER_w_structure("hqc192", hqc192, der, PrivateKeyInfo), +ENCODER_w_structure("hqc192", hqc192, pem, PrivateKeyInfo), +ENCODER_w_structure("hqc192", hqc192, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("hqc192", hqc192, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("hqc192", hqc192, der, SubjectPublicKeyInfo), +ENCODER_w_structure("hqc192", hqc192, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("hqc192", hqc192), +ENCODER_w_structure("p384_hqc192", p384_hqc192, der, PrivateKeyInfo), +ENCODER_w_structure("p384_hqc192", p384_hqc192, pem, PrivateKeyInfo), +ENCODER_w_structure("p384_hqc192", p384_hqc192, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p384_hqc192", p384_hqc192, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p384_hqc192", p384_hqc192, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p384_hqc192", p384_hqc192, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p384_hqc192", p384_hqc192), +ENCODER_w_structure("x448_hqc192", x448_hqc192, der, PrivateKeyInfo), +ENCODER_w_structure("x448_hqc192", x448_hqc192, pem, PrivateKeyInfo), +ENCODER_w_structure("x448_hqc192", x448_hqc192, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("x448_hqc192", x448_hqc192, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("x448_hqc192", x448_hqc192, der, SubjectPublicKeyInfo), +ENCODER_w_structure("x448_hqc192", x448_hqc192, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("x448_hqc192", x448_hqc192), +#endif +#ifdef OQS_ENABLE_KEM_hqc_256 +ENCODER_w_structure("hqc256", hqc256, der, PrivateKeyInfo), +ENCODER_w_structure("hqc256", hqc256, pem, PrivateKeyInfo), +ENCODER_w_structure("hqc256", hqc256, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("hqc256", hqc256, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("hqc256", hqc256, der, SubjectPublicKeyInfo), +ENCODER_w_structure("hqc256", hqc256, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("hqc256", hqc256), +ENCODER_w_structure("p521_hqc256", p521_hqc256, der, PrivateKeyInfo), +ENCODER_w_structure("p521_hqc256", p521_hqc256, pem, PrivateKeyInfo), +ENCODER_w_structure("p521_hqc256", p521_hqc256, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p521_hqc256", p521_hqc256, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p521_hqc256", p521_hqc256, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p521_hqc256", p521_hqc256, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p521_hqc256", p521_hqc256), +#endif #endif /* OQS_KEM_ENCODERS */ + #ifdef OQS_ENABLE_SIG_dilithium_2 - ENCODER_w_structure("dilithium2", dilithium2, der, PrivateKeyInfo), - ENCODER_w_structure("dilithium2", dilithium2, pem, PrivateKeyInfo), - ENCODER_w_structure("dilithium2", dilithium2, der, EncryptedPrivateKeyInfo), - ENCODER_w_structure("dilithium2", dilithium2, pem, EncryptedPrivateKeyInfo), - ENCODER_w_structure("dilithium2", dilithium2, der, SubjectPublicKeyInfo), - ENCODER_w_structure("dilithium2", dilithium2, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("dilithium2", dilithium2), - ENCODER_w_structure("p256_dilithium2", p256_dilithium2, der, - PrivateKeyInfo), - ENCODER_w_structure("p256_dilithium2", p256_dilithium2, pem, - PrivateKeyInfo), - ENCODER_w_structure("p256_dilithium2", p256_dilithium2, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p256_dilithium2", p256_dilithium2, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p256_dilithium2", p256_dilithium2, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("p256_dilithium2", p256_dilithium2, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("p256_dilithium2", p256_dilithium2), - ENCODER_w_structure("rsa3072_dilithium2", rsa3072_dilithium2, der, - PrivateKeyInfo), - ENCODER_w_structure("rsa3072_dilithium2", rsa3072_dilithium2, pem, - PrivateKeyInfo), - ENCODER_w_structure("rsa3072_dilithium2", rsa3072_dilithium2, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("rsa3072_dilithium2", rsa3072_dilithium2, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("rsa3072_dilithium2", rsa3072_dilithium2, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("rsa3072_dilithium2", rsa3072_dilithium2, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("rsa3072_dilithium2", rsa3072_dilithium2), +ENCODER_w_structure("dilithium2", dilithium2, der, PrivateKeyInfo), +ENCODER_w_structure("dilithium2", dilithium2, pem, PrivateKeyInfo), +ENCODER_w_structure("dilithium2", dilithium2, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("dilithium2", dilithium2, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("dilithium2", dilithium2, der, SubjectPublicKeyInfo), +ENCODER_w_structure("dilithium2", dilithium2, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("dilithium2", dilithium2), +ENCODER_w_structure("p256_dilithium2", p256_dilithium2, der, PrivateKeyInfo), +ENCODER_w_structure("p256_dilithium2", p256_dilithium2, pem, PrivateKeyInfo), +ENCODER_w_structure("p256_dilithium2", p256_dilithium2, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p256_dilithium2", p256_dilithium2, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p256_dilithium2", p256_dilithium2, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p256_dilithium2", p256_dilithium2, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p256_dilithium2", p256_dilithium2), +ENCODER_w_structure("rsa3072_dilithium2", rsa3072_dilithium2, der, PrivateKeyInfo), +ENCODER_w_structure("rsa3072_dilithium2", rsa3072_dilithium2, pem, PrivateKeyInfo), +ENCODER_w_structure("rsa3072_dilithium2", rsa3072_dilithium2, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("rsa3072_dilithium2", rsa3072_dilithium2, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("rsa3072_dilithium2", rsa3072_dilithium2, der, SubjectPublicKeyInfo), +ENCODER_w_structure("rsa3072_dilithium2", rsa3072_dilithium2, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("rsa3072_dilithium2", rsa3072_dilithium2), #endif #ifdef OQS_ENABLE_SIG_dilithium_3 - ENCODER_w_structure("dilithium3", dilithium3, der, PrivateKeyInfo), - ENCODER_w_structure("dilithium3", dilithium3, pem, PrivateKeyInfo), - ENCODER_w_structure("dilithium3", dilithium3, der, EncryptedPrivateKeyInfo), - ENCODER_w_structure("dilithium3", dilithium3, pem, EncryptedPrivateKeyInfo), - ENCODER_w_structure("dilithium3", dilithium3, der, SubjectPublicKeyInfo), - ENCODER_w_structure("dilithium3", dilithium3, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("dilithium3", dilithium3), - ENCODER_w_structure("p384_dilithium3", p384_dilithium3, der, - PrivateKeyInfo), - ENCODER_w_structure("p384_dilithium3", p384_dilithium3, pem, - PrivateKeyInfo), - ENCODER_w_structure("p384_dilithium3", p384_dilithium3, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p384_dilithium3", p384_dilithium3, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p384_dilithium3", p384_dilithium3, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("p384_dilithium3", p384_dilithium3, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("p384_dilithium3", p384_dilithium3), +ENCODER_w_structure("dilithium3", dilithium3, der, PrivateKeyInfo), +ENCODER_w_structure("dilithium3", dilithium3, pem, PrivateKeyInfo), +ENCODER_w_structure("dilithium3", dilithium3, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("dilithium3", dilithium3, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("dilithium3", dilithium3, der, SubjectPublicKeyInfo), +ENCODER_w_structure("dilithium3", dilithium3, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("dilithium3", dilithium3), +ENCODER_w_structure("p384_dilithium3", p384_dilithium3, der, PrivateKeyInfo), +ENCODER_w_structure("p384_dilithium3", p384_dilithium3, pem, PrivateKeyInfo), +ENCODER_w_structure("p384_dilithium3", p384_dilithium3, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p384_dilithium3", p384_dilithium3, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p384_dilithium3", p384_dilithium3, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p384_dilithium3", p384_dilithium3, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p384_dilithium3", p384_dilithium3), #endif #ifdef OQS_ENABLE_SIG_dilithium_5 - ENCODER_w_structure("dilithium5", dilithium5, der, PrivateKeyInfo), - ENCODER_w_structure("dilithium5", dilithium5, pem, PrivateKeyInfo), - ENCODER_w_structure("dilithium5", dilithium5, der, EncryptedPrivateKeyInfo), - ENCODER_w_structure("dilithium5", dilithium5, pem, EncryptedPrivateKeyInfo), - ENCODER_w_structure("dilithium5", dilithium5, der, SubjectPublicKeyInfo), - ENCODER_w_structure("dilithium5", dilithium5, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("dilithium5", dilithium5), - ENCODER_w_structure("p521_dilithium5", p521_dilithium5, der, - PrivateKeyInfo), - ENCODER_w_structure("p521_dilithium5", p521_dilithium5, pem, - PrivateKeyInfo), - ENCODER_w_structure("p521_dilithium5", p521_dilithium5, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p521_dilithium5", p521_dilithium5, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p521_dilithium5", p521_dilithium5, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("p521_dilithium5", p521_dilithium5, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("p521_dilithium5", p521_dilithium5), +ENCODER_w_structure("dilithium5", dilithium5, der, PrivateKeyInfo), +ENCODER_w_structure("dilithium5", dilithium5, pem, PrivateKeyInfo), +ENCODER_w_structure("dilithium5", dilithium5, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("dilithium5", dilithium5, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("dilithium5", dilithium5, der, SubjectPublicKeyInfo), +ENCODER_w_structure("dilithium5", dilithium5, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("dilithium5", dilithium5), +ENCODER_w_structure("p521_dilithium5", p521_dilithium5, der, PrivateKeyInfo), +ENCODER_w_structure("p521_dilithium5", p521_dilithium5, pem, PrivateKeyInfo), +ENCODER_w_structure("p521_dilithium5", p521_dilithium5, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p521_dilithium5", p521_dilithium5, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p521_dilithium5", p521_dilithium5, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p521_dilithium5", p521_dilithium5, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p521_dilithium5", p521_dilithium5), #endif #ifdef OQS_ENABLE_SIG_ml_dsa_44 - ENCODER_w_structure("mldsa44", mldsa44, der, PrivateKeyInfo), - ENCODER_w_structure("mldsa44", mldsa44, pem, PrivateKeyInfo), - ENCODER_w_structure("mldsa44", mldsa44, der, EncryptedPrivateKeyInfo), - ENCODER_w_structure("mldsa44", mldsa44, pem, EncryptedPrivateKeyInfo), - ENCODER_w_structure("mldsa44", mldsa44, der, SubjectPublicKeyInfo), - ENCODER_w_structure("mldsa44", mldsa44, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("mldsa44", mldsa44), - ENCODER_w_structure("p256_mldsa44", p256_mldsa44, der, PrivateKeyInfo), - ENCODER_w_structure("p256_mldsa44", p256_mldsa44, pem, PrivateKeyInfo), - ENCODER_w_structure("p256_mldsa44", p256_mldsa44, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p256_mldsa44", p256_mldsa44, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p256_mldsa44", p256_mldsa44, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("p256_mldsa44", p256_mldsa44, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("p256_mldsa44", p256_mldsa44), - ENCODER_w_structure("rsa3072_mldsa44", rsa3072_mldsa44, der, - PrivateKeyInfo), - ENCODER_w_structure("rsa3072_mldsa44", rsa3072_mldsa44, pem, - PrivateKeyInfo), - ENCODER_w_structure("rsa3072_mldsa44", rsa3072_mldsa44, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("rsa3072_mldsa44", rsa3072_mldsa44, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("rsa3072_mldsa44", rsa3072_mldsa44, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("rsa3072_mldsa44", rsa3072_mldsa44, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("rsa3072_mldsa44", rsa3072_mldsa44), - ENCODER_w_structure("mldsa44_pss2048", mldsa44_pss2048, der, - PrivateKeyInfo), - ENCODER_w_structure("mldsa44_pss2048", mldsa44_pss2048, pem, - PrivateKeyInfo), - ENCODER_w_structure("mldsa44_pss2048", mldsa44_pss2048, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("mldsa44_pss2048", mldsa44_pss2048, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("mldsa44_pss2048", mldsa44_pss2048, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("mldsa44_pss2048", mldsa44_pss2048, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("mldsa44_pss2048", mldsa44_pss2048), - ENCODER_w_structure("mldsa44_rsa2048", mldsa44_rsa2048, der, - PrivateKeyInfo), - ENCODER_w_structure("mldsa44_rsa2048", mldsa44_rsa2048, pem, - PrivateKeyInfo), - ENCODER_w_structure("mldsa44_rsa2048", mldsa44_rsa2048, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("mldsa44_rsa2048", mldsa44_rsa2048, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("mldsa44_rsa2048", mldsa44_rsa2048, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("mldsa44_rsa2048", mldsa44_rsa2048, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("mldsa44_rsa2048", mldsa44_rsa2048), - ENCODER_w_structure("mldsa44_ed25519", mldsa44_ed25519, der, - PrivateKeyInfo), - ENCODER_w_structure("mldsa44_ed25519", mldsa44_ed25519, pem, - PrivateKeyInfo), - ENCODER_w_structure("mldsa44_ed25519", mldsa44_ed25519, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("mldsa44_ed25519", mldsa44_ed25519, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("mldsa44_ed25519", mldsa44_ed25519, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("mldsa44_ed25519", mldsa44_ed25519, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("mldsa44_ed25519", mldsa44_ed25519), - ENCODER_w_structure("mldsa44_p256", mldsa44_p256, der, PrivateKeyInfo), - ENCODER_w_structure("mldsa44_p256", mldsa44_p256, pem, PrivateKeyInfo), - ENCODER_w_structure("mldsa44_p256", mldsa44_p256, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("mldsa44_p256", mldsa44_p256, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("mldsa44_p256", mldsa44_p256, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("mldsa44_p256", mldsa44_p256, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("mldsa44_p256", mldsa44_p256), - ENCODER_w_structure("mldsa44_bp256", mldsa44_bp256, der, PrivateKeyInfo), - ENCODER_w_structure("mldsa44_bp256", mldsa44_bp256, pem, PrivateKeyInfo), - ENCODER_w_structure("mldsa44_bp256", mldsa44_bp256, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("mldsa44_bp256", mldsa44_bp256, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("mldsa44_bp256", mldsa44_bp256, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("mldsa44_bp256", mldsa44_bp256, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("mldsa44_bp256", mldsa44_bp256), +ENCODER_w_structure("mldsa44", mldsa44, der, PrivateKeyInfo), +ENCODER_w_structure("mldsa44", mldsa44, pem, PrivateKeyInfo), +ENCODER_w_structure("mldsa44", mldsa44, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mldsa44", mldsa44, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mldsa44", mldsa44, der, SubjectPublicKeyInfo), +ENCODER_w_structure("mldsa44", mldsa44, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("mldsa44", mldsa44), +ENCODER_w_structure("p256_mldsa44", p256_mldsa44, der, PrivateKeyInfo), +ENCODER_w_structure("p256_mldsa44", p256_mldsa44, pem, PrivateKeyInfo), +ENCODER_w_structure("p256_mldsa44", p256_mldsa44, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p256_mldsa44", p256_mldsa44, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p256_mldsa44", p256_mldsa44, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p256_mldsa44", p256_mldsa44, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p256_mldsa44", p256_mldsa44), +ENCODER_w_structure("rsa3072_mldsa44", rsa3072_mldsa44, der, PrivateKeyInfo), +ENCODER_w_structure("rsa3072_mldsa44", rsa3072_mldsa44, pem, PrivateKeyInfo), +ENCODER_w_structure("rsa3072_mldsa44", rsa3072_mldsa44, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("rsa3072_mldsa44", rsa3072_mldsa44, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("rsa3072_mldsa44", rsa3072_mldsa44, der, SubjectPublicKeyInfo), +ENCODER_w_structure("rsa3072_mldsa44", rsa3072_mldsa44, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("rsa3072_mldsa44", rsa3072_mldsa44), +ENCODER_w_structure("mldsa44_pss2048", mldsa44_pss2048, der, PrivateKeyInfo), +ENCODER_w_structure("mldsa44_pss2048", mldsa44_pss2048, pem, PrivateKeyInfo), +ENCODER_w_structure("mldsa44_pss2048", mldsa44_pss2048, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mldsa44_pss2048", mldsa44_pss2048, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mldsa44_pss2048", mldsa44_pss2048, der, SubjectPublicKeyInfo), +ENCODER_w_structure("mldsa44_pss2048", mldsa44_pss2048, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("mldsa44_pss2048", mldsa44_pss2048), +ENCODER_w_structure("mldsa44_rsa2048", mldsa44_rsa2048, der, PrivateKeyInfo), +ENCODER_w_structure("mldsa44_rsa2048", mldsa44_rsa2048, pem, PrivateKeyInfo), +ENCODER_w_structure("mldsa44_rsa2048", mldsa44_rsa2048, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mldsa44_rsa2048", mldsa44_rsa2048, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mldsa44_rsa2048", mldsa44_rsa2048, der, SubjectPublicKeyInfo), +ENCODER_w_structure("mldsa44_rsa2048", mldsa44_rsa2048, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("mldsa44_rsa2048", mldsa44_rsa2048), +ENCODER_w_structure("mldsa44_ed25519", mldsa44_ed25519, der, PrivateKeyInfo), +ENCODER_w_structure("mldsa44_ed25519", mldsa44_ed25519, pem, PrivateKeyInfo), +ENCODER_w_structure("mldsa44_ed25519", mldsa44_ed25519, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mldsa44_ed25519", mldsa44_ed25519, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mldsa44_ed25519", mldsa44_ed25519, der, SubjectPublicKeyInfo), +ENCODER_w_structure("mldsa44_ed25519", mldsa44_ed25519, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("mldsa44_ed25519", mldsa44_ed25519), +ENCODER_w_structure("mldsa44_p256", mldsa44_p256, der, PrivateKeyInfo), +ENCODER_w_structure("mldsa44_p256", mldsa44_p256, pem, PrivateKeyInfo), +ENCODER_w_structure("mldsa44_p256", mldsa44_p256, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mldsa44_p256", mldsa44_p256, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mldsa44_p256", mldsa44_p256, der, SubjectPublicKeyInfo), +ENCODER_w_structure("mldsa44_p256", mldsa44_p256, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("mldsa44_p256", mldsa44_p256), +ENCODER_w_structure("mldsa44_bp256", mldsa44_bp256, der, PrivateKeyInfo), +ENCODER_w_structure("mldsa44_bp256", mldsa44_bp256, pem, PrivateKeyInfo), +ENCODER_w_structure("mldsa44_bp256", mldsa44_bp256, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mldsa44_bp256", mldsa44_bp256, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mldsa44_bp256", mldsa44_bp256, der, SubjectPublicKeyInfo), +ENCODER_w_structure("mldsa44_bp256", mldsa44_bp256, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("mldsa44_bp256", mldsa44_bp256), #endif #ifdef OQS_ENABLE_SIG_ml_dsa_65 - ENCODER_w_structure("mldsa65", mldsa65, der, PrivateKeyInfo), - ENCODER_w_structure("mldsa65", mldsa65, pem, PrivateKeyInfo), - ENCODER_w_structure("mldsa65", mldsa65, der, EncryptedPrivateKeyInfo), - ENCODER_w_structure("mldsa65", mldsa65, pem, EncryptedPrivateKeyInfo), - ENCODER_w_structure("mldsa65", mldsa65, der, SubjectPublicKeyInfo), - ENCODER_w_structure("mldsa65", mldsa65, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("mldsa65", mldsa65), - ENCODER_w_structure("p384_mldsa65", p384_mldsa65, der, PrivateKeyInfo), - ENCODER_w_structure("p384_mldsa65", p384_mldsa65, pem, PrivateKeyInfo), - ENCODER_w_structure("p384_mldsa65", p384_mldsa65, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p384_mldsa65", p384_mldsa65, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p384_mldsa65", p384_mldsa65, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("p384_mldsa65", p384_mldsa65, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("p384_mldsa65", p384_mldsa65), - ENCODER_w_structure("mldsa65_pss3072", mldsa65_pss3072, der, - PrivateKeyInfo), - ENCODER_w_structure("mldsa65_pss3072", mldsa65_pss3072, pem, - PrivateKeyInfo), - ENCODER_w_structure("mldsa65_pss3072", mldsa65_pss3072, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("mldsa65_pss3072", mldsa65_pss3072, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("mldsa65_pss3072", mldsa65_pss3072, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("mldsa65_pss3072", mldsa65_pss3072, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("mldsa65_pss3072", mldsa65_pss3072), - ENCODER_w_structure("mldsa65_rsa3072", mldsa65_rsa3072, der, - PrivateKeyInfo), - ENCODER_w_structure("mldsa65_rsa3072", mldsa65_rsa3072, pem, - PrivateKeyInfo), - ENCODER_w_structure("mldsa65_rsa3072", mldsa65_rsa3072, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("mldsa65_rsa3072", mldsa65_rsa3072, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("mldsa65_rsa3072", mldsa65_rsa3072, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("mldsa65_rsa3072", mldsa65_rsa3072, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("mldsa65_rsa3072", mldsa65_rsa3072), - ENCODER_w_structure("mldsa65_p256", mldsa65_p256, der, PrivateKeyInfo), - ENCODER_w_structure("mldsa65_p256", mldsa65_p256, pem, PrivateKeyInfo), - ENCODER_w_structure("mldsa65_p256", mldsa65_p256, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("mldsa65_p256", mldsa65_p256, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("mldsa65_p256", mldsa65_p256, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("mldsa65_p256", mldsa65_p256, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("mldsa65_p256", mldsa65_p256), - ENCODER_w_structure("mldsa65_bp256", mldsa65_bp256, der, PrivateKeyInfo), - ENCODER_w_structure("mldsa65_bp256", mldsa65_bp256, pem, PrivateKeyInfo), - ENCODER_w_structure("mldsa65_bp256", mldsa65_bp256, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("mldsa65_bp256", mldsa65_bp256, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("mldsa65_bp256", mldsa65_bp256, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("mldsa65_bp256", mldsa65_bp256, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("mldsa65_bp256", mldsa65_bp256), - ENCODER_w_structure("mldsa65_ed25519", mldsa65_ed25519, der, - PrivateKeyInfo), - ENCODER_w_structure("mldsa65_ed25519", mldsa65_ed25519, pem, - PrivateKeyInfo), - ENCODER_w_structure("mldsa65_ed25519", mldsa65_ed25519, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("mldsa65_ed25519", mldsa65_ed25519, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("mldsa65_ed25519", mldsa65_ed25519, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("mldsa65_ed25519", mldsa65_ed25519, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("mldsa65_ed25519", mldsa65_ed25519), +ENCODER_w_structure("mldsa65", mldsa65, der, PrivateKeyInfo), +ENCODER_w_structure("mldsa65", mldsa65, pem, PrivateKeyInfo), +ENCODER_w_structure("mldsa65", mldsa65, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mldsa65", mldsa65, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mldsa65", mldsa65, der, SubjectPublicKeyInfo), +ENCODER_w_structure("mldsa65", mldsa65, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("mldsa65", mldsa65), +ENCODER_w_structure("p384_mldsa65", p384_mldsa65, der, PrivateKeyInfo), +ENCODER_w_structure("p384_mldsa65", p384_mldsa65, pem, PrivateKeyInfo), +ENCODER_w_structure("p384_mldsa65", p384_mldsa65, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p384_mldsa65", p384_mldsa65, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p384_mldsa65", p384_mldsa65, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p384_mldsa65", p384_mldsa65, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p384_mldsa65", p384_mldsa65), +ENCODER_w_structure("mldsa65_pss3072", mldsa65_pss3072, der, PrivateKeyInfo), +ENCODER_w_structure("mldsa65_pss3072", mldsa65_pss3072, pem, PrivateKeyInfo), +ENCODER_w_structure("mldsa65_pss3072", mldsa65_pss3072, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mldsa65_pss3072", mldsa65_pss3072, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mldsa65_pss3072", mldsa65_pss3072, der, SubjectPublicKeyInfo), +ENCODER_w_structure("mldsa65_pss3072", mldsa65_pss3072, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("mldsa65_pss3072", mldsa65_pss3072), +ENCODER_w_structure("mldsa65_rsa3072", mldsa65_rsa3072, der, PrivateKeyInfo), +ENCODER_w_structure("mldsa65_rsa3072", mldsa65_rsa3072, pem, PrivateKeyInfo), +ENCODER_w_structure("mldsa65_rsa3072", mldsa65_rsa3072, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mldsa65_rsa3072", mldsa65_rsa3072, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mldsa65_rsa3072", mldsa65_rsa3072, der, SubjectPublicKeyInfo), +ENCODER_w_structure("mldsa65_rsa3072", mldsa65_rsa3072, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("mldsa65_rsa3072", mldsa65_rsa3072), +ENCODER_w_structure("mldsa65_p256", mldsa65_p256, der, PrivateKeyInfo), +ENCODER_w_structure("mldsa65_p256", mldsa65_p256, pem, PrivateKeyInfo), +ENCODER_w_structure("mldsa65_p256", mldsa65_p256, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mldsa65_p256", mldsa65_p256, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mldsa65_p256", mldsa65_p256, der, SubjectPublicKeyInfo), +ENCODER_w_structure("mldsa65_p256", mldsa65_p256, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("mldsa65_p256", mldsa65_p256), +ENCODER_w_structure("mldsa65_bp256", mldsa65_bp256, der, PrivateKeyInfo), +ENCODER_w_structure("mldsa65_bp256", mldsa65_bp256, pem, PrivateKeyInfo), +ENCODER_w_structure("mldsa65_bp256", mldsa65_bp256, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mldsa65_bp256", mldsa65_bp256, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mldsa65_bp256", mldsa65_bp256, der, SubjectPublicKeyInfo), +ENCODER_w_structure("mldsa65_bp256", mldsa65_bp256, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("mldsa65_bp256", mldsa65_bp256), +ENCODER_w_structure("mldsa65_ed25519", mldsa65_ed25519, der, PrivateKeyInfo), +ENCODER_w_structure("mldsa65_ed25519", mldsa65_ed25519, pem, PrivateKeyInfo), +ENCODER_w_structure("mldsa65_ed25519", mldsa65_ed25519, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mldsa65_ed25519", mldsa65_ed25519, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mldsa65_ed25519", mldsa65_ed25519, der, SubjectPublicKeyInfo), +ENCODER_w_structure("mldsa65_ed25519", mldsa65_ed25519, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("mldsa65_ed25519", mldsa65_ed25519), #endif #ifdef OQS_ENABLE_SIG_ml_dsa_87 - ENCODER_w_structure("mldsa87", mldsa87, der, PrivateKeyInfo), - ENCODER_w_structure("mldsa87", mldsa87, pem, PrivateKeyInfo), - ENCODER_w_structure("mldsa87", mldsa87, der, EncryptedPrivateKeyInfo), - ENCODER_w_structure("mldsa87", mldsa87, pem, EncryptedPrivateKeyInfo), - ENCODER_w_structure("mldsa87", mldsa87, der, SubjectPublicKeyInfo), - ENCODER_w_structure("mldsa87", mldsa87, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("mldsa87", mldsa87), - ENCODER_w_structure("p521_mldsa87", p521_mldsa87, der, PrivateKeyInfo), - ENCODER_w_structure("p521_mldsa87", p521_mldsa87, pem, PrivateKeyInfo), - ENCODER_w_structure("p521_mldsa87", p521_mldsa87, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p521_mldsa87", p521_mldsa87, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p521_mldsa87", p521_mldsa87, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("p521_mldsa87", p521_mldsa87, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("p521_mldsa87", p521_mldsa87), - ENCODER_w_structure("mldsa87_p384", mldsa87_p384, der, PrivateKeyInfo), - ENCODER_w_structure("mldsa87_p384", mldsa87_p384, pem, PrivateKeyInfo), - ENCODER_w_structure("mldsa87_p384", mldsa87_p384, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("mldsa87_p384", mldsa87_p384, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("mldsa87_p384", mldsa87_p384, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("mldsa87_p384", mldsa87_p384, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("mldsa87_p384", mldsa87_p384), - ENCODER_w_structure("mldsa87_bp384", mldsa87_bp384, der, PrivateKeyInfo), - ENCODER_w_structure("mldsa87_bp384", mldsa87_bp384, pem, PrivateKeyInfo), - ENCODER_w_structure("mldsa87_bp384", mldsa87_bp384, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("mldsa87_bp384", mldsa87_bp384, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("mldsa87_bp384", mldsa87_bp384, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("mldsa87_bp384", mldsa87_bp384, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("mldsa87_bp384", mldsa87_bp384), - ENCODER_w_structure("mldsa87_ed448", mldsa87_ed448, der, PrivateKeyInfo), - ENCODER_w_structure("mldsa87_ed448", mldsa87_ed448, pem, PrivateKeyInfo), - ENCODER_w_structure("mldsa87_ed448", mldsa87_ed448, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("mldsa87_ed448", mldsa87_ed448, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("mldsa87_ed448", mldsa87_ed448, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("mldsa87_ed448", mldsa87_ed448, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("mldsa87_ed448", mldsa87_ed448), +ENCODER_w_structure("mldsa87", mldsa87, der, PrivateKeyInfo), +ENCODER_w_structure("mldsa87", mldsa87, pem, PrivateKeyInfo), +ENCODER_w_structure("mldsa87", mldsa87, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mldsa87", mldsa87, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mldsa87", mldsa87, der, SubjectPublicKeyInfo), +ENCODER_w_structure("mldsa87", mldsa87, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("mldsa87", mldsa87), +ENCODER_w_structure("p521_mldsa87", p521_mldsa87, der, PrivateKeyInfo), +ENCODER_w_structure("p521_mldsa87", p521_mldsa87, pem, PrivateKeyInfo), +ENCODER_w_structure("p521_mldsa87", p521_mldsa87, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p521_mldsa87", p521_mldsa87, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p521_mldsa87", p521_mldsa87, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p521_mldsa87", p521_mldsa87, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p521_mldsa87", p521_mldsa87), +ENCODER_w_structure("mldsa87_p384", mldsa87_p384, der, PrivateKeyInfo), +ENCODER_w_structure("mldsa87_p384", mldsa87_p384, pem, PrivateKeyInfo), +ENCODER_w_structure("mldsa87_p384", mldsa87_p384, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mldsa87_p384", mldsa87_p384, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mldsa87_p384", mldsa87_p384, der, SubjectPublicKeyInfo), +ENCODER_w_structure("mldsa87_p384", mldsa87_p384, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("mldsa87_p384", mldsa87_p384), +ENCODER_w_structure("mldsa87_bp384", mldsa87_bp384, der, PrivateKeyInfo), +ENCODER_w_structure("mldsa87_bp384", mldsa87_bp384, pem, PrivateKeyInfo), +ENCODER_w_structure("mldsa87_bp384", mldsa87_bp384, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mldsa87_bp384", mldsa87_bp384, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mldsa87_bp384", mldsa87_bp384, der, SubjectPublicKeyInfo), +ENCODER_w_structure("mldsa87_bp384", mldsa87_bp384, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("mldsa87_bp384", mldsa87_bp384), +ENCODER_w_structure("mldsa87_ed448", mldsa87_ed448, der, PrivateKeyInfo), +ENCODER_w_structure("mldsa87_ed448", mldsa87_ed448, pem, PrivateKeyInfo), +ENCODER_w_structure("mldsa87_ed448", mldsa87_ed448, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mldsa87_ed448", mldsa87_ed448, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mldsa87_ed448", mldsa87_ed448, der, SubjectPublicKeyInfo), +ENCODER_w_structure("mldsa87_ed448", mldsa87_ed448, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("mldsa87_ed448", mldsa87_ed448), #endif #ifdef OQS_ENABLE_SIG_falcon_512 - ENCODER_w_structure("falcon512", falcon512, der, PrivateKeyInfo), - ENCODER_w_structure("falcon512", falcon512, pem, PrivateKeyInfo), - ENCODER_w_structure("falcon512", falcon512, der, EncryptedPrivateKeyInfo), - ENCODER_w_structure("falcon512", falcon512, pem, EncryptedPrivateKeyInfo), - ENCODER_w_structure("falcon512", falcon512, der, SubjectPublicKeyInfo), - ENCODER_w_structure("falcon512", falcon512, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("falcon512", falcon512), - ENCODER_w_structure("p256_falcon512", p256_falcon512, der, PrivateKeyInfo), - ENCODER_w_structure("p256_falcon512", p256_falcon512, pem, PrivateKeyInfo), - ENCODER_w_structure("p256_falcon512", p256_falcon512, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p256_falcon512", p256_falcon512, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p256_falcon512", p256_falcon512, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("p256_falcon512", p256_falcon512, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("p256_falcon512", p256_falcon512), - ENCODER_w_structure("rsa3072_falcon512", rsa3072_falcon512, der, - PrivateKeyInfo), - ENCODER_w_structure("rsa3072_falcon512", rsa3072_falcon512, pem, - PrivateKeyInfo), - ENCODER_w_structure("rsa3072_falcon512", rsa3072_falcon512, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("rsa3072_falcon512", rsa3072_falcon512, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("rsa3072_falcon512", rsa3072_falcon512, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("rsa3072_falcon512", rsa3072_falcon512, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("rsa3072_falcon512", rsa3072_falcon512), +ENCODER_w_structure("falcon512", falcon512, der, PrivateKeyInfo), +ENCODER_w_structure("falcon512", falcon512, pem, PrivateKeyInfo), +ENCODER_w_structure("falcon512", falcon512, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("falcon512", falcon512, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("falcon512", falcon512, der, SubjectPublicKeyInfo), +ENCODER_w_structure("falcon512", falcon512, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("falcon512", falcon512), +ENCODER_w_structure("p256_falcon512", p256_falcon512, der, PrivateKeyInfo), +ENCODER_w_structure("p256_falcon512", p256_falcon512, pem, PrivateKeyInfo), +ENCODER_w_structure("p256_falcon512", p256_falcon512, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p256_falcon512", p256_falcon512, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p256_falcon512", p256_falcon512, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p256_falcon512", p256_falcon512, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p256_falcon512", p256_falcon512), +ENCODER_w_structure("rsa3072_falcon512", rsa3072_falcon512, der, PrivateKeyInfo), +ENCODER_w_structure("rsa3072_falcon512", rsa3072_falcon512, pem, PrivateKeyInfo), +ENCODER_w_structure("rsa3072_falcon512", rsa3072_falcon512, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("rsa3072_falcon512", rsa3072_falcon512, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("rsa3072_falcon512", rsa3072_falcon512, der, SubjectPublicKeyInfo), +ENCODER_w_structure("rsa3072_falcon512", rsa3072_falcon512, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("rsa3072_falcon512", rsa3072_falcon512), #endif #ifdef OQS_ENABLE_SIG_falcon_padded_512 - ENCODER_w_structure("falconpadded512", falconpadded512, der, - PrivateKeyInfo), - ENCODER_w_structure("falconpadded512", falconpadded512, pem, - PrivateKeyInfo), - ENCODER_w_structure("falconpadded512", falconpadded512, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("falconpadded512", falconpadded512, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("falconpadded512", falconpadded512, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("falconpadded512", falconpadded512, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("falconpadded512", falconpadded512), - ENCODER_w_structure("p256_falconpadded512", p256_falconpadded512, der, - PrivateKeyInfo), - ENCODER_w_structure("p256_falconpadded512", p256_falconpadded512, pem, - PrivateKeyInfo), - ENCODER_w_structure("p256_falconpadded512", p256_falconpadded512, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p256_falconpadded512", p256_falconpadded512, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p256_falconpadded512", p256_falconpadded512, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("p256_falconpadded512", p256_falconpadded512, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("p256_falconpadded512", p256_falconpadded512), - ENCODER_w_structure("rsa3072_falconpadded512", rsa3072_falconpadded512, der, - PrivateKeyInfo), - ENCODER_w_structure("rsa3072_falconpadded512", rsa3072_falconpadded512, pem, - PrivateKeyInfo), - ENCODER_w_structure("rsa3072_falconpadded512", rsa3072_falconpadded512, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("rsa3072_falconpadded512", rsa3072_falconpadded512, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("rsa3072_falconpadded512", rsa3072_falconpadded512, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("rsa3072_falconpadded512", rsa3072_falconpadded512, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("rsa3072_falconpadded512", rsa3072_falconpadded512), +ENCODER_w_structure("falconpadded512", falconpadded512, der, PrivateKeyInfo), +ENCODER_w_structure("falconpadded512", falconpadded512, pem, PrivateKeyInfo), +ENCODER_w_structure("falconpadded512", falconpadded512, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("falconpadded512", falconpadded512, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("falconpadded512", falconpadded512, der, SubjectPublicKeyInfo), +ENCODER_w_structure("falconpadded512", falconpadded512, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("falconpadded512", falconpadded512), +ENCODER_w_structure("p256_falconpadded512", p256_falconpadded512, der, PrivateKeyInfo), +ENCODER_w_structure("p256_falconpadded512", p256_falconpadded512, pem, PrivateKeyInfo), +ENCODER_w_structure("p256_falconpadded512", p256_falconpadded512, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p256_falconpadded512", p256_falconpadded512, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p256_falconpadded512", p256_falconpadded512, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p256_falconpadded512", p256_falconpadded512, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p256_falconpadded512", p256_falconpadded512), +ENCODER_w_structure("rsa3072_falconpadded512", rsa3072_falconpadded512, der, PrivateKeyInfo), +ENCODER_w_structure("rsa3072_falconpadded512", rsa3072_falconpadded512, pem, PrivateKeyInfo), +ENCODER_w_structure("rsa3072_falconpadded512", rsa3072_falconpadded512, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("rsa3072_falconpadded512", rsa3072_falconpadded512, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("rsa3072_falconpadded512", rsa3072_falconpadded512, der, SubjectPublicKeyInfo), +ENCODER_w_structure("rsa3072_falconpadded512", rsa3072_falconpadded512, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("rsa3072_falconpadded512", rsa3072_falconpadded512), #endif #ifdef OQS_ENABLE_SIG_falcon_1024 - ENCODER_w_structure("falcon1024", falcon1024, der, PrivateKeyInfo), - ENCODER_w_structure("falcon1024", falcon1024, pem, PrivateKeyInfo), - ENCODER_w_structure("falcon1024", falcon1024, der, EncryptedPrivateKeyInfo), - ENCODER_w_structure("falcon1024", falcon1024, pem, EncryptedPrivateKeyInfo), - ENCODER_w_structure("falcon1024", falcon1024, der, SubjectPublicKeyInfo), - ENCODER_w_structure("falcon1024", falcon1024, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("falcon1024", falcon1024), - ENCODER_w_structure("p521_falcon1024", p521_falcon1024, der, - PrivateKeyInfo), - ENCODER_w_structure("p521_falcon1024", p521_falcon1024, pem, - PrivateKeyInfo), - ENCODER_w_structure("p521_falcon1024", p521_falcon1024, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p521_falcon1024", p521_falcon1024, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p521_falcon1024", p521_falcon1024, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("p521_falcon1024", p521_falcon1024, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("p521_falcon1024", p521_falcon1024), +ENCODER_w_structure("falcon1024", falcon1024, der, PrivateKeyInfo), +ENCODER_w_structure("falcon1024", falcon1024, pem, PrivateKeyInfo), +ENCODER_w_structure("falcon1024", falcon1024, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("falcon1024", falcon1024, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("falcon1024", falcon1024, der, SubjectPublicKeyInfo), +ENCODER_w_structure("falcon1024", falcon1024, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("falcon1024", falcon1024), +ENCODER_w_structure("p521_falcon1024", p521_falcon1024, der, PrivateKeyInfo), +ENCODER_w_structure("p521_falcon1024", p521_falcon1024, pem, PrivateKeyInfo), +ENCODER_w_structure("p521_falcon1024", p521_falcon1024, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p521_falcon1024", p521_falcon1024, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p521_falcon1024", p521_falcon1024, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p521_falcon1024", p521_falcon1024, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p521_falcon1024", p521_falcon1024), #endif #ifdef OQS_ENABLE_SIG_falcon_padded_1024 - ENCODER_w_structure("falconpadded1024", falconpadded1024, der, - PrivateKeyInfo), - ENCODER_w_structure("falconpadded1024", falconpadded1024, pem, - PrivateKeyInfo), - ENCODER_w_structure("falconpadded1024", falconpadded1024, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("falconpadded1024", falconpadded1024, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("falconpadded1024", falconpadded1024, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("falconpadded1024", falconpadded1024, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("falconpadded1024", falconpadded1024), - ENCODER_w_structure("p521_falconpadded1024", p521_falconpadded1024, der, - PrivateKeyInfo), - ENCODER_w_structure("p521_falconpadded1024", p521_falconpadded1024, pem, - PrivateKeyInfo), - ENCODER_w_structure("p521_falconpadded1024", p521_falconpadded1024, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p521_falconpadded1024", p521_falconpadded1024, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p521_falconpadded1024", p521_falconpadded1024, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("p521_falconpadded1024", p521_falconpadded1024, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("p521_falconpadded1024", p521_falconpadded1024), +ENCODER_w_structure("falconpadded1024", falconpadded1024, der, PrivateKeyInfo), +ENCODER_w_structure("falconpadded1024", falconpadded1024, pem, PrivateKeyInfo), +ENCODER_w_structure("falconpadded1024", falconpadded1024, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("falconpadded1024", falconpadded1024, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("falconpadded1024", falconpadded1024, der, SubjectPublicKeyInfo), +ENCODER_w_structure("falconpadded1024", falconpadded1024, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("falconpadded1024", falconpadded1024), +ENCODER_w_structure("p521_falconpadded1024", p521_falconpadded1024, der, PrivateKeyInfo), +ENCODER_w_structure("p521_falconpadded1024", p521_falconpadded1024, pem, PrivateKeyInfo), +ENCODER_w_structure("p521_falconpadded1024", p521_falconpadded1024, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p521_falconpadded1024", p521_falconpadded1024, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p521_falconpadded1024", p521_falconpadded1024, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p521_falconpadded1024", p521_falconpadded1024, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p521_falconpadded1024", p521_falconpadded1024), #endif #ifdef OQS_ENABLE_SIG_sphincs_sha2_128f_simple - ENCODER_w_structure("sphincssha2128fsimple", sphincssha2128fsimple, der, - PrivateKeyInfo), - ENCODER_w_structure("sphincssha2128fsimple", sphincssha2128fsimple, pem, - PrivateKeyInfo), - ENCODER_w_structure("sphincssha2128fsimple", sphincssha2128fsimple, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("sphincssha2128fsimple", sphincssha2128fsimple, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("sphincssha2128fsimple", sphincssha2128fsimple, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("sphincssha2128fsimple", sphincssha2128fsimple, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("sphincssha2128fsimple", sphincssha2128fsimple), - ENCODER_w_structure("p256_sphincssha2128fsimple", - p256_sphincssha2128fsimple, der, PrivateKeyInfo), - ENCODER_w_structure("p256_sphincssha2128fsimple", - p256_sphincssha2128fsimple, pem, PrivateKeyInfo), - ENCODER_w_structure("p256_sphincssha2128fsimple", - p256_sphincssha2128fsimple, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p256_sphincssha2128fsimple", - p256_sphincssha2128fsimple, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p256_sphincssha2128fsimple", - p256_sphincssha2128fsimple, der, SubjectPublicKeyInfo), - ENCODER_w_structure("p256_sphincssha2128fsimple", - p256_sphincssha2128fsimple, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("p256_sphincssha2128fsimple", p256_sphincssha2128fsimple), - ENCODER_w_structure("rsa3072_sphincssha2128fsimple", - rsa3072_sphincssha2128fsimple, der, PrivateKeyInfo), - ENCODER_w_structure("rsa3072_sphincssha2128fsimple", - rsa3072_sphincssha2128fsimple, pem, PrivateKeyInfo), - ENCODER_w_structure("rsa3072_sphincssha2128fsimple", - rsa3072_sphincssha2128fsimple, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("rsa3072_sphincssha2128fsimple", - rsa3072_sphincssha2128fsimple, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("rsa3072_sphincssha2128fsimple", - rsa3072_sphincssha2128fsimple, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("rsa3072_sphincssha2128fsimple", - rsa3072_sphincssha2128fsimple, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("rsa3072_sphincssha2128fsimple", - rsa3072_sphincssha2128fsimple), +ENCODER_w_structure("sphincssha2128fsimple", sphincssha2128fsimple, der, PrivateKeyInfo), +ENCODER_w_structure("sphincssha2128fsimple", sphincssha2128fsimple, pem, PrivateKeyInfo), +ENCODER_w_structure("sphincssha2128fsimple", sphincssha2128fsimple, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("sphincssha2128fsimple", sphincssha2128fsimple, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("sphincssha2128fsimple", sphincssha2128fsimple, der, SubjectPublicKeyInfo), +ENCODER_w_structure("sphincssha2128fsimple", sphincssha2128fsimple, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("sphincssha2128fsimple", sphincssha2128fsimple), +ENCODER_w_structure("p256_sphincssha2128fsimple", p256_sphincssha2128fsimple, der, PrivateKeyInfo), +ENCODER_w_structure("p256_sphincssha2128fsimple", p256_sphincssha2128fsimple, pem, PrivateKeyInfo), +ENCODER_w_structure("p256_sphincssha2128fsimple", p256_sphincssha2128fsimple, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p256_sphincssha2128fsimple", p256_sphincssha2128fsimple, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p256_sphincssha2128fsimple", p256_sphincssha2128fsimple, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p256_sphincssha2128fsimple", p256_sphincssha2128fsimple, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p256_sphincssha2128fsimple", p256_sphincssha2128fsimple), +ENCODER_w_structure("rsa3072_sphincssha2128fsimple", rsa3072_sphincssha2128fsimple, der, PrivateKeyInfo), +ENCODER_w_structure("rsa3072_sphincssha2128fsimple", rsa3072_sphincssha2128fsimple, pem, PrivateKeyInfo), +ENCODER_w_structure("rsa3072_sphincssha2128fsimple", rsa3072_sphincssha2128fsimple, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("rsa3072_sphincssha2128fsimple", rsa3072_sphincssha2128fsimple, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("rsa3072_sphincssha2128fsimple", rsa3072_sphincssha2128fsimple, der, SubjectPublicKeyInfo), +ENCODER_w_structure("rsa3072_sphincssha2128fsimple", rsa3072_sphincssha2128fsimple, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("rsa3072_sphincssha2128fsimple", rsa3072_sphincssha2128fsimple), #endif #ifdef OQS_ENABLE_SIG_sphincs_sha2_128s_simple - ENCODER_w_structure("sphincssha2128ssimple", sphincssha2128ssimple, der, - PrivateKeyInfo), - ENCODER_w_structure("sphincssha2128ssimple", sphincssha2128ssimple, pem, - PrivateKeyInfo), - ENCODER_w_structure("sphincssha2128ssimple", sphincssha2128ssimple, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("sphincssha2128ssimple", sphincssha2128ssimple, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("sphincssha2128ssimple", sphincssha2128ssimple, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("sphincssha2128ssimple", sphincssha2128ssimple, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("sphincssha2128ssimple", sphincssha2128ssimple), - ENCODER_w_structure("p256_sphincssha2128ssimple", - p256_sphincssha2128ssimple, der, PrivateKeyInfo), - ENCODER_w_structure("p256_sphincssha2128ssimple", - p256_sphincssha2128ssimple, pem, PrivateKeyInfo), - ENCODER_w_structure("p256_sphincssha2128ssimple", - p256_sphincssha2128ssimple, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p256_sphincssha2128ssimple", - p256_sphincssha2128ssimple, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p256_sphincssha2128ssimple", - p256_sphincssha2128ssimple, der, SubjectPublicKeyInfo), - ENCODER_w_structure("p256_sphincssha2128ssimple", - p256_sphincssha2128ssimple, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("p256_sphincssha2128ssimple", p256_sphincssha2128ssimple), - ENCODER_w_structure("rsa3072_sphincssha2128ssimple", - rsa3072_sphincssha2128ssimple, der, PrivateKeyInfo), - ENCODER_w_structure("rsa3072_sphincssha2128ssimple", - rsa3072_sphincssha2128ssimple, pem, PrivateKeyInfo), - ENCODER_w_structure("rsa3072_sphincssha2128ssimple", - rsa3072_sphincssha2128ssimple, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("rsa3072_sphincssha2128ssimple", - rsa3072_sphincssha2128ssimple, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("rsa3072_sphincssha2128ssimple", - rsa3072_sphincssha2128ssimple, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("rsa3072_sphincssha2128ssimple", - rsa3072_sphincssha2128ssimple, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("rsa3072_sphincssha2128ssimple", - rsa3072_sphincssha2128ssimple), +ENCODER_w_structure("sphincssha2128ssimple", sphincssha2128ssimple, der, PrivateKeyInfo), +ENCODER_w_structure("sphincssha2128ssimple", sphincssha2128ssimple, pem, PrivateKeyInfo), +ENCODER_w_structure("sphincssha2128ssimple", sphincssha2128ssimple, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("sphincssha2128ssimple", sphincssha2128ssimple, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("sphincssha2128ssimple", sphincssha2128ssimple, der, SubjectPublicKeyInfo), +ENCODER_w_structure("sphincssha2128ssimple", sphincssha2128ssimple, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("sphincssha2128ssimple", sphincssha2128ssimple), +ENCODER_w_structure("p256_sphincssha2128ssimple", p256_sphincssha2128ssimple, der, PrivateKeyInfo), +ENCODER_w_structure("p256_sphincssha2128ssimple", p256_sphincssha2128ssimple, pem, PrivateKeyInfo), +ENCODER_w_structure("p256_sphincssha2128ssimple", p256_sphincssha2128ssimple, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p256_sphincssha2128ssimple", p256_sphincssha2128ssimple, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p256_sphincssha2128ssimple", p256_sphincssha2128ssimple, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p256_sphincssha2128ssimple", p256_sphincssha2128ssimple, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p256_sphincssha2128ssimple", p256_sphincssha2128ssimple), +ENCODER_w_structure("rsa3072_sphincssha2128ssimple", rsa3072_sphincssha2128ssimple, der, PrivateKeyInfo), +ENCODER_w_structure("rsa3072_sphincssha2128ssimple", rsa3072_sphincssha2128ssimple, pem, PrivateKeyInfo), +ENCODER_w_structure("rsa3072_sphincssha2128ssimple", rsa3072_sphincssha2128ssimple, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("rsa3072_sphincssha2128ssimple", rsa3072_sphincssha2128ssimple, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("rsa3072_sphincssha2128ssimple", rsa3072_sphincssha2128ssimple, der, SubjectPublicKeyInfo), +ENCODER_w_structure("rsa3072_sphincssha2128ssimple", rsa3072_sphincssha2128ssimple, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("rsa3072_sphincssha2128ssimple", rsa3072_sphincssha2128ssimple), #endif #ifdef OQS_ENABLE_SIG_sphincs_sha2_192f_simple - ENCODER_w_structure("sphincssha2192fsimple", sphincssha2192fsimple, der, - PrivateKeyInfo), - ENCODER_w_structure("sphincssha2192fsimple", sphincssha2192fsimple, pem, - PrivateKeyInfo), - ENCODER_w_structure("sphincssha2192fsimple", sphincssha2192fsimple, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("sphincssha2192fsimple", sphincssha2192fsimple, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("sphincssha2192fsimple", sphincssha2192fsimple, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("sphincssha2192fsimple", sphincssha2192fsimple, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("sphincssha2192fsimple", sphincssha2192fsimple), - ENCODER_w_structure("p384_sphincssha2192fsimple", - p384_sphincssha2192fsimple, der, PrivateKeyInfo), - ENCODER_w_structure("p384_sphincssha2192fsimple", - p384_sphincssha2192fsimple, pem, PrivateKeyInfo), - ENCODER_w_structure("p384_sphincssha2192fsimple", - p384_sphincssha2192fsimple, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p384_sphincssha2192fsimple", - p384_sphincssha2192fsimple, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p384_sphincssha2192fsimple", - p384_sphincssha2192fsimple, der, SubjectPublicKeyInfo), - ENCODER_w_structure("p384_sphincssha2192fsimple", - p384_sphincssha2192fsimple, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("p384_sphincssha2192fsimple", p384_sphincssha2192fsimple), +ENCODER_w_structure("sphincssha2192fsimple", sphincssha2192fsimple, der, PrivateKeyInfo), +ENCODER_w_structure("sphincssha2192fsimple", sphincssha2192fsimple, pem, PrivateKeyInfo), +ENCODER_w_structure("sphincssha2192fsimple", sphincssha2192fsimple, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("sphincssha2192fsimple", sphincssha2192fsimple, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("sphincssha2192fsimple", sphincssha2192fsimple, der, SubjectPublicKeyInfo), +ENCODER_w_structure("sphincssha2192fsimple", sphincssha2192fsimple, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("sphincssha2192fsimple", sphincssha2192fsimple), +ENCODER_w_structure("p384_sphincssha2192fsimple", p384_sphincssha2192fsimple, der, PrivateKeyInfo), +ENCODER_w_structure("p384_sphincssha2192fsimple", p384_sphincssha2192fsimple, pem, PrivateKeyInfo), +ENCODER_w_structure("p384_sphincssha2192fsimple", p384_sphincssha2192fsimple, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p384_sphincssha2192fsimple", p384_sphincssha2192fsimple, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p384_sphincssha2192fsimple", p384_sphincssha2192fsimple, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p384_sphincssha2192fsimple", p384_sphincssha2192fsimple, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p384_sphincssha2192fsimple", p384_sphincssha2192fsimple), #endif #ifdef OQS_ENABLE_SIG_sphincs_shake_128f_simple - ENCODER_w_structure("sphincsshake128fsimple", sphincsshake128fsimple, der, - PrivateKeyInfo), - ENCODER_w_structure("sphincsshake128fsimple", sphincsshake128fsimple, pem, - PrivateKeyInfo), - ENCODER_w_structure("sphincsshake128fsimple", sphincsshake128fsimple, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("sphincsshake128fsimple", sphincsshake128fsimple, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("sphincsshake128fsimple", sphincsshake128fsimple, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("sphincsshake128fsimple", sphincsshake128fsimple, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("sphincsshake128fsimple", sphincsshake128fsimple), - ENCODER_w_structure("p256_sphincsshake128fsimple", - p256_sphincsshake128fsimple, der, PrivateKeyInfo), - ENCODER_w_structure("p256_sphincsshake128fsimple", - p256_sphincsshake128fsimple, pem, PrivateKeyInfo), - ENCODER_w_structure("p256_sphincsshake128fsimple", - p256_sphincsshake128fsimple, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p256_sphincsshake128fsimple", - p256_sphincsshake128fsimple, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("p256_sphincsshake128fsimple", - p256_sphincsshake128fsimple, der, SubjectPublicKeyInfo), - ENCODER_w_structure("p256_sphincsshake128fsimple", - p256_sphincsshake128fsimple, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("p256_sphincsshake128fsimple", p256_sphincsshake128fsimple), - ENCODER_w_structure("rsa3072_sphincsshake128fsimple", - rsa3072_sphincsshake128fsimple, der, PrivateKeyInfo), - ENCODER_w_structure("rsa3072_sphincsshake128fsimple", - rsa3072_sphincsshake128fsimple, pem, PrivateKeyInfo), - ENCODER_w_structure("rsa3072_sphincsshake128fsimple", - rsa3072_sphincsshake128fsimple, der, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("rsa3072_sphincsshake128fsimple", - rsa3072_sphincsshake128fsimple, pem, - EncryptedPrivateKeyInfo), - ENCODER_w_structure("rsa3072_sphincsshake128fsimple", - rsa3072_sphincsshake128fsimple, der, - SubjectPublicKeyInfo), - ENCODER_w_structure("rsa3072_sphincsshake128fsimple", - rsa3072_sphincsshake128fsimple, pem, - SubjectPublicKeyInfo), - ENCODER_TEXT("rsa3072_sphincsshake128fsimple", - rsa3072_sphincsshake128fsimple), +ENCODER_w_structure("sphincsshake128fsimple", sphincsshake128fsimple, der, PrivateKeyInfo), +ENCODER_w_structure("sphincsshake128fsimple", sphincsshake128fsimple, pem, PrivateKeyInfo), +ENCODER_w_structure("sphincsshake128fsimple", sphincsshake128fsimple, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("sphincsshake128fsimple", sphincsshake128fsimple, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("sphincsshake128fsimple", sphincsshake128fsimple, der, SubjectPublicKeyInfo), +ENCODER_w_structure("sphincsshake128fsimple", sphincsshake128fsimple, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("sphincsshake128fsimple", sphincsshake128fsimple), +ENCODER_w_structure("p256_sphincsshake128fsimple", p256_sphincsshake128fsimple, der, PrivateKeyInfo), +ENCODER_w_structure("p256_sphincsshake128fsimple", p256_sphincsshake128fsimple, pem, PrivateKeyInfo), +ENCODER_w_structure("p256_sphincsshake128fsimple", p256_sphincsshake128fsimple, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p256_sphincsshake128fsimple", p256_sphincsshake128fsimple, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p256_sphincsshake128fsimple", p256_sphincsshake128fsimple, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p256_sphincsshake128fsimple", p256_sphincsshake128fsimple, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p256_sphincsshake128fsimple", p256_sphincsshake128fsimple), +ENCODER_w_structure("rsa3072_sphincsshake128fsimple", rsa3072_sphincsshake128fsimple, der, PrivateKeyInfo), +ENCODER_w_structure("rsa3072_sphincsshake128fsimple", rsa3072_sphincsshake128fsimple, pem, PrivateKeyInfo), +ENCODER_w_structure("rsa3072_sphincsshake128fsimple", rsa3072_sphincsshake128fsimple, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("rsa3072_sphincsshake128fsimple", rsa3072_sphincsshake128fsimple, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("rsa3072_sphincsshake128fsimple", rsa3072_sphincsshake128fsimple, der, SubjectPublicKeyInfo), +ENCODER_w_structure("rsa3072_sphincsshake128fsimple", rsa3072_sphincsshake128fsimple, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("rsa3072_sphincsshake128fsimple", rsa3072_sphincsshake128fsimple), #endif #ifdef OQS_ENABLE_SIG_mayo_1 - ENCODER_w_structure("mayo1", mayo1, der, PrivateKeyInfo), - ENCODER_w_structure("mayo1", mayo1, pem, PrivateKeyInfo), - ENCODER_w_structure("mayo1", mayo1, der, EncryptedPrivateKeyInfo), - ENCODER_w_structure("mayo1", mayo1, pem, EncryptedPrivateKeyInfo), - ENCODER_w_structure("mayo1", mayo1, der, SubjectPublicKeyInfo), - ENCODER_w_structure("mayo1", mayo1, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("mayo1", mayo1), - ENCODER_w_structure("p256_mayo1", p256_mayo1, der, PrivateKeyInfo), - ENCODER_w_structure("p256_mayo1", p256_mayo1, pem, PrivateKeyInfo), - ENCODER_w_structure("p256_mayo1", p256_mayo1, der, EncryptedPrivateKeyInfo), - ENCODER_w_structure("p256_mayo1", p256_mayo1, pem, EncryptedPrivateKeyInfo), - ENCODER_w_structure("p256_mayo1", p256_mayo1, der, SubjectPublicKeyInfo), - ENCODER_w_structure("p256_mayo1", p256_mayo1, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("p256_mayo1", p256_mayo1), +ENCODER_w_structure("mayo1", mayo1, der, PrivateKeyInfo), +ENCODER_w_structure("mayo1", mayo1, pem, PrivateKeyInfo), +ENCODER_w_structure("mayo1", mayo1, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mayo1", mayo1, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mayo1", mayo1, der, SubjectPublicKeyInfo), +ENCODER_w_structure("mayo1", mayo1, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("mayo1", mayo1), +ENCODER_w_structure("p256_mayo1", p256_mayo1, der, PrivateKeyInfo), +ENCODER_w_structure("p256_mayo1", p256_mayo1, pem, PrivateKeyInfo), +ENCODER_w_structure("p256_mayo1", p256_mayo1, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p256_mayo1", p256_mayo1, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p256_mayo1", p256_mayo1, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p256_mayo1", p256_mayo1, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p256_mayo1", p256_mayo1), #endif #ifdef OQS_ENABLE_SIG_mayo_2 - ENCODER_w_structure("mayo2", mayo2, der, PrivateKeyInfo), - ENCODER_w_structure("mayo2", mayo2, pem, PrivateKeyInfo), - ENCODER_w_structure("mayo2", mayo2, der, EncryptedPrivateKeyInfo), - ENCODER_w_structure("mayo2", mayo2, pem, EncryptedPrivateKeyInfo), - ENCODER_w_structure("mayo2", mayo2, der, SubjectPublicKeyInfo), - ENCODER_w_structure("mayo2", mayo2, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("mayo2", mayo2), - ENCODER_w_structure("p256_mayo2", p256_mayo2, der, PrivateKeyInfo), - ENCODER_w_structure("p256_mayo2", p256_mayo2, pem, PrivateKeyInfo), - ENCODER_w_structure("p256_mayo2", p256_mayo2, der, EncryptedPrivateKeyInfo), - ENCODER_w_structure("p256_mayo2", p256_mayo2, pem, EncryptedPrivateKeyInfo), - ENCODER_w_structure("p256_mayo2", p256_mayo2, der, SubjectPublicKeyInfo), - ENCODER_w_structure("p256_mayo2", p256_mayo2, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("p256_mayo2", p256_mayo2), +ENCODER_w_structure("mayo2", mayo2, der, PrivateKeyInfo), +ENCODER_w_structure("mayo2", mayo2, pem, PrivateKeyInfo), +ENCODER_w_structure("mayo2", mayo2, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mayo2", mayo2, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mayo2", mayo2, der, SubjectPublicKeyInfo), +ENCODER_w_structure("mayo2", mayo2, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("mayo2", mayo2), +ENCODER_w_structure("p256_mayo2", p256_mayo2, der, PrivateKeyInfo), +ENCODER_w_structure("p256_mayo2", p256_mayo2, pem, PrivateKeyInfo), +ENCODER_w_structure("p256_mayo2", p256_mayo2, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p256_mayo2", p256_mayo2, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p256_mayo2", p256_mayo2, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p256_mayo2", p256_mayo2, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p256_mayo2", p256_mayo2), #endif #ifdef OQS_ENABLE_SIG_mayo_3 - ENCODER_w_structure("mayo3", mayo3, der, PrivateKeyInfo), - ENCODER_w_structure("mayo3", mayo3, pem, PrivateKeyInfo), - ENCODER_w_structure("mayo3", mayo3, der, EncryptedPrivateKeyInfo), - ENCODER_w_structure("mayo3", mayo3, pem, EncryptedPrivateKeyInfo), - ENCODER_w_structure("mayo3", mayo3, der, SubjectPublicKeyInfo), - ENCODER_w_structure("mayo3", mayo3, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("mayo3", mayo3), - ENCODER_w_structure("p384_mayo3", p384_mayo3, der, PrivateKeyInfo), - ENCODER_w_structure("p384_mayo3", p384_mayo3, pem, PrivateKeyInfo), - ENCODER_w_structure("p384_mayo3", p384_mayo3, der, EncryptedPrivateKeyInfo), - ENCODER_w_structure("p384_mayo3", p384_mayo3, pem, EncryptedPrivateKeyInfo), - ENCODER_w_structure("p384_mayo3", p384_mayo3, der, SubjectPublicKeyInfo), - ENCODER_w_structure("p384_mayo3", p384_mayo3, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("p384_mayo3", p384_mayo3), +ENCODER_w_structure("mayo3", mayo3, der, PrivateKeyInfo), +ENCODER_w_structure("mayo3", mayo3, pem, PrivateKeyInfo), +ENCODER_w_structure("mayo3", mayo3, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mayo3", mayo3, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mayo3", mayo3, der, SubjectPublicKeyInfo), +ENCODER_w_structure("mayo3", mayo3, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("mayo3", mayo3), +ENCODER_w_structure("p384_mayo3", p384_mayo3, der, PrivateKeyInfo), +ENCODER_w_structure("p384_mayo3", p384_mayo3, pem, PrivateKeyInfo), +ENCODER_w_structure("p384_mayo3", p384_mayo3, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p384_mayo3", p384_mayo3, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p384_mayo3", p384_mayo3, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p384_mayo3", p384_mayo3, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p384_mayo3", p384_mayo3), #endif #ifdef OQS_ENABLE_SIG_mayo_5 - ENCODER_w_structure("mayo5", mayo5, der, PrivateKeyInfo), - ENCODER_w_structure("mayo5", mayo5, pem, PrivateKeyInfo), - ENCODER_w_structure("mayo5", mayo5, der, EncryptedPrivateKeyInfo), - ENCODER_w_structure("mayo5", mayo5, pem, EncryptedPrivateKeyInfo), - ENCODER_w_structure("mayo5", mayo5, der, SubjectPublicKeyInfo), - ENCODER_w_structure("mayo5", mayo5, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("mayo5", mayo5), - ENCODER_w_structure("p521_mayo5", p521_mayo5, der, PrivateKeyInfo), - ENCODER_w_structure("p521_mayo5", p521_mayo5, pem, PrivateKeyInfo), - ENCODER_w_structure("p521_mayo5", p521_mayo5, der, EncryptedPrivateKeyInfo), - ENCODER_w_structure("p521_mayo5", p521_mayo5, pem, EncryptedPrivateKeyInfo), - ENCODER_w_structure("p521_mayo5", p521_mayo5, der, SubjectPublicKeyInfo), - ENCODER_w_structure("p521_mayo5", p521_mayo5, pem, SubjectPublicKeyInfo), - ENCODER_TEXT("p521_mayo5", p521_mayo5), +ENCODER_w_structure("mayo5", mayo5, der, PrivateKeyInfo), +ENCODER_w_structure("mayo5", mayo5, pem, PrivateKeyInfo), +ENCODER_w_structure("mayo5", mayo5, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mayo5", mayo5, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("mayo5", mayo5, der, SubjectPublicKeyInfo), +ENCODER_w_structure("mayo5", mayo5, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("mayo5", mayo5), +ENCODER_w_structure("p521_mayo5", p521_mayo5, der, PrivateKeyInfo), +ENCODER_w_structure("p521_mayo5", p521_mayo5, pem, PrivateKeyInfo), +ENCODER_w_structure("p521_mayo5", p521_mayo5, der, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p521_mayo5", p521_mayo5, pem, EncryptedPrivateKeyInfo), +ENCODER_w_structure("p521_mayo5", p521_mayo5, der, SubjectPublicKeyInfo), +ENCODER_w_structure("p521_mayo5", p521_mayo5, pem, SubjectPublicKeyInfo), +ENCODER_TEXT("p521_mayo5", p521_mayo5), #endif - ///// OQS_TEMPLATE_FRAGMENT_MAKE_END +///// OQS_TEMPLATE_FRAGMENT_MAKE_END diff --git a/oqsprov/oqsprov.c b/oqsprov/oqsprov.c index 836a5f9f..5a2f93ce 100644 --- a/oqsprov/oqsprov.c +++ b/oqsprov/oqsprov.c @@ -7,7 +7,6 @@ * */ -#include "oqs_prov.h" #include #include #include @@ -19,20 +18,22 @@ #include #include +#include "oqs_prov.h" + #ifdef NDEBUG -# define OQS_PROV_PRINTF(a) -# define OQS_PROV_PRINTF2(a, b) -# define OQS_PROV_PRINTF3(a, b, c) +#define OQS_PROV_PRINTF(a) +#define OQS_PROV_PRINTF2(a, b) +#define OQS_PROV_PRINTF3(a, b, c) #else -# define OQS_PROV_PRINTF(a) \ - if (getenv("OQSPROV")) \ - printf(a) -# define OQS_PROV_PRINTF2(a, b) \ - if (getenv("OQSPROV")) \ - printf(a, b) -# define OQS_PROV_PRINTF3(a, b, c) \ - if (getenv("OQSPROV")) \ - printf(a, b, c) +#define OQS_PROV_PRINTF(a) \ + if (getenv("OQSPROV")) \ + printf(a) +#define OQS_PROV_PRINTF2(a, b) \ + if (getenv("OQSPROV")) \ + printf(a, b) +#define OQS_PROV_PRINTF3(a, b, c) \ + if (getenv("OQSPROV")) \ + printf(a, b, c) #endif // NDEBUG /* @@ -50,9 +51,9 @@ extern OSSL_FUNC_provider_get_capabilities_fn oqs_provider_get_capabilities; ///// OQS_TEMPLATE_FRAGMENT_ASSIGN_SIG_OIDS_START #ifdef OQS_KEM_ENCODERS -# define OQS_OID_CNT 218 +#define OQS_OID_CNT 218 #else -# define OQS_OID_CNT 112 +#define OQS_OID_CNT 112 #endif const char *oqs_oid_alg_list[OQS_OID_CNT] = { @@ -282,8 +283,7 @@ const char *oqs_oid_alg_list[OQS_OID_CNT] = { ///// OQS_TEMPLATE_FRAGMENT_ASSIGN_SIG_OIDS_END }; -int oqs_patch_oids(void) -{ +int oqs_patch_oids(void) { ///// OQS_TEMPLATE_FRAGMENT_OID_PATCHING_START { const char *envval = NULL; @@ -415,9 +415,9 @@ int oqs_patch_oids(void) if ((envval = getenv("OQS_OID_P521_HQC256"))) oqs_oid_alg_list[104] = envval; -# define OQS_KEMOID_CNT 104 + 2 +#define OQS_KEMOID_CNT 104 + 2 #else -# define OQS_KEMOID_CNT 0 +#define OQS_KEMOID_CNT 0 #endif /* OQS_KEM_ENCODERS */ if ((envval = getenv("OQS_OID_DILITHIUM2"))) oqs_oid_alg_list[0 + OQS_KEMOID_CNT] = envval; @@ -535,29 +535,29 @@ int oqs_patch_oids(void) return 1; } -#define SIGALG(NAMES, SECBITS, FUNC) \ - { \ - NAMES, "provider=oqsprovider,oqsprovider.security_bits=" #SECBITS "", \ - FUNC \ +#define SIGALG(NAMES, SECBITS, FUNC) \ + { \ + NAMES, "provider=oqsprovider,oqsprovider.security_bits=" #SECBITS "", \ + FUNC \ } -#define KEMBASEALG(NAMES, SECBITS) \ - {"" #NAMES "", \ - "provider=oqsprovider,oqsprovider.security_bits=" #SECBITS "", \ +#define KEMBASEALG(NAMES, SECBITS) \ + {"" #NAMES "", \ + "provider=oqsprovider,oqsprovider.security_bits=" #SECBITS "", \ oqs_generic_kem_functions}, -#define KEMHYBALG(NAMES, SECBITS) \ - {"" #NAMES "", \ - "provider=oqsprovider,oqsprovider.security_bits=" #SECBITS "", \ +#define KEMHYBALG(NAMES, SECBITS) \ + {"" #NAMES "", \ + "provider=oqsprovider,oqsprovider.security_bits=" #SECBITS "", \ oqs_hybrid_kem_functions}, -#define KEMKMALG(NAMES, SECBITS) \ - {"" #NAMES "", \ - "provider=oqsprovider,oqsprovider.security_bits=" #SECBITS "", \ +#define KEMKMALG(NAMES, SECBITS) \ + {"" #NAMES "", \ + "provider=oqsprovider,oqsprovider.security_bits=" #SECBITS "", \ oqs_##NAMES##_keymgmt_functions}, -#define KEMKMHYBALG(NAMES, SECBITS, HYBTYPE) \ - {"" #NAMES "", \ - "provider=oqsprovider,oqsprovider.security_bits=" #SECBITS "", \ +#define KEMKMHYBALG(NAMES, SECBITS, HYBTYPE) \ + {"" #NAMES "", \ + "provider=oqsprovider,oqsprovider.security_bits=" #SECBITS "", \ oqs_##HYBTYPE##_##NAMES##_keymgmt_functions}, /* Functions provided by the core */ @@ -565,12 +565,12 @@ static OSSL_FUNC_core_gettable_params_fn *c_gettable_params = NULL; static OSSL_FUNC_core_get_params_fn *c_get_params = NULL; /* Parameters we provide to the core */ -static const OSSL_PARAM oqsprovider_param_types[] - = {OSSL_PARAM_DEFN(OSSL_PROV_PARAM_NAME, OSSL_PARAM_UTF8_PTR, NULL, 0), - OSSL_PARAM_DEFN(OSSL_PROV_PARAM_VERSION, OSSL_PARAM_UTF8_PTR, NULL, 0), - OSSL_PARAM_DEFN(OSSL_PROV_PARAM_BUILDINFO, OSSL_PARAM_UTF8_PTR, NULL, 0), - OSSL_PARAM_DEFN(OSSL_PROV_PARAM_STATUS, OSSL_PARAM_INTEGER, NULL, 0), - OSSL_PARAM_END}; +static const OSSL_PARAM oqsprovider_param_types[] = { + OSSL_PARAM_DEFN(OSSL_PROV_PARAM_NAME, OSSL_PARAM_UTF8_PTR, NULL, 0), + OSSL_PARAM_DEFN(OSSL_PROV_PARAM_VERSION, OSSL_PARAM_UTF8_PTR, NULL, 0), + OSSL_PARAM_DEFN(OSSL_PROV_PARAM_BUILDINFO, OSSL_PARAM_UTF8_PTR, NULL, 0), + OSSL_PARAM_DEFN(OSSL_PROV_PARAM_STATUS, OSSL_PARAM_INTEGER, NULL, 0), + OSSL_PARAM_END}; static const OSSL_ALGORITHM oqsprovider_signatures[] = { ///// OQS_TEMPLATE_FRAGMENT_SIG_FUNCTIONS_START @@ -765,8 +765,7 @@ static const OSSL_ALGORITHM oqsprovider_asym_kems[] = { ///// OQS_TEMPLATE_FRAGMENT_KEM_FUNCTIONS_END {NULL, NULL, NULL}}; -static const OSSL_ALGORITHM oqsprovider_keymgmt[] - = { +static const OSSL_ALGORITHM oqsprovider_keymgmt[] = { ///// OQS_TEMPLATE_FRAGMENT_KEYMGMT_FUNCTIONS_START // clang-format off @@ -970,9 +969,9 @@ static const OSSL_ALGORITHM oqsprovider_keymgmt[] KEMKMHYBALG(p521_hqc256, 256, ecp) #endif - // clang-format on - ///// OQS_TEMPLATE_FRAGMENT_KEYMGMT_FUNCTIONS_END - {NULL, NULL, NULL}}; + // clang-format on + ///// OQS_TEMPLATE_FRAGMENT_KEYMGMT_FUNCTIONS_END + {NULL, NULL, NULL}}; static const OSSL_ALGORITHM oqsprovider_encoder[] = { #define ENCODER_PROVIDER "oqsprovider" @@ -989,8 +988,7 @@ static const OSSL_ALGORITHM oqsprovider_decoder[] = { }; // get the last number on the composite OID -int get_composite_idx(int idx) -{ +int get_composite_idx(int idx) { char *s; int i, len, ret = -1, count = 0; @@ -1014,25 +1012,23 @@ int get_composite_idx(int idx) return ret; } -static const OSSL_PARAM *oqsprovider_gettable_params(void *provctx) -{ +static const OSSL_PARAM *oqsprovider_gettable_params(void *provctx) { return oqsprovider_param_types; } -#define OQS_PROVIDER_BASE_BUILD_INFO_STR \ - "OQS Provider v." OQS_PROVIDER_VERSION_STR OQS_PROVIDER_COMMIT \ +#define OQS_PROVIDER_BASE_BUILD_INFO_STR \ + "OQS Provider v." OQS_PROVIDER_VERSION_STR OQS_PROVIDER_COMMIT \ " based on liboqs v." OQS_VERSION_TEXT #ifdef QSC_ENCODING_VERSION_STRING -# define OQS_PROVIDER_BUILD_INFO_STR \ - OQS_PROVIDER_BASE_BUILD_INFO_STR \ - " using qsc-key-encoder v." QSC_ENCODING_VERSION_STRING +#define OQS_PROVIDER_BUILD_INFO_STR \ + OQS_PROVIDER_BASE_BUILD_INFO_STR \ + " using qsc-key-encoder v." QSC_ENCODING_VERSION_STRING #else -# define OQS_PROVIDER_BUILD_INFO_STR OQS_PROVIDER_BASE_BUILD_INFO_STR +#define OQS_PROVIDER_BUILD_INFO_STR OQS_PROVIDER_BASE_BUILD_INFO_STR #endif -static int oqsprovider_get_params(void *provctx, OSSL_PARAM params[]) -{ +static int oqsprovider_get_params(void *provctx, OSSL_PARAM params[]) { OSSL_PARAM *p; p = OSSL_PARAM_locate(params, OSSL_PROV_PARAM_NAME); @@ -1052,8 +1048,7 @@ static int oqsprovider_get_params(void *provctx, OSSL_PARAM params[]) } static const OSSL_ALGORITHM *oqsprovider_query(void *provctx, int operation_id, - int *no_cache) -{ + int *no_cache) { *no_cache = 0; switch (operation_id) { @@ -1075,33 +1070,31 @@ static const OSSL_ALGORITHM *oqsprovider_query(void *provctx, int operation_id, return NULL; } -static void oqsprovider_teardown(void *provctx) -{ +static void oqsprovider_teardown(void *provctx) { oqsx_freeprovctx((PROV_OQS_CTX *)provctx); OQS_destroy(); } /* Functions we provide to the core */ -static const OSSL_DISPATCH oqsprovider_dispatch_table[] - = {{OSSL_FUNC_PROVIDER_TEARDOWN, (void (*)(void))oqsprovider_teardown}, - {OSSL_FUNC_PROVIDER_GETTABLE_PARAMS, - (void (*)(void))oqsprovider_gettable_params}, - {OSSL_FUNC_PROVIDER_GET_PARAMS, (void (*)(void))oqsprovider_get_params}, - {OSSL_FUNC_PROVIDER_QUERY_OPERATION, (void (*)(void))oqsprovider_query}, - {OSSL_FUNC_PROVIDER_GET_CAPABILITIES, - (void (*)(void))oqs_provider_get_capabilities}, - {0, NULL}}; +static const OSSL_DISPATCH oqsprovider_dispatch_table[] = { + {OSSL_FUNC_PROVIDER_TEARDOWN, (void (*)(void))oqsprovider_teardown}, + {OSSL_FUNC_PROVIDER_GETTABLE_PARAMS, + (void (*)(void))oqsprovider_gettable_params}, + {OSSL_FUNC_PROVIDER_GET_PARAMS, (void (*)(void))oqsprovider_get_params}, + {OSSL_FUNC_PROVIDER_QUERY_OPERATION, (void (*)(void))oqsprovider_query}, + {OSSL_FUNC_PROVIDER_GET_CAPABILITIES, + (void (*)(void))oqs_provider_get_capabilities}, + {0, NULL}}; #ifdef OQS_PROVIDER_STATIC -# define OQS_PROVIDER_ENTRYPOINT_NAME oqs_provider_init +#define OQS_PROVIDER_ENTRYPOINT_NAME oqs_provider_init #else -# define OQS_PROVIDER_ENTRYPOINT_NAME OSSL_provider_init +#define OQS_PROVIDER_ENTRYPOINT_NAME OSSL_provider_init #endif // ifdef OQS_PROVIDER_STATIC int OQS_PROVIDER_ENTRYPOINT_NAME(const OSSL_CORE_HANDLE *handle, const OSSL_DISPATCH *in, - const OSSL_DISPATCH **out, void **provctx) -{ + const OSSL_DISPATCH **out, void **provctx) { const OSSL_DISPATCH *orig_in = in; OSSL_FUNC_core_obj_create_fn *c_obj_create = NULL; @@ -1198,7 +1191,8 @@ int OQS_PROVIDER_ENTRYPOINT_NAME(const OSSL_CORE_HANDLE *handle, oqs_oid_alg_list[i + 1], OBJ_sn2nid(oqs_oid_alg_list[i + 1])); } else { fprintf(stderr, - "OQS PROV: Impossible error: NID unregistered for %s.\n", + "OQS PROV: Impossible error: NID unregistered " + "for %s.\n", oqs_oid_alg_list[i + 1]); ERR_raise(ERR_LIB_USER, OQSPROV_R_OBJ_CREATE_ERR); goto end_init; @@ -1206,10 +1200,9 @@ int OQS_PROVIDER_ENTRYPOINT_NAME(const OSSL_CORE_HANDLE *handle, } // if libctx not yet existing, create a new one - if (((corebiometh = oqs_bio_prov_init_bio_method()) == NULL) - || ((libctx = OSSL_LIB_CTX_new_child(handle, orig_in)) == NULL) - || ((*provctx = oqsx_newprovctx(libctx, handle, corebiometh)) - == NULL)) { + if (((corebiometh = oqs_bio_prov_init_bio_method()) == NULL) || + ((libctx = OSSL_LIB_CTX_new_child(handle, orig_in)) == NULL) || + ((*provctx = oqsx_newprovctx(libctx, handle, corebiometh)) == NULL)) { OQS_PROV_PRINTF("OQS PROV: error creating new provider context\n"); ERR_raise(ERR_LIB_USER, OQSPROV_R_LIB_CREATE_ERR); goto end_init; @@ -1218,10 +1211,11 @@ int OQS_PROVIDER_ENTRYPOINT_NAME(const OSSL_CORE_HANDLE *handle, *out = oqsprovider_dispatch_table; // finally, warn if neither default nor fips provider are present: - if (!OSSL_PROVIDER_available(libctx, "default") - && !OSSL_PROVIDER_available(libctx, "fips")) { + if (!OSSL_PROVIDER_available(libctx, "default") && + !OSSL_PROVIDER_available(libctx, "fips")) { OQS_PROV_PRINTF( - "OQS PROV: Default and FIPS provider not available. Errors may result.\n"); + "OQS PROV: Default and FIPS provider not available. Errors " + "may result.\n"); } else { OQS_PROV_PRINTF("OQS PROV: Default or FIPS provider available.\n"); } diff --git a/oqsprov/oqsprov_bio.c b/oqsprov/oqsprov_bio.c index c40d0461..eca0591a 100644 --- a/oqsprov/oqsprov_bio.c +++ b/oqsprov/oqsprov_bio.c @@ -2,10 +2,11 @@ // Code strongly inspired by OpenSSL common provider bio code -#include "oqs_prov.h" #include #include +#include "oqs_prov.h" + static OSSL_FUNC_BIO_new_file_fn *c_bio_new_file = NULL; static OSSL_FUNC_BIO_new_membuf_fn *c_bio_new_membuf = NULL; static OSSL_FUNC_BIO_read_ex_fn *c_bio_read_ex = NULL; @@ -17,8 +18,7 @@ static OSSL_FUNC_BIO_up_ref_fn *c_bio_up_ref = NULL; static OSSL_FUNC_BIO_free_fn *c_bio_free = NULL; static OSSL_FUNC_BIO_vprintf_fn *c_bio_vprintf = NULL; -int oqs_prov_bio_from_dispatch(const OSSL_DISPATCH *fns) -{ +int oqs_prov_bio_from_dispatch(const OSSL_DISPATCH *fns) { for (; fns->function_id != 0; fns++) { switch (fns->function_id) { case OSSL_FUNC_BIO_NEW_FILE: @@ -67,80 +67,69 @@ int oqs_prov_bio_from_dispatch(const OSSL_DISPATCH *fns) return 1; } -OSSL_CORE_BIO *oqs_prov_bio_new_file(const char *filename, const char *mode) -{ +OSSL_CORE_BIO *oqs_prov_bio_new_file(const char *filename, const char *mode) { if (c_bio_new_file == NULL) return NULL; return c_bio_new_file(filename, mode); } -OSSL_CORE_BIO *oqs_prov_bio_new_membuf(const char *filename, int len) -{ +OSSL_CORE_BIO *oqs_prov_bio_new_membuf(const char *filename, int len) { if (c_bio_new_membuf == NULL) return NULL; return c_bio_new_membuf(filename, len); } int oqs_prov_bio_read_ex(OSSL_CORE_BIO *bio, void *data, size_t data_len, - size_t *bytes_read) -{ + size_t *bytes_read) { if (c_bio_read_ex == NULL) return 0; return c_bio_read_ex(bio, data, data_len, bytes_read); } int oqs_prov_bio_write_ex(OSSL_CORE_BIO *bio, const void *data, size_t data_len, - size_t *written) -{ + size_t *written) { if (c_bio_write_ex == NULL) return 0; return c_bio_write_ex(bio, data, data_len, written); } -int oqs_prov_bio_gets(OSSL_CORE_BIO *bio, char *buf, int size) -{ +int oqs_prov_bio_gets(OSSL_CORE_BIO *bio, char *buf, int size) { if (c_bio_gets == NULL) return -1; return c_bio_gets(bio, buf, size); } -int oqs_prov_bio_puts(OSSL_CORE_BIO *bio, const char *str) -{ +int oqs_prov_bio_puts(OSSL_CORE_BIO *bio, const char *str) { if (c_bio_puts == NULL) return -1; return c_bio_puts(bio, str); } -int oqs_prov_bio_ctrl(OSSL_CORE_BIO *bio, int cmd, long num, void *ptr) -{ +int oqs_prov_bio_ctrl(OSSL_CORE_BIO *bio, int cmd, long num, void *ptr) { if (c_bio_ctrl == NULL) return -1; return c_bio_ctrl(bio, cmd, num, ptr); } -int oqs_prov_bio_up_ref(OSSL_CORE_BIO *bio) -{ +int oqs_prov_bio_up_ref(OSSL_CORE_BIO *bio) { if (c_bio_up_ref == NULL) return 0; return c_bio_up_ref(bio); } -int oqs_prov_bio_free(OSSL_CORE_BIO *bio) -{ +int oqs_prov_bio_free(OSSL_CORE_BIO *bio) { if (c_bio_free == NULL) return 0; return c_bio_free(bio); } -int oqs_prov_bio_vprintf(OSSL_CORE_BIO *bio, const char *format, va_list ap) -{ +int oqs_prov_bio_vprintf(OSSL_CORE_BIO *bio, const char *format, va_list ap) { if (c_bio_vprintf == NULL) return -1; return c_bio_vprintf(bio, format, ap); } -int oqs_prov_bio_printf(OSSL_CORE_BIO *bio, const char *format, ...) -{ +int oqs_prov_bio_printf(OSSL_CORE_BIO *bio, const char *format, ...) { va_list ap; int ret; @@ -156,60 +145,52 @@ int oqs_prov_bio_printf(OSSL_CORE_BIO *bio, const char *format, ...) /* No direct BIO support in the FIPS module */ static int bio_core_read_ex(BIO *bio, char *data, size_t data_len, - size_t *bytes_read) -{ + size_t *bytes_read) { return oqs_prov_bio_read_ex(BIO_get_data(bio), data, data_len, bytes_read); } static int bio_core_write_ex(BIO *bio, const char *data, size_t data_len, - size_t *written) -{ + size_t *written) { return oqs_prov_bio_write_ex(BIO_get_data(bio), data, data_len, written); } -static long bio_core_ctrl(BIO *bio, int cmd, long num, void *ptr) -{ +static long bio_core_ctrl(BIO *bio, int cmd, long num, void *ptr) { return oqs_prov_bio_ctrl(BIO_get_data(bio), cmd, num, ptr); } -static int bio_core_gets(BIO *bio, char *buf, int size) -{ +static int bio_core_gets(BIO *bio, char *buf, int size) { return oqs_prov_bio_gets(BIO_get_data(bio), buf, size); } -static int bio_core_puts(BIO *bio, const char *str) -{ +static int bio_core_puts(BIO *bio, const char *str) { return oqs_prov_bio_puts(BIO_get_data(bio), str); } -static int bio_core_new(BIO *bio) -{ +static int bio_core_new(BIO *bio) { BIO_set_init(bio, 1); return 1; } -static int bio_core_free(BIO *bio) -{ +static int bio_core_free(BIO *bio) { BIO_set_init(bio, 0); oqs_prov_bio_free(BIO_get_data(bio)); return 1; } -BIO_METHOD *oqs_bio_prov_init_bio_method(void) -{ +BIO_METHOD *oqs_bio_prov_init_bio_method(void) { BIO_METHOD *corebiometh = NULL; corebiometh = BIO_meth_new(BIO_TYPE_CORE_TO_PROV, "BIO to Core filter"); - if (corebiometh == NULL - || !BIO_meth_set_write_ex(corebiometh, bio_core_write_ex) - || !BIO_meth_set_read_ex(corebiometh, bio_core_read_ex) - || !BIO_meth_set_puts(corebiometh, bio_core_puts) - || !BIO_meth_set_gets(corebiometh, bio_core_gets) - || !BIO_meth_set_ctrl(corebiometh, bio_core_ctrl) - || !BIO_meth_set_create(corebiometh, bio_core_new) - || !BIO_meth_set_destroy(corebiometh, bio_core_free)) { + if (corebiometh == NULL || + !BIO_meth_set_write_ex(corebiometh, bio_core_write_ex) || + !BIO_meth_set_read_ex(corebiometh, bio_core_read_ex) || + !BIO_meth_set_puts(corebiometh, bio_core_puts) || + !BIO_meth_set_gets(corebiometh, bio_core_gets) || + !BIO_meth_set_ctrl(corebiometh, bio_core_ctrl) || + !BIO_meth_set_create(corebiometh, bio_core_new) || + !BIO_meth_set_destroy(corebiometh, bio_core_free)) { BIO_meth_free(corebiometh); return NULL; } @@ -217,8 +198,7 @@ BIO_METHOD *oqs_bio_prov_init_bio_method(void) return corebiometh; } -BIO *oqs_bio_new_from_core_bio(PROV_OQS_CTX *provctx, OSSL_CORE_BIO *corebio) -{ +BIO *oqs_bio_new_from_core_bio(PROV_OQS_CTX *provctx, OSSL_CORE_BIO *corebio) { BIO *outbio; BIO_METHOD *corebiometh = provctx->corebiometh; diff --git a/oqsprov/oqsprov_capabilities.c b/oqsprov/oqsprov_capabilities.c index 59470a6e..f3e3ea70 100644 --- a/oqsprov/oqsprov_capabilities.c +++ b/oqsprov/oqsprov_capabilities.c @@ -110,29 +110,29 @@ static OQS_GROUP_CONSTANTS oqs_group_list[] = { }; // Adds entries for tlsname, `ecx`_tlsname and `ecp`_tlsname -#define OQS_GROUP_ENTRY(tlsname, realname, algorithm, idx) \ - { \ - OSSL_PARAM_utf8_string(OSSL_CAPABILITY_TLS_GROUP_NAME, #tlsname, \ - sizeof(#tlsname)), \ - OSSL_PARAM_utf8_string(OSSL_CAPABILITY_TLS_GROUP_NAME_INTERNAL, \ - #realname, sizeof(#realname)), \ - OSSL_PARAM_utf8_string(OSSL_CAPABILITY_TLS_GROUP_ALG, #algorithm, \ - sizeof(#algorithm)), \ - OSSL_PARAM_uint(OSSL_CAPABILITY_TLS_GROUP_ID, \ - (unsigned int *)&oqs_group_list[idx].group_id), \ - OSSL_PARAM_uint(OSSL_CAPABILITY_TLS_GROUP_SECURITY_BITS, \ - (unsigned int *)&oqs_group_list[idx].secbits), \ - OSSL_PARAM_int(OSSL_CAPABILITY_TLS_GROUP_MIN_TLS, \ - (unsigned int *)&oqs_group_list[idx].mintls), \ - OSSL_PARAM_int(OSSL_CAPABILITY_TLS_GROUP_MAX_TLS, \ - (unsigned int *)&oqs_group_list[idx].maxtls), \ - OSSL_PARAM_int(OSSL_CAPABILITY_TLS_GROUP_MIN_DTLS, \ - (unsigned int *)&oqs_group_list[idx].mindtls), \ - OSSL_PARAM_int(OSSL_CAPABILITY_TLS_GROUP_MAX_DTLS, \ - (unsigned int *)&oqs_group_list[idx].maxdtls), \ - OSSL_PARAM_int(OSSL_CAPABILITY_TLS_GROUP_IS_KEM, \ - (unsigned int *)&oqs_group_list[idx].is_kem), \ - OSSL_PARAM_END \ +#define OQS_GROUP_ENTRY(tlsname, realname, algorithm, idx) \ + { \ + OSSL_PARAM_utf8_string(OSSL_CAPABILITY_TLS_GROUP_NAME, #tlsname, \ + sizeof(#tlsname)), \ + OSSL_PARAM_utf8_string(OSSL_CAPABILITY_TLS_GROUP_NAME_INTERNAL, \ + #realname, sizeof(#realname)), \ + OSSL_PARAM_utf8_string(OSSL_CAPABILITY_TLS_GROUP_ALG, #algorithm, \ + sizeof(#algorithm)), \ + OSSL_PARAM_uint(OSSL_CAPABILITY_TLS_GROUP_ID, \ + (unsigned int *)&oqs_group_list[idx].group_id), \ + OSSL_PARAM_uint(OSSL_CAPABILITY_TLS_GROUP_SECURITY_BITS, \ + (unsigned int *)&oqs_group_list[idx].secbits), \ + OSSL_PARAM_int(OSSL_CAPABILITY_TLS_GROUP_MIN_TLS, \ + (unsigned int *)&oqs_group_list[idx].mintls), \ + OSSL_PARAM_int(OSSL_CAPABILITY_TLS_GROUP_MAX_TLS, \ + (unsigned int *)&oqs_group_list[idx].maxtls), \ + OSSL_PARAM_int(OSSL_CAPABILITY_TLS_GROUP_MIN_DTLS, \ + (unsigned int *)&oqs_group_list[idx].mindtls), \ + OSSL_PARAM_int(OSSL_CAPABILITY_TLS_GROUP_MAX_DTLS, \ + (unsigned int *)&oqs_group_list[idx].maxdtls), \ + OSSL_PARAM_int(OSSL_CAPABILITY_TLS_GROUP_IS_KEM, \ + (unsigned int *)&oqs_group_list[idx].is_kem), \ + OSSL_PARAM_END \ } static const OSSL_PARAM oqs_param_group_list[][11] = { @@ -296,120 +296,118 @@ static OQS_SIGALG_CONSTANTS oqs_sigalg_list[] = { ///// OQS_TEMPLATE_FRAGMENT_SIGALG_ASSIGNMENTS_END }; -int oqs_patch_codepoints() -{ - +int oqs_patch_codepoints() { ///// OQS_TEMPLATE_FRAGMENT_CODEPOINT_PATCHING_START if (getenv("OQS_CODEPOINT_FRODO640AES")) oqs_group_list[0].group_id = atoi(getenv("OQS_CODEPOINT_FRODO640AES")); if (getenv("OQS_CODEPOINT_P256_FRODO640AES")) - oqs_group_list[1].group_id - = atoi(getenv("OQS_CODEPOINT_P256_FRODO640AES")); + oqs_group_list[1].group_id = + atoi(getenv("OQS_CODEPOINT_P256_FRODO640AES")); if (getenv("OQS_CODEPOINT_X25519_FRODO640AES")) - oqs_group_list[2].group_id - = atoi(getenv("OQS_CODEPOINT_X25519_FRODO640AES")); + oqs_group_list[2].group_id = + atoi(getenv("OQS_CODEPOINT_X25519_FRODO640AES")); if (getenv("OQS_CODEPOINT_FRODO640SHAKE")) - oqs_group_list[3].group_id - = atoi(getenv("OQS_CODEPOINT_FRODO640SHAKE")); + oqs_group_list[3].group_id = + atoi(getenv("OQS_CODEPOINT_FRODO640SHAKE")); if (getenv("OQS_CODEPOINT_P256_FRODO640SHAKE")) - oqs_group_list[4].group_id - = atoi(getenv("OQS_CODEPOINT_P256_FRODO640SHAKE")); + oqs_group_list[4].group_id = + atoi(getenv("OQS_CODEPOINT_P256_FRODO640SHAKE")); if (getenv("OQS_CODEPOINT_X25519_FRODO640SHAKE")) - oqs_group_list[5].group_id - = atoi(getenv("OQS_CODEPOINT_X25519_FRODO640SHAKE")); + oqs_group_list[5].group_id = + atoi(getenv("OQS_CODEPOINT_X25519_FRODO640SHAKE")); if (getenv("OQS_CODEPOINT_FRODO976AES")) oqs_group_list[6].group_id = atoi(getenv("OQS_CODEPOINT_FRODO976AES")); if (getenv("OQS_CODEPOINT_P384_FRODO976AES")) - oqs_group_list[7].group_id - = atoi(getenv("OQS_CODEPOINT_P384_FRODO976AES")); + oqs_group_list[7].group_id = + atoi(getenv("OQS_CODEPOINT_P384_FRODO976AES")); if (getenv("OQS_CODEPOINT_X448_FRODO976AES")) - oqs_group_list[8].group_id - = atoi(getenv("OQS_CODEPOINT_X448_FRODO976AES")); + oqs_group_list[8].group_id = + atoi(getenv("OQS_CODEPOINT_X448_FRODO976AES")); if (getenv("OQS_CODEPOINT_FRODO976SHAKE")) - oqs_group_list[9].group_id - = atoi(getenv("OQS_CODEPOINT_FRODO976SHAKE")); + oqs_group_list[9].group_id = + atoi(getenv("OQS_CODEPOINT_FRODO976SHAKE")); if (getenv("OQS_CODEPOINT_P384_FRODO976SHAKE")) - oqs_group_list[10].group_id - = atoi(getenv("OQS_CODEPOINT_P384_FRODO976SHAKE")); + oqs_group_list[10].group_id = + atoi(getenv("OQS_CODEPOINT_P384_FRODO976SHAKE")); if (getenv("OQS_CODEPOINT_X448_FRODO976SHAKE")) - oqs_group_list[11].group_id - = atoi(getenv("OQS_CODEPOINT_X448_FRODO976SHAKE")); + oqs_group_list[11].group_id = + atoi(getenv("OQS_CODEPOINT_X448_FRODO976SHAKE")); if (getenv("OQS_CODEPOINT_FRODO1344AES")) - oqs_group_list[12].group_id - = atoi(getenv("OQS_CODEPOINT_FRODO1344AES")); + oqs_group_list[12].group_id = + atoi(getenv("OQS_CODEPOINT_FRODO1344AES")); if (getenv("OQS_CODEPOINT_P521_FRODO1344AES")) - oqs_group_list[13].group_id - = atoi(getenv("OQS_CODEPOINT_P521_FRODO1344AES")); + oqs_group_list[13].group_id = + atoi(getenv("OQS_CODEPOINT_P521_FRODO1344AES")); if (getenv("OQS_CODEPOINT_FRODO1344SHAKE")) - oqs_group_list[14].group_id - = atoi(getenv("OQS_CODEPOINT_FRODO1344SHAKE")); + oqs_group_list[14].group_id = + atoi(getenv("OQS_CODEPOINT_FRODO1344SHAKE")); if (getenv("OQS_CODEPOINT_P521_FRODO1344SHAKE")) - oqs_group_list[15].group_id - = atoi(getenv("OQS_CODEPOINT_P521_FRODO1344SHAKE")); + oqs_group_list[15].group_id = + atoi(getenv("OQS_CODEPOINT_P521_FRODO1344SHAKE")); if (getenv("OQS_CODEPOINT_KYBER512")) oqs_group_list[16].group_id = atoi(getenv("OQS_CODEPOINT_KYBER512")); if (getenv("OQS_CODEPOINT_P256_KYBER512")) - oqs_group_list[17].group_id - = atoi(getenv("OQS_CODEPOINT_P256_KYBER512")); + oqs_group_list[17].group_id = + atoi(getenv("OQS_CODEPOINT_P256_KYBER512")); if (getenv("OQS_CODEPOINT_X25519_KYBER512")) - oqs_group_list[18].group_id - = atoi(getenv("OQS_CODEPOINT_X25519_KYBER512")); + oqs_group_list[18].group_id = + atoi(getenv("OQS_CODEPOINT_X25519_KYBER512")); if (getenv("OQS_CODEPOINT_KYBER768")) oqs_group_list[19].group_id = atoi(getenv("OQS_CODEPOINT_KYBER768")); if (getenv("OQS_CODEPOINT_P384_KYBER768")) - oqs_group_list[20].group_id - = atoi(getenv("OQS_CODEPOINT_P384_KYBER768")); + oqs_group_list[20].group_id = + atoi(getenv("OQS_CODEPOINT_P384_KYBER768")); if (getenv("OQS_CODEPOINT_X448_KYBER768")) - oqs_group_list[21].group_id - = atoi(getenv("OQS_CODEPOINT_X448_KYBER768")); + oqs_group_list[21].group_id = + atoi(getenv("OQS_CODEPOINT_X448_KYBER768")); if (getenv("OQS_CODEPOINT_X25519_KYBER768")) - oqs_group_list[22].group_id - = atoi(getenv("OQS_CODEPOINT_X25519_KYBER768")); + oqs_group_list[22].group_id = + atoi(getenv("OQS_CODEPOINT_X25519_KYBER768")); if (getenv("OQS_CODEPOINT_P256_KYBER768")) - oqs_group_list[23].group_id - = atoi(getenv("OQS_CODEPOINT_P256_KYBER768")); + oqs_group_list[23].group_id = + atoi(getenv("OQS_CODEPOINT_P256_KYBER768")); if (getenv("OQS_CODEPOINT_KYBER1024")) oqs_group_list[24].group_id = atoi(getenv("OQS_CODEPOINT_KYBER1024")); if (getenv("OQS_CODEPOINT_P521_KYBER1024")) - oqs_group_list[25].group_id - = atoi(getenv("OQS_CODEPOINT_P521_KYBER1024")); + oqs_group_list[25].group_id = + atoi(getenv("OQS_CODEPOINT_P521_KYBER1024")); if (getenv("OQS_CODEPOINT_MLKEM512")) oqs_group_list[26].group_id = atoi(getenv("OQS_CODEPOINT_MLKEM512")); if (getenv("OQS_CODEPOINT_P256_MLKEM512")) - oqs_group_list[27].group_id - = atoi(getenv("OQS_CODEPOINT_P256_MLKEM512")); + oqs_group_list[27].group_id = + atoi(getenv("OQS_CODEPOINT_P256_MLKEM512")); if (getenv("OQS_CODEPOINT_X25519_MLKEM512")) - oqs_group_list[28].group_id - = atoi(getenv("OQS_CODEPOINT_X25519_MLKEM512")); + oqs_group_list[28].group_id = + atoi(getenv("OQS_CODEPOINT_X25519_MLKEM512")); if (getenv("OQS_CODEPOINT_MLKEM768")) oqs_group_list[29].group_id = atoi(getenv("OQS_CODEPOINT_MLKEM768")); if (getenv("OQS_CODEPOINT_P384_MLKEM768")) - oqs_group_list[30].group_id - = atoi(getenv("OQS_CODEPOINT_P384_MLKEM768")); + oqs_group_list[30].group_id = + atoi(getenv("OQS_CODEPOINT_P384_MLKEM768")); if (getenv("OQS_CODEPOINT_X448_MLKEM768")) - oqs_group_list[31].group_id - = atoi(getenv("OQS_CODEPOINT_X448_MLKEM768")); + oqs_group_list[31].group_id = + atoi(getenv("OQS_CODEPOINT_X448_MLKEM768")); if (getenv("OQS_CODEPOINT_X25519_MLKEM768")) - oqs_group_list[32].group_id - = atoi(getenv("OQS_CODEPOINT_X25519_MLKEM768")); + oqs_group_list[32].group_id = + atoi(getenv("OQS_CODEPOINT_X25519_MLKEM768")); if (getenv("OQS_CODEPOINT_P256_MLKEM768")) - oqs_group_list[33].group_id - = atoi(getenv("OQS_CODEPOINT_P256_MLKEM768")); + oqs_group_list[33].group_id = + atoi(getenv("OQS_CODEPOINT_P256_MLKEM768")); if (getenv("OQS_CODEPOINT_MLKEM1024")) oqs_group_list[34].group_id = atoi(getenv("OQS_CODEPOINT_MLKEM1024")); if (getenv("OQS_CODEPOINT_P521_MLKEM1024")) - oqs_group_list[35].group_id - = atoi(getenv("OQS_CODEPOINT_P521_MLKEM1024")); + oqs_group_list[35].group_id = + atoi(getenv("OQS_CODEPOINT_P521_MLKEM1024")); if (getenv("OQS_CODEPOINT_P384_MLKEM1024")) - oqs_group_list[36].group_id - = atoi(getenv("OQS_CODEPOINT_P384_MLKEM1024")); + oqs_group_list[36].group_id = + atoi(getenv("OQS_CODEPOINT_P384_MLKEM1024")); if (getenv("OQS_CODEPOINT_BIKEL1")) oqs_group_list[37].group_id = atoi(getenv("OQS_CODEPOINT_BIKEL1")); if (getenv("OQS_CODEPOINT_P256_BIKEL1")) oqs_group_list[38].group_id = atoi(getenv("OQS_CODEPOINT_P256_BIKEL1")); if (getenv("OQS_CODEPOINT_X25519_BIKEL1")) - oqs_group_list[39].group_id - = atoi(getenv("OQS_CODEPOINT_X25519_BIKEL1")); + oqs_group_list[39].group_id = + atoi(getenv("OQS_CODEPOINT_X25519_BIKEL1")); if (getenv("OQS_CODEPOINT_BIKEL3")) oqs_group_list[40].group_id = atoi(getenv("OQS_CODEPOINT_BIKEL3")); if (getenv("OQS_CODEPOINT_P384_BIKEL3")) @@ -425,8 +423,8 @@ int oqs_patch_codepoints() if (getenv("OQS_CODEPOINT_P256_HQC128")) oqs_group_list[46].group_id = atoi(getenv("OQS_CODEPOINT_P256_HQC128")); if (getenv("OQS_CODEPOINT_X25519_HQC128")) - oqs_group_list[47].group_id - = atoi(getenv("OQS_CODEPOINT_X25519_HQC128")); + oqs_group_list[47].group_id = + atoi(getenv("OQS_CODEPOINT_X25519_HQC128")); if (getenv("OQS_CODEPOINT_HQC192")) oqs_group_list[48].group_id = atoi(getenv("OQS_CODEPOINT_HQC192")); if (getenv("OQS_CODEPOINT_P384_HQC192")) @@ -439,172 +437,171 @@ int oqs_patch_codepoints() oqs_group_list[52].group_id = atoi(getenv("OQS_CODEPOINT_P521_HQC256")); if (getenv("OQS_CODEPOINT_DILITHIUM2")) - oqs_sigalg_list[0].code_point - = atoi(getenv("OQS_CODEPOINT_DILITHIUM2")); + oqs_sigalg_list[0].code_point = + atoi(getenv("OQS_CODEPOINT_DILITHIUM2")); if (getenv("OQS_CODEPOINT_P256_DILITHIUM2")) - oqs_sigalg_list[1].code_point - = atoi(getenv("OQS_CODEPOINT_P256_DILITHIUM2")); + oqs_sigalg_list[1].code_point = + atoi(getenv("OQS_CODEPOINT_P256_DILITHIUM2")); if (getenv("OQS_CODEPOINT_RSA3072_DILITHIUM2")) - oqs_sigalg_list[2].code_point - = atoi(getenv("OQS_CODEPOINT_RSA3072_DILITHIUM2")); + oqs_sigalg_list[2].code_point = + atoi(getenv("OQS_CODEPOINT_RSA3072_DILITHIUM2")); if (getenv("OQS_CODEPOINT_DILITHIUM3")) - oqs_sigalg_list[3].code_point - = atoi(getenv("OQS_CODEPOINT_DILITHIUM3")); + oqs_sigalg_list[3].code_point = + atoi(getenv("OQS_CODEPOINT_DILITHIUM3")); if (getenv("OQS_CODEPOINT_P384_DILITHIUM3")) - oqs_sigalg_list[4].code_point - = atoi(getenv("OQS_CODEPOINT_P384_DILITHIUM3")); + oqs_sigalg_list[4].code_point = + atoi(getenv("OQS_CODEPOINT_P384_DILITHIUM3")); if (getenv("OQS_CODEPOINT_DILITHIUM5")) - oqs_sigalg_list[5].code_point - = atoi(getenv("OQS_CODEPOINT_DILITHIUM5")); + oqs_sigalg_list[5].code_point = + atoi(getenv("OQS_CODEPOINT_DILITHIUM5")); if (getenv("OQS_CODEPOINT_P521_DILITHIUM5")) - oqs_sigalg_list[6].code_point - = atoi(getenv("OQS_CODEPOINT_P521_DILITHIUM5")); + oqs_sigalg_list[6].code_point = + atoi(getenv("OQS_CODEPOINT_P521_DILITHIUM5")); if (getenv("OQS_CODEPOINT_MLDSA44")) oqs_sigalg_list[7].code_point = atoi(getenv("OQS_CODEPOINT_MLDSA44")); if (getenv("OQS_CODEPOINT_P256_MLDSA44")) - oqs_sigalg_list[8].code_point - = atoi(getenv("OQS_CODEPOINT_P256_MLDSA44")); + oqs_sigalg_list[8].code_point = + atoi(getenv("OQS_CODEPOINT_P256_MLDSA44")); if (getenv("OQS_CODEPOINT_RSA3072_MLDSA44")) - oqs_sigalg_list[9].code_point - = atoi(getenv("OQS_CODEPOINT_RSA3072_MLDSA44")); + oqs_sigalg_list[9].code_point = + atoi(getenv("OQS_CODEPOINT_RSA3072_MLDSA44")); if (getenv("OQS_CODEPOINT_MLDSA44_PSS2048")) - oqs_sigalg_list[10].code_point - = atoi(getenv("OQS_CODEPOINT_MLDSA44_PSS2048")); + oqs_sigalg_list[10].code_point = + atoi(getenv("OQS_CODEPOINT_MLDSA44_PSS2048")); if (getenv("OQS_CODEPOINT_MLDSA44_RSA2048")) - oqs_sigalg_list[11].code_point - = atoi(getenv("OQS_CODEPOINT_MLDSA44_RSA2048")); + oqs_sigalg_list[11].code_point = + atoi(getenv("OQS_CODEPOINT_MLDSA44_RSA2048")); if (getenv("OQS_CODEPOINT_MLDSA44_ED25519")) - oqs_sigalg_list[12].code_point - = atoi(getenv("OQS_CODEPOINT_MLDSA44_ED25519")); + oqs_sigalg_list[12].code_point = + atoi(getenv("OQS_CODEPOINT_MLDSA44_ED25519")); if (getenv("OQS_CODEPOINT_MLDSA44_P256")) - oqs_sigalg_list[13].code_point - = atoi(getenv("OQS_CODEPOINT_MLDSA44_P256")); + oqs_sigalg_list[13].code_point = + atoi(getenv("OQS_CODEPOINT_MLDSA44_P256")); if (getenv("OQS_CODEPOINT_MLDSA44_BP256")) - oqs_sigalg_list[14].code_point - = atoi(getenv("OQS_CODEPOINT_MLDSA44_BP256")); + oqs_sigalg_list[14].code_point = + atoi(getenv("OQS_CODEPOINT_MLDSA44_BP256")); if (getenv("OQS_CODEPOINT_MLDSA65")) oqs_sigalg_list[15].code_point = atoi(getenv("OQS_CODEPOINT_MLDSA65")); if (getenv("OQS_CODEPOINT_P384_MLDSA65")) - oqs_sigalg_list[16].code_point - = atoi(getenv("OQS_CODEPOINT_P384_MLDSA65")); + oqs_sigalg_list[16].code_point = + atoi(getenv("OQS_CODEPOINT_P384_MLDSA65")); if (getenv("OQS_CODEPOINT_MLDSA65_PSS3072")) - oqs_sigalg_list[17].code_point - = atoi(getenv("OQS_CODEPOINT_MLDSA65_PSS3072")); + oqs_sigalg_list[17].code_point = + atoi(getenv("OQS_CODEPOINT_MLDSA65_PSS3072")); if (getenv("OQS_CODEPOINT_MLDSA65_RSA3072")) - oqs_sigalg_list[18].code_point - = atoi(getenv("OQS_CODEPOINT_MLDSA65_RSA3072")); + oqs_sigalg_list[18].code_point = + atoi(getenv("OQS_CODEPOINT_MLDSA65_RSA3072")); if (getenv("OQS_CODEPOINT_MLDSA65_P256")) - oqs_sigalg_list[19].code_point - = atoi(getenv("OQS_CODEPOINT_MLDSA65_P256")); + oqs_sigalg_list[19].code_point = + atoi(getenv("OQS_CODEPOINT_MLDSA65_P256")); if (getenv("OQS_CODEPOINT_MLDSA65_BP256")) - oqs_sigalg_list[20].code_point - = atoi(getenv("OQS_CODEPOINT_MLDSA65_BP256")); + oqs_sigalg_list[20].code_point = + atoi(getenv("OQS_CODEPOINT_MLDSA65_BP256")); if (getenv("OQS_CODEPOINT_MLDSA65_ED25519")) - oqs_sigalg_list[21].code_point - = atoi(getenv("OQS_CODEPOINT_MLDSA65_ED25519")); + oqs_sigalg_list[21].code_point = + atoi(getenv("OQS_CODEPOINT_MLDSA65_ED25519")); if (getenv("OQS_CODEPOINT_MLDSA87")) oqs_sigalg_list[22].code_point = atoi(getenv("OQS_CODEPOINT_MLDSA87")); if (getenv("OQS_CODEPOINT_P521_MLDSA87")) - oqs_sigalg_list[23].code_point - = atoi(getenv("OQS_CODEPOINT_P521_MLDSA87")); + oqs_sigalg_list[23].code_point = + atoi(getenv("OQS_CODEPOINT_P521_MLDSA87")); if (getenv("OQS_CODEPOINT_MLDSA87_P384")) - oqs_sigalg_list[24].code_point - = atoi(getenv("OQS_CODEPOINT_MLDSA87_P384")); + oqs_sigalg_list[24].code_point = + atoi(getenv("OQS_CODEPOINT_MLDSA87_P384")); if (getenv("OQS_CODEPOINT_MLDSA87_BP384")) - oqs_sigalg_list[25].code_point - = atoi(getenv("OQS_CODEPOINT_MLDSA87_BP384")); + oqs_sigalg_list[25].code_point = + atoi(getenv("OQS_CODEPOINT_MLDSA87_BP384")); if (getenv("OQS_CODEPOINT_MLDSA87_ED448")) - oqs_sigalg_list[26].code_point - = atoi(getenv("OQS_CODEPOINT_MLDSA87_ED448")); + oqs_sigalg_list[26].code_point = + atoi(getenv("OQS_CODEPOINT_MLDSA87_ED448")); if (getenv("OQS_CODEPOINT_FALCON512")) - oqs_sigalg_list[27].code_point - = atoi(getenv("OQS_CODEPOINT_FALCON512")); + oqs_sigalg_list[27].code_point = + atoi(getenv("OQS_CODEPOINT_FALCON512")); if (getenv("OQS_CODEPOINT_P256_FALCON512")) - oqs_sigalg_list[28].code_point - = atoi(getenv("OQS_CODEPOINT_P256_FALCON512")); + oqs_sigalg_list[28].code_point = + atoi(getenv("OQS_CODEPOINT_P256_FALCON512")); if (getenv("OQS_CODEPOINT_RSA3072_FALCON512")) - oqs_sigalg_list[29].code_point - = atoi(getenv("OQS_CODEPOINT_RSA3072_FALCON512")); + oqs_sigalg_list[29].code_point = + atoi(getenv("OQS_CODEPOINT_RSA3072_FALCON512")); if (getenv("OQS_CODEPOINT_FALCONPADDED512")) - oqs_sigalg_list[30].code_point - = atoi(getenv("OQS_CODEPOINT_FALCONPADDED512")); + oqs_sigalg_list[30].code_point = + atoi(getenv("OQS_CODEPOINT_FALCONPADDED512")); if (getenv("OQS_CODEPOINT_P256_FALCONPADDED512")) - oqs_sigalg_list[31].code_point - = atoi(getenv("OQS_CODEPOINT_P256_FALCONPADDED512")); + oqs_sigalg_list[31].code_point = + atoi(getenv("OQS_CODEPOINT_P256_FALCONPADDED512")); if (getenv("OQS_CODEPOINT_RSA3072_FALCONPADDED512")) - oqs_sigalg_list[32].code_point - = atoi(getenv("OQS_CODEPOINT_RSA3072_FALCONPADDED512")); + oqs_sigalg_list[32].code_point = + atoi(getenv("OQS_CODEPOINT_RSA3072_FALCONPADDED512")); if (getenv("OQS_CODEPOINT_FALCON1024")) - oqs_sigalg_list[33].code_point - = atoi(getenv("OQS_CODEPOINT_FALCON1024")); + oqs_sigalg_list[33].code_point = + atoi(getenv("OQS_CODEPOINT_FALCON1024")); if (getenv("OQS_CODEPOINT_P521_FALCON1024")) - oqs_sigalg_list[34].code_point - = atoi(getenv("OQS_CODEPOINT_P521_FALCON1024")); + oqs_sigalg_list[34].code_point = + atoi(getenv("OQS_CODEPOINT_P521_FALCON1024")); if (getenv("OQS_CODEPOINT_FALCONPADDED1024")) - oqs_sigalg_list[35].code_point - = atoi(getenv("OQS_CODEPOINT_FALCONPADDED1024")); + oqs_sigalg_list[35].code_point = + atoi(getenv("OQS_CODEPOINT_FALCONPADDED1024")); if (getenv("OQS_CODEPOINT_P521_FALCONPADDED1024")) - oqs_sigalg_list[36].code_point - = atoi(getenv("OQS_CODEPOINT_P521_FALCONPADDED1024")); + oqs_sigalg_list[36].code_point = + atoi(getenv("OQS_CODEPOINT_P521_FALCONPADDED1024")); if (getenv("OQS_CODEPOINT_SPHINCSSHA2128FSIMPLE")) - oqs_sigalg_list[37].code_point - = atoi(getenv("OQS_CODEPOINT_SPHINCSSHA2128FSIMPLE")); + oqs_sigalg_list[37].code_point = + atoi(getenv("OQS_CODEPOINT_SPHINCSSHA2128FSIMPLE")); if (getenv("OQS_CODEPOINT_P256_SPHINCSSHA2128FSIMPLE")) - oqs_sigalg_list[38].code_point - = atoi(getenv("OQS_CODEPOINT_P256_SPHINCSSHA2128FSIMPLE")); + oqs_sigalg_list[38].code_point = + atoi(getenv("OQS_CODEPOINT_P256_SPHINCSSHA2128FSIMPLE")); if (getenv("OQS_CODEPOINT_RSA3072_SPHINCSSHA2128FSIMPLE")) - oqs_sigalg_list[39].code_point - = atoi(getenv("OQS_CODEPOINT_RSA3072_SPHINCSSHA2128FSIMPLE")); + oqs_sigalg_list[39].code_point = + atoi(getenv("OQS_CODEPOINT_RSA3072_SPHINCSSHA2128FSIMPLE")); if (getenv("OQS_CODEPOINT_SPHINCSSHA2128SSIMPLE")) - oqs_sigalg_list[40].code_point - = atoi(getenv("OQS_CODEPOINT_SPHINCSSHA2128SSIMPLE")); + oqs_sigalg_list[40].code_point = + atoi(getenv("OQS_CODEPOINT_SPHINCSSHA2128SSIMPLE")); if (getenv("OQS_CODEPOINT_P256_SPHINCSSHA2128SSIMPLE")) - oqs_sigalg_list[41].code_point - = atoi(getenv("OQS_CODEPOINT_P256_SPHINCSSHA2128SSIMPLE")); + oqs_sigalg_list[41].code_point = + atoi(getenv("OQS_CODEPOINT_P256_SPHINCSSHA2128SSIMPLE")); if (getenv("OQS_CODEPOINT_RSA3072_SPHINCSSHA2128SSIMPLE")) - oqs_sigalg_list[42].code_point - = atoi(getenv("OQS_CODEPOINT_RSA3072_SPHINCSSHA2128SSIMPLE")); + oqs_sigalg_list[42].code_point = + atoi(getenv("OQS_CODEPOINT_RSA3072_SPHINCSSHA2128SSIMPLE")); if (getenv("OQS_CODEPOINT_SPHINCSSHA2192FSIMPLE")) - oqs_sigalg_list[43].code_point - = atoi(getenv("OQS_CODEPOINT_SPHINCSSHA2192FSIMPLE")); + oqs_sigalg_list[43].code_point = + atoi(getenv("OQS_CODEPOINT_SPHINCSSHA2192FSIMPLE")); if (getenv("OQS_CODEPOINT_P384_SPHINCSSHA2192FSIMPLE")) - oqs_sigalg_list[44].code_point - = atoi(getenv("OQS_CODEPOINT_P384_SPHINCSSHA2192FSIMPLE")); + oqs_sigalg_list[44].code_point = + atoi(getenv("OQS_CODEPOINT_P384_SPHINCSSHA2192FSIMPLE")); if (getenv("OQS_CODEPOINT_SPHINCSSHAKE128FSIMPLE")) - oqs_sigalg_list[45].code_point - = atoi(getenv("OQS_CODEPOINT_SPHINCSSHAKE128FSIMPLE")); + oqs_sigalg_list[45].code_point = + atoi(getenv("OQS_CODEPOINT_SPHINCSSHAKE128FSIMPLE")); if (getenv("OQS_CODEPOINT_P256_SPHINCSSHAKE128FSIMPLE")) - oqs_sigalg_list[46].code_point - = atoi(getenv("OQS_CODEPOINT_P256_SPHINCSSHAKE128FSIMPLE")); + oqs_sigalg_list[46].code_point = + atoi(getenv("OQS_CODEPOINT_P256_SPHINCSSHAKE128FSIMPLE")); if (getenv("OQS_CODEPOINT_RSA3072_SPHINCSSHAKE128FSIMPLE")) - oqs_sigalg_list[47].code_point - = atoi(getenv("OQS_CODEPOINT_RSA3072_SPHINCSSHAKE128FSIMPLE")); + oqs_sigalg_list[47].code_point = + atoi(getenv("OQS_CODEPOINT_RSA3072_SPHINCSSHAKE128FSIMPLE")); if (getenv("OQS_CODEPOINT_MAYO1")) oqs_sigalg_list[48].code_point = atoi(getenv("OQS_CODEPOINT_MAYO1")); if (getenv("OQS_CODEPOINT_P256_MAYO1")) - oqs_sigalg_list[49].code_point - = atoi(getenv("OQS_CODEPOINT_P256_MAYO1")); + oqs_sigalg_list[49].code_point = + atoi(getenv("OQS_CODEPOINT_P256_MAYO1")); if (getenv("OQS_CODEPOINT_MAYO2")) oqs_sigalg_list[50].code_point = atoi(getenv("OQS_CODEPOINT_MAYO2")); if (getenv("OQS_CODEPOINT_P256_MAYO2")) - oqs_sigalg_list[51].code_point - = atoi(getenv("OQS_CODEPOINT_P256_MAYO2")); + oqs_sigalg_list[51].code_point = + atoi(getenv("OQS_CODEPOINT_P256_MAYO2")); if (getenv("OQS_CODEPOINT_MAYO3")) oqs_sigalg_list[52].code_point = atoi(getenv("OQS_CODEPOINT_MAYO3")); if (getenv("OQS_CODEPOINT_P384_MAYO3")) - oqs_sigalg_list[53].code_point - = atoi(getenv("OQS_CODEPOINT_P384_MAYO3")); + oqs_sigalg_list[53].code_point = + atoi(getenv("OQS_CODEPOINT_P384_MAYO3")); if (getenv("OQS_CODEPOINT_MAYO5")) oqs_sigalg_list[54].code_point = atoi(getenv("OQS_CODEPOINT_MAYO5")); if (getenv("OQS_CODEPOINT_P521_MAYO5")) - oqs_sigalg_list[55].code_point - = atoi(getenv("OQS_CODEPOINT_P521_MAYO5")); + oqs_sigalg_list[55].code_point = + atoi(getenv("OQS_CODEPOINT_P521_MAYO5")); ///// OQS_TEMPLATE_FRAGMENT_CODEPOINT_PATCHING_END return 1; } -static int oqs_group_capability(OSSL_CALLBACK *cb, void *arg) -{ +static int oqs_group_capability(OSSL_CALLBACK *cb, void *arg) { size_t i; for (i = 0; i < OSSL_NELEM(oqs_param_group_list); i++) { @@ -616,50 +613,48 @@ static int oqs_group_capability(OSSL_CALLBACK *cb, void *arg) } #ifdef OSSL_CAPABILITY_TLS_SIGALG_NAME -# define OQS_SIGALG_ENTRY(tlsname, realname, algorithm, oid, idx) \ - { \ - OSSL_PARAM_utf8_string(OSSL_CAPABILITY_TLS_SIGALG_IANA_NAME, \ - #tlsname, sizeof(#tlsname)), \ - OSSL_PARAM_utf8_string(OSSL_CAPABILITY_TLS_SIGALG_NAME, \ - #tlsname, sizeof(#tlsname)), \ - OSSL_PARAM_utf8_string(OSSL_CAPABILITY_TLS_SIGALG_OID, #oid, \ - sizeof(#oid)), \ - OSSL_PARAM_uint( \ - OSSL_CAPABILITY_TLS_SIGALG_CODE_POINT, \ - (unsigned int *)&oqs_sigalg_list[idx].code_point), \ - OSSL_PARAM_uint( \ - OSSL_CAPABILITY_TLS_SIGALG_SECURITY_BITS, \ - (unsigned int *)&oqs_sigalg_list[idx].secbits), \ - OSSL_PARAM_int(OSSL_CAPABILITY_TLS_SIGALG_MIN_TLS, \ - (unsigned int *)&oqs_sigalg_list[idx].mintls), \ - OSSL_PARAM_int(OSSL_CAPABILITY_TLS_SIGALG_MAX_TLS, \ - (unsigned int *)&oqs_sigalg_list[idx].maxtls), \ - OSSL_PARAM_END \ - } +#define OQS_SIGALG_ENTRY(tlsname, realname, algorithm, oid, idx) \ + { \ + OSSL_PARAM_utf8_string(OSSL_CAPABILITY_TLS_SIGALG_IANA_NAME, #tlsname, \ + sizeof(#tlsname)), \ + OSSL_PARAM_utf8_string(OSSL_CAPABILITY_TLS_SIGALG_NAME, #tlsname, \ + sizeof(#tlsname)), \ + OSSL_PARAM_utf8_string(OSSL_CAPABILITY_TLS_SIGALG_OID, #oid, \ + sizeof(#oid)), \ + OSSL_PARAM_uint(OSSL_CAPABILITY_TLS_SIGALG_CODE_POINT, \ + (unsigned int *)&oqs_sigalg_list[idx].code_point), \ + OSSL_PARAM_uint(OSSL_CAPABILITY_TLS_SIGALG_SECURITY_BITS, \ + (unsigned int *)&oqs_sigalg_list[idx].secbits), \ + OSSL_PARAM_int(OSSL_CAPABILITY_TLS_SIGALG_MIN_TLS, \ + (unsigned int *)&oqs_sigalg_list[idx].mintls), \ + OSSL_PARAM_int(OSSL_CAPABILITY_TLS_SIGALG_MAX_TLS, \ + (unsigned int *)&oqs_sigalg_list[idx].maxtls), \ + OSSL_PARAM_END \ + } static const OSSL_PARAM oqs_param_sigalg_list[][12] = { ///// OQS_TEMPLATE_FRAGMENT_SIGALG_NAMES_START -# ifdef OQS_ENABLE_SIG_dilithium_2 +#ifdef OQS_ENABLE_SIG_dilithium_2 OQS_SIGALG_ENTRY(dilithium2, dilithium2, dilithium2, "1.3.6.1.4.1.2.267.7.4.4", 0), OQS_SIGALG_ENTRY(p256_dilithium2, p256_dilithium2, p256_dilithium2, "1.3.9999.2.7.1", 1), OQS_SIGALG_ENTRY(rsa3072_dilithium2, rsa3072_dilithium2, rsa3072_dilithium2, "1.3.9999.2.7.2", 2), -# endif -# ifdef OQS_ENABLE_SIG_dilithium_3 +#endif +#ifdef OQS_ENABLE_SIG_dilithium_3 OQS_SIGALG_ENTRY(dilithium3, dilithium3, dilithium3, "1.3.6.1.4.1.2.267.7.6.5", 3), OQS_SIGALG_ENTRY(p384_dilithium3, p384_dilithium3, p384_dilithium3, "1.3.9999.2.7.3", 4), -# endif -# ifdef OQS_ENABLE_SIG_dilithium_5 +#endif +#ifdef OQS_ENABLE_SIG_dilithium_5 OQS_SIGALG_ENTRY(dilithium5, dilithium5, dilithium5, "1.3.6.1.4.1.2.267.7.8.7", 5), OQS_SIGALG_ENTRY(p521_dilithium5, p521_dilithium5, p521_dilithium5, "1.3.9999.2.7.4", 6), -# endif -# ifdef OQS_ENABLE_SIG_ml_dsa_44 +#endif +#ifdef OQS_ENABLE_SIG_ml_dsa_44 OQS_SIGALG_ENTRY(mldsa44, mldsa44, mldsa44, "1.3.6.1.4.1.2.267.12.4.4", 7), OQS_SIGALG_ENTRY(p256_mldsa44, p256_mldsa44, p256_mldsa44, "1.3.9999.7.1", 8), @@ -675,8 +670,8 @@ static const OSSL_PARAM oqs_param_sigalg_list[][12] = { "2.16.840.1.114027.80.8.1.4", 13), OQS_SIGALG_ENTRY(mldsa44_bp256, mldsa44_bp256, mldsa44_bp256, "2.16.840.1.114027.80.8.1.5", 14), -# endif -# ifdef OQS_ENABLE_SIG_ml_dsa_65 +#endif +#ifdef OQS_ENABLE_SIG_ml_dsa_65 OQS_SIGALG_ENTRY(mldsa65, mldsa65, mldsa65, "1.3.6.1.4.1.2.267.12.6.5", 15), OQS_SIGALG_ENTRY(p384_mldsa65, p384_mldsa65, p384_mldsa65, "1.3.9999.7.3", 16), @@ -690,8 +685,8 @@ static const OSSL_PARAM oqs_param_sigalg_list[][12] = { "2.16.840.1.114027.80.8.1.9", 20), OQS_SIGALG_ENTRY(mldsa65_ed25519, mldsa65_ed25519, mldsa65_ed25519, "2.16.840.1.114027.80.8.1.10", 21), -# endif -# ifdef OQS_ENABLE_SIG_ml_dsa_87 +#endif +#ifdef OQS_ENABLE_SIG_ml_dsa_87 OQS_SIGALG_ENTRY(mldsa87, mldsa87, mldsa87, "1.3.6.1.4.1.2.267.12.8.7", 22), OQS_SIGALG_ENTRY(p521_mldsa87, p521_mldsa87, p521_mldsa87, "1.3.9999.7.4", 23), @@ -701,34 +696,34 @@ static const OSSL_PARAM oqs_param_sigalg_list[][12] = { "2.16.840.1.114027.80.8.1.12", 25), OQS_SIGALG_ENTRY(mldsa87_ed448, mldsa87_ed448, mldsa87_ed448, "2.16.840.1.114027.80.8.1.13", 26), -# endif -# ifdef OQS_ENABLE_SIG_falcon_512 +#endif +#ifdef OQS_ENABLE_SIG_falcon_512 OQS_SIGALG_ENTRY(falcon512, falcon512, falcon512, "1.3.9999.3.11", 27), OQS_SIGALG_ENTRY(p256_falcon512, p256_falcon512, p256_falcon512, "1.3.9999.3.12", 28), OQS_SIGALG_ENTRY(rsa3072_falcon512, rsa3072_falcon512, rsa3072_falcon512, "1.3.9999.3.13", 29), -# endif -# ifdef OQS_ENABLE_SIG_falcon_padded_512 +#endif +#ifdef OQS_ENABLE_SIG_falcon_padded_512 OQS_SIGALG_ENTRY(falconpadded512, falconpadded512, falconpadded512, "1.3.9999.3.16", 30), OQS_SIGALG_ENTRY(p256_falconpadded512, p256_falconpadded512, p256_falconpadded512, "1.3.9999.3.17", 31), OQS_SIGALG_ENTRY(rsa3072_falconpadded512, rsa3072_falconpadded512, rsa3072_falconpadded512, "1.3.9999.3.18", 32), -# endif -# ifdef OQS_ENABLE_SIG_falcon_1024 +#endif +#ifdef OQS_ENABLE_SIG_falcon_1024 OQS_SIGALG_ENTRY(falcon1024, falcon1024, falcon1024, "1.3.9999.3.14", 33), OQS_SIGALG_ENTRY(p521_falcon1024, p521_falcon1024, p521_falcon1024, "1.3.9999.3.15", 34), -# endif -# ifdef OQS_ENABLE_SIG_falcon_padded_1024 +#endif +#ifdef OQS_ENABLE_SIG_falcon_padded_1024 OQS_SIGALG_ENTRY(falconpadded1024, falconpadded1024, falconpadded1024, "1.3.9999.3.19", 35), OQS_SIGALG_ENTRY(p521_falconpadded1024, p521_falconpadded1024, p521_falconpadded1024, "1.3.9999.3.20", 36), -# endif -# ifdef OQS_ENABLE_SIG_sphincs_sha2_128f_simple +#endif +#ifdef OQS_ENABLE_SIG_sphincs_sha2_128f_simple OQS_SIGALG_ENTRY(sphincssha2128fsimple, sphincssha2128fsimple, sphincssha2128fsimple, "1.3.9999.6.4.13", 37), OQS_SIGALG_ENTRY(p256_sphincssha2128fsimple, p256_sphincssha2128fsimple, @@ -736,8 +731,8 @@ static const OSSL_PARAM oqs_param_sigalg_list[][12] = { OQS_SIGALG_ENTRY(rsa3072_sphincssha2128fsimple, rsa3072_sphincssha2128fsimple, rsa3072_sphincssha2128fsimple, "1.3.9999.6.4.15", 39), -# endif -# ifdef OQS_ENABLE_SIG_sphincs_sha2_128s_simple +#endif +#ifdef OQS_ENABLE_SIG_sphincs_sha2_128s_simple OQS_SIGALG_ENTRY(sphincssha2128ssimple, sphincssha2128ssimple, sphincssha2128ssimple, "1.3.9999.6.4.16", 40), OQS_SIGALG_ENTRY(p256_sphincssha2128ssimple, p256_sphincssha2128ssimple, @@ -745,14 +740,14 @@ static const OSSL_PARAM oqs_param_sigalg_list[][12] = { OQS_SIGALG_ENTRY(rsa3072_sphincssha2128ssimple, rsa3072_sphincssha2128ssimple, rsa3072_sphincssha2128ssimple, "1.3.9999.6.4.18", 42), -# endif -# ifdef OQS_ENABLE_SIG_sphincs_sha2_192f_simple +#endif +#ifdef OQS_ENABLE_SIG_sphincs_sha2_192f_simple OQS_SIGALG_ENTRY(sphincssha2192fsimple, sphincssha2192fsimple, sphincssha2192fsimple, "1.3.9999.6.5.10", 43), OQS_SIGALG_ENTRY(p384_sphincssha2192fsimple, p384_sphincssha2192fsimple, p384_sphincssha2192fsimple, "1.3.9999.6.5.11", 44), -# endif -# ifdef OQS_ENABLE_SIG_sphincs_shake_128f_simple +#endif +#ifdef OQS_ENABLE_SIG_sphincs_shake_128f_simple OQS_SIGALG_ENTRY(sphincsshake128fsimple, sphincsshake128fsimple, sphincsshake128fsimple, "1.3.9999.6.7.13", 45), OQS_SIGALG_ENTRY(p256_sphincsshake128fsimple, p256_sphincsshake128fsimple, @@ -760,28 +755,27 @@ static const OSSL_PARAM oqs_param_sigalg_list[][12] = { OQS_SIGALG_ENTRY(rsa3072_sphincsshake128fsimple, rsa3072_sphincsshake128fsimple, rsa3072_sphincsshake128fsimple, "1.3.9999.6.7.15", 47), -# endif -# ifdef OQS_ENABLE_SIG_mayo_1 +#endif +#ifdef OQS_ENABLE_SIG_mayo_1 OQS_SIGALG_ENTRY(mayo1, mayo1, mayo1, "1.3.9999.8.1.1", 48), OQS_SIGALG_ENTRY(p256_mayo1, p256_mayo1, p256_mayo1, "1.3.9999.8.1.2", 49), -# endif -# ifdef OQS_ENABLE_SIG_mayo_2 +#endif +#ifdef OQS_ENABLE_SIG_mayo_2 OQS_SIGALG_ENTRY(mayo2, mayo2, mayo2, "1.3.9999.8.2.1", 50), OQS_SIGALG_ENTRY(p256_mayo2, p256_mayo2, p256_mayo2, "1.3.9999.8.2.2", 51), -# endif -# ifdef OQS_ENABLE_SIG_mayo_3 +#endif +#ifdef OQS_ENABLE_SIG_mayo_3 OQS_SIGALG_ENTRY(mayo3, mayo3, mayo3, "1.3.9999.8.3.1", 52), OQS_SIGALG_ENTRY(p384_mayo3, p384_mayo3, p384_mayo3, "1.3.9999.8.3.2", 53), -# endif -# ifdef OQS_ENABLE_SIG_mayo_5 +#endif +#ifdef OQS_ENABLE_SIG_mayo_5 OQS_SIGALG_ENTRY(mayo5, mayo5, mayo5, "1.3.9999.8.5.1", 54), OQS_SIGALG_ENTRY(p521_mayo5, p521_mayo5, p521_mayo5, "1.3.9999.8.5.2", 55), -# endif +#endif ///// OQS_TEMPLATE_FRAGMENT_SIGALG_NAMES_END }; -static int oqs_sigalg_capability(OSSL_CALLBACK *cb, void *arg) -{ +static int oqs_sigalg_capability(OSSL_CALLBACK *cb, void *arg) { size_t i; // relaxed assertion for the case that not all algorithms are enabled in @@ -797,8 +791,7 @@ static int oqs_sigalg_capability(OSSL_CALLBACK *cb, void *arg) #endif /* OSSL_CAPABILITY_TLS_SIGALG_NAME */ int oqs_provider_get_capabilities(void *provctx, const char *capability, - OSSL_CALLBACK *cb, void *arg) -{ + OSSL_CALLBACK *cb, void *arg) { if (strcasecmp(capability, "TLS-GROUP") == 0) return oqs_group_capability(cb, arg); @@ -806,12 +799,13 @@ int oqs_provider_get_capabilities(void *provctx, const char *capability, if (strcasecmp(capability, "TLS-SIGALG") == 0) return oqs_sigalg_capability(cb, arg); #else -# ifndef NDEBUG - fprintf( - stderr, - "Warning: OSSL_CAPABILITY_TLS_SIGALG_NAME not defined: OpenSSL version used that does not support pluggable signature capabilities.\nUpgrading OpenSSL installation recommended to enable QSC TLS signature support.\n\n"); -# endif /* NDEBUG */ -#endif /* OSSL_CAPABILITY_TLS_SIGALG_NAME */ +#ifndef NDEBUG + fprintf(stderr, "Warning: OSSL_CAPABILITY_TLS_SIGALG_NAME not defined: " + "OpenSSL version used that does not support pluggable " + "signature capabilities.\nUpgrading OpenSSL installation " + "recommended to enable QSC TLS signature support.\n\n"); +#endif /* NDEBUG */ +#endif /* OSSL_CAPABILITY_TLS_SIGALG_NAME */ /* We don't support this capability */ return 0; diff --git a/oqsprov/oqsprov_keys.c b/oqsprov/oqsprov_keys.c index a6dd4b32..26df6739 100644 --- a/oqsprov/oqsprov_keys.c +++ b/oqsprov/oqsprov_keys.c @@ -8,7 +8,6 @@ * */ -#include "oqs_prov.h" #include #include #include @@ -18,27 +17,25 @@ #include #include +#include "oqs_prov.h" + #ifdef NDEBUG -# define OQS_KEY_PRINTF(a) -# define OQS_KEY_PRINTF2(a, b) -# define OQS_KEY_PRINTF3(a, b, c) +#define OQS_KEY_PRINTF(a) +#define OQS_KEY_PRINTF2(a, b) +#define OQS_KEY_PRINTF3(a, b, c) #else -# define OQS_KEY_PRINTF(a) \ - if (getenv("OQSKEY")) \ - printf(a) -# define OQS_KEY_PRINTF2(a, b) \ - if (getenv("OQSKEY")) \ - printf(a, b) -# define OQS_KEY_PRINTF3(a, b, c) \ - if (getenv("OQSKEY")) \ - printf(a, b, c) +#define OQS_KEY_PRINTF(a) \ + if (getenv("OQSKEY")) \ + printf(a) +#define OQS_KEY_PRINTF2(a, b) \ + if (getenv("OQSKEY")) \ + printf(a, b) +#define OQS_KEY_PRINTF3(a, b, c) \ + if (getenv("OQSKEY")) \ + printf(a, b, c) #endif // NDEBUG -typedef enum { - KEY_OP_PUBLIC, - KEY_OP_PRIVATE, - KEY_OP_KEYGEN -} oqsx_key_op_t; +typedef enum { KEY_OP_PUBLIC, KEY_OP_PRIVATE, KEY_OP_KEYGEN } oqsx_key_op_t; /// NID/name table @@ -55,9 +52,9 @@ static int oqsx_key_recreate_classickey(OQSX_KEY *key, oqsx_key_op_t op); ///// OQS_TEMPLATE_FRAGMENT_OQSNAMES_START #ifdef OQS_KEM_ENCODERS -# define NID_TABLE_LEN 109 +#define NID_TABLE_LEN 109 #else -# define NID_TABLE_LEN 56 +#define NID_TABLE_LEN 56 #endif static oqs_nid_name_t nid_names[NID_TABLE_LEN] = { @@ -201,8 +198,7 @@ static oqs_nid_name_t nid_names[NID_TABLE_LEN] = { ///// OQS_TEMPLATE_FRAGMENT_OQSNAMES_END }; -int oqs_set_nid(char *tlsname, int nid) -{ +int oqs_set_nid(char *tlsname, int nid) { int i; for (i = 0; i < NID_TABLE_LEN; i++) { if (!strcmp(nid_names[i].tlsname, tlsname)) { @@ -213,8 +209,7 @@ int oqs_set_nid(char *tlsname, int nid) return 0; } -static int get_secbits(int nid) -{ +static int get_secbits(int nid) { int i; for (i = 0; i < NID_TABLE_LEN; i++) { if (nid_names[i].nid == nid) @@ -223,8 +218,7 @@ static int get_secbits(int nid) return 0; } -static int get_keytype(int nid) -{ +static int get_keytype(int nid) { int i; for (i = 0; i < NID_TABLE_LEN; i++) { if (nid_names[i].nid == nid) @@ -233,21 +227,19 @@ static int get_keytype(int nid) return 0; } -char *get_oqsname_fromtls(char *tlsname) -{ +char *get_oqsname_fromtls(char *tlsname) { int i; for (i = 0; i < NID_TABLE_LEN; i++) { if (nid_names[i].keytype == KEY_TYPE_SIG) { - if (!strcmp(nid_names[i].oqsname, tlsname) - || !strcmp(nid_names[i].tlsname, tlsname)) + if (!strcmp(nid_names[i].oqsname, tlsname) || + !strcmp(nid_names[i].tlsname, tlsname)) return nid_names[i].oqsname; } } return 0; // classical } -char *get_oqsname(int nid) -{ +char *get_oqsname(int nid) { int i; for (i = 0; i < NID_TABLE_LEN; i++) { if (nid_names[i].nid == nid) @@ -256,8 +248,7 @@ char *get_oqsname(int nid) return 0; } -char *get_cmpname(int nid, int index) -{ +char *get_cmpname(int nid, int index) { int i, len; char *name, *s; if ((i = get_oqsalg_idx(nid)) == -1) @@ -284,8 +275,7 @@ char *get_cmpname(int nid, int index) return name; } -int get_oqsalg_idx(int nid) -{ +int get_oqsalg_idx(int nid) { int i; for (i = 0; i < NID_TABLE_LEN; i++) { if (nid_names[i].nid == nid) @@ -295,8 +285,7 @@ int get_oqsalg_idx(int nid) } /* Prepare composite data structures. RetVal 0 is error. */ -static int oqsx_key_set_composites(OQSX_KEY *key) -{ +static int oqsx_key_set_composites(OQSX_KEY *key) { int ret = 1; OQS_KEY_PRINTF2("Setting composites with evp_info %p\n", key->evp_info); @@ -335,8 +324,8 @@ static int oqsx_key_set_composites(OQSX_KEY *key) ERR_raise(ERR_LIB_USER, OQSPROV_R_INVALID_ENCODING); goto err; } - key->comp_privkey[1] = (char *)key->privkey - + classic_privkey_len + SIZE_OF_UINT32; + key->comp_privkey[1] = + (char *)key->privkey + classic_privkey_len + SIZE_OF_UINT32; } else { key->comp_privkey[0] = NULL; key->comp_privkey[1] = NULL; @@ -348,8 +337,8 @@ static int oqsx_key_set_composites(OQSX_KEY *key) ERR_raise(ERR_LIB_USER, OQSPROV_R_INVALID_ENCODING); goto err; } - key->comp_pubkey[1] - = (char *)key->pubkey + classic_pubkey_len + SIZE_OF_UINT32; + key->comp_pubkey[1] = + (char *)key->pubkey + classic_pubkey_len + SIZE_OF_UINT32; } else { key->comp_pubkey[0] = NULL; key->comp_pubkey[1] = NULL; @@ -361,8 +350,7 @@ static int oqsx_key_set_composites(OQSX_KEY *key) } PROV_OQS_CTX *oqsx_newprovctx(OSSL_LIB_CTX *libctx, - const OSSL_CORE_HANDLE *handle, BIO_METHOD *bm) -{ + const OSSL_CORE_HANDLE *handle, BIO_METHOD *bm) { PROV_OQS_CTX *ret = OPENSSL_zalloc(sizeof(PROV_OQS_CTX)); if (ret) { ret->libctx = libctx; @@ -372,22 +360,19 @@ PROV_OQS_CTX *oqsx_newprovctx(OSSL_LIB_CTX *libctx, return ret; } -void oqsx_freeprovctx(PROV_OQS_CTX *ctx) -{ +void oqsx_freeprovctx(PROV_OQS_CTX *ctx) { OSSL_LIB_CTX_free(ctx->libctx); BIO_meth_free(ctx->corebiometh); OPENSSL_free(ctx); } -void oqsx_key_set0_libctx(OQSX_KEY *key, OSSL_LIB_CTX *libctx) -{ +void oqsx_key_set0_libctx(OQSX_KEY *key, OSSL_LIB_CTX *libctx) { key->libctx = libctx; } /* convenience function creating OQSX keys from nids (only for sigs) */ static OQSX_KEY *oqsx_key_new_from_nid(OSSL_LIB_CTX *libctx, const char *propq, - int nid) -{ + int nid) { OQS_KEY_PRINTF2("Generating OQSX key for nid %d\n", nid); char *tls_algname = (char *)OBJ_nid2sn(nid); @@ -405,18 +390,17 @@ static OQSX_KEY *oqsx_key_new_from_nid(OSSL_LIB_CTX *libctx, const char *propq, /* Workaround for not functioning EC PARAM initialization * TBD, check https://github.com/openssl/openssl/issues/16989 */ -EVP_PKEY *setECParams(EVP_PKEY *eck, int nid) -{ - const unsigned char p256params[] - = {0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07}; - const unsigned char p384params[] - = {0x06, 0x05, 0x2b, 0x81, 0x04, 0x00, 0x22}; - const unsigned char p521params[] - = {0x06, 0x05, 0x2b, 0x81, 0x04, 0x00, 0x23}; - const char bp256params[] - = {0x06, 0x09, 0x2b, 0x24, 0x03, 0x03, 0x02, 0x08, 0x01, 0x01, 0x07}; - const char bp384params[] - = {0x06, 0x09, 0x2b, 0x24, 0x03, 0x03, 0x02, 0x08, 0x01, 0x01, 0x0b}; +EVP_PKEY *setECParams(EVP_PKEY *eck, int nid) { + const unsigned char p256params[] = {0x06, 0x08, 0x2a, 0x86, 0x48, + 0xce, 0x3d, 0x03, 0x01, 0x07}; + const unsigned char p384params[] = {0x06, 0x05, 0x2b, 0x81, + 0x04, 0x00, 0x22}; + const unsigned char p521params[] = {0x06, 0x05, 0x2b, 0x81, + 0x04, 0x00, 0x23}; + const char bp256params[] = {0x06, 0x09, 0x2b, 0x24, 0x03, 0x03, + 0x02, 0x08, 0x01, 0x01, 0x07}; + const char bp384params[] = {0x06, 0x09, 0x2b, 0x24, 0x03, 0x03, + 0x02, 0x08, 0x01, 0x01, 0x0b}; const unsigned char *params; switch (nid) { @@ -473,8 +457,7 @@ static const OQSX_EVP_INFO nids_ecx[] = { }; static int oqsx_hybsig_init(int bit_security, OQSX_EVP_CTX *evp_ctx, - char *algname) -{ + char *algname) { int ret = 1; int idx = (bit_security - 128) / 64; ON_ERR_GOTO(idx < 0 || idx > 5, err_init); @@ -537,8 +520,7 @@ static int oqsx_hybsig_init(int bit_security, OQSX_EVP_CTX *evp_ctx, return ret; } -static const int oqshybkem_init_ecp(char *tls_name, OQSX_EVP_CTX *evp_ctx) -{ +static const int oqshybkem_init_ecp(char *tls_name, OQSX_EVP_CTX *evp_ctx) { int ret = 1; int idx = 0; while (idx < OSSL_NELEM(OQSX_ECP_NAMES)) { @@ -567,8 +549,7 @@ static const int oqshybkem_init_ecp(char *tls_name, OQSX_EVP_CTX *evp_ctx) return ret; } -static const int oqshybkem_init_ecx(char *tls_name, OQSX_EVP_CTX *evp_ctx) -{ +static const int oqshybkem_init_ecx(char *tls_name, OQSX_EVP_CTX *evp_ctx) { int ret = 1; int idx = 0; @@ -597,8 +578,7 @@ static const int oqshybkem_init_ecx(char *tls_name, OQSX_EVP_CTX *evp_ctx) /* Re-create OQSX_KEY from encoding(s): Same end-state as after ken-gen */ static OQSX_KEY *oqsx_key_op(const X509_ALGOR *palg, const unsigned char *p, int plen, oqsx_key_op_t op, OSSL_LIB_CTX *libctx, - const char *propq) -{ + const char *propq) { OQSX_KEY *key = NULL; void **privkey, **pubkey; int nid = NID_undef; @@ -643,8 +623,9 @@ static OQSX_KEY *oqsx_key_op(const X509_ALGOR *palg, const unsigned char *p, uint32_t classical_privatekey_len = 0; // for plain OQS keys, we expect OQS priv||OQS pub key size_t actualprivkeylen = key->privkeylen; - // for hybrid keys, we expect classic priv key||OQS priv key||OQS pub - // key classic pub key must/can be re-created from classic private key + // for hybrid keys, we expect classic priv key||OQS priv key||OQS + // pub key classic pub key must/can be re-created from classic + // private key if (key->keytype == KEY_TYPE_CMP_SIG) { uint32_t privlen = 0; size_t publen = 0; @@ -658,8 +639,8 @@ static OQSX_KEY *oqsx_key_op(const X509_ALGOR *palg, const unsigned char *p, // check if key is the right size for (i = 0; i < key->numkeys; i++) { char *name; - if ((name = get_cmpname(OBJ_sn2nid(key->tls_name), i)) - == NULL) { + if ((name = get_cmpname(OBJ_sn2nid(key->tls_name), i)) == + NULL) { ERR_raise(ERR_LIB_USER, OQSPROV_R_INVALID_ENCODING); goto err_key_op; } @@ -667,8 +648,9 @@ static OQSX_KEY *oqsx_key_op(const X509_ALGOR *palg, const unsigned char *p, if (get_oqsname_fromtls(name) == 0) { // classical key publen = 0; } else { // PQC key - publen = key->pubkeylen_cmp[i]; // pubkey in PQC privkey is - // OPTIONAL + publen = key->pubkeylen_cmp[i]; // pubkey in + // PQC privkey + // is OPTIONAL } previous_privlen += privlen; previous_publen += publen; @@ -699,18 +681,20 @@ static OQSX_KEY *oqsx_key_op(const X509_ALGOR *palg, const unsigned char *p, for (i = 0; i < key->numkeys; i++) { size_t classic_publen = 0; char *name; - if ((name = get_cmpname(OBJ_sn2nid(key->tls_name), i)) - == NULL) { + if ((name = get_cmpname(OBJ_sn2nid(key->tls_name), i)) == + NULL) { ERR_raise(ERR_LIB_USER, OQSPROV_R_INVALID_ENCODING); OPENSSL_secure_clear_free(temp_priv, temp_priv_len); OPENSSL_secure_clear_free(temp_pub, temp_pub_len); goto err_key_op; } if (get_oqsname_fromtls(name) == 0) { // classical key - publen = 0; // no pubkey encoded with privkey on classical - // keys. will recreate the pubkey later - if (key->oqsx_provider_ctx.oqsx_evp_ctx->evp_info->keytype - == EVP_PKEY_RSA) { // get the RSA real key size + publen = 0; // no pubkey encoded with privkey + // on classical keys. will + // recreate the pubkey later + if (key->oqsx_provider_ctx.oqsx_evp_ctx->evp_info + ->keytype == + EVP_PKEY_RSA) { // get the RSA real key size if (previous_privlen + previous_publen + 4 > plen) { OPENSSL_free(name); OPENSSL_secure_clear_free(temp_priv, temp_priv_len); @@ -763,26 +747,26 @@ static OQSX_KEY *oqsx_key_op(const X509_ALGOR *palg, const unsigned char *p, OPENSSL_secure_clear_free(temp_pub, temp_pub_len); } else { if (key->numkeys == 2) { - size_t expected_pq_privkey_len - = key->oqsx_provider_ctx.oqsx_qs_ctx.kem->length_secret_key; + size_t expected_pq_privkey_len = + key->oqsx_provider_ctx.oqsx_qs_ctx.kem->length_secret_key; #ifndef NOPUBKEY_IN_PRIVKEY - expected_pq_privkey_len += key->oqsx_provider_ctx.oqsx_qs_ctx - .kem->length_public_key; + expected_pq_privkey_len += + key->oqsx_provider_ctx.oqsx_qs_ctx.kem->length_public_key; #endif if (plen > (SIZE_OF_UINT32 + expected_pq_privkey_len)) { - size_t max_classical_privkey_len - = key->evp_info->length_private_key; - size_t space_for_classical_privkey - = plen - expected_pq_privkey_len - SIZE_OF_UINT32; - if (space_for_classical_privkey - > max_classical_privkey_len) { + size_t max_classical_privkey_len = + key->evp_info->length_private_key; + size_t space_for_classical_privkey = + plen - expected_pq_privkey_len - SIZE_OF_UINT32; + if (space_for_classical_privkey > + max_classical_privkey_len) { ERR_raise(ERR_LIB_USER, OQSPROV_R_INVALID_ENCODING); goto err_key_op; } DECODE_UINT32(classical_privatekey_len, p); // actual classic key len - if (classical_privatekey_len - != space_for_classical_privkey) { + if (classical_privatekey_len != + space_for_classical_privkey) { ERR_raise(ERR_LIB_USER, OQSPROV_R_INVALID_ENCODING); goto err_key_op; } @@ -790,22 +774,22 @@ static OQSX_KEY *oqsx_key_op(const X509_ALGOR *palg, const unsigned char *p, ERR_raise(ERR_LIB_USER, OQSPROV_R_INVALID_ENCODING); goto err_key_op; } - actualprivkeylen -= (key->evp_info->length_private_key - - classical_privatekey_len); + actualprivkeylen -= (key->evp_info->length_private_key - + classical_privatekey_len); } #ifdef NOPUBKEY_IN_PRIVKEY if (actualprivkeylen != plen) { - OQS_KEY_PRINTF3( - "OQSX KEY: private key with unexpected length %d vs %d\n", - plen, (int)(actualprivkeylen)); + OQS_KEY_PRINTF3("OQSX KEY: private key with " + "unexpected length %d vs %d\n", + plen, (int)(actualprivkeylen)); #else - if (actualprivkeylen + oqsx_key_get_oqs_public_key_len(key) - != plen) { - OQS_KEY_PRINTF3( - "OQSX KEY: private key with unexpected length %d vs %d\n", - plen, - (int)(actualprivkeylen - + oqsx_key_get_oqs_public_key_len(key))); + if (actualprivkeylen + oqsx_key_get_oqs_public_key_len(key) != + plen) { + OQS_KEY_PRINTF3("OQSX KEY: private key with unexpected length " + "%d vs %d\n", + plen, + (int)(actualprivkeylen + + oqsx_key_get_oqs_public_key_len(key))); #endif ERR_raise(ERR_LIB_USER, OQSPROV_R_INVALID_ENCODING); goto err_key_op; @@ -822,8 +806,8 @@ static OQSX_KEY *oqsx_key_op(const X509_ALGOR *palg, const unsigned char *p, memcpy(key->privkey, p, actualprivkeylen); #ifndef NOPUBKEY_IN_PRIVKEY // only enough data to fill public OQS key component - if (oqsx_key_get_oqs_public_key_len(key) - != plen - actualprivkeylen) { + if (oqsx_key_get_oqs_public_key_len(key) != + plen - actualprivkeylen) { ERR_raise(ERR_LIB_USER, OQSPROV_R_INVALID_ENCODING); goto err_key_op; } @@ -831,8 +815,8 @@ static OQSX_KEY *oqsx_key_op(const X509_ALGOR *palg, const unsigned char *p, if (key->numkeys == 2) { unsigned char *pubkey = (unsigned char *)key->pubkey; ENCODE_UINT32(pubkey, key->evp_info->length_public_key); - memcpy(pubkey + SIZE_OF_UINT32 - + key->evp_info->length_public_key, + memcpy(pubkey + SIZE_OF_UINT32 + + key->evp_info->length_public_key, p + actualprivkeylen, plen - actualprivkeylen); } else memcpy(key->pubkey, p + key->privkeylen, @@ -851,16 +835,14 @@ static OQSX_KEY *oqsx_key_op(const X509_ALGOR *palg, const unsigned char *p, } /* Recreate EVP data structure after import. RetVal 0 is error. */ -static int oqsx_key_recreate_classickey(OQSX_KEY *key, oqsx_key_op_t op) -{ +static int oqsx_key_recreate_classickey(OQSX_KEY *key, oqsx_key_op_t op) { if (key->keytype == KEY_TYPE_CMP_SIG) { int i; if (op == KEY_OP_PUBLIC) { - for (i = 0; i < key->numkeys; i++) { char *name; - if ((name = get_cmpname(OBJ_sn2nid(key->tls_name), i)) - == NULL) { + if ((name = get_cmpname(OBJ_sn2nid(key->tls_name), i)) == + NULL) { ERR_raise(ERR_LIB_USER, OQSPROV_R_INVALID_ENCODING); goto rec_err; } @@ -871,8 +853,7 @@ static int oqsx_key_recreate_classickey(OQSX_KEY *key, oqsx_key_op_t op) ->raw_key_support) { EVP_PKEY *npk = EVP_PKEY_new(); if (key->oqsx_provider_ctx.oqsx_evp_ctx->evp_info - ->keytype - != EVP_PKEY_RSA) { + ->keytype != EVP_PKEY_RSA) { npk = setECParams(npk, key->oqsx_provider_ctx .oqsx_evp_ctx->evp_info->nid); @@ -897,11 +878,10 @@ static int oqsx_key_recreate_classickey(OQSX_KEY *key, oqsx_key_op_t op) } if (op == KEY_OP_PRIVATE) { - for (i = 0; i < key->numkeys; i++) { char *name; - if ((name = get_cmpname(OBJ_sn2nid(key->tls_name), i)) - == NULL) { + if ((name = get_cmpname(OBJ_sn2nid(key->tls_name), i)) == + NULL) { ERR_raise(ERR_LIB_USER, OQSPROV_R_INVALID_ENCODING); goto rec_err; } @@ -928,11 +908,10 @@ static int oqsx_key_recreate_classickey(OQSX_KEY *key, oqsx_key_op_t op) if (!key->oqsx_provider_ctx.oqsx_evp_ctx->evp_info ->raw_key_support) { unsigned char *comp_pubkey = key->comp_pubkey[i]; - int pubkeylen - = i2d_PublicKey(key->classical_pkey, &comp_pubkey); - if (pubkeylen - != key->oqsx_provider_ctx.oqsx_evp_ctx->evp_info - ->length_public_key) { + int pubkeylen = + i2d_PublicKey(key->classical_pkey, &comp_pubkey); + if (pubkeylen != key->oqsx_provider_ctx.oqsx_evp_ctx + ->evp_info->length_public_key) { ERR_raise(ERR_LIB_USER, OQSPROV_R_INVALID_ENCODING); OPENSSL_free(name); goto rec_err; @@ -980,9 +959,9 @@ static int oqsx_key_recreate_classickey(OQSX_KEY *key, oqsx_key_op_t op) if (key->evp_info->keytype != EVP_PKEY_RSA) { npk = setECParams(npk, key->evp_info->nid); } - key->classical_pkey - = d2i_PublicKey(key->evp_info->keytype, &npk, - &enc_pubkey, classical_pubkey_len); + key->classical_pkey = + d2i_PublicKey(key->evp_info->keytype, &npk, &enc_pubkey, + classical_pubkey_len); if (!key->classical_pkey) { ERR_raise(ERR_LIB_USER, OQSPROV_R_INVALID_ENCODING); EVP_PKEY_free(npk); @@ -1007,31 +986,32 @@ static int oqsx_key_recreate_classickey(OQSX_KEY *key, oqsx_key_op_t op) goto rec_err; } #ifndef NOPUBKEY_IN_PRIVKEY - // re-create classic public key part from private key: + // re-create classic public key part from + // private key: size_t pubkeylen; EVP_PKEY_get_raw_public_key(key->classical_pkey, NULL, &pubkeylen); - if (pubkeylen != key->evp_info->length_public_key - || EVP_PKEY_get_raw_public_key(key->classical_pkey, - enc_pubkey, &pubkeylen) - != 1) { + if (pubkeylen != key->evp_info->length_public_key || + EVP_PKEY_get_raw_public_key( + key->classical_pkey, enc_pubkey, &pubkeylen) != 1) { ERR_raise(ERR_LIB_USER, OQSPROV_R_INVALID_ENCODING); goto rec_err; } #endif } else { - key->classical_pkey - = d2i_PrivateKey(key->evp_info->keytype, NULL, - &enc_privkey, classical_privkey_len); + key->classical_pkey = + d2i_PrivateKey(key->evp_info->keytype, NULL, + &enc_privkey, classical_privkey_len); if (!key->classical_pkey) { ERR_raise(ERR_LIB_USER, OQSPROV_R_INVALID_ENCODING); goto rec_err; } #ifndef NOPUBKEY_IN_PRIVKEY - // re-create classic public key part from private key: - int pubkeylen - = i2d_PublicKey(key->classical_pkey, &enc_pubkey); + // re-create classic public key part from + // private key: + int pubkeylen = + i2d_PublicKey(key->classical_pkey, &enc_pubkey); if (pubkeylen != key->evp_info->length_public_key) { ERR_raise(ERR_LIB_USER, OQSPROV_R_INVALID_ENCODING); goto rec_err; @@ -1049,8 +1029,7 @@ static int oqsx_key_recreate_classickey(OQSX_KEY *key, oqsx_key_op_t op) } OQSX_KEY *oqsx_key_from_x509pubkey(const X509_PUBKEY *xpk, OSSL_LIB_CTX *libctx, - const char *propq) -{ + const char *propq) { const unsigned char *p; int plen; X509_ALGOR *palg; @@ -1073,15 +1052,15 @@ OQSX_KEY *oqsx_key_from_x509pubkey(const X509_PUBKEY *xpk, OSSL_LIB_CTX *libctx, return NULL; } else { count = sk_ASN1_TYPE_num(sk); - concat_key - = OPENSSL_zalloc(plen); // concat_key is allocated with plen, - // which is the max value for pubkey + concat_key = + OPENSSL_zalloc(plen); // concat_key is allocated with plen, + // which is the max value for pubkey aux = 0; for (i = 0; i < count; i++) { - aType - = sk_ASN1_TYPE_pop(sk); // this remove in FILO order, but we - // need this in the opposite order + aType = + sk_ASN1_TYPE_pop(sk); // this remove in FILO order, but we + // need this in the opposite order buf = aType->value.sequence->data; buflen = aType->value.sequence->length; aux += buflen; @@ -1104,8 +1083,7 @@ OQSX_KEY *oqsx_key_from_x509pubkey(const X509_PUBKEY *xpk, OSSL_LIB_CTX *libctx, } OQSX_KEY *oqsx_key_from_pkcs8(const PKCS8_PRIV_KEY_INFO *p8inf, - OSSL_LIB_CTX *libctx, const char *propq) -{ + OSSL_LIB_CTX *libctx, const char *propq) { OQSX_KEY *oqsx = NULL; const unsigned char *p; int plen; @@ -1145,15 +1123,14 @@ OQSX_KEY *oqsx_key_from_pkcs8(const PKCS8_PRIV_KEY_INFO *p8inf, aux = 0; for (i = 0; i < count; i++) { - aType - = sk_ASN1_TYPE_pop(sk); // this remove in FILO order, but we - // need this in the opposite order + aType = + sk_ASN1_TYPE_pop(sk); // this remove in FILO order, but we + // need this in the opposite order p8inf_internal = PKCS8_PRIV_KEY_INFO_new(); nid = 0; char *name; - if ((name - = get_cmpname(OBJ_obj2nid(palg->algorithm), count - 1 - i)) - == NULL) { + if ((name = get_cmpname(OBJ_obj2nid(palg->algorithm), + count - 1 - i)) == NULL) { ASN1_TYPE_free(aType); OPENSSL_clear_free(concat_key, plen); PKCS8_PRIV_KEY_INFO_free(p8inf_internal); @@ -1164,8 +1141,8 @@ OQSX_KEY *oqsx_key_from_pkcs8(const PKCS8_PRIV_KEY_INFO *p8inf, buflen = aType->value.sequence->length; const unsigned char *buf2 = aType->value.sequence->data; - p8inf_internal - = d2i_PKCS8_PRIV_KEY_INFO(&p8inf_internal, &buf2, buflen); + p8inf_internal = + d2i_PKCS8_PRIV_KEY_INFO(&p8inf_internal, &buf2, buflen); if (!PKCS8_pkey_get0(NULL, &buf, &buflen, &palg_internal, p8inf_internal)) { OPENSSL_free(name); @@ -1183,22 +1160,23 @@ OQSX_KEY *oqsx_key_from_pkcs8(const PKCS8_PRIV_KEY_INFO *p8inf, int j; nid = OBJ_obj2nid(palg_internal->parameter->value.object); for (j = 0; j < OSSL_NELEM(nids_sig); j++) { - if ((nids_sig[j].nid == nid) - && (nids_sig[j].length_private_key - > buflen)) { // check if the curve is the same - // and if the key len is smaller - // than the max key size + if ((nids_sig[j].nid == nid) && + (nids_sig[j].length_private_key > + buflen)) { // check if the curve is the + // same and if the key len is + // smaller than the max key + // size EVP_PKEY *ec_pkey; OSSL_PARAM params[3]; int include_pub = 1; - const unsigned char *buf3 - = aType->value.sequence->data; + const unsigned char *buf3 = + aType->value.sequence->data; unsigned char *buf4, *buf5; - if (buflen - != nids_sig[j].kex_length_secret - + 7) { // no OPTIONAL ECParameter and no - // OPTIONAL Pubkey + if (buflen != nids_sig[j].kex_length_secret + + 7) { // no OPTIONAL + // ECParameter and no + // OPTIONAL Pubkey OPENSSL_free(name); ASN1_TYPE_free(aType); PKCS8_PRIV_KEY_INFO_free(p8inf_internal); @@ -1209,32 +1187,46 @@ OQSX_KEY *oqsx_key_from_pkcs8(const PKCS8_PRIV_KEY_INFO *p8inf, ec_pkey = EVP_PKEY_new(); d2i_PrivateKey( EVP_PKEY_EC, &ec_pkey, &buf3, - aType->value.sequence - ->length); // create a new EVP_PKEY using ec - // priv key - - // set parameters for the new priv key format + aType->value.sequence->length); // create + // a new + // EVP_PKEY + // using + // ec + // priv + // key + + // set parameters for the + // new priv key format params[0] = OSSL_PARAM_construct_int( OSSL_PKEY_PARAM_EC_INCLUDE_PUBLIC, - &include_pub); // add pubkey to priv key + &include_pub); // add + // pubkey + // to + // priv + // key params[1] = OSSL_PARAM_construct_utf8_string( OSSL_PKEY_PARAM_EC_ENCODING, OSSL_PKEY_EC_ENCODING_GROUP, - 0); // add ECParam to the priv key + 0); // add ECParam to + // the priv key params[2] = OSSL_PARAM_construct_end(); EVP_PKEY_set_params(ec_pkey, params); - buf4 = OPENSSL_malloc( - nids_sig[j].length_private_key); + buf4 = + OPENSSL_malloc(nids_sig[j].length_private_key); buf5 = buf4; - buflen = i2d_PrivateKey( - ec_pkey, - &buf5); // encode priv key including parameters + buflen = i2d_PrivateKey(ec_pkey, + &buf5); // encode priv + // key + // including + // parameters aux += buflen; - memcpy( - concat_key + plen - 1 - aux, buf4, - buflen); // fill concat_key starting at the end + memcpy(concat_key + plen - 1 - aux, buf4, + buflen); // fill + // concat_key + // starting at + // the end EVP_PKEY_free(ec_pkey); OPENSSL_clear_free(buf4, buflen); @@ -1242,13 +1234,15 @@ OQSX_KEY *oqsx_key_from_pkcs8(const PKCS8_PRIV_KEY_INFO *p8inf, } } if (j == OSSL_NELEM(nids_sig)) - nid = 0; // buflen is already with the correct size, - // changing nid to memcpy at the end + nid = 0; // buflen is already with the + // correct size, changing nid + // to memcpy at the end } - // if is a RSA key the actual encoding size might be different - // from max size we calculate that difference for to facilitate - // the key reconstruction + // if is a RSA key the actual encoding size might + // be different from max size we calculate that + // difference for to facilitate the key + // reconstruction if (keytype == EVP_PKEY_RSA) { if (name[3] == '3') // 3072 key_diff = nids_sig[5].length_private_key - buflen; @@ -1259,7 +1253,8 @@ OQSX_KEY *oqsx_key_from_pkcs8(const PKCS8_PRIV_KEY_INFO *p8inf, if (!nid) { aux += buflen; memcpy(concat_key + plen - 1 - aux, buf, - buflen); // fill concat_key starting at the end + buflen); // fill concat_key + // starting at the end } OPENSSL_free(name); @@ -1284,16 +1279,15 @@ OQSX_KEY *oqsx_key_from_pkcs8(const PKCS8_PRIV_KEY_INFO *p8inf, return oqsx; } -static const int (*init_kex_fun[])(char *, OQSX_EVP_CTX *) - = {oqshybkem_init_ecp, oqshybkem_init_ecx}; +static const int (*init_kex_fun[])(char *, OQSX_EVP_CTX *) = { + oqshybkem_init_ecp, oqshybkem_init_ecx}; extern const char *oqs_oid_alg_list[]; OQSX_KEY *oqsx_key_new(OSSL_LIB_CTX *libctx, char *oqs_name, char *tls_name, int primitive, const char *propq, int bit_security, - int alg_idx) -{ - OQSX_KEY *ret = OPENSSL_zalloc( - sizeof(*ret)); // ensure all component pointers are NULL + int alg_idx) { + OQSX_KEY *ret = + OPENSSL_zalloc(sizeof(*ret)); // ensure all component pointers are NULL OQSX_EVP_CTX *evp_ctx = NULL; int ret2 = 0, i; @@ -1324,17 +1318,18 @@ OQSX_KEY *oqsx_key_new(OSSL_LIB_CTX *libctx, char *oqs_name, char *tls_name, ret->oqsx_provider_ctx.oqsx_evp_ctx = NULL; ret->oqsx_provider_ctx.oqsx_qs_ctx.sig = OQS_SIG_new(oqs_name); if (!ret->oqsx_provider_ctx.oqsx_qs_ctx.sig) { - fprintf( - stderr, - "Could not create OQS signature algorithm %s. Enabled in liboqs?\n", - oqs_name); + fprintf(stderr, + "Could not create OQS signature algorithm %s. " + "Enabled in " + "liboqs?\n", + oqs_name); goto err; } - ret->privkeylen - = ret->oqsx_provider_ctx.oqsx_qs_ctx.sig->length_secret_key; - ret->pubkeylen - = ret->oqsx_provider_ctx.oqsx_qs_ctx.sig->length_public_key; + ret->privkeylen = + ret->oqsx_provider_ctx.oqsx_qs_ctx.sig->length_secret_key; + ret->pubkeylen = + ret->oqsx_provider_ctx.oqsx_qs_ctx.sig->length_public_key; ret->keytype = KEY_TYPE_SIG; break; case KEY_TYPE_KEM: @@ -1345,47 +1340,47 @@ OQSX_KEY *oqsx_key_new(OSSL_LIB_CTX *libctx, char *oqs_name, char *tls_name, ret->oqsx_provider_ctx.oqsx_evp_ctx = NULL; ret->oqsx_provider_ctx.oqsx_qs_ctx.kem = OQS_KEM_new(oqs_name); if (!ret->oqsx_provider_ctx.oqsx_qs_ctx.kem) { - fprintf( - stderr, - "Could not create OQS KEM algorithm %s. Enabled in liboqs?\n", - oqs_name); + fprintf(stderr, + "Could not create OQS KEM algorithm %s. Enabled " + "in liboqs?\n", + oqs_name); goto err; } - ret->privkeylen - = ret->oqsx_provider_ctx.oqsx_qs_ctx.kem->length_secret_key; - ret->pubkeylen - = ret->oqsx_provider_ctx.oqsx_qs_ctx.kem->length_public_key; + ret->privkeylen = + ret->oqsx_provider_ctx.oqsx_qs_ctx.kem->length_secret_key; + ret->pubkeylen = + ret->oqsx_provider_ctx.oqsx_qs_ctx.kem->length_public_key; ret->keytype = KEY_TYPE_KEM; break; case KEY_TYPE_ECX_HYB_KEM: case KEY_TYPE_ECP_HYB_KEM: ret->oqsx_provider_ctx.oqsx_qs_ctx.kem = OQS_KEM_new(oqs_name); if (!ret->oqsx_provider_ctx.oqsx_qs_ctx.kem) { - fprintf( - stderr, - "Could not create OQS KEM algorithm %s. Enabled in liboqs?\n", - oqs_name); + fprintf(stderr, + "Could not create OQS KEM algorithm %s. Enabled " + "in liboqs?\n", + oqs_name); goto err; } evp_ctx = OPENSSL_zalloc(sizeof(OQSX_EVP_CTX)); ON_ERR_GOTO(!evp_ctx, err); - ret2 = (init_kex_fun[primitive - KEY_TYPE_ECP_HYB_KEM])(tls_name, - evp_ctx); + ret2 = + (init_kex_fun[primitive - KEY_TYPE_ECP_HYB_KEM])(tls_name, evp_ctx); ON_ERR_GOTO(ret2 <= 0 || !evp_ctx->keyParam || !evp_ctx->ctx, err); ret->numkeys = 2; ret->comp_privkey = OPENSSL_malloc(ret->numkeys * sizeof(void *)); ret->comp_pubkey = OPENSSL_malloc(ret->numkeys * sizeof(void *)); ON_ERR_GOTO(!ret->comp_privkey || !ret->comp_pubkey, err); - ret->privkeylen - = (ret->numkeys - 1) * SIZE_OF_UINT32 - + ret->oqsx_provider_ctx.oqsx_qs_ctx.kem->length_secret_key - + evp_ctx->evp_info->length_private_key; - ret->pubkeylen - = (ret->numkeys - 1) * SIZE_OF_UINT32 - + ret->oqsx_provider_ctx.oqsx_qs_ctx.kem->length_public_key - + evp_ctx->evp_info->length_public_key; + ret->privkeylen = + (ret->numkeys - 1) * SIZE_OF_UINT32 + + ret->oqsx_provider_ctx.oqsx_qs_ctx.kem->length_secret_key + + evp_ctx->evp_info->length_private_key; + ret->pubkeylen = + (ret->numkeys - 1) * SIZE_OF_UINT32 + + ret->oqsx_provider_ctx.oqsx_qs_ctx.kem->length_public_key + + evp_ctx->evp_info->length_public_key; ret->oqsx_provider_ctx.oqsx_evp_ctx = evp_ctx; ret->keytype = primitive; ret->evp_info = evp_ctx->evp_info; @@ -1393,10 +1388,11 @@ OQSX_KEY *oqsx_key_new(OSSL_LIB_CTX *libctx, char *oqs_name, char *tls_name, case KEY_TYPE_HYB_SIG: ret->oqsx_provider_ctx.oqsx_qs_ctx.sig = OQS_SIG_new(oqs_name); if (!ret->oqsx_provider_ctx.oqsx_qs_ctx.sig) { - fprintf( - stderr, - "Could not create OQS signature algorithm %s. Enabled in liboqs?\n", - oqs_name); + fprintf(stderr, + "Could not create OQS signature algorithm %s. " + "Enabled in " + "liboqs?\n", + oqs_name); goto err; } evp_ctx = OPENSSL_zalloc(sizeof(OQSX_EVP_CTX)); @@ -1409,14 +1405,14 @@ OQSX_KEY *oqsx_key_new(OSSL_LIB_CTX *libctx, char *oqs_name, char *tls_name, ret->comp_privkey = OPENSSL_malloc(ret->numkeys * sizeof(void *)); ret->comp_pubkey = OPENSSL_malloc(ret->numkeys * sizeof(void *)); ON_ERR_GOTO(!ret->comp_privkey || !ret->comp_pubkey, err); - ret->privkeylen - = (ret->numkeys - 1) * SIZE_OF_UINT32 - + ret->oqsx_provider_ctx.oqsx_qs_ctx.sig->length_secret_key - + evp_ctx->evp_info->length_private_key; - ret->pubkeylen - = (ret->numkeys - 1) * SIZE_OF_UINT32 - + ret->oqsx_provider_ctx.oqsx_qs_ctx.sig->length_public_key - + evp_ctx->evp_info->length_public_key; + ret->privkeylen = + (ret->numkeys - 1) * SIZE_OF_UINT32 + + ret->oqsx_provider_ctx.oqsx_qs_ctx.sig->length_secret_key + + evp_ctx->evp_info->length_private_key; + ret->pubkeylen = + (ret->numkeys - 1) * SIZE_OF_UINT32 + + ret->oqsx_provider_ctx.oqsx_qs_ctx.sig->length_public_key + + evp_ctx->evp_info->length_public_key; ret->oqsx_provider_ctx.oqsx_evp_ctx = evp_ctx; ret->keytype = primitive; ret->evp_info = evp_ctx->evp_info; @@ -1437,19 +1433,21 @@ OQSX_KEY *oqsx_key_new(OSSL_LIB_CTX *libctx, char *oqs_name, char *tls_name, goto err; } if (get_oqsname_fromtls(name) != 0) { - ret->oqsx_provider_ctx.oqsx_qs_ctx.sig - = OQS_SIG_new(get_oqsname_fromtls(name)); + ret->oqsx_provider_ctx.oqsx_qs_ctx.sig = + OQS_SIG_new(get_oqsname_fromtls(name)); if (!ret->oqsx_provider_ctx.oqsx_qs_ctx.sig) { - fprintf( - stderr, - "Could not create OQS signature algorithm %s. Enabled in liboqs?A\n", - name); + fprintf(stderr, + "Could not create OQS signature " + "algorithm %s. " + "Enabled in " + "liboqs?A\n", + name); goto err; } - ret->privkeylen_cmp[i] - = ret->oqsx_provider_ctx.oqsx_qs_ctx.sig->length_secret_key; - ret->pubkeylen_cmp[i] - = ret->oqsx_provider_ctx.oqsx_qs_ctx.sig->length_public_key; + ret->privkeylen_cmp[i] = + ret->oqsx_provider_ctx.oqsx_qs_ctx.sig->length_secret_key; + ret->pubkeylen_cmp[i] = + ret->oqsx_provider_ctx.oqsx_qs_ctx.sig->length_public_key; } else { evp_ctx = OPENSSL_zalloc(sizeof(OQSX_EVP_CTX)); ON_ERR_GOTO(!evp_ctx, err); @@ -1504,16 +1502,15 @@ OQSX_KEY *oqsx_key_new(OSSL_LIB_CTX *libctx, char *oqs_name, char *tls_name, return NULL; } -void oqsx_key_free(OQSX_KEY *key) -{ +void oqsx_key_free(OQSX_KEY *key) { int refcnt; if (key == NULL) return; #ifndef OQS_PROVIDER_NOATOMIC - refcnt - = atomic_fetch_sub_explicit(&key->references, 1, memory_order_relaxed) - - 1; + refcnt = + atomic_fetch_sub_explicit(&key->references, 1, memory_order_relaxed) - + 1; if (refcnt == 0) atomic_thread_fence(memory_order_acquire); #else @@ -1539,8 +1536,8 @@ void oqsx_key_free(OQSX_KEY *key) } if (key->keytype == KEY_TYPE_KEM) OQS_KEM_free(key->oqsx_provider_ctx.oqsx_qs_ctx.kem); - else if (key->keytype == KEY_TYPE_ECP_HYB_KEM - || key->keytype == KEY_TYPE_ECX_HYB_KEM) { + else if (key->keytype == KEY_TYPE_ECP_HYB_KEM || + key->keytype == KEY_TYPE_ECX_HYB_KEM) { OQS_KEM_free(key->oqsx_provider_ctx.oqsx_qs_ctx.kem); } else OQS_SIG_free(key->oqsx_provider_ctx.oqsx_qs_ctx.sig); @@ -1557,14 +1554,13 @@ void oqsx_key_free(OQSX_KEY *key) OPENSSL_free(key); } -int oqsx_key_up_ref(OQSX_KEY *key) -{ +int oqsx_key_up_ref(OQSX_KEY *key) { int refcnt; #ifndef OQS_PROVIDER_NOATOMIC - refcnt - = atomic_fetch_add_explicit(&key->references, 1, memory_order_relaxed) - + 1; + refcnt = + atomic_fetch_add_explicit(&key->references, 1, memory_order_relaxed) + + 1; #else CRYPTO_atomic_add(&key->references, 1, &refcnt, key->lock); #endif @@ -1576,8 +1572,7 @@ int oqsx_key_up_ref(OQSX_KEY *key) return (refcnt > 1); } -int oqsx_key_allocate_keymaterial(OQSX_KEY *key, int include_private) -{ +int oqsx_key_allocate_keymaterial(OQSX_KEY *key, int include_private) { int ret = 0, aux = 0; if (key->keytype != KEY_TYPE_CMP_SIG) @@ -1596,8 +1591,7 @@ int oqsx_key_allocate_keymaterial(OQSX_KEY *key, int include_private) } int oqsx_key_fromdata(OQSX_KEY *key, const OSSL_PARAM params[], - int include_private) -{ + int include_private) { const OSSL_PARAM *pp1, *pp2; OQS_KEY_PRINTF("OQSX Key from data called\n"); @@ -1642,16 +1636,15 @@ int oqsx_key_fromdata(OQSX_KEY *key, const OSSL_PARAM params[], } memcpy(key->pubkey, pp2->data, pp2->data_size); } - if (!oqsx_key_set_composites(key) - || !oqsx_key_recreate_classickey( + if (!oqsx_key_set_composites(key) || + !oqsx_key_recreate_classickey( key, key->privkey != NULL ? KEY_OP_PRIVATE : KEY_OP_PUBLIC)) return 0; return 1; } // OQS key always the last of the numkeys comp keys -static int oqsx_key_gen_oqs(OQSX_KEY *key, int gen_kem) -{ +static int oqsx_key_gen_oqs(OQSX_KEY *key, int gen_kem) { if (gen_kem) return OQS_KEM_keypair(key->oqsx_provider_ctx.oqsx_qs_ctx.kem, key->comp_pubkey[key->numkeys - 1], @@ -1667,8 +1660,7 @@ static int oqsx_key_gen_oqs(OQSX_KEY *key, int gen_kem) * pubkey/privkey buffers; returned EVP_PKEY must be freed if not used */ static EVP_PKEY *oqsx_key_gen_evp_key(OQSX_EVP_CTX *ctx, unsigned char *pubkey, - unsigned char *privkey, int encode) -{ + unsigned char *privkey, int encode) { int ret = 0, ret2 = 0, aux = 0; // Free at errhyb: @@ -1704,38 +1696,38 @@ static EVP_PKEY *oqsx_key_gen_evp_key(OQSX_EVP_CTX *ctx, unsigned char *pubkey, if (ctx->evp_info->raw_key_support) { // TODO: If available, use preallocated memory - if (ctx->evp_info->nid != NID_ED25519 - && ctx->evp_info->nid != NID_ED448) { + if (ctx->evp_info->nid != NID_ED25519 && + ctx->evp_info->nid != NID_ED448) { pubkeylen = EVP_PKEY_get1_encoded_public_key(pkey, &pubkey_encoded); - ON_ERR_SET_GOTO(pubkeylen != ctx->evp_info->length_public_key - || !pubkey_encoded, + ON_ERR_SET_GOTO(pubkeylen != ctx->evp_info->length_public_key || + !pubkey_encoded, ret, -3, errhyb); memcpy(pubkey + aux, pubkey_encoded, pubkeylen); } else { pubkeylen = ctx->evp_info->length_public_key; ret2 = EVP_PKEY_get_raw_public_key(pkey, pubkey + aux, &pubkeylen); - ON_ERR_SET_GOTO( - ret2 <= 0 || pubkeylen != ctx->evp_info->length_public_key, ret, - -3, errhyb); + ON_ERR_SET_GOTO(ret2 <= 0 || + pubkeylen != ctx->evp_info->length_public_key, + ret, -3, errhyb); } privkeylen = ctx->evp_info->length_private_key; ret2 = EVP_PKEY_get_raw_private_key(pkey, privkey + aux, &privkeylen); - ON_ERR_SET_GOTO(ret2 <= 0 - || privkeylen != ctx->evp_info->length_private_key, + ON_ERR_SET_GOTO(ret2 <= 0 || + privkeylen != ctx->evp_info->length_private_key, ret, -4, errhyb); } else { unsigned char *pubkey_enc = pubkey + aux; const unsigned char *pubkey_enc2 = pubkey + aux; pubkeylen = i2d_PublicKey(pkey, &pubkey_enc); - ON_ERR_SET_GOTO( - !pubkey_enc || pubkeylen > (int)ctx->evp_info->length_public_key, - ret, -11, errhyb); + ON_ERR_SET_GOTO(!pubkey_enc || + pubkeylen > (int)ctx->evp_info->length_public_key, + ret, -11, errhyb); unsigned char *privkey_enc = privkey + aux; const unsigned char *privkey_enc2 = privkey + aux; privkeylen = i2d_PrivateKey(pkey, &privkey_enc); - ON_ERR_SET_GOTO( - !privkey_enc || privkeylen > (int)ctx->evp_info->length_private_key, - ret, -12, errhyb); + ON_ERR_SET_GOTO(!privkey_enc || + privkeylen > (int)ctx->evp_info->length_private_key, + ret, -12, errhyb); // selftest: EVP_PKEY *ck2 = d2i_PrivateKey(ctx->evp_info->keytype, NULL, &privkey_enc2, privkeylen); @@ -1762,14 +1754,13 @@ static EVP_PKEY *oqsx_key_gen_evp_key(OQSX_EVP_CTX *ctx, unsigned char *pubkey, } /* allocates OQS and classical keys */ -int oqsx_key_gen(OQSX_KEY *key) -{ +int oqsx_key_gen(OQSX_KEY *key) { int ret = 0; EVP_PKEY *pkey = NULL; if (key->privkey == NULL || key->pubkey == NULL) { - ret = oqsx_key_allocate_keymaterial(key, 0) - || oqsx_key_allocate_keymaterial(key, 1); + ret = oqsx_key_allocate_keymaterial(key, 0) || + oqsx_key_allocate_keymaterial(key, 1); ON_ERR_GOTO(ret, err_gen); } @@ -1777,9 +1768,9 @@ int oqsx_key_gen(OQSX_KEY *key) ret = !oqsx_key_set_composites(key); ON_ERR_GOTO(ret, err_gen); ret = oqsx_key_gen_oqs(key, 1); - } else if (key->keytype == KEY_TYPE_ECP_HYB_KEM - || key->keytype == KEY_TYPE_ECX_HYB_KEM - || key->keytype == KEY_TYPE_HYB_SIG) { + } else if (key->keytype == KEY_TYPE_ECP_HYB_KEM || + key->keytype == KEY_TYPE_ECX_HYB_KEM || + key->keytype == KEY_TYPE_HYB_SIG) { pkey = oqsx_key_gen_evp_key(key->oqsx_provider_ctx.oqsx_evp_ctx, key->pubkey, key->privkey, 1); ON_ERR_GOTO(pkey == NULL, err_gen); @@ -1806,14 +1797,13 @@ int oqsx_key_gen(OQSX_KEY *key) ON_ERR_GOTO(pkey == NULL, err_gen); key->classical_pkey = pkey; } else { - ret = OQS_SIG_keypair(key->oqsx_provider_ctx.oqsx_qs_ctx.sig, - key->comp_pubkey[i], - key->comp_privkey[i]); + ret = + OQS_SIG_keypair(key->oqsx_provider_ctx.oqsx_qs_ctx.sig, + key->comp_pubkey[i], key->comp_privkey[i]); OPENSSL_free(name); ON_ERR_GOTO(ret, err_gen); } } - } else if (key->keytype == KEY_TYPE_SIG) { ret = !oqsx_key_set_composites(key); ON_ERR_GOTO(ret, err_gen); @@ -1829,30 +1819,27 @@ int oqsx_key_gen(OQSX_KEY *key) return ret; } -int oqsx_key_secbits(OQSX_KEY *key) -{ - return key->bit_security; -} +int oqsx_key_secbits(OQSX_KEY *key) { return key->bit_security; } -int oqsx_key_maxsize(OQSX_KEY *key) -{ +int oqsx_key_maxsize(OQSX_KEY *key) { switch (key->keytype) { case KEY_TYPE_KEM: return key->oqsx_provider_ctx.oqsx_qs_ctx.kem->length_shared_secret; case KEY_TYPE_ECP_HYB_KEM: case KEY_TYPE_ECX_HYB_KEM: - return key->oqsx_provider_ctx.oqsx_evp_ctx->evp_info->kex_length_secret - + key->oqsx_provider_ctx.oqsx_qs_ctx.kem->length_shared_secret; + return key->oqsx_provider_ctx.oqsx_evp_ctx->evp_info + ->kex_length_secret + + key->oqsx_provider_ctx.oqsx_qs_ctx.kem->length_shared_secret; case KEY_TYPE_SIG: return key->oqsx_provider_ctx.oqsx_qs_ctx.sig->length_signature; case KEY_TYPE_HYB_SIG: - return key->oqsx_provider_ctx.oqsx_qs_ctx.sig->length_signature - + key->oqsx_provider_ctx.oqsx_evp_ctx->evp_info->length_signature - + SIZE_OF_UINT32; + return key->oqsx_provider_ctx.oqsx_qs_ctx.sig->length_signature + + key->oqsx_provider_ctx.oqsx_evp_ctx->evp_info->length_signature + + SIZE_OF_UINT32; case KEY_TYPE_CMP_SIG: - return sizeof(CompositeSignature) - + key->oqsx_provider_ctx.oqsx_evp_ctx->evp_info->length_signature - + key->oqsx_provider_ctx.oqsx_qs_ctx.sig->length_signature; + return sizeof(CompositeSignature) + + key->oqsx_provider_ctx.oqsx_evp_ctx->evp_info->length_signature + + key->oqsx_provider_ctx.oqsx_qs_ctx.sig->length_signature; default: OQS_KEY_PRINTF("OQSX KEY: Wrong key type\n"); @@ -1860,8 +1847,7 @@ int oqsx_key_maxsize(OQSX_KEY *key) } } -int oqsx_key_get_oqs_public_key_len(OQSX_KEY *k) -{ +int oqsx_key_get_oqs_public_key_len(OQSX_KEY *k) { switch (k->keytype) { case KEY_TYPE_SIG: case KEY_TYPE_KEM: diff --git a/scripts/do_code_format.sh b/scripts/do_code_format.sh new file mode 100755 index 00000000..5c362685 --- /dev/null +++ b/scripts/do_code_format.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT + +rv=0 + +if [ "$1" = "--no-dry-run" ]; then + dryrun="-i" +else + dryrun="--dry-run" +fi + +ep=`pwd` +find oqsprov test -type f -and -name '*.[ch]' | xargs clang-format --style="{BasedOnStyle: llvm, IndentWidth: 4}" $dryrun --Werror +if [ $? -ne 0 ]; then + echo "Error: Some files need reformatting. Check output above." + rv=-1 +fi + +# check _all_ source files for CRLF line endings: +find oqsprov test -name '*.[chS]' -exec file "{}" ";" | grep CRLF +if [ $? -ne 1 ]; then + echo "Error: Files found with non-UNIX line endings." + echo "To fix, consider running \"find oqsprov test -name '*.[chS]' | xargs sed -i 's/\r//' \"." + rv=-1 +fi + +exit $rv diff --git a/scripts/format_code.sh b/scripts/format_code.sh new file mode 100755 index 00000000..3e72d762 --- /dev/null +++ b/scripts/format_code.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +# SPDX-License-Identifier: MIT + +# usage: ./scripts/format_code.sh + +arch=$(uname -m) + +# tested on Ubuntu 22 / x86_64 and macOS 13 / arm64 +if [ "$arch" != "x86_64" ] && [ "$arch" != "arm64" ] +then + echo "This script does not currently support systems where \`uname -m\` returns $arch." + exit 1 +fi + +docker run -u $(id -u ${USER}):$(id -g ${USER}) --rm -v`pwd`:/root/oqsprovider -w /root/oqsprovider openquantumsafe/ci-ubuntu-latest:latest ./scripts/do_code_format.sh --no-dry-run diff --git a/test/oqs_test_endecode.c b/test/oqs_test_endecode.c index 1427d121..583ed3e5 100644 --- a/test/oqs_test_endecode.c +++ b/test/oqs_test_endecode.c @@ -1,7 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 AND MIT -#include "oqs/oqs.h" -#include "test_common.h" #include #include #include @@ -12,6 +10,9 @@ #include #include +#include "oqs/oqs.h" +#include "test_common.h" + static OSSL_LIB_CTX *libctx = NULL; static char *modulename = NULL; static char *configfile = NULL; @@ -51,8 +52,7 @@ static ENDECODE_PARAMS test_params_list[] = { }; static EVP_PKEY *oqstest_make_key(const char *type, EVP_PKEY *template, - OSSL_PARAM *genparams) -{ + OSSL_PARAM *genparams) { EVP_PKEY *pkey = NULL; EVP_PKEY_CTX *ctx = NULL; @@ -69,25 +69,24 @@ static EVP_PKEY *oqstest_make_key(const char *type, EVP_PKEY *template, * No real need to check the errors other than for the cascade * effect. |pkey| will simply remain NULL if something goes wrong. */ - (void)(ctx != NULL && EVP_PKEY_keygen_init(ctx) > 0 - && (genparams == NULL || EVP_PKEY_CTX_set_params(ctx, genparams) > 0) - && EVP_PKEY_keygen(ctx, &pkey) > 0); + (void)(ctx != NULL && EVP_PKEY_keygen_init(ctx) > 0 && + (genparams == NULL || EVP_PKEY_CTX_set_params(ctx, genparams) > 0) && + EVP_PKEY_keygen(ctx, &pkey) > 0); EVP_PKEY_CTX_free(ctx); return pkey; } static int encode_EVP_PKEY_prov(const EVP_PKEY *pkey, const char *format, const char *structure, const char *pass, - const int selection, BUF_MEM **encoded) -{ + const int selection, BUF_MEM **encoded) { OSSL_ENCODER_CTX *ectx; BIO *mem_ser = NULL; BUF_MEM *mem_buf = NULL; const char *cipher = "AES-256-CBC"; int ok = 0; - ectx = OSSL_ENCODER_CTX_new_for_pkey(pkey, selection, format, structure, - NULL); + ectx = + OSSL_ENCODER_CTX_new_for_pkey(pkey, selection, format, structure, NULL); if (ectx == NULL) { printf("No suitable encoder found\n"); goto end; @@ -127,8 +126,7 @@ static int encode_EVP_PKEY_prov(const EVP_PKEY *pkey, const char *format, static int decode_EVP_PKEY_prov(const char *input_type, const char *structure, const char *pass, const char *keytype, const int selection, EVP_PKEY **object, - const void *encoded, const long encoded_len) -{ + const void *encoded, const long encoded_len) { EVP_PKEY *pkey = NULL; OSSL_DECODER_CTX *dctx = NULL; BIO *encoded_bio = NULL; @@ -165,8 +163,7 @@ static int decode_EVP_PKEY_prov(const char *input_type, const char *structure, return ok; } -static int test_oqs_encdec(const char *alg_name) -{ +static int test_oqs_encdec(const char *alg_name) { EVP_PKEY *pkey = NULL; EVP_PKEY *decoded_pkey = NULL; BUF_MEM *encoded = NULL; @@ -213,8 +210,7 @@ static int test_oqs_encdec(const char *alg_name) return ok; } -static int test_algs(const OSSL_ALGORITHM *algs) -{ +static int test_algs(const OSSL_ALGORITHM *algs) { int errcnt = 0; for (; algs->algorithm_names != NULL; algs++) { if (test_oqs_encdec(algs->algorithm_names)) { @@ -232,8 +228,7 @@ static int test_algs(const OSSL_ALGORITHM *algs) return errcnt; } -int main(int argc, char *argv[]) -{ +int main(int argc, char *argv[]) { size_t i; int errcnt = 0, test = 0, query_nocache; OSSL_PROVIDER *oqsprov = NULL; diff --git a/test/oqs_test_evp_pkey_params.c b/test/oqs_test_evp_pkey_params.c index 08ec9c6f..18ac883a 100644 --- a/test/oqs_test_evp_pkey_params.c +++ b/test/oqs_test_evp_pkey_params.c @@ -1,18 +1,17 @@ // SPDX-License-Identifier: Apache-2.0 AND MIT -#include "oqs_prov.h" -#include "test_common.h" - -#include -#include -#include -#include - #include #include #include #include #include +#include +#include +#include +#include + +#include "oqs_prov.h" +#include "test_common.h" ///// OQS_TEMPLATE_FRAGMENT_HYBRID_SIG_ALGS_START @@ -71,8 +70,7 @@ const char *kHybridKEMAlgorithms[] = { * \param s String to test. * * \return 1 if `s` is in `list`, else 0. */ -static int is_string_in_list(const char **list, const char *s) -{ +static int is_string_in_list(const char **list, const char *s) { for (; *list != NULL && strcmp(*list, s) != 0; ++list) ; if (*list != NULL) { @@ -86,7 +84,7 @@ static int is_string_in_list(const char **list, const char *s) * \param alg Algorithm name. * * \returns 1 if hybrid, else 0. */ -#define is_signature_algorithm_hybrid(_alg_) \ +#define is_signature_algorithm_hybrid(_alg_) \ is_string_in_list(kHybridSignatureAlgorithms, (_alg_)) /** \brief Indicates if an kem algorithm is hybrid or not. @@ -94,7 +92,7 @@ static int is_string_in_list(const char **list, const char *s) * \param alg Algorithm name. * * \returns 1 if hybrid, else 0. */ -#define is_kem_algorithm_hybrid(_alg_) \ +#define is_kem_algorithm_hybrid(_alg_) \ is_string_in_list(kHybridKEMAlgorithms, (_alg_)) /** \brief A pair of keys. */ @@ -119,8 +117,7 @@ struct KeyPair { /** \brief Frees the memory occupied by a KeyPair. * * \param kp Keypair to free. */ -static void keypair_free(struct KeyPair *kp) -{ +static void keypair_free(struct KeyPair *kp) { free(kp->pubkey); free(kp->privkey); } @@ -128,8 +125,7 @@ static void keypair_free(struct KeyPair *kp) /** \brief Initializes an OpenSSL top-level context. * * \returns The top-level context, or `NULL` if an error occurred. */ -static OSSL_LIB_CTX *init_openssl(void) -{ +static OSSL_LIB_CTX *init_openssl(void) { OSSL_LIB_CTX *ctx; if (!(ctx = OSSL_LIB_CTX_new())) { @@ -146,8 +142,7 @@ static OSSL_LIB_CTX *init_openssl(void) * \paran alg The algorithm to use. * * \returns The EVP_PKEY context, or `NULL` if an error occurred. */ -static EVP_PKEY_CTX *init_EVP_PKEY_CTX(OSSL_LIB_CTX *libctx, const char *alg) -{ +static EVP_PKEY_CTX *init_EVP_PKEY_CTX(OSSL_LIB_CTX *libctx, const char *alg) { EVP_PKEY_CTX *ctx; if (!(ctx = EVP_PKEY_CTX_new_from_name(libctx, alg, NULL))) { @@ -166,14 +161,13 @@ static EVP_PKEY_CTX *init_EVP_PKEY_CTX(OSSL_LIB_CTX *libctx, const char *alg) * \param ctx EVP_PKEY context. * * \returns 0 on success. */ -static int init_keygen(EVP_PKEY_CTX *ctx) -{ +static int init_keygen(EVP_PKEY_CTX *ctx) { int err; if ((err = EVP_PKEY_keygen_init(ctx)) == -2) { - fputs(cRED - "`EVP_PKEY_keygen_init` failed, couldn't initialize keygen: not " - "supported" cNORM "\n", + fputs(cRED "`EVP_PKEY_keygen_init` failed, couldn't initialize " + "keygen: not " + "supported" cNORM "\n", stderr); } else if (err <= 0) { fputs(cRED @@ -191,17 +185,14 @@ static int init_keygen(EVP_PKEY_CTX *ctx) * \param ctx EVP_PKEY context. * * \returns The private key, or `NULL` if an error occurred. */ -static EVP_PKEY *generate_private_key(EVP_PKEY_CTX *ctx) -{ +static EVP_PKEY *generate_private_key(EVP_PKEY_CTX *ctx) { EVP_PKEY *private_key = NULL; int err; if ((err = EVP_PKEY_generate(ctx, &private_key)) == -2) { - fputs( - cRED - "`EVP_PKEY_generate` failed, couldn't generate: not supported" cNORM - "\n", - stderr); + fputs(cRED "`EVP_PKEY_generate` failed, couldn't generate: not " + "supported" cNORM "\n", + stderr); } else if (err <= 0) { fputs(cRED "`EVP_PKEY_generate` failed, couldn't generate: ", stderr); ERR_print_errors_fp(stderr); @@ -220,14 +211,13 @@ static EVP_PKEY *generate_private_key(EVP_PKEY_CTX *ctx) * * \returns 0 on success. */ static int get_param_octet_string(const EVP_PKEY *key, const char *param_name, - uint8_t **buf, size_t *buf_len) -{ + uint8_t **buf, size_t *buf_len) { *buf = NULL; *buf_len = 0; int ret = -1; - if (EVP_PKEY_get_octet_string_param(key, param_name, NULL, 0, buf_len) - != 1) { + if (EVP_PKEY_get_octet_string_param(key, param_name, NULL, 0, buf_len) != + 1) { fprintf(stderr, cRED "`EVP_PKEY_get_octet_string_param` failed with param `%s`: ", @@ -241,8 +231,7 @@ static int get_param_octet_string(const EVP_PKEY *key, const char *param_name, goto out; } if (EVP_PKEY_get_octet_string_param(key, param_name, *buf, *buf_len, - buf_len) - != 1) { + buf_len) != 1) { fprintf(stderr, cRED "`EVP_PKEY_get_octet_string_param` failed with param `%s`: ", @@ -266,8 +255,7 @@ static int get_param_octet_string(const EVP_PKEY *key, const char *param_name, * * \returns 0 on success. */ static int private_key_params_get_classical_keys(const EVP_PKEY *private_key, - struct KeyPair *out) -{ + struct KeyPair *out) { int ret = -1; if (get_param_octet_string(private_key, @@ -297,8 +285,7 @@ static int private_key_params_get_classical_keys(const EVP_PKEY *private_key, * * \returns 0 on success. */ static int private_key_params_get_pq_keys(const EVP_PKEY *private_key, - struct KeyPair *out) -{ + struct KeyPair *out) { int ret = -1; if (get_param_octet_string(private_key, OQS_HYBRID_PKEY_PARAM_PQ_PUB_KEY, @@ -319,15 +306,15 @@ static int private_key_params_get_pq_keys(const EVP_PKEY *private_key, return ret; } -/** \brief Extracts the combination of classical+hybrid keys from an hybrid key. +/** \brief Extracts the combination of classical+hybrid keys from an hybrid + * key. * * \param private_key The private key. * \param[out] out Key pair where to write the keys. * * \returns 0 on success. */ static int private_key_params_get_full_keys(const EVP_PKEY *private_key, - struct KeyPair *out) -{ + struct KeyPair *out) { int ret = -1; if (get_param_octet_string(private_key, OSSL_PKEY_PARAM_PUB_KEY, @@ -361,8 +348,7 @@ static int private_key_params_get_full_keys(const EVP_PKEY *private_key, * \returns 0 on success. */ static int reconstitute_keys(const uint8_t *classical, const size_t classical_n, const uint8_t *pq, const size_t pq_n, - uint8_t **buf, size_t *buf_len) -{ + uint8_t **buf, size_t *buf_len) { uint32_t header; int ret = -1; @@ -394,8 +380,7 @@ static int reconstitute_keys(const uint8_t *classical, const size_t classical_n, * \returns 0 on success. */ static int keypairs_verify_consistency(const struct KeyPair *classical, const struct KeyPair *pq, - const struct KeyPair *comb) -{ + const struct KeyPair *comb) { uint8_t *reconstitution; size_t n; int ret = -1; @@ -405,12 +390,10 @@ static int keypairs_verify_consistency(const struct KeyPair *classical, goto out; } if (n != comb->pubkey_len) { - fprintf( - stderr, - cRED - "expected %#zx byte(s) for reconstitution of pubkey, got %#zx" cNORM - "\n", - comb->pubkey_len, n); + fprintf(stderr, + cRED "expected %#zx byte(s) for reconstitution of " + "pubkey, got %#zx" cNORM "\n", + comb->pubkey_len, n); goto free_reconstitute; } if (memcmp(reconstitution, comb->pubkey, n)) { @@ -429,10 +412,10 @@ static int keypairs_verify_consistency(const struct KeyPair *classical, goto out; } if (n != comb->privkey_len) { - fprintf( - stderr, - "expected %#zx byte(s) for reconstitution of privkey, got %#zx\n", - comb->privkey_len, n); + fprintf(stderr, + "expected %#zx byte(s) for reconstitution of privkey, " + "got %#zx\n", + comb->privkey_len, n); goto free_reconstitute; } if (memcmp(reconstitution, comb->privkey, n)) { @@ -459,8 +442,7 @@ static int keypairs_verify_consistency(const struct KeyPair *classical, * \param algname Algorithm name. * * \returns 0 on success. */ -static int test_algorithm(OSSL_LIB_CTX *libctx, const char *algname) -{ +static int test_algorithm(OSSL_LIB_CTX *libctx, const char *algname) { EVP_PKEY_CTX *evp_pkey_ctx; EVP_PKEY *private_key; struct KeyPair classical_keypair; @@ -516,8 +498,7 @@ static int test_algorithm(OSSL_LIB_CTX *libctx, const char *algname) return ret; } -int main(int argc, char **argv) -{ +int main(int argc, char **argv) { OSSL_LIB_CTX *libctx; OSSL_PROVIDER *default_provider; OSSL_PROVIDER *oqs_provider; diff --git a/test/oqs_test_groups.c b/test/oqs_test_groups.c index 171d2b44..cb1485ab 100644 --- a/test/oqs_test_groups.c +++ b/test/oqs_test_groups.c @@ -1,12 +1,13 @@ // SPDX-License-Identifier: Apache-2.0 AND MIT -#include "test_common.h" -#include "tlstest_helpers.h" #include #include #include #include +#include "test_common.h" +#include "tlstest_helpers.h" + static OSSL_LIB_CTX *libctx = NULL; static char *modulename = NULL; static char *configfile = NULL; @@ -14,8 +15,7 @@ static char *cert = NULL; static char *privkey = NULL; static char *certsdir = NULL; -char *test_mk_file_path(const char *dir, const char *file) -{ +char *test_mk_file_path(const char *dir, const char *file) { #ifndef OPENSSL_SYS_VMS const char *sep = "/"; #else @@ -33,8 +33,7 @@ char *test_mk_file_path(const char *dir, const char *file) return full_file; } -static int test_oqs_groups(const char *group_name) -{ +static int test_oqs_groups(const char *group_name) { SSL_CTX *cctx = NULL, *sctx = NULL; SSL *clientssl = NULL, *serverssl = NULL; int ret = 1, testresult = 0; @@ -83,12 +82,11 @@ static int test_oqs_groups(const char *group_name) return ret; } -static int test_group(const OSSL_PARAM params[], void *data) -{ +static int test_group(const OSSL_PARAM params[], void *data) { int ret = 1; int *errcnt = (int *)data; - const OSSL_PARAM *p - = OSSL_PARAM_locate_const(params, OSSL_CAPABILITY_TLS_GROUP_NAME); + const OSSL_PARAM *p = + OSSL_PARAM_locate_const(params, OSSL_CAPABILITY_TLS_GROUP_NAME); if (p == NULL || p->data_type != OSSL_PARAM_UTF8_STRING) { ret = -1; goto err; @@ -117,8 +115,7 @@ static int test_group(const OSSL_PARAM params[], void *data) return ret; } -static int test_provider_groups(OSSL_PROVIDER *provider, void *vctx) -{ +static int test_provider_groups(OSSL_PROVIDER *provider, void *vctx) { const char *provname = OSSL_PROVIDER_get0_name(provider); if (!strcmp(provname, PROVIDER_NAME_OQS)) @@ -128,8 +125,7 @@ static int test_provider_groups(OSSL_PROVIDER *provider, void *vctx) return 1; } -int main(int argc, char *argv[]) -{ +int main(int argc, char *argv[]) { size_t i; int errcnt = 0, test = 0; diff --git a/test/oqs_test_kems.c b/test/oqs_test_kems.c index 4b734aa9..9797776e 100644 --- a/test/oqs_test_kems.c +++ b/test/oqs_test_kems.c @@ -1,17 +1,17 @@ // SPDX-License-Identifier: Apache-2.0 AND MIT -#include "oqs/oqs.h" -#include "test_common.h" #include #include #include +#include "oqs/oqs.h" +#include "test_common.h" + static OSSL_LIB_CTX *libctx = NULL; static char *modulename = NULL; static char *configfile = NULL; -static int test_oqs_kems(const char *kemalg_name) -{ +static int test_oqs_kems(const char *kemalg_name) { EVP_MD_CTX *mdctx = NULL; EVP_PKEY_CTX *ctx = NULL; EVP_PKEY *key = NULL; @@ -27,41 +27,41 @@ static int test_oqs_kems(const char *kemalg_name) return 1; } // test with built-in digest only if default provider is active: - // TBD revisit when hybrids are activated: They always need default provider + // TBD revisit when hybrids are activated: They always need default + // provider if (OSSL_PROVIDER_available(libctx, "default")) { - testresult - &= (ctx = EVP_PKEY_CTX_new_from_name(libctx, kemalg_name, NULL)) - != NULL - && EVP_PKEY_keygen_init(ctx) && EVP_PKEY_generate(ctx, &key); + testresult &= (ctx = EVP_PKEY_CTX_new_from_name(libctx, kemalg_name, + NULL)) != NULL && + EVP_PKEY_keygen_init(ctx) && EVP_PKEY_generate(ctx, &key); if (!testresult) goto err; EVP_PKEY_CTX_free(ctx); ctx = NULL; - testresult - &= (ctx = EVP_PKEY_CTX_new_from_pkey(libctx, key, NULL)) != NULL - && EVP_PKEY_encapsulate_init(ctx, NULL) - && EVP_PKEY_encapsulate(ctx, NULL, &outlen, NULL, &seclen) - && (out = OPENSSL_malloc(outlen)) != NULL - && (secenc = OPENSSL_malloc(seclen)) != NULL - && memset(secenc, 0x11, seclen) != NULL - && (secdec = OPENSSL_malloc(seclen)) != NULL - && memset(secdec, 0xff, seclen) != NULL - && EVP_PKEY_encapsulate(ctx, out, &outlen, secenc, &seclen) - && EVP_PKEY_decapsulate_init(ctx, NULL) - && EVP_PKEY_decapsulate(ctx, secdec, &seclen, out, outlen) - && memcmp(secenc, secdec, seclen) == 0; + testresult &= + (ctx = EVP_PKEY_CTX_new_from_pkey(libctx, key, NULL)) != NULL && + EVP_PKEY_encapsulate_init(ctx, NULL) && + EVP_PKEY_encapsulate(ctx, NULL, &outlen, NULL, &seclen) && + (out = OPENSSL_malloc(outlen)) != NULL && + (secenc = OPENSSL_malloc(seclen)) != NULL && + memset(secenc, 0x11, seclen) != NULL && + (secdec = OPENSSL_malloc(seclen)) != NULL && + memset(secdec, 0xff, seclen) != NULL && + EVP_PKEY_encapsulate(ctx, out, &outlen, secenc, &seclen) && + EVP_PKEY_decapsulate_init(ctx, NULL) && + EVP_PKEY_decapsulate(ctx, secdec, &seclen, out, outlen) && + memcmp(secenc, secdec, seclen) == 0; if (!testresult) goto err; out[0] = ~out[0]; out[outlen - 1] = ~out[outlen - 1]; - testresult - &= memset(secdec, 0xff, seclen) != NULL - && EVP_PKEY_decapsulate_init(ctx, NULL) - && (EVP_PKEY_decapsulate(ctx, secdec, &seclen, out, outlen) || 1) - && memcmp(secenc, secdec, seclen) != 0; + testresult &= + memset(secdec, 0xff, seclen) != NULL && + EVP_PKEY_decapsulate_init(ctx, NULL) && + (EVP_PKEY_decapsulate(ctx, secdec, &seclen, out, outlen) || 1) && + memcmp(secenc, secdec, seclen) != 0; } err: @@ -75,8 +75,7 @@ static int test_oqs_kems(const char *kemalg_name) #define nelem(a) (sizeof(a) / sizeof((a)[0])) -int main(int argc, char *argv[]) -{ +int main(int argc, char *argv[]) { size_t i; int errcnt = 0, test = 0, query_nocache; OSSL_PROVIDER *oqsprov = NULL; @@ -91,8 +90,8 @@ int main(int argc, char *argv[]) oqsprov = OSSL_PROVIDER_load(libctx, modulename); - kemalgs - = OSSL_PROVIDER_query_operation(oqsprov, OSSL_OP_KEM, &query_nocache); + kemalgs = + OSSL_PROVIDER_query_operation(oqsprov, OSSL_OP_KEM, &query_nocache); if (kemalgs) { for (; kemalgs->algorithm_names != NULL; kemalgs++) { if (test_oqs_kems(kemalgs->algorithm_names)) { diff --git a/test/oqs_test_signatures.c b/test/oqs_test_signatures.c index b1137839..47c8728e 100644 --- a/test/oqs_test_signatures.c +++ b/test/oqs_test_signatures.c @@ -1,10 +1,11 @@ // SPDX-License-Identifier: Apache-2.0 AND MIT -#include "oqs/oqs.h" -#include "test_common.h" #include #include +#include "oqs/oqs.h" +#include "test_common.h" + static OSSL_LIB_CTX *libctx = NULL; static char *modulename = NULL; static char *configfile = NULL; @@ -15,8 +16,7 @@ static char *srpvfile = NULL; static char *tmpfilename = NULL; // sign-and-hash must work with and without providing a digest algorithm -static int test_oqs_signatures(const char *sigalg_name) -{ +static int test_oqs_signatures(const char *sigalg_name) { EVP_MD_CTX *mdctx = NULL; EVP_PKEY_CTX *ctx = NULL; EVP_PKEY *key = NULL; @@ -31,28 +31,29 @@ static int test_oqs_signatures(const char *sigalg_name) return 1; } // test with built-in digest only if default provider is active: - // TBD revisit when hybrids are activated: They always need default provider + // TBD revisit when hybrids are activated: They always need default + // provider if (OSSL_PROVIDER_available(libctx, "default")) { - testresult - &= (ctx = EVP_PKEY_CTX_new_from_name(libctx, sigalg_name, NULL)) - != NULL - && EVP_PKEY_keygen_init(ctx) && EVP_PKEY_generate(ctx, &key) - && (mdctx = EVP_MD_CTX_new()) != NULL - && EVP_DigestSignInit_ex(mdctx, NULL, "SHA512", libctx, NULL, - key, NULL) - && EVP_DigestSignUpdate(mdctx, msg, sizeof(msg)) - && EVP_DigestSignFinal(mdctx, NULL, &siglen) - && (sig = OPENSSL_malloc(siglen)) != NULL - && EVP_DigestSignFinal(mdctx, sig, &siglen) - && EVP_DigestVerifyInit_ex(mdctx, NULL, "SHA512", libctx, NULL, - key, NULL) - && EVP_DigestVerifyUpdate(mdctx, msg, sizeof(msg)) - && EVP_DigestVerifyFinal(mdctx, sig, siglen); + testresult &= + (ctx = EVP_PKEY_CTX_new_from_name(libctx, sigalg_name, NULL)) != + NULL && + EVP_PKEY_keygen_init(ctx) && EVP_PKEY_generate(ctx, &key) && + (mdctx = EVP_MD_CTX_new()) != NULL && + EVP_DigestSignInit_ex(mdctx, NULL, "SHA512", libctx, NULL, key, + NULL) && + EVP_DigestSignUpdate(mdctx, msg, sizeof(msg)) && + EVP_DigestSignFinal(mdctx, NULL, &siglen) && + (sig = OPENSSL_malloc(siglen)) != NULL && + EVP_DigestSignFinal(mdctx, sig, &siglen) && + EVP_DigestVerifyInit_ex(mdctx, NULL, "SHA512", libctx, NULL, key, + NULL) && + EVP_DigestVerifyUpdate(mdctx, msg, sizeof(msg)) && + EVP_DigestVerifyFinal(mdctx, sig, siglen); sig[0] = ~sig[0]; testresult &= EVP_DigestVerifyInit_ex(mdctx, NULL, "SHA512", libctx, - NULL, key, NULL) - && EVP_DigestVerifyUpdate(mdctx, msg, sizeof(msg)) - && !EVP_DigestVerifyFinal(mdctx, sig, siglen); + NULL, key, NULL) && + EVP_DigestVerifyUpdate(mdctx, msg, sizeof(msg)) && + !EVP_DigestVerifyFinal(mdctx, sig, siglen); } EVP_MD_CTX_free(mdctx); @@ -63,24 +64,23 @@ static int test_oqs_signatures(const char *sigalg_name) key = NULL; // this test must work also with default provider inactive: - testresult - &= (ctx = EVP_PKEY_CTX_new_from_name(libctx, sigalg_name, NULL)) != NULL - && EVP_PKEY_keygen_init(ctx) && EVP_PKEY_generate(ctx, &key) - && (mdctx = EVP_MD_CTX_new()) != NULL - && EVP_DigestSignInit_ex(mdctx, NULL, NULL, libctx, NULL, key, NULL) - && EVP_DigestSignUpdate(mdctx, msg, sizeof(msg)) - && EVP_DigestSignFinal(mdctx, NULL, &siglen) - && (sig = OPENSSL_malloc(siglen)) != NULL - && EVP_DigestSignFinal(mdctx, sig, &siglen) - && EVP_DigestVerifyInit_ex(mdctx, NULL, NULL, libctx, NULL, key, - NULL) - && EVP_DigestVerifyUpdate(mdctx, msg, sizeof(msg)) - && EVP_DigestVerifyFinal(mdctx, sig, siglen); + testresult &= + (ctx = EVP_PKEY_CTX_new_from_name(libctx, sigalg_name, NULL)) != NULL && + EVP_PKEY_keygen_init(ctx) && EVP_PKEY_generate(ctx, &key) && + (mdctx = EVP_MD_CTX_new()) != NULL && + EVP_DigestSignInit_ex(mdctx, NULL, NULL, libctx, NULL, key, NULL) && + EVP_DigestSignUpdate(mdctx, msg, sizeof(msg)) && + EVP_DigestSignFinal(mdctx, NULL, &siglen) && + (sig = OPENSSL_malloc(siglen)) != NULL && + EVP_DigestSignFinal(mdctx, sig, &siglen) && + EVP_DigestVerifyInit_ex(mdctx, NULL, NULL, libctx, NULL, key, NULL) && + EVP_DigestVerifyUpdate(mdctx, msg, sizeof(msg)) && + EVP_DigestVerifyFinal(mdctx, sig, siglen); sig[0] = ~sig[0]; - testresult - &= EVP_DigestVerifyInit_ex(mdctx, NULL, NULL, libctx, NULL, key, NULL) - && EVP_DigestVerifyUpdate(mdctx, msg, sizeof(msg)) - && !EVP_DigestVerifyFinal(mdctx, sig, siglen); + testresult &= + EVP_DigestVerifyInit_ex(mdctx, NULL, NULL, libctx, NULL, key, NULL) && + EVP_DigestVerifyUpdate(mdctx, msg, sizeof(msg)) && + !EVP_DigestVerifyFinal(mdctx, sig, siglen); EVP_MD_CTX_free(mdctx); EVP_PKEY_free(key); @@ -91,8 +91,7 @@ static int test_oqs_signatures(const char *sigalg_name) #define nelem(a) (sizeof(a) / sizeof((a)[0])) -int main(int argc, char *argv[]) -{ +int main(int argc, char *argv[]) { size_t i; int errcnt = 0, test = 0, query_nocache; OSSL_PROVIDER *oqsprov = NULL; diff --git a/test/oqs_test_tlssig.c b/test/oqs_test_tlssig.c index a735570a..5e653f56 100644 --- a/test/oqs_test_tlssig.c +++ b/test/oqs_test_tlssig.c @@ -1,36 +1,34 @@ // SPDX-License-Identifier: Apache-2.0 AND MIT -#include "test_common.h" -#include "tlstest_helpers.h" +#include #include #include #include -#include - #include - -#include +#include #include #include +#include "test_common.h" +#include "tlstest_helpers.h" + static OSSL_LIB_CTX *libctx = NULL; static char *modulename = NULL; static char *configfile = NULL; static char *certsdir = NULL; #ifdef OSSL_CAPABILITY_TLS_SIGALG_NAME -static int test_oqs_tlssig(const char *sig_name) -{ +static int test_oqs_tlssig(const char *sig_name) { SSL_CTX *cctx = NULL, *sctx = NULL; SSL *clientssl = NULL, *serverssl = NULL; int ret = 1, testresult = 0; char certpath[300]; char privkeypath[300]; -# ifndef OPENSSL_SYS_VMS +#ifndef OPENSSL_SYS_VMS const char *sep = "/"; -# else +#else const char *sep = ""; -# endif +#endif if (!alg_is_enabled(sig_name)) { printf("Not testing disabled algorithm %s.\n", sig_name); @@ -55,8 +53,8 @@ static int test_oqs_tlssig(const char *sig_name) goto err; } - testresult - = create_tls1_3_ctx_pair(libctx, &sctx, &cctx, certpath, privkeypath); + testresult = + create_tls1_3_ctx_pair(libctx, &sctx, &cctx, certpath, privkeypath); if (!testresult) { ret = -1; @@ -95,12 +93,11 @@ EVP_SIGNATURE_get0_name(evpsig)); } */ -static int test_signature(const OSSL_PARAM params[], void *data) -{ +static int test_signature(const OSSL_PARAM params[], void *data) { int ret = 0; int *errcnt = (int *)data; - const OSSL_PARAM *p - = OSSL_PARAM_locate_const(params, OSSL_CAPABILITY_TLS_SIGALG_NAME); + const OSSL_PARAM *p = + OSSL_PARAM_locate_const(params, OSSL_CAPABILITY_TLS_SIGALG_NAME); if (p == NULL || p->data_type != OSSL_PARAM_UTF8_STRING) { ret = -1; @@ -133,8 +130,7 @@ static int test_signature(const OSSL_PARAM params[], void *data) return ret; } -static int test_provider_signatures(OSSL_PROVIDER *provider, void *vctx) -{ +static int test_provider_signatures(OSSL_PROVIDER *provider, void *vctx) { const char *provname = OSSL_PROVIDER_get0_name(provider); if (!strcmp(provname, PROVIDER_NAME_OQS)) @@ -145,8 +141,7 @@ static int test_provider_signatures(OSSL_PROVIDER *provider, void *vctx) } #endif /* OSSL_CAPABILITY_TLS_SIGALG_NAME */ -int main(int argc, char *argv[]) -{ +int main(int argc, char *argv[]) { size_t i; int errcnt = 0, test = 0; @@ -171,9 +166,9 @@ int main(int argc, char *argv[]) // crashes: EVP_SIGNATURE_do_all_provided(libctx, test_oqs_sigs, &errcnt); OSSL_PROVIDER_do_all(libctx, test_provider_signatures, &errcnt); #else - fprintf( - stderr, - "TLS-SIG handshake test not enabled. Update OpenSSL to more current version.\n"); + fprintf(stderr, + "TLS-SIG handshake test not enabled. Update OpenSSL to more " + "current version.\n"); #endif OSSL_LIB_CTX_free(libctx); diff --git a/test/test_common.c b/test/test_common.c index cee953d9..645b2839 100644 --- a/test/test_common.c +++ b/test/test_common.c @@ -1,10 +1,10 @@ // SPDX-License-Identifier: Apache-2.0 AND MIT #include "test_common.h" + #include -void hexdump(const void *ptr, size_t len) -{ +void hexdump(const void *ptr, size_t len) { const unsigned char *p = ptr; size_t i, j; @@ -16,8 +16,7 @@ void hexdump(const void *ptr, size_t len) } #define MIN(X, Y) (((X) < (Y)) ? (X) : (Y)) -int alg_is_enabled(const char *algname) -{ +int alg_is_enabled(const char *algname) { char *alglist = getenv("OQS_SKIP_TESTS"); char *comma = NULL; char totest[200]; @@ -35,25 +34,23 @@ int alg_is_enabled(const char *algname) return strstr(algname, alglist) == NULL; } -OSSL_PROVIDER *load_default_provider(OSSL_LIB_CTX *libctx) -{ +OSSL_PROVIDER *load_default_provider(OSSL_LIB_CTX *libctx) { OSSL_PROVIDER *provider; T((provider = OSSL_PROVIDER_load(libctx, "default"))); return provider; } #ifdef OQS_PROVIDER_STATIC -# define OQS_PROVIDER_ENTRYPOINT_NAME oqs_provider_init +#define OQS_PROVIDER_ENTRYPOINT_NAME oqs_provider_init #else -# define OQS_PROVIDER_ENTRYPOINT_NAME OSSL_provider_init +#define OQS_PROVIDER_ENTRYPOINT_NAME OSSL_provider_init #endif // ifdef OQS_PROVIDER_STATIC #ifndef OQS_PROVIDER_STATIC /* Loads the oqs-provider from a shared module (.so). */ void load_oqs_provider(OSSL_LIB_CTX *libctx, const char *modulename, - const char *configfile) -{ + const char *configfile) { T(OSSL_LIB_CTX_load_config(libctx, configfile)); T(OSSL_PROVIDER_available(libctx, modulename)); } @@ -64,8 +61,7 @@ extern OSSL_provider_init_fn OQS_PROVIDER_ENTRYPOINT_NAME; /* Loads the statically linked oqs-provider. */ void load_oqs_provider(OSSL_LIB_CTX *libctx, const char *modulename, - const char *configfile) -{ + const char *configfile) { (void)configfile; T(OSSL_PROVIDER_add_builtin(libctx, modulename, OQS_PROVIDER_ENTRYPOINT_NAME)); diff --git a/test/test_common.h b/test/test_common.h index 5cb9161d..b7aa76ff 100644 --- a/test/test_common.h +++ b/test/test_common.h @@ -5,32 +5,32 @@ #include /* For controlled success */ -#define T(e) \ - if (!(e)) { \ - ERR_print_errors_fp(stderr); \ - OPENSSL_die(#e, __FILE__, __LINE__); \ +#define T(e) \ + if (!(e)) { \ + ERR_print_errors_fp(stderr); \ + OPENSSL_die(#e, __FILE__, __LINE__); \ } /* For controlled failure */ -#define TF(e) \ - if ((e)) { \ - ERR_print_errors_fp(stderr); \ - } else { \ - OPENSSL_die(#e, __FILE__, __LINE__); \ +#define TF(e) \ + if ((e)) { \ + ERR_print_errors_fp(stderr); \ + } else { \ + OPENSSL_die(#e, __FILE__, __LINE__); \ } -#define cRED "\033[1;31m" -#define cDRED "\033[0;31m" -#define cGREEN "\033[1;32m" -#define cDGREEN "\033[0;32m" -#define cBLUE "\033[1;34m" -#define cDBLUE "\033[0;34m" -#define cNORM "\033[m" +#define cRED "\033[1;31m" +#define cDRED "\033[0;31m" +#define cGREEN "\033[1;32m" +#define cDGREEN "\033[0;32m" +#define cBLUE "\033[1;34m" +#define cDBLUE "\033[0;34m" +#define cNORM "\033[m" #define PROVIDER_NAME_OQS "oqsprovider" -#define TEST_ASSERT(e) \ - { \ - if (!(test = (e))) \ - printf(cRED " Test FAILED" cNORM "\n"); \ - else \ - printf(cGREEN " Test passed" cNORM "\n"); \ +#define TEST_ASSERT(e) \ + { \ + if (!(test = (e))) \ + printf(cRED " Test FAILED" cNORM "\n"); \ + else \ + printf(cGREEN " Test passed" cNORM "\n"); \ } void hexdump(const void *ptr, size_t len); diff --git a/test/tlstest_helpers.c b/test/tlstest_helpers.c index c2490887..047d45f5 100644 --- a/test/tlstest_helpers.c +++ b/test/tlstest_helpers.c @@ -6,8 +6,7 @@ /* Stolen from openssl/tests/sslapitest.c: */ int create_cert_key(OSSL_LIB_CTX *libctx, char *algname, char *certfilename, - char *privkeyfilename) -{ + char *privkeyfilename) { EVP_PKEY_CTX *evpctx = EVP_PKEY_CTX_new_from_name(libctx, algname, NULL); EVP_PKEY *pkey = NULL; X509 *x509 = X509_new(); @@ -15,24 +14,24 @@ int create_cert_key(OSSL_LIB_CTX *libctx, char *algname, char *certfilename, BIO *keybio = NULL, *certbio = NULL; int ret = 1; - if (!evpctx || !EVP_PKEY_keygen_init(evpctx) - || !EVP_PKEY_generate(evpctx, &pkey) || !pkey || !x509 - || !ASN1_INTEGER_set(X509_get_serialNumber(x509), 1) - || !X509_gmtime_adj(X509_getm_notBefore(x509), 0) - || !X509_gmtime_adj(X509_getm_notAfter(x509), 31536000L) - || !X509_set_pubkey(x509, pkey) || !(name = X509_get_subject_name(x509)) - || !X509_NAME_add_entry_by_txt(name, "C", MBSTRING_ASC, - (unsigned char *)"CH", -1, -1, 0) - || !X509_NAME_add_entry_by_txt(name, "O", MBSTRING_ASC, - (unsigned char *)"test.org", -1, -1, 0) - || !X509_NAME_add_entry_by_txt(name, "CN", MBSTRING_ASC, - (unsigned char *)"localhost", -1, -1, 0) - || !X509_set_issuer_name(x509, name) - || !X509_sign(x509, pkey, EVP_sha1()) - || !(keybio = BIO_new_file(privkeyfilename, "wb")) - || !PEM_write_bio_PrivateKey(keybio, pkey, NULL, NULL, 0, NULL, NULL) - || !(certbio = BIO_new_file(certfilename, "wb")) - || !PEM_write_bio_X509(certbio, x509)) + if (!evpctx || !EVP_PKEY_keygen_init(evpctx) || + !EVP_PKEY_generate(evpctx, &pkey) || !pkey || !x509 || + !ASN1_INTEGER_set(X509_get_serialNumber(x509), 1) || + !X509_gmtime_adj(X509_getm_notBefore(x509), 0) || + !X509_gmtime_adj(X509_getm_notAfter(x509), 31536000L) || + !X509_set_pubkey(x509, pkey) || !(name = X509_get_subject_name(x509)) || + !X509_NAME_add_entry_by_txt(name, "C", MBSTRING_ASC, + (unsigned char *)"CH", -1, -1, 0) || + !X509_NAME_add_entry_by_txt(name, "O", MBSTRING_ASC, + (unsigned char *)"test.org", -1, -1, 0) || + !X509_NAME_add_entry_by_txt(name, "CN", MBSTRING_ASC, + (unsigned char *)"localhost", -1, -1, 0) || + !X509_set_issuer_name(x509, name) || + !X509_sign(x509, pkey, EVP_sha1()) || + !(keybio = BIO_new_file(privkeyfilename, "wb")) || + !PEM_write_bio_PrivateKey(keybio, pkey, NULL, NULL, 0, NULL, NULL) || + !(certbio = BIO_new_file(certfilename, "wb")) || + !PEM_write_bio_X509(certbio, x509)) ret = 0; EVP_PKEY_free(pkey); @@ -44,8 +43,7 @@ int create_cert_key(OSSL_LIB_CTX *libctx, char *algname, char *certfilename, } /* end steal */ int create_tls1_3_ctx_pair(OSSL_LIB_CTX *libctx, SSL_CTX **sctx, SSL_CTX **cctx, - char *certfile, char *privkeyfile) -{ + char *certfile, char *privkeyfile) { SSL_CTX *serverctx = NULL, *clientctx = NULL; if (sctx == NULL || cctx == NULL) @@ -83,8 +81,7 @@ int create_tls1_3_ctx_pair(OSSL_LIB_CTX *libctx, SSL_CTX **sctx, SSL_CTX **cctx, } int create_tls_objects(SSL_CTX *serverctx, SSL_CTX *clientctx, SSL **sssl, - SSL **cssl) -{ + SSL **cssl) { SSL *serverssl = NULL, *clientssl = NULL; BIO *s_to_c_bio = NULL, *c_to_s_bio = NULL; @@ -134,8 +131,7 @@ int create_tls_objects(SSL_CTX *serverctx, SSL_CTX *clientctx, SSL **sssl, * attempt could be restarted by a subsequent call to this function. */ int create_bare_tls_connection(SSL *serverssl, SSL *clientssl, int want, - int read) -{ + int read) { int retc = -1, rets = -1, err, abortctr = 0; int clienterr = 0, servererr = 0; @@ -166,8 +162,8 @@ int create_bare_tls_connection(SSL *serverssl, SSL *clientssl, int want, err = SSL_get_error(serverssl, rets); } - if (!servererr && rets <= 0 && err != SSL_ERROR_WANT_READ - && err != SSL_ERROR_WANT_X509_LOOKUP) { + if (!servererr && rets <= 0 && err != SSL_ERROR_WANT_READ && + err != SSL_ERROR_WANT_X509_LOOKUP) { fprintf(stderr, "SSL_accept() failed returning %d, SSL error %d.\n", rets, err); ERR_print_errors_fp(stderr); @@ -184,7 +180,6 @@ int create_bare_tls_connection(SSL *serverssl, SSL *clientssl, int want, fprintf(stderr, "No progress made"); return 0; } - } while (retc <= 0 || rets <= 0); return 1; @@ -194,8 +189,7 @@ int create_bare_tls_connection(SSL *serverssl, SSL *clientssl, int want, * Create an SSL connection including any post handshake NewSessionTicket * messages. */ -int create_tls_connection(SSL *serverssl, SSL *clientssl, int want) -{ +int create_tls_connection(SSL *serverssl, SSL *clientssl, int want) { int i; unsigned char buf; size_t readbytes;