View | Details | Raw Unified | Return to bug 2913 | Differences between
and this patch

Collapse All | Expand All

(-)a/sshkey.c (-3 / +22 lines)
Lines 3914-3919 convert_libcrypto_error(void) Link Here
3914
	return translate_libcrypto_error(ERR_peek_last_error());
3914
	return translate_libcrypto_error(ERR_peek_last_error());
3915
}
3915
}
3916
3916
3917
static int
3918
sshkey_passphrase_callback(char *buf, int size, int rwflag, void *u)
3919
{
3920
	char *p = (char *)u;
3921
	size_t len;
3922
3923
	if (p == NULL)
3924
		return -1;
3925
3926
	len = strlen(p);
3927
	if (len == 0)
3928
		return -1;
3929
3930
	if (len > size)
3931
		len = size;
3932
	memcpy(buf, p, len);
3933
3934
	return len;
3935
}
3936
3917
static int
3937
static int
3918
sshkey_parse_private_pem_fileblob(struct sshbuf *blob, int type,
3938
sshkey_parse_private_pem_fileblob(struct sshbuf *blob, int type,
3919
    const char *passphrase, struct sshkey **keyp)
3939
    const char *passphrase, struct sshkey **keyp)
Lines 3935-3942 sshkey_parse_private_pem_fileblob(struct sshbuf *blob, int type, Link Here
3935
	}
3955
	}
3936
3956
3937
	clear_libcrypto_errors();
3957
	clear_libcrypto_errors();
3938
	if ((pk = PEM_read_bio_PrivateKey(bio, NULL, NULL,
3958
	if ((pk = PEM_read_bio_PrivateKey(bio, NULL,
3939
	    (char *)passphrase)) == NULL) {
3959
	    sshkey_passphrase_callback, (char *)passphrase)) == NULL) {
3940
		r = convert_libcrypto_error();
3960
		r = convert_libcrypto_error();
3941
		goto out;
3961
		goto out;
3942
	}
3962
	}
3943
- 

Return to bug 2913