|
Lines 3913-3918
convert_libcrypto_error(void)
Link Here
|
| 3913 |
return translate_libcrypto_error(ERR_peek_last_error()); |
3913 |
return translate_libcrypto_error(ERR_peek_last_error()); |
| 3914 |
} |
3914 |
} |
| 3915 |
|
3915 |
|
|
|
3916 |
static int |
| 3917 |
pem_passphrase_cb(char *buf, int size, int rwflag, void *u) |
| 3918 |
{ |
| 3919 |
char *p = (char *)u; |
| 3920 |
size_t len; |
| 3921 |
|
| 3922 |
if (p == NULL || (len = strlen(p)) == 0) |
| 3923 |
return -1; |
| 3924 |
if (size < 0 || len > (size_t)size) |
| 3925 |
return -1; |
| 3926 |
memcpy(buf, p, len); |
| 3927 |
return (int)len; |
| 3928 |
} |
| 3929 |
|
| 3916 |
static int |
3930 |
static int |
| 3917 |
sshkey_parse_private_pem_fileblob(struct sshbuf *blob, int type, |
3931 |
sshkey_parse_private_pem_fileblob(struct sshbuf *blob, int type, |
| 3918 |
const char *passphrase, struct sshkey **keyp) |
3932 |
const char *passphrase, struct sshkey **keyp) |
|
Lines 3934-3940
sshkey_parse_private_pem_fileblob(struct sshbuf *blob, int type,
Link Here
|
| 3934 |
} |
3948 |
} |
| 3935 |
|
3949 |
|
| 3936 |
clear_libcrypto_errors(); |
3950 |
clear_libcrypto_errors(); |
| 3937 |
if ((pk = PEM_read_bio_PrivateKey(bio, NULL, NULL, |
3951 |
if ((pk = PEM_read_bio_PrivateKey(bio, NULL, pem_passphrase_cb, |
| 3938 |
(char *)passphrase)) == NULL) { |
3952 |
(char *)passphrase)) == NULL) { |
| 3939 |
/* |
3953 |
/* |
| 3940 |
* libcrypto may return various ASN.1 errors when attempting |
3954 |
* libcrypto may return various ASN.1 errors when attempting |