Index: src/OFSystemInfo.h ================================================================== --- src/OFSystemInfo.h +++ src/OFSystemInfo.h @@ -49,10 +49,12 @@ @property (class, readonly, nonatomic) bool supportsSSSE3; @property (class, readonly, nonatomic) bool supportsSSE41; @property (class, readonly, nonatomic) bool supportsSSE42; @property (class, readonly, nonatomic) bool supportsAVX; @property (class, readonly, nonatomic) bool supportsAVX2; +@property (class, readonly, nonatomic) bool supportsAESNI; +@property (class, readonly, nonatomic) bool supportsSHAExtensions; # endif # if defined(OF_POWERPC) || defined(OF_POWERPC64) || defined(DOXYGEN) @property (class, readonly, nonatomic) bool supportsAltiVec; # endif #endif @@ -251,10 +253,28 @@ * @note This method is only available on x86 and x86_64. * * @return Whether the CPU supports AVX2 */ + (bool)supportsAVX2; + +/*! + * @brief Returns whether the CPU supports AES-NI. + * + * @note This method is only available on x86 and x86_64. + * + * @return Whether the CPU supports AES-NI + */ ++ (bool)supportsAESNI; + +/*! + * @brief Returns whether the CPU supports Intel SHA Extensions. + * + * @note This method is only available on x86 and x86_64. + * + * @return Whether the CPU supports Intel SHA Extensions + */ ++ (bool)supportsSHAExtensions; #endif #if defined(OF_POWERPC) || defined(OF_POWERPC64) /*! * @brief Returns whether the CPU and OS support AltiVec. Index: src/OFSystemInfo.m ================================================================== --- src/OFSystemInfo.m +++ src/OFSystemInfo.m @@ -624,10 +624,20 @@ + (bool)supportsAVX2 { return x86_cpuid(0, 0).eax >= 7 && (x86_cpuid(7, 0).ebx & (1u << 5)); } + ++ (bool)supportsAESNI +{ + return (x86_cpuid(1, 0).ecx & (1u << 25)); +} + ++ (bool)supportsSHAExtensions +{ + return (x86_cpuid(7, 0).ebx & (1u << 29)); +} #endif #if defined(OF_POWERPC) || defined(OF_POWERPC64) + (bool)supportsAltiVec { @@ -647,12 +657,10 @@ uint32_t supportsAltiVec; if (NewGetSystemAttrs(&supportsAltiVec, sizeof(supportsAltiVec), SYSTEMINFOTYPE_PPC_ALTIVEC, TAG_DONE) > 0) return supportsAltiVec; - - return false; # endif return false; } #endif Index: tests/OFSystemInfoTests.m ================================================================== --- tests/OFSystemInfoTests.m +++ tests/OFSystemInfoTests.m @@ -83,14 +83,19 @@ PRINT(GREEN, @"Supports SSE4.2: %d", [OFSystemInfo supportsSSE42]); PRINT(GREEN, @"Supports AVX: %d", [OFSystemInfo supportsAVX]); PRINT(GREEN, @"Supports AVX2: %d", [OFSystemInfo supportsAVX2]); + + PRINT(GREEN, @"Supports AES-NI: %d", [OFSystemInfo supportsAESNI]); + + PRINT(GREEN, @"Supports SHA extensions: %d", + [OFSystemInfo supportsSHAExtensions]); #endif #ifdef OF_POWERPC PRINT(GREEN, @"Supports AltiVec: %d", [OFSystemInfo supportsAltiVec]); #endif [pool drain]; } @end