xof: Defined Extended Output Functions

This commit is contained in:
Andreas Steffen
2016-07-29 12:36:14 +02:00
parent 7f65a8c271
commit 04208ac5d4
14 changed files with 539 additions and 5 deletions
+32
View File
@@ -30,6 +30,7 @@ typedef struct aead_test_vector_t aead_test_vector_t;
typedef struct signer_test_vector_t signer_test_vector_t;
typedef struct hasher_test_vector_t hasher_test_vector_t;
typedef struct prf_test_vector_t prf_test_vector_t;
typedef struct xof_test_vector_t xof_test_vector_t;
typedef struct rng_test_vector_t rng_test_vector_t;
typedef struct dh_test_vector_t dh_test_vector_t;
@@ -114,6 +115,19 @@ struct prf_test_vector_t {
u_char *out;
};
struct xof_test_vector_t {
/** xof algorithm this test vector tests */
ext_out_function_t alg;
/** size of the seed data */
size_t len;
/** seed data */
u_char *seed;
/** size of the output */
size_t out_len;
/** expected output of size*/
u_char *out;
};
/**
* Test vector for a RNG.
*
@@ -216,6 +230,17 @@ struct crypto_tester_t {
bool (*test_prf)(crypto_tester_t *this, pseudo_random_function_t alg,
prf_constructor_t create,
u_int *speed, const char *plugin_name);
/**
* Test an XOF algorithm.
*
* @param alg algorithm to test
* @param create constructor function for the XOF
* @param speed speed test result, NULL to omit
* @return TRUE if test passed
*/
bool (*test_xof)(crypto_tester_t *this, ext_out_function_t alg,
xof_constructor_t create,
u_int *speed, const char *plugin_name);
/**
* Test a RNG implementation.
*
@@ -274,6 +299,13 @@ struct crypto_tester_t {
*/
void (*add_prf_vector)(crypto_tester_t *this, prf_test_vector_t *vector);
/**
* Add a test vector to test an XOF.
*
* @param vector pointer to test vector
*/
void (*add_xof_vector)(crypto_tester_t *this, xof_test_vector_t *vector);
/**
* Add a test vector to test a RNG.
*