diff options
| author | jsing <> | 2022-12-17 15:56:25 +0000 |
|---|---|---|
| committer | jsing <> | 2022-12-17 15:56:25 +0000 |
| commit | 8cb0d6719a25ad287afaef9db9c434e2ffbe86a7 (patch) | |
| tree | debf6c87cb5650b9a030d3c9de7f062c9bce2cd7 /src/lib/libcrypto/bn/bn.h | |
| parent | 4f30e7935ccf9f6d7cff0669aecfdf86fd5b2d9d (diff) | |
| download | openbsd-8cb0d6719a25ad287afaef9db9c434e2ffbe86a7.tar.gz openbsd-8cb0d6719a25ad287afaef9db9c434e2ffbe86a7.tar.bz2 openbsd-8cb0d6719a25ad287afaef9db9c434e2ffbe86a7.zip | |
Provide BN_zero()/BN_one() as functions and make BN_zero() always succeed.
BN_zero() is currently implemented using BN_set_word(), which means it can
fail, however almost nothing ever checks the return value. A long time
ago OpenSSL changed BN_zero() to always succeed and return void, however
kept BN_zero as a macro that calls a new BN_zero_ex() function, so that
it can be switched back to the "can fail" version.
Take a simpler approach - change BN_zero()/BN_one() to functions and make
BN_zero() always succeed. This will be exposed in the next bump, at which
point we can hopefully also remove the BN_zero_ex() function.
ok tb@
Diffstat (limited to 'src/lib/libcrypto/bn/bn.h')
| -rw-r--r-- | src/lib/libcrypto/bn/bn.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/libcrypto/bn/bn.h b/src/lib/libcrypto/bn/bn.h index bef0a878e2..ba6c25ba0a 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.56 2022/11/30 01:47:19 jsing Exp $ */ | 1 | /* $OpenBSD: bn.h,v 1.57 2022/12/17 15:56:25 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 | * |
| @@ -329,6 +329,10 @@ int BN_is_one(const BIGNUM *a); | |||
| 329 | int BN_is_word(const BIGNUM *a, const BN_ULONG w); | 329 | int BN_is_word(const BIGNUM *a, const BN_ULONG w); |
| 330 | int BN_is_odd(const BIGNUM *a); | 330 | int BN_is_odd(const BIGNUM *a); |
| 331 | 331 | ||
| 332 | #if defined(LIBRESSL_INTERNAL) || defined(LIBRESSL_NEXT_API) | ||
| 333 | void BN_zero(BIGNUM *a); | ||
| 334 | int BN_one(BIGNUM *a); | ||
| 335 | #else | ||
| 332 | #define BN_one(a) BN_set_word((a), 1) | 336 | #define BN_one(a) BN_set_word((a), 1) |
| 333 | 337 | ||
| 334 | void BN_zero_ex(BIGNUM *a); | 338 | void BN_zero_ex(BIGNUM *a); |
| @@ -338,6 +342,7 @@ void BN_zero_ex(BIGNUM *a); | |||
| 338 | #else | 342 | #else |
| 339 | #define BN_zero(a) (BN_set_word((a),0)) | 343 | #define BN_zero(a) (BN_set_word((a),0)) |
| 340 | #endif | 344 | #endif |
| 345 | #endif | ||
| 341 | 346 | ||
| 342 | const BIGNUM *BN_value_one(void); | 347 | const BIGNUM *BN_value_one(void); |
| 343 | char * BN_options(void); | 348 | char * BN_options(void); |
