summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2023-03-27 08:37:33 +0000
committertb <>2023-03-27 08:37:33 +0000
commit7f773f82da0d71fea837a23e83819617a6560888 (patch)
tree3e913e7c24287cfd42b3741a763a8f703ce14e8f /src
parenta3cf057df31964ce53c82dab6c823c6aef33ce28 (diff)
downloadopenbsd-7f773f82da0d71fea837a23e83819617a6560888.tar.gz
openbsd-7f773f82da0d71fea837a23e83819617a6560888.tar.bz2
openbsd-7f773f82da0d71fea837a23e83819617a6560888.zip
Add bn_copy(), a sane wrapper of BN_copy() for internal use
ok jsing
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/bn/bn_lib.c8
-rw-r--r--src/lib/libcrypto/bn/bn_local.h4
2 files changed, 10 insertions, 2 deletions
diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c
index 89e2713a0f..9da03e2c6e 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.76 2023/02/14 18:22:35 jsing Exp $ */ 1/* $OpenBSD: bn_lib.c,v 1.77 2023/03/27 08:37:33 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 *
@@ -384,6 +384,12 @@ BN_copy(BIGNUM *a, const BIGNUM *b)
384 return (a); 384 return (a);
385} 385}
386 386
387int
388bn_copy(BIGNUM *dst, const BIGNUM *src)
389{
390 return BN_copy(dst, src) != NULL;
391}
392
387void 393void
388BN_swap(BIGNUM *a, BIGNUM *b) 394BN_swap(BIGNUM *a, BIGNUM *b)
389{ 395{
diff --git a/src/lib/libcrypto/bn/bn_local.h b/src/lib/libcrypto/bn/bn_local.h
index 4576c36c91..4912ae96f3 100644
--- a/src/lib/libcrypto/bn/bn_local.h
+++ b/src/lib/libcrypto/bn/bn_local.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_local.h,v 1.17 2023/02/22 05:57:19 jsing Exp $ */ 1/* $OpenBSD: bn_local.h,v 1.18 2023/03/27 08:37:33 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 *
@@ -312,6 +312,8 @@ int BN_gcd_nonct(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
312 312
313int BN_swap_ct(BN_ULONG swap, BIGNUM *a, BIGNUM *b, size_t nwords); 313int BN_swap_ct(BN_ULONG swap, BIGNUM *a, BIGNUM *b, size_t nwords);
314 314
315int bn_copy(BIGNUM *dst, const BIGNUM *src);
316
315int bn_isqrt(BIGNUM *out_sqrt, int *out_perfect, const BIGNUM *n, BN_CTX *ctx); 317int bn_isqrt(BIGNUM *out_sqrt, int *out_perfect, const BIGNUM *n, BN_CTX *ctx);
316int bn_is_perfect_square(int *out_perfect, const BIGNUM *n, BN_CTX *ctx); 318int bn_is_perfect_square(int *out_perfect, const BIGNUM *n, BN_CTX *ctx);
317 319