openssl/test/recipes
XiaokangQian 9ce8e0d17e Optimize AES-XTS mode in OpenSSL for aarch64
Aes-xts mode can be optimized by interleaving cipher operation on
several blocks and loop unrolling. Interleaving needs one ideal
unrolling factor, here we adopt the same factor with aes-cbc,
which is described as below:
	If blocks number > 5, select 5 blocks as one iteration,every
	loop, decrease the blocks number by 5.
	If left blocks < 5, treat them as tail blocks.
Detailed implementation has a little adjustment for squeezing
code space.
With this way, for small size such as 16 bytes, the performance is
similar as before, but for big size such as 16k bytes, the performance
improves a lot, even reaches to 2x uplift, for some arches such as A57,
the improvement even reaches more than 2x uplift. We collect many
performance datas on different micro-archs such as thunderx2,
ampere-emag, a72, a75, a57, a53 and N1, all of which reach 0.5-2x uplift.
The following table lists the encryption performance data on aarch64,
take a72, a75, a57, a53 and N1 as examples. Performance value takes the
unit of cycles per byte, takes the format as comparision of values.
List them as below:

A72:
                            Before optimization     After optimization  Improve
evp-aes-128-xts@16          8.899913518             5.949087263         49.60%
evp-aes-128-xts@64          4.525512668             3.389141845         33.53%
evp-aes-128-xts@256         3.502906908             1.633573479         114.43%
evp-aes-128-xts@1024        3.174210419             1.155952639         174.60%
evp-aes-128-xts@8192        3.053019303             1.028134888         196.95%
evp-aes-128-xts@16384       3.025292462             1.02021169          196.54%
evp-aes-256-xts@16          9.971105023             6.754233758         47.63%
evp-aes-256-xts@64          4.931479093             3.786527393         30.24%
evp-aes-256-xts@256         3.746788153             1.943975947         92.74%
evp-aes-256-xts@1024        3.401743802             1.477394648         130.25%
evp-aes-256-xts@8192        3.278769327             1.32950421          146.62%
evp-aes-256-xts@16384       3.27093296              1.325276257         146.81%

A75:
                            Before optimization     After optimization  Improve
evp-aes-128-xts@16          8.397965173             5.126839098         63.80%
evp-aes-128-xts@64          4.176860631             2.59817764          60.76%
evp-aes-128-xts@256         3.069126585             1.284561028         138.92%
evp-aes-128-xts@1024        2.805962699             0.932754655         200.83%
evp-aes-128-xts@8192        2.725820131             0.829820397         228.48%
evp-aes-128-xts@16384       2.71521905              0.823251591         229.82%
evp-aes-256-xts@16          11.24790935             7.383914448         52.33%
evp-aes-256-xts@64          5.294128847             3.048641998         73.66%
evp-aes-256-xts@256         3.861649617             1.570359905         145.91%
evp-aes-256-xts@1024        3.537646797             1.200493533         194.68%
evp-aes-256-xts@8192        3.435353012             1.085345319         216.52%
evp-aes-256-xts@16384       3.437952563             1.097963822         213.12%

A57:
                            Before optimization     After optimization  Improve
evp-aes-128-xts@16          10.57455446             7.165438012         47.58%
evp-aes-128-xts@64          5.418185447             3.721241202         45.60%
evp-aes-128-xts@256         3.855184592             1.747145379         120.66%
evp-aes-128-xts@1024        3.477199757             1.253049735         177.50%
evp-aes-128-xts@8192        3.36768104              1.091943159         208.41%
evp-aes-128-xts@16384       3.360373443             1.088942789         208.59%
evp-aes-256-xts@16          12.54559459             8.745489036         43.45%
evp-aes-256-xts@64          6.542808937             4.326387568         51.23%
evp-aes-256-xts@256         4.62668822              2.119908754         118.25%
evp-aes-256-xts@1024        4.161716505             1.557335554         167.23%
evp-aes-256-xts@8192        4.032462227             1.377749511         192.68%
evp-aes-256-xts@16384       4.023293877             1.371558933         193.34%

A53:
                            Before optimization     After optimization  Improve
