Skip to content

Commit

Permalink
using OpenSSL coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
feventura committed Dec 19, 2023
1 parent 2f5b55f commit c67fec0
Show file tree
Hide file tree
Showing 9 changed files with 4,162 additions and 2,289 deletions.
167 changes: 110 additions & 57 deletions oqsprov/oqs_decode_der2key.c

Large diffs are not rendered by default.

539 changes: 272 additions & 267 deletions oqsprov/oqs_encode_key2any.c

Large diffs are not rendered by default.

296 changes: 204 additions & 92 deletions oqsprov/oqs_kmgmt.c

Large diffs are not rendered by default.

1,965 changes: 1,370 additions & 595 deletions oqsprov/oqs_prov.h

Large diffs are not rendered by default.

444 changes: 293 additions & 151 deletions oqsprov/oqsdecoders.inc

Large diffs are not rendered by default.

1,555 changes: 956 additions & 599 deletions oqsprov/oqsencoders.inc

Large diffs are not rendered by default.

798 changes: 540 additions & 258 deletions oqsprov/oqsprov.c

Large diffs are not rendered by default.

494 changes: 312 additions & 182 deletions oqsprov/oqsprov_capabilities.c

Large diffs are not rendered by default.

193 changes: 105 additions & 88 deletions oqsprov/oqsprov_keys.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,103 +53,120 @@ 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 81
# define NID_TABLE_LEN 81
#else
#define NID_TABLE_LEN 39
# define NID_TABLE_LEN 39
#endif

