diff options
author | djm <> | 2008-09-06 12:17:54 +0000 |
---|---|---|
committer | djm <> | 2008-09-06 12:17:54 +0000 |
commit | 38ce604e3cc97706b876b0525ddff0121115456d (patch) | |
tree | 7ccc28afe1789ea3dbedf72365f955d5b8e105b5 /src/lib/libcrypto/hmac | |
parent | 12867252827c8efaa8ddd1fa3b3d6e321e2bcdef (diff) | |
download | openbsd-38ce604e3cc97706b876b0525ddff0121115456d.tar.gz openbsd-38ce604e3cc97706b876b0525ddff0121115456d.tar.bz2 openbsd-38ce604e3cc97706b876b0525ddff0121115456d.zip |
resolve conflicts
Diffstat (limited to 'src/lib/libcrypto/hmac')
-rw-r--r-- | src/lib/libcrypto/hmac/hmac.c | 20 | ||||
-rw-r--r-- | src/lib/libcrypto/hmac/hmac.h | 13 |
2 files changed, 10 insertions, 23 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 | ||
diff --git a/src/lib/libcrypto/hmac/hmac.h b/src/lib/libcrypto/hmac/hmac.h index c6489c04c8..719fc408ac 100644 --- a/src/lib/libcrypto/hmac/hmac.h +++ b/src/lib/libcrypto/hmac/hmac.h | |||
@@ -58,17 +58,15 @@ | |||
58 | #ifndef HEADER_HMAC_H | 58 | #ifndef HEADER_HMAC_H |
59 | #define HEADER_HMAC_H | 59 | #define HEADER_HMAC_H |
60 | 60 | ||
61 | #include <openssl/opensslconf.h> | ||
62 | |||
61 | #ifdef OPENSSL_NO_HMAC | 63 | #ifdef OPENSSL_NO_HMAC |
62 | #error HMAC is disabled. | 64 | #error HMAC is disabled. |
63 | #endif | 65 | #endif |
64 | 66 | ||
65 | #include <openssl/evp.h> | 67 | #include <openssl/evp.h> |
66 | 68 | ||
67 | #ifdef OPENSSL_FIPS | 69 | #define HMAC_MAX_MD_CBLOCK 128 /* largest known is SHA512 */ |
68 | #define HMAC_MAX_MD_CBLOCK 128 | ||
69 | #else | ||
70 | #define HMAC_MAX_MD_CBLOCK 64 | ||
71 | #endif | ||
72 | 70 | ||
73 | #ifdef __cplusplus | 71 | #ifdef __cplusplus |
74 | extern "C" { | 72 | extern "C" { |
@@ -96,13 +94,12 @@ void HMAC_Init(HMAC_CTX *ctx, const void *key, int len, | |||
96 | const EVP_MD *md); /* deprecated */ | 94 | const EVP_MD *md); /* deprecated */ |
97 | void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, | 95 | void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, |
98 | const EVP_MD *md, ENGINE *impl); | 96 | const EVP_MD *md, ENGINE *impl); |
99 | void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, int len); | 97 | void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len); |
100 | void HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len); | 98 | void HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len); |
101 | unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, | 99 | unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, |
102 | const unsigned char *d, int n, unsigned char *md, | 100 | const unsigned char *d, size_t n, unsigned char *md, |
103 | unsigned int *md_len); | 101 | unsigned int *md_len); |
104 | 102 | ||
105 | void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags); | ||
106 | 103 | ||
107 | #ifdef __cplusplus | 104 | #ifdef __cplusplus |
108 | } | 105 | } |