summaryrefslogtreecommitdiff
path: root/lib/gnutls_privkey.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2010-12-13 21:53:08 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2010-12-13 21:53:08 +0100
commit82422a562a62856607894f07f3deadde9a340755 (patch)
tree10390f6d8e9f99176feff0221e4d79fafe48f85a /lib/gnutls_privkey.c
parent1c297951ba962c0922f7e8b60f91d32b0d2e901f (diff)
downloadgnutls-82422a562a62856607894f07f3deadde9a340755.tar.gz
Simplified preparation of signing code.
Diffstat (limited to 'lib/gnutls_privkey.c')
-rw-r--r--lib/gnutls_privkey.c32
1 files changed, 5 insertions, 27 deletions
diff --git a/lib/gnutls_privkey.c b/lib/gnutls_privkey.c
index 4e3b640205..86e45edd43 100644
--- a/lib/gnutls_privkey.c
+++ b/lib/gnutls_privkey.c
@@ -257,21 +257,10 @@ gnutls_privkey_sign_data (gnutls_privkey_t signer,
return ret;
}
- switch (signer->pk_algorithm)
+ ret = pk_prepare_hash (signer->pk_algorithm, hash, &digest);
+ if (ret < 0)
{
- case GNUTLS_PK_RSA:
- ret = pk_prepare_pkcs1_rsa_hash (hash, &digest);
- if (ret < 0)
- {
- gnutls_assert ();
- return ret;
- }
- break;
- case GNUTLS_PK_DSA:
- break;
- default:
- gnutls_assert ();
- ret = GNUTLS_E_UNIMPLEMENTED_FEATURE;
+ gnutls_assert();
goto cleanup;
}
@@ -329,21 +318,10 @@ gnutls_privkey_sign_hash2 (gnutls_privkey_t signer,
digest.size = hash_data->size;
memcpy(digest.data, hash_data->data, digest.size);
- switch (signer->pk_algorithm)
+ ret = pk_prepare_hash (signer->pk_algorithm, hash_algo, &digest);
+ if (ret < 0)
{
- case GNUTLS_PK_RSA:
- ret = pk_prepare_pkcs1_rsa_hash (hash_algo, &digest);
- if (ret < 0)
- {
- gnutls_assert ();
- return ret;
- }
- break;
- case GNUTLS_PK_DSA:
- break;
- default:
gnutls_assert ();
- ret = GNUTLS_E_UNIMPLEMENTED_FEATURE;
goto cleanup;
}