| Line | Count | Source | 
| 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 |  |  * SPDX-License-Identifier: BSD-2-Clause | 
| 6 |  |  */ | 
| 7 |  |  | 
| 8 |  | #include "fido.h" | 
| 9 |  |  | 
| 10 |  | int | 
| 11 |  | fido_buf_read(const unsigned char **buf, size_t *len, void *dst, size_t count) | 
| 12 | 39.4k | { | 
| 13 | 39.4k |         if (count > *len) | 
| 14 | 1.15k |                 return (-1); | 
| 15 |  |  | 
| 16 | 38.3k |         memcpy(dst, *buf, count); | 
| 17 | 38.3k |         *buf += count; | 
| 18 | 38.3k |         *len -= count; | 
| 19 |  |  | 
| 20 | 38.3k |         return (0); | 
| 21 | 39.4k | } | 
| 22 |  |  | 
| 23 |  | int | 
| 24 |  | fido_buf_write(unsigned char **buf, size_t *len, const void *src, size_t count) | 
| 25 | 5.03M | { | 
| 26 | 5.03M |         if (count > *len) | 
| 27 | 15 |                 return (-1); | 
| 28 |  |  | 
| 29 | 5.03M |         memcpy(*buf, src, count); | 
| 30 | 5.03M |         *buf += count; | 
| 31 | 5.03M |         *len -= count; | 
| 32 |  |  | 
| 33 | 5.03M |         return (0); | 
| 34 | 5.03M | } |