summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2016-02-19 12:57:00 +0100
committerWerner Koch <wk@gnupg.org>2016-02-19 14:35:35 +0100
commit744b030cff61fd25114b0b25394c62782c153343 (patch)
tree3e963f15b0a4492782cfb4b3268032c97b9d67f2 /tests
parent95f1db3affb9f5b8a2c814c211d4a02b30446c15 (diff)
downloadlibgcrypt-744b030cff61fd25114b0b25394c62782c153343.tar.gz
Add new private header gcrypt-testapi.h.
* src/gcrypt-testapi.h: New. * src/Makefile.am (libgcrypt_la_SOURCES): Add new file. * random/random.h: Include gcrypt-testapi.h. (struct gcry_drbg_test_vector) : Move to gcrypt-testapi.h. * src/global.c: Include gcrypt-testapi.h. (_gcry_vcontrol): Use PRIV_CTL_* constants instead of 58, 59, 60, 61. * cipher/cipher.c: Include gcrypt-testapi.h. (_gcry_cipher_ctl): Use PRIV_CIPHERCTL_ constants instead of 61, 62. * tests/fipsdrv.c: Include gcrypt-testapi.h. Remove definition of PRIV_CTL_ constants and replace their use by the new PRIV_CIPHERCTL_ constants. * tests/t-lock.c: Include gcrypt-testapi.h. Remove PRIV_CTL_EXTERNAL_LOCK_TEST and EXTERNAL_LOCK_TEST_ constants. * random/random-drbg.c (gcry_rngdrbg_cavs_test): Rename to ... (_gcry_rngdrbg_cavs_test): this. (gcry_rngdrbg_healthcheck_one): Rename to ... (_gcry_rngdrbg_healthcheck_one): this. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/fipsdrv.c14
-rw-r--r--tests/t-lock.c7
2 files changed, 5 insertions, 16 deletions
diff --git a/tests/fipsdrv.c b/tests/fipsdrv.c
index b3da2a30..d7574201 100644
--- a/tests/fipsdrv.c
+++ b/tests/fipsdrv.c
@@ -41,7 +41,7 @@
# define PACKAGE_BUGREPORT "devnull@example.org"
# define PACKAGE_VERSION "[build on " __DATE__ " " __TIME__ "]"
#endif
-
+#include "../src/gcrypt-testapi.h"
#define PGM "fipsdrv"
@@ -57,12 +57,6 @@
#define DIMof(type,member) DIM(((type *)0)->member)
-#define PRIV_CTL_INIT_EXTRNG_TEST 58
-#define PRIV_CTL_RUN_EXTRNG_TEST 59
-#define PRIV_CTL_DEINIT_EXTRNG_TEST 60
-#define PRIV_CTL_DISABLE_WEAK_KEY 61
-#define PRIV_CTL_GET_INPUT_VECTOR 62
-
/* Verbose mode flag. */
static int verbose;
@@ -1069,7 +1063,7 @@ run_encrypt_decrypt (int encrypt_mode,
blocklen = gcry_cipher_get_algo_blklen (cipher_algo);
assert (blocklen);
- gcry_cipher_ctl (hd, PRIV_CTL_DISABLE_WEAK_KEY, NULL, 0);
+ gcry_cipher_ctl (hd, PRIV_CIPHERCTL_DISABLE_WEAK_KEY, NULL, 0);
err = gcry_cipher_setkey (hd, key_buffer, key_buflen);
if (err)
@@ -1124,7 +1118,7 @@ get_current_iv (gcry_cipher_hd_t hd, void *buffer, size_t buflen)
{
unsigned char tmp[17];
- if (gcry_cipher_ctl (hd, PRIV_CTL_GET_INPUT_VECTOR, tmp, sizeof tmp))
+ if (gcry_cipher_ctl (hd, PRIV_CIPHERCTL_GET_INPUT_VECTOR, tmp, sizeof tmp))
die ("error getting current input vector\n");
if (buflen > *tmp)
die ("buffer too short to store the current input vector\n");
@@ -1159,7 +1153,7 @@ run_cipher_mct_loop (int encrypt_mode, int cipher_algo, int cipher_mode,
die ("invalid block length %d\n", blocklen);
- gcry_cipher_ctl (hd, PRIV_CTL_DISABLE_WEAK_KEY, NULL, 0);
+ gcry_cipher_ctl (hd, PRIV_CIPHERCTL_DISABLE_WEAK_KEY, NULL, 0);
err = gcry_cipher_setkey (hd, key_buffer, key_buflen);
if (err)
diff --git a/tests/t-lock.c b/tests/t-lock.c
index 815f63b9..2c1997d3 100644
--- a/tests/t-lock.c
+++ b/tests/t-lock.c
@@ -34,6 +34,7 @@
#define PGMNAME "t-lock"
#include "t-common.h"
+#include "../src/gcrypt-testapi.h"
/* Mingw requires us to include windows.h after winsock2.h which is
included by gcrypt.h. */
@@ -49,12 +50,6 @@
# define THREAD_RET_VALUE NULL
#endif
-#define PRIV_CTL_EXTERNAL_LOCK_TEST 61
-#define EXTERNAL_LOCK_TEST_INIT 30111
-#define EXTERNAL_LOCK_TEST_LOCK 30112
-#define EXTERNAL_LOCK_TEST_UNLOCK 30113
-#define EXTERNAL_LOCK_TEST_DESTROY 30114
-
/* Number of threads to run. */
#define N_NONCE_THREADS 8