Skip to content

Commit

Permalink
fromat code
Browse files Browse the repository at this point in the history
Signed-off-by: rtjk <47841774+rtjk@users.noreply.github.com>
  • Loading branch information
rtjk committed Aug 19, 2024
1 parent 3b08dde commit 45e961e
Show file tree
Hide file tree
Showing 8 changed files with 2,743 additions and 1,416 deletions.
173 changes: 114 additions & 59 deletions oqsprov/oqs_decode_der2key.c

Large diffs are not rendered by default.

26 changes: 16 additions & 10 deletions oqsprov/oqs_encode_key2any.c
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,7 @@ static int oqsx_pki_priv_to_der(const void *vxkey, unsigned char **pder) {
privkeylen -=
(oqsxkey->evp_info->length_private_key - actualprivkeylen);
}

#ifdef NOPUBKEY_IN_PRIVKEY
buflen = privkeylen;
buf = OPENSSL_secure_malloc(buflen);
Expand Down Expand Up @@ -1226,9 +1227,9 @@ static int oqsx_pki_priv_to_der(const void *vxkey, unsigned char **pder) {
#define p521_mayo5_evp_type 0
#define p521_mayo5_input_type "p521_mayo5"
#define p521_mayo5_pem_type "p521_mayo5"
# define CROSSrsdp128balanced_evp_type 0
# define CROSSrsdp128balanced_input_type "CROSSrsdp128balanced"
# define CROSSrsdp128balanced_pem_type "CROSSrsdp128balanced"
#define CROSSrsdp128balanced_evp_type 0
#define CROSSrsdp128balanced_input_type "CROSSrsdp128balanced"
#define CROSSrsdp128balanced_pem_type "CROSSrsdp128balanced"
///// OQS_TEMPLATE_FRAGMENT_ENCODER_DEFINES_END

/* ---------------------------------------------------------------------- */
Expand Down Expand Up @@ -1875,7 +1876,6 @@ key2text_encode(void *vctx, const void *key, int selection, OSSL_CORE_BIO *cout,
///// OQS_TEMPLATE_FRAGMENT_ENCODER_MAKE_START
#ifdef OQS_KEM_ENCODERS


MAKE_ENCODER(, frodo640aes, oqsx, EncryptedPrivateKeyInfo, der);
MAKE_ENCODER(, frodo640aes, oqsx, EncryptedPrivateKeyInfo, pem);
MAKE_ENCODER(, frodo640aes, oqsx, PrivateKeyInfo, der);
Expand Down Expand Up @@ -2540,8 +2540,10 @@ MAKE_ENCODER(, p256_sphincssha2128fsimple, oqsx, PrivateKeyInfo, pem);
MAKE_ENCODER(, p256_sphincssha2128fsimple, oqsx, SubjectPublicKeyInfo, der);
MAKE_ENCODER(, p256_sphincssha2128fsimple, oqsx, SubjectPublicKeyInfo, pem);
MAKE_TEXT_ENCODER(, p256_sphincssha2128fsimple);
MAKE_ENCODER(, rsa3072_sphincssha2128fsimple, oqsx, EncryptedPrivateKeyInfo, der);
MAKE_ENCODER(, rsa3072_sphincssha2128fsimple, oqsx, EncryptedPrivateKeyInfo, pem);
MAKE_ENCODER(, rsa3072_sphincssha2128fsimple, oqsx, EncryptedPrivateKeyInfo,
der);
MAKE_ENCODER(, rsa3072_sphincssha2128fsimple, oqsx, EncryptedPrivateKeyInfo,
pem);
MAKE_ENCODER(, rsa3072_sphincssha2128fsimple, oqsx, PrivateKeyInfo, der);
MAKE_ENCODER(, rsa3072_sphincssha2128fsimple, oqsx, PrivateKeyInfo, pem);
MAKE_ENCODER(, rsa3072_sphincssha2128fsimple, oqsx, SubjectPublicKeyInfo, der);
Expand All @@ -2561,8 +2563,10 @@ MAKE_ENCODER(, p256_sphincssha2128ssimple, oqsx, PrivateKeyInfo, pem);
MAKE_ENCODER(, p256_sphincssha2128ssimple, oqsx, SubjectPublicKeyInfo, der);
MAKE_ENCODER(, p256_sphincssha2128ssimple, oqsx, SubjectPublicKeyInfo, pem);
MAKE_TEXT_ENCODER(, p256_sphincssha2128ssimple);
MAKE_ENCODER(, rsa3072_sphincssha2128ssimple, oqsx, EncryptedPrivateKeyInfo, der);
MAKE_ENCODER(, rsa3072_sphincssha2128ssimple, oqsx, EncryptedPrivateKeyInfo, pem);
MAKE_ENCODER(, rsa3072_sphincssha2128ssimple, oqsx, EncryptedPrivateKeyInfo,
der);
MAKE_ENCODER(, rsa3072_sphincssha2128ssimple, oqsx, EncryptedPrivateKeyInfo,
pem);
MAKE_ENCODER(, rsa3072_sphincssha2128ssimple, oqsx, PrivateKeyInfo, der);
MAKE_ENCODER(, rsa3072_sphincssha2128ssimple, oqsx, PrivateKeyInfo, pem);
MAKE_ENCODER(, rsa3072_sphincssha2128ssimple, oqsx, SubjectPublicKeyInfo, der);
Expand Down Expand Up @@ -2596,8 +2600,10 @@ MAKE_ENCODER(, p256_sphincsshake128fsimple, oqsx, PrivateKeyInfo, pem);
MAKE_ENCODER(, p256_sphincsshake128fsimple, oqsx, SubjectPublicKeyInfo, der);
MAKE_ENCODER(, p256_sphincsshake128fsimple, oqsx, SubjectPublicKeyInfo, pem);
MAKE_TEXT_ENCODER(, p256_sphincsshake128fsimple);
MAKE_ENCODER(, rsa3072_sphincsshake128fsimple, oqsx, EncryptedPrivateKeyInfo, der);
MAKE_ENCODER(, rsa3072_sphincsshake128fsimple, oqsx, EncryptedPrivateKeyInfo, pem);
MAKE_ENCODER(, rsa3072_sphincsshake128fsimple, oqsx, EncryptedPrivateKeyInfo,
der);
MAKE_ENCODER(, rsa3072_sphincsshake128fsimple, oqsx, EncryptedPrivateKeyInfo,
pem);
MAKE_ENCODER(, rsa3072_sphincsshake128fsimple, oqsx, PrivateKeyInfo, der);
MAKE_ENCODER(, rsa3072_sphincsshake128fsimple, oqsx, PrivateKeyInfo, pem);
MAKE_ENCODER(, rsa3072_sphincsshake128fsimple, oqsx, SubjectPublicKeyInfo, der);
Expand Down
43 changes: 30 additions & 13 deletions oqsprov/oqs_kmgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1208,9 +1208,16 @@ static void *p521_mayo5_gen_init(void *provctx, int selection) {
KEY_TYPE_HYB_SIG, 256, 55);
}

static void *CROSSrsdp128balanced_gen_init(void *provctx, int selection)
{
return oqsx_gen_init(provctx, selection, OQS_SIG_alg_cross_rsdp_128_balanced, "CROSSrsdp128balanced", 0, 128, 56);
static void *CROSSrsdp128balanced_new_key(void *provctx) {
return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx),
OQS_SIG_alg_cross_rsdp_128_balanced,
"CROSSrsdp128balanced", KEY_TYPE_SIG, NULL, 128, 56);
}

