mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-16 11:21:18 +03:00
ssl: use malloc instead of alloca
This commit is contained in:
@ -661,7 +661,7 @@ static void add_hmac_digest(SSL *ssl, int mode, uint8_t *hmac_header,
|
|||||||
const uint8_t *buf, int buf_len, uint8_t *hmac_buf)
|
const uint8_t *buf, int buf_len, uint8_t *hmac_buf)
|
||||||
{
|
{
|
||||||
int hmac_len = buf_len + 8 + SSL_RECORD_SIZE;
|
int hmac_len = buf_len + 8 + SSL_RECORD_SIZE;
|
||||||
uint8_t *t_buf = (uint8_t *)alloca(buf_len+100);
|
uint8_t *t_buf = (uint8_t *)malloc(buf_len+100);
|
||||||
|
|
||||||
memcpy(t_buf, (mode == SSL_SERVER_WRITE || mode == SSL_CLIENT_WRITE) ?
|
memcpy(t_buf, (mode == SSL_SERVER_WRITE || mode == SSL_CLIENT_WRITE) ?
|
||||||
ssl->write_sequence : ssl->read_sequence, 8);
|
ssl->write_sequence : ssl->read_sequence, 8);
|
||||||
@ -673,6 +673,8 @@ static void add_hmac_digest(SSL *ssl, int mode, uint8_t *hmac_header,
|
|||||||
ssl->server_mac : ssl->client_mac,
|
ssl->server_mac : ssl->client_mac,
|
||||||
ssl->cipher_info->digest_size, hmac_buf);
|
ssl->cipher_info->digest_size, hmac_buf);
|
||||||
|
|
||||||
|
free(t_buf);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
print_blob("record", hmac_header, SSL_RECORD_SIZE);
|
print_blob("record", hmac_header, SSL_RECORD_SIZE);
|
||||||
print_blob("buf", buf, buf_len);
|
print_blob("buf", buf, buf_len);
|
||||||
|
Reference in New Issue
Block a user