GnuTLS: Implement sha{256,384,512}_vector() using libgcrypt

Replace the internal SHA256 implementation with the one from libgcrypt
and also add the SHA384 and SHA512 versions.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2017-12-27 23:19:32 +02:00
parent cc3e7bfc3c
commit 85c12a62ee
5 changed files with 19 additions and 5 deletions

View file

@ -651,7 +651,6 @@ OBJS += src/crypto/sha1-internal.c
endif
LIBS += -lgcrypt
LIBS_h += -lgcrypt
CONFIG_INTERNAL_SHA256=y
CONFIG_INTERNAL_RC4=y
CONFIG_INTERNAL_DH_GROUP5=y
endif

View file

@ -689,7 +689,6 @@ SHA1OBJS += ../src/crypto/sha1-internal.o
endif
LIBS += -lgcrypt
LIBS_h += -lgcrypt
CONFIG_INTERNAL_SHA256=y
CONFIG_INTERNAL_RC4=y
CONFIG_INTERNAL_DH_GROUP5=y
endif

View file

@ -1,6 +1,6 @@
/*
* WPA Supplicant / wrapper functions for libgcrypt
* Copyright (c) 2004-2009, Jouni Malinen <j@w1.fi>
* Copyright (c) 2004-2017, Jouni Malinen <j@w1.fi>
*
* This software may be distributed under the terms of the BSD license.
* See README for more details.
@ -72,6 +72,24 @@ int sha1_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
}
int sha256_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
{
return gnutls_digest_vector(GCRY_MD_SHA256, num_elem, addr, len, mac);
}
int sha384_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
{
return gnutls_digest_vector(GCRY_MD_SHA384, num_elem, addr, len, mac);
}
int sha512_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
{
return gnutls_digest_vector(GCRY_MD_SHA512, num_elem, addr, len, mac);
}
void * aes_encrypt_init(const u8 *key, size_t len)
{
gcry_cipher_hd_t hd;

View file

@ -1051,7 +1051,6 @@ OBJS += src/crypto/sha1-internal.c
endif
LIBS += -lgcrypt
LIBS_p += -lgcrypt
CONFIG_INTERNAL_SHA256=y
CONFIG_INTERNAL_RC4=y
CONFIG_INTERNAL_DH_GROUP5=y
endif

View file

@ -1095,7 +1095,6 @@ SHA1OBJS += ../src/crypto/sha1-internal.o
endif
LIBS += -lgcrypt
LIBS_p += -lgcrypt
CONFIG_INTERNAL_SHA256=y
CONFIG_INTERNAL_RC4=y
CONFIG_INTERNAL_DH_GROUP5=y
endif