Added support for AEAD test vectors to test-vectors plugin
authorMartin Willi <martin@revosec.ch>
Thu, 19 Aug 2010 08:08:18 +0000 (10:08 +0200)
committerMartin Willi <martin@revosec.ch>
Thu, 19 Aug 2010 17:05:13 +0000 (19:05 +0200)
src/libstrongswan/plugins/test_vectors/test_vectors_plugin.c

index 234d237..f3a254d 100644 (file)
@@ -20,6 +20,7 @@
 
 /* define symbols of all test vectors */
 #define TEST_VECTOR_CRYPTER(x) crypter_test_vector_t x;
+#define TEST_VECTOR_AEAD(x) aead_test_vector_t x;
 #define TEST_VECTOR_SIGNER(x) signer_test_vector_t x;
 #define TEST_VECTOR_HASHER(x) hasher_test_vector_t x;
 #define TEST_VECTOR_PRF(x) prf_test_vector_t x;
 #include "test_vectors.h"
 
 #undef TEST_VECTOR_CRYPTER
+#undef TEST_VECTOR_AEAD
 #undef TEST_VECTOR_SIGNER
 #undef TEST_VECTOR_HASHER
 #undef TEST_VECTOR_PRF
 #undef TEST_VECTOR_RNG
 
 #define TEST_VECTOR_CRYPTER(x)
+#define TEST_VECTOR_AEAD(x)
 #define TEST_VECTOR_SIGNER(x)
 #define TEST_VECTOR_HASHER(x)
 #define TEST_VECTOR_PRF(x)
@@ -48,6 +51,14 @@ static crypter_test_vector_t *crypter[] = {
 #undef TEST_VECTOR_CRYPTER
 #define TEST_VECTOR_CRYPTER(x)
 
+#undef TEST_VECTOR_AEAD
+#define TEST_VECTOR_AEAD(x) &x,
+static aead_test_vector_t *aead[] = {
+#include "test_vectors.h"
+};
+#undef TEST_VECTOR_AEAD
+#define TEST_VECTOR_AEAD(x)
+
 #undef TEST_VECTOR_SIGNER
 #define TEST_VECTOR_SIGNER(x) &x,
 static signer_test_vector_t *signer[] = {
@@ -116,6 +127,11 @@ plugin_t *test_vectors_plugin_create()
                lib->crypto->add_test_vector(lib->crypto,
                                                                         ENCRYPTION_ALGORITHM, crypter[i]);
        }
+       for (i = 0; i < countof(aead); i++)
+       {
+               lib->crypto->add_test_vector(lib->crypto,
+                                                                        AEAD_ALGORITHM, aead[i]);
+       }
        for (i = 0; i < countof(signer); i++)
        {
                lib->crypto->add_test_vector(lib->crypto,