Coverage Report

Created: 2023-03-26 08:33

/src/gnutls/lib/mem.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright (C) 2000-2012 Free Software Foundation, Inc.
3
 *
4
 * Author: Nikos Mavrogiannopoulos
5
 *
6
 * This file is part of GnuTLS.
7
 *
8
 * The GnuTLS is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU Lesser General Public License
10
 * as published by the Free Software Foundation; either version 2.1 of
11
 * the License, or (at your option) any later version.
12
 *
13
 * This library is distributed in the hope that it will be useful, but
14
 * WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
 * Lesser General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU Lesser General Public License
19
 * along with this program.  If not, see <https://www.gnu.org/licenses/>
20
 *
21
 */
22
23
#ifndef GNUTLS_LIB_MEM_H
24
# define GNUTLS_LIB_MEM_H
25
26
# include "config.h"
27
28
# ifdef HAVE_SANITIZER_ASAN_INTERFACE_H
29
#  include <sanitizer/asan_interface.h>
30
# endif
31
32
# ifdef HAVE_VALGRIND_MEMCHECK_H
33
#  include <valgrind/memcheck.h>
34
# endif
35
36
/* These realloc functions will return ptr if size==0, and will free
37
 * the ptr if the new allocation failed.
38
 */
39
void *gnutls_realloc_fast(void *ptr, size_t size);
40
void *_gnutls_reallocarray_fast(void *ptr, size_t nmemb, size_t size);
41
42
char *_gnutls_strdup(const char *);
43
44
void *_gnutls_reallocarray(void *, size_t, size_t);
45
46
unsigned _gnutls_mem_is_zero(const uint8_t * ptr, unsigned size);
47
48
# define zrelease_mpi_key(mpi) if (*mpi!=NULL) { \
49
    _gnutls_mpi_clear(*mpi); \
50
    _gnutls_mpi_release(mpi); \
51
  }
