summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authortb <>2024-02-18 15:45:42 +0000
committertb <>2024-02-18 15:45:42 +0000
commit46825b346de88f3d8b554aef8711f11431f7e17c (patch)
tree9047d6e85fd9fcd495ed303a0ed1b208200ff841 /src/lib
parent39b6299876ec6c908309c9f47f3940eb84b3be12 (diff)
downloadopenbsd-46825b346de88f3d8b554aef8711f11431f7e17c.tar.gz
openbsd-46825b346de88f3d8b554aef8711f11431f7e17c.tar.bz2
openbsd-46825b346de88f3d8b554aef8711f11431f7e17c.zip
Use EVP_MD_CTX_legacy_clear() internally
ok jsing
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/evp/evp_digest.c8
-rw-r--r--src/lib/libcrypto/evp/evp_key.c4
-rw-r--r--src/lib/libcrypto/evp/evp_pbe.c4
-rw-r--r--src/lib/libcrypto/evp/m_sigver.c6
-rw-r--r--src/lib/libcrypto/evp/p_sign.c4
-rw-r--r--src/lib/libcrypto/evp/p_verify.c4
-rw-r--r--src/lib/libcrypto/hmac/hmac.c8
-rw-r--r--src/lib/libcrypto/pem/pvkfmt.c4
-rw-r--r--src/lib/libcrypto/pkcs7/pk7_doit.c8
-rw-r--r--src/lib/libcrypto/rsa/rsa_oaep.c4
-rw-r--r--src/lib/libcrypto/rsa/rsa_pss.c6
-rw-r--r--src/lib/libcrypto/x509/x509_cmp.c6
12 files changed, 33 insertions, 33 deletions
diff --git a/src/lib/libcrypto/evp/evp_digest.c b/src/lib/libcrypto/evp/evp_digest.c
index 33ba923e72..3a349ad0e6 100644
--- a/src/lib/libcrypto/evp/evp_digest.c
+++ b/src/lib/libcrypto/evp/evp_digest.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: evp_digest.c,v 1.9 2024/02/18 15:43:21 tb Exp $ */ 1/* $OpenBSD: evp_digest.c,v 1.10 2024/02/18 15:45:42 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -123,7 +123,7 @@
123int 123int
124EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type) 124EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
125{ 125{
126 EVP_MD_CTX_init(ctx); 126 EVP_MD_CTX_legacy_clear(ctx);
127 return EVP_DigestInit_ex(ctx, type, NULL); 127 return EVP_DigestInit_ex(ctx, type, NULL);
128} 128}
129 129
@@ -207,7 +207,7 @@ EVP_Digest(const void *data, size_t count,
207 EVP_MD_CTX ctx; 207 EVP_MD_CTX ctx;
208 int ret; 208 int ret;
209 209
210 EVP_MD_CTX_init(&ctx); 210 EVP_MD_CTX_legacy_clear(&ctx);
211 EVP_MD_CTX_set_flags(&ctx, EVP_MD_CTX_FLAG_ONESHOT); 211 EVP_MD_CTX_set_flags(&ctx, EVP_MD_CTX_FLAG_ONESHOT);
212 ret = EVP_DigestInit_ex(&ctx, type, NULL) && 212 ret = EVP_DigestInit_ex(&ctx, type, NULL) &&
213 EVP_DigestUpdate(&ctx, data, count) && 213 EVP_DigestUpdate(&ctx, data, count) &&
@@ -294,7 +294,7 @@ EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx)
294int 294int
295EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in) 295EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in)
296{ 296{
297 EVP_MD_CTX_init(out); 297 EVP_MD_CTX_legacy_clear(out);
298 return EVP_MD_CTX_copy_ex(out, in); 298 return EVP_MD_CTX_copy_ex(out, in);
299} 299}
300 300
diff --git a/src/lib/libcrypto/evp/evp_key.c b/src/lib/libcrypto/evp/evp_key.c
index 1f3d758268..f51584b84b 100644
--- a/src/lib/libcrypto/evp/evp_key.c
+++ b/src/lib/libcrypto/evp/evp_key.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: evp_key.c,v 1.33 2024/01/05 10:18:52 tb Exp $ */ 1/* $OpenBSD: evp_key.c,v 1.34 2024/02/18 15:45:42 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -156,7 +156,7 @@ EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md,
156 if (data == NULL) 156 if (data == NULL)
157 return nkey; 157 return nkey;
158 158
159 EVP_MD_CTX_init(&c); 159 EVP_MD_CTX_legacy_clear(&c);
160 for (;;) { 160 for (;;) {
161 if (!EVP_DigestInit_ex(&c, md, NULL)) 161 if (!EVP_DigestInit_ex(&c, md, NULL))
162 goto err; 162 goto err;
diff --git a/src/lib/libcrypto/evp/evp_pbe.c b/src/lib/libcrypto/evp/evp_pbe.c
index bb0c227ae7..eb8d5c4157 100644
--- a/src/lib/libcrypto/evp/evp_pbe.c
+++ b/src/lib/libcrypto/evp/evp_pbe.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: evp_pbe.c,v 1.41 2024/02/01 17:11:58 tb Exp $ */ 1/* $OpenBSD: evp_pbe.c,v 1.42 2024/02/18 15:45:42 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -266,7 +266,7 @@ PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *cctx, const char *pass, int passlen,
266 else if (passlen == -1) 266 else if (passlen == -1)
267 passlen = strlen(pass); 267 passlen = strlen(pass);
268 268
269 EVP_MD_CTX_init(&ctx); 269 EVP_MD_CTX_legacy_clear(&ctx);
270 270
271 if (!EVP_DigestInit_ex(&ctx, md, NULL)) 271 if (!EVP_DigestInit_ex(&ctx, md, NULL))
272 goto err; 272 goto err;
diff --git a/src/lib/libcrypto/evp/m_sigver.c b/src/lib/libcrypto/evp/m_sigver.c
index 3ce7f7e2a6..a72671ed92 100644
--- a/src/lib/libcrypto/evp/m_sigver.c
+++ b/src/lib/libcrypto/evp/m_sigver.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: m_sigver.c,v 1.14 2023/11/29 21:35:57 tb Exp $ */ 1/* $OpenBSD: m_sigver.c,v 1.15 2024/02/18 15:45:42 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2006. 3 * project 2006.
4 */ 4 */
@@ -171,7 +171,7 @@ EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, size_t *siglen)
171 EVP_MD_CTX tmp_ctx; 171 EVP_MD_CTX tmp_ctx;
172 unsigned char md[EVP_MAX_MD_SIZE]; 172 unsigned char md[EVP_MAX_MD_SIZE];
173 unsigned int mdlen = 0; 173 unsigned int mdlen = 0;
174 EVP_MD_CTX_init(&tmp_ctx); 174 EVP_MD_CTX_legacy_clear(&tmp_ctx);
175 if (!EVP_MD_CTX_copy_ex(&tmp_ctx, ctx)) 175 if (!EVP_MD_CTX_copy_ex(&tmp_ctx, ctx))
176 return 0; 176 return 0;
177 if (sctx) 177 if (sctx)
@@ -228,7 +228,7 @@ EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sig, size_t siglen)
228 vctx = 1; 228 vctx = 1;
229 else 229 else
230 vctx = 0; 230 vctx = 0;
231 EVP_MD_CTX_init(&tmp_ctx); 231 EVP_MD_CTX_legacy_clear(&tmp_ctx);
232 if (!EVP_MD_CTX_copy_ex(&tmp_ctx, ctx)) 232 if (!EVP_MD_CTX_copy_ex(&tmp_ctx, ctx))
233 return -1; 233 return -1;
234 if (vctx) { 234 if (vctx) {
diff --git a/src/lib/libcrypto/evp/p_sign.c b/src/lib/libcrypto/evp/p_sign.c
index f7c21178a0..f6d6e12a30 100644
--- a/src/lib/libcrypto/evp/p_sign.c
+++ b/src/lib/libcrypto/evp/p_sign.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p_sign.c,v 1.19 2023/07/07 19:37:54 beck Exp $ */ 1/* $OpenBSD: p_sign.c,v 1.20 2024/02/18 15:45:42 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -77,7 +77,7 @@ EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, unsigned int *siglen,
77 int ret = 0; 77 int ret = 0;
78 78
79 *siglen = 0; 79 *siglen = 0;
80 EVP_MD_CTX_init(&tmp_ctx); 80 EVP_MD_CTX_legacy_clear(&tmp_ctx);
81 if (!EVP_MD_CTX_copy_ex(&tmp_ctx, ctx)) 81 if (!EVP_MD_CTX_copy_ex(&tmp_ctx, ctx))
82 goto err; 82 goto err;
83 if (!EVP_DigestFinal_ex(&tmp_ctx, &(m[0]), &m_len)) 83 if (!EVP_DigestFinal_ex(&tmp_ctx, &(m[0]), &m_len))
diff --git a/src/lib/libcrypto/evp/p_verify.c b/src/lib/libcrypto/evp/p_verify.c
index da7ab5425a..ed9b3700fe 100644
--- a/src/lib/libcrypto/evp/p_verify.c
+++ b/src/lib/libcrypto/evp/p_verify.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p_verify.c,v 1.18 2023/07/07 19:37:54 beck Exp $ */ 1/* $OpenBSD: p_verify.c,v 1.19 2024/02/18 15:45:42 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -75,7 +75,7 @@ EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf,
75 EVP_PKEY_CTX *pkctx = NULL; 75 EVP_PKEY_CTX *pkctx = NULL;
76 int ret = 0; 76 int ret = 0;
77 77
78 EVP_MD_CTX_init(&tmp_ctx); 78 EVP_MD_CTX_legacy_clear(&tmp_ctx);
79 if (!EVP_MD_CTX_copy_ex(&tmp_ctx, ctx)) 79 if (!EVP_MD_CTX_copy_ex(&tmp_ctx, ctx))
80 goto err; 80 goto err;
81 if (!EVP_DigestFinal_ex(&tmp_ctx, &(m[0]), &m_len)) 81 if (!EVP_DigestFinal_ex(&tmp_ctx, &(m[0]), &m_len))
diff --git a/src/lib/libcrypto/hmac/hmac.c b/src/lib/libcrypto/hmac/hmac.c
index ea3a1b4a45..32d75154d4 100644
--- a/src/lib/libcrypto/hmac/hmac.c
+++ b/src/lib/libcrypto/hmac/hmac.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: hmac.c,v 1.31 2023/02/16 08:38:17 tb Exp $ */ 1/* $OpenBSD: hmac.c,v 1.32 2024/02/18 15:45:42 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -214,9 +214,9 @@ HMAC_CTX_reset(HMAC_CTX *ctx)
214void 214void
215HMAC_CTX_init(HMAC_CTX *ctx) 215HMAC_CTX_init(HMAC_CTX *ctx)
216{ 216{
217 EVP_MD_CTX_init(&ctx->i_ctx); 217 EVP_MD_CTX_legacy_clear(&ctx->i_ctx);
218 EVP_MD_CTX_init(&ctx->o_ctx); 218 EVP_MD_CTX_legacy_clear(&ctx->o_ctx);
219 EVP_MD_CTX_init(&ctx->md_ctx); 219 EVP_MD_CTX_legacy_clear(&ctx->md_ctx);
220 ctx->md = NULL; 220 ctx->md = NULL;
221} 221}
222 222
diff --git a/src/lib/libcrypto/pem/pvkfmt.c b/src/lib/libcrypto/pem/pvkfmt.c
index 816d8b7dc0..40c9feefe5 100644
--- a/src/lib/libcrypto/pem/pvkfmt.c
+++ b/src/lib/libcrypto/pem/pvkfmt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pvkfmt.c,v 1.27 2023/07/07 13:40:44 beck Exp $ */ 1/* $OpenBSD: pvkfmt.c,v 1.28 2024/02/18 15:45:42 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2005. 3 * project 2005.
4 */ 4 */
@@ -713,7 +713,7 @@ derive_pvk_key(unsigned char *key, const unsigned char *salt,
713 EVP_MD_CTX mctx; 713 EVP_MD_CTX mctx;
714 int rv = 1; 714 int rv = 1;
715 715
716 EVP_MD_CTX_init(&mctx); 716 EVP_MD_CTX_legacy_clear(&mctx);
717 if (!EVP_DigestInit_ex(&mctx, EVP_sha1(), NULL) || 717 if (!EVP_DigestInit_ex(&mctx, EVP_sha1(), NULL) ||
718 !EVP_DigestUpdate(&mctx, salt, saltlen) || 718 !EVP_DigestUpdate(&mctx, salt, saltlen) ||
719 !EVP_DigestUpdate(&mctx, pass, passlen) || 719 !EVP_DigestUpdate(&mctx, pass, passlen) ||
diff --git a/src/lib/libcrypto/pkcs7/pk7_doit.c b/src/lib/libcrypto/pkcs7/pk7_doit.c
index ce0e99eec1..3cc7add66f 100644
--- a/src/lib/libcrypto/pkcs7/pk7_doit.c
+++ b/src/lib/libcrypto/pkcs7/pk7_doit.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pk7_doit.c,v 1.55 2024/01/25 13:44:08 tb Exp $ */ 1/* $OpenBSD: pk7_doit.c,v 1.56 2024/02/18 15:45:42 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -711,7 +711,7 @@ PKCS7_dataFinal(PKCS7 *p7, BIO *bio)
711 return 0; 711 return 0;
712 } 712 }
713 713
714 EVP_MD_CTX_init(&ctx_tmp); 714 EVP_MD_CTX_legacy_clear(&ctx_tmp);
715 i = OBJ_obj2nid(p7->type); 715 i = OBJ_obj2nid(p7->type);
716 p7->state = PKCS7_S_HEADER; 716 p7->state = PKCS7_S_HEADER;
717 717
@@ -879,7 +879,7 @@ PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO *si)
879 if (md == NULL) 879 if (md == NULL)
880 return 0; 880 return 0;
881 881
882 EVP_MD_CTX_init(&mctx); 882 EVP_MD_CTX_legacy_clear(&mctx);
883 if (EVP_DigestSignInit(&mctx, &pctx, md, NULL, si->pkey) <= 0) 883 if (EVP_DigestSignInit(&mctx, &pctx, md, NULL, si->pkey) <= 0)
884 goto err; 884 goto err;
885 885
@@ -997,7 +997,7 @@ PKCS7_signatureVerify(BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si, X509 *x509)
997 BIO *btmp; 997 BIO *btmp;
998 EVP_PKEY *pkey; 998 EVP_PKEY *pkey;
999 999
1000 EVP_MD_CTX_init(&mdc_tmp); 1000 EVP_MD_CTX_legacy_clear(&mdc_tmp);
1001 1001
1002 if (!PKCS7_type_is_signed(p7) && 1002 if (!PKCS7_type_is_signed(p7) &&
1003 !PKCS7_type_is_signedAndEnveloped(p7)) { 1003 !PKCS7_type_is_signedAndEnveloped(p7)) {
diff --git a/src/lib/libcrypto/rsa/rsa_oaep.c b/src/lib/libcrypto/rsa/rsa_oaep.c
index c2c3a61daa..4927673898 100644
--- a/src/lib/libcrypto/rsa/rsa_oaep.c
+++ b/src/lib/libcrypto/rsa/rsa_oaep.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_oaep.c,v 1.37 2023/07/08 12:26:45 beck Exp $ */ 1/* $OpenBSD: rsa_oaep.c,v 1.38 2024/02/18 15:45:42 tb Exp $ */
2/* 2/*
3 * Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved. 3 * Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved.
4 * 4 *
@@ -331,7 +331,7 @@ PKCS1_MGF1(unsigned char *mask, long len, const unsigned char *seed,
331 int mdlen; 331 int mdlen;
332 int rv = -1; 332 int rv = -1;
333 333
334 EVP_MD_CTX_init(&c); 334 EVP_MD_CTX_legacy_clear(&c);
335 mdlen = EVP_MD_size(dgst); 335 mdlen = EVP_MD_size(dgst);
336 if (mdlen < 0) 336 if (mdlen < 0)
337 goto err; 337 goto err;
diff --git a/src/lib/libcrypto/rsa/rsa_pss.c b/src/lib/libcrypto/rsa/rsa_pss.c
index 0860409be9..6670866ff6 100644
--- a/src/lib/libcrypto/rsa/rsa_pss.c
+++ b/src/lib/libcrypto/rsa/rsa_pss.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_pss.c,v 1.17 2023/07/08 12:26:45 beck Exp $ */ 1/* $OpenBSD: rsa_pss.c,v 1.18 2024/02/18 15:45:42 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2005. 3 * project 2005.
4 */ 4 */
@@ -92,7 +92,7 @@ RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash,
92 EVP_MD_CTX ctx; 92 EVP_MD_CTX ctx;
93 unsigned char H_[EVP_MAX_MD_SIZE]; 93 unsigned char H_[EVP_MAX_MD_SIZE];
94 94
95 EVP_MD_CTX_init(&ctx); 95 EVP_MD_CTX_legacy_clear(&ctx);
96 96
97 if (mgf1Hash == NULL) 97 if (mgf1Hash == NULL)
98 mgf1Hash = Hash; 98 mgf1Hash = Hash;
@@ -200,7 +200,7 @@ RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM,
200 unsigned char *H, *salt = NULL, *p; 200 unsigned char *H, *salt = NULL, *p;
201 EVP_MD_CTX ctx; 201 EVP_MD_CTX ctx;
202 202
203 EVP_MD_CTX_init(&ctx); 203 EVP_MD_CTX_legacy_clear(&ctx);
204 204
205 if (mgf1Hash == NULL) 205 if (mgf1Hash == NULL)
206 mgf1Hash = Hash; 206 mgf1Hash = Hash;
diff --git a/src/lib/libcrypto/x509/x509_cmp.c b/src/lib/libcrypto/x509/x509_cmp.c
index 3ee4fd4a5d..6098b6e7e8 100644
--- a/src/lib/libcrypto/x509/x509_cmp.c
+++ b/src/lib/libcrypto/x509/x509_cmp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_cmp.c,v 1.42 2023/02/16 08:38:17 tb Exp $ */ 1/* $OpenBSD: x509_cmp.c,v 1.43 2024/02/18 15:45:42 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -95,7 +95,7 @@ X509_issuer_and_serial_hash(X509 *a)
95 unsigned char md[16]; 95 unsigned char md[16];
96 char *f; 96 char *f;
97 97
98 EVP_MD_CTX_init(&ctx); 98 EVP_MD_CTX_legacy_clear(&ctx);
99 f = X509_NAME_oneline(a->cert_info->issuer, NULL, 0); 99 f = X509_NAME_oneline(a->cert_info->issuer, NULL, 0);
100 if (f == NULL) 100 if (f == NULL)
101 goto err; 101 goto err;
@@ -291,7 +291,7 @@ X509_NAME_hash_old(X509_NAME *x)
291 291
292 /* Make sure X509_NAME structure contains valid cached encoding */ 292 /* Make sure X509_NAME structure contains valid cached encoding */
293 i2d_X509_NAME(x, NULL); 293 i2d_X509_NAME(x, NULL);
294 EVP_MD_CTX_init(&md_ctx); 294 EVP_MD_CTX_legacy_clear(&md_ctx);
295 if (EVP_DigestInit_ex(&md_ctx, EVP_md5(), NULL) && 295 if (EVP_DigestInit_ex(&md_ctx, EVP_md5(), NULL) &&
296 EVP_DigestUpdate(&md_ctx, x->bytes->data, x->bytes->length) && 296 EVP_DigestUpdate(&md_ctx, x->bytes->data, x->bytes->length) &&
297 EVP_DigestFinal_ex(&md_ctx, md, NULL)) 297 EVP_DigestFinal_ex(&md_ctx, md, NULL))