diff options
author | 2019-11-14 21:14:10 +0000 | |
---|---|---|
committer | 2019-11-14 21:14:10 +0000 | |
commit | d75efeb73338e77fafc7850eff396e820d2d7935 (patch) | |
tree | aae45e648d23698ee6ff08637f11476e42e5a447 /lib/libfido2/src/buf.c | |
parent | Unleash all the available openings and let the midlayer sort things (diff) | |
download | wireguard-openbsd-d75efeb73338e77fafc7850eff396e820d2d7935.tar.xz wireguard-openbsd-d75efeb73338e77fafc7850eff396e820d2d7935.zip |
import libfido2 (git HEAD). This library allows communication with
U2F/FIDO2 devices over USB.
feedback and "start the churn" deraadt@
Diffstat (limited to 'lib/libfido2/src/buf.c')
-rw-r--r-- | lib/libfido2/src/buf.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/libfido2/src/buf.c b/lib/libfido2/src/buf.c new file mode 100644 index 00000000000..67ff95a2d36 --- /dev/null +++ b/lib/libfido2/src/buf.c @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2018 Yubico AB. All rights reserved. + * Use of this source code is governed by a BSD-style + * license that can be found in the LICENSE file. + */ + +#include <string.h> +#include "fido.h" + +int +buf_read(const unsigned char **buf, size_t *len, void *dst, size_t count) +{ + if (count > *len) + return (-1); + + memcpy(dst, *buf, count); + *buf += count; + *len -= count; + + return (0); +} + +int +buf_write(unsigned char **buf, size_t *len, const void *src, size_t count) +{ + if (count > *len) + return (-1); + + memcpy(*buf, src, count); + *buf += count; + *len -= count; + + return (0); +} |