#include "sha256_base.h" // Intel SHA-NI (SHA Extensions) implementation #if defined(__x86_64__) || defined(_M_X64) #include #include // TODO: Full SHA-NI implementation using: // _mm_sha256msg1_epu32, _mm_sha256msg2_epu32 for message schedule // _mm_sha256rnds2_epu32 for rounds // For now, falls back to generic (implementation placeholder) static void transform_sha_ni(uint32_t* state, const uint8_t* data) { // Placeholder: full implementation would use SHA-NI intrinsics // This requires message scheduling with sha256msg1/sha256msg2 // and rounds with sha256rnds2 transform_generic(state, data); } TransformFunc detect_x86_transform(void) { unsigned int eax, ebx, ecx, edx; if (__get_cpuid(7, &eax, &ebx, &ecx, &edx)) { if (ebx & (1 << 29)) { // SHA bit return transform_sha_ni; } } return nullptr; } #else // No x86 support TransformFunc detect_x86_transform(void) { return nullptr; } #endif