用 RPi3 运行了一下 OpenSSL 自带的速度测试,结果如下:
OpenSSL 1.0.1t 3 May 2016
built on: Sun Jun 5 04:40:58 2016
options:bn(64,32) rc4(ptr,char) des(idx,cisc,16,long) aes(partial) blowfish(ptr)
compiler: gcc -I. -I.. -I../include -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DL_ENDIAN -DTERMIO -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -Wl,-z,relro -Wa,--noexecstack -Wall -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DAES_ASM -DGHASH_ASM
The 'numbers' are in 1000s of bytes per second processed.
type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
md2 0.00 0.00 0.00 0.00 0.00
mdc2 0.00 0.00 0.00 0.00 0.00
md4 9795.82k 35752.58k 99817.73k 180638.04k 236838.91k
md5 7560.42k 26784.47k 74369.28k 133779.46k 174626.13k
hmac(md5) 7688.43k 26809.92k 74479.02k 133875.71k 174732.63k
sha1 7809.49k 24084.16k 53898.15k 78617.60k 90841.09k
rmd160 6879.44k 20474.11k 44320.09k 62478.68k 70950.91k
rc4 79596.22k 91260.46k 95840.34k 97059.84k 97391.96k
des cbc 18581.16k 20445.74k 21020.50k 21168.47k 21211.82k
des ede3 7361.25k 7669.65k 7757.31k 7779.67k 7785.13k
idea cbc 0.00 0.00 0.00 0.00 0.00
seed cbc 23227.13k 25510.27k 26237.01k 26402.47k 26451.97k
rc2 cbc 16615.92k 17779.67k 18144.43k 18223.79k 18229.93k
rc5-32/12 cbc 0.00 0.00 0.00 0.00 0.00
blowfish cbc 31986.51k 36090.58k 37283.24k 37624.49k 37726.89k
cast cbc 26678.90k 30774.91k 32116.22k 32470.36k 32571.39k
aes-128 cbc 41119.87k 46444.71k 48183.72k 48501.08k 48507.56k
aes-192 cbc 35801.51k 39766.85k 41021.53k 41247.74k 41306.79k
aes-256 cbc 32219.57k 35404.74k 36383.06k 36558.17k 36620.97k
camellia-128 cbc 29244.58k 33262.85k 34626.30k 34987.69k 35089.07k
camellia-192 cbc 23867.74k 26480.02k 27340.37k 27564.71k 27628.89k
camellia-256 cbc 23829.02k 26480.00k 27340.71k 27564.71k 27628.89k
sha256 10870.99k 27084.27k 48914.35k 61409.62k 66338.82k
sha512 3537.39k 14084.33k 20592.21k 28181.16k 31599.27k
whirlpool 1390.52k 2874.33k 4655.96k 5518.34k 5832.70k
aes-128 ige 35881.22k 42684.39k 45071.36k 45730.82k 45888.85k
aes-192 ige 31737.56k 36984.36k 38766.85k 39242.07k 39365.29k
aes-256 ige 28906.22k 33196.63k 34592.60k 34989.40k 35078.14k
ghash 42804.59k 48161.77k 50088.70k 50594.13k 50735.79k
sign verify sign/s verify/s rsa 512 bits 0.000776s 0.000067s 1288.3 14928.7
rsa 1024 bits 0.003946s 0.000199s 253.4 5013.4
rsa 2048 bits 0.025138s 0.000708s 39.8 1413.1
rsa 4096 bits 0.172931s 0.002698s 5.8 370.6
sign verify sign/s verify/s dsa 512 bits 0.000687s 0.000740s 1455.2 1351.6
dsa 1024 bits 0.001945s 0.002230s 514.2 448.4
dsa 2048 bits 0.006807s 0.007976s 146.9 125.4
sign verify sign/s verify/s 160 bit ecdsa (secp160r1) 0.0005s 0.0019s 2044.1 538.0
192 bit ecdsa (nistp192) 0.0006s 0.0025s 1631.9 399.1
224 bit ecdsa (nistp224) 0.0008s 0.0033s 1301.0 307.4
256 bit ecdsa (nistp256) 0.0010s 0.0044s 1042.4 229.6
384 bit ecdsa (nistp384) 0.0021s 0.0105s 487.7 95.5
521 bit ecdsa (nistp521) 0.0041s 0.0221s 244.8 45.2
163 bit ecdsa (nistk163) 0.0016s 0.0068s 633.9 147.9
233 bit ecdsa (nistk233) 0.0033s 0.0127s 300.7 78.8
283 bit ecdsa (nistk283) 0.0051s 0.0234s 196.6 42.8
409 bit ecdsa (nistk409) 0.0138s 0.0532s 72.7 18.8
571 bit ecdsa (nistk571) 0.0330s 0.1241s 30.3 8.1
163 bit ecdsa (nistb163) 0.0016s 0.0073s 637.4 136.7
233 bit ecdsa (nistb233) 0.0033s 0.0141s 302.8 71.1
283 bit ecdsa (nistb283) 0.0051s 0.0261s 195.4 38.3
409 bit ecdsa (nistb409) 0.0138s 0.0608s 72.4 16.4
571 bit ecdsa (nistb571) 0.0330s 0.1428s 30.3 7.0
op op/s
160 bit ecdh (secp160r1) 0.0016s 629.2
192 bit ecdh (nistp192) 0.0021s 475.7
224 bit ecdh (nistp224) 0.0028s 350.9
256 bit ecdh (nistp256) 0.0036s 278.0
384 bit ecdh (nistp384) 0.0087s 115.2
521 bit ecdh (nistp521) 0.0186s 53.8
163 bit ecdh (nistk163) 0.0033s 302.3
233 bit ecdh (nistk233) 0.0062s 160.1
283 bit ecdh (nistk283) 0.0116s 86.3
409 bit ecdh (nistk409) 0.0264s 37.8
571 bit ecdh (nistk571) 0.0619s 16.2
163 bit ecdh (nistb163) 0.0036s 277.7
233 bit ecdh (nistb233) 0.0069s 145.8
283 bit ecdh (nistb283) 0.0129s 77.2
409 bit ecdh (nistb409) 0.0302s 33.1
571 bit ecdh (nistb571) 0.0711s 14.1
这个结果与elinux.org针对此前版本Pi的测试结果相比,已经有了数量级的提升。当然与 x86 相比还有距离。我在若干年前的 Core2 系列的 T6700 上运行了同样的测试(Ubuntu 系统),得到如下结果:
OpenSSL 1.0.1f 6 Jan 2014
built on: Mon May 2 16:53:18 UTC 2016
options:bn(64,64) rc4(16x,int) des(idx,cisc,16,int) aes(partial) blowfish(idx)
compiler: cc -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -m64 -DL_ENDIAN -DTERMIO -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wa,--noexecstack -Wall -DMD32_REG_T=int -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM
The 'numbers' are in 1000s of bytes per second processed.
type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
md2 0.00 0.00 0.00 0.00 0.00
mdc2 0.00 0.00 0.00 0.00 0.00
md4 48268.28k 150163.94k 362062.44k 549839.91k 646990.88k
md5 35666.09k 106668.63k 242385.28k 355862.56k 411523.46k
hmac(md5) 26447.70k 85679.33k 211473.33k 336846.88k 408587.72k
sha1 37939.04k 107192.58k 229484.95k 321413.19k 365554.16k
rmd160 24909.55k 60307.65k 111847.95k 141809.17k 154398.51k
rc4 189484.70k 305580.82k 355119.32k 371357.04k 372187.11k
des cbc 43420.45k 45014.02k 45551.02k 45111.51k 45343.83k
des ede3 16747.00k 17329.95k 17421.79k 17445.93k 17401.13k
idea cbc 0.00 0.00 0.00 0.00 0.00
seed cbc 47317.00k 48909.10k 49460.59k 49285.16k 49358.90k
rc2 cbc 21931.40k 22349.06k 22500.91k 22436.40k 22684.04k
rc5-32/12 cbc 0.00 0.00 0.00 0.00 0.00
blowfish cbc 74512.23k 79975.90k 81205.29k 81795.58k 81964.73k
cast cbc 71014.61k 77245.85k 78006.43k 78206.69k 78296.51k
aes-128 cbc 66731.52k 72357.75k 74361.88k 155478.59k 158728.96k
aes-192 cbc 56562.79k 60617.47k 61896.75k 132451.12k 133273.94k
aes-256 cbc 48786.44k 52074.47k 52883.59k 113208.20k 114146.45k
camellia-128 cbc 62848.46k 93167.45k 105857.21k 109411.99k 110804.39k
camellia-192 cbc 53379.26k 71797.96k 78682.33k 81116.71k 81601.73k
camellia-256 cbc 51971.81k 71605.14k 78708.93k 80735.27k 81665.66k
sha256 29443.97k 64104.38k 109337.77k 133225.84k 142733.88k
sha512 23202.21k 91714.63k 140732.16k 197079.11k 224267.72k
whirlpool 18494.59k 39534.42k 65681.58k 76647.95k 68388.03k
aes-128 ige 67564.18k 70331.17k 70053.71k 70720.47k 70851.15k
aes-192 ige 57027.17k 58884.57k 59061.79k 59394.76k 59356.26k
aes-256 ige 49199.09k 50868.54k 50682.93k 51129.66k 51095.54k
ghash 162318.13k 235443.74k 265612.37k 276384.15k 278754.18k
sign verify sign/s verify/s
rsa 512 bits 0.000137s 0.000009s 7302.7 106627.1
rsa 1024 bits 0.000453s 0.000025s 2206.3 39296.2
rsa 2048 bits 0.002934s 0.000088s 340.8 11374.9
rsa 4096 bits 0.021522s 0.000326s 46.5 3068.3
sign verify sign/s verify/s
dsa 512 bits 0.000106s 0.000111s 9474.2 9016.8
dsa 1024 bits 0.000263s 0.000304s 3802.9 3288.1
dsa 2048 bits 0.000862s 0.001058s 1160.2 945.5
sign verify sign/s verify/s
160 bit ecdsa (secp160r1) 0.0001s 0.0004s 8750.3 2282.1
192 bit ecdsa (nistp192) 0.0001s 0.0005s 7208.2 1871.1
224 bit ecdsa (nistp224) 0.0001s 0.0003s 7512.7 3208.2
256 bit ecdsa (nistp256) 0.0002s 0.0005s 4982.0 1948.3
384 bit ecdsa (nistp384) 0.0004s 0.0020s 2385.1 512.4
521 bit ecdsa (nistp521) 0.0008s 0.0020s 1178.9 505.2
163 bit ecdsa (nistk163) 0.0003s 0.0015s 3099.5 663.9
233 bit ecdsa (nistk233) 0.0006s 0.0020s 1614.4 500.1
283 bit ecdsa (nistk283) 0.0010s 0.0044s 1018.5 225.9
409 bit ecdsa (nistk409) 0.0023s 0.0096s 426.1 104.4
571 bit ecdsa (nistk571) 0.0052s 0.0203s 193.8 49.3
163 bit ecdsa (nistb163) 0.0003s 0.0016s 3091.0 628.5
233 bit ecdsa (nistb233) 0.0006s 0.0021s 1606.7 477.1
283 bit ecdsa (nistb283) 0.0010s 0.0048s 1017.3 209.0
409 bit ecdsa (nistb409) 0.0024s 0.0107s 423.7 93.4
571 bit ecdsa (nistb571) 0.0052s 0.0233s 194.1 43.0
op op/s
160 bit ecdh (secp160r1) 0.0004s 2709.2
192 bit ecdh (nistp192) 0.0004s 2323.3
224 bit ecdh (nistp224) 0.0002s 4669.5
256 bit ecdh (nistp256) 0.0004s 2709.4
384 bit ecdh (nistp384) 0.0017s 605.6
521 bit ecdh (nistp521) 0.0014s 694.0
163 bit ecdh (nistk163) 0.0007s 1358.1
233 bit ecdh (nistk233) 0.0010s 1010.8
283 bit ecdh (nistk283) 0.0021s 474.0
409 bit ecdh (nistk409) 0.0047s 213.7
571 bit ecdh (nistk571) 0.0100s 99.9
163 bit ecdh (nistb163) 0.0008s 1298.7
233 bit ecdh (nistb233) 0.0011s 925.2
283 bit ecdh (nistb283) 0.0024s 423.7
409 bit ecdh (nistb409) 0.0052s 193.6
571 bit ecdh (nistb571) 0.0115s 87.2
可见,差距跑分差距明显,但是二者编译优化的差别也很明显。在 x86 上用了 SSE2 优化,而在 RPi3 上并无类似的优化,操作系统也是 32b 的。所以跑分的差距一部分来自硬件性能上的差距,另一部分应该来自于软件层面的优化工作。