mirror of
https://github.com/strongswan/strongswan.git
synced 2025-10-06 00:00:47 -04:00
wolfssl: Remove unused drbg_t instance when building without testable KE
This commit is contained in:
parent
e3fa72b81a
commit
29986dd1e5
@ -67,10 +67,12 @@ struct private_key_exchange_t {
|
|||||||
*/
|
*/
|
||||||
chunk_t shared_secret;
|
chunk_t shared_secret;
|
||||||
|
|
||||||
|
#ifdef TESTABLE_KE
|
||||||
/**
|
/**
|
||||||
* DRBG for testing.
|
* DRBG for testing.
|
||||||
*/
|
*/
|
||||||
drbg_t *drbg;
|
drbg_t *drbg;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -81,10 +83,13 @@ static bool get_random(private_key_exchange_t *this, size_t len, uint8_t *out)
|
|||||||
{
|
{
|
||||||
WC_RNG rng;
|
WC_RNG rng;
|
||||||
|
|
||||||
|
#ifdef TESTABLE_KE
|
||||||
if (this->drbg)
|
if (this->drbg)
|
||||||
{
|
{
|
||||||
return this->drbg->generate(this->drbg, len, out);
|
return this->drbg->generate(this->drbg, len, out);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (wc_InitRng(&rng) != 0)
|
if (wc_InitRng(&rng) != 0)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -272,7 +277,9 @@ METHOD(key_exchange_t, destroy, void,
|
|||||||
chunk_free(&this->ciphertext);
|
chunk_free(&this->ciphertext);
|
||||||
wc_MlKemKey_Free(this->kem);
|
wc_MlKemKey_Free(this->kem);
|
||||||
free(this->kem);
|
free(this->kem);
|
||||||
|
#ifdef TESTABLE_KE
|
||||||
DESTROY_IF(this->drbg);
|
DESTROY_IF(this->drbg);
|
||||||
|
#endif
|
||||||
free(this);
|
free(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user