diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-07-27 16:53:57 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-08-03 11:57:52 +0200 |
commit | 4256ef71a7842830f7a27061c31c36554a6b97cc (patch) | |
tree | 0ed46372269b378c67093afe6eaa8fbb046f02f4 /lib/pubkey.c | |
parent | 86da29a32b34bd2f84f914f5749c260d9ff11add (diff) | |
download | gnutls-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.c | 3 |
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; |