Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion components/si91x/crypto/sha/src/sl_si91x_sha.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,19 @@
#include "sl_constants.h"
#include "sl_si91x_protocol_types.h"
#include "sl_si91x_driver.h"
#include "sl_si91x_sha.h"
#include <string.h>


static const uint8_t sha_digest_len_table[] =
{
[SL_SI91x_SHA_1] = SL_SI91x_SHA_1_DIGEST_LEN,
[SL_SI91x_SHA_256] = SL_SI91x_SHA_256_DIGEST_LEN,
[SL_SI91x_SHA_384] = SL_SI91x_SHA_384_DIGEST_LEN,
[SL_SI91x_SHA_512] = SL_SI91x_SHA_512_DIGEST_LEN,
[SL_SI91x_SHA_224] = SL_SI91x_SHA_224_DIGEST_LEN
};

/*==============================================*/
/**
* @brief Compute the SHA digest. This is a blocking API.
Expand Down Expand Up @@ -101,7 +113,7 @@ static sl_status_t sha_pending(uint8_t sha_mode,
}

packet = sl_si91x_host_get_buffer_data(buffer, 0, NULL);
memcpy(digest, packet->data, request->total_msg_length);
memcpy(digest, packet->data, sha_digest_len_table[sha_mode]);

free(request);
sl_si91x_host_free_buffer(buffer, SL_WIFI_RX_FRAME_BUFFER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void sl_net_si91x_event_dispatch_handler(sl_si91x_queue_packet_t *data, sl_si91x
#endif

#ifdef SNTP_CLIENT_FEATURE
if (packet->command & RSI_WLAN_RSP_SNTP_CLIENT) {
if (packet->command == RSI_WLAN_RSP_SNTP_CLIENT) {
si91x_sntp_event_handler(data);
return;
}
Expand Down