OpenSSL: Save memory allocations in generate_key()