From 3d7ef4b5e9267d2056c97b49ade4f40403436384 Mon Sep 17 00:00:00 2001 From: William San Filippo Date: Fri, 24 Mar 2017 14:02:31 -0700 Subject: [PATCH] MYNEWT-687: Reduce encryption scratchpad size on nrf51 The nrf51 only required the maximum encrypted packet length (plus 16) for its encryption scratchpad register. The code was using the max PDU length of 251. The nrf51 can only support 27 byte encrypted frames. X-Original-Commit: e7934fafce21fd27138fd9e15373ce44e30da682 --- nimble/drivers/nrf51/src/ble_phy.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/nimble/drivers/nrf51/src/ble_phy.c b/nimble/drivers/nrf51/src/ble_phy.c index a18e73c90..d6ca388cb 100644 --- a/nimble/drivers/nrf51/src/ble_phy.c +++ b/nimble/drivers/nrf51/src/ble_phy.c @@ -161,9 +161,8 @@ STATS_NAME_END(ble_phy_stats) */ #if (MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_ENCRYPTION) == 1) -/* XXX: test this. only needs 43 bytes. Should just not use the macro for this*/ -/* Per nordic, the number of bytes needed for scratch is 16 + MAX_PKT_SIZE */ -#define NRF_ENC_SCRATCH_WORDS (((MYNEWT_VAL(BLE_LL_MAX_PKT_SIZE) + 16) + 3) / 4) +/* Per nordic, the number of bytes needed for scratch is 16 + MAX_PKT_SIZE. */ +#define NRF_ENC_SCRATCH_WORDS (((NRF_MAX_ENCRYPTED_PYLD_LEN + 16) + 3) / 4) uint32_t g_nrf_encrypt_scratchpad[NRF_ENC_SCRATCH_WORDS];