mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-31 19:24:42 +02:00
wolfcrypt/src/wc_kyber.c: in kyberkey_encapsulate(), don't overallocate "at" for USE_INTEL_SPEEDUP.
This commit is contained in:
@@ -407,14 +407,8 @@ static int kyberkey_encapsulate(KyberKey* key, const byte* msg, byte* coins,
|
|||||||
|
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
/* Allocate dynamic memory for all matrices, vectors and polynomials. */
|
/* Allocate dynamic memory for all matrices, vectors and polynomials. */
|
||||||
#ifndef USE_INTEL_SPEEDUP
|
|
||||||
at = (sword16*)XMALLOC(((kp + 3) * kp + 3) * KYBER_N * sizeof(sword16),
|
at = (sword16*)XMALLOC(((kp + 3) * kp + 3) * KYBER_N * sizeof(sword16),
|
||||||
key->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
key->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||||
#else
|
|
||||||
at = (sword16*)XMALLOC(
|
|
||||||
((KYBER_MAX_K + 3) * KYBER_MAX_K + 3) * KYBER_N * sizeof(sword16),
|
|
||||||
key->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
|
||||||
#endif
|
|
||||||
if (at == NULL) {
|
if (at == NULL) {
|
||||||
ret = MEMORY_E;
|
ret = MEMORY_E;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user