Fix load tester shared key enumerator, provide dedicated EAP password
This commit is contained in:
parent
69c3eca0e9
commit
e13819507e
|
@ -49,9 +49,14 @@ struct private_load_tester_creds_t {
|
|||
u_int32_t serial;
|
||||
|
||||
/**
|
||||
* Preshared key
|
||||
* Preshared key for IKE
|
||||
*/
|
||||
shared_key_t *shared;
|
||||
shared_key_t *psk;
|
||||
|
||||
/**
|
||||
* Password for EAP
|
||||
*/
|
||||
shared_key_t *pwd;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -131,7 +136,7 @@ CwMLbJ7vQqwPHXRitDmNkEOK9H+vRnDf
|
|||
-----END CERTIFICATE-----
|
||||
|
||||
*/
|
||||
char cert[] = {
|
||||
static char cert[] = {
|
||||
0x30,0x82,0x01,0xf4,0x30,0x82,0x01,0x5d,0xa0,0x03,0x02,0x01,0x02,0x02,0x01,0x00,
|
||||
0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x05,0x05,0x00,0x30,
|
||||
0x37,0x31,0x0c,0x30,0x0a,0x06,0x03,0x55,0x04,0x03,0x13,0x03,0x73,0x72,0x76,0x31,
|
||||
|
@ -174,6 +179,11 @@ static char psk[] = {
|
|||
0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08
|
||||
};
|
||||
|
||||
/**
|
||||
* Password for EAP
|
||||
*/
|
||||
static char pwd[] = "test#123";
|
||||
|
||||
/**
|
||||
* Implements credential_set_t.create_private_enumerator
|
||||
*/
|
||||
|
@ -264,6 +274,21 @@ static enumerator_t* create_cert_enumerator(private_load_tester_creds_t *this,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static bool shared_filter(void *null, shared_key_t **in, shared_key_t **out,
|
||||
void **un1, id_match_t *me, void **un2, id_match_t *other)
|
||||
{
|
||||
*out = *in;
|
||||
if (me)
|
||||
{
|
||||
*me = ID_MATCH_ANY;
|
||||
}
|
||||
if (other)
|
||||
{
|
||||
*other = ID_MATCH_ANY;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements credential_set_t.create_shared_enumerator
|
||||
*/
|
||||
|
@ -271,7 +296,22 @@ static enumerator_t* create_shared_enumerator(private_load_tester_creds_t *this,
|
|||
shared_key_type_t type, identification_t *me,
|
||||
identification_t *other)
|
||||
{
|
||||
return enumerator_create_single(this->shared, NULL);
|
||||
shared_key_t *shared;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case SHARED_IKE:
|
||||
shared = this->psk;
|
||||
break;
|
||||
case SHARED_EAP:
|
||||
shared = this->pwd;
|
||||
break;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
return enumerator_create_filter(
|
||||
enumerator_create_single(this->pwd, NULL),
|
||||
(void*)shared_filter, NULL, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -281,7 +321,8 @@ static void destroy(private_load_tester_creds_t *this)
|
|||
{
|
||||
DESTROY_IF(this->private);
|
||||
DESTROY_IF(this->ca);
|
||||
this->shared->destroy(this->shared);
|
||||
this->psk->destroy(this->psk);
|
||||
this->pwd->destroy(this->pwd);
|
||||
free(this);
|
||||
}
|
||||
|
||||
|
@ -305,8 +346,10 @@ load_tester_creds_t *load_tester_creds_create()
|
|||
BUILD_X509_FLAG, X509_CA,
|
||||
BUILD_END);
|
||||
|
||||
this->shared = shared_key_create(SHARED_IKE,
|
||||
this->psk = shared_key_create(SHARED_IKE,
|
||||
chunk_clone(chunk_create(psk, sizeof(psk))));
|
||||
this->pwd = shared_key_create(SHARED_EAP,
|
||||
chunk_clone(chunk_create(pwd, strlen(pwd))));
|
||||
this->serial = 0;
|
||||
return &this->public;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue