meson: also add option for debugging siphash
This commit is contained in:
parent
20e97dd3de
commit
d6601495be
|
@ -782,12 +782,15 @@ substs.set('DEBUGTTY', get_option('debug-tty'))
|
||||||
|
|
||||||
enable_debug_hashmap = false
|
enable_debug_hashmap = false
|
||||||
enable_debug_mmap_cache = false
|
enable_debug_mmap_cache = false
|
||||||
|
enable_debug_siphash = false
|
||||||
enable_debug_udev = false
|
enable_debug_udev = false
|
||||||
foreach name : get_option('debug-extra')
|
foreach name : get_option('debug-extra')
|
||||||
if name == 'hashmap'
|
if name == 'hashmap'
|
||||||
enable_debug_hashmap = true
|
enable_debug_hashmap = true
|
||||||
elif name == 'mmap-cache'
|
elif name == 'mmap-cache'
|
||||||
enable_debug_mmap_cache = true
|
enable_debug_mmap_cache = true
|
||||||
|
elif name == 'siphash'
|
||||||
|
enable_debug_siphash = true
|
||||||
elif name == 'udev'
|
elif name == 'udev'
|
||||||
enable_debug_udev = true
|
enable_debug_udev = true
|
||||||
else
|
else
|
||||||
|
@ -796,6 +799,7 @@ foreach name : get_option('debug-extra')
|
||||||
endforeach
|
endforeach
|
||||||
conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
|
conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
|
||||||
conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
|
conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
|
||||||
|
conf.set10('ENABLE_DEBUG_SIPHASH', enable_debug_siphash)
|
||||||
conf.set10('ENABLE_DEBUG_UDEV', enable_debug_udev)
|
conf.set10('ENABLE_DEBUG_UDEV', enable_debug_udev)
|
||||||
|
|
||||||
conf.set10('VALGRIND', get_option('valgrind'))
|
conf.set10('VALGRIND', get_option('valgrind'))
|
||||||
|
@ -3132,6 +3136,7 @@ foreach tuple : [
|
||||||
['gshadow'],
|
['gshadow'],
|
||||||
['debug hashmap'],
|
['debug hashmap'],
|
||||||
['debug mmap cache'],
|
['debug mmap cache'],
|
||||||
|
['debug siphash'],
|
||||||
['debug udev'],
|
['debug udev'],
|
||||||
['valgrind', conf.get('VALGRIND') == 1],
|
['valgrind', conf.get('VALGRIND') == 1],
|
||||||
['trace logging', conf.get('LOG_TRACE') == 1],
|
['trace logging', conf.get('LOG_TRACE') == 1],
|
||||||
|
|
|
@ -45,7 +45,7 @@ option('debug-shell', type : 'string', value : '/bin/sh',
|
||||||
description : 'path to debug shell binary')
|
description : 'path to debug shell binary')
|
||||||
option('debug-tty', type : 'string', value : '/dev/tty9',
|
option('debug-tty', type : 'string', value : '/dev/tty9',
|
||||||
description : 'specify the tty device for debug shell')
|
description : 'specify the tty device for debug shell')
|
||||||
option('debug-extra', type : 'array', choices : ['hashmap', 'mmap-cache', 'udev'], value : [],
|
option('debug-extra', type : 'array', choices : ['hashmap', 'mmap-cache', 'siphash', 'udev'], value : [],
|
||||||
description : 'enable extra debugging')
|
description : 'enable extra debugging')
|
||||||
option('memory-accounting-default', type : 'boolean',
|
option('memory-accounting-default', type : 'boolean',
|
||||||
description : 'enable MemoryAccounting= by default')
|
description : 'enable MemoryAccounting= by default')
|
||||||
|
|
|
@ -90,7 +90,7 @@ void siphash24_compress(const void *_in, size_t inlen, struct siphash *state) {
|
||||||
/* We did not have enough input to fill out the padding completely */
|
/* We did not have enough input to fill out the padding completely */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#if ENABLE_DEBUG_SIPHASH
|
||||||
printf("(%3zu) v0 %08x %08x\n", state->inlen, (uint32_t) (state->v0 >> 32), (uint32_t) state->v0);
|
printf("(%3zu) v0 %08x %08x\n", state->inlen, (uint32_t) (state->v0 >> 32), (uint32_t) state->v0);
|
||||||
printf("(%3zu) v1 %08x %08x\n", state->inlen, (uint32_t) (state->v1 >> 32), (uint32_t) state->v1);
|
printf("(%3zu) v1 %08x %08x\n", state->inlen, (uint32_t) (state->v1 >> 32), (uint32_t) state->v1);
|
||||||
printf("(%3zu) v2 %08x %08x\n", state->inlen, (uint32_t) (state->v2 >> 32), (uint32_t) state->v2);
|
printf("(%3zu) v2 %08x %08x\n", state->inlen, (uint32_t) (state->v2 >> 32), (uint32_t) state->v2);
|
||||||
|
@ -110,7 +110,7 @@ void siphash24_compress(const void *_in, size_t inlen, struct siphash *state) {
|
||||||
|
|
||||||
for ( ; in < end; in += 8) {
|
for ( ; in < end; in += 8) {
|
||||||
m = unaligned_read_le64(in);
|
m = unaligned_read_le64(in);
|
||||||
#ifdef DEBUG
|
#if ENABLE_DEBUG_SIPHASH
|
||||||
printf("(%3zu) v0 %08x %08x\n", state->inlen, (uint32_t) (state->v0 >> 32), (uint32_t) state->v0);
|
printf("(%3zu) v0 %08x %08x\n", state->inlen, (uint32_t) (state->v0 >> 32), (uint32_t) state->v0);
|
||||||
printf("(%3zu) v1 %08x %08x\n", state->inlen, (uint32_t) (state->v1 >> 32), (uint32_t) state->v1);
|
printf("(%3zu) v1 %08x %08x\n", state->inlen, (uint32_t) (state->v1 >> 32), (uint32_t) state->v1);
|
||||||
printf("(%3zu) v2 %08x %08x\n", state->inlen, (uint32_t) (state->v2 >> 32), (uint32_t) state->v2);
|
printf("(%3zu) v2 %08x %08x\n", state->inlen, (uint32_t) (state->v2 >> 32), (uint32_t) state->v2);
|
||||||
|
@ -158,7 +158,7 @@ uint64_t siphash24_finalize(struct siphash *state) {
|
||||||
|
|
||||||
b = state->padding | (((uint64_t) state->inlen) << 56);
|
b = state->padding | (((uint64_t) state->inlen) << 56);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#if ENABLE_DEBUG_SIPHASH
|
||||||
printf("(%3zu) v0 %08x %08x\n", state->inlen, (uint32_t) (state->v0 >> 32), (uint32_t) state->v0);
|
printf("(%3zu) v0 %08x %08x\n", state->inlen, (uint32_t) (state->v0 >> 32), (uint32_t) state->v0);
|
||||||
printf("(%3zu) v1 %08x %08x\n", state->inlen, (uint32_t) (state->v1 >> 32), (uint32_t) state->v1);
|
printf("(%3zu) v1 %08x %08x\n", state->inlen, (uint32_t) (state->v1 >> 32), (uint32_t) state->v1);
|
||||||
printf("(%3zu) v2 %08x %08x\n", state->inlen, (uint32_t) (state->v2 >> 32), (uint32_t) state->v2);
|
printf("(%3zu) v2 %08x %08x\n", state->inlen, (uint32_t) (state->v2 >> 32), (uint32_t) state->v2);
|
||||||
|
@ -171,7 +171,7 @@ uint64_t siphash24_finalize(struct siphash *state) {
|
||||||
sipround(state);
|
sipround(state);
|
||||||
state->v0 ^= b;
|
state->v0 ^= b;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#if ENABLE_DEBUG_SIPHASH
|
||||||
printf("(%3zu) v0 %08x %08x\n", state->inlen, (uint32_t) (state->v0 >> 32), (uint32_t) state->v0);
|
printf("(%3zu) v0 %08x %08x\n", state->inlen, (uint32_t) (state->v0 >> 32), (uint32_t) state->v0);
|
||||||
printf("(%3zu) v1 %08x %08x\n", state->inlen, (uint32_t) (state->v1 >> 32), (uint32_t) state->v1);
|
printf("(%3zu) v1 %08x %08x\n", state->inlen, (uint32_t) (state->v1 >> 32), (uint32_t) state->v1);
|
||||||
printf("(%3zu) v2 %08x %08x\n", state->inlen, (uint32_t) (state->v2 >> 32), (uint32_t) state->v2);
|
printf("(%3zu) v2 %08x %08x\n", state->inlen, (uint32_t) (state->v2 >> 32), (uint32_t) state->v2);
|
||||||
|
|
Loading…
Reference in New Issue