GmSSL icon indicating copy to clipboard operation
GmSSL copied to clipboard

sm4_aesni_avx性能疑惑

Open huchuanwen12 opened this issue 1 year ago • 2 comments

老师你好,我使用当前gmssl-master版本,编译启用sm4_aesni_avx指令优化。修改sm4_aesni_avxtest.c,测试100000次加密的速度。发现其性能与openssl-1.1.1a的sm4-ctr性能相差不大。请问这个现象正常吗?如果我想用sm4_aesni_avx性能优化,我的硬件信息需要满足什么条件。 我的测试环境信息:Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz 其指令集为:fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch ida arat epb pln pts dtherm hwp hwp_noitfy hwp_act_window hwp_epp tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt xsaveopt xsavec xgetbv1 xsaves 测试结果:openssl-1.1.1a用命令行测试出的性能:314.214Mbps gmssl测试sm4_aesni_avx的性能:390.938 Mbps

huchuanwen12 avatar Aug 15 '23 11:08 huchuanwen12

@guanzhi 老师能抽空解答下吗

huchuanwen12 avatar Aug 16 '23 02:08 huchuanwen12

首先,你的测试数据是多少字节?sm4_aesni_avx只是对64*n字节的数据进行了SIMD并行加密;而openssl-1.1.1a虽然没有使用AESNI+SIMD加速,但是使用了S盒和L转换预计算,单block加密性能更优。另外,也要看CTR模式实现部分的性能优劣。

emmansun avatar Dec 26 '23 09:12 emmansun