Debian Codegraph @

tests/external_override/poly1305_override.c

raw
1 /*
2 * This file is part of the SSH Library
3 *
4 * Copyright (c) 2021 by Anderson Toshiyuki Sasaki - Red Hat, Inc.
5 *
6 * The SSH Library is free software: you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation, either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * The SSH Library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with the SSH Library; see the file COPYING. If not,
18 * see <https://www.gnu.org/licenses/>.
19 */
20
21 #include "config.h"
22
23 #include <stdlib.h>
24 #include <stdint.h>
25 #include <stdio.h>
26 #include <libssh/poly1305.h>
27 #include <libssh/priv.h>
28
29 static bool internal_function_called = false;
30
31 void __wrap_poly1305_auth(uint8_t out[POLY1305_TAGLEN],
32 const uint8_t *m,
33 size_t inlen,
34 const uint8_t key[POLY1305_KEYLEN])
35 #ifdef HAVE_GCC_BOUNDED_ATTRIBUTE
36 __attribute__((__bounded__(__minbytes__, 1, POLY1305_TAGLEN)))
37 __attribute__((__bounded__(__buffer__, 2, 3)))
38 __attribute__((__bounded__(__minbytes__, 4, POLY1305_KEYLEN)))
39 #endif
40 {
41 fprintf(stderr, "%s: Internal implementation was called\n", __func__);
42 internal_function_called = true;
43 poly1305_auth(out, m, inlen, key);
44 }
45
46 bool internal_poly1305_function_called(void)
47 {
48 return internal_function_called;
49 }
50
51 void reset_poly1305_function_called(void)
52 {
53 internal_function_called = false;
54 }