diff options
author | David Benjamin <davidben@davidben.net> | 2018-06-05 17:56:07 -0400 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2018-06-05 17:56:07 -0400 |
commit | 179eb1d0917ddc1067d056127e08e952206e0e91 (patch) | |
tree | 0afb9ac4381ddc109803b167da9fb1db257b6d41 /src/OpenSSL/crypto.py | |
parent | 7ac5f272c867cd9cfe2d14107e611af84c69b79b (diff) | |
download | pyopenssl-179eb1d0917ddc1067d056127e08e952206e0e91.tar.gz |
Only allocate exponent in the TYPE_RSA path. (#767)
Not much point in making it otherwise.
Diffstat (limited to 'src/OpenSSL/crypto.py')
-rw-r--r-- | src/OpenSSL/crypto.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/OpenSSL/crypto.py b/src/OpenSSL/crypto.py index adf03b4..d40f23c 100644 --- a/src/OpenSSL/crypto.py +++ b/src/OpenSSL/crypto.py @@ -288,15 +288,15 @@ class PKey(object): if not isinstance(bits, int): raise TypeError("bits must be an integer") - # TODO Check error return - exponent = _lib.BN_new() - exponent = _ffi.gc(exponent, _lib.BN_free) - _lib.BN_set_word(exponent, _lib.RSA_F4) - if type == TYPE_RSA: if bits <= 0: raise ValueError("Invalid number of bits") + # TODO Check error return + exponent = _lib.BN_new() + exponent = _ffi.gc(exponent, _lib.BN_free) + _lib.BN_set_word(exponent, _lib.RSA_F4) + rsa = _lib.RSA_new() result = _lib.RSA_generate_key_ex(rsa, bits, exponent, _ffi.NULL) |