summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/sshbuf-getput-crypto.c
diff options
context:
space:
mode:
authordjm <djm@openbsd.org>2019-11-15 06:00:20 +0000
committerdjm <djm@openbsd.org>2019-11-15 06:00:20 +0000
commit07b718ede9babc17af66543ccb0bf8e8df904cb5 (patch)
treef58c3b4d25a96c9c1a6c2adadd02bbb64ed6e388 /usr.bin/ssh/sshbuf-getput-crypto.c
parentunshield security key privkey before attempting signature in (diff)
downloadwireguard-openbsd-07b718ede9babc17af66543ccb0bf8e8df904cb5.tar.xz
wireguard-openbsd-07b718ede9babc17af66543ccb0bf8e8df904cb5.zip
remove most uses of BN_CTX
We weren't following the rules re BN_CTX_start/BN_CTX_end and the places we were using it didn't benefit from its use anyway. ok dtucker@
Diffstat (limited to 'usr.bin/ssh/sshbuf-getput-crypto.c')
-rw-r--r--usr.bin/ssh/sshbuf-getput-crypto.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/usr.bin/ssh/sshbuf-getput-crypto.c b/usr.bin/ssh/sshbuf-getput-crypto.c
index fa91a8abd26..e3e71ba0cf2 100644
--- a/usr.bin/ssh/sshbuf-getput-crypto.c
+++ b/usr.bin/ssh/sshbuf-getput-crypto.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshbuf-getput-crypto.c,v 1.7 2019/01/21 09:54:11 djm Exp $ */
+/* $OpenBSD: sshbuf-getput-crypto.c,v 1.8 2019/11/15 06:00:20 djm Exp $ */
/*
* Copyright (c) 2011 Damien Miller
*
@@ -146,23 +146,17 @@ int
sshbuf_put_ec(struct sshbuf *buf, const EC_POINT *v, const EC_GROUP *g)
{
u_char d[SSHBUF_MAX_ECPOINT];
- BN_CTX *bn_ctx;
size_t len;
int ret;
- if ((bn_ctx = BN_CTX_new()) == NULL)
- return SSH_ERR_ALLOC_FAIL;
if ((len = EC_POINT_point2oct(g, v, POINT_CONVERSION_UNCOMPRESSED,
- NULL, 0, bn_ctx)) > SSHBUF_MAX_ECPOINT) {
- BN_CTX_free(bn_ctx);
+ NULL, 0, NULL)) > SSHBUF_MAX_ECPOINT) {
return SSH_ERR_INVALID_ARGUMENT;
}
if (EC_POINT_point2oct(g, v, POINT_CONVERSION_UNCOMPRESSED,
- d, len, bn_ctx) != len) {
- BN_CTX_free(bn_ctx);
+ d, len, NULL) != len) {
return SSH_ERR_INTERNAL_ERROR; /* Shouldn't happen */
}
- BN_CTX_free(bn_ctx);
ret = sshbuf_put_string(buf, d, len);
explicit_bzero(d, len);
return ret;