Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.0
libssh
0001-libcrypto-Use-newer-API-for-HMAC.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-libcrypto-Use-newer-API-for-HMAC.patch of Package libssh
From cf1e808e2ffa1f26644fb5d2cb82a919f323deba Mon Sep 17 00:00:00 2001 From: Jakub Jelen <jjelen@redhat.com> Date: Sat, 5 Nov 2016 16:51:05 +0100 Subject: [PATCH] libcrypto: Use newer API for HMAC This is for OpenSSL 1.1.0 support. Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org> --- src/libcrypto.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/libcrypto.c b/src/libcrypto.c index 19065bd6..64c92eaa 100644 --- a/src/libcrypto.c +++ b/src/libcrypto.c @@ -378,32 +378,33 @@ void ssh_mac_final(unsigned char *md, ssh_mac_ctx ctx) { HMACCTX hmac_init(const void *key, int len, enum ssh_hmac_e type) { HMACCTX ctx = NULL; - ctx = malloc(sizeof(*ctx)); + ctx = HMAC_CTX_new(); if (ctx == NULL) { return NULL; } #ifndef OLD_CRYPTO - HMAC_CTX_init(ctx); // openssl 0.9.7 requires it. + HMAC_CTX_reset(ctx); // openssl 0.9.7 requires it. #endif switch(type) { case SSH_HMAC_SHA1: - HMAC_Init(ctx, key, len, EVP_sha1()); + HMAC_Init_ex(ctx, key, len, EVP_sha1(), NULL); break; case SSH_HMAC_SHA256: - HMAC_Init(ctx, key, len, EVP_sha256()); + HMAC_Init_ex(ctx, key, len, EVP_sha256(), NULL); break; case SSH_HMAC_SHA384: - HMAC_Init(ctx, key, len, EVP_sha384()); + HMAC_Init_ex(ctx, key, len, EVP_sha384(), NULL); break; case SSH_HMAC_SHA512: - HMAC_Init(ctx, key, len, EVP_sha512()); + HMAC_Init_ex(ctx, key, len, EVP_sha512(), NULL); break; case SSH_HMAC_MD5: - HMAC_Init(ctx, key, len, EVP_md5()); + HMAC_Init_ex(ctx, key, len, EVP_md5(), NULL); break; default: + HMAC_CTX_free(ctx); SAFE_FREE(ctx); ctx = NULL; } @@ -419,7 +420,7 @@ void hmac_final(HMACCTX ctx, unsigned char *hashmacbuf, unsigned int *len) { HMAC_Final(ctx,hashmacbuf,len); #ifndef OLD_CRYPTO - HMAC_CTX_cleanup(ctx); + HMAC_CTX_reset(ctx); #else HMAC_cleanup(ctx); #endif -- 2.13.5
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor