summaryrefslogtreecommitdiff
path: root/providers/implementations
diff options
context:
space:
mode:
authorEnji Cooper <ngie@FreeBSD.org>2026-04-07 22:35:35 +0000
committerEnji Cooper <ngie@FreeBSD.org>2026-04-07 22:35:35 +0000
commitab5fc4ac933ff67bc800e774dffce15e2a541e90 (patch)
tree41fac85d3f2f7d74be9bfce46b1a78ff9897165d /providers/implementations
parent808413da28df9fb93e1f304e6016b15e660f54c8 (diff)
Diffstat (limited to 'providers/implementations')
-rw-r--r--providers/implementations/ciphers/cipher_aes_gcm_hw_ppc.inc8
-rw-r--r--providers/implementations/ciphers/cipher_aes_ocb.c4
-rw-r--r--providers/implementations/ciphers/ciphercommon.c6
-rw-r--r--providers/implementations/include/prov/ciphercommon_ccm.h16
-rw-r--r--providers/implementations/include/prov/ciphercommon_gcm.h14
-rw-r--r--providers/implementations/kdfs/pkcs12kdf.c11
-rw-r--r--providers/implementations/kem/rsa_kem.c22
-rw-r--r--providers/implementations/keymgmt/ml_kem_kmgmt.c4
-rw-r--r--providers/implementations/rands/drbg_hmac.c4
-rw-r--r--providers/implementations/signature/dsa_sig.c36
-rw-r--r--providers/implementations/signature/ecdsa_sig.c47
-rw-r--r--providers/implementations/signature/sm2_sig.c10
-rw-r--r--providers/implementations/storemgmt/file_store.c11
-rw-r--r--providers/implementations/storemgmt/winstore_store.c6
14 files changed, 117 insertions, 82 deletions
diff --git a/providers/implementations/ciphers/cipher_aes_gcm_hw_ppc.inc b/providers/implementations/ciphers/cipher_aes_gcm_hw_ppc.inc
index 153eb7989171..a1df534f2a7a 100644
--- a/providers/implementations/ciphers/cipher_aes_gcm_hw_ppc.inc
+++ b/providers/implementations/ciphers/cipher_aes_gcm_hw_ppc.inc
@@ -1,5 +1,5 @@
/*
- * Copyright 2001-2022 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2001-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -44,8 +44,8 @@ static inline u32 add32TOU(unsigned char buf[4], u32 n)
static size_t ppc_aes_gcm_crypt(const unsigned char *in, unsigned char *out, size_t len,
const void *key, unsigned char ivec[16], u64 *Xi, int encrypt)
{
- int s = 0;
- int ndone = 0;
+ size_t s = 0;
+ size_t ndone = 0;
int ctr_reset = 0;
u64 blocks_unused;
u64 nb = len / 16;
@@ -119,7 +119,7 @@ static int ppc_aes_gcm_cipher_update(PROV_GCM_CTX *ctx, const unsigned char *in,
size_t res = (16 - ctx->gcm.mres) % 16;
if (CRYPTO_gcm128_decrypt(&ctx->gcm, in, out, res))
- return -1;
+ return 0;
bulk = ppc_aes_gcm_crypt(in + res, out + res, len - res,
ctx->gcm.key,
diff --git a/providers/implementations/ciphers/cipher_aes_ocb.c b/providers/implementations/ciphers/cipher_aes_ocb.c
index a50099719c4a..b724c425e392 100644
--- a/providers/implementations/ciphers/cipher_aes_ocb.c
+++ b/providers/implementations/ciphers/cipher_aes_ocb.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2019-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -27,7 +27,7 @@
#define OCB_MIN_IV_LEN 1
#define OCB_MAX_IV_LEN 15
-PROV_CIPHER_FUNC(int, ocb_cipher, (PROV_AES_OCB_CTX * ctx, const unsigned char *in, unsigned char *out, size_t nextblock));
+PROV_CIPHER_FUNC(int, ocb_cipher, (PROV_AES_OCB_CTX *ctx, const unsigned char *in, unsigned char *out, size_t nextblock));
/* forward declarations */
static OSSL_FUNC_cipher_encrypt_init_fn aes_ocb_einit;
static OSSL_FUNC_cipher_decrypt_init_fn aes_ocb_dinit;
diff --git a/providers/implementations/ciphers/ciphercommon.c b/providers/implementations/ciphers/ciphercommon.c
index ba2a9b68088b..9b6930e5c49b 100644
--- a/providers/implementations/ciphers/ciphercommon.c
+++ b/providers/implementations/ciphers/ciphercommon.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2019-2025 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2019-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -691,6 +691,10 @@ int ossl_cipher_generic_set_ctx_params(void *vctx, const OSSL_PARAM params[])
ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_GET_PARAMETER);
return 0;
}
+ if (ctx->blocksize > 0 && num >= (unsigned int)ctx->blocksize) {
+ ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_GET_PARAMETER);
+ return 0;
+ }
ctx->num = num;
}
return 1;
diff --git a/providers/implementations/include/prov/ciphercommon_ccm.h b/providers/implementations/include/prov/ciphercommon_ccm.h
index 59d77f0bb10d..fefe7ed31565 100644
--- a/providers/implementations/include/prov/ciphercommon_ccm.h
+++ b/providers/implementations/include/prov/ciphercommon_ccm.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2019-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -48,13 +48,13 @@ typedef struct prov_ccm_st {
const PROV_CCM_HW *hw; /* hardware specific methods */
} PROV_CCM_CTX;
-PROV_CIPHER_FUNC(int, CCM_cipher, (PROV_CCM_CTX * ctx, unsigned char *out, size_t *padlen, const unsigned char *in, size_t len));
-PROV_CIPHER_FUNC(int, CCM_setkey, (PROV_CCM_CTX * ctx, const unsigned char *key, size_t keylen));
-PROV_CIPHER_FUNC(int, CCM_setiv, (PROV_CCM_CTX * dat, const unsigned char *iv, size_t ivlen, size_t mlen));
-PROV_CIPHER_FUNC(int, CCM_setaad, (PROV_CCM_CTX * ctx, const unsigned char *aad, size_t aadlen));
-PROV_CIPHER_FUNC(int, CCM_auth_encrypt, (PROV_CCM_CTX * ctx, const unsigned char *in, unsigned char *out, size_t len, unsigned char *tag, size_t taglen));
-PROV_CIPHER_FUNC(int, CCM_auth_decrypt, (PROV_CCM_CTX * ctx, const unsigned char *in, unsigned char *out, size_t len, unsigned char *tag, size_t taglen));
-PROV_CIPHER_FUNC(int, CCM_gettag, (PROV_CCM_CTX * ctx, unsigned char *tag, size_t taglen));
+PROV_CIPHER_FUNC(int, CCM_cipher, (PROV_CCM_CTX *ctx, unsigned char *out, size_t *padlen, const unsigned char *in, size_t len));
+PROV_CIPHER_FUNC(int, CCM_setkey, (PROV_CCM_CTX *ctx, const unsigned char *key, size_t keylen));
+PROV_CIPHER_FUNC(int, CCM_setiv, (PROV_CCM_CTX *dat, const unsigned char *iv, size_t ivlen, size_t mlen));
+PROV_CIPHER_FUNC(int, CCM_setaad, (PROV_CCM_CTX *ctx, const unsigned char *aad, size_t aadlen));
+PROV_CIPHER_FUNC(int, CCM_auth_encrypt, (PROV_CCM_CTX *ctx, const unsigned char *in, unsigned char *out, size_t len, unsigned char *tag, size_t taglen));
+PROV_CIPHER_FUNC(int, CCM_auth_decrypt, (PROV_CCM_CTX *ctx, const unsigned char *in, unsigned char *out, size_t len, unsigned char *tag, size_t taglen));
+PROV_CIPHER_FUNC(int, CCM_gettag, (PROV_CCM_CTX *ctx, unsigned char *tag, size_t taglen));
/*
* CCM Mode internal method table used to handle hardware specific differences,
diff --git a/providers/implementations/include/prov/ciphercommon_gcm.h b/providers/implementations/include/prov/ciphercommon_gcm.h
index 7b411618f027..7c57e3cb7950 100644
--- a/providers/implementations/include/prov/ciphercommon_gcm.h
+++ b/providers/implementations/include/prov/ciphercommon_gcm.h
@@ -1,6 +1,6 @@
/*
- * Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2019-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -81,12 +81,12 @@ typedef struct prov_gcm_ctx_st {
ctr128_f ctr;
} PROV_GCM_CTX;
-PROV_CIPHER_FUNC(int, GCM_setkey, (PROV_GCM_CTX * ctx, const unsigned char *key, size_t keylen));
-PROV_CIPHER_FUNC(int, GCM_setiv, (PROV_GCM_CTX * dat, const unsigned char *iv, size_t ivlen));
-PROV_CIPHER_FUNC(int, GCM_aadupdate, (PROV_GCM_CTX * ctx, const unsigned char *aad, size_t aadlen));
-PROV_CIPHER_FUNC(int, GCM_cipherupdate, (PROV_GCM_CTX * ctx, const unsigned char *in, size_t len, unsigned char *out));
-PROV_CIPHER_FUNC(int, GCM_cipherfinal, (PROV_GCM_CTX * ctx, unsigned char *tag));
-PROV_CIPHER_FUNC(int, GCM_oneshot, (PROV_GCM_CTX * ctx, unsigned char *aad, size_t aad_len, const unsigned char *in, size_t in_len, unsigned char *out, unsigned char *tag, size_t taglen));
+PROV_CIPHER_FUNC(int, GCM_setkey, (PROV_GCM_CTX *ctx, const unsigned char *key, size_t keylen));
+PROV_CIPHER_FUNC(int, GCM_setiv, (PROV_GCM_CTX *dat, const unsigned char *iv, size_t ivlen));
+PROV_CIPHER_FUNC(int, GCM_aadupdate, (PROV_GCM_CTX *ctx, const unsigned char *aad, size_t aadlen));
+PROV_CIPHER_FUNC(int, GCM_cipherupdate, (PROV_GCM_CTX *ctx, const unsigned char *in, size_t len, unsigned char *out));
+PROV_CIPHER_FUNC(int, GCM_cipherfinal, (PROV_GCM_CTX *ctx, unsigned char *tag));
+PROV_CIPHER_FUNC(int, GCM_oneshot, (PROV_GCM_CTX *ctx, unsigned char *aad, size_t aad_len, const unsigned char *in, size_t in_len, unsigned char *out, unsigned char *tag, size_t taglen));
struct prov_gcm_hw_st {
OSSL_GCM_setkey_fn setkey;
OSSL_GCM_setiv_fn setiv;
diff --git a/providers/implementations/kdfs/pkcs12kdf.c b/providers/implementations/kdfs/pkcs12kdf.c
index fa4b808f4e11..397cd50ec6a8 100644
--- a/providers/implementations/kdfs/pkcs12kdf.c
+++ b/providers/implementations/kdfs/pkcs12kdf.c
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2023 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1999-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -266,6 +266,15 @@ static int kdf_pkcs12_set_ctx_params(void *vctx, const OSSL_PARAM params[])
if ((p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_ITER)) != NULL)
if (!OSSL_PARAM_get_uint64(p, &ctx->iter))
return 0;
+#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
+ /*
+ * If we're running the fuzzer, limit iteration count to
+ * 100 so we don't time out running the derivation for
+ * a really long time
+ */
+ if (getenv("OPENSSL_RUNNING_UNIT_TESTS") == NULL && p != NULL && ctx->iter > 100)
+ ctx->iter = 100;
+#endif
return 1;
}
diff --git a/providers/implementations/kem/rsa_kem.c b/providers/implementations/kem/rsa_kem.c
index f7bf368a0dfc..78925809d985 100644
--- a/providers/implementations/kem/rsa_kem.c
+++ b/providers/implementations/kem/rsa_kem.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-2025 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2020-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -316,17 +316,19 @@ static int rsasve_generate(PROV_RSA_CTX *prsactx,
return 0;
/* Step(3): out = RSAEP((n,e), z) */
- ret = RSA_public_encrypt(nlen, secret, out, prsactx->rsa, RSA_NO_PADDING);
- if (ret) {
- ret = 1;
- if (outlen != NULL)
- *outlen = nlen;
- if (secretlen != NULL)
- *secretlen = nlen;
- } else {
+ ret = RSA_public_encrypt((int)nlen, secret, out, prsactx->rsa,
+ RSA_NO_PADDING);
+ if (ret <= 0 || ret != (int)nlen) {
OPENSSL_cleanse(secret, nlen);
+ return 0;
}
- return ret;
+
+ if (outlen != NULL)
+ *outlen = nlen;
+ if (secretlen != NULL)
+ *secretlen = nlen;
+
+ return 1;
}
/**
diff --git a/providers/implementations/keymgmt/ml_kem_kmgmt.c b/providers/implementations/keymgmt/ml_kem_kmgmt.c
index 0be2a1e29839..7884f40ae58e 100644
--- a/providers/implementations/keymgmt/ml_kem_kmgmt.c
+++ b/providers/implementations/keymgmt/ml_kem_kmgmt.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2024-2025 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2024-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -799,7 +799,7 @@ static void ml_kem_gen_cleanup(void *vgctx)
return;
if (gctx->seed != NULL)
- OPENSSL_cleanse(gctx->seed, ML_KEM_RANDOM_BYTES);
+ OPENSSL_cleanse(gctx->seed, ML_KEM_SEED_BYTES);
OPENSSL_free(gctx->propq);
OPENSSL_free(gctx);
}
diff --git a/providers/implementations/rands/drbg_hmac.c b/providers/implementations/rands/drbg_hmac.c
index ff8a6cd6f0a6..d3191e55a929 100644
--- a/providers/implementations/rands/drbg_hmac.c
+++ b/providers/implementations/rands/drbg_hmac.c
@@ -437,7 +437,7 @@ static int drbg_fetch_algs_from_prov(const OSSL_PARAM params[],
p = OSSL_PARAM_locate_const(params, OSSL_ALG_PARAM_DIGEST);
if (p) {
- if (OSSL_PARAM_get_utf8_string_ptr(p, &digest_name)) {
+ if (!OSSL_PARAM_get_utf8_string_ptr(p, &digest_name)) {
ERR_raise(ERR_LIB_PROV, PROV_R_VALUE_ERROR);
goto done;
}
@@ -458,7 +458,7 @@ static int drbg_fetch_algs_from_prov(const OSSL_PARAM params[],
if (p == NULL) {
hmac_name = "HMAC";
} else {
- if (OSSL_PARAM_get_utf8_string_ptr(p, &hmac_name)) {
+ if (!OSSL_PARAM_get_utf8_string_ptr(p, &hmac_name)) {
ERR_raise(ERR_LIB_PROV, PROV_R_VALUE_ERROR);
goto done;
}
diff --git a/providers/implementations/signature/dsa_sig.c b/providers/implementations/signature/dsa_sig.c
index 51dcc3f2300d..48237d7eb9ed 100644
--- a/providers/implementations/signature/dsa_sig.c
+++ b/providers/implementations/signature/dsa_sig.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2019-2025 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2019-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -634,13 +634,14 @@ static void *dsa_dupctx(void *vpdsactx)
if (!ossl_prov_is_running())
return NULL;
- dstctx = OPENSSL_zalloc(sizeof(*srcctx));
- if (dstctx == NULL)
+ if ((dstctx = OPENSSL_memdup(srcctx, sizeof(*srcctx))) == NULL)
return NULL;
- *dstctx = *srcctx;
dstctx->dsa = NULL;
dstctx->propq = NULL;
+ dstctx->md = NULL;
+ dstctx->mdctx = NULL;
+ dstctx->sig = NULL;
if (srcctx->dsa != NULL && !DSA_up_ref(srcctx->dsa))
goto err;
@@ -650,18 +651,15 @@ static void *dsa_dupctx(void *vpdsactx)
goto err;
dstctx->md = srcctx->md;
- if (srcctx->mdctx != NULL) {
- dstctx->mdctx = EVP_MD_CTX_new();
- if (dstctx->mdctx == NULL
- || !EVP_MD_CTX_copy_ex(dstctx->mdctx, srcctx->mdctx))
- goto err;
- }
-
- if (srcctx->propq != NULL) {
- dstctx->propq = OPENSSL_strdup(srcctx->propq);
- if (dstctx->propq == NULL)
- goto err;
- }
+ if (srcctx->mdctx != NULL
+ && (dstctx->mdctx = EVP_MD_CTX_dup(srcctx->mdctx)) == NULL)
+ goto err;
+ if (srcctx->propq != NULL
+ && ((dstctx->propq = OPENSSL_strdup(srcctx->propq)) == NULL))
+ goto err;
+ if (srcctx->sig != NULL
+ && ((dstctx->sig = OPENSSL_memdup(srcctx->sig, srcctx->siglen)) == NULL))
+ goto err;
return dstctx;
err:
@@ -972,6 +970,12 @@ static int dsa_sigalg_set_ctx_params(void *vpdsactx, const OSSL_PARAM params[])
if (!OSSL_PARAM_get_octet_string(p, (void **)&pdsactx->sig,
0, &pdsactx->siglen))
return 0;
+ /* The signature must not be empty */
+ if (pdsactx->siglen == 0) {
+ OPENSSL_free(pdsactx->sig);
+ pdsactx->sig = NULL;
+ return 0;
+ }
}
}
return 1;
diff --git a/providers/implementations/signature/ecdsa_sig.c b/providers/implementations/signature/ecdsa_sig.c
index 0c04fc4ec683..3ce4cd0d2a82 100644
--- a/providers/implementations/signature/ecdsa_sig.c
+++ b/providers/implementations/signature/ecdsa_sig.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-2025 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2020-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -630,40 +630,37 @@ static void *ecdsa_dupctx(void *vctx)
PROV_ECDSA_CTX *srcctx = (PROV_ECDSA_CTX *)vctx;
PROV_ECDSA_CTX *dstctx;
- if (!ossl_prov_is_running())
- return NULL;
-
- dstctx = OPENSSL_zalloc(sizeof(*srcctx));
- if (dstctx == NULL)
+ /* Test KATS should not need to be supported */
+ if (!ossl_prov_is_running()
+ || srcctx->kinv != NULL
+ || srcctx->r != NULL
+ || (dstctx = OPENSSL_memdup(srcctx, sizeof(*srcctx))) == NULL)
return NULL;
- *dstctx = *srcctx;
dstctx->ec = NULL;
dstctx->propq = NULL;
+ dstctx->md = NULL;
+ dstctx->mdctx = NULL;
+ dstctx->sig = NULL;
if (srcctx->ec != NULL && !EC_KEY_up_ref(srcctx->ec))
goto err;
- /* Test KATS should not need to be supported */
- if (srcctx->kinv != NULL || srcctx->r != NULL)
- goto err;
dstctx->ec = srcctx->ec;
if (srcctx->md != NULL && !EVP_MD_up_ref(srcctx->md))
goto err;
dstctx->md = srcctx->md;
- if (srcctx->mdctx != NULL) {
- dstctx->mdctx = EVP_MD_CTX_new();
- if (dstctx->mdctx == NULL
- || !EVP_MD_CTX_copy_ex(dstctx->mdctx, srcctx->mdctx))
- goto err;
- }
-
- if (srcctx->propq != NULL) {
- dstctx->propq = OPENSSL_strdup(srcctx->propq);
- if (dstctx->propq == NULL)
- goto err;
- }
+ if (srcctx->mdctx != NULL
+ && ((dstctx->mdctx = EVP_MD_CTX_new()) == NULL
+ || !EVP_MD_CTX_copy_ex(dstctx->mdctx, srcctx->mdctx)))
+ goto err;
+ if (srcctx->propq != NULL
+ && (dstctx->propq = OPENSSL_strdup(srcctx->propq)) == NULL)
+ goto err;
+ if (srcctx->sig != NULL
+ && (dstctx->sig = OPENSSL_memdup(srcctx->sig, srcctx->siglen)) == NULL)
+ goto err;
return dstctx;
err:
@@ -990,6 +987,12 @@ static int ecdsa_sigalg_set_ctx_params(void *vctx, const OSSL_PARAM params[])
if (!OSSL_PARAM_get_octet_string(p, (void **)&ctx->sig,
0, &ctx->siglen))
return 0;
+ /* The signature must not be empty */
+ if (ctx->siglen == 0) {
+ OPENSSL_free(ctx->sig);
+ ctx->sig = NULL;
+ return 0;
+ }
}
}
return 1;
diff --git a/providers/implementations/signature/sm2_sig.c b/providers/implementations/signature/sm2_sig.c
index d367c4938114..4322e49f592f 100644
--- a/providers/implementations/signature/sm2_sig.c
+++ b/providers/implementations/signature/sm2_sig.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2020-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -214,6 +214,12 @@ static int sm2sig_digest_signverify_init(void *vpsm2ctx, const char *mdname,
int ret = 0;
unsigned char *aid = NULL;
+ /*
+ * Each EVP_Digest{Sign,Verify}Init_ex(3) starts with fresh content, that
+ * needs to recompute the "Z" digest.
+ */
+ ctx->flag_compute_z_digest = 1;
+
if (!sm2sig_signature_init(vpsm2ctx, ec, params)
|| !sm2sig_set_mdname(ctx, mdname))
return ret;
@@ -247,8 +253,6 @@ static int sm2sig_digest_signverify_init(void *vpsm2ctx, const char *mdname,
if (!EVP_DigestInit_ex2(ctx->mdctx, ctx->md, params))
goto error;
- ctx->flag_compute_z_digest = 1;
-
ret = 1;
error:
diff --git a/providers/implementations/storemgmt/file_store.c b/providers/implementations/storemgmt/file_store.c
index 6568906ea1c4..f73c5fd5c831 100644
--- a/providers/implementations/storemgmt/file_store.c
+++ b/providers/implementations/storemgmt/file_store.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-2025 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2020-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -104,6 +104,8 @@ struct file_ctx_st {
/* Expected object type. May be unspecified */
int expected_type;
+ /* Fatal error occurred. We should indicate EOF. */
+ int fatal_error;
};
static void free_file_ctx(struct file_ctx_st *ctx)
@@ -559,8 +561,10 @@ static int file_load_file(struct file_ctx_st *ctx,
/* Setup the decoders (one time shot per session */
- if (!file_setup_decoders(ctx))
+ if (!file_setup_decoders(ctx)) {
+ ctx->fatal_error = 1;
return 0;
+ }
/* Setup for this object */
@@ -758,6 +762,9 @@ static int file_eof(void *loaderctx)
{
struct file_ctx_st *ctx = loaderctx;
+ if (ctx->fatal_error)
+ return 1;
+
switch (ctx->type) {
case IS_DIR:
return ctx->_.dir.end_reached;
diff --git a/providers/implementations/storemgmt/winstore_store.c b/providers/implementations/storemgmt/winstore_store.c
index cd3e4b94fb3b..9da24b4f55c0 100644
--- a/providers/implementations/storemgmt/winstore_store.c
+++ b/providers/implementations/storemgmt/winstore_store.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2022-2025 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2022-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -272,8 +272,10 @@ static int winstore_load_using(struct winstore_ctx_st *ctx,
const unsigned char *der_ = der;
size_t der_len_ = der_len;
- if (setup_decoder(ctx) == 0)
+ if (setup_decoder(ctx) == 0) {
+ ctx->state = STATE_EOF;
return 0;
+ }
data.object_cb = object_cb;
data.object_cbarg = object_cbarg;