-/* $OpenBSD: tls.c,v 1.66 2017/06/22 17:58:54 jsing Exp $ */
+/* $OpenBSD: tls.c,v 1.67 2017/06/22 18:03:57 jsing Exp $ */
/*
* Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
*
*hash = NULL;
- if ((membio = BIO_new_mem_buf(keypair->cert_mem, keypair->cert_len))
- == NULL)
+ if ((membio = BIO_new_mem_buf(keypair->cert_mem,
+ keypair->cert_len)) == NULL)
goto err;
-
- if ((cert = PEM_read_bio_X509_AUX(membio, NULL, NULL, NULL)) == NULL)
+ if ((cert = PEM_read_bio_X509_AUX(membio, NULL, tls_password_cb,
+ NULL)) == NULL)
goto err;
rv = tls_cert_hash(cert, hash);
tls_set_errorx(ctx, "failed to create buffer");
goto err;
}
- if ((pkey = PEM_read_bio_PrivateKey(bio, NULL, NULL,
+ if ((pkey = PEM_read_bio_PrivateKey(bio, NULL, tls_password_cb,
NULL)) == NULL) {
tls_set_errorx(ctx, "failed to read private key");
goto err;
-/* $OpenBSD: tls_internal.h,v 1.60 2017/05/07 03:27:06 jsing Exp $ */
+/* $OpenBSD: tls_internal.h,v 1.61 2017/06/22 18:03:57 jsing Exp $ */
/*
* Copyright (c) 2014 Jeremie Courreges-Anglas <jca@openbsd.org>
* Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
size_t *_outlen);
int tls_cert_hash(X509 *_cert, char **_hash);
+int tls_password_cb(char *_buf, int _size, int _rwflag, void *_u);
+
__END_HIDDEN_DECLS
/* XXX this function is not fully hidden so relayd can use it */
-/* $OpenBSD: tls_server.c,v 1.38 2017/06/22 17:34:25 jsing Exp $ */
+/* $OpenBSD: tls_server.c,v 1.39 2017/06/22 18:03:57 jsing Exp $ */
/*
* Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
*
tls_error_set(error, "failed to create certificate bio");
goto err;
}
- if ((*cert = PEM_read_bio_X509(cert_bio, NULL, NULL, NULL)) == NULL) {
+ if ((*cert = PEM_read_bio_X509(cert_bio, NULL, tls_password_cb,
+ NULL)) == NULL) {
if ((ssl_err = ERR_peek_error()) != 0)
errstr = ERR_error_string(ssl_err, NULL);
tls_error_set(error, "failed to load certificate: %s", errstr);
-/* $OpenBSD: tls_util.c,v 1.8 2017/05/06 21:34:13 jsing Exp $ */
+/* $OpenBSD: tls_util.c,v 1.9 2017/06/22 18:03:57 jsing Exp $ */
/*
* Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
* Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
return (rv);
}
-static int
+int
tls_password_cb(char *buf, int size, int rwflag, void *u)
{
size_t len;