summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bn/bn_lib.c
diff options
context:
space:
mode:
authortb <>2021-12-04 15:48:23 +0000
committertb <>2021-12-04 15:48:23 +0000
commit9e67971b75131ba30d80f574f8a566cc6baec963 (patch)
tree3975d1baedd6dcf431ceef07e593ecfdc35929dc /src/lib/libcrypto/bn/bn_lib.c
parent766ad3b0542215bba5dbae922add70f5c0c23224 (diff)
downloadopenbsd-9e67971b75131ba30d80f574f8a566cc6baec963.tar.gz
openbsd-9e67971b75131ba30d80f574f8a566cc6baec963.tar.bz2
openbsd-9e67971b75131ba30d80f574f8a566cc6baec963.zip
Provide replacement functions for the BN_GENCB_set{,_old}() macros
The function implementations are necessary to make BIGNUM opaque. They will be used in libcrypto internally until they will replace the macro implementations with the next bump. ok inoguchi jsing
Diffstat (limited to 'src/lib/libcrypto/bn/bn_lib.c')
-rw-r--r--src/lib/libcrypto/bn/bn_lib.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c
index af837eed01..14817629aa 100644
--- a/src/lib/libcrypto/bn/bn_lib.c
+++ b/src/lib/libcrypto/bn/bn_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_lib.c,v 1.48 2021/09/08 12:19:17 tb Exp $ */ 1/* $OpenBSD: bn_lib.c,v 1.49 2021/12/04 15:48:23 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 *
@@ -1056,6 +1056,24 @@ BN_GENCB_free(BN_GENCB *cb)
1056 free(cb); 1056 free(cb);
1057} 1057}
1058 1058
1059/* Populate a BN_GENCB structure with an "old"-style callback */
1060void
1061BN_GENCB_set_old(BN_GENCB *gencb, void (*cb)(int, int, void *), void *cb_arg)
1062{
1063 gencb->ver = 1;
1064 gencb->cb.cb_1 = cb;
1065 gencb->arg = cb_arg;
1066}
1067
1068/* Populate a BN_GENCB structure with a "new"-style callback */
1069void
1070BN_GENCB_set(BN_GENCB *gencb, int (*cb)(int, int, BN_GENCB *), void *cb_arg)
1071{
1072 gencb->ver = 2;
1073 gencb->cb.cb_2 = cb;
1074 gencb->arg = cb_arg;
1075}
1076
1059void * 1077void *
1060BN_GENCB_get_arg(BN_GENCB *cb) 1078BN_GENCB_get_arg(BN_GENCB *cb)
1061{ 1079{