version 1.120, 2015/12/11 04:21:11 |
version 1.121, 2016/04/09 12:39:30 |
|
|
struct sshbuf *b = NULL; |
struct sshbuf *b = NULL; |
int r; |
int r; |
|
|
*keyp = NULL; |
if (keyp != NULL) |
|
*keyp = NULL; |
if (commentp != NULL) |
if (commentp != NULL) |
*commentp = NULL; |
*commentp = NULL; |
|
|
|
|
{ |
{ |
int fd, r; |
int fd, r; |
|
|
*keyp = NULL; |
if (keyp != NULL) |
|
*keyp = NULL; |
if (commentp != NULL) |
if (commentp != NULL) |
*commentp = NULL; |
*commentp = NULL; |
|
|
|
|
struct sshbuf *buffer = NULL; |
struct sshbuf *buffer = NULL; |
int r; |
int r; |
|
|
|
if (keyp != NULL) |
|
*keyp = NULL; |
if ((buffer = sshbuf_new()) == NULL) { |
if ((buffer = sshbuf_new()) == NULL) { |
r = SSH_ERR_ALLOC_FAIL; |
r = SSH_ERR_ALLOC_FAIL; |
goto out; |
goto out; |
|
|
struct sshbuf *buffer = NULL; |
struct sshbuf *buffer = NULL; |
int r, fd; |
int r, fd; |
|
|
*keyp = NULL; |
if (keyp != NULL) |
|
*keyp = NULL; |
if (commentp != NULL) |
if (commentp != NULL) |
*commentp = NULL; |
*commentp = NULL; |
|
|
|
|
char *file = NULL; |
char *file = NULL; |
int r = SSH_ERR_INTERNAL_ERROR; |
int r = SSH_ERR_INTERNAL_ERROR; |
|
|
*keyp = NULL; |
if (keyp != NULL) |
|
*keyp = NULL; |
|
|
if (asprintf(&file, "%s-cert.pub", filename) == -1) |
if (asprintf(&file, "%s-cert.pub", filename) == -1) |
return SSH_ERR_ALLOC_FAIL; |
return SSH_ERR_ALLOC_FAIL; |
|
|
} |
} |
if ((r = sshkey_try_load_public(pub, file, NULL)) != 0) |
if ((r = sshkey_try_load_public(pub, file, NULL)) != 0) |
goto out; |
goto out; |
|
/* success */ |
*keyp = pub; |
if (keyp != NULL) { |
pub = NULL; |
*keyp = pub; |
|
pub = NULL; |
|
} |
r = 0; |
r = 0; |
|
|
out: |
out: |
free(file); |
free(file); |
sshkey_free(pub); |
sshkey_free(pub); |
|
|
struct sshkey *key = NULL, *cert = NULL; |
struct sshkey *key = NULL, *cert = NULL; |
int r; |
int r; |
|
|
*keyp = NULL; |
if (keyp != NULL) |
|
*keyp = NULL; |
|
|
switch (type) { |
switch (type) { |
#ifdef WITH_OPENSSL |
#ifdef WITH_OPENSSL |
|
|
(r = sshkey_cert_copy(cert, key)) != 0) |
(r = sshkey_cert_copy(cert, key)) != 0) |
goto out; |
goto out; |
r = 0; |
r = 0; |
*keyp = key; |
if (keyp != NULL) { |
key = NULL; |
*keyp = key; |
|
key = NULL; |
|
} |
out: |
out: |
sshkey_free(key); |
sshkey_free(key); |
sshkey_free(cert); |
sshkey_free(cert); |