Skip to content

Performance difference in ECC signature computation using OpenSSL inside and outside Intel SGX enclave #182

@chaudhryfaisal

Description

@chaudhryfaisal

Overview:
When computing ECC signatures inside and outside the Intel SGX enclave using the OpenSSL library, we observed a significant performance difference. Inside the enclave, the performance is about 5,000 operations, while outside the enclave, it is 43,000 operations. However, when using the Ring library, the performance is similar inside and outside the enclave.

Additional Information:

Steps to Reproduce:

  1. Compile and run the code inside the enclave using OpenSSL.
  2. Compile and run the same code outside the enclave using OpenSSL.
  3. Compile and run the same code inside and outside the enclave using the Ring library.
  4. Measure the performance of ECC signature computation in each case.

POC Code

git clone https://github.com/chaudhryfaisal/teaclave-sgx-sdk-hello-rust-vscode-debug-intel-sgx-ssl.git
cd teaclave-sgx-sdk-hello-rust-vscode-debug-intel-sgx-ssl
make
    ...
    cd ./bin; ./app
    [+] Init Enclave Successful 2!
    This is a normal world string passed into Enclave!
    This is a in-Enclave Rust string!
    [enclave/src/lib.rs:66] a * 2 = 4
    [+] say_something success...
    [+] ecc_test
    [+] ecall_ecc_key_create
    ecall_ecc_key_create
    [+] ecall_ecc_sign
    [+] ecc_test
    [+] ecall_ecc_key_create
    ecall_ecc_key_create
    [+] ecall_ecc_sign
    ecc_key_create
    !!! stage started: openssl_no_enclave 
    *** stage completed: openssl_no_enclave (1_000 iters, 0.023 secs)
    !!! stage started: openssl_enclave 
    *** stage completed: openssl_enclave (1_000 iters, 0.198 secs)
    --- Benchmark results ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     stage               iters  secs   msecs    iters/s  diff.s     
    ----------------------------------------------------------------
     openssl_enclave     1_000  0.198  197.980  5_051               
     openssl_no_enclave  1_000  0.023  22.962   43_549   +762.19 %  

Expected Behavior:
The performance of ECC signature computation should be similar inside and outside the enclave when using the OpenSSL library.

Actual Behavior:
There is a significant performance difference in ECC signature computation inside and outside the enclave using the OpenSSL library.

Environment Details:

lscpu
Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
CPU(s):              24
On-line CPU(s) list: 0-23
Thread(s) per core:  2
Core(s) per socket:  12
Socket(s):           1
NUMA node(s):        1
Vendor ID:           GenuineIntel
CPU family:          6
Model:               106
Model name:          Intel(R) Xeon(R) Silver 4310 CPU @ 2.10GHz
Stepping:            6
CPU MHz:             2100.000
BogoMIPS:            4200.00
Virtualization:      VT-x
L1d cache:           48K
L1i cache:           32K
L2 cache:            1280K
L3 cache:            18432K
NUMA node0 CPU(s):   0-23
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 invpcid_single ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust sgx bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local split_lock_detect wbnoinvd dtherm ida arat pln pts avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq la57 rdpid sgx_lc fsrm md_clear pconfig flush_l1d arch_capabilities

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions