diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2002-03-14 18:22:23 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2002-03-14 18:22:23 +0000 |
commit | de941e289e5d320d2e3258b0ebf71562830aaabc (patch) | |
tree | 082d81fe05a8c694a71a531dbe3eab7495773b17 /crypto | |
parent | 1d2845352926df66db5798cfebf3784f6af59b8c (diff) | |
download | openssl-new-de941e289e5d320d2e3258b0ebf71562830aaabc.tar.gz |
Initialize cipher context in KRB5
("D. Russell" <russelld@aol.net>)
Allow HMAC functions to use an alternative ENGINE.
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/evp/p5_crpt2.c | 2 | ||||
-rw-r--r-- | crypto/hmac/hmac.c | 10 | ||||
-rw-r--r-- | crypto/hmac/hmac.h | 2 | ||||
-rw-r--r-- | crypto/pkcs12/p12_mutl.c | 8 |
4 files changed, 11 insertions, 11 deletions
diff --git a/crypto/evp/p5_crpt2.c b/crypto/evp/p5_crpt2.c index 14cad73cde..7881860b53 100644 --- a/crypto/evp/p5_crpt2.c +++ b/crypto/evp/p5_crpt2.c @@ -100,7 +100,7 @@ int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen, itmp[1] = (unsigned char)((i >> 16) & 0xff); itmp[2] = (unsigned char)((i >> 8) & 0xff); itmp[3] = (unsigned char)(i & 0xff); - HMAC_Init_ex(&hctx, pass, passlen, EVP_sha1()); + HMAC_Init_ex(&hctx, pass, passlen, EVP_sha1(), NULL); HMAC_Update(&hctx, salt, saltlen); HMAC_Update(&hctx, itmp, 4); HMAC_Final(&hctx, digtmp, NULL); diff --git a/crypto/hmac/hmac.c b/crypto/hmac/hmac.c index 3fff7b1af3..da363b7950 100644 --- a/crypto/hmac/hmac.c +++ b/crypto/hmac/hmac.c @@ -61,7 +61,7 @@ #include <openssl/hmac.h> void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, - const EVP_MD *md) + const EVP_MD *md, ENGINE *impl) { int i,j,reset=0; unsigned char pad[HMAC_MAX_MD_CBLOCK]; @@ -80,7 +80,7 @@ void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, j=EVP_MD_block_size(md); if (j < len) { - EVP_DigestInit_ex(&ctx->md_ctx,md, NULL); + EVP_DigestInit_ex(&ctx->md_ctx,md, impl); EVP_DigestUpdate(&ctx->md_ctx,key,len); EVP_DigestFinal_ex(&(ctx->md_ctx),ctx->key, &ctx->key_length); @@ -99,12 +99,12 @@ void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, { for (i=0; i<HMAC_MAX_MD_CBLOCK; i++) pad[i]=0x36^ctx->key[i]; - EVP_DigestInit_ex(&ctx->i_ctx,md, NULL); + EVP_DigestInit_ex(&ctx->i_ctx,md, impl); EVP_DigestUpdate(&ctx->i_ctx,pad,EVP_MD_block_size(md)); for (i=0; i<HMAC_MAX_MD_CBLOCK; i++) pad[i]=0x5c^ctx->key[i]; - EVP_DigestInit_ex(&ctx->o_ctx,md, NULL); + EVP_DigestInit_ex(&ctx->o_ctx,md, impl); EVP_DigestUpdate(&ctx->o_ctx,pad,EVP_MD_block_size(md)); } EVP_MD_CTX_copy_ex(&ctx->md_ctx,&ctx->i_ctx); @@ -115,7 +115,7 @@ void HMAC_Init(HMAC_CTX *ctx, const void *key, int len, { if(key && md) HMAC_CTX_init(ctx); - HMAC_Init_ex(ctx,key,len,md); + HMAC_Init_ex(ctx,key,len,md, NULL); } void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, int len) diff --git a/crypto/hmac/hmac.h b/crypto/hmac/hmac.h index 58ac3d0993..0364a1fcbd 100644 --- a/crypto/hmac/hmac.h +++ b/crypto/hmac/hmac.h @@ -91,7 +91,7 @@ void HMAC_CTX_cleanup(HMAC_CTX *ctx); void HMAC_Init(HMAC_CTX *ctx, const void *key, int len, const EVP_MD *md); /* deprecated */ void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, - const EVP_MD *md); + const EVP_MD *md, ENGINE *impl); 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, diff --git a/crypto/pkcs12/p12_mutl.c b/crypto/pkcs12/p12_mutl.c index b6a10de70c..0fb67f74b8 100644 --- a/crypto/pkcs12/p12_mutl.c +++ b/crypto/pkcs12/p12_mutl.c @@ -87,11 +87,11 @@ int PKCS12_gen_mac (PKCS12 *p12, const char *pass, int passlen, return 0; } HMAC_CTX_init(&hmac); - HMAC_Init_ex (&hmac, key, PKCS12_MAC_KEY_LENGTH, md_type); - HMAC_Update (&hmac, p12->authsafes->d.data->data, + HMAC_Init_ex(&hmac, key, PKCS12_MAC_KEY_LENGTH, md_type, NULL); + HMAC_Update(&hmac, p12->authsafes->d.data->data, p12->authsafes->d.data->length); - HMAC_Final (&hmac, mac, maclen); - HMAC_CTX_cleanup (&hmac); + HMAC_Final(&hmac, mac, maclen); + HMAC_CTX_cleanup(&hmac); return 1; } |