aboutsummaryrefslogtreecommitdiff
path: root/crypto/modes
AgeCommit message (Collapse)AuthorFilesLines
2016-02-13Pass $(CC) to perlasm scripts via the environmentRichard Levitte1-10/+10
It seems that on some platforms, the perlasm scripts call the C compiler for certain checks. These scripts need the environment variable CC to have the C compiler command. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-02-12modes/ctr128.c: pay attention to ecount_buf alignment in CRYPTO_ctr128_encrypt.Andy Polyakov1-24/+17
It's never problem if CRYPTO_ctr128_encrypt is called from EVP, because buffer in question is always aligned within EVP_CIPHER_CTX structure. RT#4218 Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-02-10unified build scheme: add a "unified" template for Unix MakefileRichard Levitte1-0/+27
This also adds all the raw sections needed for some files. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-02-05GH601: Various spelling fixes.FdaSilvaYY2-3/+3
Signed-off-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
2016-02-04Restore xmm7 from the correct address on win64Kurt Roeckx1-1/+1
Reviewed-by: Richard Levitte <levitte@openssl.org> RT: #4288, MR: #1831
2016-02-01unified build scheme: add build.info filesRichard Levitte1-0/+5
Now that we have the foundation for the "unified" build scheme in place, we add build.info files. They have been generated from the Makefiles in the same directories. Things that are platform specific will appear in later commits. Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-01-29Templatize util/domdRich Salz1-2/+1
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-01-26Remove /* foo.c */ commentsRich Salz1-1/+0
This was done by the following find . -name '*.[ch]' | /tmp/pl where /tmp/pl is the following three-line script: print unless $. == 1 && m@/\* .*\.[ch] \*/@; close ARGV if eof; # Close file to reset $. And then some hand-editing of other files. Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
2016-01-20Remove update tagsRich Salz1-2/+0
Also remove depend/local_depend. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-01-17Remove some old makefile targetsRich Salz1-12/+0
Remove lint, tags, dclean, tests. This is prep for a new makedepend scheme. This is temporary pending unified makefile, and might help it. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-01-12Move Makefiles to Makefile.inRich Salz2-148/+94
Create Makefile's from Makefile.in Rename Makefile.org to Makefile.in Rename Makefiles to Makefile.in Address review feedback from Viktor and Richard Reviewed-by: Viktor Dukhovni <viktor@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-12-13x86_64 assembly pack: tune clang version detection even further.Andy Polyakov2-2/+2
RT#4171 Reviewed-by: Kurt Roeckx <kurt@openssl.org>
2015-12-10x86[_64] assembly pack: add optimized AES-NI OCB subroutines.Andy Polyakov2-76/+98
Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-12-10modes/ocb128.c: fix overstep.Andy Polyakov1-1/+1
Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-12-07ARMv4 assembly pack: allow Thumb2 even in iOS build,Andy Polyakov1-1/+1
and engage it in most modules. Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-12-02modes/ocb128.c: fix sanitizer warning.Andy Polyakov1-7/+7
Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-12-02modes/ocb128.c: split fixed block xors to aligned and misaligned.Andy Polyakov2-57/+26
Main goal was to improve performance on RISC platforms, e.g. 10% was measured on MIPS, POWER8... Reviewed-by: Matt Caswell <matt@openssl.org>
2015-12-02modes/ocb128.c: ocb_lookup_l to allow non-contiguous lookupAndy Polyakov1-8/+29
and CRYPTO_ocb128_encrypt to handle in==out. Reviewed-by: Matt Caswell <matt@openssl.org>
2015-11-23x86_64 assembly pack: tune clang version detection.Andy Polyakov2-2/+2
RT#4142 Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-11-11modes/asm/ghash-armv4.pl: extend Apple fix to all clang cases.Andy Polyakov1-1/+1
Triggered by RT#3989. Reviewed-by: Matt Caswell <matt@openssl.org>
2015-11-09Continue standardising malloc style for libcryptoMatt Caswell2-4/+4
Continuing from previous commit ensure our style is consistent for malloc return checks. Reviewed-by: Kurt Roeckx <kurt@openssl.org>
2015-09-26Skylake performance results.Andy Polyakov2-6/+8
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-09-25ARMv4 assembly pack: implement support for Thumb2.Andy Polyakov1-5/+40
As some of ARM processors, more specifically Cortex-Mx series, are Thumb2-only, we need to support Thumb2-only builds even in assembly. Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-07-14Conversion to UTF-8 where neededRichard Levitte7-37/+37
This leaves behind files with names ending with '.iso-8859-1'. These should be safe to remove. If something went wrong when re-encoding, there will be some files with names ending with '.utf8' left behind. Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-06-10gcm.c: address linker warning about OPENSSL_ia32cap_P size mismatch.Andy Polyakov1-1/+1
Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-06-08Use CRYPTO_memcmp when comparing authenticatorsEmilia Kasper1-1/+1
Pointed out by Victor Vasiliev (vasilvv@mit.edu) via Adam Langley (Google). Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-05-22Fix the update target and remove duplicate file updatesRichard Levitte1-0/+2
We had updates of certain header files in both Makefile.org and the Makefile in the directory the header file lived in. This is error prone and also sometimes generates slightly different results (usually just a comment that differs) depending on which way the update was done. This removes the file update targets from the top level Makefile, adds an update: target in all Makefiles and has it depend on the depend: or local_depend: targets, whichever is appropriate, so we don't get a double run through the whole file tree. Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-05-14make dependRichard Levitte1-1/+1
Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-05-14Identify and move common internal libcrypto header filesRichard Levitte1-1/+1
There are header files in crypto/ that are used by a number of crypto/ submodules. Move those to crypto/include/internal and adapt the affected source code and Makefiles. The header files that got moved are: crypto/cryptolib.h crypto/md32_common.h Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-05-05memset, memcpy, sizeof consistency fixesRich Salz1-8/+6
Just as with the OPENSSL_malloc calls, consistently use sizeof(*ptr) for memset and memcpy. Remove needless casts for those functions. For memset, replace alternative forms of zero with 0. Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-05-04Use safer sizeof variant in mallocRich Salz2-2/+2
For a local variable: TYPE *p; Allocations like this are "risky": p = OPENSSL_malloc(sizeof(TYPE)); if the type of p changes, and the malloc call isn't updated, you could get memory corruption. Instead do this: p = OPENSSL_malloc(sizeof(*p)); Also fixed a few memset() calls that I noticed while doing this. Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-04-30free cleanup almost the finaleRich Salz2-8/+2
Add OPENSSL_clear_free which merges cleanse and free. (Names was picked to be similar to BN_clear_free, etc.) Removed OPENSSL_freeFunc macro. Fixed the small simple ones that are left: CRYPTO_free CRYPTO_free_locked OPENSSL_free_locked Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-04-28remove malloc castsRich Salz2-2/+2
Following ANSI C rules, remove the casts from calls to OPENSSL_malloc and OPENSSL_realloc. Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-04-21modes/asm/ghashv8-armx.pl: additional performance data.Andy Polyakov1-0/+1
Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-04-20Add assembly support for 32-bit iOS.Andy Polyakov1-10/+27
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-04-04Appease clang -WshadowRichard Levitte1-19/+19
The macros BSWAP4 and BSWAP8 have statetemnt expressions implementations that use local variable names that shadow variables outside the macro call, generating warnings like this e_aes_cbc_hmac_sha1.c:263:14: warning: declaration shadows a local variable [-Wshadow] seqnum = BSWAP8(blocks[0].q[0]); ^ ../modes/modes_lcl.h:41:29: note: expanded from macro 'BSWAP8' ^ e_aes_cbc_hmac_sha1.c:223:12: note: previous declaration is here size_t ret = 0; ^ Have clang be quiet by modifying the macro variable names slightly (suffixing them with an underscore). Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-04-02modes/asm/ghashv8-armx.pl: up to 90% performance improvement.Andy Polyakov1-54/+222
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-03-31Remove EXHEADER, TEST, APPS, links:, install: and uninstall: where relevantRichard Levitte1-18/+1
With no more symlinks, there's no need for those variables, or the links target. This also goes for all install: and uninstall: targets that do nothing but copy $(EXHEADER) files, since that's now taken care of by the top Makefile. Also, removed METHTEST from test/Makefile. It looks like an old test that's forgotten... Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-03-31Stop symlinking, move files to intended directoryRichard Levitte1-192/+0
Rather than making include/openssl/foo.h a symlink to crypto/foo/foo.h, this change moves the file to include/openssl/foo.h once and for all. Likewise, move crypto/foo/footest.c to test/footest.c, instead of symlinking it there. Originally-by: Geoff Thorpe <geoff@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-03-20CRYPTO_128_unwrap(): Fix refactoring damageRichard Godbee1-5/+5
crypto/modes/wrap128.c was heavily refactored to support AES Key Wrap with Padding, and four bugs were introduced into CRYPTO_128_unwrap() at that time: - crypto_128_unwrap_raw()'s return value ('ret') is checked incorrectly, and the function immediately returns 'ret' in (almost) all cases. This makes the IV checking code later in the function unreachable, but callers think the IV check succeeded since CRYPTO_128_unwrap()'s return value is non-zero. FIX: Return 0 (error) if crypto_128_unwrap_raw() returned 0 (error). - crypto_128_unwrap_raw() writes the IV to the 'got_iv' buffer, not to the first 8 bytes of the output buffer ('out') as the IV checking code expects. This makes the IV check fail. FIX: Compare 'iv' to 'got_iv', not 'out'. - The data written to the output buffer ('out') is "cleansed" if the IV check fails, but the code passes OPENSSL_cleanse() the input buffer length ('inlen') instead of the number of bytes that crypto_128_unwrap_raw() wrote to the output buffer ('ret'). This means that OPENSSL_cleanse() could potentially write past the end of 'out'. FIX: Change 'inlen' to 'ret' in the OPENSSL_cleanse() call. - CRYPTO_128_unwrap() is returning the length of the input buffer ('inlen') instead of the number of bytes written to the output buffer ('ret'). This could cause the caller to read past the end of 'out'. FIX: Return 'ret' instead of 'inlen' at the end of the function. PR#3749 Reviewed-by: Stephen Henson <steve@openssl.org> Reviewed-by: Emilia Käsper <emilia@openssl.org>
2015-03-20wrap128.c: Fix Doxygen commentsRichard Godbee1-19/+20
Reviewed-by: Stephen Henson <steve@openssl.org> Reviewed-by: Emilia Käsper <emilia@openssl.org>
2015-03-17Fix unintended sign extensionMatt Caswell1-1/+4
The function CRYPTO_128_unwrap_pad uses an 8 byte AIV (Alternative Initial Value). The least significant 4 bytes of this is placed into the local variable |ptext_len|. This is done as follows: ptext_len = (aiv[4] << 24) | (aiv[5] << 16) | (aiv[6] << 8) | aiv[7]; aiv[4] is an unsigned char, but (aiv[4] << 24) is promoted to a *signed* int - therefore we could end up shifting into the sign bit and end up with a negative value. |ptext_len| is a size_t (typically 64-bits). If the result of the shifts is negative then the upper bits of |ptext_len| will all be 1. This commit fixes the issue by explicitly casting to an unsigned int. Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-03-13Fix key wrapping mode with padding to conform to RFC 5649.Petr Spacek1-2/+7
According to RFC 5649 section 4.1 step 1) we should not add padding if plaintext length is multiply of 8 ockets. This matches pseudo-code in http://dx.doi.org/10.6028/NIST.SP.800-38F on page 15, section 6.3 KWP, algorithm 5 KWP-AE, step 2. PR#3675 Reviewed-by: Stephen Henson <steve@openssl.org> Reviewed-by: Andy Polyakov <appro@openssl.org>
2015-03-08ARMv4 assembly pack: add Cortex-A15 performance data.Andy Polyakov1-2/+2
Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-02-03Dead code: crypto/dh,modes,pkcs12,ripemd,rsa,srpRich Salz1-3/+0
And an uncompiled C++ test file. Also remove srp_lcl.h, with help from Richard. Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-01-30modes/gcm128.c: harmonize ctx->ghash assignment, shortcut *_ctr32Andy Polyakov1-106/+92
in OPENSSL_SMALL_FOOTPRINT build, remove undesired reformat artefact and inconsistency in pre-processor logic. Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-01-30modes/gcm128.c: fix OPENSSL_SMALL_FOOTPRINT compile failureAndy Polyakov1-0/+8
on affected platforms (PowerPC and AArch64). For reference, minimalistic #ifdef GHASH is sufficient, because it's never defined with OPENSSL_SMALL_FOOTPRINT and ctx->ghash is never referred. Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-01-28Fix warning on some compilers where variable index shadows a globalMatt Caswell1-5/+5
declaration Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-01-23Add assembly support to ios64-cross.Andy Polyakov1-1/+9
Fix typos in ios64-cross config line. Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-01-22Run util/openssl-format-source -v -c .Matt Caswell12-3506/+3812
Reviewed-by: Tim Hudson <tjh@openssl.org>