diff options
author | Martin Willi <martin@strongswan.org> | 2008-05-13 13:52:45 +0000 |
---|---|---|
committer | Martin Willi <martin@strongswan.org> | 2008-05-13 13:52:45 +0000 |
commit | 7af8995cdec2783433b01c78a8a6c49b682d1fd1 (patch) | |
tree | 13f230bc7d9011182bbac62db8cd67002aed7d34 | |
parent | 02ffd896420239ec6941e5ec2c4030611ed6eaf6 (diff) | |
download | strongswan-7af8995cdec2783433b01c78a8a6c49b682d1fd1.tar.bz2 strongswan-7af8995cdec2783433b01c78a8a6c49b682d1fd1.tar.xz |
fixed unsave calculation of mpz_export length
-rw-r--r-- | src/libstrongswan/plugins/gmp/gmp_rsa_private_key.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/libstrongswan/plugins/gmp/gmp_rsa_private_key.c b/src/libstrongswan/plugins/gmp/gmp_rsa_private_key.c index b6285dad7..5eb28cb20 100644 --- a/src/libstrongswan/plugins/gmp/gmp_rsa_private_key.c +++ b/src/libstrongswan/plugins/gmp/gmp_rsa_private_key.c @@ -373,11 +373,9 @@ static bool belongs_to(private_gmp_rsa_private_key_t *this, public_key_t *public */ chunk_t gmp_mpz_to_asn1(const mpz_t value) { - size_t bits = mpz_sizeinbase(value, 2); /* size in bits */ chunk_t n; - n.len = 1 + bits / 8; /* size in bytes */ - n.ptr = mpz_export(NULL, NULL, 1, n.len, 1, 0, value); + n.ptr = mpz_export(NULL, &n.len, 1, 1, 1, 0, value); return asn1_wrap(ASN1_INTEGER, "m", n); } |