summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2022-01-14 07:49:49 +0000
committertb <>2022-01-14 07:49:49 +0000
commit8c60ea70a3180083dd57070d774a38f43ce0ea08 (patch)
tree86eaa4f6c31663bf615ddba9616c66030e99b5c9
parent55b6b15a4f08444e468a207fc894ef005c2fb5fa (diff)
downloadopenbsd-8c60ea70a3180083dd57070d774a38f43ce0ea08.tar.gz
openbsd-8c60ea70a3180083dd57070d774a38f43ce0ea08.tar.bz2
openbsd-8c60ea70a3180083dd57070d774a38f43ce0ea08.zip
Unifdef LIBRESSL_OPAQUE_* and LIBRESSL_NEXT_API
This marks the start of major surgery in libcrypto. Do not attempt to build the tree for a while (~50 commits).
-rw-r--r--src/lib/libcrypto/bio/bio.h6
-rw-r--r--src/lib/libcrypto/bn/bn.h66
-rw-r--r--src/lib/libcrypto/dh/dh.h6
-rw-r--r--src/lib/libcrypto/dsa/dsa.h6
-rw-r--r--src/lib/libcrypto/ecdsa/ecdsa.h4
-rw-r--r--src/lib/libcrypto/evp/evp.h16
-rw-r--r--src/lib/libcrypto/objects/objects.h4
-rw-r--r--src/lib/libcrypto/pem/pem.h4
-rw-r--r--src/lib/libcrypto/rsa/rsa.h4
-rw-r--r--src/lib/libcrypto/x509/x509_vfy.h6
10 files changed, 10 insertions, 112 deletions
diff --git a/src/lib/libcrypto/bio/bio.h b/src/lib/libcrypto/bio/bio.h
index 23d47367d4..d715deb2eb 100644
--- a/src/lib/libcrypto/bio/bio.h
+++ b/src/lib/libcrypto/bio/bio.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: bio.h,v 1.50 2022/01/05 20:48:44 tb Exp $ */ 1/* $OpenBSD: bio.h,v 1.51 2022/01/14 07:49:49 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 *
@@ -632,14 +632,10 @@ BIO * BIO_pop(BIO *b);
632void BIO_free_all(BIO *a); 632void BIO_free_all(BIO *a);
633BIO * BIO_find_type(BIO *b, int bio_type); 633BIO * BIO_find_type(BIO *b, int bio_type);
634BIO * BIO_next(BIO *b); 634BIO * BIO_next(BIO *b);
635#if defined(LIBRESSL_OPAQUE_BIO) || defined(LIBRESSL_CRYPTO_INTERNAL)
636void BIO_set_next(BIO *b, BIO *next); 635void BIO_set_next(BIO *b, BIO *next);
637#endif
638BIO * BIO_get_retry_BIO(BIO *bio, int *reason); 636BIO * BIO_get_retry_BIO(BIO *bio, int *reason);
639int BIO_get_retry_reason(BIO *bio); 637int BIO_get_retry_reason(BIO *bio);
640#if defined(LIBRESSL_OPAQUE_BIO) || defined(LIBRESSL_CRYPTO_INTERNAL)
641void BIO_set_retry_reason(BIO *bio, int reason); 638void BIO_set_retry_reason(BIO *bio, int reason);
642#endif
643BIO * BIO_dup_chain(BIO *in); 639BIO * BIO_dup_chain(BIO *in);
644 640
645int BIO_nread0(BIO *bio, char **buf); 641int BIO_nread0(BIO *bio, char **buf);
diff --git a/src/lib/libcrypto/bn/bn.h b/src/lib/libcrypto/bn/bn.h
index db5e7f908c..5d9f17c4d9 100644
--- a/src/lib/libcrypto/bn/bn.h
+++ b/src/lib/libcrypto/bn/bn.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn.h,v 1.50 2021/12/04 16:11:10 tb Exp $ */ 1/* $OpenBSD: bn.h,v 1.51 2022/01/14 07:49:49 tb Exp $ */
2/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -228,14 +228,9 @@ extern "C" {
228#ifndef OPENSSL_NO_DEPRECATED 228#ifndef OPENSSL_NO_DEPRECATED
229#define BN_FLG_FREE 0x8000 /* used for debugging */ 229#define BN_FLG_FREE 0x8000 /* used for debugging */
230#endif 230#endif
231#if defined(LIBRESSL_OPAQUE_BN) || defined(LIBRESSL_CRYPTO_INTERNAL)
232void BN_set_flags(BIGNUM *b, int n); 231void BN_set_flags(BIGNUM *b, int n);
233int BN_get_flags(const BIGNUM *b, int n); 232int BN_get_flags(const BIGNUM *b, int n);
234void BN_with_flags(BIGNUM *dest, const BIGNUM *src, int flags); 233void BN_with_flags(BIGNUM *dest, const BIGNUM *src, int flags);
235#else
236#define BN_set_flags(b,n) ((b)->flags|=(n))
237#define BN_get_flags(b,n) ((b)->flags&(n))
238#endif
239 234
240/* Values for |top| in BN_rand() */ 235/* Values for |top| in BN_rand() */
241#define BN_RAND_TOP_ANY -1 236#define BN_RAND_TOP_ANY -1
@@ -246,19 +241,6 @@ void BN_with_flags(BIGNUM *dest, const BIGNUM *src, int flags);
246#define BN_RAND_BOTTOM_ANY 0 241#define BN_RAND_BOTTOM_ANY 0
247#define BN_RAND_BOTTOM_ODD 1 242#define BN_RAND_BOTTOM_ODD 1
248 243
249#if !defined(LIBRESSL_OPAQUE_BN) && !defined(LIBRESSL_CRYPTO_INTERNAL)
250/* get a clone of a BIGNUM with changed flags, for *temporary* use only
251 * (the two BIGNUMs cannot not be used in parallel!) */
252#define BN_with_flags(dest,b,n) ((dest)->d=(b)->d, \
253 (dest)->top=(b)->top, \
254 (dest)->dmax=(b)->dmax, \
255 (dest)->neg=(b)->neg, \
256 (dest)->flags=(((dest)->flags & BN_FLG_MALLOCED) \
257 | ((b)->flags & ~BN_FLG_MALLOCED) \
258 | BN_FLG_STATIC_DATA \
259 | (n)))
260#endif
261
262/* Move to bn_lcl.h */ 244/* Move to bn_lcl.h */
263struct bignum_st { 245struct bignum_st {
264 BN_ULONG *d; /* Pointer to an array of 'BN_BITS2' bit chunks. */ 246 BN_ULONG *d; /* Pointer to an array of 'BN_BITS2' bit chunks. */
@@ -313,7 +295,6 @@ void BN_GENCB_free(BN_GENCB *cb);
313/* Wrapper function to make using BN_GENCB easier, */ 295/* Wrapper function to make using BN_GENCB easier, */
314int BN_GENCB_call(BN_GENCB *cb, int a, int b); 296int BN_GENCB_call(BN_GENCB *cb, int a, int b);
315 297
316#if defined(LIBRESSL_OPAQUE_BN) || defined(LIBRESSL_CRYPTO_INTERNAL)
317/* Populate a BN_GENCB structure with an "old"-style callback */ 298/* Populate a BN_GENCB structure with an "old"-style callback */
318void BN_GENCB_set_old(BN_GENCB *gencb, void (*callback)(int, int, void *), 299void BN_GENCB_set_old(BN_GENCB *gencb, void (*callback)(int, int, void *),
319 void *cb_arg); 300 void *cb_arg);
@@ -321,20 +302,6 @@ void BN_GENCB_set_old(BN_GENCB *gencb, void (*callback)(int, int, void *),
321/* Populate a BN_GENCB structure with a "new"-style callback */ 302/* Populate a BN_GENCB structure with a "new"-style callback */
322void BN_GENCB_set(BN_GENCB *gencb, int (*callback)(int, int, BN_GENCB *), 303void BN_GENCB_set(BN_GENCB *gencb, int (*callback)(int, int, BN_GENCB *),
323 void *cb_arg); 304 void *cb_arg);
324#else
325/* Macro to populate a BN_GENCB structure with an "old"-style callback */
326#define BN_GENCB_set_old(gencb, callback, cb_arg) { \
327 BN_GENCB *tmp_gencb = (gencb); \
328 tmp_gencb->ver = 1; \
329 tmp_gencb->arg = (cb_arg); \
330 tmp_gencb->cb.cb_1 = (callback); }
331/* Macro to populate a BN_GENCB structure with a "new"-style callback */
332#define BN_GENCB_set(gencb, callback, cb_arg) { \
333 BN_GENCB *tmp_gencb = (gencb); \
334 tmp_gencb->ver = 2; \
335 tmp_gencb->arg = (cb_arg); \
336 tmp_gencb->cb.cb_2 = (callback); }
337#endif /* !LIBRESSL_CRYPTO_INTERNAL */
338 305
339void *BN_GENCB_get_arg(BN_GENCB *cb); 306void *BN_GENCB_get_arg(BN_GENCB *cb);
340 307
@@ -416,7 +383,6 @@ void *BN_GENCB_get_arg(BN_GENCB *cb);
416 383
417#define BN_num_bytes(a) ((BN_num_bits(a)+7)/8) 384#define BN_num_bytes(a) ((BN_num_bits(a)+7)/8)
418 385
419#if defined(LIBRESSL_OPAQUE_BN) || defined(LIBRESSL_CRYPTO_INTERNAL)
420int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w); 386int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w);
421int BN_is_zero(const BIGNUM *a); 387int BN_is_zero(const BIGNUM *a);
422int BN_is_one(const BIGNUM *a); 388int BN_is_one(const BIGNUM *a);
@@ -427,23 +393,6 @@ int BN_is_odd(const BIGNUM *a);
427 393
428void BN_zero_ex(BIGNUM *a); 394void BN_zero_ex(BIGNUM *a);
429 395
430#else
431#define BN_abs_is_word(a,w) ((((a)->top == 1) && ((a)->d[0] == (BN_ULONG)(w))) || \
432 (((w) == 0) && ((a)->top == 0)))
433#define BN_is_zero(a) ((a)->top == 0)
434#define BN_is_one(a) (BN_abs_is_word((a),1) && !(a)->neg)
435#define BN_is_word(a,w) (BN_abs_is_word((a),(w)) && (!(w) || !(a)->neg))
436#define BN_is_odd(a) (((a)->top > 0) && ((a)->d[0] & 1))
437
438#define BN_one(a) (BN_set_word((a),1))
439#define BN_zero_ex(a) \
440 do { \
441 BIGNUM *_tmp_bn = (a); \
442 _tmp_bn->top = 0; \
443 _tmp_bn->neg = 0; \
444 } while(0)
445#endif /* LIBRESSL_OPAQUE_BN */
446
447#ifdef OPENSSL_NO_DEPRECATED 396#ifdef OPENSSL_NO_DEPRECATED
448#define BN_zero(a) BN_zero_ex(a) 397#define BN_zero(a) BN_zero_ex(a)
449#else 398#else
@@ -490,15 +439,7 @@ int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx);
490 */ 439 */
491void BN_set_negative(BIGNUM *b, int n); 440void BN_set_negative(BIGNUM *b, int n);
492 441
493#if defined(LIBRESSL_OPAQUE_BN) || defined(LIBRESSL_CRYPTO_INTERNAL)
494int BN_is_negative(const BIGNUM *b); 442int BN_is_negative(const BIGNUM *b);
495#else
496/** BN_is_negative returns 1 if the BIGNUM is negative
497 * \param a pointer to the BIGNUM object
498 * \return 1 if a < 0 and 0 otherwise
499 */
500#define BN_is_negative(a) ((a)->neg != 0)
501#endif
502 443
503#ifndef LIBRESSL_INTERNAL 444#ifndef LIBRESSL_INTERNAL
504int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d, 445int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d,
@@ -613,13 +554,8 @@ BN_MONT_CTX *BN_MONT_CTX_new(void );
613void BN_MONT_CTX_init(BN_MONT_CTX *ctx); 554void BN_MONT_CTX_init(BN_MONT_CTX *ctx);
614int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 555int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
615 BN_MONT_CTX *mont, BN_CTX *ctx); 556 BN_MONT_CTX *mont, BN_CTX *ctx);
616#if defined(LIBRESSL_OPAQUE_BN) || defined(LIBRESSL_CRYPTO_INTERNAL)
617int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, 557int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont,
618 BN_CTX *ctx); 558 BN_CTX *ctx);
619#else
620#define BN_to_montgomery(r,a,mont,ctx) BN_mod_mul_montgomery(\
621 (r),(a),&((mont)->RR),(mont),(ctx))
622#endif
623int BN_from_montgomery(BIGNUM *r, const BIGNUM *a, 559int BN_from_montgomery(BIGNUM *r, const BIGNUM *a,
624 BN_MONT_CTX *mont, BN_CTX *ctx); 560 BN_MONT_CTX *mont, BN_CTX *ctx);
625void BN_MONT_CTX_free(BN_MONT_CTX *mont); 561void BN_MONT_CTX_free(BN_MONT_CTX *mont);
diff --git a/src/lib/libcrypto/dh/dh.h b/src/lib/libcrypto/dh/dh.h
index 21e840efc4..4545035afb 100644
--- a/src/lib/libcrypto/dh/dh.h
+++ b/src/lib/libcrypto/dh/dh.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: dh.h,v 1.30 2022/01/10 12:00:52 tb Exp $ */ 1/* $OpenBSD: dh.h,v 1.31 2022/01/14 07:49:49 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 *
@@ -199,19 +199,15 @@ void DH_get0_pqg(const DH *dh, const BIGNUM **p, const BIGNUM **q,
199int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g); 199int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g);
200void DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key); 200void DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key);
201int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key); 201int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key);
202#if defined(LIBRESSL_OPAQUE_DH) || defined(LIBRESSL_CRYPTO_INTERNAL)
203const BIGNUM *DH_get0_p(const DH *dh); 202const BIGNUM *DH_get0_p(const DH *dh);
204const BIGNUM *DH_get0_q(const DH *dh); 203const BIGNUM *DH_get0_q(const DH *dh);
205const BIGNUM *DH_get0_g(const DH *dh); 204const BIGNUM *DH_get0_g(const DH *dh);
206const BIGNUM *DH_get0_priv_key(const DH *dh); 205const BIGNUM *DH_get0_priv_key(const DH *dh);
207const BIGNUM *DH_get0_pub_key(const DH *dh); 206const BIGNUM *DH_get0_pub_key(const DH *dh);
208#endif
209void DH_clear_flags(DH *dh, int flags); 207void DH_clear_flags(DH *dh, int flags);
210int DH_test_flags(const DH *dh, int flags); 208int DH_test_flags(const DH *dh, int flags);
211void DH_set_flags(DH *dh, int flags); 209void DH_set_flags(DH *dh, int flags);
212#if defined(LIBRESSL_OPAQUE_DH) || defined(LIBRESSL_CRYPTO_INTERNAL)
213long DH_get_length(const DH *dh); 210long DH_get_length(const DH *dh);
214#endif
215int DH_set_length(DH *dh, long length); 211int DH_set_length(DH *dh, long length);
216 212
217/* Deprecated version */ 213/* Deprecated version */
diff --git a/src/lib/libcrypto/dsa/dsa.h b/src/lib/libcrypto/dsa/dsa.h
index 7a5c2cd1c0..b0220856cc 100644
--- a/src/lib/libcrypto/dsa/dsa.h
+++ b/src/lib/libcrypto/dsa/dsa.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: dsa.h,v 1.33 2022/01/05 20:52:14 tb Exp $ */ 1/* $OpenBSD: dsa.h,v 1.34 2022/01/14 07:49:49 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 *
@@ -202,9 +202,7 @@ void DSA_free(DSA *r);
202/* "up" the DSA object's reference count */ 202/* "up" the DSA object's reference count */
203int DSA_up_ref(DSA *r); 203int DSA_up_ref(DSA *r);
204int DSA_size(const DSA *); 204int DSA_size(const DSA *);
205#if defined(LIBRESSL_OPAQUE_DSA) || defined(LIBRESSL_CRYPTO_INTERNAL)
206int DSA_bits(const DSA *d); 205int DSA_bits(const DSA *d);
207#endif
208 /* next 4 return -1 on error */ 206 /* next 4 return -1 on error */
209int DSA_sign_setup( DSA *dsa,BN_CTX *ctx_in,BIGNUM **kinvp,BIGNUM **rp); 207int DSA_sign_setup( DSA *dsa,BN_CTX *ctx_in,BIGNUM **kinvp,BIGNUM **rp);
210int DSA_sign(int type,const unsigned char *dgst,int dlen, 208int DSA_sign(int type,const unsigned char *dgst,int dlen,
@@ -270,13 +268,11 @@ void DSA_get0_pqg(const DSA *d, const BIGNUM **p, const BIGNUM **q,
270int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g); 268int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g);
271void DSA_get0_key(const DSA *d, const BIGNUM **pub_key, const BIGNUM **priv_key); 269void DSA_get0_key(const DSA *d, const BIGNUM **pub_key, const BIGNUM **priv_key);
272int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key); 270int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key);
273#if defined(LIBRESSL_OPAQUE_DSA) || defined(LIBRESSL_CRYPTO_INTERNAL)
274const BIGNUM *DSA_get0_p(const DSA *d); 271const BIGNUM *DSA_get0_p(const DSA *d);
275const BIGNUM *DSA_get0_q(const DSA *d); 272const BIGNUM *DSA_get0_q(const DSA *d);
276const BIGNUM *DSA_get0_g(const DSA *d); 273const BIGNUM *DSA_get0_g(const DSA *d);
277const BIGNUM *DSA_get0_pub_key(const DSA *d); 274const BIGNUM *DSA_get0_pub_key(const DSA *d);
278const BIGNUM *DSA_get0_priv_key(const DSA *d); 275const BIGNUM *DSA_get0_priv_key(const DSA *d);
279#endif
280void DSA_clear_flags(DSA *d, int flags); 276void DSA_clear_flags(DSA *d, int flags);
281int DSA_test_flags(const DSA *d, int flags); 277int DSA_test_flags(const DSA *d, int flags);
282void DSA_set_flags(DSA *d, int flags); 278void DSA_set_flags(DSA *d, int flags);
diff --git a/src/lib/libcrypto/ecdsa/ecdsa.h b/src/lib/libcrypto/ecdsa/ecdsa.h
index 7b0a25468a..7b57f534ef 100644
--- a/src/lib/libcrypto/ecdsa/ecdsa.h
+++ b/src/lib/libcrypto/ecdsa/ecdsa.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: ecdsa.h,v 1.9 2022/01/05 20:39:04 tb Exp $ */ 1/* $OpenBSD: ecdsa.h,v 1.10 2022/01/14 07:49:49 tb Exp $ */
2/** 2/**
3 * \file crypto/ecdsa/ecdsa.h Include file for the OpenSSL ECDSA functions 3 * \file crypto/ecdsa/ecdsa.h Include file for the OpenSSL ECDSA functions
4 * \author Written by Nils Larsch for the OpenSSL project 4 * \author Written by Nils Larsch for the OpenSSL project
@@ -140,10 +140,8 @@ ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **sig, const unsigned char **pp, long len);
140 */ 140 */
141void ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps); 141void ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps);
142 142
143#if defined(LIBRESSL_OPAQUE_ECDSA) || defined(LIBRESSL_CRYPTO_INTERNAL)
144const BIGNUM *ECDSA_SIG_get0_r(const ECDSA_SIG *sig); 143const BIGNUM *ECDSA_SIG_get0_r(const ECDSA_SIG *sig);
145const BIGNUM *ECDSA_SIG_get0_s(const ECDSA_SIG *sig); 144const BIGNUM *ECDSA_SIG_get0_s(const ECDSA_SIG *sig);
146#endif
147 145
148/** Setter for r and s fields of ECDSA_SIG 146/** Setter for r and s fields of ECDSA_SIG
149 * \param sig pointer to ECDSA_SIG pointer 147 * \param sig pointer to ECDSA_SIG pointer
diff --git a/src/lib/libcrypto/evp/evp.h b/src/lib/libcrypto/evp/evp.h
index df71b0ac16..012b06befc 100644
--- a/src/lib/libcrypto/evp/evp.h
+++ b/src/lib/libcrypto/evp/evp.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: evp.h,v 1.96 2022/01/12 08:52:25 tb Exp $ */ 1/* $OpenBSD: evp.h,v 1.97 2022/01/14 07:49:49 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 *
@@ -495,7 +495,6 @@ int EVP_MD_size(const EVP_MD *md);
495int EVP_MD_block_size(const EVP_MD *md); 495int EVP_MD_block_size(const EVP_MD *md);
496unsigned long EVP_MD_flags(const EVP_MD *md); 496unsigned long EVP_MD_flags(const EVP_MD *md);
497 497
498#if defined(LIBRESSL_NEXT_API) || defined(LIBRESSL_CRYPTO_INTERNAL)
499EVP_MD *EVP_MD_meth_new(int md_type, int pkey_type); 498EVP_MD *EVP_MD_meth_new(int md_type, int pkey_type);
500void EVP_MD_meth_free(EVP_MD *md); 499void EVP_MD_meth_free(EVP_MD *md);
501EVP_MD *EVP_MD_meth_dup(const EVP_MD *md); 500EVP_MD *EVP_MD_meth_dup(const EVP_MD *md);
@@ -513,14 +512,11 @@ int EVP_MD_meth_set_copy(EVP_MD *md,
513int EVP_MD_meth_set_cleanup(EVP_MD *md, int (*cleanup)(EVP_MD_CTX *ctx)); 512int EVP_MD_meth_set_cleanup(EVP_MD *md, int (*cleanup)(EVP_MD_CTX *ctx));
514int EVP_MD_meth_set_ctrl(EVP_MD *md, 513int EVP_MD_meth_set_ctrl(EVP_MD *md,
515 int (*ctrl)(EVP_MD_CTX *ctx, int cmd, int p1, void *p2)); 514 int (*ctrl)(EVP_MD_CTX *ctx, int cmd, int p1, void *p2));
516#endif
517 515
518const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx); 516const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx);
519void *EVP_MD_CTX_md_data(const EVP_MD_CTX *ctx); 517void *EVP_MD_CTX_md_data(const EVP_MD_CTX *ctx);
520#if defined(LIBRESSL_CRYPTO_INTERNAL) || defined(LIBRESSL_NEXT_API)
521EVP_PKEY_CTX *EVP_MD_CTX_pkey_ctx(const EVP_MD_CTX *ctx); 518EVP_PKEY_CTX *EVP_MD_CTX_pkey_ctx(const EVP_MD_CTX *ctx);
522void EVP_MD_CTX_set_pkey_ctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX *pctx); 519void EVP_MD_CTX_set_pkey_ctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX *pctx);
523#endif
524#define EVP_MD_CTX_size(e) EVP_MD_size(EVP_MD_CTX_md(e)) 520#define EVP_MD_CTX_size(e) EVP_MD_size(EVP_MD_CTX_md(e))
525#define EVP_MD_CTX_block_size(e) EVP_MD_block_size(EVP_MD_CTX_md(e)) 521#define EVP_MD_CTX_block_size(e) EVP_MD_block_size(EVP_MD_CTX_md(e))
526#define EVP_MD_CTX_type(e) EVP_MD_type(EVP_MD_CTX_md(e)) 522#define EVP_MD_CTX_type(e) EVP_MD_type(EVP_MD_CTX_md(e))
@@ -546,11 +542,9 @@ int EVP_CIPHER_CTX_set_iv(EVP_CIPHER_CTX *ctx,
546int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in); 542int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in);
547void *EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx); 543void *EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx);
548void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data); 544void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data);
549#if defined(LIBRESSL_NEXT_API) || defined(LIBRESSL_CRYPTO_INTERNAL)
550void *EVP_CIPHER_CTX_get_cipher_data(const EVP_CIPHER_CTX *ctx); 545void *EVP_CIPHER_CTX_get_cipher_data(const EVP_CIPHER_CTX *ctx);
551void *EVP_CIPHER_CTX_set_cipher_data(EVP_CIPHER_CTX *ctx, void *cipher_data); 546void *EVP_CIPHER_CTX_set_cipher_data(EVP_CIPHER_CTX *ctx, void *cipher_data);
552unsigned char *EVP_CIPHER_CTX_buf_noconst(EVP_CIPHER_CTX *ctx); 547unsigned char *EVP_CIPHER_CTX_buf_noconst(EVP_CIPHER_CTX *ctx);
553#endif
554#define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c)) 548#define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c))
555unsigned long EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx); 549unsigned long EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx);
556#define EVP_CIPHER_CTX_mode(e) (EVP_CIPHER_CTX_flags(e) & EVP_CIPH_MODE) 550#define EVP_CIPHER_CTX_mode(e) (EVP_CIPHER_CTX_flags(e) & EVP_CIPH_MODE)
@@ -1107,14 +1101,12 @@ void EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth,
1107void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth, 1101void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth,
1108 int (*pkey_ctrl)(EVP_PKEY *pkey, int op, long arg1, void *arg2)); 1102 int (*pkey_ctrl)(EVP_PKEY *pkey, int op, long arg1, void *arg2));
1109 1103
1110#if defined(LIBRESSL_CRYPTO_INTERNAL) || defined(LIBRESSL_NEXT_API)
1111void EVP_PKEY_asn1_set_check(EVP_PKEY_ASN1_METHOD *ameth, 1104void EVP_PKEY_asn1_set_check(EVP_PKEY_ASN1_METHOD *ameth,
1112 int (*pkey_check)(const EVP_PKEY *pk)); 1105 int (*pkey_check)(const EVP_PKEY *pk));
1113void EVP_PKEY_asn1_set_public_check(EVP_PKEY_ASN1_METHOD *ameth, 1106void EVP_PKEY_asn1_set_public_check(EVP_PKEY_ASN1_METHOD *ameth,
1114 int (*pkey_public_check)(const EVP_PKEY *pk)); 1107 int (*pkey_public_check)(const EVP_PKEY *pk));
1115void EVP_PKEY_asn1_set_param_check(EVP_PKEY_ASN1_METHOD *ameth, 1108void EVP_PKEY_asn1_set_param_check(EVP_PKEY_ASN1_METHOD *ameth,
1116 int (*pkey_check)(const EVP_PKEY *pk)); 1109 int (*pkey_check)(const EVP_PKEY *pk));
1117#endif
1118 1110
1119#define EVP_PKEY_OP_UNDEFINED 0 1111#define EVP_PKEY_OP_UNDEFINED 0
1120#define EVP_PKEY_OP_PARAMGEN (1<<1) 1112#define EVP_PKEY_OP_PARAMGEN (1<<1)
@@ -1242,11 +1234,9 @@ int EVP_PKEY_paramgen_init(EVP_PKEY_CTX *ctx);
1242int EVP_PKEY_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey); 1234int EVP_PKEY_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey);
1243int EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx); 1235int EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx);
1244int EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey); 1236int EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey);
1245#if defined(LIBRESSL_CRYPTO_INTERNAL) || defined(LIBRESSL_NEXT_API)
1246int EVP_PKEY_check(EVP_PKEY_CTX *ctx); 1237int EVP_PKEY_check(EVP_PKEY_CTX *ctx);
1247int EVP_PKEY_public_check(EVP_PKEY_CTX *ctx); 1238int EVP_PKEY_public_check(EVP_PKEY_CTX *ctx);
1248int EVP_PKEY_param_check(EVP_PKEY_CTX *ctx); 1239int EVP_PKEY_param_check(EVP_PKEY_CTX *ctx);
1249#endif
1250 1240
1251void EVP_PKEY_CTX_set_cb(EVP_PKEY_CTX *ctx, EVP_PKEY_gen_cb *cb); 1241void EVP_PKEY_CTX_set_cb(EVP_PKEY_CTX *ctx, EVP_PKEY_gen_cb *cb);
1252EVP_PKEY_gen_cb *EVP_PKEY_CTX_get_cb(EVP_PKEY_CTX *ctx); 1242EVP_PKEY_gen_cb *EVP_PKEY_CTX_get_cb(EVP_PKEY_CTX *ctx);
@@ -1313,14 +1303,12 @@ void EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth,
1313 int (*ctrl)(EVP_PKEY_CTX *ctx, int type, int p1, void *p2), 1303 int (*ctrl)(EVP_PKEY_CTX *ctx, int type, int p1, void *p2),
1314 int (*ctrl_str)(EVP_PKEY_CTX *ctx, const char *type, const char *value)); 1304 int (*ctrl_str)(EVP_PKEY_CTX *ctx, const char *type, const char *value));
1315 1305
1316#if defined(LIBRESSL_CRYPTO_INTERNAL) || defined(LIBRESSL_NEXT_API)
1317void EVP_PKEY_meth_set_check(EVP_PKEY_METHOD *pmeth, 1306void EVP_PKEY_meth_set_check(EVP_PKEY_METHOD *pmeth,
1318 int (*check)(EVP_PKEY *pkey)); 1307 int (*check)(EVP_PKEY *pkey));
1319void EVP_PKEY_meth_set_public_check(EVP_PKEY_METHOD *pmeth, 1308void EVP_PKEY_meth_set_public_check(EVP_PKEY_METHOD *pmeth,
1320 int (*public_check)(EVP_PKEY *pkey)); 1309 int (*public_check)(EVP_PKEY *pkey));
1321void EVP_PKEY_meth_set_param_check(EVP_PKEY_METHOD *pmeth, 1310void EVP_PKEY_meth_set_param_check(EVP_PKEY_METHOD *pmeth,
1322 int (*param_check)(EVP_PKEY *pkey)); 1311 int (*param_check)(EVP_PKEY *pkey));
1323#endif
1324 1312
1325/* Authenticated Encryption with Additional Data. 1313/* Authenticated Encryption with Additional Data.
1326 * 1314 *
@@ -1378,7 +1366,6 @@ typedef struct evp_aead_ctx_st {
1378 * should be used. */ 1366 * should be used. */
1379#define EVP_AEAD_DEFAULT_TAG_LENGTH 0 1367#define EVP_AEAD_DEFAULT_TAG_LENGTH 0
1380 1368
1381#if defined(LIBRESSL_CRYPTO_INTERNAL) || defined(LIBRESSL_NEXT_API)
1382/* EVP_AEAD_CTX_new allocates a new context for use with EVP_AEAD_CTX_init. 1369/* EVP_AEAD_CTX_new allocates a new context for use with EVP_AEAD_CTX_init.
1383 * It can be cleaned up for reuse with EVP_AEAD_CTX_cleanup and must be freed 1370 * It can be cleaned up for reuse with EVP_AEAD_CTX_cleanup and must be freed
1384 * with EVP_AEAD_CTX_free. */ 1371 * with EVP_AEAD_CTX_free. */
@@ -1386,7 +1373,6 @@ EVP_AEAD_CTX *EVP_AEAD_CTX_new(void);
1386 1373
1387/* EVP_AEAD_CTX_free releases all memory owned by the context. */ 1374/* EVP_AEAD_CTX_free releases all memory owned by the context. */
1388void EVP_AEAD_CTX_free(EVP_AEAD_CTX *ctx); 1375void EVP_AEAD_CTX_free(EVP_AEAD_CTX *ctx);
1389#endif
1390 1376
1391/* EVP_AEAD_CTX_init initializes the context for the given AEAD algorithm. 1377/* EVP_AEAD_CTX_init initializes the context for the given AEAD algorithm.
1392 * The implementation argument may be NULL to choose the default implementation. 1378 * The implementation argument may be NULL to choose the default implementation.
diff --git a/src/lib/libcrypto/objects/objects.h b/src/lib/libcrypto/objects/objects.h
index 2aaaefd96b..3ed792bb34 100644
--- a/src/lib/libcrypto/objects/objects.h
+++ b/src/lib/libcrypto/objects/objects.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: objects.h,v 1.14 2022/01/08 21:36:39 tb Exp $ */ 1/* $OpenBSD: objects.h,v 1.15 2022/01/14 07:49:49 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 *
@@ -1105,10 +1105,8 @@ int OBJ_create(const char *oid, const char *sn, const char *ln);
1105void OBJ_cleanup(void); 1105void OBJ_cleanup(void);
1106int OBJ_create_objects(BIO *in); 1106int OBJ_create_objects(BIO *in);
1107 1107
1108#if defined(LIBRESSL_CRYPTO_INTERNAL) || defined(LIBRESSL_NEXT_API)
1109size_t OBJ_length(const ASN1_OBJECT *obj); 1108size_t OBJ_length(const ASN1_OBJECT *obj);
1110const unsigned char *OBJ_get0_data(const ASN1_OBJECT *obj); 1109const unsigned char *OBJ_get0_data(const ASN1_OBJECT *obj);
1111#endif
1112 1110
1113int OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid); 1111int OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid);
1114int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid); 1112int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid);
diff --git a/src/lib/libcrypto/pem/pem.h b/src/lib/libcrypto/pem/pem.h
index b447dc4ac2..0ea04bece7 100644
--- a/src/lib/libcrypto/pem/pem.h
+++ b/src/lib/libcrypto/pem/pem.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: pem.h,v 1.21 2021/12/24 12:59:17 tb Exp $ */ 1/* $OpenBSD: pem.h,v 1.22 2022/01/14 07:49:49 tb Exp $ */
2/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -482,11 +482,9 @@ DECLARE_PEM_rw_cb(PrivateKey, EVP_PKEY)
482 482
483DECLARE_PEM_rw(PUBKEY, EVP_PKEY) 483DECLARE_PEM_rw(PUBKEY, EVP_PKEY)
484 484
485#if defined(LIBRESSL_NEXT_API) || defined(LIBRESSL_CRYPTO_INTERNAL)
486int PEM_write_bio_PrivateKey_traditional(BIO *bp, EVP_PKEY *x, 485int PEM_write_bio_PrivateKey_traditional(BIO *bp, EVP_PKEY *x,
487 const EVP_CIPHER *enc, unsigned char *kstr, int klen, pem_password_cb *cb, 486 const EVP_CIPHER *enc, unsigned char *kstr, int klen, pem_password_cb *cb,
488 void *u); 487 void *u);
489#endif
490int PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, EVP_PKEY *x, int nid, 488int PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, EVP_PKEY *x, int nid,
491 char *kstr, int klen, 489 char *kstr, int klen,
492 pem_password_cb *cb, void *u); 490 pem_password_cb *cb, void *u);
diff --git a/src/lib/libcrypto/rsa/rsa.h b/src/lib/libcrypto/rsa/rsa.h
index 9dea6c37c0..daefcb85b2 100644
--- a/src/lib/libcrypto/rsa/rsa.h
+++ b/src/lib/libcrypto/rsa/rsa.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa.h,v 1.52 2022/01/05 20:44:12 tb Exp $ */ 1/* $OpenBSD: rsa.h,v 1.53 2022/01/14 07:49:49 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 *
@@ -470,7 +470,6 @@ void RSA_get0_crt_params(const RSA *r, const BIGNUM **dmp1, const BIGNUM **dmq1,
470int RSA_set0_crt_params(RSA *r, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp); 470int RSA_set0_crt_params(RSA *r, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp);
471void RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q); 471void RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q);
472int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q); 472int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q);
473#if defined(LIBRESSL_OPAQUE_RSA) || defined(LIBRESSL_CRYPTO_INTERNAL)
474const BIGNUM *RSA_get0_n(const RSA *r); 473const BIGNUM *RSA_get0_n(const RSA *r);
475const BIGNUM *RSA_get0_e(const RSA *r); 474const BIGNUM *RSA_get0_e(const RSA *r);
476const BIGNUM *RSA_get0_d(const RSA *r); 475const BIGNUM *RSA_get0_d(const RSA *r);
@@ -480,7 +479,6 @@ const BIGNUM *RSA_get0_dmp1(const RSA *r);
480const BIGNUM *RSA_get0_dmq1(const RSA *r); 479const BIGNUM *RSA_get0_dmq1(const RSA *r);
481const BIGNUM *RSA_get0_iqmp(const RSA *r); 480const BIGNUM *RSA_get0_iqmp(const RSA *r);
482const RSA_PSS_PARAMS *RSA_get0_pss_params(const RSA *r); 481const RSA_PSS_PARAMS *RSA_get0_pss_params(const RSA *r);
483#endif
484void RSA_clear_flags(RSA *r, int flags); 482void RSA_clear_flags(RSA *r, int flags);
485int RSA_test_flags(const RSA *r, int flags); 483int RSA_test_flags(const RSA *r, int flags);
486void RSA_set_flags(RSA *r, int flags); 484void RSA_set_flags(RSA *r, int flags);
diff --git a/src/lib/libcrypto/x509/x509_vfy.h b/src/lib/libcrypto/x509/x509_vfy.h
index a02ef94e2b..c50624a603 100644
--- a/src/lib/libcrypto/x509/x509_vfy.h
+++ b/src/lib/libcrypto/x509/x509_vfy.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_vfy.h,v 1.48 2022/01/05 20:18:19 tb Exp $ */ 1/* $OpenBSD: x509_vfy.h,v 1.49 2022/01/14 07:49:49 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 *
@@ -297,11 +297,9 @@ int X509_STORE_set_trust(X509_STORE *ctx, int trust);
297int X509_STORE_set1_param(X509_STORE *ctx, X509_VERIFY_PARAM *pm); 297int X509_STORE_set1_param(X509_STORE *ctx, X509_VERIFY_PARAM *pm);
298X509_VERIFY_PARAM *X509_STORE_get0_param(X509_STORE *ctx); 298X509_VERIFY_PARAM *X509_STORE_get0_param(X509_STORE *ctx);
299 299
300#if defined(LIBRESSL_NEXT_API) || defined(LIBRESSL_CRYPTO_INTERNAL)
301typedef int (*X509_STORE_CTX_verify_cb)(int, X509_STORE_CTX *); 300typedef int (*X509_STORE_CTX_verify_cb)(int, X509_STORE_CTX *);
302 301
303X509_STORE_CTX_verify_cb X509_STORE_get_verify_cb(X509_STORE *); 302X509_STORE_CTX_verify_cb X509_STORE_get_verify_cb(X509_STORE *);
304#endif
305 303
306void X509_STORE_set_verify_cb(X509_STORE *ctx, 304void X509_STORE_set_verify_cb(X509_STORE *ctx,
307 int (*verify_cb)(int, X509_STORE_CTX *)); 305 int (*verify_cb)(int, X509_STORE_CTX *));
@@ -398,12 +396,10 @@ int (*X509_STORE_CTX_get_verify_cb(X509_STORE_CTX *ctx))(int, X509_STORE_CTX *);
398void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx, 396void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx,
399 int (*verify_cb)(int, X509_STORE_CTX *)); 397 int (*verify_cb)(int, X509_STORE_CTX *));
400 398
401#if defined(LIBRESSL_NEXT_API) || defined(LIBRESSL_CRYPTO_INTERNAL)
402typedef int (*X509_STORE_CTX_verify_fn)(X509_STORE_CTX *); 399typedef int (*X509_STORE_CTX_verify_fn)(X509_STORE_CTX *);
403 400
404void X509_STORE_set_verify(X509_STORE *ctx, X509_STORE_CTX_verify_fn verify); 401void X509_STORE_set_verify(X509_STORE *ctx, X509_STORE_CTX_verify_fn verify);
405X509_STORE_CTX_verify_fn X509_STORE_get_verify(X509_STORE *ctx); 402X509_STORE_CTX_verify_fn X509_STORE_get_verify(X509_STORE *ctx);
406#endif
407#define X509_STORE_set_verify_func(ctx, func) \ 403#define X509_STORE_set_verify_func(ctx, func) \
408 X509_STORE_set_verify((ctx), (func)) 404 X509_STORE_set_verify((ctx), (func))
409 405