Go to file
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
.github Fix typos and repeated words 2020-07-05 01:49:20 +02:00
apps apps/passwd: remove the -crypt option. 2020-11-12 08:35:47 +10:00
boringssl@2070f8ad91
Configurations Remove FLOSS from all OSS builds on NonStop except for SPT threading. 2020-11-01 06:27:09 +01:00
crypto Optimize AES-XTS mode in OpenSSL for aarch64 2020-11-12 11:09:22 +01:00
demos Update copyright year 2020-08-06 13:22:30 +01:00
dev dev/release.sh: improve instruction for pushing the tag 2020-10-17 11:54:34 +02:00
doc apps/passwd: remove the -crypt option. 2020-11-12 08:35:47 +10:00
engines Avoid duplicate ends_with_dirsep functions 2020-11-11 16:05:56 +01:00
external/perl Update the bundled external perl module Text-Template to version 1.56 2019-09-12 12:53:32 +02:00
fuzz Update copyright year 2020-10-15 14:10:06 +01:00
gost-engine@b008f2a0ff Update gost-engine to fix API rename 2020-08-07 23:13:14 +03:00
include Optimize AES-XTS mode in OpenSSL for aarch64 2020-11-12 11:09:22 +01:00
krb5@890ca2f401 Update the krb5 submodule 2019-12-25 12:45:32 -08:00
ms Unify all assembler file generators 2019-09-16 16:29:57 +02:00
os-dep
providers Avoid duplicate ends_with_dirsep functions 2020-11-11 16:05:56 +01:00
pyca-cryptography@09403100de Update the pyca-cryptography submodule 2018-09-10 12:04:03 +01:00
ssl SSL: refactor all SSLfatal() calls 2020-11-11 12:12:23 +01:00
test Optimize AES-XTS mode in OpenSSL for aarch64 2020-11-12 11:09:22 +01:00
tools Following the license change, modify the boilerplates in util/, tools/ 2018-12-06 14:17:23 +01:00
util ENCODER: Add support for specifying the outermost output structure 2020-11-11 12:43:27 +01:00
VMS Following the license change, modify the boilerplates in last few 2018-12-06 15:40:33 +01:00
.gitattributes Do not export the submodules gost-engine 2020-11-04 16:09:25 +03:00
.gitignore Fix some missed usage of DEFINE_LHASH_OF() 2020-10-30 14:24:30 +00:00
.gitmodules GOST external tests 2020-05-23 22:04:21 +03:00
.travis-apt-pin.preferences
.travis-create-release.sh Remove all 'make dist' artifacts 2018-11-23 12:40:32 +01:00
.travis.yml Travis: default to HARNESS_JOBS=4 2020-07-02 16:48:15 +03:00
ACKNOWLEDGEMENTS.md Fix issues reported by markdownlint 2020-05-08 16:22:02 +02:00
appveyor.yml appveyor.yml: Clean up minimal configuration, adding no-ec and pruning cascaded no-* 2020-09-28 15:51:54 +02:00
AUTHORS.md Fix issues reported by markdownlint 2020-05-08 16:22:02 +02:00
build.info Fix some missed usage of DEFINE_LHASH_OF() 2020-10-30 14:24:30 +00:00
CHANGES.md apps/passwd: remove the -crypt option. 2020-11-12 08:35:47 +10:00
config config: Turn into a simple wrapper 2020-06-28 18:34:36 +02:00
config.com Update copyright year 2020-07-16 14:47:04 +02:00
configdata.pm.in configdata.pm.in, util/dofile.pl: Make a HERE document stricter. 2020-10-27 10:17:19 +01:00
Configure Configure: handle undefined shared_target. 2020-09-29 16:08:04 +02:00
CONTRIBUTING.md Change markdown link style in README, INSTALL, SUPPORT and CONTRIBUTING 2020-10-18 13:28:08 +02:00
e_os.h Implement OpenSSL secure memory for Windows 2020-10-22 12:11:35 +10:00
FAQ.md doc: introduce some minimalistic markdown without essential changes 2020-02-26 21:04:38 +01:00
HACKING.md Fix many MarkDown issues in {NOTES*,README*,HACKING,LICENSE}.md files 2020-07-05 11:29:43 +02:00
INSTALL.md Change markdown link style in README, INSTALL, SUPPORT and CONTRIBUTING 2020-10-18 13:28:08 +02:00
LICENSE.txt Rename NOTES*, README*, VERSION, HACKING, LICENSE to .md or .txt 2020-07-05 11:29:43 +02:00
NEWS.md Prepare for 3.0 alpha 9 2020-11-05 14:04:11 +00:00
NOTES-Android.md Fix many MarkDown issues in {NOTES*,README*,HACKING,LICENSE}.md files 2020-07-05 11:29:43 +02:00
NOTES-DJGPP.md Fix many MarkDown issues in {NOTES*,README*,HACKING,LICENSE}.md files 2020-07-05 11:29:43 +02:00
NOTES-NONSTOP.md Rewrite the HPE NonStop Notes file in Markdown with more explanations. 2020-10-28 17:18:26 +01:00
NOTES-Perl.md Fix many MarkDown issues in {NOTES*,README*,HACKING,LICENSE}.md files 2020-07-05 11:29:43 +02:00
NOTES-Unix.md Fix many MarkDown issues in {NOTES*,README*,HACKING,LICENSE}.md files 2020-07-05 11:29:43 +02:00
NOTES-Valgrind.md Fix many MarkDown issues in {NOTES*,README*,HACKING,LICENSE}.md files 2020-07-05 11:29:43 +02:00
NOTES-VMS.md Fix many MarkDown issues in {NOTES*,README*,HACKING,LICENSE}.md files 2020-07-05 11:29:43 +02:00
NOTES-Windows.txt Fix markdown nits in NOTES-Windows.txt 2020-09-10 08:57:55 +10:00
README-Engine.md Fix many MarkDown issues in {NOTES*,README*,HACKING,LICENSE}.md files 2020-07-05 11:29:43 +02:00
README-FIPS.md Fix many MarkDown issues in {NOTES*,README*,HACKING,LICENSE}.md files 2020-07-05 11:29:43 +02:00
README.md fix typo in README 2020-11-03 17:58:12 +01:00
SUPPORT.md Change markdown link style in README, INSTALL, SUPPORT and CONTRIBUTING 2020-10-18 13:28:08 +02:00
VERSION.dat Prepare for 3.0 alpha 9 2020-11-05 14:04:11 +00:00

