diff options
Diffstat (limited to 'src/lib/libcrypto/evp/m_sha1.c')
-rw-r--r-- | src/lib/libcrypto/evp/m_sha1.c | 46 |
1 files changed, 18 insertions, 28 deletions
diff --git a/src/lib/libcrypto/evp/m_sha1.c b/src/lib/libcrypto/evp/m_sha1.c index 60da93873c..4679b1c463 100644 --- a/src/lib/libcrypto/evp/m_sha1.c +++ b/src/lib/libcrypto/evp/m_sha1.c | |||
@@ -56,25 +56,23 @@ | |||
56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
57 | */ | 57 | */ |
58 | 58 | ||
59 | #ifndef OPENSSL_NO_SHA | ||
60 | #include <stdio.h> | 59 | #include <stdio.h> |
61 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
61 | |||
62 | #ifndef OPENSSL_NO_SHA | ||
63 | |||
62 | #include <openssl/evp.h> | 64 | #include <openssl/evp.h> |
63 | #include <openssl/objects.h> | 65 | #include <openssl/objects.h> |
64 | #include <openssl/x509.h> | 66 | #include <openssl/x509.h> |
67 | #ifndef OPENSSL_NO_RSA | ||
68 | #include <openssl/rsa.h> | ||
69 | #endif | ||
65 | 70 | ||
66 | static int init(EVP_MD_CTX *ctx) | 71 | static int init(EVP_MD_CTX *ctx) |
67 | { return SHA1_Init(ctx->md_data); } | 72 | { return SHA1_Init(ctx->md_data); } |
68 | 73 | ||
69 | static int update(EVP_MD_CTX *ctx,const void *data,unsigned long count) | 74 | static int update(EVP_MD_CTX *ctx,const void *data,size_t count) |
70 | #ifndef OPENSSL_FIPS | ||
71 | { return SHA1_Update(ctx->md_data,data,count); } | 75 | { return SHA1_Update(ctx->md_data,data,count); } |
72 | #else | ||
73 | { | ||
74 | OPENSSL_assert(sizeof(count)<=sizeof(size_t)); | ||
75 | return SHA1_Update(ctx->md_data,data,count); | ||
76 | } | ||
77 | #endif | ||
78 | 76 | ||
79 | static int final(EVP_MD_CTX *ctx,unsigned char *md) | 77 | static int final(EVP_MD_CTX *ctx,unsigned char *md) |
80 | { return SHA1_Final(md,ctx->md_data); } | 78 | { return SHA1_Final(md,ctx->md_data); } |
@@ -84,7 +82,7 @@ static const EVP_MD sha1_md= | |||
84 | NID_sha1, | 82 | NID_sha1, |
85 | NID_sha1WithRSAEncryption, | 83 | NID_sha1WithRSAEncryption, |
86 | SHA_DIGEST_LENGTH, | 84 | SHA_DIGEST_LENGTH, |
87 | EVP_MD_FLAG_FIPS, | 85 | 0, |
88 | init, | 86 | init, |
89 | update, | 87 | update, |
90 | final, | 88 | final, |
@@ -101,7 +99,6 @@ const EVP_MD *EVP_sha1(void) | |||
101 | } | 99 | } |
102 | #endif | 100 | #endif |
103 | 101 | ||
104 | #ifdef OPENSSL_FIPS | ||
105 | #ifndef OPENSSL_NO_SHA256 | 102 | #ifndef OPENSSL_NO_SHA256 |
106 | static int init224(EVP_MD_CTX *ctx) | 103 | static int init224(EVP_MD_CTX *ctx) |
107 | { return SHA224_Init(ctx->md_data); } | 104 | { return SHA224_Init(ctx->md_data); } |
@@ -112,11 +109,8 @@ static int init256(EVP_MD_CTX *ctx) | |||
112 | * SHA256 functions even in SHA224 context. This is what happens | 109 | * SHA256 functions even in SHA224 context. This is what happens |
113 | * there anyway, so we can spare few CPU cycles:-) | 110 | * there anyway, so we can spare few CPU cycles:-) |
114 | */ | 111 | */ |
115 | static int update256(EVP_MD_CTX *ctx,const void *data,unsigned long count) | 112 | static int update256(EVP_MD_CTX *ctx,const void *data,size_t count) |
116 | { | 113 | { return SHA256_Update(ctx->md_data,data,count); } |
117 | OPENSSL_assert(sizeof(count)<=sizeof(size_t)); | ||
118 | return SHA256_Update(ctx->md_data,data,count); | ||
119 | } | ||
120 | static int final256(EVP_MD_CTX *ctx,unsigned char *md) | 114 | static int final256(EVP_MD_CTX *ctx,unsigned char *md) |
121 | { return SHA256_Final(md,ctx->md_data); } | 115 | { return SHA256_Final(md,ctx->md_data); } |
122 | 116 | ||
@@ -125,7 +119,7 @@ static const EVP_MD sha224_md= | |||
125 | NID_sha224, | 119 | NID_sha224, |
126 | NID_sha224WithRSAEncryption, | 120 | NID_sha224WithRSAEncryption, |
127 | SHA224_DIGEST_LENGTH, | 121 | SHA224_DIGEST_LENGTH, |
128 | EVP_MD_FLAG_FIPS, | 122 | 0, |
129 | init224, | 123 | init224, |
130 | update256, | 124 | update256, |
131 | final256, | 125 | final256, |
@@ -144,7 +138,7 @@ static const EVP_MD sha256_md= | |||
144 | NID_sha256, | 138 | NID_sha256, |
145 | NID_sha256WithRSAEncryption, | 139 | NID_sha256WithRSAEncryption, |
146 | SHA256_DIGEST_LENGTH, | 140 | SHA256_DIGEST_LENGTH, |
147 | EVP_MD_FLAG_FIPS, | 141 | 0, |
148 | init256, | 142 | init256, |
149 | update256, | 143 | update256, |
150 | final256, | 144 | final256, |
@@ -157,7 +151,7 @@ static const EVP_MD sha256_md= | |||
157 | 151 | ||
158 | const EVP_MD *EVP_sha256(void) | 152 | const EVP_MD *EVP_sha256(void) |
159 | { return(&sha256_md); } | 153 | { return(&sha256_md); } |
160 | #endif /* ifndef OPENSSL_NO_SHA256 */ | 154 | #endif /* ifndef OPENSSL_NO_SHA256 */ |
161 | 155 | ||
162 | #ifndef OPENSSL_NO_SHA512 | 156 | #ifndef OPENSSL_NO_SHA512 |
163 | static int init384(EVP_MD_CTX *ctx) | 157 | static int init384(EVP_MD_CTX *ctx) |
@@ -165,11 +159,8 @@ static int init384(EVP_MD_CTX *ctx) | |||
165 | static int init512(EVP_MD_CTX *ctx) | 159 | static int init512(EVP_MD_CTX *ctx) |
166 | { return SHA512_Init(ctx->md_data); } | 160 | { return SHA512_Init(ctx->md_data); } |
167 | /* See comment in SHA224/256 section */ | 161 | /* See comment in SHA224/256 section */ |
168 | static int update512(EVP_MD_CTX *ctx,const void *data,unsigned long count) | 162 | static int update512(EVP_MD_CTX *ctx,const void *data,size_t count) |
169 | { | 163 | { return SHA512_Update(ctx->md_data,data,count); } |
170 | OPENSSL_assert(sizeof(count)<=sizeof(size_t)); | ||
171 | return SHA512_Update(ctx->md_data,data,count); | ||
172 | } | ||
173 | static int final512(EVP_MD_CTX *ctx,unsigned char *md) | 164 | static int final512(EVP_MD_CTX *ctx,unsigned char *md) |
174 | { return SHA512_Final(md,ctx->md_data); } | 165 | { return SHA512_Final(md,ctx->md_data); } |
175 | 166 | ||
@@ -178,7 +169,7 @@ static const EVP_MD sha384_md= | |||
178 | NID_sha384, | 169 | NID_sha384, |
179 | NID_sha384WithRSAEncryption, | 170 | NID_sha384WithRSAEncryption, |
180 | SHA384_DIGEST_LENGTH, | 171 | SHA384_DIGEST_LENGTH, |
181 | EVP_MD_FLAG_FIPS, | 172 | 0, |
182 | init384, | 173 | init384, |
183 | update512, | 174 | update512, |
184 | final512, | 175 | final512, |
@@ -197,7 +188,7 @@ static const EVP_MD sha512_md= | |||
197 | NID_sha512, | 188 | NID_sha512, |
198 | NID_sha512WithRSAEncryption, | 189 | NID_sha512WithRSAEncryption, |
199 | SHA512_DIGEST_LENGTH, | 190 | SHA512_DIGEST_LENGTH, |
200 | EVP_MD_FLAG_FIPS, | 191 | 0, |
201 | init512, | 192 | init512, |
202 | update512, | 193 | update512, |
203 | final512, | 194 | final512, |
@@ -210,5 +201,4 @@ static const EVP_MD sha512_md= | |||
210 | 201 | ||
211 | const EVP_MD *EVP_sha512(void) | 202 | const EVP_MD *EVP_sha512(void) |
212 | { return(&sha512_md); } | 203 | { return(&sha512_md); } |
213 | #endif /* ifndef OPENSSL_NO_SHA512 */ | 204 | #endif /* ifndef OPENSSL_NO_SHA512 */ |
214 | #endif /* ifdef OPENSSL_FIPS */ | ||