[Cryptech-Commits] [sw/libhal] 01/01: Merge branch systolic_crt into master.

git at cryptech.is git at cryptech.is
Wed Dec 13 19:33:04 UTC 2017


This is an automated email from the git hooks/post-receive script.

sra at hactrn.net pushed a commit to branch master
in repository sw/libhal.

commit bc167c214e97ed35f39d088a7dee3f1a9511340e
Merge: e5d8d55 238e33e
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Wed Dec 13 14:15:45 2017 -0500

    Merge branch systolic_crt into master.
    
    This branch was sitting for long enough that master had been through a
    cleanup pass, so beware of accidental reversions.

 Makefile            |   7 +-
 asn1_internal.h     |  10 ++
 core.c              |  39 +++---
 cryptech/libhal.py  |   2 +-
 hal.h               |  54 +++++---
 hal_internal.h      |  63 +++++++++
 hal_io.c            | 114 ++++++++++++++++
 hal_io_eim.c        |  54 +-------
 hal_io_fmc.c        |  56 +-------
 hal_io_i2c.c        |  47 -------
 ks.c                | 123 +++++++++++++----
 ks.h                |   2 +-
 ks_token.c          |  20 ++-
 modexp.c            | 300 +++++++++++++++++++++++++++---------------
 rpc_pkey.c          |  27 +++-
 rsa.c               | 371 +++++++++++++++++++++++++++++++++++++++++++++-------
 tests/test-rsa.c    |  19 ++-
 tests/test-trng.c   |   1 +
 unit-tests.py       |   4 +
 verilog_constants.h |  37 ++++--
 20 files changed, 951 insertions(+), 399 deletions(-)

diff --cc ks_token.c
index 4950f0b,3f2194a..1676bc0
--- a/ks_token.c
+++ b/ks_token.c
@@@ -102,12 -103,13 +103,12 @@@ static inline uint32_t ks_token_offset(
  
  static hal_error_t ks_token_read(hal_ks_t *ks, const unsigned blockno, hal_ks_block_t *block)
  {
-   if (ks != hal_ks_token || block == NULL || blockno >= NUM_FLASH_BLOCKS || sizeof(*block) != KEYSTORE_SUBSECTOR_SIZE)
+   if (ks != hal_ks_token || block == NULL || blockno >= NUM_FLASH_BLOCKS || sizeof(*block) != HAL_KS_BLOCK_SIZE)
      return HAL_ERROR_IMPOSSIBLE;
  
 -  /* Sigh, magic numeric return codes */
    if (keystore_read_data(ks_token_offset(blockno),
                           block->bytes,
 -                         KEYSTORE_PAGE_SIZE) != 1)
 +                         KEYSTORE_PAGE_SIZE) != CMSIS_HAL_OK)
      return HAL_ERROR_KEYSTORE_ACCESS;
  
    switch (hal_ks_block_get_type(block)) {
@@@ -192,8 -198,14 +193,13 @@@ static hal_error_t ks_token_erase(hal_k
    if (ks != hal_ks_token || blockno >= NUM_FLASH_BLOCKS)
      return HAL_ERROR_IMPOSSIBLE;
  
-   if (keystore_erase_subsector(blockno) != CMSIS_HAL_OK)
-     return HAL_ERROR_KEYSTORE_ACCESS;
+   unsigned subsector =  blockno      * SUBSECTORS_PER_BLOCK;
+   const unsigned end = (blockno + 1) * SUBSECTORS_PER_BLOCK;
+ 
+   do {
 -    /* Sigh, magic numeric return codes */
 -    if (keystore_erase_subsector(subsector) != 1)
++    if (keystore_erase_subsector(subsector) != CMSIS_HAL_OK)
+       return HAL_ERROR_KEYSTORE_ACCESS;
+   } while (++subsector < end);
  
    return HAL_OK;
  }



More information about the Commits mailing list