randombit / botan

Cryptography Toolkit
https://botan.randombit.net
BSD 2-Clause "Simplified" License
2.6k stars 570 forks source link

Fix aarch64/armv7/ppc64 feature detection for systems with AT_HWCAP != 16 #4315

Closed randombit closed 3 months ago

randombit commented 3 months ago

This value was hard coded but it appears - while all known systems use the same bit flags for HWCAP/HWCAP2, they do not necessarily use the same value for AT_HWCAP itself. This was discovered during review of #4312

Previously this value was hardcoded, because some older glibc headers are missing the definition. Instead expose it via a pair of new functions in OS, which return the actual definition, if it's available, or otherwise default to the Linux/Android value.

coveralls commented 3 months ago

Coverage Status

coverage: 91.279% (+0.002%) from 91.277% when pulling c0697e73a19b46fb389aeb5fe14a92b2275b5301 on jack/fix-auxval into 69ad604ff8ba35860cfb22be3ed4e763ea07ba2c on master.

brad0 commented 3 months ago

@randombit and just FYI this issue affects Botan 2.