diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/sha/sha512.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/lib/libcrypto/sha/sha512.c b/src/lib/libcrypto/sha/sha512.c index 987fc07c99..f5ed468b85 100644 --- a/src/lib/libcrypto/sha/sha512.c +++ b/src/lib/libcrypto/sha/sha512.c | |||
| @@ -5,6 +5,10 @@ | |||
| 5 | * ==================================================================== | 5 | * ==================================================================== |
| 6 | */ | 6 | */ |
| 7 | #include <openssl/opensslconf.h> | 7 | #include <openssl/opensslconf.h> |
| 8 | #ifdef OPENSSL_FIPS | ||
| 9 | #include <openssl/fips.h> | ||
| 10 | #endif | ||
| 11 | |||
| 8 | #if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA512) | 12 | #if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA512) |
| 9 | /* | 13 | /* |
| 10 | * IMPLEMENTATION NOTES. | 14 | * IMPLEMENTATION NOTES. |
| @@ -61,6 +65,9 @@ const char SHA512_version[]="SHA-512" OPENSSL_VERSION_PTEXT; | |||
| 61 | 65 | ||
| 62 | int SHA384_Init (SHA512_CTX *c) | 66 | int SHA384_Init (SHA512_CTX *c) |
| 63 | { | 67 | { |
| 68 | #ifdef OPENSSL_FIPS | ||
| 69 | FIPS_selftest_check(); | ||
| 70 | #endif | ||
| 64 | c->h[0]=U64(0xcbbb9d5dc1059ed8); | 71 | c->h[0]=U64(0xcbbb9d5dc1059ed8); |
| 65 | c->h[1]=U64(0x629a292a367cd507); | 72 | c->h[1]=U64(0x629a292a367cd507); |
| 66 | c->h[2]=U64(0x9159015a3070dd17); | 73 | c->h[2]=U64(0x9159015a3070dd17); |
| @@ -76,6 +83,9 @@ int SHA384_Init (SHA512_CTX *c) | |||
| 76 | 83 | ||
| 77 | int SHA512_Init (SHA512_CTX *c) | 84 | int SHA512_Init (SHA512_CTX *c) |
| 78 | { | 85 | { |
| 86 | #ifdef OPENSSL_FIPS | ||
| 87 | FIPS_selftest_check(); | ||
| 88 | #endif | ||
| 79 | c->h[0]=U64(0x6a09e667f3bcc908); | 89 | c->h[0]=U64(0x6a09e667f3bcc908); |
| 80 | c->h[1]=U64(0xbb67ae8584caa73b); | 90 | c->h[1]=U64(0xbb67ae8584caa73b); |
| 81 | c->h[2]=U64(0x3c6ef372fe94f82b); | 91 | c->h[2]=U64(0x3c6ef372fe94f82b); |
| @@ -327,7 +337,7 @@ static const SHA_LONG64 K512[80] = { | |||
| 327 | ((SHA_LONG64)hi)<<32|lo; }) | 337 | ((SHA_LONG64)hi)<<32|lo; }) |
| 328 | # else | 338 | # else |
| 329 | # define PULL64(x) ({ const unsigned int *p=(const unsigned int *)(&(x));\ | 339 | # define PULL64(x) ({ const unsigned int *p=(const unsigned int *)(&(x));\ |
| 330 | unsigned int hi=p[0],lo=p[1]; \ | 340 | unsigned int hi=p[0],lo=p[1]; \ |
| 331 | asm ("bswapl %0; bswapl %1;" \ | 341 | asm ("bswapl %0; bswapl %1;" \ |
| 332 | : "=r"(lo),"=r"(hi) \ | 342 | : "=r"(lo),"=r"(hi) \ |
| 333 | : "0"(lo),"1"(hi)); \ | 343 | : "0"(lo),"1"(hi)); \ |