static void *CROSSrsdp128balanced_gen_init(void *provctx, int selection) {
return oqsx_gen_init(provctx, selection,
OQS_SIG_alg_cross_rsdp_128_balanced,
"CROSSrsdp128balanced", 0, 128, 56);
}

///// OQS_TEMPLATE_FRAGMENT_KEYMGMT_CONSTRUCTORS_END
Expand Down Expand Up @@ -1416,30 +1423,40 @@ MAKE_SIG_KEYMGMT_FUNCTIONS(CROSSrsdp128balanced)

MAKE_KEM_KEYMGMT_FUNCTIONS(frodo640aes, OQS_KEM_alg_frodokem_640_aes, 128)

MAKE_KEM_ECP_KEYMGMT_FUNCTIONS(p256_frodo640aes, OQS_KEM_alg_frodokem_640_aes, 128)
MAKE_KEM_ECP_KEYMGMT_FUNCTIONS(p256_frodo640aes, OQS_KEM_alg_frodokem_640_aes,
128)

MAKE_KEM_ECX_KEYMGMT_FUNCTIONS(x25519_frodo640aes, OQS_KEM_alg_frodokem_640_aes, 128)
MAKE_KEM_ECX_KEYMGMT_FUNCTIONS(x25519_frodo640aes, OQS_KEM_alg_frodokem_640_aes,
128)
MAKE_KEM_KEYMGMT_FUNCTIONS(frodo640shake, OQS_KEM_alg_frodokem_640_shake, 128)

