diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/hmac/hmac.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/src/lib/libcrypto/hmac/hmac.c b/src/lib/libcrypto/hmac/hmac.c index 6c110bd52b..c45e001492 100644 --- a/src/lib/libcrypto/hmac/hmac.c +++ b/src/lib/libcrypto/hmac/hmac.c | |||
| @@ -58,10 +58,8 @@ | |||
| 58 | #include <stdio.h> | 58 | #include <stdio.h> |
| 59 | #include <stdlib.h> | 59 | #include <stdlib.h> |
| 60 | #include <string.h> | 60 | #include <string.h> |
| 61 | #include <openssl/hmac.h> | ||
| 62 | #include "cryptlib.h" | 61 | #include "cryptlib.h" |
| 63 | 62 | #include <openssl/hmac.h> | |
| 64 | #ifndef OPENSSL_FIPS | ||
| 65 | 63 | ||
| 66 | void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, | 64 | void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, |
| 67 | const EVP_MD *md, ENGINE *impl) | 65 | const EVP_MD *md, ENGINE *impl) |
| @@ -81,7 +79,7 @@ void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, | |||
| 81 | { | 79 | { |
| 82 | reset=1; | 80 | reset=1; |
| 83 | j=EVP_MD_block_size(md); | 81 | j=EVP_MD_block_size(md); |
| 84 | OPENSSL_assert(j <= sizeof ctx->key); | 82 | OPENSSL_assert(j <= (int)sizeof(ctx->key)); |
| 85 | if (j < len) | 83 | if (j < len) |
| 86 | { | 84 | { |
| 87 | EVP_DigestInit_ex(&ctx->md_ctx,md, impl); | 85 | EVP_DigestInit_ex(&ctx->md_ctx,md, impl); |
| @@ -91,7 +89,7 @@ void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, | |||
| 91 | } | 89 | } |
| 92 | else | 90 | else |
| 93 | { | 91 | { |
| 94 | OPENSSL_assert(len <= sizeof ctx->key); | 92 | OPENSSL_assert(len>=0 && len<=(int)sizeof(ctx->key)); |
| 95 | memcpy(ctx->key,key,len); | 93 | memcpy(ctx->key,key,len); |
| 96 | ctx->key_length=len; | 94 | ctx->key_length=len; |
| 97 | } | 95 | } |
| @@ -123,7 +121,7 @@ void HMAC_Init(HMAC_CTX *ctx, const void *key, int len, | |||
| 123 | HMAC_Init_ex(ctx,key,len,md, NULL); | 121 | HMAC_Init_ex(ctx,key,len,md, NULL); |
| 124 | } | 122 | } |
| 125 | 123 | ||
| 126 | void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, int len) | 124 | void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len) |
| 127 | { | 125 | { |
| 128 | EVP_DigestUpdate(&ctx->md_ctx,data,len); | 126 | EVP_DigestUpdate(&ctx->md_ctx,data,len); |
| 129 | } | 127 | } |
| @@ -158,7 +156,7 @@ void HMAC_CTX_cleanup(HMAC_CTX *ctx) | |||
| 158 | } | 156 | } |
| 159 | 157 | ||
| 160 | unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, | 158 | unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, |
| 161 | const unsigned char *d, int n, unsigned char *md, | 159 | const unsigned char *d, size_t n, unsigned char *md, |
| 162 | unsigned int *md_len) | 160 | unsigned int *md_len) |
| 163 | { | 161 | { |
| 164 | HMAC_CTX c; | 162 | HMAC_CTX c; |
| @@ -173,11 +171,3 @@ unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, | |||
| 173 | return(md); | 171 | return(md); |
| 174 | } | 172 | } |
| 175 | 173 | ||
| 176 | void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags) | ||
| 177 | { | ||
| 178 | EVP_MD_CTX_set_flags(&ctx->i_ctx, flags); | ||
| 179 | EVP_MD_CTX_set_flags(&ctx->o_ctx, flags); | ||
| 180 | EVP_MD_CTX_set_flags(&ctx->md_ctx, flags); | ||
| 181 | } | ||
| 182 | |||
| 183 | #endif | ||
