diff options
Diffstat (limited to 'src/lib/libcrypto/evp/digest.c')
| -rw-r--r-- | src/lib/libcrypto/evp/digest.c | 28 |
1 files changed, 1 insertions, 27 deletions
diff --git a/src/lib/libcrypto/evp/digest.c b/src/lib/libcrypto/evp/digest.c index 467e6b5ae9..982ba2b136 100644 --- a/src/lib/libcrypto/evp/digest.c +++ b/src/lib/libcrypto/evp/digest.c | |||
| @@ -117,10 +117,6 @@ | |||
| 117 | #include <openssl/engine.h> | 117 | #include <openssl/engine.h> |
| 118 | #endif | 118 | #endif |
| 119 | 119 | ||
| 120 | #ifdef OPENSSL_FIPS | ||
| 121 | #include <openssl/fips.h> | ||
| 122 | #endif | ||
| 123 | |||
| 124 | void EVP_MD_CTX_init(EVP_MD_CTX *ctx) | 120 | void EVP_MD_CTX_init(EVP_MD_CTX *ctx) |
| 125 | { | 121 | { |
| 126 | memset(ctx,'\0',sizeof *ctx); | 122 | memset(ctx,'\0',sizeof *ctx); |
| @@ -229,26 +225,12 @@ skip_to_init: | |||
| 229 | } | 225 | } |
| 230 | if (ctx->flags & EVP_MD_CTX_FLAG_NO_INIT) | 226 | if (ctx->flags & EVP_MD_CTX_FLAG_NO_INIT) |
| 231 | return 1; | 227 | return 1; |
| 232 | #ifdef OPENSSL_FIPS | ||
| 233 | if (FIPS_mode()) | ||
| 234 | { | ||
| 235 | if (FIPS_digestinit(ctx, type)) | ||
| 236 | return 1; | ||
| 237 | OPENSSL_free(ctx->md_data); | ||
| 238 | ctx->md_data = NULL; | ||
| 239 | return 0; | ||
| 240 | } | ||
| 241 | #endif | ||
| 242 | return ctx->digest->init(ctx); | 228 | return ctx->digest->init(ctx); |
| 243 | } | 229 | } |
| 244 | 230 | ||
| 245 | int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *data, size_t count) | 231 | int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *data, size_t count) |
| 246 | { | 232 | { |
| 247 | #ifdef OPENSSL_FIPS | ||
| 248 | return FIPS_digestupdate(ctx, data, count); | ||
| 249 | #else | ||
| 250 | return ctx->update(ctx,data,count); | 233 | return ctx->update(ctx,data,count); |
| 251 | #endif | ||
| 252 | } | 234 | } |
| 253 | 235 | ||
| 254 | /* The caller can assume that this removes any secret data from the context */ | 236 | /* The caller can assume that this removes any secret data from the context */ |
| @@ -263,10 +245,8 @@ int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *size) | |||
| 263 | /* The caller can assume that this removes any secret data from the context */ | 245 | /* The caller can assume that this removes any secret data from the context */ |
| 264 | int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *size) | 246 | int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *size) |
| 265 | { | 247 | { |
| 266 | #ifdef OPENSSL_FIPS | ||
| 267 | return FIPS_digestfinal(ctx, md, size); | ||
| 268 | #else | ||
| 269 | int ret; | 248 | int ret; |
| 249 | |||
| 270 | OPENSSL_assert(ctx->digest->md_size <= EVP_MAX_MD_SIZE); | 250 | OPENSSL_assert(ctx->digest->md_size <= EVP_MAX_MD_SIZE); |
| 271 | ret=ctx->digest->final(ctx,md); | 251 | ret=ctx->digest->final(ctx,md); |
| 272 | if (size != NULL) | 252 | if (size != NULL) |
| @@ -278,7 +258,6 @@ int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *size) | |||
| 278 | } | 258 | } |
| 279 | memset(ctx->md_data,0,ctx->digest->ctx_size); | 259 | memset(ctx->md_data,0,ctx->digest->ctx_size); |
| 280 | return ret; | 260 | return ret; |
| 281 | #endif | ||
| 282 | } | 261 | } |
| 283 | 262 | ||
| 284 | int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in) | 263 | int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in) |
| @@ -372,7 +351,6 @@ void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx) | |||
| 372 | /* This call frees resources associated with the context */ | 351 | /* This call frees resources associated with the context */ |
| 373 | int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx) | 352 | int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx) |
| 374 | { | 353 | { |
| 375 | #ifndef OPENSSL_FIPS | ||
| 376 | /* Don't assume ctx->md_data was cleaned in EVP_Digest_Final, | 354 | /* Don't assume ctx->md_data was cleaned in EVP_Digest_Final, |
| 377 | * because sometimes only copies of the context are ever finalised. | 355 | * because sometimes only copies of the context are ever finalised. |
| 378 | */ | 356 | */ |
| @@ -385,7 +363,6 @@ int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx) | |||
| 385 | OPENSSL_cleanse(ctx->md_data,ctx->digest->ctx_size); | 363 | OPENSSL_cleanse(ctx->md_data,ctx->digest->ctx_size); |
| 386 | OPENSSL_free(ctx->md_data); | 364 | OPENSSL_free(ctx->md_data); |
| 387 | } | 365 | } |
| 388 | #endif | ||
| 389 | if (ctx->pctx) | 366 | if (ctx->pctx) |
| 390 | EVP_PKEY_CTX_free(ctx->pctx); | 367 | EVP_PKEY_CTX_free(ctx->pctx); |
| 391 | #ifndef OPENSSL_NO_ENGINE | 368 | #ifndef OPENSSL_NO_ENGINE |
| @@ -394,9 +371,6 @@ int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx) | |||
| 394 | * functional reference we held for this reason. */ | 371 | * functional reference we held for this reason. */ |
| 395 | ENGINE_finish(ctx->engine); | 372 | ENGINE_finish(ctx->engine); |
| 396 | #endif | 373 | #endif |
| 397 | #ifdef OPENSSL_FIPS | ||
| 398 | FIPS_md_ctx_cleanup(ctx); | ||
| 399 | #endif | ||
| 400 | memset(ctx,'\0',sizeof *ctx); | 374 | memset(ctx,'\0',sizeof *ctx); |
| 401 | 375 | ||
| 402 | return 1; | 376 | return 1; |