evp-aes-128-xts@16          18.07842135             13.96980808         29.40%
evp-aes-128-xts@64          7.933818397             6.07159276          30.70%
evp-aes-128-xts@256         5.264604704             2.611155744         101.60%
evp-aes-128-xts@1024        4.606660117             1.722713454         167.40%
evp-aes-128-xts@8192        4.405160115             1.454379201         202.90%
evp-aes-128-xts@16384       4.401592028             1.442279392         205.20%
evp-aes-256-xts@16          20.07084054             16.00803726         25.40%
evp-aes-256-xts@64          9.192647294             6.883876732         33.50%
evp-aes-256-xts@256         6.336143161             3.108140452         103.90%
evp-aes-256-xts@1024        5.62502952              2.097960651         168.10%
evp-aes-256-xts@8192        5.412085608             1.807294191         199.50%
evp-aes-256-xts@16384       5.403062591             1.790135764         201.80%

N1:
                            Before optimization     After optimization  Improve
evp-aes-128-xts@16          6.48147613              4.209415473         53.98%
evp-aes-128-xts@64          2.847744115             1.950757468         45.98%
evp-aes-128-xts@256         2.085711968             1.061903238         96.41%
evp-aes-128-xts@1024        1.842014669             0.798486302         130.69%
evp-aes-128-xts@8192        1.760449052             0.713853939         146.61%
evp-aes-128-xts@16384       1.760763546             0.707702009         148.80%
evp-aes-256-xts@16          7.264142817             5.265970454         37.94%
evp-aes-256-xts@64          3.251356212             2.41176323          34.81%
evp-aes-256-xts@256         2.380488469             1.342095742         77.37%
evp-aes-256-xts@1024        2.08853022              1.041718215         100.49%
evp-aes-256-xts@8192        2.027432668             0.944571334         114.64%
evp-aes-256-xts@16384       2.00740782              0.941991415         113.10%

Add more XTS test cases to cover the cipher stealing mode and cases of different
number of blocks.