static oqs_nid_name_t nid_names[NID_TABLE_LEN] = {
#ifdef OQS_KEM_ENCODERS

{ 0, "frodo640aes", OQS_KEM_alg_frodokem_640_aes, KEY_TYPE_KEM, 128 },
{ 0, "p256_frodo640aes", OQS_KEM_alg_frodokem_640_aes, KEY_TYPE_ECP_HYB_KEM , 128 },
{ 0, "x25519_frodo640aes", OQS_KEM_alg_frodokem_640_aes, KEY_TYPE_ECX_HYB_KEM , 128 },
{ 0, "frodo640shake", OQS_KEM_alg_frodokem_640_shake, KEY_TYPE_KEM, 128 },
{ 0, "p256_frodo640shake", OQS_KEM_alg_frodokem_640_shake, KEY_TYPE_ECP_HYB_KEM , 128 },
{ 0, "x25519_frodo640shake", OQS_KEM_alg_frodokem_640_shake, KEY_TYPE_ECX_HYB_KEM , 128 },
{ 0, "frodo976aes", OQS_KEM_alg_frodokem_976_aes, KEY_TYPE_KEM, 192 },
{ 0, "p384_frodo976aes", OQS_KEM_alg_frodokem_976_aes, KEY_TYPE_ECP_HYB_KEM , 192 },
{ 0, "x448_frodo976aes", OQS_KEM_alg_frodokem_976_aes, KEY_TYPE_ECX_HYB_KEM , 192 },
{ 0, "frodo976shake", OQS_KEM_alg_frodokem_976_shake, KEY_TYPE_KEM, 192 },
{ 0, "p384_frodo976shake", OQS_KEM_alg_frodokem_976_shake, KEY_TYPE_ECP_HYB_KEM , 192 },
{ 0, "x448_frodo976shake", OQS_KEM_alg_frodokem_976_shake, KEY_TYPE_ECX_HYB_KEM , 192 },
{ 0, "frodo1344aes", OQS_KEM_alg_frodokem_1344_aes, KEY_TYPE_KEM, 256 },
{ 0, "p521_frodo1344aes", OQS_KEM_alg_frodokem_1344_aes, KEY_TYPE_ECP_HYB_KEM , 256 },
{ 0, "frodo1344shake", OQS_KEM_alg_frodokem_1344_shake, KEY_TYPE_KEM, 256 },
{ 0, "p521_frodo1344shake", OQS_KEM_alg_frodokem_1344_shake, KEY_TYPE_ECP_HYB_KEM , 256 },
{ 0, "kyber512", OQS_KEM_alg_kyber_512, KEY_TYPE_KEM, 128 },
{ 0, "p256_kyber512", OQS_KEM_alg_kyber_512, KEY_TYPE_ECP_HYB_KEM , 128 },
{ 0, "x25519_kyber512", OQS_KEM_alg_kyber_512, KEY_TYPE_ECX_HYB_KEM , 128 },
{ 0, "kyber768", OQS_KEM_alg_kyber_768, KEY_TYPE_KEM, 192 },
{ 0, "p384_kyber768", OQS_KEM_alg_kyber_768, KEY_TYPE_ECP_HYB_KEM , 192 },
{ 0, "x448_kyber768", OQS_KEM_alg_kyber_768, KEY_TYPE_ECX_HYB_KEM , 192 },
{ 0, "x25519_kyber768", OQS_KEM_alg_kyber_768, KEY_TYPE_ECX_HYB_KEM , 192 },
{ 0, "p256_kyber768", OQS_KEM_alg_kyber_768, KEY_TYPE_ECP_HYB_KEM , 192 },
{ 0, "kyber1024", OQS_KEM_alg_kyber_1024, KEY_TYPE_KEM, 256 },
{ 0, "p521_kyber1024", OQS_KEM_alg_kyber_1024, KEY_TYPE_ECP_HYB_KEM , 256 },
{ 0, "bikel1", OQS_KEM_alg_bike_l1, KEY_TYPE_KEM, 128 },
{ 0, "p256_bikel1", OQS_KEM_alg_bike_l1, KEY_TYPE_ECP_HYB_KEM , 128 },
{ 0, "x25519_bikel1", OQS_KEM_alg_bike_l1, KEY_TYPE_ECX_HYB_KEM , 128 },
{ 0, "bikel3", OQS_KEM_alg_bike_l3, KEY_TYPE_KEM, 192 },
{ 0, "p384_bikel3", OQS_KEM_alg_bike_l3, KEY_TYPE_ECP_HYB_KEM , 192 },
{ 0, "x448_bikel3", OQS_KEM_alg_bike_l3, KEY_TYPE_ECX_HYB_KEM , 192 },
{ 0, "bikel5", OQS_KEM_alg_bike_l5, KEY_TYPE_KEM, 256 },
{ 0, "p521_bikel5", OQS_KEM_alg_bike_l5, KEY_TYPE_ECP_HYB_KEM , 256 },
{ 0, "hqc128", OQS_KEM_alg_hqc_128, KEY_TYPE_KEM, 128 },
{ 0, "p256_hqc128", OQS_KEM_alg_hqc_128, KEY_TYPE_ECP_HYB_KEM , 128 },
{ 0, "x25519_hqc128", OQS_KEM_alg_hqc_128, KEY_TYPE_ECX_HYB_KEM , 128 },
{ 0, "hqc192", OQS_KEM_alg_hqc_192, KEY_TYPE_KEM, 192 },
{ 0, "p384_hqc192", OQS_KEM_alg_hqc_192, KEY_TYPE_ECP_HYB_KEM , 192 },
{ 0, "x448_hqc192", OQS_KEM_alg_hqc_192, KEY_TYPE_ECX_HYB_KEM , 192 },
{ 0, "hqc256", OQS_KEM_alg_hqc_256, KEY_TYPE_KEM, 256 },
{ 0, "p521_hqc256", OQS_KEM_alg_hqc_256, KEY_TYPE_ECP_HYB_KEM , 256 },
{0, "frodo640aes", OQS_KEM_alg_frodokem_640_aes, KEY_TYPE_KEM, 128},
{0, "p256_frodo640aes", OQS_KEM_alg_frodokem_640_aes, KEY_TYPE_ECP_HYB_KEM,
128},
{0, "x25519_frodo640aes", OQS_KEM_alg_frodokem_640_aes,
KEY_TYPE_ECX_HYB_KEM, 128},
{0, "frodo640shake", OQS_KEM_alg_frodokem_640_shake, KEY_TYPE_KEM, 128},
{0, "p256_frodo640shake", OQS_KEM_alg_frodokem_640_shake,
KEY_TYPE_ECP_HYB_KEM, 128},
{0, "x25519_frodo640shake", OQS_KEM_alg_frodokem_640_shake,
KEY_TYPE_ECX_HYB_KEM, 128},
{0, "frodo976aes", OQS_KEM_alg_frodokem_976_aes, KEY_TYPE_KEM, 192},
{0, "p384_frodo976aes", OQS_KEM_alg_frodokem_976_aes, KEY_TYPE_ECP_HYB_KEM,
192},
{0, "x448_frodo976aes", OQS_KEM_alg_frodokem_976_aes, KEY_TYPE_ECX_HYB_KEM,
192},
{0, "frodo976shake", OQS_KEM_alg_frodokem_976_shake, KEY_TYPE_KEM, 192},
{0, "p384_frodo976shake", OQS_KEM_alg_frodokem_976_shake,
KEY_TYPE_ECP_HYB_KEM, 192},
{0, "x448_frodo976shake", OQS_KEM_alg_frodokem_976_shake,
KEY_TYPE_ECX_HYB_KEM, 192},
{0, "frodo1344aes", OQS_KEM_alg_frodokem_1344_aes, KEY_TYPE_KEM, 256},
{0, "p521_frodo1344aes", OQS_KEM_alg_frodokem_1344_aes,
KEY_TYPE_ECP_HYB_KEM, 256},
{0, "frodo1344shake", OQS_KEM_alg_frodokem_1344_shake, KEY_TYPE_KEM, 256},
{0, "p521_frodo1344shake", OQS_KEM_alg_frodokem_1344_shake,
KEY_TYPE_ECP_HYB_KEM, 256},
{0, "kyber512", OQS_KEM_alg_kyber_512, KEY_TYPE_KEM, 128},
{0, "p256_kyber512", OQS_KEM_alg_kyber_512, KEY_TYPE_ECP_HYB_KEM, 128},
{0, "x25519_kyber512", OQS_KEM_alg_kyber_512, KEY_TYPE_ECX_HYB_KEM, 128},
{0, "kyber768", OQS_KEM_alg_kyber_768, KEY_TYPE_KEM, 192},
{0, "p384_kyber768", OQS_KEM_alg_kyber_768, KEY_TYPE_ECP_HYB_KEM, 192},
{0, "x448_kyber768", OQS_KEM_alg_kyber_768, KEY_TYPE_ECX_HYB_KEM, 192},
{0, "x25519_kyber768", OQS_KEM_alg_kyber_768, KEY_TYPE_ECX_HYB_KEM, 192},
{0, "p256_kyber768", OQS_KEM_alg_kyber_768, KEY_TYPE_ECP_HYB_KEM, 192},
{0, "kyber1024", OQS_KEM_alg_kyber_1024, KEY_TYPE_KEM, 256},
{0, "p521_kyber1024", OQS_KEM_alg_kyber_1024, KEY_TYPE_ECP_HYB_KEM, 256},
{0, "bikel1", OQS_KEM_alg_bike_l1, KEY_TYPE_KEM, 128},
{0, "p256_bikel1", OQS_KEM_alg_bike_l1, KEY_TYPE_ECP_HYB_KEM, 128},
{0, "x25519_bikel1", OQS_KEM_alg_bike_l1, KEY_TYPE_ECX_HYB_KEM, 128},
{0, "bikel3", OQS_KEM_alg_bike_l3, KEY_TYPE_KEM, 192},
{0, "p384_bikel3", OQS_KEM_alg_bike_l3, KEY_TYPE_ECP_HYB_KEM, 192},
{0, "x448_bikel3", OQS_KEM_alg_bike_l3, KEY_TYPE_ECX_HYB_KEM, 192},
{0, "bikel5", OQS_KEM_alg_bike_l5, KEY_TYPE_KEM, 256},
{0, "p521_bikel5", OQS_KEM_alg_bike_l5, KEY_TYPE_ECP_HYB_KEM, 256},
{0, "hqc128", OQS_KEM_alg_hqc_128, KEY_TYPE_KEM, 128},
{0, "p256_hqc128", OQS_KEM_alg_hqc_128, KEY_TYPE_ECP_HYB_KEM, 128},
{0, "x25519_hqc128", OQS_KEM_alg_hqc_128, KEY_TYPE_ECX_HYB_KEM, 128},
{0, "hqc192", OQS_KEM_alg_hqc_192, KEY_TYPE_KEM, 192},
{0, "p384_hqc192", OQS_KEM_alg_hqc_192, KEY_TYPE_ECP_HYB_KEM, 192},
{0, "x448_hqc192", OQS_KEM_alg_hqc_192, KEY_TYPE_ECX_HYB_KEM, 192},
{0, "hqc256", OQS_KEM_alg_hqc_256, KEY_TYPE_KEM, 256},
{0, "p521_hqc256", OQS_KEM_alg_hqc_256, KEY_TYPE_ECP_HYB_KEM, 256},

#endif /* OQS_KEM_ENCODERS */
{ 0, "dilithium2", OQS_SIG_alg_dilithium_2, KEY_TYPE_SIG, 128 },
{ 0, "p256_dilithium2", OQS_SIG_alg_dilithium_2, KEY_TYPE_HYB_SIG, 128 },
{ 0, "rsa3072_dilithium2", OQS_SIG_alg_dilithium_2, KEY_TYPE_HYB_SIG, 128 },
{ 0, "dilithium2_pss2048", OQS_SIG_alg_dilithium_2, KEY_TYPE_CMP_SIG, 112 },
{ 0, "dilithium2_rsa2048", OQS_SIG_alg_dilithium_2, KEY_TYPE_CMP_SIG, 112 },
{ 0, "dilithium2_ed25519", OQS_SIG_alg_dilithium_2, KEY_TYPE_CMP_SIG, 128 },
{ 0, "dilithium2_p256", OQS_SIG_alg_dilithium_2, KEY_TYPE_CMP_SIG, 128 },
{ 0, "dilithium2_bp256", OQS_SIG_alg_dilithium_2, KEY_TYPE_CMP_SIG, 256 },
{ 0, "dilithium3", OQS_SIG_alg_dilithium_3, KEY_TYPE_SIG, 192 },
{ 0, "p384_dilithium3", OQS_SIG_alg_dilithium_3, KEY_TYPE_HYB_SIG, 192 },
{ 0, "dilithium3_pss3072", OQS_SIG_alg_dilithium_3, KEY_TYPE_CMP_SIG, 128 },
{ 0, "dilithium3_rsa3072", OQS_SIG_alg_dilithium_3, KEY_TYPE_CMP_SIG, 128 },
{ 0, "dilithium3_p256", OQS_SIG_alg_dilithium_3, KEY_TYPE_CMP_SIG, 128 },
{ 0, "dilithium3_bp256", OQS_SIG_alg_dilithium_3, KEY_TYPE_CMP_SIG, 256 },
{ 0, "dilithium3_ed25519", OQS_SIG_alg_dilithium_3, KEY_TYPE_CMP_SIG, 128 },
{ 0, "dilithium5", OQS_SIG_alg_dilithium_5, KEY_TYPE_SIG, 256 },
{ 0, "p521_dilithium5", OQS_SIG_alg_dilithium_5, KEY_TYPE_HYB_SIG, 256 },
{ 0, "dilithium5_p384", OQS_SIG_alg_dilithium_5, KEY_TYPE_CMP_SIG, 192 },
{ 0, "dilithium5_bp384", OQS_SIG_alg_dilithium_5, KEY_TYPE_CMP_SIG, 384 },
{ 0, "dilithium5_ed448", OQS_SIG_alg_dilithium_5, KEY_TYPE_CMP_SIG, 192 },
{ 0, "falcon512", OQS_SIG_alg_falcon_512, KEY_TYPE_SIG, 128 },
{ 0, "p256_falcon512", OQS_SIG_alg_falcon_512, KEY_TYPE_HYB_SIG, 128 },
{ 0, "rsa3072_falcon512", OQS_SIG_alg_falcon_512, KEY_TYPE_HYB_SIG, 128 },
{ 0, "falcon512_p256", OQS_SIG_alg_falcon_512, KEY_TYPE_CMP_SIG, 128 },
{ 0, "falcon512_bp256", OQS_SIG_alg_falcon_512, KEY_TYPE_CMP_SIG, 256 },
{ 0, "falcon512_ed25519", OQS_SIG_alg_falcon_512, KEY_TYPE_CMP_SIG, 128 },
{ 0, "falcon1024", OQS_SIG_alg_falcon_1024, KEY_TYPE_SIG, 256 },
{ 0, "p521_falcon1024", OQS_SIG_alg_falcon_1024, KEY_TYPE_HYB_SIG, 256 },
{ 0, "sphincssha2128fsimple", OQS_SIG_alg_sphincs_sha2_128f_simple, KEY_TYPE_SIG, 128 },
{ 0, "p256_sphincssha2128fsimple", OQS_SIG_alg_sphincs_sha2_128f_simple, KEY_TYPE_HYB_SIG, 128 },
{ 0, "rsa3072_sphincssha2128fsimple", OQS_SIG_alg_sphincs_sha2_128f_simple, KEY_TYPE_HYB_SIG, 128 },
{ 0, "sphincssha2128ssimple", OQS_SIG_alg_sphincs_sha2_128s_simple, KEY_TYPE_SIG, 128 },
{ 0, "p256_sphincssha2128ssimple", OQS_SIG_alg_sphincs_sha2_128s_simple, KEY_TYPE_HYB_SIG, 128 },
{ 0, "rsa3072_sphincssha2128ssimple", OQS_SIG_alg_sphincs_sha2_128s_simple, KEY_TYPE_HYB_SIG, 128 },
{ 0, "sphincssha2192fsimple", OQS_SIG_alg_sphincs_sha2_192f_simple, KEY_TYPE_SIG, 192 },
{ 0, "p384_sphincssha2192fsimple", OQS_SIG_alg_sphincs_sha2_192f_simple, KEY_TYPE_HYB_SIG, 192 },
{ 0, "sphincsshake128fsimple", OQS_SIG_alg_sphincs_shake_128f_simple, KEY_TYPE_SIG, 128 },
{ 0, "p256_sphincsshake128fsimple", OQS_SIG_alg_sphincs_shake_128f_simple, KEY_TYPE_HYB_SIG, 128 },
{ 0, "rsa3072_sphincsshake128fsimple", OQS_SIG_alg_sphincs_shake_128f_simple, KEY_TYPE_HYB_SIG, 128 },
///// OQS_TEMPLATE_FRAGMENT_OQSNAMES_END
{0, "dilithium2", OQS_SIG_alg_dilithium_2, KEY_TYPE_SIG, 128},
{0, "p256_dilithium2", OQS_SIG_alg_dilithium_2, KEY_TYPE_HYB_SIG, 128},
{0, "rsa3072_dilithium2", OQS_SIG_alg_dilithium_2, KEY_TYPE_HYB_SIG, 128},
{0, "dilithium2_pss2048", OQS_SIG_alg_dilithium_2, KEY_TYPE_CMP_SIG, 112},
{0, "dilithium2_rsa2048", OQS_SIG_alg_dilithium_2, KEY_TYPE_CMP_SIG, 112},
{0, "dilithium2_ed25519", OQS_SIG_alg_dilithium_2, KEY_TYPE_CMP_SIG, 128},
{0, "dilithium2_p256", OQS_SIG_alg_dilithium_2, KEY_TYPE_CMP_SIG, 128},
{0, "dilithium2_bp256", OQS_SIG_alg_dilithium_2, KEY_TYPE_CMP_SIG, 256},
{0, "dilithium3", OQS_SIG_alg_dilithium_3, KEY_TYPE_SIG, 192},
{0, "p384_dilithium3", OQS_SIG_alg_dilithium_3, KEY_TYPE_HYB_SIG, 192},
{0, "dilithium3_pss3072", OQS_SIG_alg_dilithium_3, KEY_TYPE_CMP_SIG, 128},
{0, "dilithium3_rsa3072", OQS_SIG_alg_dilithium_3, KEY_TYPE_CMP_SIG, 128},
{0, "dilithium3_p256", OQS_SIG_alg_dilithium_3, KEY_TYPE_CMP_SIG, 128},
{0, "dilithium3_bp256", OQS_SIG_alg_dilithium_3, KEY_TYPE_CMP_SIG, 256},
{0, "dilithium3_ed25519", OQS_SIG_alg_dilithium_3, KEY_TYPE_CMP_SIG, 128},
{0, "dilithium5", OQS_SIG_alg_dilithium_5, KEY_TYPE_SIG, 256},
{0, "p521_dilithium5", OQS_SIG_alg_dilithium_5, KEY_TYPE_HYB_SIG, 256},
{0, "dilithium5_p384", OQS_SIG_alg_dilithium_5, KEY_TYPE_CMP_SIG, 192},
{0, "dilithium5_bp384", OQS_SIG_alg_dilithium_5, KEY_TYPE_CMP_SIG, 384},
{0, "dilithium5_ed448", OQS_SIG_alg_dilithium_5, KEY_TYPE_CMP_SIG, 192},
{0, "falcon512", OQS_SIG_alg_falcon_512, KEY_TYPE_SIG, 128},
{0, "p256_falcon512", OQS_SIG_alg_falcon_512, KEY_TYPE_HYB_SIG, 128},
{0, "rsa3072_falcon512", OQS_SIG_alg_falcon_512, KEY_TYPE_HYB_SIG, 128},
{0, "falcon512_p256", OQS_SIG_alg_falcon_512, KEY_TYPE_CMP_SIG, 128},
{0, "falcon512_bp256", OQS_SIG_alg_falcon_512, KEY_TYPE_CMP_SIG, 256},
{0, "falcon512_ed25519", OQS_SIG_alg_falcon_512, KEY_TYPE_CMP_SIG, 128},
{0, "falcon1024", OQS_SIG_alg_falcon_1024, KEY_TYPE_SIG, 256},
{0, "p521_falcon1024", OQS_SIG_alg_falcon_1024, KEY_TYPE_HYB_SIG, 256},
{0, "sphincssha2128fsimple", OQS_SIG_alg_sphincs_sha2_128f_simple,
KEY_TYPE_SIG, 128},
{0, "p256_sphincssha2128fsimple", OQS_SIG_alg_sphincs_sha2_128f_simple,
KEY_TYPE_HYB_SIG, 128},
{0, "rsa3072_sphincssha2128fsimple", OQS_SIG_alg_sphincs_sha2_128f_simple,
KEY_TYPE_HYB_SIG, 128},
{0, "sphincssha2128ssimple", OQS_SIG_alg_sphincs_sha2_128s_simple,
KEY_TYPE_SIG, 128},
{0, "p256_sphincssha2128ssimple", OQS_SIG_alg_sphincs_sha2_128s_simple,
KEY_TYPE_HYB_SIG, 128},
{0, "rsa3072_sphincssha2128ssimple", OQS_SIG_alg_sphincs_sha2_128s_simple,
KEY_TYPE_HYB_SIG, 128},
{0, "sphincssha2192fsimple", OQS_SIG_alg_sphincs_sha2_192f_simple,
KEY_TYPE_SIG, 192},
{0, "p384_sphincssha2192fsimple", OQS_SIG_alg_sphincs_sha2_192f_simple,
KEY_TYPE_HYB_SIG, 192},
{0, "sphincsshake128fsimple", OQS_SIG_alg_sphincs_shake_128f_simple,
KEY_TYPE_SIG, 128},
{0, "p256_sphincsshake128fsimple", OQS_SIG_alg_sphincs_shake_128f_simple,
KEY_TYPE_HYB_SIG, 128},
{0, "rsa3072_sphincsshake128fsimple", OQS_SIG_alg_sphincs_shake_128f_simple,
KEY_TYPE_HYB_SIG, 128},
///// OQS_TEMPLATE_FRAGMENT_OQSNAMES_END
};

int oqs_set_nid(char *tlsname, int nid)
Expand Down

0 comments on commit c67fec0

Please sign in to comment.