#include "ntru_drbg.h"
#include <utils/debug.h>
+#include <utils/test.h>
#define MAX_STRENGTH_BITS 256
#define MAX_DRBG_REQUESTS 0xfffffffe
!this->hmac->get_signature(this->hmac, this->value, NULL) ||
!this->hmac->get_signature(this->hmac, ch_00, NULL) ||
!this->hmac->get_signature(this->hmac, data, this->key.ptr) ||
- !this->hmac->set_key(this->hmac, this->key) ||
+ !this->hmac->set_key(this->hmac, this->key) ||
!this->hmac->get_signature(this->hmac, this->value,
this->value.ptr))
{
!this->hmac->get_signature(this->hmac, this->value, NULL) ||
!this->hmac->get_signature(this->hmac, ch_01, NULL) ||
!this->hmac->get_signature(this->hmac, data, this->key.ptr) ||
- !this->hmac->set_key(this->hmac, this->key) ||
+ !this->hmac->set_key(this->hmac, this->key) ||
!this->hmac->get_signature(this->hmac, this->value,
this->value.ptr))
{
{
return FALSE;
}
- output = chunk_create(out, len);
+ output = chunk_create(out, len);
if (this->reseed_counter > this->max_requests)
{
return FALSE;
}
this->reseed_counter++;
-
+
return TRUE;
}
DBG1(DBG_LIB, "could not instantiate HMAC-SHA256");
return NULL;
}
-
+
max_requests = lib->settings->get_int(lib->settings,
"libstrongswan.plugins.ntru.max_drbg_requests",
MAX_DRBG_REQUESTS);
return &this->public;
}
+EXPORT_FUNCTION_FOR_TESTS(ntru, ntru_drbg_create);
#include <tests/utils/test_rng.h>
#include <plugins/ntru/ntru_drbg.h>
+#include <utils/test.h>
+
+IMPORT_FUNCTION_FOR_TESTS(ntru, ntru_drbg_create, ntru_drbg_t*,
+ u_int32_t strength, chunk_t pers_str, rng_t *entropy)
/**
* NTRU parameter sets to test