unit-tests: Register nonce generator and make first nonce byte configurable
This commit is contained in:
@@ -14,8 +14,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "exchange_test_helper.h"
|
#include "exchange_test_helper.h"
|
||||||
#include "mock_ipsec.h"
|
|
||||||
#include "mock_dh.h"
|
#include "mock_dh.h"
|
||||||
|
#include "mock_ipsec.h"
|
||||||
|
#include "mock_nonce_gen.h"
|
||||||
|
|
||||||
#include <credentials/sets/mem_cred.h>
|
#include <credentials/sets/mem_cred.h>
|
||||||
|
|
||||||
@@ -196,6 +197,14 @@ static void initialize_logging()
|
|||||||
charon->load_loggers(charon, NULL, TRUE);
|
charon->load_loggers(charon, NULL, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a nonce generator with the first byte
|
||||||
|
*/
|
||||||
|
static nonce_gen_t *create_nonce_gen()
|
||||||
|
{
|
||||||
|
return mock_nonce_gen_create(exchange_test_helper->nonce_first_byte);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Described in header
|
* Described in header
|
||||||
*/
|
*/
|
||||||
@@ -208,6 +217,9 @@ void exchange_test_helper_init(char *plugins)
|
|||||||
PLUGIN_PROVIDE(DH, MODP_2048_BIT),
|
PLUGIN_PROVIDE(DH, MODP_2048_BIT),
|
||||||
PLUGIN_PROVIDE(DH, MODP_3072_BIT),
|
PLUGIN_PROVIDE(DH, MODP_3072_BIT),
|
||||||
PLUGIN_PROVIDE(DH, ECP_256_BIT),
|
PLUGIN_PROVIDE(DH, ECP_256_BIT),
|
||||||
|
PLUGIN_REGISTER(NONCE_GEN, create_nonce_gen),
|
||||||
|
PLUGIN_PROVIDE(NONCE_GEN),
|
||||||
|
PLUGIN_DEPENDS(RNG, RNG_WEAK),
|
||||||
};
|
};
|
||||||
|
|
||||||
INIT(this,
|
INIT(this,
|
||||||
|
|||||||
@@ -40,6 +40,12 @@ struct exchange_test_helper_t {
|
|||||||
*/
|
*/
|
||||||
mock_sender_t *sender;
|
mock_sender_t *sender;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the initial byte of all nonces generated by future nonce
|
||||||
|
* generators (already instatiated nonce generators are not affected).
|
||||||
|
*/
|
||||||
|
u_char nonce_first_byte;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an established IKE_SA/CHILD_SA
|
* Creates an established IKE_SA/CHILD_SA
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user