summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Walter <stefw@src.gnome.org>2008-09-01 02:54:33 +0000
committerStefan Walter <stefw@src.gnome.org>2008-09-01 02:54:33 +0000
commitf60249f31aff9beb4e53617fb663e1ccf4c76bd7 (patch)
treefd33ffe394d7b32a5cd114dbdc4bc64c68d6185b
parent404dcd06195874b0c5ec135dbf988f0f54272ee5 (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
-rw-r--r--ChangeLog5
-rw-r--r--daemon/pkcs11/gkr-pkcs11-rsa.c16
2 files changed, 18 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 55862b71..6c449101 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2008-08-31 Stef Walter <stef@memberwebs.com>
+ * daemon/pkcs11/gkr-pkcs11-rsa.c: Support extracting of RSA
+ signature even when no pad function is specified for extraction.
+
+2008-08-31 Stef Walter <stef@memberwebs.com>
+
* daemon/pk/gkr-pk-object.c: Don't try to rename in indexes
if digest remains the same on an object.
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;
}