[Cryptech-Commits] [sw/stm32] 02/02: Merge branch 'js_keywrap' to 'master'

git at cryptech.is git at cryptech.is
Wed Mar 4 22:30:19 UTC 2020


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

paul at psgd.org pushed a commit to branch master
in repository sw/stm32.

commit 6b2513f1e0def3a134383aa635cb41feac37be31
Merge: b60bdf0 087b079
Author: Paul Selkirk <paul at psgd.org>
AuthorDate: Wed Feb 26 14:14:22 2020 -0500

    Merge branch 'js_keywrap' to 'master'

 projects/cli-test/Makefile       |   1 +
 projects/cli-test/mgmt-cli.c     |   2 +
 projects/cli-test/mgmt-keywrap.c | 316 +++++++++++++++++++++++++++++++++++++++
 projects/cli-test/mgmt-keywrap.h |  42 ++++++
 projects/hsm/mgmt-misc.c         |  34 +++++
 5 files changed, 395 insertions(+)

diff --cc projects/cli-test/Makefile
index 5bb3fb1,fadf2cf..5971d13
--- a/projects/cli-test/Makefile
+++ b/projects/cli-test/Makefile
@@@ -6,19 -5,16 +6,20 @@@ OBJS = 
  	mgmt-dfu.o \
  	mgmt-fpga.o \
  	mgmt-keystore.o \
+ 	mgmt-keywrap.o \
  	mgmt-masterkey.o \
  	mgmt-misc.o \
 -	mgmt-show.o \
 -	mgmt-test.o \
 -	test-fmc.o \
 -	test-mkmif.o \
 -	test_sdram.o
 +	mgmt-show.o
  
  CFLAGS += -I$(LIBCLI_SRC) -I$(LIBHAL_SRC)
 +CFLAGS += -I$(LIBTFM_BLD)
 +CFLAGS += -Wno-missing-field-initializers
 +
 +ifdef DO_TIMING
 +CFLAGS += -DDO_TIMING
 +OBJS += mgmt-timing.o $(TOPLEVEL)/stm-dwt.o
 +LDFLAGS += -lm
 +endif
  
  LIBS += $(LIBCLI_BLD)/libcli.a $(LIBHAL_BLD)/libhal.a $(LIBTFM_BLD)/libtfm.a
  
diff --cc projects/cli-test/mgmt-cli.c
index 960d691,416be77..fa63d50
--- a/projects/cli-test/mgmt-cli.c
+++ b/projects/cli-test/mgmt-cli.c
@@@ -49,9 -47,7 +49,10 @@@
  #include "mgmt-test.h"
  #include "mgmt-keystore.h"
  #include "mgmt-masterkey.h"
+ #include "mgmt-keywrap.h"
 +#ifdef DO_TIMING
 +#include "mgmt-timing.h"
 +#endif
  
  #undef HAL_OK
  #define HAL_OK LIBHAL_OK
@@@ -177,11 -173,10 +178,12 @@@ int cli_main(void
      configure_cli_show(cli);
      configure_cli_fpga(cli);
      configure_cli_misc(cli);
 -    configure_cli_test(cli);
      configure_cli_keystore(cli);
      configure_cli_masterkey(cli);
+     configure_cli_keywrap(cli);
 +#ifdef DO_TIMING
 +    configure_cli_timing(cli);
 +#endif
  
      while (1) {
          control_mgmt_uart_dma_rx(DMA_RX_START);
diff --cc projects/hsm/mgmt-misc.c
index 377af73,72ee1f2..116197d
--- a/projects/hsm/mgmt-misc.c
+++ b/projects/hsm/mgmt-misc.c
@@@ -230,8 -181,13 +230,42 @@@ static int cmd_rsa_modexpng(struct cli_
      return CLI_ERROR;
  }
  
++static int cmd_keywrap_core(struct cli_def *cli, const char *command, char *argv[], int argc)
++{
++    int onoff;
++
++    if (argc != 1) {
++	cli_print(cli, "Wrong number of arguments (%i).", argc);
++	cli_print(cli, "Syntax: %s <on|off>", command);
++	return CLI_ERROR;
++    }
++
++    if (strcmp(argv[0], "on") == 0)
++        onoff = 1;
++    else if (strcmp(argv[0], "off") == 0)
++        onoff = 0;
++    else {
++	cli_print(cli, "Argument must be 'on' or 'off' - not '%s'", argv[0]);
++	return CLI_ERROR;
++    }
++
++    int ret = hal_aes_use_keywrap_core(onoff);
++    if (ret)
++        cli_print(cli, "keywrap core enabled");
++    else if (onoff)
++        cli_print(cli, "keywrap core not found");
++    else
++        cli_print(cli, "keywrap core disabled");
++    return CLI_OK;
++}
++
  void configure_cli_misc(struct cli_def *cli)
  {
+     struct cli_command *c_keywrap = cli_register_command(cli, NULL, "keywrap", NULL, 0, 0, NULL);
+ 
+     /* keywrap core */
+     cli_register_command(cli, c_keywrap, "core", cmd_keywrap_core, 0, 0, "Toggle use of the keywrap core");
+ 
  #ifdef DO_PROFILING
      struct cli_command *c_profile = cli_register_command(cli, NULL, "profile", NULL, 0, 0, NULL);
  



More information about the Commits mailing list