diff options
Diffstat (limited to 'src/lib/libcrypto/hmac/hmac.c')
-rw-r--r-- | src/lib/libcrypto/hmac/hmac.c | 33 |
1 files changed, 9 insertions, 24 deletions
diff --git a/src/lib/libcrypto/hmac/hmac.c b/src/lib/libcrypto/hmac/hmac.c index fb09129963..5c349bbb56 100644 --- a/src/lib/libcrypto/hmac/hmac.c +++ b/src/lib/libcrypto/hmac/hmac.c | |||
@@ -58,13 +58,10 @@ | |||
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 "hmac.h" | 61 | #include <openssl/hmac.h> |
62 | 62 | ||
63 | void HMAC_Init(ctx,key,len,md) | 63 | void HMAC_Init(HMAC_CTX *ctx, const void *key, int len, |
64 | HMAC_CTX *ctx; | 64 | const EVP_MD *md) |
65 | unsigned char *key; | ||
66 | int len; | ||
67 | EVP_MD *md; | ||
68 | { | 65 | { |
69 | int i,j,reset=0; | 66 | int i,j,reset=0; |
70 | unsigned char pad[HMAC_MAX_MD_CBLOCK]; | 67 | unsigned char pad[HMAC_MAX_MD_CBLOCK]; |
@@ -112,18 +109,12 @@ EVP_MD *md; | |||
112 | memcpy(&ctx->md_ctx,&ctx->i_ctx,sizeof(ctx->i_ctx)); | 109 | memcpy(&ctx->md_ctx,&ctx->i_ctx,sizeof(ctx->i_ctx)); |
113 | } | 110 | } |
114 | 111 | ||
115 | void HMAC_Update(ctx,data,len) | 112 | void HMAC_Update(HMAC_CTX *ctx, unsigned char *data, int len) |
116 | HMAC_CTX *ctx; | ||
117 | unsigned char *data; | ||
118 | int len; | ||
119 | { | 113 | { |
120 | EVP_DigestUpdate(&(ctx->md_ctx),data,len); | 114 | EVP_DigestUpdate(&(ctx->md_ctx),data,len); |
121 | } | 115 | } |
122 | 116 | ||
123 | void HMAC_Final(ctx,md,len) | 117 | void HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len) |
124 | HMAC_CTX *ctx; | ||
125 | unsigned char *md; | ||
126 | unsigned int *len; | ||
127 | { | 118 | { |
128 | int j; | 119 | int j; |
129 | unsigned int i; | 120 | unsigned int i; |
@@ -137,20 +128,14 @@ unsigned int *len; | |||
137 | EVP_DigestFinal(&(ctx->md_ctx),md,len); | 128 | EVP_DigestFinal(&(ctx->md_ctx),md,len); |
138 | } | 129 | } |
139 | 130 | ||
140 | void HMAC_cleanup(ctx) | 131 | void HMAC_cleanup(HMAC_CTX *ctx) |
141 | HMAC_CTX *ctx; | ||
142 | { | 132 | { |
143 | memset(ctx,0,sizeof(HMAC_CTX)); | 133 | memset(ctx,0,sizeof(HMAC_CTX)); |
144 | } | 134 | } |
145 | 135 | ||
146 | unsigned char *HMAC(evp_md,key,key_len,d,n,md,md_len) | 136 | unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, |
147 | EVP_MD *evp_md; | 137 | unsigned char *d, int n, unsigned char *md, |
148 | unsigned char *key; | 138 | unsigned int *md_len) |
149 | int key_len; | ||
150 | unsigned char *d; | ||
151 | int n; | ||
152 | unsigned char *md; | ||
153 | unsigned int *md_len; | ||
154 | { | 139 | { |
155 | HMAC_CTX c; | 140 | HMAC_CTX c; |
156 | static unsigned char m[EVP_MAX_MD_SIZE]; | 141 | static unsigned char m[EVP_MAX_MD_SIZE]; |