summaryrefslogtreecommitdiffstats
path: root/crypto/hmac
diff options
context:
space:
mode:
authorBen Laurie <ben@openssl.org>2001-12-09 21:53:31 +0000
committerBen Laurie <ben@openssl.org>2001-12-09 21:53:31 +0000
commitff3fa48fc79029d46f5285bdf9347b96f2262ce2 (patch)
treef74a1f8ddd6ecf86c7f217742f10dea32a3b89bb /crypto/hmac
parent87166e1fb6941280fc0827909d944b806461727d (diff)
Improve back compatibility.
Diffstat (limited to 'crypto/hmac')
-rw-r--r--crypto/hmac/hmac.c12
-rw-r--r--crypto/hmac/hmac.h6
2 files changed, 15 insertions, 3 deletions
diff --git a/crypto/hmac/hmac.c b/crypto/hmac/hmac.c
index a2a49d986a..3fff7b1af3 100644
--- a/crypto/hmac/hmac.c
+++ b/crypto/hmac/hmac.c
@@ -60,8 +60,8 @@
#include <string.h>
#include <openssl/hmac.h>
-void HMAC_Init(HMAC_CTX *ctx, const void *key, int len,
- const EVP_MD *md)
+void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
+ const EVP_MD *md)
{
int i,j,reset=0;
unsigned char pad[HMAC_MAX_MD_CBLOCK];
@@ -110,6 +110,14 @@ void HMAC_Init(HMAC_CTX *ctx, const void *key, int len,
EVP_MD_CTX_copy_ex(&ctx->md_ctx,&ctx->i_ctx);
}
+void HMAC_Init(HMAC_CTX *ctx, const void *key, int len,
+ const EVP_MD *md)
+ {
+ if(key && md)
+ HMAC_CTX_init(ctx);
+ HMAC_Init_ex(ctx,key,len,md);
+ }
+
void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, int len)
{
EVP_DigestUpdate(&ctx->md_ctx,data,len);
diff --git a/crypto/hmac/hmac.h b/crypto/hmac/hmac.h
index e70b01b2fb..58ac3d0993 100644
--- a/crypto/hmac/hmac.h
+++ b/crypto/hmac/hmac.h
@@ -86,8 +86,12 @@ typedef struct hmac_ctx_st
void HMAC_CTX_init(HMAC_CTX *ctx);
void HMAC_CTX_cleanup(HMAC_CTX *ctx);
+#define HMAC_cleanup(ctx) HMAC_CTX_cleanup(ctx) /* deprecated */
+
void HMAC_Init(HMAC_CTX *ctx, const void *key, int len,
- const EVP_MD *md);
+ const EVP_MD *md); /* deprecated */
+void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
+ const EVP_MD *md);
void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, int len);
void HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len);
unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len,