utzig commented on a change in pull request #2176: da1469x: support blocks that are not ENC_FLASH_BLK multiples. URL: https://github.com/apache/mynewt-core/pull/2176#discussion_r375393468
########## File path: hw/drivers/flash/enc_flash/ef_da1469x/src/hw_enc_flash.c ########## @@ -139,12 +139,15 @@ enc_flash_crypt_arch(struct enc_flash_dev *edev, uint32_t blk_addr, struct eflash_da1469x_dev *dev = EDEV_TO_DA1469X(edev); const struct hal_flash *h_dev = edev->efd_hwdev; uint32_t ctr[4] = {0}; + uint8_t blk[ENC_FLASH_BLK] = {0}; ctr[0] = (uint32_t) ((blk_addr - h_dev->hf_base_addr) / ENC_FLASH_BLK); Review comment: Btw, it would be interesting to find out if the endianness of the `uint32_t` written to `CRYPTO_MREGx_REG` is correct by just writing the value or if we need to do `os_bswap_32` here (or in the register writing above!). The security is still OK, but the values would be different from the expected ones and the counter would increment in a weird way (instead of +1). A way to test it would be to write one block of a vector to address 0 of flash and read using JTAG/SWD and check that it matches the encrypted vector. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services