From: slontis Date: Tue, 21 Jan 2025 21:46:18 +0000 (+1100) Subject: ML-DSA: coverage testing fixups X-Git-Tag: openssl-3.5.0-alpha1~593 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=30b6650e1d6262c02597e4c1b6c094accd99640e;p=thirdparty%2Fopenssl.git ML-DSA: coverage testing fixups Reviewed-by: Paul Dale Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/26505) --- diff --git a/crypto/ml_dsa/ml_dsa_key.c b/crypto/ml_dsa/ml_dsa_key.c index 6694a94e22d..9057f5ec7a2 100644 --- a/crypto/ml_dsa/ml_dsa_key.c +++ b/crypto/ml_dsa/ml_dsa_key.c @@ -92,7 +92,6 @@ void ossl_ml_dsa_key_free(ML_DSA_KEY *key) OPENSSL_cleanse(key->K, sizeof(key->K)); OPENSSL_free(key->pub_encoding); OPENSSL_free(key->priv_encoding); - OPENSSL_free(key->propq); OPENSSL_free(key); } @@ -115,10 +114,6 @@ ML_DSA_KEY *ossl_ml_dsa_key_dup(const ML_DSA_KEY *src, int selection) if (ret != NULL) { ret->libctx = src->libctx; ret->params = src->params; - if (src->propq != NULL) { - if ((ret->propq = OPENSSL_strdup(src->propq)) == NULL) - goto err; - } if ((selection & OSSL_KEYMGMT_SELECT_KEYPAIR) != 0) { if (src->pub_encoding != NULL) { /* The public components are present if the private key is present */ @@ -336,7 +331,7 @@ int ossl_ml_dsa_key_fromdata(ML_DSA_KEY *key, const OSSL_PARAM params[], if (pub != NULL && (pub_data_len != ossl_ml_dsa_key_get_pub_len(key) || memcmp(ossl_ml_dsa_key_get_pub(key), pub_data, - pub_data_len) == 0)) + pub_data_len) != 0)) return 0; } } @@ -503,10 +498,6 @@ size_t ossl_ml_dsa_key_get_sig_len(const ML_DSA_KEY *key) { return key->params->sig_len; } -void ossl_ml_dsa_key_set0_libctx(ML_DSA_KEY *key, OSSL_LIB_CTX *lib_ctx) -{ - key->libctx = lib_ctx; -} const char *ossl_ml_dsa_key_get_name(const ML_DSA_KEY *key) { diff --git a/crypto/ml_dsa/ml_dsa_key.h b/crypto/ml_dsa/ml_dsa_key.h index 26ffe2ebbc4..0bc7ca0458b 100644 --- a/crypto/ml_dsa/ml_dsa_key.h +++ b/crypto/ml_dsa/ml_dsa_key.h @@ -16,7 +16,6 @@ struct ml_dsa_key_st { OSSL_LIB_CTX *libctx; const ML_DSA_PARAMS *params; - char *propq; EVP_MD *shake128_md; EVP_MD *shake256_md; diff --git a/include/crypto/ml_dsa.h b/include/crypto/ml_dsa.h index 7e15cffb0b2..dadab02bc14 100644 --- a/include/crypto/ml_dsa.h +++ b/include/crypto/ml_dsa.h @@ -40,9 +40,8 @@ __owur size_t ossl_ml_dsa_key_get_pub_len(const ML_DSA_KEY *key); __owur size_t ossl_ml_dsa_key_get_collision_strength_bits(const ML_DSA_KEY *key); __owur size_t ossl_ml_dsa_key_get_priv_len(const ML_DSA_KEY *key); __owur size_t ossl_ml_dsa_key_get_sig_len(const ML_DSA_KEY *key); -__owur const char *ossl_ml_dsa_key_get_name(const ML_DSA_KEY *key); __owur int ossl_ml_dsa_key_matches(const ML_DSA_KEY *key, const char *alg); -void ossl_ml_dsa_key_set0_libctx(ML_DSA_KEY *key, OSSL_LIB_CTX *lib_ctx); +__owur const char *ossl_ml_dsa_key_get_name(const ML_DSA_KEY *key); __owur int ossl_ml_dsa_key_public_from_private(ML_DSA_KEY *key); __owur int ossl_ml_dsa_pk_decode(ML_DSA_KEY *key, const uint8_t *in, size_t in_len);