diff options
| author | bcook <> | 2016-07-17 21:21:40 +0000 |
|---|---|---|
| committer | bcook <> | 2016-07-17 21:21:40 +0000 |
| commit | fdee4729e12ac97473d08c1a7e9d17c5468fe82c (patch) | |
| tree | d641199492f3d6ad5b328a633518dd06ae8a1d28 | |
| parent | 00c5500ecd078240623477d09383d42a2d706a69 (diff) | |
| download | openbsd-fdee4729e12ac97473d08c1a7e9d17c5468fe82c.tar.gz openbsd-fdee4729e12ac97473d08c1a7e9d17c5468fe82c.tar.bz2 openbsd-fdee4729e12ac97473d08c1a7e9d17c5468fe82c.zip | |
Initialize buffers before use, noted by Kinichiro Inoguchi.
ok beck@
| -rw-r--r-- | src/lib/libcrypto/bn/bn_nist.c | 14 | ||||
| -rw-r--r-- | src/lib/libssl/src/crypto/bn/bn_nist.c | 14 |
2 files changed, 14 insertions, 14 deletions
diff --git a/src/lib/libcrypto/bn/bn_nist.c b/src/lib/libcrypto/bn/bn_nist.c index 693d6f1ed3..44bf0cb0ce 100644 --- a/src/lib/libcrypto/bn/bn_nist.c +++ b/src/lib/libcrypto/bn/bn_nist.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_nist.c,v 1.15 2014/10/28 07:35:58 jsg Exp $ */ | 1 | /* $OpenBSD: bn_nist.c,v 1.16 2016/07/17 21:21:40 bcook Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Nils Larsch for the OpenSSL project | 3 | * Written by Nils Larsch for the OpenSSL project |
| 4 | */ | 4 | */ |
| @@ -510,7 +510,7 @@ BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, BN_CTX *ctx) | |||
| 510 | } | 510 | } |
| 511 | #else | 511 | #else |
| 512 | { | 512 | { |
| 513 | BN_ULONG t_d[BN_NIST_192_TOP]; | 513 | BN_ULONG t_d[BN_NIST_192_TOP] = {0}; |
| 514 | 514 | ||
| 515 | nist_set_192(t_d, buf.bn, 0, 3, 3); | 515 | nist_set_192(t_d, buf.bn, 0, 3, 3); |
| 516 | carry = (int)bn_add_words(r_d, r_d, t_d, BN_NIST_192_TOP); | 516 | carry = (int)bn_add_words(r_d, r_d, t_d, BN_NIST_192_TOP); |
| @@ -568,7 +568,7 @@ BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, BN_CTX *ctx) | |||
| 568 | BN_ULONG bn[BN_NIST_224_TOP]; | 568 | BN_ULONG bn[BN_NIST_224_TOP]; |
| 569 | unsigned int ui[BN_NIST_224_TOP * | 569 | unsigned int ui[BN_NIST_224_TOP * |
| 570 | sizeof(BN_ULONG) / sizeof(unsigned int)]; | 570 | sizeof(BN_ULONG) / sizeof(unsigned int)]; |
| 571 | } buf; | 571 | } buf = {0}; |
| 572 | BN_ULONG c_d[BN_NIST_224_TOP], *res; | 572 | BN_ULONG c_d[BN_NIST_224_TOP], *res; |
| 573 | uintptr_t mask; | 573 | uintptr_t mask; |
| 574 | union { | 574 | union { |
| @@ -673,7 +673,7 @@ BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, BN_CTX *ctx) | |||
| 673 | } | 673 | } |
| 674 | #else | 674 | #else |
| 675 | { | 675 | { |
| 676 | BN_ULONG t_d[BN_NIST_224_TOP]; | 676 | BN_ULONG t_d[BN_NIST_224_TOP] = {0}; |
| 677 | 677 | ||
| 678 | nist_set_224(t_d, buf.bn, 10, 9, 8, 7, 0, 0, 0); | 678 | nist_set_224(t_d, buf.bn, 10, 9, 8, 7, 0, 0, 0); |
| 679 | carry = (int)bn_add_words(r_d, r_d, t_d, BN_NIST_224_TOP); | 679 | carry = (int)bn_add_words(r_d, r_d, t_d, BN_NIST_224_TOP); |
| @@ -746,7 +746,7 @@ BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, BN_CTX *ctx) | |||
| 746 | unsigned int ui[BN_NIST_256_TOP * | 746 | unsigned int ui[BN_NIST_256_TOP * |
| 747 | sizeof(BN_ULONG) / sizeof(unsigned int)]; | 747 | sizeof(BN_ULONG) / sizeof(unsigned int)]; |
| 748 | } buf; | 748 | } buf; |
| 749 | BN_ULONG c_d[BN_NIST_256_TOP], *res; | 749 | BN_ULONG c_d[BN_NIST_256_TOP] = {0}, *res; |
| 750 | uintptr_t mask; | 750 | uintptr_t mask; |
| 751 | union { | 751 | union { |
| 752 | bn_addsub_f f; | 752 | bn_addsub_f f; |
| @@ -879,7 +879,7 @@ BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, BN_CTX *ctx) | |||
| 879 | } | 879 | } |
| 880 | #else | 880 | #else |
| 881 | { | 881 | { |
| 882 | BN_ULONG t_d[BN_NIST_256_TOP]; | 882 | BN_ULONG t_d[BN_NIST_256_TOP] = {0}; |
| 883 | 883 | ||
| 884 | /*S1*/ | 884 | /*S1*/ |
| 885 | nist_set_256(t_d, buf.bn, 15, 14, 13, 12, 11, 0, 0, 0); | 885 | nist_set_256(t_d, buf.bn, 15, 14, 13, 12, 11, 0, 0, 0); |
| @@ -1133,7 +1133,7 @@ BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, BN_CTX *ctx) | |||
| 1133 | } | 1133 | } |
| 1134 | #else | 1134 | #else |
| 1135 | { | 1135 | { |
| 1136 | BN_ULONG t_d[BN_NIST_384_TOP]; | 1136 | BN_ULONG t_d[BN_NIST_384_TOP] = {0}; |
| 1137 | 1137 | ||
| 1138 | /*S1*/ | 1138 | /*S1*/ |
| 1139 | nist_set_256(t_d, buf.bn, 0, 0, 0, 0, 0, 23 - 4, 22 - 4, | 1139 | nist_set_256(t_d, buf.bn, 0, 0, 0, 0, 0, 23 - 4, 22 - 4, |
diff --git a/src/lib/libssl/src/crypto/bn/bn_nist.c b/src/lib/libssl/src/crypto/bn/bn_nist.c index 693d6f1ed3..44bf0cb0ce 100644 --- a/src/lib/libssl/src/crypto/bn/bn_nist.c +++ b/src/lib/libssl/src/crypto/bn/bn_nist.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_nist.c,v 1.15 2014/10/28 07:35:58 jsg Exp $ */ | 1 | /* $OpenBSD: bn_nist.c,v 1.16 2016/07/17 21:21:40 bcook Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Nils Larsch for the OpenSSL project | 3 | * Written by Nils Larsch for the OpenSSL project |
| 4 | */ | 4 | */ |
| @@ -510,7 +510,7 @@ BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, BN_CTX *ctx) | |||
| 510 | } | 510 | } |
| 511 | #else | 511 | #else |
| 512 | { | 512 | { |
| 513 | BN_ULONG t_d[BN_NIST_192_TOP]; | 513 | BN_ULONG t_d[BN_NIST_192_TOP] = {0}; |
| 514 | 514 | ||
| 515 | nist_set_192(t_d, buf.bn, 0, 3, 3); | 515 | nist_set_192(t_d, buf.bn, 0, 3, 3); |
| 516 | carry = (int)bn_add_words(r_d, r_d, t_d, BN_NIST_192_TOP); | 516 | carry = (int)bn_add_words(r_d, r_d, t_d, BN_NIST_192_TOP); |
| @@ -568,7 +568,7 @@ BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, BN_CTX *ctx) | |||
| 568 | BN_ULONG bn[BN_NIST_224_TOP]; | 568 | BN_ULONG bn[BN_NIST_224_TOP]; |
| 569 | unsigned int ui[BN_NIST_224_TOP * | 569 | unsigned int ui[BN_NIST_224_TOP * |
| 570 | sizeof(BN_ULONG) / sizeof(unsigned int)]; | 570 | sizeof(BN_ULONG) / sizeof(unsigned int)]; |
| 571 | } buf; | 571 | } buf = {0}; |
| 572 | BN_ULONG c_d[BN_NIST_224_TOP], *res; | 572 | BN_ULONG c_d[BN_NIST_224_TOP], *res; |
| 573 | uintptr_t mask; | 573 | uintptr_t mask; |
| 574 | union { | 574 | union { |
| @@ -673,7 +673,7 @@ BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, BN_CTX *ctx) | |||
| 673 | } | 673 | } |
| 674 | #else | 674 | #else |
| 675 | { | 675 | { |
| 676 | BN_ULONG t_d[BN_NIST_224_TOP]; | 676 | BN_ULONG t_d[BN_NIST_224_TOP] = {0}; |
| 677 | 677 | ||
| 678 | nist_set_224(t_d, buf.bn, 10, 9, 8, 7, 0, 0, 0); | 678 | nist_set_224(t_d, buf.bn, 10, 9, 8, 7, 0, 0, 0); |
| 679 | carry = (int)bn_add_words(r_d, r_d, t_d, BN_NIST_224_TOP); | 679 | carry = (int)bn_add_words(r_d, r_d, t_d, BN_NIST_224_TOP); |
| @@ -746,7 +746,7 @@ BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, BN_CTX *ctx) | |||
| 746 | unsigned int ui[BN_NIST_256_TOP * | 746 | unsigned int ui[BN_NIST_256_TOP * |
| 747 | sizeof(BN_ULONG) / sizeof(unsigned int)]; | 747 | sizeof(BN_ULONG) / sizeof(unsigned int)]; |
| 748 | } buf; | 748 | } buf; |
| 749 | BN_ULONG c_d[BN_NIST_256_TOP], *res; | 749 | BN_ULONG c_d[BN_NIST_256_TOP] = {0}, *res; |
| 750 | uintptr_t mask; | 750 | uintptr_t mask; |
| 751 | union { | 751 | union { |
| 752 | bn_addsub_f f; | 752 | bn_addsub_f f; |
| @@ -879,7 +879,7 @@ BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, BN_CTX *ctx) | |||
| 879 | } | 879 | } |
| 880 | #else | 880 | #else |
| 881 | { | 881 | { |
| 882 | BN_ULONG t_d[BN_NIST_256_TOP]; | 882 | BN_ULONG t_d[BN_NIST_256_TOP] = {0}; |
| 883 | 883 | ||
| 884 | /*S1*/ | 884 | /*S1*/ |
| 885 | nist_set_256(t_d, buf.bn, 15, 14, 13, 12, 11, 0, 0, 0); | 885 | nist_set_256(t_d, buf.bn, 15, 14, 13, 12, 11, 0, 0, 0); |
| @@ -1133,7 +1133,7 @@ BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, BN_CTX *ctx) | |||
| 1133 | } | 1133 | } |
| 1134 | #else | 1134 | #else |
| 1135 | { | 1135 | { |
| 1136 | BN_ULONG t_d[BN_NIST_384_TOP]; | 1136 | BN_ULONG t_d[BN_NIST_384_TOP] = {0}; |
| 1137 | 1137 | ||
| 1138 | /*S1*/ | 1138 | /*S1*/ |
| 1139 | nist_set_256(t_d, buf.bn, 0, 0, 0, 0, 0, 23 - 4, 22 - 4, | 1139 | nist_set_256(t_d, buf.bn, 0, 0, 0, 0, 0, 23 - 4, 22 - 4, |
