1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-30 13:01:23 +03:00

pki_crypto: Don't use deprecated function with newer OpenSSL

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Andreas Schneider
2017-10-29 16:06:14 +01:00
parent 7527876fad
commit 954da14c15

View File

@@ -453,11 +453,24 @@ int pki_key_generate_rsa(ssh_key key, int parameter){
int pki_key_generate_dss(ssh_key key, int parameter){ int pki_key_generate_dss(ssh_key key, int parameter){
int rc; int rc;
#if OPENSSL_VERSION_NUMBER > 0x10100000L
rc = DSA_generate_parameters_ex(key->dsa,
parameter,
NULL, /* seed */
0, /* seed_len */
NULL, /* counter_ret */
NULL, /* h_ret */
NULL); /* cb */
if (rc != 1) {
return SSH_ERROR;
}
#else
key->dsa = DSA_generate_parameters(parameter, NULL, 0, NULL, NULL, key->dsa = DSA_generate_parameters(parameter, NULL, 0, NULL, NULL,
NULL, NULL); NULL, NULL);
if(key->dsa == NULL){ if(key->dsa == NULL){
return SSH_ERROR; return SSH_ERROR;
} }
#endif
rc = DSA_generate_key(key->dsa); rc = DSA_generate_key(key->dsa);
if (rc != 1){ if (rc != 1){
DSA_free(key->dsa); DSA_free(key->dsa);