Wireshark-commits: [Wireshark-commits] master 40ff4ff: ssl-utils: simplify private key storage, fix
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=40ff4ffee88977b2981e29cb4ad8658394c8442e
Submitter: Anders Broman (a.broman58@xxxxxxxxx)
Changed: branch: master
Repository: wireshark
Commits:
40ff4ff by Peter Wu (peter@xxxxxxxxxxxxx):
ssl-utils: simplify private key storage, fix resource leaks
The certificate and GnuTLS private key are never used except for
reporting in the log file. Remove the unused certificate-related code
from the PKCS#12 file parsing. Report an immediate error instead of
opening key file if GnuTLS is disabled.
Made ssl_load_key and ssl_load_pkcs12 static, they are not used outside
the SSL dissector. If for some reason the PKCS#12 bag contains multiple
private keys, then the previous one would be overwritten (leaking
memory). Fix this by returning the first private key found.
Simplify key_hash (dtls_key_hash/ssl_key_hash) memory management, now
the table automatically frees keys/values when items are removed.
Fix memory leaks:
- ssldecrypt_uat_fld_password_chk_cb: release ssl_load_pkcs12 memory.
- ssl_load_key: avoid leaking gnutls_x509_privkey_t on error.
- ssl_load_pkcs12: fix ssl_pkey leak on error path.
Change-Id: I5db6fecb0d74e5c78796392aeb17e3eb7985a2ef
Reviewed-on: https://code.wireshark.org/review/10764
Reviewed-by: Peter Wu <peter@xxxxxxxxxxxxx>
Petri-Dish: Peter Wu <peter@xxxxxxxxxxxxx>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@xxxxxxxxxxxxx>
Reviewed-by: Anders Broman <a.broman58@xxxxxxxxx>
Actions performed:
from 9fea515 UDP: Refactor some dissector code
adds 40ff4ff ssl-utils: simplify private key storage, fix resource leaks
Summary of changes:
epan/dissectors/packet-dtls.c | 4 +-
epan/dissectors/packet-ssl-utils.c | 227 ++++++++++++------------------------
epan/dissectors/packet-ssl-utils.h | 25 +---
epan/dissectors/packet-ssl.c | 4 +-
4 files changed, 82 insertions(+), 178 deletions(-)