Skip to content

Commit

Permalink
Enable use of OpenSSL that doesn't have DSA.
Browse files Browse the repository at this point in the history
Added #if LIBSSH2_DSA for all DSA functions.
  • Loading branch information
LarsNordin-LNdata authored and alamaison committed Apr 1, 2015
1 parent 983ceaf commit e113202
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,7 @@ gen_publickey_from_rsa(LIBSSH2_SESSION *session, RSA *rsa,
return key;
}

#if LIBSSH2_DSA
static unsigned char *
gen_publickey_from_dsa(LIBSSH2_SESSION* session, DSA *dsa,
size_t *key_len)
Expand Down Expand Up @@ -694,6 +695,7 @@ gen_publickey_from_dsa(LIBSSH2_SESSION* session, DSA *dsa,
*key_len = (size_t)(p - key);
return key;
}
#endif /* LIBSSH_DSA */

static int
gen_publickey_from_rsa_evp(LIBSSH2_SESSION *session,
Expand Down Expand Up @@ -749,6 +751,7 @@ gen_publickey_from_rsa_evp(LIBSSH2_SESSION *session,
"Unable to allocate memory for private key data");
}

#if LIBSSH2_DSA
static int
gen_publickey_from_dsa_evp(LIBSSH2_SESSION *session,
unsigned char **method,
Expand Down Expand Up @@ -802,6 +805,7 @@ gen_publickey_from_dsa_evp(LIBSSH2_SESSION *session,
LIBSSH2_ERROR_ALLOC,
"Unable to allocate memory for private key data");
}
#endif /* LIBSSH_DSA */

int
_libssh2_pub_priv_keyfile(LIBSSH2_SESSION *session,
Expand Down Expand Up @@ -855,10 +859,12 @@ _libssh2_pub_priv_keyfile(LIBSSH2_SESSION *session,
session, method, method_len, pubkeydata, pubkeydata_len, pk);
break;

#if LIBSSH2_DSA
case EVP_PKEY_DSA :
st = gen_publickey_from_dsa_evp(
session, method, method_len, pubkeydata, pubkeydata_len, pk);
break;
#endif /* LIBSSH_DSA */

default :
st = _libssh2_error(session,
Expand Down Expand Up @@ -921,12 +927,12 @@ _libssh2_pub_priv_keyfilememory(LIBSSH2_SESSION *session,
st = gen_publickey_from_rsa_evp(session, method, method_len,
pubkeydata, pubkeydata_len, pk);
break;

#if LIBSSH2_DSA
case EVP_PKEY_DSA :
st = gen_publickey_from_dsa_evp(session, method, method_len,
pubkeydata, pubkeydata_len, pk);
break;

#endif /* LIBSSH_DSA */
default :
st = _libssh2_error(session,
LIBSSH2_ERROR_FILE,
Expand Down

0 comments on commit e113202

Please sign in to comment.