Skip to content

Commit

Permalink
Fixes #4
Browse files Browse the repository at this point in the history
  • Loading branch information
nickray committed Oct 24, 2020
1 parent 22a1567 commit c9c4656
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 4 additions & 2 deletions c-api/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ clean:
libopencm3/lib/libopencm3_stm32f4.a:
$(MAKE) -C libopencm3

build-example: libopencm3/lib/libopencm3_stm32f4.a
example/example.elf: libopencm3/lib/libopencm3_stm32f4.a
$(MAKE) -C example

build-example: example/example.elf

SEMIHOSTING = -semihosting-config enable=on,target=native
SPEC = -cpu cortex-m33 -machine musca-b1 -nographic
run-example:
run-example: build-example
# Get out via Ctrl-A X in case QEMU does not return
qemu-system-arm $(SPEC) $(SEMIHOSTING) -kernel example/example.elf

Expand Down
7 changes: 4 additions & 3 deletions c-api/example/example.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "salty.h"

Expand All @@ -24,15 +25,15 @@ int main(void) {

uint8_t public_key[32];

uint8_t data [] = "salty!";
const uint8_t data [] = "salty!";

uint8_t signature[64];

/* __asm__("BKPT"); */

salty_public_key(&seed, &public_key);
salty_sign(&seed, data, 6, &signature);
salty_Error err = salty_verify(&public_key, data, sizeof(data), &signature);
salty_sign(&seed, data, strlen((const char*) data), &signature);
salty_Error err = salty_verify(&public_key, data, strlen((const char*) data), &signature);

/* assert(1); */

Expand Down

0 comments on commit c9c4656

Please sign in to comment.