tests/libpkcs11mock2.la
tests/libutils.la
tests/long-session-id
-tests/memset
-tests/memset0
-tests/memset1
tests/mini
tests/mini-alignment
tests/mini-alpn
# Those modules are common to lib/ and src/.
common_modules="
-alloca attribute byteswap c-ctype c-strcase fopen-gnu func getline gettext-h gettimeofday hash hash-pjw-bare arpa_inet inet_ntop inet_pton intprops memmem-simple minmax netdb netinet_in read-file secure_getenv setsockopt snprintf stdint stpcpy strcase strdup-posix strndup strtok_r strverscmp sys_socket sys_stat sys_types threadlib time_r unistd valgrind-tests vasprintf verify vsnprintf
+alloca attribute byteswap c-ctype c-strcase explicit_bzero fopen-gnu func getline gettext-h gettimeofday hash hash-pjw-bare arpa_inet inet_ntop inet_pton intprops memmem-simple minmax netdb netinet_in read-file secure_getenv setsockopt snprintf stdint stpcpy strcase strdup-posix strndup strtok_r strverscmp sys_socket sys_stat sys_types threadlib time_r unistd valgrind-tests vasprintf verify vsnprintf
"
gnulib_modules="
$common_modules extensions gendocs havelib ldd lib-msvc-compat lib-symbol-versions maintainer-makefile manywarnings pmccabe2html warnings
dnl No fork on MinGW, disable some self-tests until we fix them.
dnl Check clock_gettime and pthread_mutex_lock in libc (avoid linking to other libs)
-AC_CHECK_FUNCS([fork setitimer getrusage getpwuid_r nanosleep daemon getpid localtime mmap explicit_bzero],,)
+AC_CHECK_FUNCS([fork setitimer getrusage getpwuid_r nanosleep daemon getpid localtime mmap],,)
dnl Manually check some functions by including headers first. On macOS, you
dnl normally only have the latest SDK available, containing all existing
dnl functions, but having them restricted according to target version in
**/
void gnutls_memset(void *data, int c, size_t size)
{
- volatile unsigned volatile_zero;
- volatile char *vdata = (volatile char*)data;
-#ifdef HAVE_EXPLICIT_BZERO
- if (c == 0) {
- explicit_bzero(data, size);
- return;
- }
-#endif
- volatile_zero = 0;
-
- /* This is based on a nice trick for safe memset,
- * sent by David Jacobson in the openssl-dev mailing list.
- */
-
- if (size > 0) {
- do {
- memset(data, c, size);
- } while(vdata[volatile_zero] != c);
- }
+ explicit_bzero(data, size);
+ memset(data, c, size);
}
/**
mini-emsgsize-dtls chainverify-unsorted mini-overhead tls12-ffdhe \
mini-dtls-heartbeat mini-x509-callbacks key-openssl priorities priorities-groups \
gnutls_x509_privkey_import gnutls_x509_crt_list_import time x509-server-verify \
- sign-verify-ext4 tls-neg-ext4-key resume-lifetime memset0 memset1 \
+ sign-verify-ext4 tls-neg-ext4-key resume-lifetime \
mini-dtls-srtp rsa-encrypt-decrypt mini-loss-time gnutls-strcodes \
mini-record mini-dtls-record handshake-timeout mini-record-range \
cert-status fips-mode-pthread rsa-psk global-init sec-params sign-verify-data \
dtls_pthread_LDADD = $(LDADD) -lpthread
rng_pthread_LDADD = $(LDADD) -lpthread
-memset0_CFLAGS = -DCHAR=0x0
-memset0_SOURCES = memset.c
-memset0_LDADD = $(LDADD)
-
-memset1_CFLAGS = -DCHAR=0xa
-memset1_SOURCES = memset.c
-memset1_LDADD = $(LDADD)
-
tls12_rollback_detection_CFLAGS = -DTLS12
tls12_rollback_detection_SOURCES = tls13/rnd-rollback-detection.c
tls12_rollback_detection_LDADD = $(LDADD) ../gl/libgnu.la
+++ /dev/null
-/*
- * Copyright (C) 2017 Red Hat, Inc.
- *
- * Author: Nikos Mavrogiannopoulos
- *
- * This file is part of GnuTLS.
- *
- * GnuTLS is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * GnuTLS is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <string.h>
-#include <stdint.h>
-#include <gnutls/gnutls.h>
-
-#include "utils.h"
-
-#define BUF_SIZE 128
-
-void func1(void);
-void func2(void);
-
-static unsigned char *ptr;
-
-/* Checks whether gnutls_memset() call is being optimized
- * out.
- */
-
-void func1(void)
-{
- unsigned char buf[BUF_SIZE];
- ptr = buf;
-
- gnutls_memset(buf, CHAR, sizeof(buf));
-}
-
-void func2(void)
-{
- if (ptr[0] != CHAR || ptr[2] != CHAR || ptr[16] != CHAR)
- fail("previous memset failed!\n");
-}
-
-void doit(void)
-{
-#if defined(__has_feature)
-# if __has_feature(address_sanitizer)
- exit(77);
-# endif
-#endif
-
-#if __SANITIZE_ADDRESS__ == 1
- exit(77);
-#endif
-
- func1();
- func2();
- success("memset test succeeded\n");
-}