MAKE_KEM_ECP_KEYMGMT_FUNCTIONS(p256_frodo640shake, OQS_KEM_alg_frodokem_640_shake, 128)
MAKE_KEM_ECP_KEYMGMT_FUNCTIONS(p256_frodo640shake,
OQS_KEM_alg_frodokem_640_shake, 128)

MAKE_KEM_ECX_KEYMGMT_FUNCTIONS(x25519_frodo640shake, OQS_KEM_alg_frodokem_640_shake, 128)
MAKE_KEM_ECX_KEYMGMT_FUNCTIONS(x25519_frodo640shake,
OQS_KEM_alg_frodokem_640_shake, 128)
MAKE_KEM_KEYMGMT_FUNCTIONS(frodo976aes, OQS_KEM_alg_frodokem_976_aes, 192)

MAKE_KEM_ECP_KEYMGMT_FUNCTIONS(p384_frodo976aes, OQS_KEM_alg_frodokem_976_aes, 192)
MAKE_KEM_ECP_KEYMGMT_FUNCTIONS(p384_frodo976aes, OQS_KEM_alg_frodokem_976_aes,
192)

MAKE_KEM_ECX_KEYMGMT_FUNCTIONS(x448_frodo976aes, OQS_KEM_alg_frodokem_976_aes, 192)
MAKE_KEM_ECX_KEYMGMT_FUNCTIONS(x448_frodo976aes, OQS_KEM_alg_frodokem_976_aes,
192)
MAKE_KEM_KEYMGMT_FUNCTIONS(frodo976shake, OQS_KEM_alg_frodokem_976_shake, 192)

MAKE_KEM_ECP_KEYMGMT_FUNCTIONS(p384_frodo976shake, OQS_KEM_alg_frodokem_976_shake, 192)
MAKE_KEM_ECP_KEYMGMT_FUNCTIONS(p384_frodo976shake,
OQS_KEM_alg_frodokem_976_shake, 192)

MAKE_KEM_ECX_KEYMGMT_FUNCTIONS(x448_frodo976shake, OQS_KEM_alg_frodokem_976_shake, 192)
MAKE_KEM_ECX_KEYMGMT_FUNCTIONS(x448_frodo976shake,
OQS_KEM_alg_frodokem_976_shake, 192)
MAKE_KEM_KEYMGMT_FUNCTIONS(frodo1344aes, OQS_KEM_alg_frodokem_1344_aes, 256)

MAKE_KEM_ECP_KEYMGMT_FUNCTIONS(p521_frodo1344aes, OQS_KEM_alg_frodokem_1344_aes, 256)
MAKE_KEM_ECP_KEYMGMT_FUNCTIONS(p521_frodo1344aes, OQS_KEM_alg_frodokem_1344_aes,
256)
MAKE_KEM_KEYMGMT_FUNCTIONS(frodo1344shake, OQS_KEM_alg_frodokem_1344_shake, 256)

MAKE_KEM_ECP_KEYMGMT_FUNCTIONS(p521_frodo1344shake, OQS_KEM_alg_frodokem_1344_shake, 256)
MAKE_KEM_ECP_KEYMGMT_FUNCTIONS(p521_frodo1344shake,
OQS_KEM_alg_frodokem_1344_shake, 256)
MAKE_KEM_KEYMGMT_FUNCTIONS(kyber512, OQS_KEM_alg_kyber_512, 128)

MAKE_KEM_ECP_KEYMGMT_FUNCTIONS(p256_kyber512, OQS_KEM_alg_kyber_512, 128)
Expand Down
Loading

0 comments on commit 45e961e

Please sign in to comment.