diff options
author | David Benjamin <davidben@chromium.org> | 2015-11-14 19:57:11 +0300 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2015-11-17 02:18:00 +0300 |
commit | 2077cf915283d6a2292d6114f131dd5af124b1b0 (patch) | |
tree | 072e2269928d1eb6903f6db0e942e705cff02c86 /crypto/sha | |
parent | af07365b498b4cf183493a86dcfd768b3a5e8eaa (diff) |
Use UINT64_C instead of OPENSSL_U64.
stdint.h already has macros for this. The spec says that, in C++,
__STDC_CONSTANT_MACROS is needed, so define it for bytestring_test.cc.
Chromium seems to use these macros without trouble, so I'm assuming we
can rely on them.
Change-Id: I56d178689b44d22c6379911bbb93d3b01dd832a3
Reviewed-on: https://boringssl-review.googlesource.com/6510
Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto/sha')
-rw-r--r-- | crypto/sha/sha512.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/crypto/sha/sha512.c b/crypto/sha/sha512.c index beb0f8c8..6300f69f 100644 --- a/crypto/sha/sha512.c +++ b/crypto/sha/sha512.c @@ -60,8 +60,6 @@ #include <openssl/mem.h> -#include "../internal.h" - /* IMPLEMENTATION NOTES. * @@ -87,14 +85,14 @@ #endif int SHA384_Init(SHA512_CTX *sha) { - sha->h[0] = OPENSSL_U64(0xcbbb9d5dc1059ed8); - sha->h[1] = OPENSSL_U64(0x629a292a367cd507); - sha->h[2] = OPENSSL_U64(0x9159015a3070dd17); - sha->h[3] = OPENSSL_U64(0x152fecd8f70e5939); - sha->h[4] = OPENSSL_U64(0x67332667ffc00b31); - sha->h[5] = OPENSSL_U64(0x8eb44a8768581511); - sha->h[6] = OPENSSL_U64(0xdb0c2e0d64f98fa7); - sha->h[7] = OPENSSL_U64(0x47b5481dbefa4fa4); + sha->h[0] = UINT64_C(0xcbbb9d5dc1059ed8); + sha->h[1] = UINT64_C(0x629a292a367cd507); + sha->h[2] = UINT64_C(0x9159015a3070dd17); + sha->h[3] = UINT64_C(0x152fecd8f70e5939); + sha->h[4] = UINT64_C(0x67332667ffc00b31); + sha->h[5] = UINT64_C(0x8eb44a8768581511); + sha->h[6] = UINT64_C(0xdb0c2e0d64f98fa7); + sha->h[7] = UINT64_C(0x47b5481dbefa4fa4); sha->Nl = 0; sha->Nh = 0; @@ -105,14 +103,14 @@ int SHA384_Init(SHA512_CTX *sha) { int SHA512_Init(SHA512_CTX *sha) { - sha->h[0] = OPENSSL_U64(0x6a09e667f3bcc908); - sha->h[1] = OPENSSL_U64(0xbb67ae8584caa73b); - sha->h[2] = OPENSSL_U64(0x3c6ef372fe94f82b); - sha->h[3] = OPENSSL_U64(0xa54ff53a5f1d36f1); - sha->h[4] = OPENSSL_U64(0x510e527fade682d1); - sha->h[5] = OPENSSL_U64(0x9b05688c2b3e6c1f); - sha->h[6] = OPENSSL_U64(0x1f83d9abfb41bd6b); - sha->h[7] = OPENSSL_U64(0x5be0cd19137e2179); + sha->h[0] = UINT64_C(0x6a09e667f3bcc908); + sha->h[1] = UINT64_C(0xbb67ae8584caa73b); + sha->h[2] = UINT64_C(0x3c6ef372fe94f82b); + sha->h[3] = UINT64_C(0xa54ff53a5f1d36f1); + sha->h[4] = UINT64_C(0x510e527fade682d1); + sha->h[5] = UINT64_C(0x9b05688c2b3e6c1f); + sha->h[6] = UINT64_C(0x1f83d9abfb41bd6b); + sha->h[7] = UINT64_C(0x5be0cd19137e2179); sha->Nl = 0; sha->Nh = 0; @@ -185,7 +183,7 @@ int SHA512_Update(SHA512_CTX *c, const void *in_data, size_t len) { return 1; } - l = (c->Nl + (((uint64_t)len) << 3)) & OPENSSL_U64(0xffffffffffffffff); + l = (c->Nl + (((uint64_t)len) << 3)) & UINT64_C(0xffffffffffffffff); if (l < c->Nl) { c->Nh++; } |