diff options
author | Peter Wu <peter@lekensteyn.nl> | 2015-07-16 23:06:36 +0200 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2015-07-16 23:13:33 +0000 |
commit | b99f10bea7273574470cc87fcbd82acad3b0b29a (patch) | |
tree | 241665788a334ab5f5a159c97de3d83170a76cae /epan/dissectors/packet-ssl-utils.c | |
parent | 255d53dfc11fa49eadd30fefe3ed5950b03e6659 (diff) |
ssl-utils: fix RSA keys with GnuTLS 2.12.23
Apparently GnuTLS 2.12.23 as used on Ubuntu 14.04 produces different
outputs for the u parameter as observed in gdb. GnuTLS 3.4.2 on Arch
Linux works fine. Workaround this issue by unconditionally calculating
the inverse.
Change-Id: I8406352f8c570b355ea774cafc903662d06888ac
Fixes: v1.99.8rc0-417-g85f8a99
Bug: 11371
Reviewed-on: https://code.wireshark.org/review/9666
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'epan/dissectors/packet-ssl-utils.c')
-rw-r--r-- | epan/dissectors/packet-ssl-utils.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/epan/dissectors/packet-ssl-utils.c b/epan/dissectors/packet-ssl-utils.c index 3a8ecae7d8..20e8f30bd6 100644 --- a/epan/dissectors/packet-ssl-utils.c +++ b/epan/dissectors/packet-ssl-utils.c @@ -3489,11 +3489,11 @@ ssl_privkey_to_sexp(struct gnutls_x509_privkey_int* priv_key) /* p, q = q, p */ gcry_mpi_swap(rsa_params[3], rsa_params[4]); /* due to swapping p and q, u = p^-1 mod p which happens to be needed. */ - } else { - /* libgcrypt expects u = p^-1 mod q (for OpenPGP), but the u parameter - * says u = q^-1 mod p. Recompute u = p^-1 mod q. */ - gcry_mpi_invm(rsa_params[5], rsa_params[3], rsa_params[4]); } + /* libgcrypt expects u = p^-1 mod q (for OpenPGP), but the u parameter + * says u = q^-1 mod p. Recompute u = p^-1 mod q. Do this unconditionally as + * at least GnuTLS 2.12.23 computes an invalid value. */ + gcry_mpi_invm(rsa_params[5], rsa_params[3], rsa_params[4]); if (gcry_sexp_build( &rsa_priv_key, NULL, "(private-key(rsa((n%m)(e%m)(d%m)(p%m)(q%m)(u%m))))", rsa_params[0], |