diff options
author | Bill Meier <wmeier@newsguy.com> | 2011-03-09 00:43:49 +0000 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2011-03-09 00:43:49 +0000 |
commit | ff6cd61a00721d22c3179c08d552a272bdc50ce6 (patch) | |
tree | 76feafb23e9ab495ce3e4d2dbfe1ff8f98352c13 /epan/dissectors/packet-ssl-utils.c | |
parent | 41c433856f88ed0daf3c8209e230a8f4c6e9d554 (diff) | |
download | wireshark-ff6cd61a00721d22c3179c08d552a272bdc50ce6.tar.gz |
Check that imported private key is RSA; Prevents a crash.
Fixes Bug #5662
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5662
svn path=/trunk/; revision=36174
Diffstat (limited to 'epan/dissectors/packet-ssl-utils.c')
-rw-r--r-- | epan/dissectors/packet-ssl-utils.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/epan/dissectors/packet-ssl-utils.c b/epan/dissectors/packet-ssl-utils.c index 131c12657d..9489fb13a8 100644 --- a/epan/dissectors/packet-ssl-utils.c +++ b/epan/dissectors/packet-ssl-utils.c @@ -2467,6 +2467,14 @@ ssl_load_key(FILE* fp) g_free(key.data); return NULL; } + + if (gnutls_x509_privkey_get_pk_algorithm(priv_key) != GNUTLS_PK_RSA) { + ssl_debug_printf("ssl_load_key: private key public key algorithm isn't RSA\n"); + g_free(private_key); + g_free(key.data); + return NULL; + } + g_free(key.data); private_key->x509_pkey = priv_key; @@ -2631,6 +2639,12 @@ ssl_load_pkcs12(FILE* fp, const gchar *cert_passwd) { return 0; } + if (gnutls_x509_privkey_get_pk_algorithm(ssl_pkey) != GNUTLS_PK_RSA) { + ssl_debug_printf("ssl_load_pkcs12: private key public key algorithm isn't RSA\n"); + g_free(private_key); + return 0; + } + private_key->x509_pkey = ssl_pkey; private_key->sexp_pkey = ssl_privkey_to_sexp(ssl_pkey); if ( !private_key->sexp_pkey ) { |