diff options
author | jsing <> | 2015-09-13 11:49:44 +0000 |
---|---|---|
committer | jsing <> | 2015-09-13 11:49:44 +0000 |
commit | 21654feacf896dbd0001798f2c549c31b9974412 (patch) | |
tree | 26ad5794d56d0f5b57b98ae4229d0178ef464bb9 /src/lib/libcrypto/ecdh/ech_err.c | |
parent | 647e0b210017623cf0a87fdbeee7d38a16907ec3 (diff) | |
download | openbsd-21654feacf896dbd0001798f2c549c31b9974412.tar.gz openbsd-21654feacf896dbd0001798f2c549c31b9974412.tar.bz2 openbsd-21654feacf896dbd0001798f2c549c31b9974412.zip |
Check ECDH output buffer length and avoid truncation.
Currently, if you call ECDH_compute_key() it will silently truncate the
resulting key if the output buffer is less than the key size. Instead,
detect this condition and return an error. If the buffer provided is larger
than the key length, zero the remainder.
ok beck@ miod@ "+ shivers"
Diffstat (limited to 'src/lib/libcrypto/ecdh/ech_err.c')
-rw-r--r-- | src/lib/libcrypto/ecdh/ech_err.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib/libcrypto/ecdh/ech_err.c b/src/lib/libcrypto/ecdh/ech_err.c index 2899b573c3..afe5ff3af8 100644 --- a/src/lib/libcrypto/ecdh/ech_err.c +++ b/src/lib/libcrypto/ecdh/ech_err.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ech_err.c,v 1.4 2015/09/13 10:46:20 jsing Exp $ */ | 1 | /* $OpenBSD: ech_err.c,v 1.5 2015/09/13 11:49:44 jsing Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -80,6 +80,7 @@ static ERR_STRING_DATA ECDH_str_functs[]= { | |||
80 | 80 | ||
81 | static ERR_STRING_DATA ECDH_str_reasons[]= { | 81 | static ERR_STRING_DATA ECDH_str_reasons[]= { |
82 | {ERR_REASON(ECDH_R_KDF_FAILED) , "KDF failed"}, | 82 | {ERR_REASON(ECDH_R_KDF_FAILED) , "KDF failed"}, |
83 | {ERR_REASON(ECDH_R_KEY_TRUNCATION), "key would be truncated"}, | ||
83 | {ERR_REASON(ECDH_R_NON_FIPS_METHOD) , "non fips method"}, | 84 | {ERR_REASON(ECDH_R_NON_FIPS_METHOD) , "non fips method"}, |
84 | {ERR_REASON(ECDH_R_NO_PRIVATE_VALUE) , "no private value"}, | 85 | {ERR_REASON(ECDH_R_NO_PRIVATE_VALUE) , "no private value"}, |
85 | {ERR_REASON(ECDH_R_POINT_ARITHMETIC_FAILURE), "point arithmetic failure"}, | 86 | {ERR_REASON(ECDH_R_POINT_ARITHMETIC_FAILURE), "point arithmetic failure"}, |