我刚开始使用openssl并想测试ECDH的时间复杂度。然后我得到以下结果:
Doing 160 bits ecdh's for 10s: 40378 160-bits ECDH ops in 10.00s
Doing 192 bits ecdh's for 10s: 33250 192-bits ECDH ops in 10.00s
Doing 224 bits ecdh's for 10s: 23116 224-bits ECDH ops in 10.00s
Doing 256 bits ecdh's for 10s: 162753 256-bits ECDH ops in 10.00s
Doing 384 bits ecdh's for 10s: 8678 384-bits ECDH ops in 10.00s
Doing 521 bits ecdh's for 10s: 3621 521-bits ECDH ops in 10.00s
Doing 163 bits ecdh's for 10s: 37984 163-bits ECDH ops in 10.00s
Doing 233 bits ecdh's for 10s: 29814 233-bits ECDH ops in 10.00s
Doing 283 bits ecdh's for 10s: 16536 283-bits ECDH ops in 10.00s
Doing 409 bits ecdh's for 10s: 10180 409-bits ECDH ops in 10.00s
Doing 571 bits ecdh's for 10s: 4456 571-bits ECDH ops in 10.00s
Doing 163 bits ecdh's for 10s: 35757 163-bits ECDH ops in 10.00s
Doing 233 bits ecdh's for 10s: 28772 233-bits ECDH ops in 10.00s
Doing 283 bits ecdh's for 10s: 15668 283-bits ECDH ops in 10.01s
Doing 409 bits ecdh's for 10s: 9718 409-bits ECDH ops in 10.00s
Doing 571 bits ecdh's for 10s: 4110 571-bits ECDH ops in 10.00s
Doing 256 bits ecdh's for 10s: 20469 256-bits ECDH ops in 10.00s
Doing 256 bits ecdh's for 10s: 20735 256-bits ECDH ops in 10.00s
Doing 384 bits ecdh's for 10s: 8664 384-bits ECDH ops in 10.00s
Doing 384 bits ecdh's for 10s: 8668 384-bits ECDH ops in 10.00s
Doing 512 bits ecdh's for 10s: 5868 512-bits ECDH ops in 10.00s
Doing 512 bits ecdh's for 10s: 5984 512-bits ECDH ops in 10.00s
Doing 253 bits ecdh's for 10s: 235817 253-bits ECDH ops in 10.00s
Doing 448 bits ecdh's for 10s: 15137 448-bits ECDH ops in 10.00s
OpenSSL 1.1.1d 10 Sep 2019
built on: Wed Oct 16 15:16:22 2019 UTC
op op/s
160 bits ecdh (secp160r1) 0.0002s 4037.8
192 bits ecdh (nistp192) 0.0003s 3325.0
224 bits ecdh (nistp224) 0.0004s 2311.6
256 bits ecdh (nistp256) 0.0001s 16275.3
384 bits ecdh (nistp384) 0.0012s 867.8
521 bits ecdh (nistp521) 0.0028s 362.1
163 bits ecdh (nistk163) 0.0003s 3798.4
233 bits ecdh (nistk233) 0.0003s 2981.4
283 bits ecdh (nistk283) 0.0006s 1653.6
409 bits ecdh (nistk409) 0.0010s 1018.0
571 bits ecdh (nistk571) 0.0022s 445.6
163 bits ecdh (nistb163) 0.0003s 3575.7
233 bits ecdh (nistb233) 0.0003s 2877.2
283 bits ecdh (nistb283) 0.0006s 1565.2
409 bits ecdh (nistb409) 0.0010s 971.8
571 bits ecdh (nistb571) 0.0024s 411.0
256 bits ecdh (brainpoolP256r1) 0.0005s 2046.9
256 bits ecdh (brainpoolP256t1) 0.0005s 2073.5
384 bits ecdh (brainpoolP384r1) 0.0012s 866.4
384 bits ecdh (brainpoolP384t1) 0.0012s 866.8
512 bits ecdh (brainpoolP512r1) 0.0017s 586.8
512 bits ecdh (brainpoolP512t1) 0.0017s 598.4
253 bits ecdh (X25519) 0.0000s 23581.7
448 bits ecdh (X448) 0.0007s 1513.7
从结果可以看出,随着位的增加,相应的处理时间也增加。但是为什么使用256位时处理时间会大大减少?openssl的实现中是否有任何特殊的优化方法? 谢谢