diff options
author | tb <> | 2023-06-13 09:12:22 +0000 |
---|---|---|
committer | tb <> | 2023-06-13 09:12:22 +0000 |
commit | c83852c11b8675efa6930be4e17c9743d2cfda4d (patch) | |
tree | 68cbd584fbcb27b812b5a084b2a27e56cb81ab42 /src | |
parent | 68db0cd7592a548f310f8037c0ba78583d91e3c9 (diff) | |
download | openbsd-c83852c11b8675efa6930be4e17c9743d2cfda4d.tar.gz openbsd-c83852c11b8675efa6930be4e17c9743d2cfda4d.tar.bz2 openbsd-c83852c11b8675efa6930be4e17c9743d2cfda4d.zip |
Add a BN_R_INVALID_ARGUMENT error code
One problem with OpenSSL error codes is that they tend to be too specific
(another problem is that they are extremely ugly). So add an EINVAL-style
error code. This will be used in an upcoming commit to disallow aliasing
of the 'return value' with the modulus in BN_mod_* functions and should
be applicable elsewhere, outside of this one narrow use case.
ok jsing
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/bn/bn.h | 3 | ||||
-rw-r--r-- | src/lib/libcrypto/bn/bn_err.c | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/libcrypto/bn/bn.h b/src/lib/libcrypto/bn/bn.h index 386f8dff8d..7dc138d170 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.71 2023/04/27 06:48:47 tb Exp $ */ | 1 | /* $OpenBSD: bn.h,v 1.72 2023/06/13 09:12:22 tb 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 | * |
@@ -547,6 +547,7 @@ void ERR_load_BN_strings(void); | |||
547 | #define BN_R_ENCODING_ERROR 104 | 547 | #define BN_R_ENCODING_ERROR 104 |
548 | #define BN_R_EXPAND_ON_STATIC_BIGNUM_DATA 105 | 548 | #define BN_R_EXPAND_ON_STATIC_BIGNUM_DATA 105 |
549 | #define BN_R_INPUT_NOT_REDUCED 110 | 549 | #define BN_R_INPUT_NOT_REDUCED 110 |
550 | #define BN_R_INVALID_ARGUMENT 118 | ||
550 | #define BN_R_INVALID_LENGTH 106 | 551 | #define BN_R_INVALID_LENGTH 106 |
551 | #define BN_R_INVALID_RANGE 115 | 552 | #define BN_R_INVALID_RANGE 115 |
552 | #define BN_R_NOT_A_SQUARE 111 | 553 | #define BN_R_NOT_A_SQUARE 111 |
diff --git a/src/lib/libcrypto/bn/bn_err.c b/src/lib/libcrypto/bn/bn_err.c index 592c509416..b861ea9374 100644 --- a/src/lib/libcrypto/bn/bn_err.c +++ b/src/lib/libcrypto/bn/bn_err.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bn_err.c,v 1.15 2022/07/12 14:42:48 kn Exp $ */ | 1 | /* $OpenBSD: bn_err.c,v 1.16 2023/06/13 09:12:22 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -80,6 +80,7 @@ static ERR_STRING_DATA BN_str_reasons[]= { | |||
80 | {ERR_REASON(BN_R_ENCODING_ERROR) , "encoding error"}, | 80 | {ERR_REASON(BN_R_ENCODING_ERROR) , "encoding error"}, |
81 | {ERR_REASON(BN_R_EXPAND_ON_STATIC_BIGNUM_DATA), "expand on static bignum data"}, | 81 | {ERR_REASON(BN_R_EXPAND_ON_STATIC_BIGNUM_DATA), "expand on static bignum data"}, |
82 | {ERR_REASON(BN_R_INPUT_NOT_REDUCED) , "input not reduced"}, | 82 | {ERR_REASON(BN_R_INPUT_NOT_REDUCED) , "input not reduced"}, |
83 | {ERR_REASON(BN_R_INVALID_ARGUMENT) , "invalid argument"}, | ||
83 | {ERR_REASON(BN_R_INVALID_LENGTH) , "invalid length"}, | 84 | {ERR_REASON(BN_R_INVALID_LENGTH) , "invalid length"}, |
84 | {ERR_REASON(BN_R_INVALID_RANGE) , "invalid range"}, | 85 | {ERR_REASON(BN_R_INVALID_RANGE) , "invalid range"}, |
85 | {ERR_REASON(BN_R_NOT_A_SQUARE) , "not a square"}, | 86 | {ERR_REASON(BN_R_NOT_A_SQUARE) , "not a square"}, |