upstream: unbreak FIDO sk-ed25519 key enrollment for OPENSSL=no builds;

ok dtucker@

OpenBSD-Commit-ID: 6323a5241728626cbb2bf0452cf6a5bcbd7ff709
This commit is contained in:
djm@openbsd.org 2021-10-01 04:50:36 +00:00 committed by Damien Miller
parent 207648d7a6
commit bb754b470c
1 changed files with 6 additions and 2 deletions

View File

@ -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;
}