diff options
author | Ahmad Fatoum <ahmad@a3f.at> | 2017-04-26 07:33:25 +0200 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2017-06-05 23:43:03 +0000 |
commit | 502cc61711173273ffb8be2cf895f5e79c3b47bc (patch) | |
tree | 53db680580f3ca6a56461908330b9a30218a1449 /wsutil/wsgcrypt.h | |
parent | 1b228df643121ab2fabde34226701b9cd92401be (diff) |
Move RSA key loading and decryption functions to wsutil
Loading PEM and PKCS#11 keys was being done in static functions
in packet-ssl-utils.c. These were moved to wsutil, with prototypes
in a new <wsutil/rsa.h> header. This adds gnutls as optional
dependency to wsutil.
The RSA decryption helper was also moved and is now provided in
<wsutil/wsgcrypt.h>.
This allows more dissectors to access this functionality.
Change-Id: I6cfbbf5203f2881c82bad721747834ccd76e2033
Reviewed-on: https://code.wireshark.org/review/21941
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'wsutil/wsgcrypt.h')
-rw-r--r-- | wsutil/wsgcrypt.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/wsutil/wsgcrypt.h b/wsutil/wsgcrypt.h index 90ad24081d..8ad0fcfd4f 100644 --- a/wsutil/wsgcrypt.h +++ b/wsutil/wsgcrypt.h @@ -51,4 +51,8 @@ WS_DLL_PUBLIC gcry_error_t ws_hmac_buffer(int algo, void *digest, const void *bu 64 bits as key, encrypted data is returned in OUTPUT which must be at least 8 bytes large */ WS_DLL_PUBLIC void crypt_des_ecb(guint8 *output, const guint8 *buffer, const guint8 *key56); +/* Convenience function for RSA decryption. Returns decrypted length on success, 0 on failure */ +WS_DLL_PUBLIC size_t rsa_decrypt_inplace(const guint len, guchar* data, gcry_sexp_t pk, gboolean pkcs1_padding, char **err); + + #endif /* __WSGCRYPT_H__ */ |