summaryrefslogtreecommitdiff
path: root/lib/pubkey.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2017-07-27 16:53:57 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2017-08-03 11:57:52 +0200
commit4256ef71a7842830f7a27061c31c36554a6b97cc (patch)
tree0ed46372269b378c67093afe6eaa8fbb046f02f4 /lib/pubkey.c
parent86da29a32b34bd2f84f914f5749c260d9ff11add (diff)
downloadgnutls-4256ef71a7842830f7a27061c31c36554a6b97cc.tar.gz
Added convention for missing SubjectPublicKeyInfo params field
That is, when that field is missing, the spki_st structure field pk will be set to GNUTLS_PK_UNKNOWN. In that case other fields are undefined. Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
Diffstat (limited to 'lib/pubkey.c')
-rw-r--r--lib/pubkey.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/pubkey.c b/lib/pubkey.c
index 9cbdd25fbb..1ae8c05830 100644
--- a/lib/pubkey.c
+++ b/lib/pubkey.c
@@ -2152,6 +2152,9 @@ gnutls_pubkey_get_spki(gnutls_pubkey_t pubkey, gnutls_x509_spki_t spki, unsigned
return GNUTLS_E_INVALID_REQUEST;
}
+ if (pubkey->params.spki.pk == GNUTLS_PK_UNKNOWN)
+ return gnutls_assert_val(GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE);
+
memcpy(spki, &pubkey->params.spki, sizeof(gnutls_x509_spki_st));
return 0;