summaryrefslogtreecommitdiff
path: root/lib/x509/privkey_pkcs8.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2016-08-07 12:45:03 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2016-08-08 08:32:42 +0200
commit0470bf60104410e183e90bb1d21ccc151a545c44 (patch)
treec7dbf49cdf50cea44dc454d9715113c3caea9548 /lib/x509/privkey_pkcs8.c
parent186dc9c2012003587a38d7f4d03edd8da5fe989f (diff)
downloadgnutls-0470bf60104410e183e90bb1d21ccc151a545c44.tar.gz
x509: call the fixup functions after loading private keys
That way we can better report errors which relate to illegal parameters being detected.
Diffstat (limited to 'lib/x509/privkey_pkcs8.c')
-rw-r--r--lib/x509/privkey_pkcs8.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/x509/privkey_pkcs8.c b/lib/x509/privkey_pkcs8.c
index ca438656b4..f84d913e87 100644
--- a/lib/x509/privkey_pkcs8.c
+++ b/lib/x509/privkey_pkcs8.c
@@ -34,6 +34,7 @@
#include <algorithms.h>
#include <num.h>
#include <random.h>
+#include <pk.h>
#include <nettle/pbkdf2.h>
static int _decode_pkcs8_ecc_key(ASN1_TYPE pkcs8_asn,
@@ -1507,12 +1508,18 @@ gnutls_x509_privkey_import_pkcs8(gnutls_x509_privkey_t key,
goto cleanup;
}
+ result =
+ _gnutls_pk_fixup(key->pk_algorithm, GNUTLS_IMPORT, &key->params);
+ if (result < 0) {
+ gnutls_assert();
+ goto cleanup;
+ }
+
if (need_free)
_gnutls_free_datum(&_data);
/* The key has now been decoded.
*/
-
return 0;
cleanup: