Mbed-TLS / mbedtls

An open source, portable, easy to use, readable and flexible TLS library, and reference implementation of the PSA Cryptography API. Releases are on a varying cadence, typically around 3 - 6 months between releases.
https://www.trustedfirmware.org/projects/mbed-tls/
Other
5.24k stars 2.56k forks source link

armv7 encryption benchmark with aes-gcm-256 is 10 times lower than openssl,how can I solve this #9535

Closed 20083017 closed 3 weeks ago

20083017 commented 3 weeks ago

Summary

System information

Mbed TLS version (number or commit id): 3.5.1

5786443k 1024bytes for openssl

while mbedtls has 2219k/sec

20083017 commented 3 weeks ago

image image

paul-elliott-arm commented 3 weeks ago

Hi @20083017,

You have not given me a lot to go on here - its extremely difficult to tell if you are actually comparing like with like here, and I don't think its really our place to help you debug this.

If you can determine a specific area of slowdown in our code then its possible we could assist you with this, but as written this is really not enough information to go on.

20083017 commented 3 weeks ago

image here is our cpu info,I'm just wondering if openssl optimized it's performance on armv7, any help will be gratitude

davidhorstmann-arm commented 3 weeks ago

here is our cpu info,I'm just wondering if openssl optimized it's performance on armv7, any help will be gratitude

Hello,

It is likely that OpenSSL has been optimised for armv7 platforms (along with any other platforms that they support).

Mbed TLS is probably slower than OpenSSL because we have made different design tradeoffs. Mbed TLS aims to be an embedded library, so it focuses on small code size and memory footprint, sometimes at the expense of performance.

Meanwhile OpenSSL is aimed at the highest possible performance (as far as I'm aware) but it probably compiles to a larger code size than Mbed TLS, and uses more memory.

I hope that helps.

20083017 commented 3 weeks ago

@davidhorstmann-arm Thank you very much, I've figured out the reason why openssl is better! Turns out that they uses asm and crypto engines to accelerate which will be faster . After all, Thanks for your quick reply ^_^