> You are running Darwin, and freebl does not have any optimizations for > RSA on darwin. It has some assembly optimizations on most other x86 > platforms. But on Darwin, freebl is built with plain C code, and no > assembly at all. That is one reason why the code is running a lot slower. > > It's likely that your OpenSSL version has been built with some assembly > optimizations, which could explain the difference.
This is the system provided OpenSSL library. I think Apple has enabled all possible optimizations. > > Even if you end up building NSS with optimizations, they use the regular > multiply instructions, which performs best on AMD chips, but not as well > on Intel CPUs. For Intel, one needs to use the SSE2 and above > instructions set, which NSS currently doesn't do - except on one > platform, Linux. I have an SSE2 chip, and I also compile an NSS lib passing the SSE2 flag to GCC, but unfortunately (as you mention), their is no optimization foe SSE2 on Darwin in the NSS sources. > > Another possible reason is if you are comparing 32-bit NSS vs 64-bit > OpenSSL binaries. Regardless of assembly optimizations. The 64-bit code > is always a lot faster, even without optimizations. Of course, but as my test exec is link on both library, so that could no be the case. Anyway by default, gcc produce 32 bits binary on OS X, and you should ask it explicitly to get a 64 bits version (and I don't ask it). > FYI, I ran the following command on Solaris x64, on a 4-year old dual > AMD Opteron 246 (2.2 GHz), with a 32-bit optimized of NSS 3.12, with > optimizations : > > time ./rsaperf -n none -k 2048 -g -i 1 > > This does one keygen, plus one RSA private key op (there is no way to > make rsaperf do 0 private key ops ...). But the time of the private key > op is about 26 ms, fixed time, and mostly noise lost in the keygen time. > > My results were between 0.91 and 5.38 seconds, with an average of 2.72 > seconds. Still slower than your openssl build, but about twice as fast > as your NSS results. > > When using a 64-bit optimized build of NSS, on the same system, the > results were way better. > > Out of 10, the RSA keygen time only varies from 0.25 to 0.84 second. The > average was 0.6 second. The lone private key op time dropped to 4.6 > milliseconds, so it's still negligible. That's what I supected. If I do not managed to find a way to generate an optimized binary, I think I'm going to workaround this issue by generating the key using OpenSSL and then, import them in my NSS db. Thank you. _______________________________________________ dev-tech-crypto mailing list dev-tech-crypto@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-tech-crypto