Coverage Report

Created: 2022-01-17 10:46

/libfido2/src/buf.c
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
15.1k
{
12
15.1k
        if (count > *len)
13
254
                return (-1);
14
15
14.9k
        memcpy(dst, *buf, count);
16
14.9k
        *buf += count;
17
14.9k
        *len -= count;
18
19
14.9k
        return (0);
20
14.9k
}
21
22
int
23
fido_buf_write(unsigned char **buf, size_t *len, const void *src, size_t count)
24
3.94M
{
25
3.94M
        if (count > *len)
26
0
                return (-1);
27
28
3.94M
        memcpy(*buf, src, count);
29
3.94M
        *buf += count;
30
3.94M
        *len -= count;
31
32
3.94M
        return (0);
33
3.94M
}