From eccb7907a7b84eeb1cbe78a5a66feecc2cbefea7 Mon Sep 17 00:00:00 2001 From: Norman Ashley Date: Thu, 29 Aug 2024 01:49:27 -0400 Subject: [PATCH 1/8] Fix various static analysis issues. Signed-off-by: Norman Ashley --- oqsprov/oqs_encode_key2any.c | 11 ++++++++++- oqsprov/oqs_kem.c | 21 +++++++++------------ oqsprov/oqs_kmgmt.c | 2 +- oqsprov/oqsprov_keys.c | 10 ++++++---- test/oqs_test_evp_pkey_params.c | 2 ++ 5 files changed, 28 insertions(+), 18 deletions(-) diff --git a/oqsprov/oqs_encode_key2any.c b/oqsprov/oqs_encode_key2any.c index a1395325..ca9b571d 100644 --- a/oqsprov/oqs_encode_key2any.c +++ b/oqsprov/oqs_encode_key2any.c @@ -662,10 +662,19 @@ static int oqsx_pki_priv_to_der(const void *vxkey, unsigned char **pder) { OPENSSL_malloc(oqsxkey->numkeys * sizeof(unsigned char *)); size_t *templen = OPENSSL_malloc(oqsxkey->numkeys * sizeof(size_t)); PKCS8_PRIV_KEY_INFO *p8inf_internal = NULL; + sk = sk_ASN1_TYPE_new_null(); int i; - if ((sk = sk_ASN1_TYPE_new_null()) == NULL) + if (!sk || !templen || !aType || !aString || !temp) { + OPENSSL_free(aType); + OPENSSL_free(aString); + OPENSSL_free(temp); + OPENSSL_free(templen); + if (sk) { + sk_ASN1_TYPE_pop_free(sk, ASN1_TYPE_free); + } return -1; + } for (i = 0; i < oqsxkey->numkeys; i++) { aType[i] = ASN1_TYPE_new(); diff --git a/oqsprov/oqs_kem.c b/oqsprov/oqs_kem.c index 84ac17d0..adc11f46 100644 --- a/oqsprov/oqs_kem.c +++ b/oqsprov/oqs_kem.c @@ -115,18 +115,6 @@ static int oqs_qs_kem_encaps_keyslot(void *vpkemctx, unsigned char *out, OQS_KEM_PRINTF("OQS Warning: public key is NULL\n"); return -1; } - if (out == NULL || secret == NULL) { - if (outlen != NULL) { - *outlen = kem_ctx->length_ciphertext; - } - if (secretlen != NULL) { - *secretlen = kem_ctx->length_shared_secret; - } - OQS_KEM_PRINTF3("KEM returning lengths %ld and %ld\n", - kem_ctx->length_ciphertext, - kem_ctx->length_shared_secret); - return 1; - } if (outlen == NULL) { OQS_KEM_PRINTF("OQS Warning: outlen is NULL\n"); return -1; @@ -135,6 +123,15 @@ static int oqs_qs_kem_encaps_keyslot(void *vpkemctx, unsigned char *out, OQS_KEM_PRINTF("OQS Warning: secretlen is NULL\n"); return -1; } + if (out == NULL || secret == NULL) { + *outlen = kem_ctx->length_ciphertext; + *secretlen = kem_ctx->length_shared_secret; + OQS_KEM_PRINTF3("KEM returning lengths %ld and %ld\n", + kem_ctx->length_ciphertext, + kem_ctx->length_shared_secret); + return 1; + } + if (*outlen < kem_ctx->length_ciphertext) { OQS_KEM_PRINTF("OQS Warning: out buffer too small\n"); return -1; diff --git a/oqsprov/oqs_kmgmt.c b/oqsprov/oqs_kmgmt.c index c24ccaaf..1480abbc 100644 --- a/oqsprov/oqs_kmgmt.c +++ b/oqsprov/oqs_kmgmt.c @@ -376,7 +376,7 @@ static int oqsx_get_hybrid_params(OQSX_KEY *key, OSSL_PARAM params[]) { DECODE_UINT32(classical_privkey_len, key->privkey); } - if (key->comp_pubkey[1] != NULL) { + if (key->comp_pubkey && key->comp_pubkey[1] != NULL) { pq_pubkey = key->comp_pubkey[1]; pq_pubkey_len = key->pubkeylen - classical_pubkey_len - SIZE_OF_UINT32; } diff --git a/oqsprov/oqsprov_keys.c b/oqsprov/oqsprov_keys.c index d711ff56..173a3120 100644 --- a/oqsprov/oqsprov_keys.c +++ b/oqsprov/oqsprov_keys.c @@ -1497,10 +1497,12 @@ OQSX_KEY *oqsx_key_new(OSSL_LIB_CTX *libctx, char *oqs_name, char *tls_name, if (ret->lock) CRYPTO_THREAD_lock_free(ret->lock); #endif - OPENSSL_free(ret->tls_name); - OPENSSL_free(ret->propq); - OPENSSL_free(ret->comp_privkey); - OPENSSL_free(ret->comp_pubkey); + if (ret) { + OPENSSL_free(ret->tls_name); + OPENSSL_free(ret->propq); + OPENSSL_free(ret->comp_privkey); + OPENSSL_free(ret->comp_pubkey); + } OPENSSL_free(ret); return NULL; } diff --git a/test/oqs_test_evp_pkey_params.c b/test/oqs_test_evp_pkey_params.c index 18ac883a..b85f9cd1 100644 --- a/test/oqs_test_evp_pkey_params.c +++ b/test/oqs_test_evp_pkey_params.c @@ -534,6 +534,7 @@ int main(int argc, char **argv) { fprintf(stderr, cRED " No signature algorithms found" cNORM "\n"); ERR_print_errors_fp(stderr); ++errcnt; + goto next_alg; } for (; algs->algorithm_names != NULL; ++algs) { @@ -550,6 +551,7 @@ int main(int argc, char **argv) { } } +next_alg: algs = OSSL_PROVIDER_query_operation(oqs_provider, OSSL_OP_KEM, &query_nocache); if (!algs) { From d6b5a90989fcf078d06ba33131b8f24f03ddc8cd Mon Sep 17 00:00:00 2001 From: Norman Ashley Date: Sat, 31 Aug 2024 15:06:39 -0400 Subject: [PATCH 2/8] Fix Dereference before null check. Signed-off-by: Norman Ashley --- oqsprov/oqs_kem.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/oqsprov/oqs_kem.c b/oqsprov/oqs_kem.c index adc11f46..aba8c073 100644 --- a/oqsprov/oqs_kem.c +++ b/oqsprov/oqs_kem.c @@ -103,13 +103,15 @@ static int oqs_qs_kem_encaps_keyslot(void *vpkemctx, unsigned char *out, size_t *outlen, unsigned char *secret, 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; + const OQS_KEM *kem_ctx = NULL; OQS_KEM_PRINTF("OQS KEM provider called: encaps\n"); - if (pkemctx->kem == NULL) { + if (!pkemctx->kem || !pkemctx->kem->oqsx_provider_ctx) { OQS_KEM_PRINTF("OQS Warning: OQS_KEM not initialized\n"); return -1; } + + kem_ctx = pkemctx->kem->oqsx_provider_ctx.oqsx_qs_ctx.kem; if (pkemctx->kem->comp_pubkey == NULL || pkemctx->kem->comp_pubkey[keyslot] == NULL) { OQS_KEM_PRINTF("OQS Warning: public key is NULL\n"); From a1882064a33f9ed295d15ab0f0338987b217e1ae Mon Sep 17 00:00:00 2001 From: Norman Ashley Date: Sat, 31 Aug 2024 15:30:18 -0400 Subject: [PATCH 3/8] Fix Dereference before null check. Signed-off-by: Norman Ashley --- oqsprov/oqs_kem.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/oqsprov/oqs_kem.c b/oqsprov/oqs_kem.c index aba8c073..0ed3fbe4 100644 --- a/oqsprov/oqs_kem.c +++ b/oqsprov/oqs_kem.c @@ -106,7 +106,7 @@ static int oqs_qs_kem_encaps_keyslot(void *vpkemctx, unsigned char *out, const OQS_KEM *kem_ctx = NULL; OQS_KEM_PRINTF("OQS KEM provider called: encaps\n"); - if (!pkemctx->kem || !pkemctx->kem->oqsx_provider_ctx) { + if (pkemctx->kem == NULL) { OQS_KEM_PRINTF("OQS Warning: OQS_KEM not initialized\n"); return -1; } @@ -153,13 +153,14 @@ static int oqs_qs_kem_decaps_keyslot(void *vpkemctx, unsigned char *out, size_t *outlen, const unsigned char *in, 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; + const OQS_KEM *kem_ctx = NULL; OQS_KEM_PRINTF("OQS KEM provider called: decaps\n"); if (pkemctx->kem == NULL) { OQS_KEM_PRINTF("OQS Warning: OQS_KEM not initialized\n"); return -1; } + kem_ctx = pkemctx->kem->oqsx_provider_ctx.oqsx_qs_ctx.kem; if (pkemctx->kem->comp_privkey == NULL || pkemctx->kem->comp_privkey[keyslot] == NULL) { OQS_KEM_PRINTF("OQS Warning: private key is NULL\n"); From 6ed95c46d935ad73ed37894aa33648e3cc22db8f Mon Sep 17 00:00:00 2001 From: Jan Schaumann Date: Fri, 6 Sep 2024 11:02:21 +0000 Subject: [PATCH 4/8] add support for the CMAKE_PARAMS environment variable (#510) * add support for the CMAKE_PARAMS environment variable Signed-off-by: Jan Schaumann --------- Signed-off-by: Jan Schaumann Signed-off-by: Norman Ashley --- CONFIGURE.md | 10 ++++++++++ scripts/fullbuild.sh | 7 ++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CONFIGURE.md b/CONFIGURE.md index 63dccf97..309c9570 100644 --- a/CONFIGURE.md +++ b/CONFIGURE.md @@ -30,6 +30,16 @@ activate further warning messages. In particular, when "Debug" has been set, dis [debugging capabilities](https://github.com/open-quantum-safe/oqs-provider/wiki/Debugging) are activated and additional setup warnings are output. +### CMAKE_PARAMS + +This environment variable lets you specify additional flags to pass to `cmake` explicitly when using the `fullbuild.sh` script. + +For example, in order to point `cmake` to a specific library, you might run: + +``` +$ env CMAKE_PARAMS="-DOPENSSL_CRYPTO_LIBRARY=/opt/lib64/libcrypto.so" bash scripts/fullbuild.sh +``` + ### liboqs_DIR This environment variable must be set to the location of the `liboqs` installation to be diff --git a/scripts/fullbuild.sh b/scripts/fullbuild.sh index 4640b575..33de4c75 100755 --- a/scripts/fullbuild.sh +++ b/scripts/fullbuild.sh @@ -3,6 +3,7 @@ # The following variables influence the operation of this build script: # Argument -f: Soft clean, ensuring re-build of oqs-provider binary # Argument -F: Hard clean, ensuring checkout and build of all dependencies +# EnvVar CMAKE_PARAMS: passed to cmake # EnvVar MAKE_PARAMS: passed to invocations of make; sample value: "-j" # EnvVar OQSPROV_CMAKE_PARAMS: passed to invocations of oqsprovider cmake # EnvVar LIBOQS_BRANCH: Defines branch/release of liboqs; default value "main" @@ -108,7 +109,7 @@ if [ -z $liboqs_DIR ]; then # STD: only include NIST standardized algorithms # NIST_R4: only include algorithms in round 4 of the NIST competition # All: include all algorithms supported by liboqs (default) - cd liboqs && cmake -GNinja $DOQS_ALGS_ENABLED $CMAKE_OPENSSL_LOCATION -DCMAKE_INSTALL_PREFIX=$(pwd)/../.local -S . -B _build && cd _build && ninja && ninja install && cd ../.. + cd liboqs && cmake -GNinja $CMAKE_PARAMS $DOQS_ALGS_ENABLED $CMAKE_OPENSSL_LOCATION -DCMAKE_INSTALL_PREFIX=$(pwd)/../.local -S . -B _build && cd _build && ninja && ninja install && cd ../.. if [ $? -ne 0 ]; then echo "liboqs build failed. Exiting." exit -1 @@ -125,9 +126,9 @@ if [ ! -f "_build/lib/oqsprovider.$SHLIBEXT" ]; then BUILD_TYPE="" # for omitting public key in private keys add -DNOPUBKEY_IN_PRIVKEY=ON if [ -z "$OPENSSL_INSTALL" ]; then - cmake $CMAKE_OPENSSL_LOCATION $BUILD_TYPE $OQSPROV_CMAKE_PARAMS -S . -B _build && cmake --build _build + cmake $CMAKE_PARAMS $CMAKE_OPENSSL_LOCATION $BUILD_TYPE $OQSPROV_CMAKE_PARAMS -S . -B _build && cmake --build _build else - cmake -DOPENSSL_ROOT_DIR=$OPENSSL_INSTALL $BUILD_TYPE $OQSPROV_CMAKE_PARAMS -S . -B _build && cmake --build _build + cmake $CMAKE_PARAMS -DOPENSSL_ROOT_DIR=$OPENSSL_INSTALL $BUILD_TYPE $OQSPROV_CMAKE_PARAMS -S . -B _build && cmake --build _build fi if [ $? -ne 0 ]; then echo "provider build failed. Exiting." From 601c14c3153a4bd96b9e789340058ca6212c7c4e Mon Sep 17 00:00:00 2001 From: Michael Baentsch <57787676+baentsch@users.noreply.github.com> Date: Wed, 11 Sep 2024 12:39:39 +0200 Subject: [PATCH 5/8] update MLKEM code points (#511) * update X25519-MLKEM768 code point Signed-off-by: Michael Baentsch <57787676+baentsch@users.noreply.github.com> * further MLKEM (O)ID updates Signed-off-by: Michael Baentsch <57787676+baentsch@users.noreply.github.com> * set p256_mlkem768 code point as per standard Signed-off-by: Michael Baentsch <57787676+baentsch@users.noreply.github.com> --------- Signed-off-by: Michael Baentsch <57787676+baentsch@users.noreply.github.com> Signed-off-by: Norman Ashley --- ALGORITHMS.md | 28 +++++++++---------- oqs-template/generate.yml | 50 ++++++++++++++++++++++++---------- oqs-template/oqs-kem-info.md | 22 +++++++-------- oqsprov/oqsprov.c | 6 ++-- oqsprov/oqsprov_capabilities.c | 22 +++++++-------- 5 files changed, 74 insertions(+), 54 deletions(-) diff --git a/ALGORITHMS.md b/ALGORITHMS.md index df2d1fcf..236cef8a 100644 --- a/ALGORITHMS.md +++ b/ALGORITHMS.md @@ -38,17 +38,17 @@ As standardization for these algorithms within TLS is not done, all TLS code poi | p256_kyber768 | 0x639A | Yes | OQS_CODEPOINT_P256_KYBER768 | | kyber1024 | 0x023D | Yes | OQS_CODEPOINT_KYBER1024 | | p521_kyber1024 | 0x2F3D | Yes | OQS_CODEPOINT_P521_KYBER1024 | -| mlkem512 | 0x0247 | Yes | OQS_CODEPOINT_MLKEM512 | -| p256_mlkem512 | 0x2F47 | Yes | OQS_CODEPOINT_P256_MLKEM512 | -| x25519_mlkem512 | 0x2FB2 | Yes | OQS_CODEPOINT_X25519_MLKEM512 | -| mlkem768 | 0x0248 | Yes | OQS_CODEPOINT_MLKEM768 | -| p384_mlkem768 | 0x2F48 | Yes | OQS_CODEPOINT_P384_MLKEM768 | -| x448_mlkem768 | 0x2FB3 | Yes | OQS_CODEPOINT_X448_MLKEM768 | -| x25519_mlkem768 | 0x2FB4 | Yes | OQS_CODEPOINT_X25519_MLKEM768 | -| p256_mlkem768 | 0x2FB5 | Yes | OQS_CODEPOINT_P256_MLKEM768 | -| mlkem1024 | 0x0249 | Yes | OQS_CODEPOINT_MLKEM1024 | -| p521_mlkem1024 | 0x2F49 | Yes | OQS_CODEPOINT_P521_MLKEM1024 | -| p384_mlkem1024 | 0x2F4A | Yes | OQS_CODEPOINT_P384_MLKEM1024 | +| mlkem512 | 0x024A | Yes | OQS_CODEPOINT_MLKEM512 | +| p256_mlkem512 | 0x2F4B | Yes | OQS_CODEPOINT_P256_MLKEM512 | +| x25519_mlkem512 | 0x2FB6 | Yes | OQS_CODEPOINT_X25519_MLKEM512 | +| mlkem768 | 0x0768 | Yes | OQS_CODEPOINT_MLKEM768 | +| p384_mlkem768 | 0x2F4C | Yes | OQS_CODEPOINT_P384_MLKEM768 | +| x448_mlkem768 | 0x2FB7 | Yes | OQS_CODEPOINT_X448_MLKEM768 | +| x25519_mlkem768 | 0x2FB8 | Yes | OQS_CODEPOINT_X25519_MLKEM768 | +| p256_mlkem768 | 4587 | Yes | OQS_CODEPOINT_P256_MLKEM768 | +| mlkem1024 | 0x1024 | Yes | OQS_CODEPOINT_MLKEM1024 | +| p521_mlkem1024 | 0x2F4D | Yes | OQS_CODEPOINT_P521_MLKEM1024 | +| p384_mlkem1024 | 0x2F4E | Yes | OQS_CODEPOINT_P384_MLKEM1024 | | bikel1 | 0x0241 | Yes | OQS_CODEPOINT_BIKEL1 | | p256_bikel1 | 0x2F41 | Yes | OQS_CODEPOINT_P256_BIKEL1 | | x25519_bikel1 | 0x2FAE | Yes | OQS_CODEPOINT_X25519_BIKEL1 | @@ -254,15 +254,15 @@ If [OQS_KEM_ENCODERS](CONFIGURE.md#OQS_KEM_ENCODERS) is enabled the following li | p256_kyber768 | 1.3.9999.99.52 | OQS_OID_P256_KYBER768 | kyber1024 | 1.3.6.1.4.1.2.267.8.4.4 | OQS_OID_KYBER1024 | p521_kyber1024 | 1.3.9999.99.74 | OQS_OID_P521_KYBER1024 -| mlkem512 | 1.3.6.1.4.1.22554.5.6.1 | OQS_OID_MLKEM512 +| mlkem512 | 2.16.840.1.101.3.4.4.1 | OQS_OID_MLKEM512 | p256_mlkem512 | 1.3.6.1.4.1.22554.5.7.1 | OQS_OID_P256_MLKEM512 | x25519_mlkem512 | 1.3.6.1.4.1.22554.5.8.1 | OQS_OID_X25519_MLKEM512 -| mlkem768 | 1.3.6.1.4.1.22554.5.6.2 | OQS_OID_MLKEM768 +| mlkem768 | 2.16.840.1.101.3.4.4.2 | OQS_OID_MLKEM768 | p384_mlkem768 | 1.3.9999.99.75 | OQS_OID_P384_MLKEM768 | x448_mlkem768 | 1.3.9999.99.53 | OQS_OID_X448_MLKEM768 | x25519_mlkem768 | 1.3.9999.99.54 | OQS_OID_X25519_MLKEM768 | p256_mlkem768 | 1.3.9999.99.55 | OQS_OID_P256_MLKEM768 -| mlkem1024 | 1.3.6.1.4.1.22554.5.6.3 | OQS_OID_MLKEM1024 +| mlkem1024 | 2.16.840.1.101.3.4.4.3 | OQS_OID_MLKEM1024 | p521_mlkem1024 | 1.3.9999.99.76 | OQS_OID_P521_MLKEM1024 | p384_mlkem1024 | 1.3.6.1.4.1.42235.6 | OQS_OID_P384_MLKEM1024 | bikel1 | 1.3.9999.99.78 | OQS_OID_BIKEL1 diff --git a/oqs-template/generate.yml b/oqs-template/generate.yml index 571dfdc1..514c05e6 100644 --- a/oqs-template/generate.yml +++ b/oqs-template/generate.yml @@ -1,5 +1,5 @@ # This is the master document for ID interoperability for KEM IDs, p-hybrid KEM IDs, SIG (O)IDs -# Next free plain KEM ID: 0x024A, p-hybrid: 0x2F4B, X-hybrid: 0x2FB6 +# Next free plain KEM ID: 0x024D, p-hybrid: 0x2F4F, X-hybrid: 0x2FB9 kems: - family: 'FrodoKEM' @@ -143,40 +143,58 @@ kems: hybrid_group: secp521_r1 nid: '0x2F11' oqs_alg: 'OQS_KEM_alg_kyber_1024' +# end of IBM support section +# NIST OIDs see https://csrc.nist.gov/projects/computer-security-objects-register/algorithm-registration +# KEM prefix 2.16.840.1.101.3.4.4. - family: 'ML-KEM' name_group: 'mlkem512' - nid: '0x0247' - oid: '1.3.6.1.4.1.22554.5.6.1' - nid_hybrid: '0x2F47' +# code point not standardized: Why? XXX + nid: '0x024A' +# NIST kem 1 + oid: '2.16.840.1.101.3.4.4.1' +# code point not standardized: Why? XXX + nid_hybrid: '0x2F4B' +# retain OIDs of the Legion of the BouncyCastle: XXX check if OK hybrid_oid: '1.3.6.1.4.1.22554.5.7.1' oqs_alg: 'OQS_KEM_alg_ml_kem_512' extra_nids: current: - hybrid_group: "x25519" +# retain OIDs of the Legion of the BouncyCastle: XXX check if OK hybrid_oid: '1.3.6.1.4.1.22554.5.8.1' - nid: '0x2FB2' +# code point not standardized: Why? XXX + nid: '0x2FB6' - family: 'ML-KEM' name_group: 'mlkem768' - nid: '0x0248' - oid: '1.3.6.1.4.1.22554.5.6.2' - nid_hybrid: '0x2F48' +# https://www.ietf.org/archive/id/draft-connolly-tls-mlkem-key-agreement-01.html + nid: '0x0768' +# NIST kem 2 + oid: '2.16.840.1.101.3.4.4.2' +# code point not standardized: Why? XXX + nid_hybrid: '0x2F4C' oqs_alg: 'OQS_KEM_alg_ml_kem_768' extra_nids: current: - hybrid_group: "x448" - nid: '0x2FB3' +# code point not standardized: Why? XXX + nid: '0x2FB7' +# To change when hybrid order change implemented, see https://github.com/open-quantum-safe/oqs-provider/issues/503 - hybrid_group: "x25519" - nid: '0x2FB4' + nid: '0x2FB8' - hybrid_group: "p256" - nid: '0x2FB5' +# https://www.ietf.org/archive/id/draft-kwiatkowski-tls-ecdhe-mlkem-01.html#name-iana-considerations + nid: '4587' - family: 'ML-KEM' name_group: 'mlkem1024' - nid: '0x0249' - oid: '1.3.6.1.4.1.22554.5.6.3' - nid_hybrid: '0x2F49' +# https://www.ietf.org/archive/id/draft-connolly-tls-mlkem-key-agreement-01.html + nid: '0x1024' +# NIST kem 3 + oid: '2.16.840.1.101.3.4.4.3' +# code point not standardized: Why? XXX + nid_hybrid: '0x2F4D' oqs_alg: 'OQS_KEM_alg_ml_kem_1024' extra_nids: current: @@ -184,8 +202,10 @@ kems: # this oid is proposed by Tresorit # if the hybrid combination is standardized, feel free to change it - hybrid_group: "p384" +# does Tresorit want to update? hybrid_oid: '1.3.6.1.4.1.42235.6' - nid: '0x2F4A' +# code point not standardized: Why? XXX + nid: '0x2F4E' - family: 'BIKE' name_group: 'bike1l1fo' diff --git a/oqs-template/oqs-kem-info.md b/oqs-template/oqs-kem-info.md index dafa41cb..db953c5b 100644 --- a/oqs-template/oqs-kem-info.md +++ b/oqs-template/oqs-kem-info.md @@ -85,14 +85,14 @@ | HQC | 2023-04-30 | hqc192 | 4 | 3 | 0x2FB1 | x448 | | HQC | 2023-04-30 | hqc256 | 4 | 5 | 0x0246 | | | HQC | 2023-04-30 | hqc256 | 4 | 5 | 0x2F46 | secp521_r1 | -| ML-KEM | ML-KEM-ipd | mlkem1024 | ipd | 5 | 0x0249 | | -| ML-KEM | ML-KEM-ipd | mlkem1024 | ipd | 5 | 0x2F49 | secp521_r1 | -| ML-KEM | ML-KEM-ipd | mlkem1024 | ipd | 5 | 0x2F4A | p384 | -| ML-KEM | ML-KEM-ipd | mlkem512 | ipd | 1 | 0x0247 | | -| ML-KEM | ML-KEM-ipd | mlkem512 | ipd | 1 | 0x2F47 | secp256_r1 | -| ML-KEM | ML-KEM-ipd | mlkem512 | ipd | 1 | 0x2FB2 | x25519 | -| ML-KEM | ML-KEM-ipd | mlkem768 | ipd | 3 | 0x0248 | | -| ML-KEM | ML-KEM-ipd | mlkem768 | ipd | 3 | 0x2F48 | secp384_r1 | -| ML-KEM | ML-KEM-ipd | mlkem768 | ipd | 3 | 0x2FB3 | x448 | -| ML-KEM | ML-KEM-ipd | mlkem768 | ipd | 3 | 0x2FB4 | x25519 | -| ML-KEM | ML-KEM-ipd | mlkem768 | ipd | 3 | 0x2FB5 | p256 | +| ML-KEM | ML-KEM | mlkem1024 | FIPS203 | 5 | 0x1024 | | +| ML-KEM | ML-KEM | mlkem1024 | FIPS203 | 5 | 0x2F4D | secp521_r1 | +| ML-KEM | ML-KEM | mlkem1024 | FIPS203 | 5 | 0x2F4E | p384 | +| ML-KEM | ML-KEM | mlkem512 | FIPS203 | 1 | 0x024A | | +| ML-KEM | ML-KEM | mlkem512 | FIPS203 | 1 | 0x2F4B | secp256_r1 | +| ML-KEM | ML-KEM | mlkem512 | FIPS203 | 1 | 0x2FB6 | x25519 | +| ML-KEM | ML-KEM | mlkem768 | FIPS203 | 3 | 0x0768 | | +| ML-KEM | ML-KEM | mlkem768 | FIPS203 | 3 | 0x2F4C | secp384_r1 | +| ML-KEM | ML-KEM | mlkem768 | FIPS203 | 3 | 0x2FB7 | x448 | +| ML-KEM | ML-KEM | mlkem768 | FIPS203 | 3 | 0x2FB8 | x25519 | +| ML-KEM | ML-KEM | mlkem768 | FIPS203 | 3 | 4587 | p256 | diff --git a/oqsprov/oqsprov.c b/oqsprov/oqsprov.c index 5a2f93ce..b95a1741 100644 --- a/oqsprov/oqsprov.c +++ b/oqsprov/oqsprov.c @@ -111,13 +111,13 @@ const char *oqs_oid_alg_list[OQS_OID_CNT] = { "kyber1024", "1.3.9999.99.30", "p521_kyber1024", - "1.3.6.1.4.1.22554.5.6.1", + "2.16.840.1.101.3.4.4.1", "mlkem512", "1.3.6.1.4.1.22554.5.7.1", "p256_mlkem512", "1.3.6.1.4.1.22554.5.8.1", "x25519_mlkem512", - "1.3.6.1.4.1.22554.5.6.2", + "2.16.840.1.101.3.4.4.2", "mlkem768", "1.3.9999.99.31", "p384_mlkem768", @@ -127,7 +127,7 @@ const char *oqs_oid_alg_list[OQS_OID_CNT] = { "x25519_mlkem768", "1.3.9999.99.11", "p256_mlkem768", - "1.3.6.1.4.1.22554.5.6.3", + "2.16.840.1.101.3.4.4.3", "mlkem1024", "1.3.9999.99.32", "p521_mlkem1024", diff --git a/oqsprov/oqsprov_capabilities.c b/oqsprov/oqsprov_capabilities.c index f3e3ea70..d51631b0 100644 --- a/oqsprov/oqsprov_capabilities.c +++ b/oqsprov/oqsprov_capabilities.c @@ -70,20 +70,20 @@ static OQS_GROUP_CONSTANTS oqs_group_list[] = { {0x023D, 256, TLS1_3_VERSION, 0, -1, -1, 1}, {0x2F3D, 256, TLS1_3_VERSION, 0, -1, -1, 1}, - {0x0247, 128, TLS1_3_VERSION, 0, -1, -1, 1}, + {0x024A, 128, TLS1_3_VERSION, 0, -1, -1, 1}, - {0x2F47, 128, TLS1_3_VERSION, 0, -1, -1, 1}, - {0x2FB2, 128, TLS1_3_VERSION, 0, -1, -1, 1}, - {0x0248, 192, TLS1_3_VERSION, 0, -1, -1, 1}, + {0x2F4B, 128, TLS1_3_VERSION, 0, -1, -1, 1}, + {0x2FB6, 128, TLS1_3_VERSION, 0, -1, -1, 1}, + {0x0768, 192, TLS1_3_VERSION, 0, -1, -1, 1}, - {0x2F48, 192, TLS1_3_VERSION, 0, -1, -1, 1}, - {0x2FB3, 192, TLS1_3_VERSION, 0, -1, -1, 1}, - {0x2FB4, 192, TLS1_3_VERSION, 0, -1, -1, 1}, - {0x2FB5, 192, TLS1_3_VERSION, 0, -1, -1, 1}, - {0x0249, 256, TLS1_3_VERSION, 0, -1, -1, 1}, + {0x2F4C, 192, TLS1_3_VERSION, 0, -1, -1, 1}, + {0x2FB7, 192, TLS1_3_VERSION, 0, -1, -1, 1}, + {0x2FB8, 192, TLS1_3_VERSION, 0, -1, -1, 1}, + {4587, 192, TLS1_3_VERSION, 0, -1, -1, 1}, + {0x1024, 256, TLS1_3_VERSION, 0, -1, -1, 1}, - {0x2F49, 256, TLS1_3_VERSION, 0, -1, -1, 1}, - {0x2F4A, 256, TLS1_3_VERSION, 0, -1, -1, 1}, + {0x2F4D, 256, TLS1_3_VERSION, 0, -1, -1, 1}, + {0x2F4E, 256, TLS1_3_VERSION, 0, -1, -1, 1}, {0x0241, 128, TLS1_3_VERSION, 0, -1, -1, 1}, {0x2F41, 128, TLS1_3_VERSION, 0, -1, -1, 1}, From 4990d3eb4d89d43e4add2770400de763760846a4 Mon Sep 17 00:00:00 2001 From: JP Lomas Date: Thu, 12 Sep 2024 11:26:22 +0100 Subject: [PATCH 6/8] Actionlint workflow checking (#516) * Actionlint workflow checking Integrate Actionlint to check GitHub workflows for errors as part of CI. It also fixes issues highlighted in other workflows, primarily the `checkout` version and missing property. Signed-off-by: JP Lomas * Update CODEOWNERS Signed-off-by: JP Lomas --------- Signed-off-by: JP Lomas Signed-off-by: Norman Ashley --- .github/CODEOWNERS | 2 +- .github/workflows/check_workflows.yml | 14 ++++++++++++++ .github/workflows/coding_style.yml | 2 +- .github/workflows/linux.yml | 8 ++++---- .github/workflows/macos.yml | 6 +++--- .github/workflows/standalone.yml | 4 ++-- .github/workflows/windows.yml | 20 +++++++++++--------- 7 files changed, 36 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/check_workflows.yml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index af0eb104..9d57fd03 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -5,6 +5,6 @@ /oqs-template/generate.yml @baentsch @bhess @feventura /CMakeLists.txt @baentsch @thb-sb /.circleci/config.yml @baentsch @thb-sb -/.github/workflows @baentsch @thb-sb +/.github/workflows @baentsch @thb-sb @jplomas /oqsprov/oqs_sig.c @baentsch @feventura /scripts/oqsprovider-pkcs12gen.sh @iyanmv diff --git a/.github/workflows/check_workflows.yml b/.github/workflows/check_workflows.yml new file mode 100644 index 00000000..3bbb6650 --- /dev/null +++ b/.github/workflows/check_workflows.yml @@ -0,0 +1,14 @@ +name: Check GitHub workflows + +on: [pull_request, push, workflow_call] + +jobs: + workflowcheck: + name: Check validity of GitHub workflows + runs-on: ubuntu-latest + container: openquantumsafe/ci-ubuntu-latest:latest + steps: + - name: Checkout code + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin@v4 + - name: Ensure GitHub actions are valid + run: actionlint -shellcheck "" # run *without* shellcheck diff --git a/.github/workflows/coding_style.yml b/.github/workflows/coding_style.yml index e4304be6..e990a32a 100644 --- a/.github/workflows/coding_style.yml +++ b/.github/workflows/coding_style.yml @@ -14,7 +14,7 @@ jobs: run: apt-get update && apt-get install -y clang-format - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin@v4 - name: Check coding style using clang-format run: ./scripts/do_code_format.sh diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 9bbb3db6..0e4510c0 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -23,7 +23,7 @@ jobs: LIBOQS_BRANCH: "main" steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin@v4 - name: Full build run: OQSPROV_CMAKE_PARAMS=${{ matrix.cmake-params}} ./scripts/fullbuild.sh - name: Enable sibling oqsprovider for testing @@ -53,7 +53,7 @@ jobs: LIBOQS_BRANCH: "main" steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin@v4 - name: Full build run: OPENSSL_BRANCH=${{ matrix.ossl-branch }} ./scripts/fullbuild.sh - name: Enable sibling oqsprovider for testing @@ -103,7 +103,7 @@ jobs: OPENSSL_BRANCH: "openssl-3.1" steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin@v4 - name: Install dependencies run: apt-get update && apt-get install -y clang llvm ninja-build git cmake libclang-14-dev libclang-common-14-dev @@ -177,7 +177,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin@v4 - name: Install dependencies run: apt-get update && apt-get install -y ninja-build git cmake nodejs gcc-aarch64-linux-gnu libc6-dev-arm64-cross qemu-user diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index b8b130f4..5bfc8c5b 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -25,15 +25,15 @@ jobs: MAKE_PARAMS: -j 4 steps: - name: Checkout provider - uses: actions/checkout@v3 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin@v4 - name: Checkout openssl - uses: actions/checkout@v3 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin@v4 with: set-safe-directory: true repository: openssl/openssl path: openssl - name: checkout liboqs - uses: actions/checkout@v3 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin@v4 with: set-safe-directory: true repository: open-quantum-safe/liboqs diff --git a/.github/workflows/standalone.yml b/.github/workflows/standalone.yml index ee227f99..9c763971 100644 --- a/.github/workflows/standalone.yml +++ b/.github/workflows/standalone.yml @@ -18,7 +18,7 @@ jobs: - name: Install prerequisites run: brew install liboqs - name: Checkout oqsprovider code - uses: actions/checkout@v2 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin@v4 - name: Build and test oqsprovider # try this only if brew'd liboqs knows about ML-KEM: run: | @@ -46,7 +46,7 @@ jobs: - name: Update container run: apt update && apt install -y cmake ninja-build gcc libssl-dev git - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin@v4 - name: Full build run: LIBOQS_BRANCH=main ./scripts/fullbuild.sh - name: Test diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 384e376d..3747c7a2 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -18,6 +18,8 @@ jobs: platform: - arch: win64 oqsconfig: -DOQS_ALGS_ENABLED=STD + # empty `config` property here to prevent actionlint error (property "config" is not defined in object type) on line 62 below + config: # - arch: win32 # config: --strict-warnings no-fips enable-quic runs-on: ${{matrix.os}} @@ -29,9 +31,9 @@ jobs: MAKE_PARAMS: -j 4 steps: - name: Checkout provider - uses: actions/checkout@v3 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin@v4 - name: Checkout openssl - uses: actions/checkout@v3 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin@v4 with: set-safe-directory: true repository: openssl/openssl @@ -39,7 +41,7 @@ jobs: # TODO: Revert ref tag once openssl master doesn't crash any more ref: openssl-3.3.0 - name: checkout liboqs - uses: actions/checkout@v3 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin@v4 with: set-safe-directory: true repository: open-quantum-safe/liboqs @@ -126,15 +128,15 @@ jobs: with: path: c:\openssl32 key: ${{ runner.os }}-msvcopenssl32 - - uses: actions/checkout@v3 + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin@v4 - name: Checkout OpenSSL master if: steps.cache-openssl32.outputs.cache-hit != 'true' - uses: actions/checkout@v3 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin@v4 with: set-safe-directory: true repository: openssl/openssl path: openssl - - uses: actions/checkout@v3 + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin@v4 with: set-safe-directory: true repository: open-quantum-safe/liboqs @@ -240,15 +242,15 @@ jobs: with: path: c:\openssl32n key: ${{ runner.os }}-msvcopenssl32n - - uses: actions/checkout@v3 + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin@v4 - name: Checkout OpenSSL master if: steps.cache-openssl32n.outputs.cache-hit != 'true' - uses: actions/checkout@v3 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin@v4 with: set-safe-directory: true repository: openssl/openssl path: openssl - - uses: actions/checkout@v3 + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin@v4 with: set-safe-directory: true repository: open-quantum-safe/liboqs From a605863aa90164aadf7615410b2febbd38429d99 Mon Sep 17 00:00:00 2001 From: Michael Baentsch <57787676+baentsch@users.noreply.github.com> Date: Thu, 12 Sep 2024 20:06:31 +0200 Subject: [PATCH 7/8] add explicit usage warning [skip ci] (#515) * add explicit usage warning [skip ci] Signed-off-by: Michael Baentsch <57787676+baentsch@users.noreply.github.com> * copying the liboqs core warning over to avoid any misunderstanding [skip ci] Signed-off-by: Michael Baentsch <57787676+baentsch@users.noreply.github.com> * Update README.md Co-authored-by: Spencer Wilson Signed-off-by: Michael Baentsch <57787676+baentsch@users.noreply.github.com> * disable CF hybrid interop testing Signed-off-by: Michael Baentsch <57787676+baentsch@users.noreply.github.com> --------- Signed-off-by: Michael Baentsch <57787676+baentsch@users.noreply.github.com> Co-authored-by: Spencer Wilson Signed-off-by: Norman Ashley --- README.md | 21 +++++++++++++++++++++ scripts/oqsprovider-externalinterop.sh | 5 +++++ 2 files changed, 26 insertions(+) diff --git a/README.md b/README.md index 77997f0f..a4b11c52 100644 --- a/README.md +++ b/README.md @@ -249,6 +249,27 @@ THIS SOFTWARE IS PROVIDED WITH NO WARRANTIES, EXPRESS OR IMPLIED, AND ALL IMPLIED WARRANTIES ARE DISCLAIMED, INCLUDING ANY WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. +## Standards compliance + +This project follows the [NIST PQC standardization process](https://csrc.nist.gov/projects/post-quantum-cryptography) +and aims to support experimentation with the various PQC algorithms +under evaluation and in different stages of standardization by NIST. +`oqsprovider` at this time cannot claim or prove adherence to any +standards documents published. For more details, review the file +[STANDARDS.md](STANDARDS.md) carefully. Most notably, hybrid and +composite implementations exclusively implemented in `oqsprovider` +are at a pre-standard/draft stage only. Over time the project aims +to provide standards compliance and solicits input by way of +contributions to achieve this state. + ## Component disclaimer +`oqsprovider` for the implementation of all pure PQC functionality +is completely dependent on [liboqs](https://github.com/open-quantum-safe/liboqs) and accordingly +cannot recommend any use beyond experimentation purposes: + +WE DO NOT CURRENTLY RECOMMEND RELYING ON THIS SOFTWARE IN A PRODUCTION ENVIRONMENT OR TO PROTECT ANY SENSITIVE DATA. This software is meant to help with research and prototyping. While we make a best-effort approach to avoid security bugs, this library has not received the level of auditing and analysis that would be necessary to rely on it for high security use. + +Further details and background available at: + [liboqs disclaimer](https://github.com/open-quantum-safe/liboqs#limitations-and-security) diff --git a/scripts/oqsprovider-externalinterop.sh b/scripts/oqsprovider-externalinterop.sh index 7a161a4e..5a6e3129 100755 --- a/scripts/oqsprovider-externalinterop.sh +++ b/scripts/oqsprovider-externalinterop.sh @@ -28,6 +28,11 @@ fi # Ascertain algorithms are available: +# skipping these tests for now as per https://mailarchive.ietf.org/arch/msg/tls/hli5ogDbUudAA4tZXskVbOqeor4 +# TBD replace with suitable ML-KEM hybrid tests as and when available XXX + +exit 0 + echo " Cloudflare:" if ! ($OPENSSL_APP list -kem-algorithms | grep x25519_kyber768); then From 53a073e46e5cbaa2fda08d36f0fa916a31a32166 Mon Sep 17 00:00:00 2001 From: Norman Ashley Date: Thu, 12 Sep 2024 20:04:28 -0400 Subject: [PATCH 8/8] Fixed deref without null check. Signed-off-by: Norman Ashley --- oqsprov/oqsprov.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oqsprov/oqsprov.c b/oqsprov/oqsprov.c index b95a1741..ac5336f4 100644 --- a/oqsprov/oqsprov.c +++ b/oqsprov/oqsprov.c @@ -1164,7 +1164,7 @@ int OQS_PROVIDER_ENTRYPOINT_NAME(const OSSL_CORE_HANDLE *handle, * Not testing for errors is intentional. * At least one core version hangs up; so don't do this there: */ - if (strcmp("3.1.0", ossl_versionp)) { + if (ossl_versionp && strcmp("3.1.0", ossl_versionp)) { ERR_set_mark(); OBJ_create(oqs_oid_alg_list[i], oqs_oid_alg_list[i + 1], oqs_oid_alg_list[i + 1]);