@@ -469,30 +469,12 @@ inline bool HasARMv7()
469
469
inline bool HasNEON ()
470
470
{
471
471
// ASIMD is a core feature on Aarch32 and Aarch64 like SSE2 is a core feature on x86_64
472
- #if defined(__aarch32__ ) || defined( __aarch64__ )
472
+ #if defined(CRYPTOPP_ARM_ASIMD_AVAILABLE )
473
473
return true;
474
- #else
474
+ #elif defined( CRYPTOPP_ARM_NEON_AVAILABLE )
475
475
if (!g_ArmDetectionDone )
476
476
DetectArmFeatures ();
477
477
return g_hasNEON ;
478
- #endif
479
- }
480
-
481
- /// \brief Determine if an ARM processor provides Polynomial Multiplication
482
- /// \return true if the hardware is capable of polynomial multiplications at runtime,
483
- /// false otherwise.
484
- /// \details The multiplication instructions are available under Aarch32 and Aarch64.
485
- /// \details Runtime support requires compile time support. When compiling with GCC,
486
- /// you may need to compile with <tt>-march=armv8-a+crypto</tt>; while Apple requires
487
- /// <tt>-arch arm64</tt>. Also see ARM's <tt>__ARM_FEATURE_CRYPTO</tt> preprocessor macro.
488
- /// \since Crypto++ 5.6.4
489
- /// \note This function is only available on Aarch32 and Aarch64 platforms
490
- inline bool HasPMULL ()
491
- {
492
- #if defined(__aarch32__ ) || defined(__aarch64__ )
493
- if (!g_ArmDetectionDone )
494
- DetectArmFeatures ();
495
- return g_hasPMULL ;
496
478
#else
497
479
return false;
498
480
#endif
@@ -510,7 +492,7 @@ inline bool HasPMULL()
510
492
/// \note This function is only available on Aarch32 and Aarch64 platforms
511
493
inline bool HasCRC32 ()
512
494
{
513
- #if defined(__aarch32__ ) || defined( __aarch64__ )
495
+ #if defined(CRYPTOPP_ARM_CRC32_AVAILABLE )
514
496
if (!g_ArmDetectionDone )
515
497
DetectArmFeatures ();
516
498
return g_hasCRC32 ;
@@ -530,7 +512,7 @@ inline bool HasCRC32()
530
512
/// \note This function is only available on Aarch32 and Aarch64 platforms
531
513
inline bool HasAES ()
532
514
{
533
- #if defined(__aarch32__ ) || defined( __aarch64__ )
515
+ #if defined(CRYPTOPP_ARM_AES_AVAILABLE )
534
516
if (!g_ArmDetectionDone )
535
517
DetectArmFeatures ();
536
518
return g_hasAES ;
@@ -539,6 +521,26 @@ inline bool HasAES()
539
521
#endif
540
522
}
541
523
524
+ /// \brief Determine if an ARM processor provides Polynomial Multiplication
525
+ /// \return true if the hardware is capable of polynomial multiplications at runtime,
526
+ /// false otherwise.
527
+ /// \details The multiplication instructions are available under Aarch32 and Aarch64.
528
+ /// \details Runtime support requires compile time support. When compiling with GCC,
529
+ /// you may need to compile with <tt>-march=armv8-a+crypto</tt>; while Apple requires
530
+ /// <tt>-arch arm64</tt>. Also see ARM's <tt>__ARM_FEATURE_CRYPTO</tt> preprocessor macro.
531
+ /// \since Crypto++ 5.6.4
532
+ /// \note This function is only available on Aarch32 and Aarch64 platforms
533
+ inline bool HasPMULL ()
534
+ {
535
+ #if defined(CRYPTOPP_ARM_PMULL_AVAILABLE )
536
+ if (!g_ArmDetectionDone )
537
+ DetectArmFeatures ();
538
+ return g_hasPMULL ;
539
+ #else
540
+ return false;
541
+ #endif
542
+ }
543
+
542
544
/// \brief Determine if an ARM processor has SHA1 available
543
545
/// \return true if the hardware is capable of SHA1 at runtime, false otherwise.
544
546
/// \details SHA1 is part of the optional Crypto extensions on Aarch32 and Aarch64. They are
@@ -550,7 +552,7 @@ inline bool HasAES()
550
552
/// \note This function is only available on Aarch32 and Aarch64 platforms
551
553
inline bool HasSHA1 ()
552
554
{
553
- #if defined(__aarch32__ ) || defined( __aarch64__ )
555
+ #if defined(CRYPTOPP_ARM_SHA1_AVAILABLE )
554
556
if (!g_ArmDetectionDone )
555
557
DetectArmFeatures ();
556
558
return g_hasSHA1 ;
@@ -570,7 +572,7 @@ inline bool HasSHA1()
570
572
/// \note This function is only available on Aarch32 and Aarch64 platforms
571
573
inline bool HasSHA2 ()
572
574
{
573
- #if defined(__aarch32__ ) || defined( __aarch64__ )
575
+ #if defined(CRYPTOPP_ARM_SHA2_AVAILABLE )
574
576
if (!g_ArmDetectionDone )
575
577
DetectArmFeatures ();
576
578
return g_hasSHA2 ;
@@ -590,7 +592,7 @@ inline bool HasSHA2()
590
592
/// \note This function is only available on Aarch32 and Aarch64 platforms
591
593
inline bool HasSHA3 ()
592
594
{
593
- #if defined(__aarch32__ ) || defined( __aarch64__ )
595
+ #if defined(CRYPTOPP_ARM_SHA3_AVAILABLE )
594
596
if (!g_ArmDetectionDone )
595
597
DetectArmFeatures ();
596
598
return g_hasSHA3 ;
@@ -610,7 +612,7 @@ inline bool HasSHA3()
610
612
/// \note This function is only available on Aarch32 and Aarch64 platforms
611
613
inline bool HasSHA512 ()
612
614
{
613
- #if defined(__aarch32__ ) || defined( __aarch64__ )
615
+ #if defined(CRYPTOPP_ARM_SHA512_AVAILABLE )
614
616
if (!g_ArmDetectionDone )
615
617
DetectArmFeatures ();
616
618
return g_hasSHA512 ;
@@ -630,7 +632,7 @@ inline bool HasSHA512()
630
632
/// \note This function is only available on Aarch32 and Aarch64 platforms
631
633
inline bool HasSM3 ()
632
634
{
633
- #if defined(__aarch32__ ) || defined( __aarch64__ )
635
+ #if defined(CRYPTOPP_ARM_SM3_AVAILABLE )
634
636
if (!g_ArmDetectionDone )
635
637
DetectArmFeatures ();
636
638
return g_hasSM3 ;
@@ -650,7 +652,7 @@ inline bool HasSM3()
650
652
/// \note This function is only available on Aarch32 and Aarch64 platforms
651
653
inline bool HasSM4 ()
652
654
{
653
- #if defined(__aarch32__ ) || defined( __aarch64__ )
655
+ #if defined(CRYPTOPP_ARM_SM4_AVAILABLE )
654
656
if (!g_ArmDetectionDone )
655
657
DetectArmFeatures ();
656
658
return g_hasSM4 ;
0 commit comments