1# ESP32 Port 2 3Support for the ESP32-WROOM-32 on-board crypto hardware acceleration for symmetric AES, SHA1/SHA256/SHA384/SHA512 and RSA primitive including mul, mulmod and exptmod. 4 5## ESP32 Acceleration 6 7For detail about ESP32 HW Acceleration, you can find in [Technical Reference Manual](https://espressif.com/sites/default/files/documentation/esp32_technical_reference_manual_en.pdf) 8 9### Building 10 11To enable hw acceleration : 12 13* Uncomment out `#define WOLFSSL_ESPIDF` in `/path/to/wolfssl/wolfssl/wolfcrypt/settings.h` 14* Uncomment out `#define WOLFSSL_ESPWROOM32` in `/path/to/wolfssl/wolfssl/wolfcrypt/settings.h` 15 16To disable portions of the hardware acceleration you can optionally define: 17 18```c 19/* Disabled SHA, AES and RSA acceleration */ 20#define NO_ESP32WROOM32_CRYPT 21/* Disabled AES acceleration */ 22#define NO_WOLFSSL_ESP32WROOM32_CRYPT_AES 23/* Disabled SHA acceleration */ 24#define NO_WOLFSSL_ESP32WROOM32_CRYPT_HASH 25/* Disabled RSA Primitive acceleration */ 26#define NO_WOLFSSL_ESP32WROOM32_CRYPT_RSA_PRI 27``` 28 29### Coding 30 31In your application you must include `<wolfssl/wolfcrypt/settings.h>` before any other wolfSSL headers. If building the sources directly we recommend defining `WOLFSSL_USER_SETTINGS` and adding your own `user_settings.h` file. You can find a good reference for this in `IDE/GCC-ARM/Header/user_settings.h`. 32 33 34### Benchmarks 35 36w/ `USE_FAST_MATH` and `WOLFSSL_SMALL_STACK` options 37 38Software only implementation : 39 40``` 41AES-128-CBC-enc 1 MB took 1.001 seconds, 1.146 MB/s 42AES-128-CBC-dec 1 MB took 1.017 seconds, 1.104 MB/s 43AES-192-CBC-enc 1 MB took 1.018 seconds, 1.055 MB/s 44AES-192-CBC-dec 1 MB took 1.006 seconds, 1.019 MB/s 45AES-256-CBC-enc 1000 KB took 1.000 seconds, 1000.000 KB/s 46AES-256-CBC-dec 975 KB took 1.007 seconds, 968.222 KB/s 47AES-128-GCM-enc 350 KB took 1.055 seconds, 331.754 KB/s 48AES-128-GCM-dec 350 KB took 1.054 seconds, 332.068 KB/s 49AES-192-GCM-enc 325 KB took 1.013 seconds, 320.829 KB/s 50AES-192-GCM-dec 325 KB took 1.013 seconds, 320.829 KB/s 51AES-256-GCM-enc 325 KB took 1.041 seconds, 312.200 KB/s 52AES-256-GCM-dec 325 KB took 1.041 seconds, 312.200 KB/s 53SHA 6 MB took 1.004 seconds, 5.714 MB/s 54SHA-256 2 MB took 1.006 seconds, 1.747 MB/s 55SHA-384 1 MB took 1.011 seconds, 1.159 MB/s 56SHA-512 1 MB took 1.009 seconds, 1.161 MB/s 57HMAC-SHA 6 MB took 1.001 seconds, 5.634 MB/s 58HMAC-SHA256 2 MB took 1.000 seconds, 1.733 MB/s 59HMAC-SHA384 1 MB took 1.004 seconds, 1.046 MB/s 60HMAC-SHA512 1 MB took 1.002 seconds, 1.048 MB/s 61RSA 2048 public 16 ops took 1.056 sec, avg 66.000 ms, 15.152 ops/sec 62RSA 2048 private 2 ops took 2.488 sec, avg 1244.000 ms, 0.804 ops/sec 63ECC 256 key gen 4 ops took 1.101 sec, avg 275.250 ms, 3.633 ops/sec 64ECDHE 256 agree 4 ops took 1.098 sec, avg 274.500 ms, 3.643 ops/sec 65ECDSA 256 sign 4 ops took 1.111 sec, avg 277.750 ms, 3.600 ops/sec 66ECDSA 256 verify 2 ops took 1.099 sec, avg 549.500 ms, 1.820 ops/sec 67``` 68 69Hardware Acceleration : 70 71 72``` 73AES-128-CBC-enc 6 MB took 1.004 seconds, 5.958 MB/s 74AES-128-CBC-dec 5 MB took 1.002 seconds, 5.287 MB/s 75AES-192-CBC-enc 6 MB took 1.004 seconds, 5.958 MB/s 76AES-192-CBC-dec 5 MB took 1.002 seconds, 5.287 MB/s 77AES-256-CBC-enc 6 MB took 1.001 seconds, 5.951 MB/s 78AES-256-CBC-dec 5 MB took 1.004 seconds, 5.277 MB/s 79AES-128-GCM-enc 375 KB took 1.067 seconds, 351.453 KB/s 80AES-128-GCM-dec 375 KB took 1.067 seconds, 351.453 KB/s 81AES-192-GCM-enc 350 KB took 1.010 seconds, 346.535 KB/s 82AES-192-GCM-dec 350 KB took 1.009 seconds, 346.878 KB/s 83AES-256-GCM-enc 350 KB took 1.016 seconds, 344.488 KB/s 84AES-256-GCM-dec 350 KB took 1.016 seconds, 344.488 KB/s 85SHA 14 MB took 1.000 seconds, 14.062 MB/s 86SHA-256 15 MB took 1.000 seconds, 15.234 MB/s 87SHA-384 17 MB took 1.000 seconds, 17.383 MB/s 88SHA-512 18 MB took 1.001 seconds, 17.512 MB/s 89HMAC-SHA 14 MB took 1.000 seconds, 13.818 MB/s 90HMAC-SHA256 15 MB took 1.001 seconds, 14.951 MB/s 91HMAC-SHA384 17 MB took 1.001 seconds, 16.683 MB/s 92HMAC-SHA512 17 MB took 1.000 seconds, 16.943 MB/s 93RSA 2048 public 20 ops took 1.017 sec, avg 50.850 ms, 19.666 ops/sec 94RSA 2048 private 4 ops took 1.059 sec, avg 264.750 ms, 3.777 ops/sec 95ECC 256 key gen 4 ops took 1.092 sec, avg 273.000 ms, 3.663 ops/sec 96ECDHE 256 agree 4 ops took 1.089 sec, avg 272.250 ms, 3.673 ops/sec 97ECDSA 256 sign 4 ops took 1.101 sec, avg 275.250 ms, 3.633 ops/sec 98ECDSA 256 verify 2 ops took 1.092 sec, avg 546.000 ms, 1.832 ops/sec 99``` 100 101Condition : 102- Model : ESP32-WROOM-32 103- CPU Speed: 240Mhz 104- ESP-IDF : v3.3-beta1-39-g6cb37ecc5(commit hash : 6cb37ecc5) 105- OS : Ubuntu 18.04.1 LTS (Bionic Beaver) 106 107## Support 108 109Email us at [support@wolfssl.com](mailto:support@wolfssl.com). 110