mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 14:49:24 +01:00
crypto: Move hmac_sha1 to crypto.c
This commit is contained in:
parent
962e2e8b2c
commit
064f1e0df9
@ -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_sha1_SOURCES = unit/test-hmac-sha1.c \
|
||||
src/crypto.h src/crypto.c \
|
||||
src/sha1.h src/sha1.c
|
||||
unit_test_hmac_sha1_LDADD = ell/libell-internal.la
|
||||
|
||||
|
@ -58,6 +58,13 @@ bool hmac_md5(const void *key, size_t key_len,
|
||||
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,
|
||||
const void *data, size_t data_len, void *output, size_t size)
|
||||
{
|
||||
|
@ -39,6 +39,8 @@ struct crypto_ptk {
|
||||
|
||||
bool hmac_md5(const void *key, size_t key_len,
|
||||
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,
|
||||
const void *data, size_t data_len, void *output, size_t size);
|
||||
bool cmac_aes(const void *key, size_t key_len,
|
||||
|
16
src/sha1.c
16
src/sha1.c
@ -74,22 +74,6 @@ static void __hmac_sha1(struct l_checksum *checksum,
|
||||
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,
|
||||
const char *password, size_t password_len,
|
||||
const char *salt, size_t salt_len,
|
||||
|
@ -22,9 +22,6 @@
|
||||
|
||||
#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,
|
||||
const void *salt, size_t salt_len,
|
||||
unsigned int iterations, void *output, size_t size);
|
||||
|
Loading…
Reference in New Issue
Block a user