if (sk->secret_key_data) {
oqs_lms_key_data *key_data = (oqs_lms_key_data *)sk->secret_key_data;
- if (key_data) {
+ if (key_data != NULL) {
OQS_MEM_secure_free(key_data->sec_key, key_data->len_sec_key);
key_data->sec_key = NULL;
ret = OQS_ERROR;
cleanup:
- if (secret_key) {
+ if ((secret_key) && (kem != NULL)) {
OQS_MEM_secure_free(secret_key - sizeof(magic_t), kem->length_secret_key + 2 * sizeof(magic_t));
}
- if (shared_secret_e) {
+ if ((shared_secret_e) && (kem != NULL)) {
OQS_MEM_secure_free(shared_secret_e - sizeof(magic_t), kem->length_shared_secret + 2 * sizeof(magic_t));
}
- if (shared_secret_d) {
+ if ((shared_secret_d) && (kem != NULL)) {
OQS_MEM_secure_free(shared_secret_d - sizeof(magic_t), kem->length_shared_secret + 2 * sizeof(magic_t));
}
if (public_key) {
if (ciphertext) {
OQS_MEM_insecure_free(ciphertext - sizeof(magic_t));
}
- if (seed) {
+ if ((seed) && (kem != NULL)) {
OQS_MEM_secure_free(seed - sizeof(magic_t), kem->length_keypair_seed + 2 * sizeof(magic_t));
}
OQS_KEM_free(kem);
ret = OQS_ERROR;
cleanup:
- if (secret_key) {
+ if ((secret_key) && (sig != NULL)) {
OQS_MEM_secure_free(secret_key - sizeof(magic_t), sig->length_secret_key + 2 * sizeof(magic_t));
}
if (public_key) {
ret = OQS_ERROR;
cleanup:
- if (secret_key) {
+ if ((secret_key) && (kem != NULL)) {
OQS_MEM_secure_free(secret_key - sizeof(magic_t), kem->length_secret_key + 2 * sizeof(magic_t));
}
- if (shared_secret_e) {
+ if ((shared_secret_e) && (kem != NULL)) {
OQS_MEM_secure_free(shared_secret_e - sizeof(magic_t), kem->length_shared_secret + 2 * sizeof(magic_t));
}
- if (shared_secret_d) {
+ if ((shared_secret_d) && (kem != NULL)) {
OQS_MEM_secure_free(shared_secret_d - sizeof(magic_t), kem->length_shared_secret + 2 * sizeof(magic_t));
}
if (public_key) {
ret = OQS_ERROR;
cleanup:
- if (secret_key) {
+ if ((secret_key) && (sig != NULL)) {
OQS_MEM_secure_free(secret_key - sizeof(magic_t), sig->length_secret_key + 2 * sizeof(magic_t));
}
if (public_key) {