summaryrefslogtreecommitdiffstats
path: root/sk-usbhid.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2021-10-01 06:50:36 +0200
committerDamien Miller <djm@mindrot.org>2021-10-01 06:53:24 +0200
commitbb754b470c360e787a99fb4e88e2668198e97b41 (patch)
tree4add71243355aeb68d9d470f9c0ff242da68a565 /sk-usbhid.c
parentInclude stdlib.h for arc4random_uniform prototype. (diff)
downloadopenssh-bb754b470c360e787a99fb4e88e2668198e97b41.tar.xz
openssh-bb754b470c360e787a99fb4e88e2668198e97b41.zip
upstream: unbreak FIDO sk-ed25519 key enrollment for OPENSSL=no builds;
ok dtucker@ OpenBSD-Commit-ID: 6323a5241728626cbb2bf0452cf6a5bcbd7ff709
Diffstat (limited to 'sk-usbhid.c')
-rw-r--r--sk-usbhid.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sk-usbhid.c b/sk-usbhid.c
index 438980889..2fdf3d94f 100644
--- a/sk-usbhid.c
+++ b/sk-usbhid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sk-usbhid.c,v 1.30 2021/05/31 06:48:42 djm Exp $ */
+/* $OpenBSD: sk-usbhid.c,v 1.31 2021/10/01 04:50:36 djm Exp $ */
/*
* Copyright (c) 2019 Markus Friedl
* Copyright (c) 2020 Pedro Martelletto
@@ -306,6 +306,8 @@ sha256_mem(const void *m, size_t mlen, u_char *d, size_t dlen)
{
#ifdef WITH_OPENSSL
u_int mdlen;
+#else
+ SHA2_CTX ctx;
#endif
if (dlen != 32)
@@ -315,7 +317,9 @@ sha256_mem(const void *m, size_t mlen, u_char *d, size_t dlen)
if (!EVP_Digest(m, mlen, d, &mdlen, EVP_sha256(), NULL))
return -1;
#else
- SHA256Data(m, mlen, d);
+ SHA256Init(&ctx);
+ SHA256Update(&ctx, (const uint8_t *)m, mlen);
+ SHA256Final(d, &ctx);
#endif
return 0;
}