summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2021-12-12 21:30:14 +0000
committertb <>2021-12-12 21:30:14 +0000
commitc1ae4c3a2dcb48029aaea219cb195e9dfe1d093d (patch)
tree68f1da62b9246ae5a21e41ac2ee05ee8307cfa6f
parenta0b1347b1dec62a1a5e864ed59314d2e9b42e15b (diff)
downloadopenbsd-c1ae4c3a2dcb48029aaea219cb195e9dfe1d093d.tar.gz
openbsd-c1ae4c3a2dcb48029aaea219cb195e9dfe1d093d.tar.bz2
openbsd-c1ae4c3a2dcb48029aaea219cb195e9dfe1d093d.zip
Include evp_locl.h where it will be needed once most structs from
evp.h will be moved to evp_locl.h in an upcoming bump. ok inoguchi
-rw-r--r--src/lib/libcrypto/asn1/a_pkey.c3
-rw-r--r--src/lib/libcrypto/asn1/a_pubkey.c4
-rw-r--r--src/lib/libcrypto/asn1/a_sign.c3
-rw-r--r--src/lib/libcrypto/asn1/a_verify.c3
-rw-r--r--src/lib/libcrypto/asn1/ameth_lib.c3
-rw-r--r--src/lib/libcrypto/asn1/asn_mime.c3
-rw-r--r--src/lib/libcrypto/asn1/n_pkey.c3
-rw-r--r--src/lib/libcrypto/asn1/p5_pbev2.c4
-rw-r--r--src/lib/libcrypto/asn1/x_pubkey.c3
-rw-r--r--src/lib/libcrypto/cmac/cm_ameth.c3
-rw-r--r--src/lib/libcrypto/cmac/cmac.c4
-rw-r--r--src/lib/libcrypto/dh/dh_ameth.c3
-rw-r--r--src/lib/libcrypto/dsa/dsa_ameth.c3
-rw-r--r--src/lib/libcrypto/ec/ec_ameth.c3
-rw-r--r--src/lib/libcrypto/engine/eng_openssl.c4
-rw-r--r--src/lib/libcrypto/evp/bio_b64.c4
-rw-r--r--src/lib/libcrypto/evp/bio_enc.c4
-rw-r--r--src/lib/libcrypto/evp/bio_md.c4
-rw-r--r--src/lib/libcrypto/evp/digest.c4
-rw-r--r--src/lib/libcrypto/evp/e_aes_cbc_hmac_sha1.c5
-rw-r--r--src/lib/libcrypto/evp/e_camellia.c3
-rw-r--r--src/lib/libcrypto/evp/e_gost2814789.c4
-rw-r--r--src/lib/libcrypto/evp/e_null.c4
-rw-r--r--src/lib/libcrypto/evp/e_rc4_hmac_md5.c4
-rw-r--r--src/lib/libcrypto/evp/encode.c4
-rw-r--r--src/lib/libcrypto/evp/evp_key.c4
-rw-r--r--src/lib/libcrypto/evp/evp_lib.c4
-rw-r--r--src/lib/libcrypto/evp/evp_pkey.c3
-rw-r--r--src/lib/libcrypto/evp/m_dss.c4
-rw-r--r--src/lib/libcrypto/evp/m_dss1.c4
-rw-r--r--src/lib/libcrypto/evp/m_ecdsa.c4
-rw-r--r--src/lib/libcrypto/evp/m_gost2814789.c5
-rw-r--r--src/lib/libcrypto/evp/m_gostr341194.c5
-rw-r--r--src/lib/libcrypto/evp/m_md4.c4
-rw-r--r--src/lib/libcrypto/evp/m_md5.c4
-rw-r--r--src/lib/libcrypto/evp/m_md5_sha1.c4
-rw-r--r--src/lib/libcrypto/evp/m_null.c4
-rw-r--r--src/lib/libcrypto/evp/m_ripemd.c4
-rw-r--r--src/lib/libcrypto/evp/m_sha1.c4
-rw-r--r--src/lib/libcrypto/evp/m_sm3.c4
-rw-r--r--src/lib/libcrypto/evp/m_streebog.c4
-rw-r--r--src/lib/libcrypto/evp/m_wp.c4
-rw-r--r--src/lib/libcrypto/evp/names.c4
-rw-r--r--src/lib/libcrypto/evp/p5_crpt.c4
-rw-r--r--src/lib/libcrypto/evp/p_dec.c4
-rw-r--r--src/lib/libcrypto/evp/p_enc.c4
-rw-r--r--src/lib/libcrypto/evp/p_lib.c3
-rw-r--r--src/lib/libcrypto/evp/p_open.c4
-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/gost/gost89imit_ameth.c3
-rw-r--r--src/lib/libcrypto/gost/gostr341001_ameth.c3
-rw-r--r--src/lib/libcrypto/hkdf/hkdf.c3
-rw-r--r--src/lib/libcrypto/hmac/hm_ameth.c3
-rw-r--r--src/lib/libcrypto/hmac/hmac.c3
-rw-r--r--src/lib/libcrypto/pem/pem_info.c4
-rw-r--r--src/lib/libcrypto/pem/pem_lib.c3
-rw-r--r--src/lib/libcrypto/pem/pem_pkey.c3
-rw-r--r--src/lib/libcrypto/pem/pvkfmt.c3
-rw-r--r--src/lib/libcrypto/pkcs12/p12_decr.c4
-rw-r--r--src/lib/libcrypto/pkcs12/p12_key.c4
-rw-r--r--src/lib/libcrypto/pkcs12/p12_mutl.c3
-rw-r--r--src/lib/libcrypto/pkcs7/pk7_doit.c3
-rw-r--r--src/lib/libcrypto/pkcs7/pk7_lib.c3
-rw-r--r--src/lib/libcrypto/rsa/rsa_oaep.c3
-rw-r--r--src/lib/libcrypto/rsa/rsa_pss.c4
-rw-r--r--src/lib/libcrypto/ts/ts_rsp_sign.c3
-rw-r--r--src/lib/libcrypto/ts/ts_rsp_verify.c3
-rw-r--r--src/lib/libcrypto/x509/x509_cmp.c3
-rw-r--r--src/lib/libcrypto/x509/x509_req.c3
-rw-r--r--src/lib/libcrypto/x509/x509type.c3
71 files changed, 184 insertions, 72 deletions
diff --git a/src/lib/libcrypto/asn1/a_pkey.c b/src/lib/libcrypto/asn1/a_pkey.c
index 5e6787d641..2e97d32ab4 100644
--- a/src/lib/libcrypto/asn1/a_pkey.c
+++ b/src/lib/libcrypto/asn1/a_pkey.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: a_pkey.c,v 1.1 2021/12/04 15:38:10 jsing Exp $ */ 1/* $OpenBSD: a_pkey.c,v 1.2 2021/12/12 21:30:13 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 *
@@ -72,6 +72,7 @@
72#endif 72#endif
73 73
74#include "asn1_locl.h" 74#include "asn1_locl.h"
75#include "evp_locl.h"
75 76
76EVP_PKEY * 77EVP_PKEY *
77d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp, long length) 78d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp, long length)
diff --git a/src/lib/libcrypto/asn1/a_pubkey.c b/src/lib/libcrypto/asn1/a_pubkey.c
index b89df8ae61..7ad13e9761 100644
--- a/src/lib/libcrypto/asn1/a_pubkey.c
+++ b/src/lib/libcrypto/asn1/a_pubkey.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: a_pubkey.c,v 1.1 2021/12/04 15:38:10 jsing Exp $ */ 1/* $OpenBSD: a_pubkey.c,v 1.2 2021/12/12 21:30:13 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 *
@@ -76,6 +76,8 @@
76#include <openssl/rsa.h> 76#include <openssl/rsa.h>
77#endif 77#endif
78 78
79#include "evp_locl.h"
80
79EVP_PKEY * 81EVP_PKEY *
80d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp, long length) 82d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp, long length)
81{ 83{
diff --git a/src/lib/libcrypto/asn1/a_sign.c b/src/lib/libcrypto/asn1/a_sign.c
index df955be745..b6b4c20970 100644
--- a/src/lib/libcrypto/asn1/a_sign.c
+++ b/src/lib/libcrypto/asn1/a_sign.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: a_sign.c,v 1.23 2017/05/02 03:59:44 deraadt Exp $ */ 1/* $OpenBSD: a_sign.c,v 1.24 2021/12/12 21:30:13 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,6 +123,7 @@
123#include <openssl/x509.h> 123#include <openssl/x509.h>
124 124
125#include "asn1_locl.h" 125#include "asn1_locl.h"
126#include "evp_locl.h"
126 127
127int 128int
128ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2, 129ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
diff --git a/src/lib/libcrypto/asn1/a_verify.c b/src/lib/libcrypto/asn1/a_verify.c
index 6f0cd1080b..a8a3790882 100644
--- a/src/lib/libcrypto/asn1/a_verify.c
+++ b/src/lib/libcrypto/asn1/a_verify.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: a_verify.c,v 1.24 2017/05/02 03:59:44 deraadt Exp $ */ 1/* $OpenBSD: a_verify.c,v 1.25 2021/12/12 21:30:13 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 *
@@ -70,6 +70,7 @@
70#include <openssl/x509.h> 70#include <openssl/x509.h>
71 71
72#include "asn1_locl.h" 72#include "asn1_locl.h"
73#include "evp_locl.h"
73 74
74int 75int
75ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, 76ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a,
diff --git a/src/lib/libcrypto/asn1/ameth_lib.c b/src/lib/libcrypto/asn1/ameth_lib.c
index 545ba8f1a1..ed7f5bd3e4 100644
--- a/src/lib/libcrypto/asn1/ameth_lib.c
+++ b/src/lib/libcrypto/asn1/ameth_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ameth_lib.c,v 1.22 2021/12/03 14:18:06 tb Exp $ */ 1/* $OpenBSD: ameth_lib.c,v 1.23 2021/12/12 21:30:13 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 */
@@ -69,6 +69,7 @@
69#endif 69#endif
70 70
71#include "asn1_locl.h" 71#include "asn1_locl.h"
72#include "evp_locl.h"
72 73
73extern const EVP_PKEY_ASN1_METHOD rsa_asn1_meths[]; 74extern const EVP_PKEY_ASN1_METHOD rsa_asn1_meths[];
74extern const EVP_PKEY_ASN1_METHOD rsa_pss_asn1_meth; 75extern const EVP_PKEY_ASN1_METHOD rsa_pss_asn1_meth;
diff --git a/src/lib/libcrypto/asn1/asn_mime.c b/src/lib/libcrypto/asn1/asn_mime.c
index 6bad111775..7a51808631 100644
--- a/src/lib/libcrypto/asn1/asn_mime.c
+++ b/src/lib/libcrypto/asn1/asn_mime.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: asn_mime.c,v 1.27 2017/01/29 17:49:22 beck Exp $ */ 1/* $OpenBSD: asn_mime.c,v 1.28 2021/12/12 21:30:13 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. 3 * project.
4 */ 4 */
@@ -63,6 +63,7 @@
63#include <openssl/x509.h> 63#include <openssl/x509.h>
64 64
65#include "asn1_locl.h" 65#include "asn1_locl.h"
66#include "evp_locl.h"
66 67
67/* Generalised MIME like utilities for streaming ASN1. Although many 68/* Generalised MIME like utilities for streaming ASN1. Although many
68 * have a PKCS7/CMS like flavour others are more general purpose. 69 * have a PKCS7/CMS like flavour others are more general purpose.
diff --git a/src/lib/libcrypto/asn1/n_pkey.c b/src/lib/libcrypto/asn1/n_pkey.c
index 89adcd5b11..cfc00887e5 100644
--- a/src/lib/libcrypto/asn1/n_pkey.c
+++ b/src/lib/libcrypto/asn1/n_pkey.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: n_pkey.c,v 1.33 2021/11/01 20:53:08 tb Exp $ */ 1/* $OpenBSD: n_pkey.c,v 1.34 2021/12/12 21:30:13 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 *
@@ -69,6 +69,7 @@
69#include <openssl/rsa.h> 69#include <openssl/rsa.h>
70#include <openssl/x509.h> 70#include <openssl/x509.h>
71 71
72#include "evp_locl.h"
72#include "x509_lcl.h" 73#include "x509_lcl.h"
73 74
74#ifndef OPENSSL_NO_RC4 75#ifndef OPENSSL_NO_RC4
diff --git a/src/lib/libcrypto/asn1/p5_pbev2.c b/src/lib/libcrypto/asn1/p5_pbev2.c
index 0105c59549..54dd1eb614 100644
--- a/src/lib/libcrypto/asn1/p5_pbev2.c
+++ b/src/lib/libcrypto/asn1/p5_pbev2.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p5_pbev2.c,v 1.25 2017/01/29 17:49:22 beck Exp $ */ 1/* $OpenBSD: p5_pbev2.c,v 1.26 2021/12/12 21:30:13 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-2004. 3 * project 1999-2004.
4 */ 4 */
@@ -64,6 +64,8 @@
64#include <openssl/err.h> 64#include <openssl/err.h>
65#include <openssl/x509.h> 65#include <openssl/x509.h>
66 66
67#include "evp_locl.h"
68
67/* PKCS#5 v2.0 password based encryption structures */ 69/* PKCS#5 v2.0 password based encryption structures */
68 70
69static const ASN1_TEMPLATE PBE2PARAM_seq_tt[] = { 71static const ASN1_TEMPLATE PBE2PARAM_seq_tt[] = {
diff --git a/src/lib/libcrypto/asn1/x_pubkey.c b/src/lib/libcrypto/asn1/x_pubkey.c
index 3efe61db48..fecd6c97e3 100644
--- a/src/lib/libcrypto/asn1/x_pubkey.c
+++ b/src/lib/libcrypto/asn1/x_pubkey.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x_pubkey.c,v 1.29 2021/12/03 16:46:50 jsing Exp $ */ 1/* $OpenBSD: x_pubkey.c,v 1.30 2021/12/12 21:30:13 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 *
@@ -72,6 +72,7 @@
72#endif 72#endif
73 73
74#include "asn1_locl.h" 74#include "asn1_locl.h"
75#include "evp_locl.h"
75#include "x509_lcl.h" 76#include "x509_lcl.h"
76 77
77/* Minor tweak to operation: free up EVP_PKEY */ 78/* Minor tweak to operation: free up EVP_PKEY */
diff --git a/src/lib/libcrypto/cmac/cm_ameth.c b/src/lib/libcrypto/cmac/cm_ameth.c
index e7e7fe0f80..26956465ee 100644
--- a/src/lib/libcrypto/cmac/cm_ameth.c
+++ b/src/lib/libcrypto/cmac/cm_ameth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cm_ameth.c,v 1.7 2014/07/12 16:03:37 miod Exp $ */ 1/* $OpenBSD: cm_ameth.c,v 1.8 2021/12/12 21:30:13 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 2010. 3 * project 2010.
4 */ 4 */
@@ -57,6 +57,7 @@
57#include <openssl/evp.h> 57#include <openssl/evp.h>
58 58
59#include "asn1_locl.h" 59#include "asn1_locl.h"
60#include "evp_locl.h"
60 61
61/* CMAC "ASN1" method. This is just here to indicate the 62/* CMAC "ASN1" method. This is just here to indicate the
62 * maximum CMAC output length and to free up a CMAC 63 * maximum CMAC output length and to free up a CMAC
diff --git a/src/lib/libcrypto/cmac/cmac.c b/src/lib/libcrypto/cmac/cmac.c
index d01ae0f3ae..cd286f88e3 100644
--- a/src/lib/libcrypto/cmac/cmac.c
+++ b/src/lib/libcrypto/cmac/cmac.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cmac.c,v 1.10 2015/09/10 15:56:25 jsing Exp $ */ 1/* $OpenBSD: cmac.c,v 1.11 2021/12/12 21:30:13 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. 3 * project.
4 */ 4 */
@@ -57,6 +57,8 @@
57 57
58#include <openssl/cmac.h> 58#include <openssl/cmac.h>
59 59
60#include "evp_locl.h"
61
60struct CMAC_CTX_st { 62struct CMAC_CTX_st {
61 /* Cipher context to use */ 63 /* Cipher context to use */
62 EVP_CIPHER_CTX cctx; 64 EVP_CIPHER_CTX cctx;
diff --git a/src/lib/libcrypto/dh/dh_ameth.c b/src/lib/libcrypto/dh/dh_ameth.c
index af15fb2c68..aee8b05850 100644
--- a/src/lib/libcrypto/dh/dh_ameth.c
+++ b/src/lib/libcrypto/dh/dh_ameth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dh_ameth.c,v 1.18 2020/01/04 13:57:43 inoguchi Exp $ */ 1/* $OpenBSD: dh_ameth.c,v 1.19 2021/12/12 21:30:13 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 */
@@ -65,6 +65,7 @@
65#include <openssl/x509.h> 65#include <openssl/x509.h>
66 66
67#include "asn1_locl.h" 67#include "asn1_locl.h"
68#include "evp_locl.h"
68 69
69static void 70static void
70int_dh_free(EVP_PKEY *pkey) 71int_dh_free(EVP_PKEY *pkey)
diff --git a/src/lib/libcrypto/dsa/dsa_ameth.c b/src/lib/libcrypto/dsa/dsa_ameth.c
index cfb33237ec..af9ebaddde 100644
--- a/src/lib/libcrypto/dsa/dsa_ameth.c
+++ b/src/lib/libcrypto/dsa/dsa_ameth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dsa_ameth.c,v 1.28 2019/11/01 15:15:35 jsing Exp $ */ 1/* $OpenBSD: dsa_ameth.c,v 1.29 2021/12/12 21:30:13 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 */
@@ -69,6 +69,7 @@
69 69
70#include "asn1_locl.h" 70#include "asn1_locl.h"
71#include "bn_lcl.h" 71#include "bn_lcl.h"
72#include "evp_locl.h"
72 73
73static int 74static int
74dsa_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *pubkey) 75dsa_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *pubkey)
diff --git a/src/lib/libcrypto/ec/ec_ameth.c b/src/lib/libcrypto/ec/ec_ameth.c
index 2e73bdd2f6..c96c46dd53 100644
--- a/src/lib/libcrypto/ec/ec_ameth.c
+++ b/src/lib/libcrypto/ec/ec_ameth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ec_ameth.c,v 1.28 2019/09/09 20:26:16 tb Exp $ */ 1/* $OpenBSD: ec_ameth.c,v 1.29 2021/12/12 21:30:13 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 */
@@ -67,6 +67,7 @@
67#include <openssl/x509.h> 67#include <openssl/x509.h>
68 68
69#include "asn1_locl.h" 69#include "asn1_locl.h"
70#include "evp_locl.h"
70 71
71#ifndef OPENSSL_NO_CMS 72#ifndef OPENSSL_NO_CMS
72static int ecdh_cms_decrypt(CMS_RecipientInfo *ri); 73static int ecdh_cms_decrypt(CMS_RecipientInfo *ri);
diff --git a/src/lib/libcrypto/engine/eng_openssl.c b/src/lib/libcrypto/engine/eng_openssl.c
index f8f6c8f58c..8bc508f7a4 100644
--- a/src/lib/libcrypto/engine/eng_openssl.c
+++ b/src/lib/libcrypto/engine/eng_openssl.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: eng_openssl.c,v 1.13 2018/04/14 07:18:37 tb Exp $ */ 1/* $OpenBSD: eng_openssl.c,v 1.14 2021/12/12 21:30:13 tb Exp $ */
2/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL 2/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -84,6 +84,8 @@
84#include <openssl/rsa.h> 84#include <openssl/rsa.h>
85#endif 85#endif
86 86
87#include "evp_locl.h"
88
87/* This testing gunk is implemented (and explained) lower down. It also assumes 89/* This testing gunk is implemented (and explained) lower down. It also assumes
88 * the application explicitly calls "ENGINE_load_openssl()" because this is no 90 * the application explicitly calls "ENGINE_load_openssl()" because this is no
89 * longer automatic in ENGINE_load_builtin_engines(). */ 91 * longer automatic in ENGINE_load_builtin_engines(). */
diff --git a/src/lib/libcrypto/evp/bio_b64.c b/src/lib/libcrypto/evp/bio_b64.c
index 82aaa8bf7a..abe266b604 100644
--- a/src/lib/libcrypto/evp/bio_b64.c
+++ b/src/lib/libcrypto/evp/bio_b64.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bio_b64.c,v 1.22 2018/08/24 19:47:25 tb Exp $ */ 1/* $OpenBSD: bio_b64.c,v 1.23 2021/12/12 21:30:13 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 *
@@ -63,6 +63,8 @@
63#include <openssl/buffer.h> 63#include <openssl/buffer.h>
64#include <openssl/evp.h> 64#include <openssl/evp.h>
65 65
66#include "evp_locl.h"
67
66static int b64_write(BIO *h, const char *buf, int num); 68static int b64_write(BIO *h, const char *buf, int num);
67static int b64_read(BIO *h, char *buf, int size); 69static int b64_read(BIO *h, char *buf, int size);
68static int b64_puts(BIO *h, const char *str); 70static int b64_puts(BIO *h, const char *str);
diff --git a/src/lib/libcrypto/evp/bio_enc.c b/src/lib/libcrypto/evp/bio_enc.c
index 33f611d178..de9267a0d5 100644
--- a/src/lib/libcrypto/evp/bio_enc.c
+++ b/src/lib/libcrypto/evp/bio_enc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bio_enc.c,v 1.23 2021/12/01 09:06:30 jsing Exp $ */ 1/* $OpenBSD: bio_enc.c,v 1.24 2021/12/12 21:30:13 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 *
@@ -63,6 +63,8 @@
63#include <openssl/buffer.h> 63#include <openssl/buffer.h>
64#include <openssl/evp.h> 64#include <openssl/evp.h>
65 65
66#include "evp_locl.h"
67
66static int enc_write(BIO *h, const char *buf, int num); 68static int enc_write(BIO *h, const char *buf, int num);
67static int enc_read(BIO *h, char *buf, int size); 69static int enc_read(BIO *h, char *buf, int size);
68/*static int enc_puts(BIO *h, const char *str); */ 70/*static int enc_puts(BIO *h, const char *str); */
diff --git a/src/lib/libcrypto/evp/bio_md.c b/src/lib/libcrypto/evp/bio_md.c
index 44f72185dc..e35510c17c 100644
--- a/src/lib/libcrypto/evp/bio_md.c
+++ b/src/lib/libcrypto/evp/bio_md.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bio_md.c,v 1.15 2018/05/02 15:51:41 tb Exp $ */ 1/* $OpenBSD: bio_md.c,v 1.16 2021/12/12 21:30:13 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 *
@@ -62,6 +62,8 @@
62#include <openssl/buffer.h> 62#include <openssl/buffer.h>
63#include <openssl/evp.h> 63#include <openssl/evp.h>
64 64
65#include "evp_locl.h"
66
65/* BIO_put and BIO_get both add to the digest, 67/* BIO_put and BIO_get both add to the digest,
66 * BIO_gets returns the digest */ 68 * BIO_gets returns the digest */
67 69
diff --git a/src/lib/libcrypto/evp/digest.c b/src/lib/libcrypto/evp/digest.c
index 4cd3565c65..59c98b57b8 100644
--- a/src/lib/libcrypto/evp/digest.c
+++ b/src/lib/libcrypto/evp/digest.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: digest.c,v 1.31 2019/04/19 17:04:45 jsing Exp $ */ 1/* $OpenBSD: digest.c,v 1.32 2021/12/12 21:30:13 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 *
@@ -122,6 +122,8 @@
122#include <openssl/engine.h> 122#include <openssl/engine.h>
123#endif 123#endif
124 124
125#include "evp_locl.h"
126
125int 127int
126EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type) 128EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
127{ 129{
diff --git a/src/lib/libcrypto/evp/e_aes_cbc_hmac_sha1.c b/src/lib/libcrypto/evp/e_aes_cbc_hmac_sha1.c
index 9be17e36f2..eef9c28096 100644
--- a/src/lib/libcrypto/evp/e_aes_cbc_hmac_sha1.c
+++ b/src/lib/libcrypto/evp/e_aes_cbc_hmac_sha1.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: e_aes_cbc_hmac_sha1.c,v 1.15 2019/04/03 15:33:37 tb Exp $ */ 1/* $OpenBSD: e_aes_cbc_hmac_sha1.c,v 1.16 2021/12/12 21:30:13 tb Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 2011-2013 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 2011-2013 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -59,8 +59,9 @@
59#include <openssl/objects.h> 59#include <openssl/objects.h>
60#include <openssl/aes.h> 60#include <openssl/aes.h>
61#include <openssl/sha.h> 61#include <openssl/sha.h>
62#include "evp_locl.h" 62
63#include "constant_time_locl.h" 63#include "constant_time_locl.h"
64#include "evp_locl.h"
64 65
65#define TLS1_1_VERSION 0x0302 66#define TLS1_1_VERSION 0x0302
66 67
diff --git a/src/lib/libcrypto/evp/e_camellia.c b/src/lib/libcrypto/evp/e_camellia.c
index fd12cf9c50..70dad7ead6 100644
--- a/src/lib/libcrypto/evp/e_camellia.c
+++ b/src/lib/libcrypto/evp/e_camellia.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: e_camellia.c,v 1.8 2017/01/29 17:49:23 beck Exp $ */ 1/* $OpenBSD: e_camellia.c,v 1.9 2021/12/12 21:30:13 tb Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 2006 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -61,6 +61,7 @@
61#include <openssl/evp.h> 61#include <openssl/evp.h>
62#include <openssl/err.h> 62#include <openssl/err.h>
63#include <openssl/camellia.h> 63#include <openssl/camellia.h>
64
64#include "evp_locl.h" 65#include "evp_locl.h"
65 66
66static int camellia_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, 67static int camellia_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
diff --git a/src/lib/libcrypto/evp/e_gost2814789.c b/src/lib/libcrypto/evp/e_gost2814789.c
index 730de4fed1..7803d9507b 100644
--- a/src/lib/libcrypto/evp/e_gost2814789.c
+++ b/src/lib/libcrypto/evp/e_gost2814789.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: e_gost2814789.c,v 1.4 2017/01/29 17:49:23 beck Exp $ */ 1/* $OpenBSD: e_gost2814789.c,v 1.5 2021/12/12 21:30:13 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> 3 * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
4 * Copyright (c) 2005-2006 Cryptocom LTD 4 * Copyright (c) 2005-2006 Cryptocom LTD
@@ -48,6 +48,7 @@
48 * OF THE POSSIBILITY OF SUCH DAMAGE. 48 * OF THE POSSIBILITY OF SUCH DAMAGE.
49 * ==================================================================== 49 * ====================================================================
50 */ 50 */
51
51#include <string.h> 52#include <string.h>
52 53
53#include <openssl/opensslconf.h> 54#include <openssl/opensslconf.h>
@@ -56,6 +57,7 @@
56#include <openssl/evp.h> 57#include <openssl/evp.h>
57#include <openssl/err.h> 58#include <openssl/err.h>
58#include <openssl/gost.h> 59#include <openssl/gost.h>
60
59#include "evp_locl.h" 61#include "evp_locl.h"
60 62
61typedef struct { 63typedef struct {
diff --git a/src/lib/libcrypto/evp/e_null.c b/src/lib/libcrypto/evp/e_null.c
index 65374cc3f5..db79e1ec5f 100644
--- a/src/lib/libcrypto/evp/e_null.c
+++ b/src/lib/libcrypto/evp/e_null.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: e_null.c,v 1.14 2014/07/11 08:44:48 jsing Exp $ */ 1/* $OpenBSD: e_null.c,v 1.15 2021/12/12 21:30:13 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 *
@@ -62,6 +62,8 @@
62#include <openssl/evp.h> 62#include <openssl/evp.h>
63#include <openssl/objects.h> 63#include <openssl/objects.h>
64 64
65#include "evp_locl.h"
66
65static int null_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, 67static int null_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
66 const unsigned char *iv, int enc); 68 const unsigned char *iv, int enc);
67static int null_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, 69static int null_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
diff --git a/src/lib/libcrypto/evp/e_rc4_hmac_md5.c b/src/lib/libcrypto/evp/e_rc4_hmac_md5.c
index ac73361fa3..b8a6b4492e 100644
--- a/src/lib/libcrypto/evp/e_rc4_hmac_md5.c
+++ b/src/lib/libcrypto/evp/e_rc4_hmac_md5.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: e_rc4_hmac_md5.c,v 1.8 2017/01/31 13:17:21 inoguchi Exp $ */ 1/* $OpenBSD: e_rc4_hmac_md5.c,v 1.9 2021/12/12 21:30:13 tb Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 2011 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 2011 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -60,6 +60,8 @@
60#include <openssl/rc4.h> 60#include <openssl/rc4.h>
61#include <openssl/md5.h> 61#include <openssl/md5.h>
62 62
63#include "evp_locl.h"
64
63/* FIXME: surely this is available elsewhere? */ 65/* FIXME: surely this is available elsewhere? */
64#define EVP_RC4_KEY_SIZE 16 66#define EVP_RC4_KEY_SIZE 16
65 67
diff --git a/src/lib/libcrypto/evp/encode.c b/src/lib/libcrypto/evp/encode.c
index 2f942a032f..30fcd858cf 100644
--- a/src/lib/libcrypto/evp/encode.c
+++ b/src/lib/libcrypto/evp/encode.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: encode.c,v 1.28 2020/03/04 11:53:21 inoguchi Exp $ */ 1/* $OpenBSD: encode.c,v 1.29 2021/12/12 21:30:13 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 *
@@ -62,6 +62,8 @@
62 62
63#include <openssl/evp.h> 63#include <openssl/evp.h>
64 64
65#include "evp_locl.h"
66
65static unsigned char conv_ascii2bin(unsigned char a); 67static unsigned char conv_ascii2bin(unsigned char a);
66#define conv_bin2ascii(a) (data_bin2ascii[(a)&0x3f]) 68#define conv_bin2ascii(a) (data_bin2ascii[(a)&0x3f])
67 69
diff --git a/src/lib/libcrypto/evp/evp_key.c b/src/lib/libcrypto/evp/evp_key.c
index 91d0fc0de9..dcfb94e301 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.26 2018/08/14 17:59:26 tb Exp $ */ 1/* $OpenBSD: evp_key.c,v 1.27 2021/12/12 21:30:13 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 *
@@ -65,6 +65,8 @@
65#include <openssl/ui.h> 65#include <openssl/ui.h>
66#include <openssl/x509.h> 66#include <openssl/x509.h>
67 67
68#include "evp_locl.h"
69
68/* should be init to zeros. */ 70/* should be init to zeros. */
69static char prompt_string[80]; 71static char prompt_string[80];
70 72
diff --git a/src/lib/libcrypto/evp/evp_lib.c b/src/lib/libcrypto/evp/evp_lib.c
index 83b81bd429..f2ff7bdec5 100644
--- a/src/lib/libcrypto/evp/evp_lib.c
+++ b/src/lib/libcrypto/evp/evp_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: evp_lib.c,v 1.18 2021/10/24 13:51:07 tb Exp $ */ 1/* $OpenBSD: evp_lib.c,v 1.19 2021/12/12 21:30:13 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 *
@@ -63,6 +63,8 @@
63#include <openssl/evp.h> 63#include <openssl/evp.h>
64#include <openssl/objects.h> 64#include <openssl/objects.h>
65 65
66#include "evp_locl.h"
67
66int 68int
67EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type) 69EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type)
68{ 70{
diff --git a/src/lib/libcrypto/evp/evp_pkey.c b/src/lib/libcrypto/evp/evp_pkey.c
index 9ff544b84a..3ba0e1dd51 100644
--- a/src/lib/libcrypto/evp/evp_pkey.c
+++ b/src/lib/libcrypto/evp/evp_pkey.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: evp_pkey.c,v 1.23 2018/08/24 20:26:03 tb Exp $ */ 1/* $OpenBSD: evp_pkey.c,v 1.24 2021/12/12 21:30:13 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 */
@@ -63,6 +63,7 @@
63#include <openssl/x509.h> 63#include <openssl/x509.h>
64 64
65#include "asn1_locl.h" 65#include "asn1_locl.h"
66#include "evp_locl.h"
66 67
67/* Extract a private key from a PKCS8 structure */ 68/* Extract a private key from a PKCS8 structure */
68 69
diff --git a/src/lib/libcrypto/evp/m_dss.c b/src/lib/libcrypto/evp/m_dss.c
index d23c9b4e71..45f09dde5d 100644
--- a/src/lib/libcrypto/evp/m_dss.c
+++ b/src/lib/libcrypto/evp/m_dss.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: m_dss.c,v 1.16 2014/07/11 08:44:48 jsing Exp $ */ 1/* $OpenBSD: m_dss.c,v 1.17 2021/12/12 21:30:13 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 *
@@ -68,6 +68,8 @@
68#include <openssl/dsa.h> 68#include <openssl/dsa.h>
69#endif 69#endif
70 70
71#include "evp_locl.h"
72
71#ifndef OPENSSL_NO_SHA 73#ifndef OPENSSL_NO_SHA
72 74
73static int 75static int
diff --git a/src/lib/libcrypto/evp/m_dss1.c b/src/lib/libcrypto/evp/m_dss1.c
index a906c11b69..283672cc1e 100644
--- a/src/lib/libcrypto/evp/m_dss1.c
+++ b/src/lib/libcrypto/evp/m_dss1.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: m_dss1.c,v 1.16 2014/07/11 08:44:48 jsing Exp $ */ 1/* $OpenBSD: m_dss1.c,v 1.17 2021/12/12 21:30:13 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 *
@@ -70,6 +70,8 @@
70#include <openssl/dsa.h> 70#include <openssl/dsa.h>
71#endif 71#endif
72 72
73#include "evp_locl.h"
74
73static int 75static int
74init(EVP_MD_CTX *ctx) 76init(EVP_MD_CTX *ctx)
75{ 77{
diff --git a/src/lib/libcrypto/evp/m_ecdsa.c b/src/lib/libcrypto/evp/m_ecdsa.c
index b9af6423b5..b4bd21f7b0 100644
--- a/src/lib/libcrypto/evp/m_ecdsa.c
+++ b/src/lib/libcrypto/evp/m_ecdsa.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: m_ecdsa.c,v 1.8 2014/07/11 08:44:48 jsing Exp $ */ 1/* $OpenBSD: m_ecdsa.c,v 1.9 2021/12/12 21:30:13 tb Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -117,6 +117,8 @@
117#include <openssl/objects.h> 117#include <openssl/objects.h>
118#include <openssl/x509.h> 118#include <openssl/x509.h>
119 119
120#include "evp_locl.h"
121
120#ifndef OPENSSL_NO_SHA 122#ifndef OPENSSL_NO_SHA
121 123
122static int 124static int
diff --git a/src/lib/libcrypto/evp/m_gost2814789.c b/src/lib/libcrypto/evp/m_gost2814789.c
index 279af872e0..7d11ec8c89 100644
--- a/src/lib/libcrypto/evp/m_gost2814789.c
+++ b/src/lib/libcrypto/evp/m_gost2814789.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: m_gost2814789.c,v 1.2 2014/11/09 23:06:50 miod Exp $ */ 1/* $OpenBSD: m_gost2814789.c,v 1.3 2021/12/12 21:30:13 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> 3 * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
4 * Copyright (c) 2005-2006 Cryptocom LTD 4 * Copyright (c) 2005-2006 Cryptocom LTD
@@ -48,6 +48,7 @@
48 * OF THE POSSIBILITY OF SUCH DAMAGE. 48 * OF THE POSSIBILITY OF SUCH DAMAGE.
49 * ==================================================================== 49 * ====================================================================
50 */ 50 */
51
51#include <openssl/opensslconf.h> 52#include <openssl/opensslconf.h>
52 53
53#ifndef OPENSSL_NO_GOST 54#ifndef OPENSSL_NO_GOST
@@ -56,6 +57,8 @@
56#include <openssl/gost.h> 57#include <openssl/gost.h>
57#include <openssl/objects.h> 58#include <openssl/objects.h>
58 59
60#include "evp_locl.h"
61
59static int 62static int
60gost2814789_init(EVP_MD_CTX *ctx) 63gost2814789_init(EVP_MD_CTX *ctx)
61{ 64{
diff --git a/src/lib/libcrypto/evp/m_gostr341194.c b/src/lib/libcrypto/evp/m_gostr341194.c
index 66d9b4f303..40de232344 100644
--- a/src/lib/libcrypto/evp/m_gostr341194.c
+++ b/src/lib/libcrypto/evp/m_gostr341194.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: m_gostr341194.c,v 1.2 2014/11/09 23:06:50 miod Exp $ */ 1/* $OpenBSD: m_gostr341194.c,v 1.3 2021/12/12 21:30:13 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> 3 * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
4 * Copyright (c) 2005-2006 Cryptocom LTD 4 * Copyright (c) 2005-2006 Cryptocom LTD
@@ -48,6 +48,7 @@
48 * OF THE POSSIBILITY OF SUCH DAMAGE. 48 * OF THE POSSIBILITY OF SUCH DAMAGE.
49 * ==================================================================== 49 * ====================================================================
50 */ 50 */
51
51#include <stdio.h> 52#include <stdio.h>
52 53
53#include <openssl/opensslconf.h> 54#include <openssl/opensslconf.h>
@@ -58,6 +59,8 @@
58#include <openssl/gost.h> 59#include <openssl/gost.h>
59#include <openssl/objects.h> 60#include <openssl/objects.h>
60 61
62#include "evp_locl.h"
63
61static int 64static int
62gostr341194_init(EVP_MD_CTX *ctx) 65gostr341194_init(EVP_MD_CTX *ctx)
63{ 66{
diff --git a/src/lib/libcrypto/evp/m_md4.c b/src/lib/libcrypto/evp/m_md4.c
index ab3cc852be..5729807986 100644
--- a/src/lib/libcrypto/evp/m_md4.c
+++ b/src/lib/libcrypto/evp/m_md4.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: m_md4.c,v 1.16 2015/09/14 01:45:03 doug Exp $ */ 1/* $OpenBSD: m_md4.c,v 1.17 2021/12/12 21:30:13 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 *
@@ -71,6 +71,8 @@
71#include <openssl/rsa.h> 71#include <openssl/rsa.h>
72#endif 72#endif
73 73
74#include "evp_locl.h"
75
74static int 76static int
75init(EVP_MD_CTX *ctx) 77init(EVP_MD_CTX *ctx)
76{ 78{
diff --git a/src/lib/libcrypto/evp/m_md5.c b/src/lib/libcrypto/evp/m_md5.c
index 36cff7ab51..dbdc567616 100644
--- a/src/lib/libcrypto/evp/m_md5.c
+++ b/src/lib/libcrypto/evp/m_md5.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: m_md5.c,v 1.15 2014/07/13 09:30:02 miod Exp $ */ 1/* $OpenBSD: m_md5.c,v 1.16 2021/12/12 21:30:13 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 *
@@ -71,6 +71,8 @@
71#include <openssl/rsa.h> 71#include <openssl/rsa.h>
72#endif 72#endif
73 73
74#include "evp_locl.h"
75
74static int 76static int
75init(EVP_MD_CTX *ctx) 77init(EVP_MD_CTX *ctx)
76{ 78{
diff --git a/src/lib/libcrypto/evp/m_md5_sha1.c b/src/lib/libcrypto/evp/m_md5_sha1.c
index 4e8a0c32f6..aaddbe9c81 100644
--- a/src/lib/libcrypto/evp/m_md5_sha1.c
+++ b/src/lib/libcrypto/evp/m_md5_sha1.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: m_md5_sha1.c,v 1.2 2018/08/10 17:30:29 jsing Exp $ */ 1/* $OpenBSD: m_md5_sha1.c,v 1.3 2021/12/12 21:30:13 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2017 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2017 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -24,6 +24,8 @@
24#include <openssl/rsa.h> 24#include <openssl/rsa.h>
25#endif 25#endif
26 26
27#include "evp_locl.h"
28
27struct md5_sha1_ctx { 29struct md5_sha1_ctx {
28 MD5_CTX md5; 30 MD5_CTX md5;
29 SHA_CTX sha1; 31 SHA_CTX sha1;
diff --git a/src/lib/libcrypto/evp/m_null.c b/src/lib/libcrypto/evp/m_null.c
index 897be3cee9..86f5a08688 100644
--- a/src/lib/libcrypto/evp/m_null.c
+++ b/src/lib/libcrypto/evp/m_null.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: m_null.c,v 1.9 2014/07/11 08:44:48 jsing Exp $ */ 1/* $OpenBSD: m_null.c,v 1.10 2021/12/12 21:30:13 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 *
@@ -62,6 +62,8 @@
62#include <openssl/objects.h> 62#include <openssl/objects.h>
63#include <openssl/x509.h> 63#include <openssl/x509.h>
64 64
65#include "evp_locl.h"
66
65static int 67static int
66init(EVP_MD_CTX *ctx) 68init(EVP_MD_CTX *ctx)
67{ 69{
diff --git a/src/lib/libcrypto/evp/m_ripemd.c b/src/lib/libcrypto/evp/m_ripemd.c
index be7f1393b0..b3369ab53f 100644
--- a/src/lib/libcrypto/evp/m_ripemd.c
+++ b/src/lib/libcrypto/evp/m_ripemd.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: m_ripemd.c,v 1.12 2014/07/13 09:30:02 miod Exp $ */ 1/* $OpenBSD: m_ripemd.c,v 1.13 2021/12/12 21:30:13 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 *
@@ -71,6 +71,8 @@
71#include <openssl/rsa.h> 71#include <openssl/rsa.h>
72#endif 72#endif
73 73
74#include "evp_locl.h"
75
74static int 76static int
75init(EVP_MD_CTX *ctx) 77init(EVP_MD_CTX *ctx)
76{ 78{
diff --git a/src/lib/libcrypto/evp/m_sha1.c b/src/lib/libcrypto/evp/m_sha1.c
index 13d5b030d2..396f00aa13 100644
--- a/src/lib/libcrypto/evp/m_sha1.c
+++ b/src/lib/libcrypto/evp/m_sha1.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: m_sha1.c,v 1.17 2014/07/11 08:44:48 jsing Exp $ */ 1/* $OpenBSD: m_sha1.c,v 1.18 2021/12/12 21:30:13 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 *
@@ -70,6 +70,8 @@
70#include <openssl/rsa.h> 70#include <openssl/rsa.h>
71#endif 71#endif
72 72
73#include "evp_locl.h"
74
73static int 75static int
74init(EVP_MD_CTX *ctx) 76init(EVP_MD_CTX *ctx)
75{ 77{
diff --git a/src/lib/libcrypto/evp/m_sm3.c b/src/lib/libcrypto/evp/m_sm3.c
index 66582b8e4a..614be5d780 100644
--- a/src/lib/libcrypto/evp/m_sm3.c
+++ b/src/lib/libcrypto/evp/m_sm3.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: m_sm3.c,v 1.1 2018/11/11 06:53:31 tb Exp $ */ 1/* $OpenBSD: m_sm3.c,v 1.2 2021/12/12 21:30:13 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2018, Ribose Inc 3 * Copyright (c) 2018, Ribose Inc
4 * 4 *
@@ -25,6 +25,8 @@
25#include <openssl/rsa.h> 25#include <openssl/rsa.h>
26#endif 26#endif
27 27
28#include "evp_locl.h"
29
28static int 30static int
29sm3_init(EVP_MD_CTX *ctx) 31sm3_init(EVP_MD_CTX *ctx)
30{ 32{
diff --git a/src/lib/libcrypto/evp/m_streebog.c b/src/lib/libcrypto/evp/m_streebog.c
index 882c7852bb..cd6c312b02 100644
--- a/src/lib/libcrypto/evp/m_streebog.c
+++ b/src/lib/libcrypto/evp/m_streebog.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: m_streebog.c,v 1.2 2014/11/09 23:06:50 miod Exp $ */ 1/* $OpenBSD: m_streebog.c,v 1.3 2021/12/12 21:30:13 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> 3 * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
4 * Copyright (c) 2005-2006 Cryptocom LTD 4 * Copyright (c) 2005-2006 Cryptocom LTD
@@ -57,6 +57,8 @@
57#include <openssl/gost.h> 57#include <openssl/gost.h>
58#include <openssl/objects.h> 58#include <openssl/objects.h>
59 59
60#include "evp_locl.h"
61
60static int 62static int
61streebog_init256(EVP_MD_CTX *ctx) 63streebog_init256(EVP_MD_CTX *ctx)
62{ 64{
diff --git a/src/lib/libcrypto/evp/m_wp.c b/src/lib/libcrypto/evp/m_wp.c
index 3f543ac0af..dd777565cf 100644
--- a/src/lib/libcrypto/evp/m_wp.c
+++ b/src/lib/libcrypto/evp/m_wp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: m_wp.c,v 1.8 2014/07/13 09:30:02 miod Exp $ */ 1/* $OpenBSD: m_wp.c,v 1.9 2021/12/12 21:30:13 tb Exp $ */
2 2
3#include <stdio.h> 3#include <stdio.h>
4 4
@@ -11,6 +11,8 @@
11#include <openssl/x509.h> 11#include <openssl/x509.h>
12#include <openssl/whrlpool.h> 12#include <openssl/whrlpool.h>
13 13
14#include "evp_locl.h"
15
14static int 16static int
15init(EVP_MD_CTX *ctx) 17init(EVP_MD_CTX *ctx)
16{ 18{
diff --git a/src/lib/libcrypto/evp/names.c b/src/lib/libcrypto/evp/names.c
index dfcf9ee225..02529eef6c 100644
--- a/src/lib/libcrypto/evp/names.c
+++ b/src/lib/libcrypto/evp/names.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: names.c,v 1.14 2018/03/17 16:20:01 beck Exp $ */ 1/* $OpenBSD: names.c,v 1.15 2021/12/12 21:30:13 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 *
@@ -62,6 +62,8 @@
62#include <openssl/objects.h> 62#include <openssl/objects.h>
63#include <openssl/x509.h> 63#include <openssl/x509.h>
64 64
65#include "evp_locl.h"
66
65int 67int
66EVP_add_cipher(const EVP_CIPHER *c) 68EVP_add_cipher(const EVP_CIPHER *c)
67{ 69{
diff --git a/src/lib/libcrypto/evp/p5_crpt.c b/src/lib/libcrypto/evp/p5_crpt.c
index 98e4549db1..b9482e0864 100644
--- a/src/lib/libcrypto/evp/p5_crpt.c
+++ b/src/lib/libcrypto/evp/p5_crpt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p5_crpt.c,v 1.19 2020/01/12 07:11:13 inoguchi Exp $ */ 1/* $OpenBSD: p5_crpt.c,v 1.20 2021/12/12 21:30:13 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 */
@@ -64,6 +64,8 @@
64#include <openssl/evp.h> 64#include <openssl/evp.h>
65#include <openssl/x509.h> 65#include <openssl/x509.h>
66 66
67#include "evp_locl.h"
68
67/* Doesn't do anything now: Builtin PBE algorithms in static table. 69/* Doesn't do anything now: Builtin PBE algorithms in static table.
68 */ 70 */
69 71
diff --git a/src/lib/libcrypto/evp/p_dec.c b/src/lib/libcrypto/evp/p_dec.c
index c827c5e4c2..c19cc651b3 100644
--- a/src/lib/libcrypto/evp/p_dec.c
+++ b/src/lib/libcrypto/evp/p_dec.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p_dec.c,v 1.11 2017/01/29 17:49:23 beck Exp $ */ 1/* $OpenBSD: p_dec.c,v 1.12 2021/12/12 21:30:13 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 *
@@ -69,6 +69,8 @@
69#include <openssl/rsa.h> 69#include <openssl/rsa.h>
70#endif 70#endif
71 71
72#include "evp_locl.h"
73
72int 74int
73EVP_PKEY_decrypt_old(unsigned char *key, const unsigned char *ek, int ekl, 75EVP_PKEY_decrypt_old(unsigned char *key, const unsigned char *ek, int ekl,
74 EVP_PKEY *priv) 76 EVP_PKEY *priv)
diff --git a/src/lib/libcrypto/evp/p_enc.c b/src/lib/libcrypto/evp/p_enc.c
index 49c46f1a70..5553429c50 100644
--- a/src/lib/libcrypto/evp/p_enc.c
+++ b/src/lib/libcrypto/evp/p_enc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p_enc.c,v 1.11 2017/01/29 17:49:23 beck Exp $ */ 1/* $OpenBSD: p_enc.c,v 1.12 2021/12/12 21:30:13 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 *
@@ -69,6 +69,8 @@
69#include <openssl/rsa.h> 69#include <openssl/rsa.h>
70#endif 70#endif
71 71
72#include "evp_locl.h"
73
72int 74int
73EVP_PKEY_encrypt_old(unsigned char *ek, const unsigned char *key, int key_len, 75EVP_PKEY_encrypt_old(unsigned char *ek, const unsigned char *key, int key_len,
74 EVP_PKEY *pubk) 76 EVP_PKEY *pubk)
diff --git a/src/lib/libcrypto/evp/p_lib.c b/src/lib/libcrypto/evp/p_lib.c
index 9577b10ea1..89ce4c451a 100644
--- a/src/lib/libcrypto/evp/p_lib.c
+++ b/src/lib/libcrypto/evp/p_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p_lib.c,v 1.26 2021/03/29 15:57:23 tb Exp $ */ 1/* $OpenBSD: p_lib.c,v 1.27 2021/12/12 21:30:13 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 *
@@ -82,6 +82,7 @@
82#endif 82#endif
83 83
84#include "asn1_locl.h" 84#include "asn1_locl.h"
85#include "evp_locl.h"
85 86
86static void EVP_PKEY_free_it(EVP_PKEY *x); 87static void EVP_PKEY_free_it(EVP_PKEY *x);
87 88
diff --git a/src/lib/libcrypto/evp/p_open.c b/src/lib/libcrypto/evp/p_open.c
index 57a46706b9..e4c59e68db 100644
--- a/src/lib/libcrypto/evp/p_open.c
+++ b/src/lib/libcrypto/evp/p_open.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p_open.c,v 1.19 2017/05/02 03:59:44 deraadt Exp $ */ 1/* $OpenBSD: p_open.c,v 1.20 2021/12/12 21:30:13 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 *
@@ -69,6 +69,8 @@
69#include <openssl/rsa.h> 69#include <openssl/rsa.h>
70#include <openssl/x509.h> 70#include <openssl/x509.h>
71 71
72#include "evp_locl.h"
73
72int 74int
73EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, 75EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,
74 const unsigned char *ek, int ekl, const unsigned char *iv, EVP_PKEY *priv) 76 const unsigned char *ek, int ekl, const unsigned char *iv, EVP_PKEY *priv)
diff --git a/src/lib/libcrypto/evp/p_sign.c b/src/lib/libcrypto/evp/p_sign.c
index 6312924518..34dafd87fe 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.14 2017/01/29 17:49:23 beck Exp $ */ 1/* $OpenBSD: p_sign.c,v 1.15 2021/12/12 21:30:13 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 *
@@ -63,6 +63,8 @@
63#include <openssl/objects.h> 63#include <openssl/objects.h>
64#include <openssl/x509.h> 64#include <openssl/x509.h>
65 65
66#include "evp_locl.h"
67
66int 68int
67EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, unsigned int *siglen, 69EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, unsigned int *siglen,
68 EVP_PKEY *pkey) 70 EVP_PKEY *pkey)
diff --git a/src/lib/libcrypto/evp/p_verify.c b/src/lib/libcrypto/evp/p_verify.c
index 7dd752c4fb..6ecdef0787 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.13 2017/01/29 17:49:23 beck Exp $ */ 1/* $OpenBSD: p_verify.c,v 1.14 2021/12/12 21:30:13 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 *
@@ -63,6 +63,8 @@
63#include <openssl/objects.h> 63#include <openssl/objects.h>
64#include <openssl/x509.h> 64#include <openssl/x509.h>
65 65
66#include "evp_locl.h"
67
66int 68int
67EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf, 69EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf,
68 unsigned int siglen, EVP_PKEY *pkey) 70 unsigned int siglen, EVP_PKEY *pkey)
diff --git a/src/lib/libcrypto/gost/gost89imit_ameth.c b/src/lib/libcrypto/gost/gost89imit_ameth.c
index a2631d97f8..3fdfa3eef2 100644
--- a/src/lib/libcrypto/gost/gost89imit_ameth.c
+++ b/src/lib/libcrypto/gost/gost89imit_ameth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: gost89imit_ameth.c,v 1.2 2014/11/09 23:06:52 miod Exp $ */ 1/* $OpenBSD: gost89imit_ameth.c,v 1.3 2021/12/12 21:30:14 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> 3 * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
4 * Copyright (c) 2005-2006 Cryptocom LTD 4 * Copyright (c) 2005-2006 Cryptocom LTD
@@ -55,6 +55,7 @@
55#include <openssl/evp.h> 55#include <openssl/evp.h>
56 56
57#include "asn1_locl.h" 57#include "asn1_locl.h"
58#include "evp_locl.h"
58 59
59static void 60static void
60mackey_free_gost(EVP_PKEY *pk) 61mackey_free_gost(EVP_PKEY *pk)
diff --git a/src/lib/libcrypto/gost/gostr341001_ameth.c b/src/lib/libcrypto/gost/gostr341001_ameth.c
index 294b654d4f..d4c3d8a9c7 100644
--- a/src/lib/libcrypto/gost/gostr341001_ameth.c
+++ b/src/lib/libcrypto/gost/gostr341001_ameth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: gostr341001_ameth.c,v 1.17 2021/04/20 17:16:38 tb Exp $ */ 1/* $OpenBSD: gostr341001_ameth.c,v 1.18 2021/12/12 21:30:14 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> 3 * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
4 * Copyright (c) 2005-2006 Cryptocom LTD 4 * Copyright (c) 2005-2006 Cryptocom LTD
@@ -63,6 +63,7 @@
63 63
64 64
65#include "asn1_locl.h" 65#include "asn1_locl.h"
66#include "evp_locl.h"
66#include "gost_locl.h" 67#include "gost_locl.h"
67#include "gost_asn1.h" 68#include "gost_asn1.h"
68 69
diff --git a/src/lib/libcrypto/hkdf/hkdf.c b/src/lib/libcrypto/hkdf/hkdf.c
index f33ba79891..9adf12608c 100644
--- a/src/lib/libcrypto/hkdf/hkdf.c
+++ b/src/lib/libcrypto/hkdf/hkdf.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: hkdf.c,v 1.6 2021/12/12 21:27:37 tb Exp $ */ 1/* $OpenBSD: hkdf.c,v 1.7 2021/12/12 21:30:14 tb Exp $ */
2/* Copyright (c) 2014, Google Inc. 2/* Copyright (c) 2014, Google Inc.
3 * 3 *
4 * Permission to use, copy, modify, and/or distribute this software for any 4 * Permission to use, copy, modify, and/or distribute this software for any
@@ -21,6 +21,7 @@
21#include <openssl/err.h> 21#include <openssl/err.h>
22#include <openssl/hmac.h> 22#include <openssl/hmac.h>
23 23
24#include "evp_locl.h"
24#include "hmac_local.h" 25#include "hmac_local.h"
25 26
26/* https://tools.ietf.org/html/rfc5869#section-2 */ 27/* https://tools.ietf.org/html/rfc5869#section-2 */
diff --git a/src/lib/libcrypto/hmac/hm_ameth.c b/src/lib/libcrypto/hmac/hm_ameth.c
index ebbcab5ac2..84bb5f0c07 100644
--- a/src/lib/libcrypto/hmac/hm_ameth.c
+++ b/src/lib/libcrypto/hmac/hm_ameth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: hm_ameth.c,v 1.11 2021/12/12 21:27:38 tb Exp $ */ 1/* $OpenBSD: hm_ameth.c,v 1.12 2021/12/12 21:30:14 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 2007. 3 * project 2007.
4 */ 4 */
@@ -63,6 +63,7 @@
63#include <openssl/hmac.h> 63#include <openssl/hmac.h>
64 64
65#include "asn1_locl.h" 65#include "asn1_locl.h"
66#include "evp_locl.h"
66#include "hmac_local.h" 67#include "hmac_local.h"
67 68
68#define HMAC_TEST_PRIVATE_KEY_FORMAT 69#define HMAC_TEST_PRIVATE_KEY_FORMAT
diff --git a/src/lib/libcrypto/hmac/hmac.c b/src/lib/libcrypto/hmac/hmac.c
index a3eb7666e9..55989988ad 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.26 2021/12/12 21:27:38 tb Exp $ */ 1/* $OpenBSD: hmac.c,v 1.27 2021/12/12 21:30:14 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 *
@@ -63,6 +63,7 @@
63#include <openssl/err.h> 63#include <openssl/err.h>
64#include <openssl/hmac.h> 64#include <openssl/hmac.h>
65 65
66#include "evp_locl.h"
66#include "hmac_local.h" 67#include "hmac_local.h"
67 68
68int 69int
diff --git a/src/lib/libcrypto/pem/pem_info.c b/src/lib/libcrypto/pem/pem_info.c
index 33c1de43fd..aecdbb2e05 100644
--- a/src/lib/libcrypto/pem/pem_info.c
+++ b/src/lib/libcrypto/pem/pem_info.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pem_info.c,v 1.24 2020/07/25 11:53:37 schwarze Exp $ */ 1/* $OpenBSD: pem_info.c,v 1.25 2021/12/12 21:30:14 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,6 +75,8 @@
75#include <openssl/rsa.h> 75#include <openssl/rsa.h>
76#endif 76#endif
77 77
78#include "evp_locl.h"
79
78STACK_OF(X509_INFO) * 80STACK_OF(X509_INFO) *
79PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, 81PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb,
80 void *u) 82 void *u)
diff --git a/src/lib/libcrypto/pem/pem_lib.c b/src/lib/libcrypto/pem/pem_lib.c
index f0126790e9..7b7f81092e 100644
--- a/src/lib/libcrypto/pem/pem_lib.c
+++ b/src/lib/libcrypto/pem/pem_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pem_lib.c,v 1.49 2019/09/06 17:41:05 jsing Exp $ */ 1/* $OpenBSD: pem_lib.c,v 1.50 2021/12/12 21:30:14 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 *
@@ -79,6 +79,7 @@
79#endif 79#endif
80 80
81#include "asn1_locl.h" 81#include "asn1_locl.h"
82#include "evp_locl.h"
82 83
83#define MIN_LENGTH 4 84#define MIN_LENGTH 4
84 85
diff --git a/src/lib/libcrypto/pem/pem_pkey.c b/src/lib/libcrypto/pem/pem_pkey.c
index 89181a25f7..8f4fba2f8e 100644
--- a/src/lib/libcrypto/pem/pem_pkey.c
+++ b/src/lib/libcrypto/pem/pem_pkey.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pem_pkey.c,v 1.23 2017/05/02 03:59:44 deraadt Exp $ */ 1/* $OpenBSD: pem_pkey.c,v 1.24 2021/12/12 21:30:14 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 *
@@ -74,6 +74,7 @@
74#endif 74#endif
75 75
76#include "asn1_locl.h" 76#include "asn1_locl.h"
77#include "evp_locl.h"
77 78
78int pem_check_suffix(const char *pem_str, const char *suffix); 79int pem_check_suffix(const char *pem_str, const char *suffix);
79 80
diff --git a/src/lib/libcrypto/pem/pvkfmt.c b/src/lib/libcrypto/pem/pvkfmt.c
index abb7f7eec9..9d758ab289 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.22 2019/07/08 11:56:18 inoguchi Exp $ */ 1/* $OpenBSD: pvkfmt.c,v 1.23 2021/12/12 21:30:14 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 */
@@ -74,6 +74,7 @@
74#include <openssl/rsa.h> 74#include <openssl/rsa.h>
75 75
76#include "bn_lcl.h" 76#include "bn_lcl.h"
77#include "evp_locl.h"
77 78
78/* Utility function: read a DWORD (4 byte unsigned integer) in little endian 79/* Utility function: read a DWORD (4 byte unsigned integer) in little endian
79 * format 80 * format
diff --git a/src/lib/libcrypto/pkcs12/p12_decr.c b/src/lib/libcrypto/pkcs12/p12_decr.c
index 8ac7f17cfc..c352ba565c 100644
--- a/src/lib/libcrypto/pkcs12/p12_decr.c
+++ b/src/lib/libcrypto/pkcs12/p12_decr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p12_decr.c,v 1.20 2021/07/09 14:08:00 tb Exp $ */ 1/* $OpenBSD: p12_decr.c,v 1.21 2021/12/12 21:30:14 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 */
@@ -62,6 +62,8 @@
62#include <openssl/err.h> 62#include <openssl/err.h>
63#include <openssl/pkcs12.h> 63#include <openssl/pkcs12.h>
64 64
65#include "evp_locl.h"
66
65/* Encrypt/Decrypt a buffer based on password and algor, result in a 67/* Encrypt/Decrypt a buffer based on password and algor, result in a
66 * malloc'ed buffer 68 * malloc'ed buffer
67 */ 69 */
diff --git a/src/lib/libcrypto/pkcs12/p12_key.c b/src/lib/libcrypto/pkcs12/p12_key.c
index 2887948144..38d25d2f6b 100644
--- a/src/lib/libcrypto/pkcs12/p12_key.c
+++ b/src/lib/libcrypto/pkcs12/p12_key.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p12_key.c,v 1.27 2021/07/09 14:08:00 tb Exp $ */ 1/* $OpenBSD: p12_key.c,v 1.28 2021/12/12 21:30:14 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 */
@@ -63,6 +63,8 @@
63#include <openssl/err.h> 63#include <openssl/err.h>
64#include <openssl/pkcs12.h> 64#include <openssl/pkcs12.h>
65 65
66#include "evp_locl.h"
67
66/* PKCS12 compatible key/IV generation */ 68/* PKCS12 compatible key/IV generation */
67#ifndef min 69#ifndef min
68#define min(a,b) ((a) < (b) ? (a) : (b)) 70#define min(a,b) ((a) < (b) ? (a) : (b))
diff --git a/src/lib/libcrypto/pkcs12/p12_mutl.c b/src/lib/libcrypto/pkcs12/p12_mutl.c
index aa363747b3..f3a6ea3ba3 100644
--- a/src/lib/libcrypto/pkcs12/p12_mutl.c
+++ b/src/lib/libcrypto/pkcs12/p12_mutl.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p12_mutl.c,v 1.26 2021/12/12 21:27:38 tb Exp $ */ 1/* $OpenBSD: p12_mutl.c,v 1.27 2021/12/12 21:30:14 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 */
@@ -68,6 +68,7 @@
68#include <openssl/hmac.h> 68#include <openssl/hmac.h>
69#include <openssl/pkcs12.h> 69#include <openssl/pkcs12.h>
70 70
71#include "evp_locl.h"
71#include "hmac_local.h" 72#include "hmac_local.h"
72#include "x509_lcl.h" 73#include "x509_lcl.h"
73 74
diff --git a/src/lib/libcrypto/pkcs7/pk7_doit.c b/src/lib/libcrypto/pkcs7/pk7_doit.c
index 6d921e5cff..c9d64bcf34 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.45 2021/11/01 20:53:08 tb Exp $ */ 1/* $OpenBSD: pk7_doit.c,v 1.46 2021/12/12 21:30:14 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 *
@@ -65,6 +65,7 @@
65#include <openssl/x509.h> 65#include <openssl/x509.h>
66#include <openssl/x509v3.h> 66#include <openssl/x509v3.h>
67 67
68#include "evp_locl.h"
68#include "x509_lcl.h" 69#include "x509_lcl.h"
69 70
70static int add_attribute(STACK_OF(X509_ATTRIBUTE) **sk, int nid, int atrtype, 71static int add_attribute(STACK_OF(X509_ATTRIBUTE) **sk, int nid, int atrtype,
diff --git a/src/lib/libcrypto/pkcs7/pk7_lib.c b/src/lib/libcrypto/pkcs7/pk7_lib.c
index 24cb0fe4c6..7e92df1e9f 100644
--- a/src/lib/libcrypto/pkcs7/pk7_lib.c
+++ b/src/lib/libcrypto/pkcs7/pk7_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pk7_lib.c,v 1.22 2021/11/01 20:53:08 tb Exp $ */ 1/* $OpenBSD: pk7_lib.c,v 1.23 2021/12/12 21:30:14 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 *
@@ -63,6 +63,7 @@
63#include <openssl/x509.h> 63#include <openssl/x509.h>
64 64
65#include "asn1_locl.h" 65#include "asn1_locl.h"
66#include "evp_locl.h"
66#include "x509_lcl.h" 67#include "x509_lcl.h"
67 68
68long 69long
diff --git a/src/lib/libcrypto/rsa/rsa_oaep.c b/src/lib/libcrypto/rsa/rsa_oaep.c
index e54600b094..aa37868950 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.33 2019/10/17 14:31:56 jsing Exp $ */ 1/* $OpenBSD: rsa_oaep.c,v 1.34 2021/12/12 21:30:14 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 *
@@ -80,6 +80,7 @@
80#include <openssl/sha.h> 80#include <openssl/sha.h>
81 81
82#include "constant_time_locl.h" 82#include "constant_time_locl.h"
83#include "evp_locl.h"
83#include "rsa_locl.h" 84#include "rsa_locl.h"
84 85
85int 86int
diff --git a/src/lib/libcrypto/rsa/rsa_pss.c b/src/lib/libcrypto/rsa/rsa_pss.c
index 562f7b252c..85ce762643 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.13 2018/09/05 00:55:33 djm Exp $ */ 1/* $OpenBSD: rsa_pss.c,v 1.14 2021/12/12 21:30:14 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 */
@@ -66,6 +66,8 @@
66#include <openssl/rsa.h> 66#include <openssl/rsa.h>
67#include <openssl/sha.h> 67#include <openssl/sha.h>
68 68
69#include "evp_locl.h"
70
69static const unsigned char zeroes[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; 71static const unsigned char zeroes[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
70 72
71int 73int
diff --git a/src/lib/libcrypto/ts/ts_rsp_sign.c b/src/lib/libcrypto/ts/ts_rsp_sign.c
index cbd7039abe..470cbfb7ea 100644
--- a/src/lib/libcrypto/ts/ts_rsp_sign.c
+++ b/src/lib/libcrypto/ts/ts_rsp_sign.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ts_rsp_sign.c,v 1.25 2021/11/04 23:52:34 beck Exp $ */ 1/* $OpenBSD: ts_rsp_sign.c,v 1.26 2021/12/12 21:30:14 tb Exp $ */
2/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL 2/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL
3 * project 2002. 3 * project 2002.
4 */ 4 */
@@ -65,6 +65,7 @@
65#include <openssl/pkcs7.h> 65#include <openssl/pkcs7.h>
66#include <openssl/ts.h> 66#include <openssl/ts.h>
67 67
68#include "evp_locl.h"
68#include "x509_lcl.h" 69#include "x509_lcl.h"
69 70
70/* Private function declarations. */ 71/* Private function declarations. */
diff --git a/src/lib/libcrypto/ts/ts_rsp_verify.c b/src/lib/libcrypto/ts/ts_rsp_verify.c
index 07578945cb..8b15760be9 100644
--- a/src/lib/libcrypto/ts/ts_rsp_verify.c
+++ b/src/lib/libcrypto/ts/ts_rsp_verify.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ts_rsp_verify.c,v 1.23 2021/11/04 23:52:34 beck Exp $ */ 1/* $OpenBSD: ts_rsp_verify.c,v 1.24 2021/12/12 21:30:14 tb Exp $ */
2/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL 2/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL
3 * project 2002. 3 * project 2002.
4 */ 4 */
@@ -64,6 +64,7 @@
64#include <openssl/pkcs7.h> 64#include <openssl/pkcs7.h>
65#include <openssl/ts.h> 65#include <openssl/ts.h>
66 66
67#include "evp_locl.h"
67#include "x509_lcl.h" 68#include "x509_lcl.h"
68 69
69/* Private function declarations. */ 70/* Private function declarations. */
diff --git a/src/lib/libcrypto/x509/x509_cmp.c b/src/lib/libcrypto/x509/x509_cmp.c
index bc944b71d7..e60ee25de1 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.37 2021/11/04 23:52:34 beck Exp $ */ 1/* $OpenBSD: x509_cmp.c,v 1.38 2021/12/12 21:30:14 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 *
@@ -68,6 +68,7 @@
68#include <openssl/x509.h> 68#include <openssl/x509.h>
69#include <openssl/x509v3.h> 69#include <openssl/x509v3.h>
70 70
71#include "evp_locl.h"
71#include "x509_lcl.h" 72#include "x509_lcl.h"
72 73
73int 74int
diff --git a/src/lib/libcrypto/x509/x509_req.c b/src/lib/libcrypto/x509/x509_req.c
index e7f871449f..ffe9b8607f 100644
--- a/src/lib/libcrypto/x509/x509_req.c
+++ b/src/lib/libcrypto/x509/x509_req.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_req.c,v 1.26 2021/11/03 13:27:28 schwarze Exp $ */ 1/* $OpenBSD: x509_req.c,v 1.27 2021/12/12 21:30:14 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 *
@@ -70,6 +70,7 @@
70#include <openssl/pem.h> 70#include <openssl/pem.h>
71#include <openssl/x509.h> 71#include <openssl/x509.h>
72 72
73#include "evp_locl.h"
73#include "x509_lcl.h" 74#include "x509_lcl.h"
74 75
75X509_REQ * 76X509_REQ *
diff --git a/src/lib/libcrypto/x509/x509type.c b/src/lib/libcrypto/x509/x509type.c
index 1748ee5110..7495b9ef04 100644
--- a/src/lib/libcrypto/x509/x509type.c
+++ b/src/lib/libcrypto/x509/x509type.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509type.c,v 1.14 2021/11/01 20:53:08 tb Exp $ */ 1/* $OpenBSD: x509type.c,v 1.15 2021/12/12 21:30:14 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 *
@@ -62,6 +62,7 @@
62#include <openssl/objects.h> 62#include <openssl/objects.h>
63#include <openssl/x509.h> 63#include <openssl/x509.h>
64 64
65#include "evp_locl.h"
65#include "x509_lcl.h" 66#include "x509_lcl.h"
66 67
67int 68int