AC_DEFINE(HAVE_ATTR_FALLTHROUGH, [1], [defined if we have the fallthrough attribute.])
fi
+saved_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Werror"
+AC_CACHE_CHECK([for __attribute__((nonstring))],
+ tor_cv_c_attr_nonstring,
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([],
+ [[ __attribute__((nonstring)) const char foo[5] = "abcde"; ]])],
+ [tor_cv_c_attr_nonstring=yes],
+ [tor_cv_c_attr_nonstring=no] )])
+CFLAGS="$saved_CFLAGS"
+
+if test "$tor_cv_c_attr_nonstring" = "yes"; then
+ AC_DEFINE(HAVE_ATTR_NONSTRING, [1], [defined if we have the nonstring attribute.])
+fi
+
TORUSER=_tor
AC_ARG_WITH(tor-user,
AS_HELP_STRING(--with-tor-user=NAME, [specify username for tor daemon]),
#define FALLTHROUGH
#endif
+#if defined(HAVE_ATTR_NONSTRING)
+#define NONSTRING __attribute__((nonstring))
+#else
+#define NONSTRING
+#endif
+
/* What GCC do we have? */
#ifdef __GNUC__
#define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
/* shared */
const curve25519_public_key_t *server_pubkey;
- uint8_t node_id[20] = "abcdefghijklmnopqrst";
+
+ NONSTRING uint8_t node_id[20] = "abcdefghijklmnopqrst";
(void) arg;
{
char digest[DIGEST_LEN];
bridge_info_t *bridge;
- const char fingerprint[HEX_DIGEST_LEN] =
+ NONSTRING const char fingerprint[HEX_DIGEST_LEN] =
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
tor_addr_t *addr = tor_malloc(sizeof(tor_addr_t));
char ret_addr[16];
{
char digest[DIGEST_LEN];
bridge_info_t *bridge;
- const char fingerprint[HEX_DIGEST_LEN] =
+ NONSTRING const char fingerprint[HEX_DIGEST_LEN] =
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
tor_addr_t *addr = tor_malloc(sizeof(tor_addr_t));
uint16_t port = 11111;
{
char digest[DIGEST_LEN];
bridge_info_t *bridge;
- const char fingerprint[HEX_DIGEST_LEN] =
+ NONSTRING const char fingerprint[HEX_DIGEST_LEN] =
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
tor_addr_t *addr = tor_malloc(sizeof(tor_addr_t));
uint16_t port = 4444;
{
char digest1[DIGEST_LEN];
bridge_info_t *bridge;
- const char fingerprint[HEX_DIGEST_LEN] =
+ NONSTRING const char fingerprint[HEX_DIGEST_LEN] =
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
helper_add_bridges_to_bridgelist(arg);
node_t node_with_digest;
memset(&node_with_digest, 0, sizeof(node_with_digest));
- const char fingerprint[HEX_DIGEST_LEN] =
+ NONSTRING const char fingerprint[HEX_DIGEST_LEN] =
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
- const char fingerprint2[HEX_DIGEST_LEN] =
+ NONSTRING const char fingerprint2[HEX_DIGEST_LEN] =
"ffffffffffffffffffffffffffffffffffffffff";
base16_decode(node_with_digest.identity, DIGEST_LEN,
test_cfmt_relay_header(void *arg)
{
relay_header_t rh;
- const uint8_t hdr_1[RELAY_HEADER_SIZE] =
+ NONSTRING const uint8_t hdr_1[RELAY_HEADER_SIZE] =
"\x03" "\x00\x00" "\x21\x22" "ABCD" "\x01\x03";
uint8_t hdr_out[RELAY_HEADER_SIZE];
(void)arg;
{
or_circuit_t *c1, *c2, *c3, *c4;
origin_circuit_t *c5;
- const uint8_t tok1[REND_TOKEN_LEN] = "The cat can't tell y";
- const uint8_t tok2[REND_TOKEN_LEN] = "ou its name, and it ";
- const uint8_t tok3[REND_TOKEN_LEN] = "doesn't really care.";
+ NONSTRING const uint8_t tok1[REND_TOKEN_LEN] = "The cat can't tell y";
+ NONSTRING const uint8_t tok2[REND_TOKEN_LEN] = "ou its name, and it ";
+ NONSTRING const uint8_t tok3[REND_TOKEN_LEN] = "doesn't really care.";
/* -- Adapted from a quote by Fredrik Lundh. */
(void)arg;
ed25519_public_key_t intro_pk2 = { {2} }; /* Junk, not important. */
{
- const uint8_t tok1[REND_TOKEN_LEN] = "bet i got some of th";
+ NONSTRING const uint8_t tok1[REND_TOKEN_LEN] = "bet i got some of th";
circ1 = or_circuit_new(0, NULL);
tt_assert(circ1);
}
{
- const uint8_t tok2[REND_TOKEN_LEN] = "you dont know anythi";
+ NONSTRING const uint8_t tok2[REND_TOKEN_LEN] = "you dont know anythi";
circ2 = origin_circuit_new();
tt_assert(circ2);
const int TEST_VALS[] = { 5, 500, 1023, 1024, 1025, 2046, 2047, 2048, 2049,
10000, OPE_INPUT_MAX };
unsigned i;
- const uint8_t key[32] = "A fixed key, chosen arbitrarily.";
+ NONSTRING const uint8_t key[32] = "A fixed key, chosen arbitrarily.";
ope = crypto_ope_new(key);
tt_assert(ope);
(void)arg;
crypto_ope_t *ope = NULL;
- const uint8_t key[32] = "A fixed key, chosen arbitrarily.";
+ NONSTRING const uint8_t key[32] = "A fixed key, chosen arbitrarily.";
ope = crypto_ope_new(key);
tt_u64_op(UINT64_MAX, OP_EQ, crypto_ope_encrypt(ope,INT_MIN));
smartlist_len(bw_file_headers));
/* force bw_file_headers to be bigger than
* MAX_BW_FILE_HEADER_COUNT_IN_VOTE */
- char line[8] = "foo=bar\0";
+ NONSTRING char line[8] = "foo=bar\0";
smartlist_add_strdup(bw_file_headers, line);
tt_int_op(MAX_BW_FILE_HEADER_COUNT_IN_VOTE, OP_LT,
smartlist_len(bw_file_headers));
char *fname = tor_strdup(get_fname("V3BandwidthsFile"));
/* Initialize to a wrong digest. */
- uint8_t digest[DIGEST256_LEN] = "01234567890123456789abcdefghijkl";
+ NONSTRING
+ uint8_t digest[DIGEST256_LEN] = "01234567890123456789abcdefghijkl";
/* Digest of an empty string. Initialize to a wrong digest. */
- char digest_empty_str[DIGEST256_LEN] = "01234567890123456789abcdefghijkl";
+ NONSTRING
+ char digest_empty_str[DIGEST256_LEN] = "01234567890123456789abcdefghijkl";
crypto_digest256(digest_empty_str, "", 0, DIGEST_SHA256);
/* Digest of the content. Initialize to a wrong digest. */
- char digest_expected[DIGEST256_LEN] = "01234567890123456789abcdefghijkl";
+ NONSTRING
+ char digest_expected[DIGEST256_LEN] = "01234567890123456789abcdefghijkl";
crypto_digest256(digest_expected, content, strlen(content), DIGEST_SHA256);
/* When the bandwidth file can not be found. */
size_t reply_len=0;
char hmac1[32], hmac2[32];
- const char client_nonce[32] =
+ NONSTRING const char client_nonce[32] =
"Who is the third who walks alway";
char server_hash_input[] =
"ExtORPort authentication server-to-client hash"
#include "test/test.h"
-static const char KEY_MATERIAL[3][CPATH_KEY_MATERIAL_LEN] = {
+NONSTRING static const char KEY_MATERIAL[3][CPATH_KEY_MATERIAL_LEN] = {
" 'My public key is in this signed x509 object', said Tom assertively.",
"'Let's chart the pedal phlanges in the tomb', said Tom cryptographically",
" 'Segmentation fault bugs don't _just happen_', said Tom seethingly.",
TEST(inbound),
END_OF_TESTCASES
};
-
test_util_format_unaligned_accessors(void *ignored)
{
(void)ignored;
- char buf[9] = "onionsoup"; // 6f6e696f6e736f7570
+ NONSTRING char buf[9] = "onionsoup"; // 6f6e696f6e736f7570
tt_u64_op(get_uint64(buf+1), OP_EQ,
tor_htonll(UINT64_C(0x6e696f6e736f7570)));