diff options
author | Stefan Walter <stefw@src.gnome.org> | 2008-09-01 02:54:33 +0000 |
---|---|---|
committer | Stefan Walter <stefw@src.gnome.org> | 2008-09-01 02:54:33 +0000 |
commit | f60249f31aff9beb4e53617fb663e1ccf4c76bd7 (patch) | |
tree | fd33ffe394d7b32a5cd114dbdc4bc64c68d6185b /daemon | |
parent | 404dcd06195874b0c5ec135dbf988f0f54272ee5 (diff) |
Support extracting of RSA signature even when no pad function is specified
* daemon/pkcs11/gkr-pkcs11-rsa.c: Support extracting of RSA
signature even when no pad function is specified for extraction.
svn path=/trunk/; revision=1288
Diffstat (limited to 'daemon')
-rw-r--r-- | daemon/pkcs11/gkr-pkcs11-rsa.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/daemon/pkcs11/gkr-pkcs11-rsa.c b/daemon/pkcs11/gkr-pkcs11-rsa.c index c3d100db..8b787afe 100644 --- a/daemon/pkcs11/gkr-pkcs11-rsa.c +++ b/daemon/pkcs11/gkr-pkcs11-rsa.c @@ -118,15 +118,25 @@ sexp_to_data (const gchar* format1, const gchar *format2, const gchar *format3, guint nbits, GkrCryptoPadding padfunc, gcry_sexp_t sexp, guchar **data, gsize *n_data) { + gboolean res; + g_assert (format1); g_assert (sexp); g_assert (data); g_assert (n_data); /* Now extract and send it back out */ - *data = gkr_crypto_sexp_extract_mpi_padded (sexp, nbits, n_data, padfunc, - format1, format2, format3, NULL); - g_return_val_if_fail (*data, CKR_GENERAL_ERROR); + if (padfunc) { + *data = gkr_crypto_sexp_extract_mpi_padded (sexp, nbits, n_data, padfunc, + format1, format2, format3, NULL); + g_return_val_if_fail (*data, CKR_GENERAL_ERROR); + } else { + *n_data = nbits / 8; + *data = g_malloc0 (*n_data); + res = gkr_crypto_sexp_extract_mpi_aligned (sexp, *data, *n_data, + format1, format2, format3, NULL); + g_return_val_if_fail (res, CKR_GENERAL_ERROR); + } return CKR_OK; } |