mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-08-08 19:02:06 +03:00
pki: Fix ssh_key_dup().
This commit is contained in:
@@ -114,7 +114,7 @@ ssh_key pki_key_dup(const ssh_key key, int demote)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!demote && (key->flags == SSH_KEY_FLAG_PRIVATE)) {
|
||||
if (!demote && (key->flags & SSH_KEY_FLAG_PRIVATE)) {
|
||||
new->dsa->priv_key = BN_dup(key->dsa->priv_key);
|
||||
if (new->dsa->priv_key == NULL) {
|
||||
goto fail;
|
||||
@@ -149,7 +149,7 @@ ssh_key pki_key_dup(const ssh_key key, int demote)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!demote && (key->flags == SSH_KEY_FLAG_PRIVATE)) {
|
||||
if (!demote && (key->flags & SSH_KEY_FLAG_PRIVATE)) {
|
||||
new->rsa->d = BN_dup(key->rsa->d);
|
||||
if (new->rsa->d == NULL) {
|
||||
goto fail;
|
||||
|
@@ -808,7 +808,7 @@ ssh_key pki_key_dup(const ssh_key key, int demote)
|
||||
ssh_string_fill(y, (char *)tmp, size);
|
||||
gcry_sexp_release(sexp);
|
||||
|
||||
if (!demote && (key->flags == SSH_KEY_FLAG_PRIVATE)) {
|
||||
if (!demote && (key->flags & SSH_KEY_FLAG_PRIVATE)) {
|
||||
sexp = gcry_sexp_find_token(key->dsa, "x", 0);
|
||||
if (sexp == NULL) {
|
||||
goto fail;
|
||||
@@ -877,7 +877,7 @@ ssh_key pki_key_dup(const ssh_key key, int demote)
|
||||
ssh_string_fill(e, (char *)tmp, size);
|
||||
gcry_sexp_release(sexp);
|
||||
|
||||
if (!demote && (key->flags == SSH_KEY_FLAG_PRIVATE)) {
|
||||
if (!demote && (key->flags & SSH_KEY_FLAG_PRIVATE)) {
|
||||
sexp = gcry_sexp_find_token(key->rsa, "d", 0);
|
||||
if (sexp == NULL) {
|
||||
goto fail;
|
||||
|
Reference in New Issue
Block a user