Fix crash of stream buffer if PSRAM is used

This commit is contained in:
Michael Geramb 2024-01-06 10:23:01 +01:00
parent 4269eca982
commit 52a95bd3e1
1 changed files with 5 additions and 5 deletions

View File

@ -1603,12 +1603,12 @@ void Nonce::inc(){
////////////////////////////////////// //////////////////////////////////////
HapOut::HapStreamBuffer::HapStreamBuffer(){ HapOut::HapStreamBuffer::HapStreamBuffer(){
// Do not use PRAM form stream buffer, it would fail sometimes
buffer=(char *)malloc(bufSize+1); // add 1 for adding null terminator when printing text
encBuf=(uint8_t *)malloc(bufSize+18); // 2-byte AAD + encrypted data + 16-byte authentication tag
buffer=(char *)HS_MALLOC(bufSize+1); // add 1 for adding null terminator when printing text hash=(uint8_t *)malloc(48); // space for SHA-384 hash output
encBuf=(uint8_t *)HS_MALLOC(bufSize+18); // 2-byte AAD + encrypted data + 16-byte authentication tag ctx = (mbedtls_sha512_context *)malloc(sizeof(mbedtls_sha512_context)); // space for hash context
hash=(uint8_t *)HS_MALLOC(48); // space for SHA-384 hash output
ctx = (mbedtls_sha512_context *)HS_MALLOC(sizeof(mbedtls_sha512_context)); // space for hash context
mbedtls_sha512_init(ctx); // initialize context mbedtls_sha512_init(ctx); // initialize context
mbedtls_sha512_starts_ret(ctx,1); // start SHA-384 hash (note second argument=1) mbedtls_sha512_starts_ret(ctx,1); // start SHA-384 hash (note second argument=1)