mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-04-08 18:35:05 +02:00
compat code for fido_assert_set_clientdata()
This commit is contained in:
parent
d6b5aa08fd
commit
56192518e3
@ -3230,6 +3230,7 @@ if test "x$enable_sk" = "xyes" -a "x$enable_sk_internal" = "xyes" ; then
|
||||
saved_LIBS="$LIBS"
|
||||
LIBS="$LIBS $LIBFIDO2"
|
||||
AC_CHECK_FUNCS([ \
|
||||
fido_assert_set_clientdata \
|
||||
fido_cred_prot \
|
||||
fido_cred_set_prot \
|
||||
fido_cred_set_clientdata \
|
||||
|
28
sk-usbhid.c
28
sk-usbhid.c
@ -312,7 +312,8 @@ sk_touch_poll(struct sk_usbhid **skv, size_t nsk, int *touch, size_t *idx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef HAVE_FIDO_CRED_SET_CLIENTDATA
|
||||
#if !defined(FIDO_ASSERT_SET_CLIENTDATA) || \
|
||||
!defined(HAVE_FIDO_CRED_SET_CLIENTDATA)
|
||||
/* Calculate SHA256(m) */
|
||||
static int
|
||||
sha256_mem(const void *m, size_t mlen, u_char *d, size_t dlen)
|
||||
@ -336,8 +337,10 @@ sha256_mem(const void *m, size_t mlen, u_char *d, size_t dlen)
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
#endif /* !FIDO_ASSERT_SET_CLIENTDATA || !HAVE_FIDO_CRED_SET_CLIENTDATA */
|
||||
|
||||
int
|
||||
#ifndef HAVE_FIDO_CRED_SET_CLIENTDATA
|
||||
static int
|
||||
fido_cred_set_clientdata(fido_cred_t *cred, const u_char *ptr, size_t len)
|
||||
{
|
||||
uint8_t d[32];
|
||||
@ -357,6 +360,27 @@ fido_cred_set_clientdata(fido_cred_t *cred, const u_char *ptr, size_t len)
|
||||
}
|
||||
#endif /* HAVE_FIDO_CRED_SET_CLIENTDATA */
|
||||
|
||||
#ifndef HAVE_ASSERT_CRED_SET_CLIENTDATA
|
||||
static int
|
||||
fido_assert_set_clientdata(fido_assert_t *assert, const u_char *ptr, size_t len)
|
||||
{
|
||||
uint8_t d[32];
|
||||
int r;
|
||||
|
||||
if (sha256_mem(ptr, len, d, sizeof(d)) != 0) {
|
||||
skdebug(__func__, "hash challenge failed");
|
||||
return FIDO_ERR_INTERNAL;
|
||||
}
|
||||
r = fido_assert_set_clientdata_hash(assert, d, sizeof(d));
|
||||
explicit_bzero(d, sizeof(d));
|
||||
if (r != FIDO_OK) {
|
||||
skdebug(__func__, "fido_assert_set_clientdata_hash failed: %s",
|
||||
fido_strerr(r));
|
||||
}
|
||||
return r;
|
||||
}
|
||||
#endif /* HAVE_FIDO_ASSERT_SET_CLIENTDATA */
|
||||
|
||||
/* Check if the specified key handle exists on a given sk. */
|
||||
static int
|
||||
sk_try(const struct sk_usbhid *sk, const char *application,
|
||||
|
Loading…
x
Reference in New Issue
Block a user