1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-28 00:58:09 +00:00
trezor-firmware/bootloader/crypto.c
2016-10-04 18:01:48 +02:00

16 lines
433 B
C

#include "crypto.h"
#include "ed25519-donna/ed25519.h"
#include "cmsis/stm32f405xx.h"
void hash_flash(uint8_t hash[SHA256_DIGEST_LENGTH])
{
sha256_Raw((const uint8_t *)FLASH_BASE, 1024*1024, hash);
}
bool ed25519_verify(const uint8_t *msg, uint32_t msglen, uint8_t *pubkey, uint8_t *signature)
{
return (0 == ed25519_sign_open(msg, msglen, *(const ed25519_public_key *)pubkey, *(const ed25519_signature *)signature));
}