diff options
| author | jsing <> | 2015-09-13 11:49:44 +0000 |
|---|---|---|
| committer | jsing <> | 2015-09-13 11:49:44 +0000 |
| commit | aa9790509fcdc9b7899a04af0eddf1b611899d0f (patch) | |
| tree | 26ad5794d56d0f5b57b98ae4229d0178ef464bb9 /src/lib/libcrypto/ecdh/ecdh.h | |
| parent | 955ad6f28695c5e5f8ae286a391cfd51835eaa2c (diff) | |
| download | openbsd-aa9790509fcdc9b7899a04af0eddf1b611899d0f.tar.gz openbsd-aa9790509fcdc9b7899a04af0eddf1b611899d0f.tar.bz2 openbsd-aa9790509fcdc9b7899a04af0eddf1b611899d0f.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/ecdh.h')
| -rw-r--r-- | src/lib/libcrypto/ecdh/ecdh.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib/libcrypto/ecdh/ecdh.h b/src/lib/libcrypto/ecdh/ecdh.h index 3bcb8b045e..e1cc8404d0 100644 --- a/src/lib/libcrypto/ecdh/ecdh.h +++ b/src/lib/libcrypto/ecdh/ecdh.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ecdh.h,v 1.3 2015/09/13 10:46:20 jsing Exp $ */ | 1 | /* $OpenBSD: ecdh.h,v 1.4 2015/09/13 11:49:44 jsing Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. |
| 4 | * | 4 | * |
| @@ -116,6 +116,7 @@ void ERR_load_ECDH_strings(void); | |||
| 116 | 116 | ||
| 117 | /* Reason codes. */ | 117 | /* Reason codes. */ |
| 118 | #define ECDH_R_KDF_FAILED 102 | 118 | #define ECDH_R_KDF_FAILED 102 |
| 119 | #define ECDH_R_KEY_TRUNCATION 104 | ||
| 119 | #define ECDH_R_NON_FIPS_METHOD 103 | 120 | #define ECDH_R_NON_FIPS_METHOD 103 |
| 120 | #define ECDH_R_NO_PRIVATE_VALUE 100 | 121 | #define ECDH_R_NO_PRIVATE_VALUE 100 |
| 121 | #define ECDH_R_POINT_ARITHMETIC_FAILURE 101 | 122 | #define ECDH_R_POINT_ARITHMETIC_FAILURE 101 |
