]> git.ipfire.org Git - people/ms/strongswan.git/blobdiff - src/libstrongswan/crypto/crypto_tester.h
xof: Defined Extended Output Functions
[people/ms/strongswan.git] / src / libstrongswan / crypto / crypto_tester.h
index 6cc9b0d57503344c77021a6315a5efba40dd6f37..34dfa948904fd9b66b72033fcb519468a733ace1 100644 (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.
         *