aboutsummaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
Diffstat (limited to 'crypto')
-rw-r--r--crypto/bio/bss_file.c2
-rw-r--r--crypto/cms/cms_pwri.c2
-rw-r--r--crypto/ec/ecp_sm2p256.c103
-rw-r--r--crypto/evp/bio_ok.c27
-rw-r--r--crypto/evp/ctrl_params_translate.c2
-rw-r--r--crypto/evp/p_lib.c17
-rw-r--r--crypto/http/http_lib.c1
-rw-r--r--crypto/info.c14
-rw-r--r--crypto/ml_dsa/ml_dsa_key.c4
-rw-r--r--crypto/ml_kem/ml_kem.c2
-rw-r--r--crypto/modes/siv128.c3
-rw-r--r--crypto/property/property_parse.c2
-rw-r--r--crypto/rsa/rsa_gen.c15
-rw-r--r--crypto/rsa/rsa_sign.c4
-rw-r--r--crypto/threads_pthread.c12
-rw-r--r--crypto/x509/t_x509.c3
-rw-r--r--crypto/x509/x509_lu.c1
17 files changed, 65 insertions, 149 deletions
diff --git a/crypto/bio/bss_file.c b/crypto/bio/bss_file.c
index 2743a14417cf..ddcb4feb6a58 100644
--- a/crypto/bio/bss_file.c
+++ b/crypto/bio/bss_file.c
@@ -287,7 +287,7 @@ static long file_ctrl(BIO *b, int cmd, long num, void *ptr)
if (fp == NULL) {
ERR_raise_data(ERR_LIB_SYS, get_last_sys_error(),
"calling fopen(%s, %s)",
- ptr, p);
+ (const char *)ptr, p);
ERR_raise(ERR_LIB_BIO, ERR_R_SYS_LIB);
ret = 0;
break;
diff --git a/crypto/cms/cms_pwri.c b/crypto/cms/cms_pwri.c
index a7d609f83791..ee1b8aa6ed61 100644
--- a/crypto/cms/cms_pwri.c
+++ b/crypto/cms/cms_pwri.c
@@ -242,7 +242,7 @@ static int kek_unwrap_key(unsigned char *out, size_t *outlen,
/* Check byte failure */
goto err;
}
- if (inlen < (size_t)(tmp[0] - 4)) {
+ if (inlen < 4 + (size_t)tmp[0]) {
/* Invalid length value */
goto err;
}
diff --git a/crypto/ec/ecp_sm2p256.c b/crypto/ec/ecp_sm2p256.c
index 7668b61378b6..4c39be2186fb 100644
--- a/crypto/ec/ecp_sm2p256.c
+++ b/crypto/ec/ecp_sm2p256.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2023 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2023-2025 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
@@ -56,10 +56,6 @@ ALIGN32 static const BN_ULONG def_p[P256_LIMBS] = {
0xffffffffffffffff, 0xffffffff00000000,
0xffffffffffffffff, 0xfffffffeffffffff
};
-ALIGN32 static const BN_ULONG def_ord[P256_LIMBS] = {
- 0x53bbf40939d54123, 0x7203df6b21c6052b,
- 0xffffffffffffffff, 0xfffffffeffffffff
-};
ALIGN32 static const BN_ULONG ONE[P256_LIMBS] = {1, 0, 0, 0};
@@ -177,13 +173,6 @@ static ossl_inline void ecp_sm2p256_mod_inverse(BN_ULONG* out,
BN_MOD_INV(out, in, ecp_sm2p256_div_by_2, ecp_sm2p256_sub, def_p);
}
-/* Modular inverse mod order |out| = |in|^(-1) % |ord|. */
-static ossl_inline void ecp_sm2p256_mod_ord_inverse(BN_ULONG* out,
- const BN_ULONG* in) {
- BN_MOD_INV(out, in, ecp_sm2p256_div_by_2_mod_ord, ecp_sm2p256_sub_mod_ord,
- def_ord);
-}
-
/* Point double: R <- P + P */
static void ecp_sm2p256_point_double(P256_POINT *R, const P256_POINT *P)
{
@@ -454,52 +443,6 @@ static int ecp_sm2p256_is_affine_G(const EC_POINT *generator)
}
#endif
-/*
- * Convert Jacobian coordinate point into affine coordinate (x,y)
- */
-static int ecp_sm2p256_get_affine(const EC_GROUP *group,
- const EC_POINT *point,
- BIGNUM *x, BIGNUM *y, BN_CTX *ctx)
-{
- ALIGN32 BN_ULONG z_inv2[P256_LIMBS] = {0};
- ALIGN32 BN_ULONG z_inv3[P256_LIMBS] = {0};
- ALIGN32 BN_ULONG x_aff[P256_LIMBS] = {0};
- ALIGN32 BN_ULONG y_aff[P256_LIMBS] = {0};
- ALIGN32 BN_ULONG point_x[P256_LIMBS] = {0};
- ALIGN32 BN_ULONG point_y[P256_LIMBS] = {0};
- ALIGN32 BN_ULONG point_z[P256_LIMBS] = {0};
-
- if (EC_POINT_is_at_infinity(group, point)) {
- ECerr(ERR_LIB_EC, EC_R_POINT_AT_INFINITY);
- return 0;
- }
-
- if (ecp_sm2p256_bignum_field_elem(point_x, point->X) <= 0
- || ecp_sm2p256_bignum_field_elem(point_y, point->Y) <= 0
- || ecp_sm2p256_bignum_field_elem(point_z, point->Z) <= 0) {
- ECerr(ERR_LIB_EC, EC_R_COORDINATES_OUT_OF_RANGE);
- return 0;
- }
-
- ecp_sm2p256_mod_inverse(z_inv3, point_z);
- ecp_sm2p256_sqr(z_inv2, z_inv3);
-
- if (x != NULL) {
- ecp_sm2p256_mul(x_aff, point_x, z_inv2);
- if (!bn_set_words(x, x_aff, P256_LIMBS))
- return 0;
- }
-
- if (y != NULL) {
- ecp_sm2p256_mul(z_inv3, z_inv3, z_inv2);
- ecp_sm2p256_mul(y_aff, point_y, z_inv3);
- if (!bn_set_words(y, y_aff, P256_LIMBS))
- return 0;
- }
-
- return 1;
-}
-
/* r = sum(scalar[i]*point[i]) */
static int ecp_sm2p256_windowed_mul(const EC_GROUP *group,
P256_POINT *r,
@@ -689,44 +632,6 @@ static int ecp_sm2p256_field_sqr(const EC_GROUP *group, BIGNUM *r,
return 1;
}
-static int ecp_sm2p256_inv_mod_ord(const EC_GROUP *group, BIGNUM *r,
- const BIGNUM *x, BN_CTX *ctx)
-{
- int ret = 0;
- ALIGN32 BN_ULONG t[P256_LIMBS] = {0};
- ALIGN32 BN_ULONG out[P256_LIMBS] = {0};
-
- if (bn_wexpand(r, P256_LIMBS) == NULL) {
- ECerr(ERR_LIB_EC, ERR_R_BN_LIB);
- goto err;
- }
-
- if ((BN_num_bits(x) > 256) || BN_is_negative(x)) {
- BIGNUM *tmp;
-
- if ((tmp = BN_CTX_get(ctx)) == NULL
- || !BN_nnmod(tmp, x, group->order, ctx)) {
- ECerr(ERR_LIB_EC, ERR_R_BN_LIB);
- goto err;
- }
- x = tmp;
- }
-
- if (!ecp_sm2p256_bignum_field_elem(t, x)) {
- ECerr(ERR_LIB_EC, EC_R_COORDINATES_OUT_OF_RANGE);
- goto err;
- }
-
- ecp_sm2p256_mod_ord_inverse(out, t);
-
- if (!bn_set_words(r, out, P256_LIMBS))
- goto err;
-
- ret = 1;
-err:
- return ret;
-}
-
const EC_METHOD *EC_GFp_sm2p256_method(void)
{
static const EC_METHOD ret = {
@@ -747,7 +652,7 @@ const EC_METHOD *EC_GFp_sm2p256_method(void)
ossl_ec_GFp_simple_point_copy,
ossl_ec_GFp_simple_point_set_to_infinity,
ossl_ec_GFp_simple_point_set_affine_coordinates,
- ecp_sm2p256_get_affine,
+ ossl_ec_GFp_simple_point_get_affine_coordinates,
0, 0, 0,
ossl_ec_GFp_simple_add,
ossl_ec_GFp_simple_dbl,
@@ -763,7 +668,7 @@ const EC_METHOD *EC_GFp_sm2p256_method(void)
ecp_sm2p256_field_mul,
ecp_sm2p256_field_sqr,
0 /* field_div */,
- 0 /* field_inv */,
+ ossl_ec_GFp_simple_field_inv,
0 /* field_encode */,
0 /* field_decode */,
0 /* field_set_to_one */,
@@ -779,7 +684,7 @@ const EC_METHOD *EC_GFp_sm2p256_method(void)
ossl_ecdsa_simple_sign_setup,
ossl_ecdsa_simple_sign_sig,
ossl_ecdsa_simple_verify_sig,
- ecp_sm2p256_inv_mod_ord,
+ 0, /* use constant‑time fallback for inverse mod order */
0, /* blind_coordinates */
0, /* ladder_pre */
0, /* ladder_step */
diff --git a/crypto/evp/bio_ok.c b/crypto/evp/bio_ok.c
index 20811ffded6f..d7f6c71ee1ad 100644
--- a/crypto/evp/bio_ok.c
+++ b/crypto/evp/bio_ok.c
@@ -1,5 +1,5 @@
/*
- * Copyright 1995-2024 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2025 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
@@ -560,7 +560,7 @@ static int block_in(BIO *b)
{
BIO_OK_CTX *ctx;
EVP_MD_CTX *md;
- unsigned long tl = 0;
+ size_t tl = 0;
unsigned char tmp[EVP_MAX_MD_SIZE];
int md_size;
@@ -571,15 +571,18 @@ static int block_in(BIO *b)
goto berr;
assert(sizeof(tl) >= OK_BLOCK_BLOCK); /* always true */
- tl = ctx->buf[0];
- tl <<= 8;
- tl |= ctx->buf[1];
- tl <<= 8;
- tl |= ctx->buf[2];
- tl <<= 8;
- tl |= ctx->buf[3];
-
- if (ctx->buf_len < tl + OK_BLOCK_BLOCK + md_size)
+ tl = ((size_t)ctx->buf[0] << 24)
+ | ((size_t)ctx->buf[1] << 16)
+ | ((size_t)ctx->buf[2] << 8)
+ | ((size_t)ctx->buf[3]);
+
+ if (tl > OK_BLOCK_SIZE)
+ goto berr;
+
+ if (tl > SIZE_MAX - OK_BLOCK_BLOCK - (size_t)md_size)
+ goto berr;
+
+ if (ctx->buf_len < tl + OK_BLOCK_BLOCK + (size_t)md_size)
return 1;
if (!EVP_DigestUpdate(md,
@@ -587,7 +590,7 @@ static int block_in(BIO *b)
goto berr;
if (!EVP_DigestFinal_ex(md, tmp, NULL))
goto berr;
- if (memcmp(&(ctx->buf[tl + OK_BLOCK_BLOCK]), tmp, md_size) == 0) {
+ if (memcmp(&(ctx->buf[tl + OK_BLOCK_BLOCK]), tmp, (size_t)md_size) == 0) {
/* there might be parts from next block lurking around ! */
ctx->buf_off_save = tl + OK_BLOCK_BLOCK + md_size;
ctx->buf_len_save = ctx->buf_len;
diff --git a/crypto/evp/ctrl_params_translate.c b/crypto/evp/ctrl_params_translate.c
index ed73fc0fbb8d..c846353200b2 100644
--- a/crypto/evp/ctrl_params_translate.c
+++ b/crypto/evp/ctrl_params_translate.c
@@ -1356,7 +1356,7 @@ static int fix_rsa_padding_mode(enum state state,
if (i == OSSL_NELEM(str_value_map)) {
ERR_raise_data(ERR_LIB_RSA, RSA_R_UNKNOWN_PADDING_TYPE,
"[action:%d, state:%d] padding name %s",
- ctx->action_type, state, ctx->p1);
+ ctx->action_type, state, (const char *)ctx->p2);
ctx->p1 = ret = -2;
} else if (state == POST_CTRL_TO_PARAMS) {
/* EVP_PKEY_CTRL_GET_RSA_PADDING weirdness explained further up */
diff --git a/crypto/evp/p_lib.c b/crypto/evp/p_lib.c
index 7f4508169dfa..63953a84e1f5 100644
--- a/crypto/evp/p_lib.c
+++ b/crypto/evp/p_lib.c
@@ -1146,15 +1146,14 @@ int EVP_PKEY_can_sign(const EVP_PKEY *pkey)
} else {
const OSSL_PROVIDER *prov = EVP_KEYMGMT_get0_provider(pkey->keymgmt);
OSSL_LIB_CTX *libctx = ossl_provider_libctx(prov);
- const char *supported_sig =
- pkey->keymgmt->query_operation_name != NULL
- ? pkey->keymgmt->query_operation_name(OSSL_OP_SIGNATURE)
- : EVP_KEYMGMT_get0_name(pkey->keymgmt);
- EVP_SIGNATURE *signature = NULL;
-
- signature = EVP_SIGNATURE_fetch(libctx, supported_sig, NULL);
- if (signature != NULL) {
- EVP_SIGNATURE_free(signature);
+ EVP_SIGNATURE *sig;
+ const char *name;
+
+ name = evp_keymgmt_util_query_operation_name(pkey->keymgmt,
+ OSSL_OP_SIGNATURE);
+ sig = EVP_SIGNATURE_fetch(libctx, name, NULL);
+ if (sig != NULL) {
+ EVP_SIGNATURE_free(sig);
return 1;
}
}
diff --git a/crypto/http/http_lib.c b/crypto/http/http_lib.c
index fcf8a69e07a8..022b8c194cbe 100644
--- a/crypto/http/http_lib.c
+++ b/crypto/http/http_lib.c
@@ -263,6 +263,7 @@ static int use_proxy(const char *no_proxy, const char *server)
/* strip leading '[' and trailing ']' from escaped IPv6 address */
sl -= 2;
strncpy(host, server + 1, sl);
+ host[sl] = '\0';
server = host;
}
diff --git a/crypto/info.c b/crypto/info.c
index 4d70471be255..e760ec094027 100644
--- a/crypto/info.c
+++ b/crypto/info.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2019-2025 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
@@ -23,6 +23,9 @@
#if defined(__arm__) || defined(__arm) || defined(__aarch64__)
# include "arm_arch.h"
# define CPU_INFO_STR_LEN 128
+#elif defined(__powerpc__) || defined(__POWERPC__) || defined(_ARCH_PPC)
+# include "crypto/ppc_arch.h"
+# define CPU_INFO_STR_LEN 128
#elif defined(__s390__) || defined(__s390x__)
# include "s390x_arch.h"
# define CPU_INFO_STR_LEN 2048
@@ -77,6 +80,15 @@ DEFINE_RUN_ONCE_STATIC(init_info_strings)
BIO_snprintf(ossl_cpu_info_str + strlen(ossl_cpu_info_str),
sizeof(ossl_cpu_info_str) - strlen(ossl_cpu_info_str),
" env:%s", env);
+# elif defined(__powerpc__) || defined(__POWERPC__) || defined(_ARCH_PPC)
+ const char *env;
+
+ BIO_snprintf(ossl_cpu_info_str, sizeof(ossl_cpu_info_str),
+ CPUINFO_PREFIX "OPENSSL_ppccap=0x%x", OPENSSL_ppccap_P);
+ if ((env = getenv("OPENSSL_ppccap")) != NULL)
+ BIO_snprintf(ossl_cpu_info_str + strlen(ossl_cpu_info_str),
+ sizeof(ossl_cpu_info_str) - strlen(ossl_cpu_info_str),
+ " env:%s", env);
# elif defined(__s390__) || defined(__s390x__)
const char *env;
diff --git a/crypto/ml_dsa/ml_dsa_key.c b/crypto/ml_dsa/ml_dsa_key.c
index 41df1a956fb8..50e3b5433085 100644
--- a/crypto/ml_dsa/ml_dsa_key.c
+++ b/crypto/ml_dsa/ml_dsa_key.c
@@ -311,6 +311,7 @@ int ossl_ml_dsa_key_has(const ML_DSA_KEY *key, int selection)
static int public_from_private(const ML_DSA_KEY *key, EVP_MD_CTX *md_ctx,
VECTOR *t1, VECTOR *t0)
{
+ int ret = 0;
const ML_DSA_PARAMS *params = key->params;
uint32_t k = params->k, l = params->l;
POLY *polys;
@@ -343,9 +344,10 @@ static int public_from_private(const ML_DSA_KEY *key, EVP_MD_CTX *md_ctx,
/* Zeroize secret */
vector_zero(&s1_ntt);
+ ret = 1;
err:
OPENSSL_free(polys);
- return 1;
+ return ret;
}
int ossl_ml_dsa_key_public_from_private(ML_DSA_KEY *key)
diff --git a/crypto/ml_kem/ml_kem.c b/crypto/ml_kem/ml_kem.c
index 4474af0f87cb..716c3bf4275e 100644
--- a/crypto/ml_kem/ml_kem.c
+++ b/crypto/ml_kem/ml_kem.c
@@ -2046,5 +2046,5 @@ int ossl_ml_kem_pubkey_cmp(const ML_KEM_KEY *key1, const ML_KEM_KEY *key2)
* No match if just one of the public keys is not available, otherwise both
* are unavailable, and for now such keys are considered equal.
*/
- return (ossl_ml_kem_have_pubkey(key1) ^ ossl_ml_kem_have_pubkey(key2));
+ return (!(ossl_ml_kem_have_pubkey(key1) ^ ossl_ml_kem_have_pubkey(key2)));
}
diff --git a/crypto/modes/siv128.c b/crypto/modes/siv128.c
index 72526b849eaf..4e52d8eb8782 100644
--- a/crypto/modes/siv128.c
+++ b/crypto/modes/siv128.c
@@ -202,9 +202,12 @@ int ossl_siv128_init(SIV128_CONTEXT *ctx, const unsigned char *key, int klen,
|| !EVP_MAC_final(mac_ctx, ctx->d.byte, &out_len,
sizeof(ctx->d.byte))) {
EVP_CIPHER_CTX_free(ctx->cipher_ctx);
+ ctx->cipher_ctx = NULL;
EVP_MAC_CTX_free(ctx->mac_ctx_init);
+ ctx->mac_ctx_init = NULL;
EVP_MAC_CTX_free(mac_ctx);
EVP_MAC_free(ctx->mac);
+ ctx->mac = NULL;
return 0;
}
EVP_MAC_CTX_free(mac_ctx);
diff --git a/crypto/property/property_parse.c b/crypto/property/property_parse.c
index 3a67754224f0..23963c89bc46 100644
--- a/crypto/property/property_parse.c
+++ b/crypto/property/property_parse.c
@@ -641,7 +641,7 @@ static void put_str(const char *str, char **buf, size_t *remain, size_t *needed)
}
quotes = quote != '\0';
- if (*remain == 0) {
+ if (*remain <= (size_t)quotes) {
*needed += 2 * quotes;
return;
}
diff --git a/crypto/rsa/rsa_gen.c b/crypto/rsa/rsa_gen.c
index 033f66714add..f76bb7748369 100644
--- a/crypto/rsa/rsa_gen.c
+++ b/crypto/rsa/rsa_gen.c
@@ -734,18 +734,3 @@ err:
return ret;
}
-
-#ifdef FIPS_MODULE
-int ossl_rsa_key_pairwise_test(RSA *rsa)
-{
- OSSL_CALLBACK *stcb;
- void *stcbarg;
- int res;
-
- OSSL_SELF_TEST_get_callback(rsa->libctx, &stcb, &stcbarg);
- res = rsa_keygen_pairwise_test(rsa, stcb, stcbarg);
- if (res <= 0)
- ossl_set_error_state(OSSL_SELF_TEST_TYPE_PCT_IMPORT);
- return res;
-}
-#endif /* FIPS_MODULE */
diff --git a/crypto/rsa/rsa_sign.c b/crypto/rsa/rsa_sign.c
index 78e4bad69e49..bb6e99acf9d3 100644
--- a/crypto/rsa/rsa_sign.c
+++ b/crypto/rsa/rsa_sign.c
@@ -1,5 +1,5 @@
/*
- * Copyright 1995-2024 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2025 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
@@ -129,7 +129,7 @@ static const unsigned char digestinfo_ripemd160_der[] = {
# ifndef OPENSSL_NO_SM3
/* SM3 (1 2 156 10197 1 401) */
static const unsigned char digestinfo_sm3_der[] = {
- ASN1_SEQUENCE, 0x0f + SM3_DIGEST_LENGTH,
+ ASN1_SEQUENCE, 0x10 + SM3_DIGEST_LENGTH,
ASN1_SEQUENCE, 0x0c,
ASN1_OID, 0x08, 1 * 40 + 2, 0x81, 0x1c, 0xcf, 0x55, 1, 0x83, 0x78,
ASN1_NULL, 0x00,
diff --git a/crypto/threads_pthread.c b/crypto/threads_pthread.c
index 44d6ebe09231..ace2dc499061 100644
--- a/crypto/threads_pthread.c
+++ b/crypto/threads_pthread.c
@@ -62,8 +62,10 @@ __tsan_mutex_post_lock((x), 0, 0)
/*
* The Non-Stop KLT thread model currently seems broken in its rwlock
* implementation
+ * Likewise is there a problem with the glibc implementation on riscv.
*/
-# if defined(PTHREAD_RWLOCK_INITIALIZER) && !defined(_KLT_MODEL_)
+# if defined(PTHREAD_RWLOCK_INITIALIZER) && !defined(_KLT_MODEL_) \
+ && !defined(__riscv)
# define USE_RWLOCK
# endif
@@ -279,7 +281,7 @@ static struct rcu_qp *get_hold_current_qp(struct rcu_lock_st *lock)
/* if the idx hasn't changed, we're good, else try again */
if (qp_idx == ATOMIC_LOAD_N(uint32_t, &lock->reader_idx,
- __ATOMIC_RELAXED))
+ __ATOMIC_ACQUIRE))
break;
ATOMIC_SUB_FETCH(&lock->qp_group[qp_idx].users, (uint64_t)1,
@@ -403,8 +405,12 @@ static struct rcu_qp *update_qp(CRYPTO_RCU_LOCK *lock, uint32_t *curr_id)
*curr_id = lock->id_ctr;
lock->id_ctr++;
+ /*
+ * make the current state of everything visible by this release
+ * when get_hold_current_qp acquires the next qp
+ */
ATOMIC_STORE_N(uint32_t, &lock->reader_idx, lock->current_alloc_idx,
- __ATOMIC_RELAXED);
+ __ATOMIC_RELEASE);
/*
* this should make sure that the new value of reader_idx is visible in
diff --git a/crypto/x509/t_x509.c b/crypto/x509/t_x509.c
index 7d693669cd36..d849e642ce8b 100644
--- a/crypto/x509/t_x509.c
+++ b/crypto/x509/t_x509.c
@@ -219,7 +219,8 @@ int X509_ocspid_print(BIO *bp, X509 *x)
goto err;
if ((der = dertmp = OPENSSL_malloc(derlen)) == NULL)
goto err;
- i2d_X509_NAME(subj, &dertmp);
+ if (i2d_X509_NAME(subj, &dertmp) < 0)
+ goto err;
md = EVP_MD_fetch(x->libctx, SN_sha1, x->propq);
if (md == NULL)
diff --git a/crypto/x509/x509_lu.c b/crypto/x509/x509_lu.c
index 05ee7c8c6b51..eb2d47955b2e 100644
--- a/crypto/x509/x509_lu.c
+++ b/crypto/x509/x509_lu.c
@@ -408,7 +408,6 @@ static int x509_store_add(X509_STORE *store, void *x, int crl)
}
if (!X509_STORE_lock(store)) {
- obj->type = X509_LU_NONE;
X509_OBJECT_free(obj);
return 0;
}