diff --git a/oqsprov/oqs_encode_key2any.c b/oqsprov/oqs_encode_key2any.c index b0b4bbd7..199188e8 100644 --- a/oqsprov/oqs_encode_key2any.c +++ b/oqsprov/oqs_encode_key2any.c @@ -1475,6 +1475,10 @@ static int oqsx_to_text(BIO *out, const void *key, int selection) <= 0) return 0; break; + case KEY_TYPE_CMP_SIG: + if (BIO_printf(out, "%s composite private key:\n", okey->tls_name) <= 0) + return 0; + break; default: ERR_raise(ERR_LIB_USER, OQSPROV_R_INVALID_KEY); return 0; @@ -1497,6 +1501,10 @@ static int oqsx_to_text(BIO *out, const void *key, int selection) if (BIO_printf(out, "%s hybrid public key:\n", okey->tls_name) <= 0) return 0; break; + case KEY_TYPE_CMP_SIG: + if (BIO_printf(out, "%s composite public key:\n", okey->tls_name) <= 0) + return 0; + break; default: ERR_raise(ERR_LIB_USER, OQSPROV_R_INVALID_KEY); return 0; @@ -1505,51 +1513,105 @@ static int oqsx_to_text(BIO *out, const void *key, int selection) if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0) { if (okey->privkey) { - if (okey->numkeys > 1) { // hybrid key - char classic_label[200]; - int classic_key_len = 0; - sprintf(classic_label, - "%s key material:", OBJ_nid2sn(okey->evp_info->nid)); - DECODE_UINT32(classic_key_len, okey->privkey); - if (!print_labeled_buf(out, classic_label, - okey->comp_privkey[0], classic_key_len)) - return 0; - /* finally print pure PQ key */ - if (!print_labeled_buf(out, "PQ key material:", - okey->comp_privkey[okey->numkeys - 1], - okey->privkeylen - classic_key_len - - SIZE_OF_UINT32)) - return 0; - } else { // plain PQ key - if (!print_labeled_buf(out, "PQ key material:", - okey->comp_privkey[okey->numkeys - 1], - okey->privkeylen)) - return 0; + if (okey->keytype == KEY_TYPE_CMP_SIG){ + char *name; + char label[200]; + int i, privlen; + for (i = 0; i < okey->numkeys; i++){ + if ((name = get_cmpname(OBJ_sn2nid(okey->tls_name), i)) == NULL){ + OPENSSL_free(name); + ERR_raise(ERR_LIB_USER, OQSPROV_R_INVALID_KEY); + return 0; + } + sprintf(label, "%s key material:", name); + + if(get_oqsname_fromtls(name) == 0 //classical key + && okey->oqsx_provider_ctx[i].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); + OPENSSL_cleanse(enc_len, 2); + DECODE_UINT32(privlen, enc_len); + privlen += 4; + OPENSSL_free(enc_len); + if (privlen > okey->privkeylen_cmp[i]){ + OPENSSL_free(name); + ERR_raise(ERR_LIB_USER, OQSPROV_R_INVALID_ENCODING); + return 0; + } + }else + privlen = okey->privkeylen_cmp[i]; + if (!print_labeled_buf(out, label, + okey->comp_privkey[i], privlen)) + return 0; + + OPENSSL_free(name); + } + }else{ + if (okey->numkeys > 1) { // hybrid key + char classic_label[200]; + int classic_key_len = 0; + sprintf(classic_label, + "%s key material:", OBJ_nid2sn(okey->evp_info->nid)); + DECODE_UINT32(classic_key_len, okey->privkey); + if (!print_labeled_buf(out, classic_label, + okey->comp_privkey[0], classic_key_len)) + return 0; + /* finally print pure PQ key */ + if (!print_labeled_buf(out, "PQ key material:", + okey->comp_privkey[okey->numkeys - 1], + okey->privkeylen - classic_key_len + - SIZE_OF_UINT32)) + return 0; + } else { // plain PQ key + if (!print_labeled_buf(out, "PQ key material:", + okey->comp_privkey[okey->numkeys - 1], + okey->privkeylen)) + return 0; + } } } } if ((selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) != 0) { if (okey->pubkey) { - if (okey->numkeys > 1) { // hybrid key - char classic_label[200]; - int classic_key_len = 0; - DECODE_UINT32(classic_key_len, okey->pubkey); - sprintf(classic_label, - "%s key material:", OBJ_nid2sn(okey->evp_info->nid)); - if (!print_labeled_buf(out, classic_label, okey->comp_pubkey[0], - classic_key_len)) - return 0; - /* 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)) - return 0; - } else { // PQ key only - if (!print_labeled_buf(out, "PQ key material:", - okey->comp_pubkey[okey->numkeys - 1], - okey->pubkeylen)) - return 0; + if (okey->keytype == KEY_TYPE_CMP_SIG){ + char *name; + char label[200]; + int i; + for (i = 0; i < okey->numkeys; i++){ + if ((name = get_cmpname(OBJ_sn2nid(okey->tls_name), i)) == NULL){ + OPENSSL_free(name); + ERR_raise(ERR_LIB_USER, OQSPROV_R_INVALID_KEY); + return 0; + } + sprintf(label, "%s key material:", name); + + if (!print_labeled_buf(out, label, + okey->comp_pubkey[i], okey->pubkeylen_cmp[i])) + return 0; + + OPENSSL_free(name); + } + }else{ + if (okey->numkeys > 1) { // hybrid key + char classic_label[200]; + int classic_key_len = 0; + DECODE_UINT32(classic_key_len, okey->pubkey); + sprintf(classic_label, + "%s key material:", OBJ_nid2sn(okey->evp_info->nid)); + if (!print_labeled_buf(out, classic_label, okey->comp_pubkey[0], + classic_key_len)) + return 0; + /* 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)) + return 0; + } else { // PQ key only + if (!print_labeled_buf(out, "PQ key material:", + okey->comp_pubkey[okey->numkeys - 1], + okey->pubkeylen)) + return 0; + } } } } @@ -2122,94 +2184,110 @@ MAKE_ENCODER(, dilithium3_rsa3072, oqsx, PrivateKeyInfo, der); MAKE_ENCODER(, dilithium3_rsa3072, oqsx, PrivateKeyInfo, pem); MAKE_ENCODER(, dilithium3_rsa3072, oqsx, SubjectPublicKeyInfo, der); MAKE_ENCODER(, dilithium3_rsa3072, oqsx, SubjectPublicKeyInfo, pem); +MAKE_TEXT_ENCODER(, dilithium3_rsa3072); MAKE_ENCODER(, dilithium3_p256, oqsx, EncryptedPrivateKeyInfo, der); MAKE_ENCODER(, dilithium3_p256, oqsx, EncryptedPrivateKeyInfo, pem); MAKE_ENCODER(, dilithium3_p256, oqsx, PrivateKeyInfo, der); MAKE_ENCODER(, dilithium3_p256, oqsx, PrivateKeyInfo, pem); MAKE_ENCODER(, dilithium3_p256, oqsx, SubjectPublicKeyInfo, der); MAKE_ENCODER(, dilithium3_p256, oqsx, SubjectPublicKeyInfo, pem); +MAKE_TEXT_ENCODER(, dilithium3_p256); MAKE_ENCODER(, falcon512_p256, oqsx, EncryptedPrivateKeyInfo, der); MAKE_ENCODER(, falcon512_p256, oqsx, EncryptedPrivateKeyInfo, pem); MAKE_ENCODER(, falcon512_p256, oqsx, PrivateKeyInfo, der); MAKE_ENCODER(, falcon512_p256, oqsx, PrivateKeyInfo, pem); MAKE_ENCODER(, falcon512_p256, oqsx, SubjectPublicKeyInfo, der); MAKE_ENCODER(, falcon512_p256, oqsx, SubjectPublicKeyInfo, pem); +MAKE_TEXT_ENCODER(, falcon512_p256); MAKE_ENCODER(, dilithium5_p384, oqsx, EncryptedPrivateKeyInfo, der); MAKE_ENCODER(, dilithium5_p384, oqsx, EncryptedPrivateKeyInfo, pem); MAKE_ENCODER(, dilithium5_p384, oqsx, PrivateKeyInfo, der); MAKE_ENCODER(, dilithium5_p384, oqsx, PrivateKeyInfo, pem); MAKE_ENCODER(, dilithium5_p384, oqsx, SubjectPublicKeyInfo, der); MAKE_ENCODER(, dilithium5_p384, oqsx, SubjectPublicKeyInfo, pem); +MAKE_TEXT_ENCODER(, dilithium5_p384); MAKE_ENCODER(, dilithium3_bp256, oqsx, EncryptedPrivateKeyInfo, der); MAKE_ENCODER(, dilithium3_bp256, oqsx, EncryptedPrivateKeyInfo, pem); MAKE_ENCODER(, dilithium3_bp256, oqsx, PrivateKeyInfo, der); MAKE_ENCODER(, dilithium3_bp256, oqsx, PrivateKeyInfo, pem); MAKE_ENCODER(, dilithium3_bp256, oqsx, SubjectPublicKeyInfo, der); MAKE_ENCODER(, dilithium3_bp256, oqsx, SubjectPublicKeyInfo, pem); +MAKE_TEXT_ENCODER(, dilithium3_bp256); MAKE_ENCODER(, dilithium3_ed25519, oqsx, EncryptedPrivateKeyInfo, der); MAKE_ENCODER(, dilithium3_ed25519, oqsx, EncryptedPrivateKeyInfo, pem); MAKE_ENCODER(, dilithium3_ed25519, oqsx, PrivateKeyInfo, der); MAKE_ENCODER(, dilithium3_ed25519, oqsx, PrivateKeyInfo, pem); MAKE_ENCODER(, dilithium3_ed25519, oqsx, SubjectPublicKeyInfo, der); MAKE_ENCODER(, dilithium3_ed25519, oqsx, SubjectPublicKeyInfo, pem); +MAKE_TEXT_ENCODER(, dilithium3_ed25519); MAKE_ENCODER(, dilithium5_bp384, oqsx, EncryptedPrivateKeyInfo, der); MAKE_ENCODER(, dilithium5_bp384, oqsx, EncryptedPrivateKeyInfo, pem); MAKE_ENCODER(, dilithium5_bp384, oqsx, PrivateKeyInfo, der); MAKE_ENCODER(, dilithium5_bp384, oqsx, PrivateKeyInfo, pem); MAKE_ENCODER(, dilithium5_bp384, oqsx, SubjectPublicKeyInfo, der); MAKE_ENCODER(, dilithium5_bp384, oqsx, SubjectPublicKeyInfo, pem); +MAKE_TEXT_ENCODER(, dilithium5_bp384); MAKE_ENCODER(, dilithium5_ed448, oqsx, EncryptedPrivateKeyInfo, der); MAKE_ENCODER(, dilithium5_ed448, oqsx, EncryptedPrivateKeyInfo, pem); MAKE_ENCODER(, dilithium5_ed448, oqsx, PrivateKeyInfo, der); MAKE_ENCODER(, dilithium5_ed448, oqsx, PrivateKeyInfo, pem); MAKE_ENCODER(, dilithium5_ed448, oqsx, SubjectPublicKeyInfo, der); MAKE_ENCODER(, dilithium5_ed448, oqsx, SubjectPublicKeyInfo, pem); +MAKE_TEXT_ENCODER(, dilithium5_ed448); MAKE_ENCODER(, falcon512_bp256, oqsx, EncryptedPrivateKeyInfo, der); MAKE_ENCODER(, falcon512_bp256, oqsx, EncryptedPrivateKeyInfo, pem); MAKE_ENCODER(, falcon512_bp256, oqsx, PrivateKeyInfo, der); MAKE_ENCODER(, falcon512_bp256, oqsx, PrivateKeyInfo, pem); MAKE_ENCODER(, falcon512_bp256, oqsx, SubjectPublicKeyInfo, der); MAKE_ENCODER(, falcon512_bp256, oqsx, SubjectPublicKeyInfo, pem); +MAKE_TEXT_ENCODER(, falcon512_bp256); MAKE_ENCODER(, falcon512_ed25519, oqsx, EncryptedPrivateKeyInfo, der); MAKE_ENCODER(, falcon512_ed25519, oqsx, EncryptedPrivateKeyInfo, pem); MAKE_ENCODER(, falcon512_ed25519, oqsx, PrivateKeyInfo, der); MAKE_ENCODER(, falcon512_ed25519, oqsx, PrivateKeyInfo, pem); MAKE_ENCODER(, falcon512_ed25519, oqsx, SubjectPublicKeyInfo, der); MAKE_ENCODER(, falcon512_ed25519, oqsx, SubjectPublicKeyInfo, pem); +MAKE_TEXT_ENCODER(, falcon512_ed25519); MAKE_ENCODER(, dilithium3_pss3072, oqsx, EncryptedPrivateKeyInfo, der); MAKE_ENCODER(, dilithium3_pss3072, oqsx, EncryptedPrivateKeyInfo, pem); MAKE_ENCODER(, dilithium3_pss3072, oqsx, PrivateKeyInfo, der); MAKE_ENCODER(, dilithium3_pss3072, oqsx, PrivateKeyInfo, pem); MAKE_ENCODER(, dilithium3_pss3072, oqsx, SubjectPublicKeyInfo, der); MAKE_ENCODER(, dilithium3_pss3072, oqsx, SubjectPublicKeyInfo, pem); +MAKE_TEXT_ENCODER(, dilithium3_pss3072); MAKE_ENCODER(, dilithium2_pss2048, oqsx, EncryptedPrivateKeyInfo, der); MAKE_ENCODER(, dilithium2_pss2048, oqsx, EncryptedPrivateKeyInfo, pem); MAKE_ENCODER(, dilithium2_pss2048, oqsx, PrivateKeyInfo, der); MAKE_ENCODER(, dilithium2_pss2048, oqsx, PrivateKeyInfo, pem); MAKE_ENCODER(, dilithium2_pss2048, oqsx, SubjectPublicKeyInfo, der); MAKE_ENCODER(, dilithium2_pss2048, oqsx, SubjectPublicKeyInfo, pem); +MAKE_TEXT_ENCODER(, dilithium2_pss2048); MAKE_ENCODER(, dilithium2_rsa2048, oqsx, EncryptedPrivateKeyInfo, der); MAKE_ENCODER(, dilithium2_rsa2048, oqsx, EncryptedPrivateKeyInfo, pem); MAKE_ENCODER(, dilithium2_rsa2048, oqsx, PrivateKeyInfo, der); MAKE_ENCODER(, dilithium2_rsa2048, oqsx, PrivateKeyInfo, pem); MAKE_ENCODER(, dilithium2_rsa2048, oqsx, SubjectPublicKeyInfo, der); MAKE_ENCODER(, dilithium2_rsa2048, oqsx, SubjectPublicKeyInfo, pem); +MAKE_TEXT_ENCODER(, dilithium2_rsa2048); MAKE_ENCODER(, dilithium2_ed25519, oqsx, EncryptedPrivateKeyInfo, der); MAKE_ENCODER(, dilithium2_ed25519, oqsx, EncryptedPrivateKeyInfo, pem); MAKE_ENCODER(, dilithium2_ed25519, oqsx, PrivateKeyInfo, der); MAKE_ENCODER(, dilithium2_ed25519, oqsx, PrivateKeyInfo, pem); MAKE_ENCODER(, dilithium2_ed25519, oqsx, SubjectPublicKeyInfo, der); MAKE_ENCODER(, dilithium2_ed25519, oqsx, SubjectPublicKeyInfo, pem); +MAKE_TEXT_ENCODER(, dilithium2_ed25519); MAKE_ENCODER(, dilithium2_p256, oqsx, EncryptedPrivateKeyInfo, der); MAKE_ENCODER(, dilithium2_p256, oqsx, EncryptedPrivateKeyInfo, pem); MAKE_ENCODER(, dilithium2_p256, oqsx, PrivateKeyInfo, der); MAKE_ENCODER(, dilithium2_p256, oqsx, PrivateKeyInfo, pem); MAKE_ENCODER(, dilithium2_p256, oqsx, SubjectPublicKeyInfo, der); MAKE_ENCODER(, dilithium2_p256, oqsx, SubjectPublicKeyInfo, pem); +MAKE_TEXT_ENCODER(, dilithium2_p256); MAKE_ENCODER(, dilithium2_bp256, oqsx, EncryptedPrivateKeyInfo, der); MAKE_ENCODER(, dilithium2_bp256, oqsx, EncryptedPrivateKeyInfo, pem); MAKE_ENCODER(, dilithium2_bp256, oqsx, PrivateKeyInfo, der); MAKE_ENCODER(, dilithium2_bp256, oqsx, PrivateKeyInfo, pem); MAKE_ENCODER(, dilithium2_bp256, oqsx, SubjectPublicKeyInfo, der); MAKE_ENCODER(, dilithium2_bp256, oqsx, SubjectPublicKeyInfo, pem); +MAKE_TEXT_ENCODER(, dilithium2_bp256); ///// OQS_TEMPLATE_FRAGMENT_ENCODER_MAKE_END diff --git a/oqsprov/oqs_prov.h b/oqsprov/oqs_prov.h index 5d402e60..fb7a7ee6 100644 --- a/oqsprov/oqs_prov.h +++ b/oqsprov/oqs_prov.h @@ -1411,6 +1411,7 @@ extern const OSSL_DISPATCH oqs_dilithium3_rsa3072_to_EncryptedPrivateKeyInfo_der extern const OSSL_DISPATCH oqs_dilithium3_rsa3072_to_EncryptedPrivateKeyInfo_pem_encoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium3_rsa3072_to_SubjectPublicKeyInfo_der_encoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium3_rsa3072_to_SubjectPublicKeyInfo_pem_encoder_functions[]; +extern const OSSL_DISPATCH oqs_dilithium3_rsa3072_to_text_encoder_functions[]; extern const OSSL_DISPATCH oqs_PrivateKeyInfo_der_to_dilithium3_rsa3072_decoder_functions[]; extern const OSSL_DISPATCH oqs_SubjectPublicKeyInfo_der_to_dilithium3_rsa3072_decoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium3_p256_to_PrivateKeyInfo_der_encoder_functions[]; @@ -1419,6 +1420,7 @@ extern const OSSL_DISPATCH oqs_dilithium3_p256_to_EncryptedPrivateKeyInfo_der_en extern const OSSL_DISPATCH oqs_dilithium3_p256_to_EncryptedPrivateKeyInfo_pem_encoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium3_p256_to_SubjectPublicKeyInfo_der_encoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium3_p256_to_SubjectPublicKeyInfo_pem_encoder_functions[]; +extern const OSSL_DISPATCH oqs_dilithium3_p256_to_text_encoder_functions[]; extern const OSSL_DISPATCH oqs_PrivateKeyInfo_der_to_dilithium3_p256_decoder_functions[]; extern const OSSL_DISPATCH oqs_SubjectPublicKeyInfo_der_to_dilithium3_p256_decoder_functions[]; extern const OSSL_DISPATCH oqs_falcon512_p256_to_PrivateKeyInfo_der_encoder_functions[]; @@ -1427,6 +1429,7 @@ extern const OSSL_DISPATCH oqs_falcon512_p256_to_EncryptedPrivateKeyInfo_der_enc extern const OSSL_DISPATCH oqs_falcon512_p256_to_EncryptedPrivateKeyInfo_pem_encoder_functions[]; extern const OSSL_DISPATCH oqs_falcon512_p256_to_SubjectPublicKeyInfo_der_encoder_functions[]; extern const OSSL_DISPATCH oqs_falcon512_p256_to_SubjectPublicKeyInfo_pem_encoder_functions[]; +extern const OSSL_DISPATCH oqs_falcon512_p256_to_text_encoder_functions[]; extern const OSSL_DISPATCH oqs_PrivateKeyInfo_der_to_falcon512_p256_decoder_functions[]; extern const OSSL_DISPATCH oqs_SubjectPublicKeyInfo_der_to_falcon512_p256_decoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium5_p384_to_PrivateKeyInfo_der_encoder_functions[]; @@ -1435,6 +1438,7 @@ extern const OSSL_DISPATCH oqs_dilithium5_p384_to_EncryptedPrivateKeyInfo_der_en extern const OSSL_DISPATCH oqs_dilithium5_p384_to_EncryptedPrivateKeyInfo_pem_encoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium5_p384_to_SubjectPublicKeyInfo_der_encoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium5_p384_to_SubjectPublicKeyInfo_pem_encoder_functions[]; +extern const OSSL_DISPATCH oqs_dilithium5_p384_to_text_encoder_functions[]; extern const OSSL_DISPATCH oqs_PrivateKeyInfo_der_to_dilithium5_p384_decoder_functions[]; extern const OSSL_DISPATCH oqs_SubjectPublicKeyInfo_der_to_dilithium5_p384_decoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium3_bp256_to_PrivateKeyInfo_der_encoder_functions[]; @@ -1443,6 +1447,7 @@ extern const OSSL_DISPATCH oqs_dilithium3_bp256_to_EncryptedPrivateKeyInfo_der_e extern const OSSL_DISPATCH oqs_dilithium3_bp256_to_EncryptedPrivateKeyInfo_pem_encoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium3_bp256_to_SubjectPublicKeyInfo_der_encoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium3_bp256_to_SubjectPublicKeyInfo_pem_encoder_functions[]; +extern const OSSL_DISPATCH oqs_dilithium3_bp256_to_text_encoder_functions[]; extern const OSSL_DISPATCH oqs_PrivateKeyInfo_der_to_dilithium3_bp256_decoder_functions[]; extern const OSSL_DISPATCH oqs_SubjectPublicKeyInfo_der_to_dilithium3_bp256_decoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium3_ed25519_to_PrivateKeyInfo_der_encoder_functions[]; @@ -1451,6 +1456,7 @@ extern const OSSL_DISPATCH oqs_dilithium3_ed25519_to_EncryptedPrivateKeyInfo_der extern const OSSL_DISPATCH oqs_dilithium3_ed25519_to_EncryptedPrivateKeyInfo_pem_encoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium3_ed25519_to_SubjectPublicKeyInfo_der_encoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium3_ed25519_to_SubjectPublicKeyInfo_pem_encoder_functions[]; +extern const OSSL_DISPATCH oqs_dilithium3_ed25519_to_text_encoder_functions[]; extern const OSSL_DISPATCH oqs_PrivateKeyInfo_der_to_dilithium3_ed25519_decoder_functions[]; extern const OSSL_DISPATCH oqs_SubjectPublicKeyInfo_der_to_dilithium3_ed25519_decoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium5_bp384_to_PrivateKeyInfo_der_encoder_functions[]; @@ -1459,6 +1465,7 @@ extern const OSSL_DISPATCH oqs_dilithium5_bp384_to_EncryptedPrivateKeyInfo_der_e extern const OSSL_DISPATCH oqs_dilithium5_bp384_to_EncryptedPrivateKeyInfo_pem_encoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium5_bp384_to_SubjectPublicKeyInfo_der_encoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium5_bp384_to_SubjectPublicKeyInfo_pem_encoder_functions[]; +extern const OSSL_DISPATCH oqs_dilithium5_bp384_to_text_encoder_functions[]; extern const OSSL_DISPATCH oqs_PrivateKeyInfo_der_to_dilithium5_bp384_decoder_functions[]; extern const OSSL_DISPATCH oqs_SubjectPublicKeyInfo_der_to_dilithium5_bp384_decoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium5_ed448_to_PrivateKeyInfo_der_encoder_functions[]; @@ -1467,6 +1474,7 @@ extern const OSSL_DISPATCH oqs_dilithium5_ed448_to_EncryptedPrivateKeyInfo_der_e extern const OSSL_DISPATCH oqs_dilithium5_ed448_to_EncryptedPrivateKeyInfo_pem_encoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium5_ed448_to_SubjectPublicKeyInfo_der_encoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium5_ed448_to_SubjectPublicKeyInfo_pem_encoder_functions[]; +extern const OSSL_DISPATCH oqs_dilithium5_ed448_to_text_encoder_functions[]; extern const OSSL_DISPATCH oqs_PrivateKeyInfo_der_to_dilithium5_ed448_decoder_functions[]; extern const OSSL_DISPATCH oqs_SubjectPublicKeyInfo_der_to_dilithium5_ed448_decoder_functions[]; extern const OSSL_DISPATCH oqs_falcon512_bp256_to_PrivateKeyInfo_der_encoder_functions[]; @@ -1475,6 +1483,7 @@ extern const OSSL_DISPATCH oqs_falcon512_bp256_to_EncryptedPrivateKeyInfo_der_en extern const OSSL_DISPATCH oqs_falcon512_bp256_to_EncryptedPrivateKeyInfo_pem_encoder_functions[]; extern const OSSL_DISPATCH oqs_falcon512_bp256_to_SubjectPublicKeyInfo_der_encoder_functions[]; extern const OSSL_DISPATCH oqs_falcon512_bp256_to_SubjectPublicKeyInfo_pem_encoder_functions[]; +extern const OSSL_DISPATCH oqs_falcon512_bp256_to_text_encoder_functions[]; extern const OSSL_DISPATCH oqs_PrivateKeyInfo_der_to_falcon512_bp256_decoder_functions[]; extern const OSSL_DISPATCH oqs_SubjectPublicKeyInfo_der_to_falcon512_bp256_decoder_functions[]; extern const OSSL_DISPATCH oqs_falcon512_ed25519_to_PrivateKeyInfo_der_encoder_functions[]; @@ -1483,6 +1492,7 @@ extern const OSSL_DISPATCH oqs_falcon512_ed25519_to_EncryptedPrivateKeyInfo_der_ extern const OSSL_DISPATCH oqs_falcon512_ed25519_to_EncryptedPrivateKeyInfo_pem_encoder_functions[]; extern const OSSL_DISPATCH oqs_falcon512_ed25519_to_SubjectPublicKeyInfo_der_encoder_functions[]; extern const OSSL_DISPATCH oqs_falcon512_ed25519_to_SubjectPublicKeyInfo_pem_encoder_functions[]; +extern const OSSL_DISPATCH oqs_falcon512_ed25519_to_text_encoder_functions[]; extern const OSSL_DISPATCH oqs_PrivateKeyInfo_der_to_falcon512_ed25519_decoder_functions[]; extern const OSSL_DISPATCH oqs_SubjectPublicKeyInfo_der_to_falcon512_ed25519_decoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium3_pss3072_to_PrivateKeyInfo_der_encoder_functions[]; @@ -1491,6 +1501,7 @@ extern const OSSL_DISPATCH oqs_dilithium3_pss3072_to_EncryptedPrivateKeyInfo_der extern const OSSL_DISPATCH oqs_dilithium3_pss3072_to_EncryptedPrivateKeyInfo_pem_encoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium3_pss3072_to_SubjectPublicKeyInfo_der_encoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium3_pss3072_to_SubjectPublicKeyInfo_pem_encoder_functions[]; +extern const OSSL_DISPATCH oqs_dilithium3_pss3072_to_text_encoder_functions[]; extern const OSSL_DISPATCH oqs_PrivateKeyInfo_der_to_dilithium3_pss3072_decoder_functions[]; extern const OSSL_DISPATCH oqs_SubjectPublicKeyInfo_der_to_dilithium3_pss3072_decoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium2_pss2048_to_PrivateKeyInfo_der_encoder_functions[]; @@ -1499,6 +1510,7 @@ extern const OSSL_DISPATCH oqs_dilithium2_pss2048_to_EncryptedPrivateKeyInfo_der extern const OSSL_DISPATCH oqs_dilithium2_pss2048_to_EncryptedPrivateKeyInfo_pem_encoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium2_pss2048_to_SubjectPublicKeyInfo_der_encoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium2_pss2048_to_SubjectPublicKeyInfo_pem_encoder_functions[]; +extern const OSSL_DISPATCH oqs_dilithium2_pss2048_to_text_encoder_functions[]; extern const OSSL_DISPATCH oqs_PrivateKeyInfo_der_to_dilithium2_pss2048_decoder_functions[]; extern const OSSL_DISPATCH oqs_SubjectPublicKeyInfo_der_to_dilithium2_pss2048_decoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium2_rsa2048_to_PrivateKeyInfo_der_encoder_functions[]; @@ -1507,6 +1519,7 @@ extern const OSSL_DISPATCH oqs_dilithium2_rsa2048_to_EncryptedPrivateKeyInfo_der extern const OSSL_DISPATCH oqs_dilithium2_rsa2048_to_EncryptedPrivateKeyInfo_pem_encoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium2_rsa2048_to_SubjectPublicKeyInfo_der_encoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium2_rsa2048_to_SubjectPublicKeyInfo_pem_encoder_functions[]; +extern const OSSL_DISPATCH oqs_dilithium2_rsa2048_to_text_encoder_functions[]; extern const OSSL_DISPATCH oqs_PrivateKeyInfo_der_to_dilithium2_rsa2048_decoder_functions[]; extern const OSSL_DISPATCH oqs_SubjectPublicKeyInfo_der_to_dilithium2_rsa2048_decoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium2_ed25519_to_PrivateKeyInfo_der_encoder_functions[]; @@ -1515,6 +1528,7 @@ extern const OSSL_DISPATCH oqs_dilithium2_ed25519_to_EncryptedPrivateKeyInfo_der extern const OSSL_DISPATCH oqs_dilithium2_ed25519_to_EncryptedPrivateKeyInfo_pem_encoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium2_ed25519_to_SubjectPublicKeyInfo_der_encoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium2_ed25519_to_SubjectPublicKeyInfo_pem_encoder_functions[]; +extern const OSSL_DISPATCH oqs_dilithium2_ed25519_to_text_encoder_functions[]; extern const OSSL_DISPATCH oqs_PrivateKeyInfo_der_to_dilithium2_ed25519_decoder_functions[]; extern const OSSL_DISPATCH oqs_SubjectPublicKeyInfo_der_to_dilithium2_ed25519_decoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium2_p256_to_PrivateKeyInfo_der_encoder_functions[]; @@ -1523,6 +1537,7 @@ extern const OSSL_DISPATCH oqs_dilithium2_p256_to_EncryptedPrivateKeyInfo_der_en extern const OSSL_DISPATCH oqs_dilithium2_p256_to_EncryptedPrivateKeyInfo_pem_encoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium2_p256_to_SubjectPublicKeyInfo_der_encoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium2_p256_to_SubjectPublicKeyInfo_pem_encoder_functions[]; +extern const OSSL_DISPATCH oqs_dilithium2_p256_to_text_encoder_functions[]; extern const OSSL_DISPATCH oqs_PrivateKeyInfo_der_to_dilithium2_p256_decoder_functions[]; extern const OSSL_DISPATCH oqs_SubjectPublicKeyInfo_der_to_dilithium2_p256_decoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium2_bp256_to_PrivateKeyInfo_der_encoder_functions[]; @@ -1531,6 +1546,7 @@ extern const OSSL_DISPATCH oqs_dilithium2_bp256_to_EncryptedPrivateKeyInfo_der_e extern const OSSL_DISPATCH oqs_dilithium2_bp256_to_EncryptedPrivateKeyInfo_pem_encoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium2_bp256_to_SubjectPublicKeyInfo_der_encoder_functions[]; extern const OSSL_DISPATCH oqs_dilithium2_bp256_to_SubjectPublicKeyInfo_pem_encoder_functions[]; +extern const OSSL_DISPATCH oqs_dilithium2_bp256_to_text_encoder_functions[]; extern const OSSL_DISPATCH oqs_PrivateKeyInfo_der_to_dilithium2_bp256_decoder_functions[]; extern const OSSL_DISPATCH oqs_SubjectPublicKeyInfo_der_to_dilithium2_bp256_decoder_functions[]; ///// OQS_TEMPLATE_FRAGMENT_ENDECODER_FUNCTIONS_END diff --git a/oqsprov/oqsencoders.inc b/oqsprov/oqsencoders.inc index 52e97f29..e12e45cb 100644 --- a/oqsprov/oqsencoders.inc +++ b/oqsprov/oqsencoders.inc @@ -590,6 +590,7 @@ ENCODER_w_structure("frodo640aes", frodo640aes, der, PrivateKeyInfo), SubjectPublicKeyInfo), ENCODER_w_structure("dilithium2_pss2048", dilithium2_pss2048, pem, SubjectPublicKeyInfo), + ENCODER_TEXT("dilithium2_pss2048", dilithium2_pss2048), ENCODER_w_structure("dilithium2_rsa2048", dilithium2_rsa2048, der, PrivateKeyInfo), ENCODER_w_structure("dilithium2_rsa2048", dilithium2_rsa2048, pem, @@ -602,6 +603,7 @@ ENCODER_w_structure("frodo640aes", frodo640aes, der, PrivateKeyInfo), SubjectPublicKeyInfo), ENCODER_w_structure("dilithium2_rsa2048", dilithium2_rsa2048, pem, SubjectPublicKeyInfo), + ENCODER_TEXT("dilithium2_rsa2048", dilithium2_rsa2048), ENCODER_w_structure("dilithium2_ed25519", dilithium2_ed25519, der, PrivateKeyInfo), ENCODER_w_structure("dilithium2_ed25519", dilithium2_ed25519, pem, @@ -614,6 +616,7 @@ ENCODER_w_structure("frodo640aes", frodo640aes, der, PrivateKeyInfo), SubjectPublicKeyInfo), ENCODER_w_structure("dilithium2_ed25519", dilithium2_ed25519, pem, SubjectPublicKeyInfo), + ENCODER_TEXT("dilithium2_ed25519", dilithium2_ed25519), ENCODER_w_structure("dilithium2_p256", dilithium2_p256, der, PrivateKeyInfo), ENCODER_w_structure("dilithium2_p256", dilithium2_p256, pem, @@ -626,6 +629,7 @@ ENCODER_w_structure("frodo640aes", frodo640aes, der, PrivateKeyInfo), SubjectPublicKeyInfo), ENCODER_w_structure("dilithium2_p256", dilithium2_p256, pem, SubjectPublicKeyInfo), + ENCODER_TEXT("dilithium2_p256", dilithium2_p256), ENCODER_w_structure("dilithium2_bp256", dilithium2_bp256, der, PrivateKeyInfo), ENCODER_w_structure("dilithium2_bp256", dilithium2_bp256, pem, @@ -638,6 +642,7 @@ ENCODER_w_structure("frodo640aes", frodo640aes, der, PrivateKeyInfo), SubjectPublicKeyInfo), ENCODER_w_structure("dilithium2_bp256", dilithium2_bp256, pem, SubjectPublicKeyInfo), + ENCODER_TEXT("dilithium2_bp256", dilithium2_bp256), #endif #ifdef OQS_ENABLE_SIG_dilithium_3 ENCODER_w_structure("dilithium3", dilithium3, der, PrivateKeyInfo), @@ -672,6 +677,7 @@ ENCODER_w_structure("frodo640aes", frodo640aes, der, PrivateKeyInfo), SubjectPublicKeyInfo), ENCODER_w_structure("dilithium3_rsa3072", dilithium3_rsa3072, pem, SubjectPublicKeyInfo), + ENCODER_TEXT("dilithium3_rsa3072", dilithium3_rsa3072), ENCODER_w_structure("dilithium3_p256", dilithium3_p256, der, PrivateKeyInfo), ENCODER_w_structure("dilithium3_p256", dilithium3_p256, pem, @@ -684,6 +690,7 @@ ENCODER_w_structure("frodo640aes", frodo640aes, der, PrivateKeyInfo), SubjectPublicKeyInfo), ENCODER_w_structure("dilithium3_p256", dilithium3_p256, pem, SubjectPublicKeyInfo), + ENCODER_TEXT("dilithium3_p256", dilithium3_p256), ENCODER_w_structure("dilithium3_bp256", dilithium3_bp256, der, PrivateKeyInfo), ENCODER_w_structure("dilithium3_bp256", dilithium3_bp256, pem, @@ -696,6 +703,7 @@ ENCODER_w_structure("frodo640aes", frodo640aes, der, PrivateKeyInfo), SubjectPublicKeyInfo), ENCODER_w_structure("dilithium3_bp256", dilithium3_bp256, pem, SubjectPublicKeyInfo), + ENCODER_TEXT("dilithium3_bp256", dilithium3_bp256), ENCODER_w_structure("dilithium3_ed25519", dilithium3_ed25519, der, PrivateKeyInfo), ENCODER_w_structure("dilithium3_ed25519", dilithium3_ed25519, pem, @@ -708,6 +716,7 @@ ENCODER_w_structure("frodo640aes", frodo640aes, der, PrivateKeyInfo), SubjectPublicKeyInfo), ENCODER_w_structure("dilithium3_ed25519", dilithium3_ed25519, pem, SubjectPublicKeyInfo), + ENCODER_TEXT("dilithium3_ed25519", dilithium3_ed25519), ENCODER_w_structure("dilithium3_pss3072", dilithium3_pss3072, der, PrivateKeyInfo), ENCODER_w_structure("dilithium3_pss3072", dilithium3_pss3072, pem, @@ -720,6 +729,7 @@ ENCODER_w_structure("frodo640aes", frodo640aes, der, PrivateKeyInfo), SubjectPublicKeyInfo), ENCODER_w_structure("dilithium3_pss3072", dilithium3_pss3072, pem, SubjectPublicKeyInfo), + ENCODER_TEXT("dilithium3_pss3072", dilithium3_pss3072), #endif #ifdef OQS_ENABLE_SIG_dilithium_5 @@ -755,6 +765,7 @@ ENCODER_w_structure("frodo640aes", frodo640aes, der, PrivateKeyInfo), SubjectPublicKeyInfo), ENCODER_w_structure("dilithium5_p384", dilithium5_p384, pem, SubjectPublicKeyInfo), + ENCODER_TEXT("dilithium5_p384", dilithium5_p384), ENCODER_w_structure("dilithium5_bp384", dilithium5_bp384, der, PrivateKeyInfo), ENCODER_w_structure("dilithium5_bp384", dilithium5_bp384, pem, @@ -767,6 +778,7 @@ ENCODER_w_structure("frodo640aes", frodo640aes, der, PrivateKeyInfo), SubjectPublicKeyInfo), ENCODER_w_structure("dilithium5_bp384", dilithium5_bp384, pem, SubjectPublicKeyInfo), + ENCODER_TEXT("dilithium5_bp384", dilithium5_bp384), ENCODER_w_structure("dilithium5_ed448", dilithium5_ed448, der, PrivateKeyInfo), ENCODER_w_structure("dilithium5_ed448", dilithium5_ed448, pem, @@ -779,6 +791,7 @@ ENCODER_w_structure("frodo640aes", frodo640aes, der, PrivateKeyInfo), SubjectPublicKeyInfo), ENCODER_w_structure("dilithium5_ed448", dilithium5_ed448, pem, SubjectPublicKeyInfo), + ENCODER_TEXT("dilithium5_ed448", dilithium5_ed448), #endif #ifdef OQS_ENABLE_SIG_falcon_512 ENCODER_w_structure("falcon512", falcon512, der, PrivateKeyInfo), @@ -798,6 +811,7 @@ ENCODER_w_structure("frodo640aes", frodo640aes, der, PrivateKeyInfo), 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, @@ -810,6 +824,7 @@ ENCODER_w_structure("frodo640aes", frodo640aes, der, PrivateKeyInfo), SubjectPublicKeyInfo), ENCODER_w_structure("rsa3072_falcon512", rsa3072_falcon512, pem, SubjectPublicKeyInfo), + ENCODER_TEXT("rsa3072_falcon512", rsa3072_falcon512), ENCODER_w_structure("falcon512_p256", falcon512_p256, der, PrivateKeyInfo), ENCODER_w_structure("falcon512_p256", falcon512_p256, pem, @@ -822,6 +837,7 @@ ENCODER_w_structure("frodo640aes", frodo640aes, der, PrivateKeyInfo), SubjectPublicKeyInfo), ENCODER_w_structure("falcon512_p256", falcon512_p256, pem, SubjectPublicKeyInfo), + ENCODER_TEXT("falcon512_p256", falcon512_p256), ENCODER_w_structure("falcon512_bp256", falcon512_bp256, der, PrivateKeyInfo), ENCODER_w_structure("falcon512_bp256", falcon512_bp256, pem, @@ -834,6 +850,7 @@ ENCODER_w_structure("frodo640aes", frodo640aes, der, PrivateKeyInfo), SubjectPublicKeyInfo), ENCODER_w_structure("falcon512_bp256", falcon512_bp256, pem, SubjectPublicKeyInfo), + ENCODER_TEXT("falcon512_bp256", falcon512_bp256), ENCODER_w_structure("falcon512_ed25519", falcon512_ed25519, der, PrivateKeyInfo), ENCODER_w_structure("falcon512_ed25519", falcon512_ed25519, pem, @@ -846,6 +863,7 @@ ENCODER_w_structure("frodo640aes", frodo640aes, der, PrivateKeyInfo), SubjectPublicKeyInfo), ENCODER_w_structure("falcon512_ed25519", falcon512_ed25519, pem, SubjectPublicKeyInfo), + ENCODER_TEXT("falcon512_ed25519", falcon512_ed25519), #endif #ifdef OQS_ENABLE_SIG_falcon_1024 ENCODER_w_structure("falcon1024", falcon1024, der, PrivateKeyInfo),