Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (c) 2018 Yubico AB. All rights reserved. |
3 | | * Use of this source code is governed by a BSD-style |
4 | | * license that can be found in the LICENSE file. |
5 | | */ |
6 | | |
7 | | #include "fido.h" |
8 | | |
9 | | int |
10 | | fido_buf_read(const unsigned char **buf, size_t *len, void *dst, size_t count) |
11 | 14.3k | { |
12 | 14.3k | if (count > *len) |
13 | 489 | return (-1); |
14 | | |
15 | 13.8k | memcpy(dst, *buf, count); |
16 | 13.8k | *buf += count; |
17 | 13.8k | *len -= count; |
18 | | |
19 | 13.8k | return (0); |
20 | 14.3k | } |
21 | | |
22 | | int |
23 | | fido_buf_write(unsigned char **buf, size_t *len, const void *src, size_t count) |
24 | 3.12M | { |
25 | 3.12M | if (count > *len) |
26 | 0 | return (-1); |
27 | | |
28 | 3.12M | memcpy(*buf, src, count); |
29 | 3.12M | *buf += count; |
30 | 3.12M | *len -= count; |
31 | | |
32 | 3.12M | return (0); |
33 | 3.12M | } |