From bb754b470c360e787a99fb4e88e2668198e97b41 Mon Sep 17 00:00:00 2001 From: "djm@openbsd.org" Date: Fri, 1 Oct 2021 04:50:36 +0000 Subject: [PATCH] upstream: unbreak FIDO sk-ed25519 key enrollment for OPENSSL=no builds; ok dtucker@ OpenBSD-Commit-ID: 6323a5241728626cbb2bf0452cf6a5bcbd7ff709 --- sk-usbhid.c | 8 ++++++-- 1 file 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; }