summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/hmac/hmac.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/hmac/hmac.c')
-rw-r--r--src/lib/libcrypto/hmac/hmac.c33
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
63void HMAC_Init(ctx,key,len,md) 63void HMAC_Init(HMAC_CTX *ctx, const void *key, int len,
64HMAC_CTX *ctx; 64 const EVP_MD *md)
65unsigned char *key;
66int len;
67EVP_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
115void HMAC_Update(ctx,data,len) 112void HMAC_Update(HMAC_CTX *ctx, unsigned char *data, int len)
116HMAC_CTX *ctx;
117unsigned char *data;
118int len;
119 { 113 {
120 EVP_DigestUpdate(&(ctx->md_ctx),data,len); 114 EVP_DigestUpdate(&(ctx->md_ctx),data,len);
121 } 115 }
122 116
123void HMAC_Final(ctx,md,len) 117void HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len)
124HMAC_CTX *ctx;
125unsigned char *md;
126unsigned 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
140void HMAC_cleanup(ctx) 131void HMAC_cleanup(HMAC_CTX *ctx)
141HMAC_CTX *ctx;
142 { 132 {
143 memset(ctx,0,sizeof(HMAC_CTX)); 133 memset(ctx,0,sizeof(HMAC_CTX));
144 } 134 }
145 135
146unsigned char *HMAC(evp_md,key,key_len,d,n,md,md_len) 136unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len,
147EVP_MD *evp_md; 137 unsigned char *d, int n, unsigned char *md,
148unsigned char *key; 138 unsigned int *md_len)
149int key_len;
150unsigned char *d;
151int n;
152unsigned char *md;
153unsigned 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];