aboutsummaryrefslogtreecommitdiff
path: root/crypto/evp/e_aes.c
AgeCommit message (Collapse)AuthorFilesLines
2019-03-07FIPS AES_GCM IV gen changesShane Lontis1-2/+45
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/8393)
2019-02-05Remove unnecessary trailing whitespaceSam Roberts1-1/+1
Trim trailing whitespace. It doesn't match OpenSSL coding standards, AFAICT, and it can cause problems with git tooling. Trailing whitespace remains in test data and external source. Reviewed-by: Kurt Roeckx <kurt@roeckx.be> Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/8092)
2019-01-08Fix compilation on sparcMatt Caswell1-0/+5
Fixes #7966 Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/7997)
2019-01-05crypto/evp/e_aes.c: build again on s390xRichard Levitte1-2/+14
The stuff needed to build with SIV wasn't in place for s390x Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/7988)
2018-12-12Add RFC5297 AES-SIV supportTodd Short1-5/+122
Based originally on github.com/dfoxfranke/libaes_siv This creates an SIV128 mode that uses EVP interfaces for the CBC, CTR and CMAC code to reduce complexity at the cost of perfomance. The expected use is for short inputs, not TLS-sized records. Add multiple AAD input capacity in the EVP tests. Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> (Merged from https://github.com/openssl/openssl/pull/3540)
2018-12-07evp/e_aes: Expose IVBoris Pismenny1-0/+8
This commit exposes the cipher's IV to applications. Signed-off-by: Boris Pismenny <borisp@mellanox.com> Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Paul Yang <yang.yang@baishancloud.com> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5253)
2018-12-06Following the license change, modify the boilerplates in crypto/evp/Richard Levitte1-1/+1
[skip ci] Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/7794)
2018-09-21typo-fixes: miscellaneous typo fixesagnosticdev1-1/+1
Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/7277)
2018-09-12Limit the number of AES-GCM keys allowed in TLS. A new error is raised if thisPauli1-0/+27
limit is ever reached. This is a FIPS 140-2 requirement from IG A.5 "Key/IV Pair Uniqueness Requirements from SP 800-38D". Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/7129)
2018-09-12FIPS 140-2 IG A.9 XTS key check.Pauli1-2/+22
Add a check that the two keys used for AES-XTS are different. One test case uses the same key for both of the AES-XTS keys. This causes a failure under FIP 140-2 IG A.9. Mark the test as returning a failure. Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/7120)
2018-07-12Fix undefined behavior in s390x aes-gcm/ccmPatrick Steuer1-19/+21
Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Andy Polyakov <appro@openssl.org>
2018-06-03evp/e_aes.c: replace calls to one-liners with references in GCM.Andy Polyakov1-43/+30
Even though calls can be viewed as styling improvement, they do come with cost. It's not big cost and shows only on short inputs, but it is measurable, 2-3% on some platforms. Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6312)
2018-04-03Set error code on alloc failuresRich Salz1-8/+12
Almost all *alloc failures now set an error code. Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/5842)
2018-03-28crypto/e_aes.c: use S390X_AES_FC macroPatrick Steuer1-4/+2
... to compute s390x aes function code from keylength. Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com> Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5250)
2018-03-28crypto/evp/e_aes.c: add size_t casts to increase readabilityPatrick Steuer1-4/+4
Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com> Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5250)
2018-03-28s390x assembly pack: add KMF code path for aes-cfb/cfb8Patrick Steuer1-13/+121
Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com> Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5250)
2018-03-28s390x assembly pack: add KMO code path for aes-ofbPatrick Steuer1-7/+79
Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com> Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5250)
2018-03-28s390x assembly pack: add KM code path for aes-ecbPatrick Steuer1-20/+72
Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com> Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5250)
2018-03-19Don't use a ssl specific DRBG anymoreKurt Roeckx1-17/+5
Since the public and private DRBG are per thread we don't need one per ssl object anymore. It could also try to get entropy from a DRBG that's really from an other thread because the SSL object moved to an other thread. Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/5547)
2018-03-15Publish the RAND_DRBG APIDr. Matthias St. Pierre1-1/+1
Fixes #4403 This commit moves the internal header file "internal/rand.h" to <openssl/rand_drbg.h>, making the RAND_DRBG API public. The RAND_POOL API remains private, its function prototypes were moved to "internal/rand_int.h" and converted to lowercase. Documentation for the new API is work in progress on GitHub #5461. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5462)
2018-02-28Tell the ciphers which DRBG to use for generating random bytes.Kurt Roeckx1-5/+17
Reviewed-by: Richard Levitte <levitte@openssl.org> GH: #4672
2018-02-23Fix some bugs with the cfb1 bitsize handlingBernd Edlinger1-0/+2
Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5426)
2018-02-06crypto/evp/e_aes.c: add comments to s390x aes gcm implementationPatrick Steuer1-2/+32
Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com> Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5230)
2018-02-06s390x assembly pack: add KMAC code path for aes-ccmPatrick Steuer1-10/+526
Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com> Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5230)
2018-01-09Update copyright years on all files merged since Jan 1st 2018Richard Levitte1-1/+1
Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5038)
2018-01-07s390x assembly pack: add KMA code path for aes-gcm.Patrick Steuer1-0/+735
Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com> Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4634)
2017-05-11Fix gcc-7 warnings.Bernd Edlinger1-0/+1
- Mostly missing fall thru comments - And uninitialized value used in sslapitest.c Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3440)
2017-02-08Make EVP_*Final work for CCM ciphersDr. Stephen Henson1-3/+4
Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2550)
2017-02-07Fix a crash in EVP_CIPHER_CTX_cleanup due to cipher_data may be NULLBernd Edlinger1-0/+2
or EVP_CTRL_INIT/EVP_CTRL_COPY was not called or failed. If that happens in EVP_CipherInit_ex/EVP_CIPHER_CTX_copy set cipher = NULL, aes_gcm_cleanup should check that gctx != NULL before calling OPENSSL_cleanse. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2562)
2017-01-26crypto/evp: harden AEAD ciphers.Andy Polyakov1-2/+12
Originally a crash in 32-bit build was reported CHACHA20-POLY1305 cipher. The crash is triggered by truncated packet and is result of excessive hashing to the edge of accessible memory. Since hash operation is read-only it is not considered to be exploitable beyond a DoS condition. Other ciphers were hardened. Thanks to Robert Święcki for report. CVE-2017-3731 Reviewed-by: Rich Salz <rsalz@openssl.org>
2017-01-25Fix the overlapping check for fragmented "Update" operationsMatt Caswell1-0/+10
When doing in place encryption the overlapping buffer check can fail incorrectly where we have done a partial block "Update" operation. This fixes things to take account of any pending partial blocks. Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2275)
2017-01-25Properly handle a partial block in OCB modeMatt Caswell1-0/+2
If we have previously been passed a partial block in an "Update" call then make sure we properly increment the output buffer when we use it. Fixes #2273 Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2275)
2017-01-25Don't use magic numbers in aes_ocb_cipher()Matt Caswell1-11/+13
Lots of references to 16 replaced by AES_BLOCK_SIZE. Also a few other style tweaks in that function Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2275)
2016-10-18Fix strict-warnings buildPatrick Steuer1-2/+2
crypto/evp/e_aes.c: Types of inp and out parameters of AES_xts_en/decrypt functions need to be changed from char to unsigned char to avoid build error due to '-Werror=incompatible-pointer-types'. crypto/aes/asm/aes-s390x.pl: Comments need to reflect the above change. Signed-off-by: Patrick Steuer <psteuer@mail.de> Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> CLA: trivial
2016-07-16evp/e_aes.c: wire new CBC and CTR subroutines from aesfx-sparcv9.Andy Polyakov1-2/+4
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-06-14evp/e_aes.c: wire hardware-assisted XTS subroutines.Andy Polyakov1-0/+14
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-05-24Fix braces in e_aes.c: aes_init_keyTodd Short1-1/+2
This compiles correctly, but depending on what may be defined, it's possible that this could fail compilation. The braces are mismatched, and it's possible to end up with an else followed by another else. This presumes the indentation is mostly correct and indicative of intent. Found via static analysis. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1118)
2016-05-17Copyright consolidation 05/10Rich Salz1-47/+6
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-05-02Remove obsolete defined(__INTEL__) condition.Andy Polyakov1-2/+1
This macro was defined by no-longer-supported __MWERKS__ compiler. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-20evp/aes_aes.c: engage Fujitsu SPARC64 X AES support.Andy Polyakov1-1/+10
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-13Remove OPENSSL_NO_AES guardsMatt Caswell1-184/+182
no-aes is no longer a Configure option and therefore the OPENSSL_NO_AES guards can be removed. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-03-20Remove #error from include files.Rich Salz1-1/+1
Don't have #error statements in header files, but instead wrap the contents of that file in #ifndef OPENSSL_NO_xxx This means it is now always safe to include the header file. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-03-18Mark OCB as an AEAD cipherMatt Caswell1-3/+6
OCB is AEAD capable but was not marked as such with the EVP_CIPH_FLAG_AEAD_CIPHER flag. Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-02-05GH601: Various spelling fixes.FdaSilvaYY1-1/+1
Signed-off-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
2016-01-12Adapt builtin cipher implementations to opaque EVP_CIPHERRichard Levitte1-191/+287
They all stop including evp_locl.h, so we also take care of their adaptation to opaque EVP_CIPHER_CTX, as was promised in an earlier commit. Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-12-10evp/e_aes.c: wire hardware-assisted block function to OCB.Andy Polyakov1-1/+39
Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-12-10x86[_64] assembly pack: add optimized AES-NI OCB subroutines.Andy Polyakov1-3/+20
Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-11-09Continue standardising malloc style for libcryptoMatt Caswell1-2/+2
Continuing from previous commit ensure our style is consistent for malloc return checks. Reviewed-by: Kurt Roeckx <kurt@openssl.org>
2015-08-14CCM support.Dr. Stephen Henson1-4/+88
Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-07-06Relax CCM tag check.Dr. Stephen Henson1-1/+1
In CCM mode don't require a tag before initialising decrypt: this allows the tag length to be set without requiring the tag. Reviewed-by: Rich Salz <rsalz@openssl.org>