cryptopp icon indicating copy to clipboard operation
cryptopp copied to clipboard

Fix arm crypto logic issue in config_asm.h

Open antznin opened this issue 7 months ago • 5 comments

The current logic for enabling or disabling the CRYPTOPP_ARM_*_AVAILABLE macros seems wrong, because we do an OR between all of the conditions following defined(__ARM_FEATURE_CRYPTO). Fix the logic so that the CRYPTOPP_ARM_*_AVAILABLE macros are set if __ARM_FEATURE_CRYPTO is set AND any of the following condition is true.

antznin avatar May 27 '25 07:05 antznin

The current logic for enabling or disabling the CRYPTOPP_ARM_*_AVAILABLE macros seems wrong

OR'ed condition contains a list of known and allowed compilers; otherwise __ARM_FEATURE_CRYPTO could be used to force enabling of CRYPTOPP_ARM_*_AVAILABLE macros.

irwir avatar Jun 12 '25 10:06 irwir

The current logic for enabling or disabling the CRYPTOPP_ARM_*_AVAILABLE macros seems wrong

OR'ed condition contains a list of known and allowed compilers; otherwise __ARM_FEATURE_CRYPTO could be used to force enabling of CRYPTOPP_ARM_*_AVAILABLE macros.

That was the case before my patch, yes.

Now after my modification, a known and allowed compiler must be used and __ARM_FEATURE_CRYPTO must be set.

So I'm not sure I understand your comment.

antznin avatar Jun 28 '25 13:06 antznin

Now after my modification, a known and allowed compiler must be used and __ARM_FEATURE_CRYPTO must be set.

Incorrect interpretation of code logic. Should cryptopp need a single on/off switch here, then __ARM_FEATURE_CRYPTO would be checked before other conditions. In fact, all three blocks you suggested to change could have been placed under one check.

irwir avatar Jun 29 '25 13:06 irwir

Should cryptopp need a single on/off switch here, then __ARM_FEATURE_CRYPTO would be checked before other conditions. In fact, all three blocks you suggested to change could have been placed under one check.

Sure, I can change the code so __ARM_FEATURE_CRYPTO is checked first, then the three compilers. This also makes sense to me. But I'm not sure that what we want after your comments.

antznin avatar Jul 03 '25 06:07 antznin

This PR goes against portability, because any non-listed compiler would require source code changes.

irwir avatar Jul 03 '25 08:07 irwir