diff options
| author | tb <> | 2021-12-04 15:53:01 +0000 |
|---|---|---|
| committer | tb <> | 2021-12-04 15:53:01 +0000 |
| commit | b6edb64309ee0e5ec4b6209d18f8243451517729 (patch) | |
| tree | d6e778b0f86a5a6d60eef0b24c751d23a791739e /src/lib/libcrypto/bn/bn_lib.c | |
| parent | cd068a91eeb270452808f2fb0f3091059390bc4b (diff) | |
| download | openbsd-b6edb64309ee0e5ec4b6209d18f8243451517729.tar.gz openbsd-b6edb64309ee0e5ec4b6209d18f8243451517729.tar.bz2 openbsd-b6edb64309ee0e5ec4b6209d18f8243451517729.zip | |
Provide replacement functions for the BN_{get,set,with}_flags() macros.
ok inoguchi jsing
Diffstat (limited to 'src/lib/libcrypto/bn/bn_lib.c')
| -rw-r--r-- | src/lib/libcrypto/bn/bn_lib.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c index 14817629aa..e4085c9d67 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.49 2021/12/04 15:48:23 tb Exp $ */ | 1 | /* $OpenBSD: bn_lib.c,v 1.50 2021/12/04 15:53:01 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 | * |
| @@ -137,6 +137,30 @@ BN_get_params(int which) | |||
| 137 | } | 137 | } |
| 138 | #endif | 138 | #endif |
| 139 | 139 | ||
| 140 | void | ||
| 141 | BN_set_flags(BIGNUM *b, int n) | ||
| 142 | { | ||
| 143 | b->flags |= n; | ||
| 144 | } | ||
| 145 | |||
| 146 | int | ||
| 147 | BN_get_flags(const BIGNUM *b, int n) | ||
| 148 | { | ||
| 149 | return b->flags & n; | ||
| 150 | } | ||
| 151 | |||
| 152 | void | ||
| 153 | BN_with_flags(BIGNUM *dest, const BIGNUM *b, int flags) | ||
| 154 | { | ||
| 155 | int dest_flags; | ||
| 156 | |||
| 157 | dest_flags = (dest->flags & BN_FLG_MALLOCED) | | ||
| 158 | (b->flags & ~BN_FLG_MALLOCED) | BN_FLG_STATIC_DATA | flags; | ||
| 159 | |||
| 160 | *dest = *b; | ||
| 161 | dest->flags = dest_flags; | ||
| 162 | } | ||
| 163 | |||
| 140 | const BIGNUM * | 164 | const BIGNUM * |
| 141 | BN_value_one(void) | 165 | BN_value_one(void) |
| 142 | { | 166 | { |
