diff options
author | djm <> | 2009-01-09 12:14:11 +0000 |
---|---|---|
committer | djm <> | 2009-01-09 12:14:11 +0000 |
commit | 30562050421d947c3eb3c10edde6e87730b17471 (patch) | |
tree | a92ed8bb9450f2391bf3955cbfb87d5f3cf9e051 /src/lib/libcrypto/sha | |
parent | d895739bce8a14b03d66ef79acb062db0e1d7b41 (diff) | |
parent | a0fdc9ec41594852f67ec77dfad9cb06bacc4186 (diff) | |
download | openbsd-30562050421d947c3eb3c10edde6e87730b17471.tar.gz openbsd-30562050421d947c3eb3c10edde6e87730b17471.tar.bz2 openbsd-30562050421d947c3eb3c10edde6e87730b17471.zip |
This commit was generated by cvs2git to track changes on a CVS vendor
branch.
Diffstat (limited to 'src/lib/libcrypto/sha')
-rw-r--r-- | src/lib/libcrypto/sha/sha256.c | 10 | ||||
-rw-r--r-- | src/lib/libcrypto/sha/sha512.c | 12 |
2 files changed, 21 insertions, 1 deletions
diff --git a/src/lib/libcrypto/sha/sha256.c b/src/lib/libcrypto/sha/sha256.c index 867f90cc97..3256a83e98 100644 --- a/src/lib/libcrypto/sha/sha256.c +++ b/src/lib/libcrypto/sha/sha256.c | |||
@@ -12,12 +12,19 @@ | |||
12 | 12 | ||
13 | #include <openssl/crypto.h> | 13 | #include <openssl/crypto.h> |
14 | #include <openssl/sha.h> | 14 | #include <openssl/sha.h> |
15 | #ifdef OPENSSL_FIPS | ||
16 | #include <openssl/fips.h> | ||
17 | #endif | ||
18 | |||
15 | #include <openssl/opensslv.h> | 19 | #include <openssl/opensslv.h> |
16 | 20 | ||
17 | const char SHA256_version[]="SHA-256" OPENSSL_VERSION_PTEXT; | 21 | const char SHA256_version[]="SHA-256" OPENSSL_VERSION_PTEXT; |
18 | 22 | ||
19 | int SHA224_Init (SHA256_CTX *c) | 23 | int SHA224_Init (SHA256_CTX *c) |
20 | { | 24 | { |
25 | #ifdef OPENSSL_FIPS | ||
26 | FIPS_selftest_check(); | ||
27 | #endif | ||
21 | c->h[0]=0xc1059ed8UL; c->h[1]=0x367cd507UL; | 28 | c->h[0]=0xc1059ed8UL; c->h[1]=0x367cd507UL; |
22 | c->h[2]=0x3070dd17UL; c->h[3]=0xf70e5939UL; | 29 | c->h[2]=0x3070dd17UL; c->h[3]=0xf70e5939UL; |
23 | c->h[4]=0xffc00b31UL; c->h[5]=0x68581511UL; | 30 | c->h[4]=0xffc00b31UL; c->h[5]=0x68581511UL; |
@@ -29,6 +36,9 @@ int SHA224_Init (SHA256_CTX *c) | |||
29 | 36 | ||
30 | int SHA256_Init (SHA256_CTX *c) | 37 | int SHA256_Init (SHA256_CTX *c) |
31 | { | 38 | { |
39 | #ifdef OPENSSL_FIPS | ||
40 | FIPS_selftest_check(); | ||
41 | #endif | ||
32 | c->h[0]=0x6a09e667UL; c->h[1]=0xbb67ae85UL; | 42 | c->h[0]=0x6a09e667UL; c->h[1]=0xbb67ae85UL; |
33 | c->h[2]=0x3c6ef372UL; c->h[3]=0xa54ff53aUL; | 43 | c->h[2]=0x3c6ef372UL; c->h[3]=0xa54ff53aUL; |
34 | c->h[4]=0x510e527fUL; c->h[5]=0x9b05688cUL; | 44 | c->h[4]=0x510e527fUL; c->h[5]=0x9b05688cUL; |
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)); \ |