52
53
0
# define zeroize_key(x, size) gnutls_memset(x, 0, size)
54
55
0
# define zeroize_temp_key zeroize_key
56
# define zrelease_temp_mpi_key zrelease_mpi_key
57
58
static inline void _gnutls_memory_mark_undefined(void *addr, size_t size)
59
0
{
60
0
# ifdef HAVE_SANITIZER_ASAN_INTERFACE_H
61
0
  ASAN_POISON_MEMORY_REGION(addr, size);
62
0
# endif
63
0
# ifdef HAVE_VALGRIND_MEMCHECK_H
64
0
  if (RUNNING_ON_VALGRIND)
65
0
    VALGRIND_MAKE_MEM_UNDEFINED(addr, size);
66
0
# endif
67
0
}
Unexecuted instantiation: common.c:_gnutls_memory_mark_undefined
Unexecuted instantiation: crl.c:_gnutls_memory_mark_undefined
Unexecuted instantiation: crq.c:_gnutls_memory_mark_undefined
Unexecuted instantiation: dn.c:_gnutls_memory_mark_undefined
Unexecuted instantiation: extensions.c:_gnutls_memory_mark_undefined
Unexecuted instantiation: hostname-verify.c:_gnutls_memory_mark_undefined
Unexecuted instantiation: key_decode.c:_gnutls_memory_mark_undefined
Unexecuted instantiation: key_encode.c:_gnutls_memory_mark_undefined
Unexecuted instantiation: mpi.c:_gnutls_memory_mark_undefined
Unexecuted instantiation: ocsp.c:_gnutls_memory_mark_undefined
Unexecuted instantiation: output.c:_gnutls_memory_mark_undefined
Unexecuted instantiation: pkcs12.c:_gnutls_memory_mark_undefined
Unexecuted instantiation: pkcs12_bag.c:_gnutls_memory_mark_undefined
Unexecuted instantiation: pkcs12_encr.c:_gnutls_memory_mark_undefined
Unexecuted instantiation: pkcs7-crypt.c:_gnutls_memory_mark_undefined
Unexecuted instantiation: privkey_openssl.c:_gnutls_memory_mark_undefined
Unexecuted instantiation: privkey_pkcs8.c:_gnutls_memory_mark_undefined
Unexecuted instantiation: privkey_pkcs8_pbes1.c:_gnutls_memory_mark_undefined
Unexecuted instantiation: prov-seed.c:_gnutls_memory_mark_undefined
Unexecuted instantiation: sign.c:_gnutls_memory_mark_undefined
Unexecuted instantiation: time.c:_gnutls_memory_mark_undefined
Unexecuted instantiation: tls_features.c:_gnutls_memory_mark_undefined
Unexecuted instantiation: verify-high.c:_gnutls_memory_mark_undefined
Unexecuted instantiation: verify-high2.c:_gnutls_memory_mark_undefined
Unexecuted instantiation: verify.c:_gnutls_memory_mark_undefined
Unexecuted instantiation: virt-san.c:_gnutls_memory_mark_undefined
Unexecuted instantiation: x509.c:_gnutls_memory_mark_undefined
Unexecuted instantiation: x509_dn.c:_gnutls_memory_mark_undefined
Unexecuted instantiation: x509_ext.c:_gnutls_memory_mark_undefined
Unexecuted instantiation: x509_write.c:_gnutls_memory_mark_undefined
Unexecuted instantiation: attributes.c:_gnutls_memory_mark_undefined
Unexecuted instantiation: email-verify.c:_gnutls_memory_mark_undefined
Unexecuted instantiation: ip.c:_gnutls_memory_mark_undefined
Unexecuted instantiation: krb5.c:_gnutls_memory_mark_undefined
Unexecuted instantiation: name_constraints.c:_gnutls_memory_mark_undefined
68
69
static inline void _gnutls_memory_mark_defined(void *addr, size_t size)
70
0
{
71
0
# ifdef HAVE_SANITIZER_ASAN_INTERFACE_H
72
0
  ASAN_UNPOISON_MEMORY_REGION(addr, size);
73
0
# endif
74
0
# ifdef HAVE_VALGRIND_MEMCHECK_H
75
0
  if (RUNNING_ON_VALGRIND)
76
0
    VALGRIND_MAKE_MEM_DEFINED(addr, size);
77
0
# endif
78
0
}
Unexecuted instantiation: common.c:_gnutls_memory_mark_defined
Unexecuted instantiation: crl.c:_gnutls_memory_mark_defined
Unexecuted instantiation: crq.c:_gnutls_memory_mark_defined
Unexecuted instantiation: dn.c:_gnutls_memory_mark_defined
Unexecuted instantiation: extensions.c:_gnutls_memory_mark_defined
Unexecuted instantiation: hostname-verify.c:_gnutls_memory_mark_defined
Unexecuted instantiation: key_decode.c:_gnutls_memory_mark_defined
Unexecuted instantiation: key_encode.c:_gnutls_memory_mark_defined
Unexecuted instantiation: mpi.c:_gnutls_memory_mark_defined
Unexecuted instantiation: ocsp.c:_gnutls_memory_mark_defined
Unexecuted instantiation: output.c:_gnutls_memory_mark_defined
Unexecuted instantiation: pkcs12.c:_gnutls_memory_mark_defined
Unexecuted instantiation: pkcs12_bag.c:_gnutls_memory_mark_defined
Unexecuted instantiation: pkcs12_encr.c:_gnutls_memory_mark_defined
Unexecuted instantiation: pkcs7-crypt.c:_gnutls_memory_mark_defined
Unexecuted instantiation: privkey_openssl.c:_gnutls_memory_mark_defined
Unexecuted instantiation: privkey_pkcs8.c:_gnutls_memory_mark_defined
Unexecuted instantiation: privkey_pkcs8_pbes1.c:_gnutls_memory_mark_defined
Unexecuted instantiation: prov-seed.c:_gnutls_memory_mark_defined
Unexecuted instantiation: sign.c:_gnutls_memory_mark_defined
Unexecuted instantiation: time.c:_gnutls_memory_mark_defined
Unexecuted instantiation: tls_features.c:_gnutls_memory_mark_defined
Unexecuted instantiation: verify-high.c:_gnutls_memory_mark_defined
Unexecuted instantiation: verify-high2.c:_gnutls_memory_mark_defined
Unexecuted instantiation: verify.c:_gnutls_memory_mark_defined
Unexecuted instantiation: virt-san.c:_gnutls_memory_mark_defined
Unexecuted instantiation: x509.c:_gnutls_memory_mark_defined
Unexecuted instantiation: x509_dn.c:_gnutls_memory_mark_defined
Unexecuted instantiation: x509_ext.c:_gnutls_memory_mark_defined
Unexecuted instantiation: x509_write.c:_gnutls_memory_mark_defined
Unexecuted instantiation: attributes.c:_gnutls_memory_mark_defined
Unexecuted instantiation: email-verify.c:_gnutls_memory_mark_defined
Unexecuted instantiation: ip.c:_gnutls_memory_mark_defined
Unexecuted instantiation: krb5.c:_gnutls_memory_mark_defined
Unexecuted instantiation: name_constraints.c:_gnutls_memory_mark_defined
79
80
#endif        /* GNUTLS_LIB_MEM_H */