diff options
-rw-r--r-- | libtomcrypt/hashes/hash_get_oid.c | 4 | ||||
-rw-r--r-- | libtomcrypt/headers/tomcrypt_hash.h | 4 | ||||
-rw-r--r-- | libtomcrypt/pk/rsa/rsa_sign_hash.c | 2 | ||||
-rw-r--r-- | libtomcrypt/pk/rsa/rsa_verify_hash.c | 2 |
4 files changed, 7 insertions, 5 deletions
diff --git a/libtomcrypt/hashes/hash_get_oid.c b/libtomcrypt/hashes/hash_get_oid.c index 32e4390..c6469ba 100644 --- a/libtomcrypt/hashes/hash_get_oid.c +++ b/libtomcrypt/hashes/hash_get_oid.c @@ -46,9 +46,9 @@ static const oid_st sha512_oid = { .OID = { 2, 16, 840, 1, 101, 3, 4, 2, 3, }, }; -int hash_get_oid(int hash, oid_st *st) +int hash_get_oid(const struct algo_properties_st *hash, oid_st *st) { - switch (hash) { + switch (hash->algo) { case NCR_ALG_SHA1: memcpy(st, &sha1_oid, sizeof(*st)); break; diff --git a/libtomcrypt/headers/tomcrypt_hash.h b/libtomcrypt/headers/tomcrypt_hash.h index 417e481..1a2934b 100644 --- a/libtomcrypt/headers/tomcrypt_hash.h +++ b/libtomcrypt/headers/tomcrypt_hash.h @@ -1,5 +1,7 @@ /* ---- HASH FUNCTIONS ---- */ +struct algo_properties_st; + int hash_is_valid(int idx); int hash_memory(int hash, @@ -8,5 +10,5 @@ int hash_memory(int hash, int hash_memory_multi(int hash, unsigned char *out, unsigned long *outlen, const unsigned char *in, unsigned long inlen, ...); -int hash_get_oid(int hash, oid_st* st); +int hash_get_oid(const struct algo_properties_st *hash, oid_st* st); diff --git a/libtomcrypt/pk/rsa/rsa_sign_hash.c b/libtomcrypt/pk/rsa/rsa_sign_hash.c index 2d87c47..30577a1 100644 --- a/libtomcrypt/pk/rsa/rsa_sign_hash.c +++ b/libtomcrypt/pk/rsa/rsa_sign_hash.c @@ -79,7 +79,7 @@ int rsa_sign_hash_ex(const unsigned char *in, unsigned long inlen, oid_st st; /* not all hashes have OIDs... so sad */ - if (hash_get_oid(hash->algo, &st) != CRYPT_OK) { + if (hash_get_oid(hash, &st) != CRYPT_OK) { return CRYPT_INVALID_ARG; } diff --git a/libtomcrypt/pk/rsa/rsa_verify_hash.c b/libtomcrypt/pk/rsa/rsa_verify_hash.c index c563391..eff2f3e 100644 --- a/libtomcrypt/pk/rsa/rsa_verify_hash.c +++ b/libtomcrypt/pk/rsa/rsa_verify_hash.c @@ -103,7 +103,7 @@ int rsa_verify_hash_ex(const unsigned char *sig, unsigned long siglen, oid_st st; /* not all hashes have OIDs... so sad */ - if (hash_get_oid(hash_algo->algo, &st) != CRYPT_OK) { + if (hash_get_oid(hash_algo, &st) != CRYPT_OK) { err = CRYPT_INVALID_ARG; goto bail_2; } |