Closed okudayukiko closed 4 years ago
在我的三星手机(Exynos处理器)执行cat /proc/cpuinfo显示 Features: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid 没有neon指令集。 执行AES计算很耗电且速度慢。
AES is not a must-have instruction set on mobile platforms. Enabling AES instrin requires special routine to check support and two versions of code to support either situation. Contribution is welcomed.
OpenSSL should already handle it. If you have any questions, please check the OpenSSL source code.
AES is not a must-have instruction set on mobile platforms. Enabling AES instrin requires special routine to check support and two versions of code to support either situation. Contribution is welcomed.
通過cat /proc/cpuinfo
決定CPU是否支援AES指令集,然後執行不同的代碼。或者提供一個開關,打開這個開關就優先使用ChaCha20演算法。比如Chrome for Android,如果CPU支援AES,就優先使用AES-128-GCM;如果CPU不支援AES,就優先使用CHACHA20-POLY1305。AES計算確實需要AES指令集的輔助,尤其是AES-GCM。
没有调用AES指令集会导致在手机上执行AES加解密速度缓慢和很耗电,以及不稳定。