CustomizedGitHooks: yes
Change-Id: I93ee31b2575e1413764e27b599af62994deb4c96

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/11399)
2020-11-12 11:09:22 +01:00
..
04-test_conf_data
04-test_params_conversion_data
04-test_pem_data Rename NOTES*, README*, VERSION, HACKING, LICENSE to .md or .txt 2020-07-05 11:29:43 +02:00
10-test_bn_data
15-test_ecparam_data
15-test_mp_rsa_data
15-test_rsaoaep_data Test RSA oaep in fips mode 2020-07-23 17:40:40 +10:00
25-test_eai_data EAI test script and data 2020-08-26 14:04:17 +03:00
25-test_rusext_data Some OIDs used in Russian X.509 certificates. 2020-10-05 12:14:17 +03:00
30-test_evp_data Optimize AES-XTS mode in OpenSSL for aarch64 2020-11-12 11:09:22 +01:00
30-test_evp_pkey_provided Update test data for DSA public key text 2020-08-31 14:49:16 +10:00
61-test_bio_prefix_data
65-test_cmp_client_data
65-test_cmp_msg_data Add libctx/provider support to cmp_msg_test 2020-08-21 09:04:13 +02:00
65-test_cmp_protect_data
65-test_cmp_server_data
65-test_cmp_vfy_data
80-test_ca_data apps/ca: allow CRL lastUpdate/nextUpdate fields to be specified 2020-09-11 14:32:27 +03:00
80-test_cms_data
80-test_ocsp_data
81-test_cmp_cli_data Move CMP CLI test output files to BLDTOP/test-runs/test_cmp_cli/ 2020-10-06 21:45:25 +02:00
90-test_gost_data
90-test_includes_data
90-test_sslapi_data
90-test_store_data Fix 90-test_store.t for latest config, limits, providers, and disabled algos 2020-06-08 05:39:16 +02:00
95-test_external_gost_engine_data GOST external tests 2020-05-23 22:04:21 +03:00
95-test_external_krb5_data
95-test_external_pyca_data
01-test_abort.t
01-test_sanity.t
01-test_symbol_presence.t Update copyright year 2020-10-15 14:10:06 +01:00
01-test_test.t
02-test_errstr.t TEST: skip POSIX errcode zero in tesst/recipes/02-test_errstr.t 2020-09-12 03:51:21 +02:00
02-test_internal_context.t
02-test_internal_ctype.t
02-test_internal_keymgmt.t
02-test_internal_provider.t
02-test_lhash.t
02-test_ordinals.t
02-test_sparse_array.t
02-test_stack.t
03-test_exdata.t
03-test_fipsinstall.t Add self tests for rsa encryption 2020-09-16 14:10:23 +10:00
03-test_internal_asn1_dsa.t
03-test_internal_asn1.t
03-test_internal_bn.t Update copyright year 2020-05-15 14:09:49 +01:00
03-test_internal_chacha.t
03-test_internal_curve448.t
03-test_internal_ec.t
03-test_internal_ffc.t
03-test_internal_mdc2.t
03-test_internal_modes.t
03-test_internal_namemap.t
03-test_internal_poly1305.t
03-test_internal_rsa_sp800_56b.t Update copyright year 2020-05-15 14:09:49 +01:00
03-test_internal_siphash.t
03-test_internal_sm2.t
03-test_internal_sm4.t
03-test_internal_ssl_cert_table.t
03-test_internal_x509.t
03-test_params_api.t
03-test_property.t
03-test_ui.t
04-test_asn1_decode.t
04-test_asn1_encode.t
04-test_asn1_string_table.t
04-test_bio_callback.t
04-test_bioprint.t
04-test_conf.t
04-test_encoder_decoder.t Rename OSSL_SERIALIZER / OSSL_DESERIALIZER to OSSL_ENCODE / OSSL_DECODE 2020-08-21 09:23:58 +02:00
04-test_err.t
04-test_hexstring.t Fix ERR_print_errors so that it matches the documented format in doc/man3/ERR_error_string.pod 2020-05-26 12:44:36 +10:00
04-test_param_build.t
04-test_params_conversion.t
04-test_params.t
04-test_pem.t Update copyright year 2020-05-15 14:09:49 +01:00
04-test_provider_fallback.t Update copyright year 2020-06-25 14:13:12 +01:00
04-test_provider.t
05-test_bf.t
05-test_cast.t
05-test_cmac.t Update copyright year 2020-06-25 14:13:12 +01:00
05-test_des.t
05-test_hmac.t
05-test_idea.t
05-test_rand.t rand: instantiate the DRBGs upon first use. 2020-08-28 10:19:56 +10:00
05-test_rc2.t
05-test_rc4.t
05-test_rc5.t
06-test-rdrand.t
10-test_bn.t
10-test_exp.t
15-test_dh.t
15-test_dsa.t TEST: modify tconversion.pl for forensics 2020-10-16 19:07:20 +02:00
15-test_ec.t TEST: modify tconversion.pl for forensics 2020-10-16 19:07:20 +02:00
15-test_ecdsa.t
15-test_ecparam.t
15-test_gendh.t test/recipes/15-test_gendh.t: don't try DER params 2020-10-30 13:07:38 +01:00
15-test_gendsa.t Fix DSA/DH so that legacy keys can still be generated by the default provider 2020-08-17 23:40:20 +10:00
15-test_genec.t Add Explicit EC parameter support to providers. 2020-08-22 14:55:41 +10:00
15-test_genrsa.t TEST: Ensure that the base provider i activated when needed 2020-09-03 17:48:33 +02:00
15-test_mp_rsa.t
15-test_out_option.t
15-test_rsa.t TEST: modify tconversion.pl for forensics 2020-10-16 19:07:20 +02:00
15-test_rsaoaep.t Add 'fips-securitychecks' option and plumb this into the actual fips checks 2020-09-18 14:20:39 +01:00
15-test_rsapss.t test/recipes/15-test_rsapss.t: Add test with unrestricted signature 2020-05-14 12:17:13 +02:00
20-test_app.t Fix segfault in openssl app called with no args. 2020-06-18 09:03:32 +10:00
20-test_cli_fips.t Update openssl list to support new provider objects. 2020-09-26 07:13:22 +10:00
20-test_dgst.t Test HMAC output from the dgst CLI 2020-09-17 11:12:08 +03:00
20-test_enc_more.t Apps: change provider_path option to provider-path. 2020-08-18 19:31:42 +10:00
20-test_enc.t Apps: change provider_path option to provider-path. 2020-08-18 19:31:42 +10:00
20-test_kdf.t Update copyright year 2020-05-15 14:09:49 +01:00
20-test_mac.t Update copyright year 2020-05-15 14:09:49 +01:00
20-test_passwd.t apps/passwd: remove the -crypt option. 2020-11-12 08:35:47 +10:00
20-test_pkeyutl.t Clean up some SM2 related TODOs in the tests 2020-09-25 11:13:53 +01:00
20-test_rand_config.t rand: add a test case for configuration based random 2020-09-23 15:28:30 +10:00
25-test_crl.t TEST: modify tconversion.pl for forensics 2020-10-16 19:07:20 +02:00
25-test_d2i.t
25-test_eai_data.t Update copyright year 2020-10-15 14:10:06 +01:00
25-test_pkcs7.t Update copyright year 2020-11-05 13:37:26 +00:00
25-test_req.t TEST: modify tconversion.pl for forensics 2020-10-16 19:07:20 +02:00
25-test_rusext.t
25-test_sid.t Update copyright year 2020-11-05 13:37:26 +00:00
25-test_verify_store.t Update copyright year 2020-06-04 14:33:57 +01:00
25-test_verify.t Implement treatment of id-pkix-ocsp-no-check extension for OCSP_basic_verify() 2020-09-26 14:03:44 +02:00
25-test_x509.t 25-test_x509.t: Re-add and improve a test on non-existence of ASN.1 parse errors 2020-11-11 10:54:22 +01:00
30-test_acvp.t Make -provider_name and -section_name optional 2020-07-15 23:17:29 +02:00
30-test_aesgcm.t
30-test_afalg.t Update copyright year 2020-05-15 14:09:49 +01:00
30-test_defltfips.t Test that EVP_default_properties_is_fips_enabled() works early 2020-08-17 11:27:51 +01:00
30-test_engine.t Update copyright year 2020-08-06 13:22:30 +01:00
30-test_evp_extra.t Update copyright year 2020-06-25 14:13:12 +01:00
30-test_evp_fetch_prov.t Make -provider_name and -section_name optional 2020-07-15 23:17:29 +02:00
30-test_evp_kdf.t
30-test_evp_libctx.t test/recipes/30-test_evp_libctx.t: use fips-and-base.cnf 2020-11-11 12:43:27 +01:00
30-test_evp_pkey_dparam.t
30-test_evp_pkey_provided.t
30-test_evp.t Add AES KW inverse ciphers to the EVP layer 2020-11-02 09:22:14 +10:00
30-test_pbelu.t
30-test_pkey_meth_kdf.t
30-test_pkey_meth.t
30-test_provider_status.t Add 'on demand self test' and status test to providers 2020-08-09 18:06:52 +10:00
40-test_rehash.t
60-test_x509_check_cert_pkey.t
60-test_x509_dup_cert.t
60-test_x509_store.t
60-test_x509_time.t
61-test_bio_prefix.t
65-test_cmp_asn.t
65-test_cmp_client.t TEST: Ensure that the base provider i activated when needed 2020-09-03 17:48:33 +02:00
65-test_cmp_ctx.t
65-test_cmp_hdr.t
65-test_cmp_msg.t Update copyright year 2020-10-15 14:10:06 +01:00
65-test_cmp_protect.t Update copyright year 2020-10-15 14:10:06 +01:00
65-test_cmp_server.t Add libctx/provider support to cmp_server_test 2020-08-21 09:04:11 +02:00
65-test_cmp_status.t
65-test_cmp_vfy.t Add libctx/provider support to cmp_vfy_test 2020-08-21 09:04:13 +02:00
66-test_ossl_store.t Fix coverity issue: CID 1466486 - Resource leak in OSSL_STORE 2020-09-12 15:57:23 +10:00
70-test_asyncio.t
70-test_bad_dtls.t
70-test_clienthello.t
70-test_comp.t
70-test_key_share.t
70-test_packet.t
70-test_recordlen.t
70-test_renegotiation.t Update copyright year 2020-07-16 14:47:04 +02:00
70-test_servername.t
70-test_sslcbcpadding.t
70-test_sslcertstatus.t
70-test_sslextension.t Update copyright year 2020-07-16 14:47:04 +02:00
70-test_sslmessages.t
70-test_sslrecords.t Update copyright year 2020-07-16 14:47:04 +02:00
70-test_sslsessiontick.t
70-test_sslsigalgs.t Reduce the security bits for MD5 and SHA1 based signatures in TLS 2020-06-27 08:41:40 +02:00
70-test_sslsignature.t
70-test_sslskewith0p.t
70-test_sslversions.t Reduce the security bits for MD5 and SHA1 based signatures in TLS 2020-06-27 08:41:40 +02:00
70-test_sslvertol.t
70-test_tls13alerts.t
70-test_tls13cookie.t
70-test_tls13downgrade.t Update copyright year 2020-07-16 14:47:04 +02:00
70-test_tls13hrr.t
70-test_tls13kexmodes.t
70-test_tls13messages.t
70-test_tls13psk.t
70-test_tlsextms.t
70-test_verify_extra.t Update copyright year 2020-07-16 14:47:04 +02:00
70-test_wpacket.t
71-test_ssl_ctx.t
80-test_ca.t Fix test/recipes/80-test_ca.t to skip_all properly in a subtest 2020-11-07 12:24:49 +01:00
80-test_cipherbytes.t
80-test_cipherlist.t
80-test_ciphername.t
80-test_cms.t Tests for processing zero-length content in SMIME format 2020-10-08 18:17:44 +03:00
80-test_cmsapi.t
80-test_ct.t
80-test_dane.t
80-test_dtls_mtu.t
80-test_dtls.t
80-test_dtlsv1listen.t
80-test_http.t
80-test_ocsp.t TEST: Pass -no-CAstore in 80-test_ocsp.t 2020-06-23 12:25:48 +02:00
80-test_pkcs12.t Update copyright year 2020-10-15 14:10:06 +01:00
80-test_ssl_new.t TEST: Ensure that the base provider i activated when needed 2020-09-03 17:48:33 +02:00
80-test_ssl_old.t TEST: Ensure that the base provider i activated when needed 2020-09-03 17:48:33 +02:00
80-test_ssl_test_ctx.t
80-test_sslcorrupt.t
80-test_tsa.t Update copyright year 2020-08-06 13:22:30 +01:00
80-test_x509aux.t
81-test_cmp_cli.t Move CMP CLI test output files to BLDTOP/test-runs/test_cmp_cli/ 2020-10-06 21:45:25 +02:00
90-test_asn1_time.t
90-test_async.t
90-test_bio_enc.t
90-test_bio_memleak.t Update copyright year 2020-05-15 14:09:49 +01:00
90-test_constant_time.t
90-test_fatalerr.t
90-test_gmdiff.t
90-test_gost.t
90-test_ige.t
90-test_includes.t
90-test_memleak.t
90-test_overhead.t
90-test_secmem.t
90-test_shlibload.t test/recipes/90-test_shlibload.t: Skip when address sanitizer enabled 2020-11-01 06:01:09 +01:00
90-test_srp.t
90-test_sslapi.t TEST: Ensure that the base provider i activated when needed 2020-09-03 17:48:33 +02:00
90-test_sslbuffers.t
90-test_store.t TEST: Modify test/recipes/90-test_store.t for use with different 'file:' loaders 2020-09-03 17:48:32 +02:00
90-test_sysdefault.t
90-test_threads.t
90-test_time_offset.t
90-test_tls13ccs.t
90-test_tls13encryption.t
90-test_tls13secrets.t
90-test_v3name.t
95-test_external_boringssl.t
95-test_external_gost_engine.t Update copyright year 2020-06-04 14:33:57 +01:00
95-test_external_krb5.t Rename NOTES*, README*, VERSION, HACKING, LICENSE to .md or .txt 2020-07-05 11:29:43 +02:00
95-test_external_pyca.t
99-test_ecstress.t
99-test_fuzz.t 99-test_fuzz.t: Clean up and re-organize such that sub-tests could be split easily 2020-07-16 21:44:26 +02:00
fuzz.pl 99-test_fuzz.t: Clean up and re-organize such that sub-tests could be split easily 2020-07-16 21:44:26 +02:00
ocsp-response.der
tconversion.pl TEST: modify tconversion.pl for forensics 2020-10-16 19:07:20 +02:00