3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-26 10:39:23 +01:00

crypto: Move hmac_sha1 to crypto.c

This commit is contained in:
Denis Kenzior 2016-02-10 14:12:46 -06:00
parent 962e2e8b2c
commit 064f1e0df9
5 changed files with 10 additions and 19 deletions

View File

@ -130,6 +130,7 @@ unit_test_hmac_md5_SOURCES = unit/test-hmac-md5.c \
unit_test_hmac_md5_LDADD = ell/libell-internal.la unit_test_hmac_md5_LDADD = ell/libell-internal.la
unit_test_hmac_sha1_SOURCES = unit/test-hmac-sha1.c \ unit_test_hmac_sha1_SOURCES = unit/test-hmac-sha1.c \
src/crypto.h src/crypto.c \
src/sha1.h src/sha1.c src/sha1.h src/sha1.c
unit_test_hmac_sha1_LDADD = ell/libell-internal.la unit_test_hmac_sha1_LDADD = ell/libell-internal.la

View File

@ -58,6 +58,13 @@ bool hmac_md5(const void *key, size_t key_len,
output, size); output, size);
} }
bool hmac_sha1(const void *key, size_t key_len,
const void *data, size_t data_len, void *output, size_t size)
{
return hmac_common(L_CHECKSUM_SHA1, key, key_len, data, data_len,
output, size);
}
bool hmac_sha256(const void *key, size_t key_len, bool hmac_sha256(const void *key, size_t key_len,
const void *data, size_t data_len, void *output, size_t size) const void *data, size_t data_len, void *output, size_t size)
{ {

View File

@ -39,6 +39,8 @@ struct crypto_ptk {
bool hmac_md5(const void *key, size_t key_len, bool hmac_md5(const void *key, size_t key_len,
const void *data, size_t data_len, void *output, size_t size); const void *data, size_t data_len, void *output, size_t size);
bool hmac_sha1(const void *key, size_t key_len,
const void *data, size_t data_len, void *output, size_t size);
bool hmac_sha256(const void *key, size_t key_len, bool hmac_sha256(const void *key, size_t key_len,
const void *data, size_t data_len, void *output, size_t size); const void *data, size_t data_len, void *output, size_t size);
bool cmac_aes(const void *key, size_t key_len, bool cmac_aes(const void *key, size_t key_len,

View File

@ -74,22 +74,6 @@ static void __hmac_sha1(struct l_checksum *checksum,
size > SHA1_MAC_LEN ? SHA1_MAC_LEN : size); size > SHA1_MAC_LEN ? SHA1_MAC_LEN : size);
} }
bool hmac_sha1(const void *key, size_t key_len,
const void *data, size_t data_len, void *output, size_t size)
{
struct l_checksum *checksum;
checksum = l_checksum_new(L_CHECKSUM_SHA1);
if (!checksum)
return false;
__hmac_sha1(checksum, key, key_len, data, data_len, output, size);
l_checksum_free(checksum);
return true;
}
static void F(struct l_checksum *checksum, static void F(struct l_checksum *checksum,
const char *password, size_t password_len, const char *password, size_t password_len,
const char *salt, size_t salt_len, const char *salt, size_t salt_len,

View File

@ -22,9 +22,6 @@
#include <stdbool.h> #include <stdbool.h>
bool hmac_sha1(const void *key, size_t key_len,
const void *data, size_t data_len, void *output, size_t size);
bool pbkdf2_sha1(const void *password, size_t password_len, bool pbkdf2_sha1(const void *password, size_t password_len,
const void *salt, size_t salt_len, const void *salt, size_t salt_len,
unsigned int iterations, void *output, size_t size); unsigned int iterations, void *output, size_t size);