Welcome to the OpenSSL Project

openssl logo

travis badge appveyor badge

OpenSSL is a robust, commercial-grade, full-featured Open Source Toolkit for the Transport Layer Security (TLS) protocol formerly known as the Secure Sockets Layer (SSL) protocol. The protocol implementation is based on a full-strength general purpose cryptographic library, which can also be used stand-alone.

OpenSSL is descended from the SSLeay library developed by Eric A. Young and Tim J. Hudson.

The official Home Page of the OpenSSL Project is www.openssl.org.

Table of Contents

Overview

The OpenSSL toolkit includes:

  • libssl an implementation of all TLS protocol versions up to TLSv1.3 (RFC 8446).

  • libcrypto a full-strength general purpose cryptographic library. It constitutes the basis of the TLS implementation, but can also be used independently.

  • openssl the OpenSSL command line tool, a swiss army knife for cryptographic tasks, testing and analyzing. It can be used for

    • creation of key parameters
    • creation of X.509 certificates, CSRs and CRLs
    • calculation of message digests
    • encryption and decryption
    • SSL/TLS client and server tests
    • handling of S/MIME signed or encrypted mail
    • and more...

Download

For Production Use

Source code tarballs of the official releases can be downloaded from www.openssl.org/source. The OpenSSL project does not distribute the toolkit in binary form.

However, for a large variety of operating systems precompiled versions of the OpenSSL toolkit are available. In particular on Linux and other Unix operating systems it is normally recommended to link against the precompiled shared libraries provided by the distributor or vendor.

For Testing and Development

Although testing and development could in theory also be done using the source tarballs, having a local copy of the git repository with the entire project history gives you much more insight into the code base.

The official OpenSSL Git Repository is located at git.openssl.org. There is a GitHub mirror of the repository at github.com/openssl/openssl, which is updated automatically from the former on every commit.

A local copy of the Git Repository can be obtained by cloning it from the original OpenSSL repository using

git clone git://git.openssl.org/openssl.git

or from the GitHub mirror using

git clone https://github.com/openssl/openssl.git

If you intend to contribute to OpenSSL, either to fix bugs or contribute new features, you need to fork the OpenSSL repository openssl/openssl on GitHub and clone your public fork instead.

git clone https://github.com/yourname/openssl.git

This is necessary, because all development of OpenSSL nowadays is done via GitHub pull requests. For more details, see Contributing.

Build and Install

After obtaining the Source, have a look at the INSTALL file for detailed instructions about building and installing OpenSSL. For some platforms, the installation instructions are amended by a platform specific document.

Specific notes on upgrading to OpenSSL 3.0 from previous versions, as well as known issues are available on the OpenSSL 3.0 Wiki page.

Documentation

Manual Pages

The manual pages for the master branch and all current stable releases are available online.

Wiki

There is a Wiki at wiki.openssl.org which is currently not very active. It contains a lot of useful information, not all of which is up to date.

License

OpenSSL is licensed under the Apache License 2.0, which means that you are free to get and use it for commercial and non-commercial purposes as long as you fulfill its conditions.

See the LICENSE.txt file for more details.

Support

There are various ways to get in touch. The correct channel depends on your requirement. see the SUPPORT file for more details.

Contributing

If you are interested and willing to contribute to the OpenSSL project, please take a look at the CONTRIBUTING file.

Legalities

A number of nations restrict the use or export of cryptography. If you are potentially subject to such restrictions you should seek legal advice before attempting to develop or distribute cryptographic code.

Copyright

Copyright (c) 1998-2020 The OpenSSL Project

Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson

All rights reserved.