summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjsing <>2018-02-20 17:13:14 +0000
committerjsing <>2018-02-20 17:13:14 +0000
commit2f0d52b8a3e3ce63552d3125a01f70077b6e6b1a (patch)
treebcd4e3cc304aa2782318d21cb627e1d85a2d5dd1 /src
parentffdc588fe5b7d401c01aa2c6d688fd0eb0c26cb3 (diff)
downloadopenbsd-2f0d52b8a3e3ce63552d3125a01f70077b6e6b1a.tar.gz
openbsd-2f0d52b8a3e3ce63552d3125a01f70077b6e6b1a.tar.bz2
openbsd-2f0d52b8a3e3ce63552d3125a01f70077b6e6b1a.zip
Provide BN_GENCB_new(), BN_GENCB_free() and BN_GENCB_get_arg()
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/Symbols.list3
-rw-r--r--src/lib/libcrypto/bn/bn.h7
-rw-r--r--src/lib/libcrypto/bn/bn_lib.c27
3 files changed, 35 insertions, 2 deletions
diff --git a/src/lib/libcrypto/Symbols.list b/src/lib/libcrypto/Symbols.list
index 022176264e..23030bdb15 100644
--- a/src/lib/libcrypto/Symbols.list
+++ b/src/lib/libcrypto/Symbols.list
@@ -375,6 +375,9 @@ BN_CTX_init
375BN_CTX_new 375BN_CTX_new
376BN_CTX_start 376BN_CTX_start
377BN_GENCB_call 377BN_GENCB_call
378BN_GENCB_free
379BN_GENCB_get_arg
380BN_GENCB_new
378BN_GF2m_add 381BN_GF2m_add
379BN_GF2m_arr2poly 382BN_GF2m_arr2poly
380BN_GF2m_mod 383BN_GF2m_mod
diff --git a/src/lib/libcrypto/bn/bn.h b/src/lib/libcrypto/bn/bn.h
index cca9def20b..cd94e39345 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.37 2018/02/20 17:02:30 jsing Exp $ */ 1/* $OpenBSD: bn.h,v 1.38 2018/02/20 17:13:14 jsing 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 *
@@ -285,6 +285,11 @@ struct bn_gencb_st {
285 int (*cb_2)(int, int, BN_GENCB *); 285 int (*cb_2)(int, int, BN_GENCB *);
286 } cb; 286 } cb;
287}; 287};
288
289BN_GENCB *BN_GENCB_new(void);
290void BN_GENCB_free(BN_GENCB *cb);
291void *BN_GENCB_get_arg(BN_GENCB *cb);
292
288/* Wrapper function to make using BN_GENCB easier, */ 293/* Wrapper function to make using BN_GENCB easier, */
289int BN_GENCB_call(BN_GENCB *cb, int a, int b); 294int BN_GENCB_call(BN_GENCB *cb, int a, int b);
290/* Macro to populate a BN_GENCB structure with an "old"-style callback */ 295/* Macro to populate a BN_GENCB structure with an "old"-style callback */
diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c
index 8aeeb5304f..ffb5ee7c2e 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.38 2017/05/02 03:59:44 deraadt Exp $ */ 1/* $OpenBSD: bn_lib.c,v 1.39 2018/02/20 17:13:14 jsing 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 *
@@ -888,3 +888,28 @@ BN_consttime_swap(BN_ULONG condition, BIGNUM *a, BIGNUM *b, int nwords)
888 } 888 }
889#undef BN_CONSTTIME_SWAP 889#undef BN_CONSTTIME_SWAP
890} 890}
891
892BN_GENCB *
893BN_GENCB_new(void)
894{
895 BN_GENCB *cb;
896
897 if ((cb = calloc(1, sizeof(*cb))) == NULL)
898 return NULL;
899
900 return cb;
901}
902
903void
904BN_GENCB_free(BN_GENCB *cb)
905{
906 if (cb == NULL)
907 return;
908 free(cb);
909}
910
911void *
912BN_GENCB_get_arg(BN_GENCB *cb)
913{
914 return cb->arg;
915}