Skip to content

Instantly share code, notes, and snippets.

View estshorter's full-sized avatar

estshorter estshorter

View GitHub Profile
#define DEBUG_WOLFSSL
//
#define HAVE_CURVE25519
#define WOLFSSL_SHA512
#define HAVE_ED25519
#define WOLFSSL_SP_MATH_ALL
#include <windows.h>
// clang -fomit-frame-pointer -target arm-linux-gnueabihf -march=armv8-a -mcpu=cortex-a53 -mfloat-abi=hard -marm
// --sysroot=/usr/lib/arm-linux-gnueabihf test.c
// のようにomit-frame-pointerを指定していても、オプション指定なし(O0)だと以下のように怒られる。
// test.c:12:9: warning: inline asm clobber list contains reserved registers: R11 [-Winline-asm]
// 12 | "sub sp, sp, #0x200\n\t"
// | ^
// test.c:12:9: note: Reserved registers on the clobber list may not be preserved across the asm statement, and clobbering them may lead to undefined behaviour.
// 1 warning generated.
// O1以上を指定すると出ない。
uint32_t read_id_isar5(void) {
uint32_t value;
asm volatile("mrc p15, 0, %0, c0, c2, 5" : "=r"(value));
return value;
}
void check_crypto_extension(void) {
uint32_t id_isar5 = read_id_isar5();
uint32_t aes = (id_isar5 >> 4) & 0xF;