version 1.21, 2015/08/19 23:19:01 |
version 1.22, 2015/09/02 07:51:12 |
|
|
|
|
if ((ret = sshbuf_putb(to->certblob, from->certblob)) != 0 || |
if ((ret = sshbuf_putb(to->certblob, from->certblob)) != 0 || |
(ret = sshbuf_putb(to->critical, from->critical)) != 0 || |
(ret = sshbuf_putb(to->critical, from->critical)) != 0 || |
(ret = sshbuf_putb(to->extensions, from->extensions) != 0)) |
(ret = sshbuf_putb(to->extensions, from->extensions)) != 0) |
return ret; |
return ret; |
|
|
to->serial = from->serial; |
to->serial = from->serial; |
|
|
goto out; |
goto out; |
} |
} |
if ((r = sshkey_ec_validate_public(EC_KEY_get0_group(k->ecdsa), |
if ((r = sshkey_ec_validate_public(EC_KEY_get0_group(k->ecdsa), |
EC_KEY_get0_public_key(k->ecdsa)) != 0) || |
EC_KEY_get0_public_key(k->ecdsa))) != 0 || |
(r = sshkey_ec_validate_private(k->ecdsa)) != 0) |
(r = sshkey_ec_validate_private(k->ecdsa)) != 0) |
goto out; |
goto out; |
break; |
break; |
|
|
goto out; |
goto out; |
} |
} |
if ((r = sshkey_ec_validate_public(EC_KEY_get0_group(k->ecdsa), |
if ((r = sshkey_ec_validate_public(EC_KEY_get0_group(k->ecdsa), |
EC_KEY_get0_public_key(k->ecdsa)) != 0) || |
EC_KEY_get0_public_key(k->ecdsa))) != 0 || |
(r = sshkey_ec_validate_private(k->ecdsa)) != 0) |
(r = sshkey_ec_validate_private(k->ecdsa)) != 0) |
goto out; |
goto out; |
break; |
break; |
|
|
case KEY_RSA_CERT: |
case KEY_RSA_CERT: |
if ((r = sshkey_froms(buf, &k)) != 0 || |
if ((r = sshkey_froms(buf, &k)) != 0 || |
(r = sshkey_add_private(k)) != 0 || |
(r = sshkey_add_private(k)) != 0 || |
(r = sshbuf_get_bignum2(buf, k->rsa->d) != 0) || |
(r = sshbuf_get_bignum2(buf, k->rsa->d)) != 0 || |
(r = sshbuf_get_bignum2(buf, k->rsa->iqmp) != 0) || |
(r = sshbuf_get_bignum2(buf, k->rsa->iqmp)) != 0 || |
(r = sshbuf_get_bignum2(buf, k->rsa->p) != 0) || |
(r = sshbuf_get_bignum2(buf, k->rsa->p)) != 0 || |
(r = sshbuf_get_bignum2(buf, k->rsa->q) != 0) || |
(r = sshbuf_get_bignum2(buf, k->rsa->q)) != 0 || |
(r = rsa_generate_additional_parameters(k->rsa)) != 0) |
(r = rsa_generate_additional_parameters(k->rsa)) != 0) |
goto out; |
goto out; |
break; |
break; |
|
|
|
|
/* Store public key. This will be in plain text. */ |
/* Store public key. This will be in plain text. */ |
if ((r = sshbuf_put_u32(encrypted, BN_num_bits(key->rsa->n))) != 0 || |
if ((r = sshbuf_put_u32(encrypted, BN_num_bits(key->rsa->n))) != 0 || |
(r = sshbuf_put_bignum1(encrypted, key->rsa->n) != 0) || |
(r = sshbuf_put_bignum1(encrypted, key->rsa->n)) != 0 || |
(r = sshbuf_put_bignum1(encrypted, key->rsa->e) != 0) || |
(r = sshbuf_put_bignum1(encrypted, key->rsa->e)) != 0 || |
(r = sshbuf_put_cstring(encrypted, comment) != 0)) |
(r = sshbuf_put_cstring(encrypted, comment)) != 0) |
goto out; |
goto out; |
|
|
/* Allocate space for the private part of the key in the buffer. */ |
/* Allocate space for the private part of the key in the buffer. */ |