summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2010-07-24 02:32:56 +0200
committerMiloslav Trmač <mitr@redhat.com>2010-07-24 04:25:24 +0200
commit82c206a8e9d16e439c64d9afbf5afabd9ed1f0ce (patch)
tree224f8339a82fe1509621be9a4bd330e80d6a265c
parent7b96171b3bed031238bee741a0a223ea332946b4 (diff)
downloadkernel-crypto-82c206a8e9d16e439c64d9afbf5afabd9ed1f0ce.tar.gz
kernel-crypto-82c206a8e9d16e439c64d9afbf5afabd9ed1f0ce.tar.xz
kernel-crypto-82c206a8e9d16e439c64d9afbf5afabd9ed1f0ce.zip
Use algo_properties_st in hash_get_oid
-rw-r--r--libtomcrypt/hashes/hash_get_oid.c4
-rw-r--r--libtomcrypt/headers/tomcrypt_hash.h4
-rw-r--r--libtomcrypt/pk/rsa/rsa_sign_hash.c2
-rw-r--r--libtomcrypt/pk/rsa/rsa_verify_hash.c2
4 files changed, 7 insertions, 5 deletions
diff --git a/libtomcrypt/hashes/hash_get_oid.c b/libtomcrypt/hashes/hash_get_oid.c
index 32e439058b7..c6469bad99c 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 417e4812440..1a2934b5903 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 2d87c47f2bc..30577a129b1 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 c563391d6da..eff2f3e3435 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;
}