Skip to content

Instantly share code, notes, and snippets.

@estshorter
Created October 20, 2025 14:08
Show Gist options
  • Select an option

  • Save estshorter/a1f3df7dfda5200d6d587d397f476c95 to your computer and use it in GitHub Desktop.

Select an option

Save estshorter/a1f3df7dfda5200d6d587d397f476c95 to your computer and use it in GitHub Desktop.
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;
uint32_t sha1 = (id_isar5 >> 8) & 0xF;
uint32_t sha2 = (id_isar5 >> 12) & 0xF;
printf("Cryptography Extension サポート状況:\n");
printf(" AES: %s\n", aes ? "あり" : "なし");
printf(" SHA1: %s\n", sha1 ? "あり" : "なし");
printf(" SHA2: %s\n", sha2 ? "あり" : "なし");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment