Check rng return value when generating OCSP nonces
This commit is contained in:
committed by
Martin Willi
parent
3c73911174
commit
ae56e1eb97
@@ -199,15 +199,15 @@ static chunk_t build_nonce(private_x509_ocsp_request_t *this)
|
|||||||
rng_t *rng;
|
rng_t *rng;
|
||||||
|
|
||||||
rng = lib->crypto->create_rng(lib->crypto, RNG_WEAK);
|
rng = lib->crypto->create_rng(lib->crypto, RNG_WEAK);
|
||||||
if (rng)
|
if (!rng || !rng->allocate_bytes(rng, NONCE_LEN, &this->nonce))
|
||||||
{
|
{
|
||||||
rng->allocate_bytes(rng, NONCE_LEN, &this->nonce);
|
DBG1(DBG_LIB, "creating OCSP request nonce failed, no RNG found");
|
||||||
rng->destroy(rng);
|
DESTROY_IF(rng);
|
||||||
return asn1_wrap(ASN1_SEQUENCE, "cm", ASN1_nonce_oid,
|
return chunk_empty;
|
||||||
asn1_simple_object(ASN1_OCTET_STRING, this->nonce));
|
|
||||||
}
|
}
|
||||||
DBG1(DBG_LIB, "creating OCSP request nonce failed, no RNG found");
|
rng->destroy(rng);
|
||||||
return chunk_empty;
|
return asn1_wrap(ASN1_SEQUENCE, "cm", ASN1_nonce_oid,
|
||||||
|
asn1_simple_object(ASN1_OCTET_STRING, this->nonce));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user