sc-hsm: Prevent double-free crash if key generation fails
Fixes #262 (SEGV when reader does not support extended length ADPU)
This commit is contained in:
parent
db60f8da59
commit
5279bfa2d1
|
@ -421,27 +421,35 @@ void sc_pkcs15emu_sc_hsm_free_cvc(sc_cvc_t *cvc)
|
|||
{
|
||||
if (cvc->signature) {
|
||||
free(cvc->signature);
|
||||
cvc->signature = NULL;
|
||||
}
|
||||
if (cvc->primeOrModulus) {
|
||||
free(cvc->primeOrModulus);
|
||||
cvc->primeOrModulus = NULL;
|
||||
}
|
||||
if (cvc->coefficientAorExponent) {
|
||||
free(cvc->coefficientAorExponent);
|
||||
cvc->coefficientAorExponent = NULL;
|
||||
}
|
||||
if (cvc->coefficientB) {
|
||||
free(cvc->coefficientB);
|
||||
cvc->coefficientB = NULL;
|
||||
}
|
||||
if (cvc->basePointG) {
|
||||
free(cvc->basePointG);
|
||||
cvc->basePointG = NULL;
|
||||
}
|
||||
if (cvc->order) {
|
||||
free(cvc->order);
|
||||
cvc->order = NULL;
|
||||
}
|
||||
if (cvc->publicPoint) {
|
||||
free(cvc->publicPoint);
|
||||
cvc->publicPoint = NULL;
|
||||
}
|
||||
if (cvc->cofactor) {
|
||||
free(cvc->cofactor);
|
||||
cvc->cofactor = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue