cm3-bluepill/crypto.c
2025-07-16 15:51:28 +02:00

21 lines
475 B
C

#include "crypto.h"
#include "monocypher.h"
#include <libopencm3/stm32/gpio.h>
#include <stdint.h>
static uint8_t sk[64];
static uint8_t pk[32];
static uint8_t seed[32];
static uint8_t signature[64];
void crypto_demo(void) {
crypto_eddsa_key_pair(sk, pk, seed);
char *msg = "Hello\n";
crypto_eddsa_sign(signature, sk, (uint8_t *)msg, 6);
int res = crypto_eddsa_check(signature, pk, (uint8_t *)msg, 6);
crypto_wipe(sk, 64);
crypto_wipe(pk, 32);
}