Merge pull request #7769 from douzzer/20240719-PQ-fixes

20240719-PQ-fixes
This commit is contained in:
David Garske
2024-07-19 14:20:33 -07:00
committed by GitHub
2 changed files with 10 additions and 5 deletions

View File

@@ -6952,9 +6952,8 @@ int wc_dilithium_init_ex(dilithium_key* key, void* heap, int devId)
key->idLen = 0; key->idLen = 0;
key->labelLen = 0; key->labelLen = 0;
#endif #endif
}
key->heap = heap; key->heap = heap;
}
return ret; return ret;
} }
@@ -7422,7 +7421,9 @@ int wc_dilithium_check_key(dilithium_key* key)
} }
/* Dispose of allocated memory. */ /* Dispose of allocated memory. */
if (s1 != NULL) {
XFREE(s1, key->heap, DYNAMIC_TYPE_DILITHIUM); XFREE(s1, key->heap, DYNAMIC_TYPE_DILITHIUM);
}
#else #else
/* Validate parameter. */ /* Validate parameter. */
if (key == NULL) { if (key == NULL) {

View File

@@ -286,7 +286,9 @@ int wc_KyberKey_MakeKeyWithRandom(KyberKey* key, const unsigned char* rand,
} }
/* Free dynamic memory allocated in function. */ /* Free dynamic memory allocated in function. */
if (a != NULL) {
XFREE(a, key->heap, DYNAMIC_TYPE_TMP_BUFFER); XFREE(a, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
}
return ret; return ret;
} }
@@ -890,7 +892,9 @@ int wc_KyberKey_Decapsulate(KyberKey* key, unsigned char* ss,
#ifndef USE_INTEL_SPEEDUP #ifndef USE_INTEL_SPEEDUP
/* Dispose of dynamic memory allocated in function. */ /* Dispose of dynamic memory allocated in function. */
if (cmp != NULL) {
XFREE(cmp, key->heap, DYNAMIC_TYPE_TMP_BUFFER); XFREE(cmp, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
}
#endif #endif
return ret; return ret;