summaryrefslogtreecommitdiff
path: root/lib/libcrypto/bn/bn_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libcrypto/bn/bn_lib.c')
-rw-r--r--lib/libcrypto/bn/bn_lib.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/lib/libcrypto/bn/bn_lib.c b/lib/libcrypto/bn/bn_lib.c
index 14817629aa1..e4085c9d671 100644
--- a/lib/libcrypto/bn/bn_lib.c
+++ b/lib/libcrypto/bn/bn_lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bn_lib.c,v 1.49 2021/12/04 15:48:23 tb Exp $ */
+/* $OpenBSD: bn_lib.c,v 1.50 2021/12/04 15:53:01 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -137,6 +137,30 @@ BN_get_params(int which)
}
#endif
+void
+BN_set_flags(BIGNUM *b, int n)
+{
+ b->flags |= n;
+}
+
+int
+BN_get_flags(const BIGNUM *b, int n)
+{
+ return b->flags & n;
+}
+
+void
+BN_with_flags(BIGNUM *dest, const BIGNUM *b, int flags)
+{
+ int dest_flags;
+
+ dest_flags = (dest->flags & BN_FLG_MALLOCED) |
+ (b->flags & ~BN_FLG_MALLOCED) | BN_FLG_STATIC_DATA | flags;
+
+ *dest = *b;
+ dest->flags = dest_flags;
+}
+
const BIGNUM *
BN_value_one(void)
{