register hash functions instead of prfs
This commit is contained in:
+12
-12
@@ -57,15 +57,15 @@ MP_INT groupgenerator; /* MODP group generator (2) */
|
|||||||
void init_crypto(void)
|
void init_crypto(void)
|
||||||
{
|
{
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
encryption_algorithm_t encryption;
|
encryption_algorithm_t encryption_alg;
|
||||||
pseudo_random_function_t prf;
|
hash_algorithm_t hash_alg;
|
||||||
|
|
||||||
enumerator = lib->crypto->create_crypter_enumerator(lib->crypto);
|
enumerator = lib->crypto->create_crypter_enumerator(lib->crypto);
|
||||||
while (enumerator->enumerate(enumerator, &encryption))
|
while (enumerator->enumerate(enumerator, &encryption_alg))
|
||||||
{
|
{
|
||||||
const struct encrypt_desc *desc;
|
const struct encrypt_desc *desc;
|
||||||
|
|
||||||
switch (encryption)
|
switch (encryption_alg)
|
||||||
{
|
{
|
||||||
case ENCR_3DES:
|
case ENCR_3DES:
|
||||||
desc = &encrypt_desc_3des;
|
desc = &encrypt_desc_3des;
|
||||||
@@ -90,26 +90,26 @@ void init_crypto(void)
|
|||||||
}
|
}
|
||||||
enumerator->destroy(enumerator);
|
enumerator->destroy(enumerator);
|
||||||
|
|
||||||
enumerator = lib->crypto->create_prf_enumerator(lib->crypto);
|
enumerator = lib->crypto->create_hasher_enumerator(lib->crypto);
|
||||||
while (enumerator->enumerate(enumerator, &prf))
|
while (enumerator->enumerate(enumerator, &hash_alg))
|
||||||
{
|
{
|
||||||
const struct hash_desc *desc;
|
const struct hash_desc *desc;
|
||||||
|
|
||||||
switch (prf)
|
switch (hash_alg)
|
||||||
{
|
{
|
||||||
case PRF_HMAC_SHA1:
|
case HASH_SHA1:
|
||||||
desc = &hash_desc_sha1;
|
desc = &hash_desc_sha1;
|
||||||
break;
|
break;
|
||||||
case PRF_HMAC_SHA2_256:
|
case HASH_SHA256:
|
||||||
desc = &hash_desc_sha2_256;
|
desc = &hash_desc_sha2_256;
|
||||||
break;
|
break;
|
||||||
case PRF_HMAC_SHA2_384:
|
case HASH_SHA384:
|
||||||
desc = &hash_desc_sha2_384;
|
desc = &hash_desc_sha2_384;
|
||||||
break;
|
break;
|
||||||
case PRF_HMAC_SHA2_512:
|
case HASH_SHA512:
|
||||||
desc = &hash_desc_sha2_512;
|
desc = &hash_desc_sha2_512;
|
||||||
break;
|
break;
|
||||||
case PRF_HMAC_MD5:
|
case HASH_MD5:
|
||||||
desc = &hash_desc_md5;
|
desc = &hash_desc_md5;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user