Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/boringssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2016-07-12Revert "Move C++ helpers into |bssl| namespace."Adam Langley
This reverts commit 09feb0f3d95a2bc58ce0faaf14256d3bd30f52a4. (In order to make WebRTC happy this also needs to be reverted.)
2016-07-12Revert scoped_types.h change.Adam Langley
This reverts commits: 8d79ed67407e433d80ebc8d3aa080e8ce16e6eb7 19fdcb523402ed13ab798cf811fb0119e3e7b104 8d79ed67407e433d80ebc8d3aa080e8ce16e6eb7 Because WebRTC (at least) includes our headers in an extern "C" block, which precludes having any C++ in them. Change-Id: Ia849f43795a40034cbd45b22ea680b51aab28b2d
2016-07-12Remove scoped_types.h.Adam Langley
This change scatters the contents of the two scoped_types.h files into the headers for each of the areas of the code. The types are now in the |bssl| namespace. Change-Id: I802b8de68fba4786b6a0ac1bacd11d81d5842423 Reviewed-on: https://boringssl-review.googlesource.com/8731 Reviewed-by: Adam Langley <agl@google.com>
2016-07-12Move C++ helpers into |bssl| namespace.Adam Langley
We currently have the situation where the |tool| and |bssl_shim| code includes scoped_types.h from crypto/test and ssl/test. That's weird and shouldn't happen. Also, our C++ consumers might quite like to have access to the scoped types. Thus this change moves some of the template code to base.h and puts it all in a |bssl| namespace to prepare for scattering these types into their respective headers. In order that all the existing test code be able to access these types, it's all moved into the same namespace. Change-Id: I3207e29474dc5fcc344ace43119df26dae04eabb Reviewed-on: https://boringssl-review.googlesource.com/8730 Reviewed-by: David Benjamin <davidben@google.com>
2016-06-10Wrap MSVC-only warning pragmas in a macro.David Benjamin
There's a __pragma expression which allows this. Android builds us Windows with MinGW for some reason, so we actually do have to tolerate non-MSVC-compatible Windows compilers. (Clang for Windows is much more sensible than MinGW and intentionally mimicks MSVC.) MinGW doesn't understand MSVC's pragmas and warns a lot. #pragma warning is safe to suppress, so wrap those to shush them. This also lets us do away with a few ifdefs. Change-Id: I1f5a8bec4940d4b2d947c4c1cc9341bc15ec4972 Reviewed-on: https://boringssl-review.googlesource.com/8236 Reviewed-by: Adam Langley <agl@google.com>
2016-06-09Require in == out for in-place encryption.David Benjamin
While most of OpenSSL's assembly allows out < in too, some of it doesn't. Upstream seems to not consider this a problem (or, at least, they're failing to make a decision on whether it is a problem, so we should assume they'll stay their course). Accordingly, require aliased buffers to exactly align so we don't have to keep chasing this down. Change-Id: I00eb3df3e195b249116c68f7272442918d7077eb Reviewed-on: https://boringssl-review.googlesource.com/8231 Reviewed-by: Adam Langley <agl@google.com>
2016-06-06Be consistent about 𝑥_tests.txtAdam Langley
Some files were named 𝑥_test.txt and some 𝑥_tests.txt. This change unifies around the latter. Change-Id: Id6f29bad8b998f3c3466655097ef593f7f18f82f Reviewed-on: https://boringssl-review.googlesource.com/8150 Reviewed-by: David Benjamin <davidben@google.com>
2016-05-04Add a comment with an SMT verification of the Barrett reductions.Adam Langley
Change-Id: I32dc13b16733fc09e53e3891ca68f51df6c1624c Reviewed-on: https://boringssl-review.googlesource.com/7850 Reviewed-by: David Benjamin <davidben@google.com>
2016-05-03Fix encrypt overflowDavid Benjamin
An overflow can occur in the EVP_EncryptUpdate function. If an attacker is able to supply very large amounts of input data after a previous call to EVP_EncryptUpdate with a partial block then a length check can overflow resulting in a heap corruption. Following an analysis of all OpenSSL internal usage of the EVP_EncryptUpdate function all usage is one of two forms. The first form is like this: EVP_EncryptInit() EVP_EncryptUpdate() i.e. where the EVP_EncryptUpdate() call is known to be the first called function after an EVP_EncryptInit(), and therefore that specific call must be safe. The second form is where the length passed to EVP_EncryptUpdate() can be seen from the code to be some small value and therefore there is no possibility of an overflow. [BoringSSL: We also have code that calls EVP_CIPHER functions by way of the TLS/SSL3 "AEADs". However, there we know the inputs are bounded by 2^16.] Since all instances are one of these two forms, I believe that there can be no overflows in internal code due to this problem. It should be noted that EVP_DecryptUpdate() can call EVP_EncryptUpdate() in certain code paths. Also EVP_CipherUpdate() is a synonym for EVP_EncryptUpdate(). Therefore I have checked all instances of these calls too, and came to the same conclusion, i.e. there are no instances in internal usage where an overflow could occur. This could still represent a security issue for end user code that calls this function directly. CVE-2016-2106 Issue reported by Guido Vranken. (Imported from upstream's 3ab937bc440371fbbe74318ce494ba95021f850a.) Change-Id: Iabde896555c39899c7f0f6baf7a163a7b3c2f3d6 Reviewed-on: https://boringssl-review.googlesource.com/7845 Reviewed-by: Adam Langley <agl@google.com>
2016-04-19Switch all 'num' parameters in crypto/modes to unsigned.David Benjamin
Also switch the EVP_CIPHER copy to cut down on how frequently we need to cast back and forth. BUG=22 Change-Id: I9af1e586ca27793a4ee6193bbb348cf2b28a126e Reviewed-on: https://boringssl-review.googlesource.com/7689 Reviewed-by: Steven Valdez <svaldez@google.com> Reviewed-by: David Benjamin <davidben@google.com>
2016-04-11Remove EVP_aead_chacha20_poly1305_rfc7539 alias.David Benjamin
This slipped through, but all the callers are now using EVP_aead_chacha20_poly1305, so we can remove this version. Change-Id: I76eb3a4481aae4d18487ca96ebe3776e60d6abe8 Reviewed-on: https://boringssl-review.googlesource.com/7650 Reviewed-by: Steven Valdez <svaldez@google.com> Reviewed-by: David Benjamin <davidben@google.com>
2016-03-31Remove some easy obj.h dependencies.David Benjamin
A lot of consumers of obj.h only want the NID values. Others didn't need it at all. This also removes some OBJ_nid2sn and OBJ_nid2ln calls in EVP error paths which isn't worth pulling a large table in for. BUG=chromium:499653 Change-Id: Id6dff578f993012e35b740a13b8e4f9c2edc0744 Reviewed-on: https://boringssl-review.googlesource.com/7563 Reviewed-by: David Benjamin <davidben@google.com>
2016-03-26Fix build when using Visual Studio 2015 Update 1.Brian Smith
Many of the compatibility issues are described at https://msdn.microsoft.com/en-us/library/mt612856.aspx. The macros that suppressed warnings on a per-function basis no longer work in Update 1, so replace them with #pragmas. Update 1 warns when |size_t| arguments to |printf| are casted, so stop doing that casting. Unfortunately, this requires an ugly hack to continue working in MSVC 2013 as MSVC 2013 doesn't support "%zu". Finally, Update 1 has new warnings, some of which need to be suppressed. --- Updated by davidben to give up on suppressing warnings in crypto/x509 and crypto/x509v3 as those directories aren't changed much from upstream. In each of these cases, upstream opted just blindly initialize the variable, so do the same. Also switch C4265 to level 4, per Microsoft's recommendation and work around a bug in limits.h that happens to get fixed by Google include order style. (limits.h is sensitive to whether corecrt.h, pulled in by stddef.h and some other headers, is included before it. The reason it affected just one file is we often put the file's header first, which means base.h is pulling in stddef.h. Relying on this is ugly, but it's no worse than what everything else is doing and this doesn't seem worth making something as tame as limits.h so messy to use.) Change-Id: I02d1f935356899f424d3525d03eca401bfa3e6cd Reviewed-on: https://boringssl-review.googlesource.com/7480 Reviewed-by: David Benjamin <davidben@google.com>
2016-03-20Add missing internal includes.Piotr Sikora
Partially fixes build with -Wmissing-prototypes -Wmissing-declarations. Change-Id: I51209c30f532899f57cfdd9a50cff0a8ee3da5b5 Signed-off-by: Piotr Sikora <piotrsikora@google.com> Reviewed-on: https://boringssl-review.googlesource.com/7512 Reviewed-by: David Benjamin <davidben@google.com>
2016-03-19Use UINT64_C instead of unsigned long long integer constant.Piotr Sikora
Change-Id: I44aa9be26ad9aea6771cb46a886a721b4bc28fde Signed-off-by: Piotr Sikora <piotrsikora@google.com> Reviewed-on: https://boringssl-review.googlesource.com/7510 Reviewed-by: David Benjamin <davidben@google.com>
2016-03-01Test AEAD interface with aliased buffers.Adam Langley
Cases where the input and output buffers overlap are always a little odd. This change adds a test to ensures that the (generic) AEADs function in these situations. Change-Id: I6f1987a5e10ddef6b2b8f037a6d50737a120bc99 Reviewed-on: https://boringssl-review.googlesource.com/7195 Reviewed-by: David Benjamin <davidben@google.com>
2016-02-24Test different chunk sizes in cipher_test.Adam Langley
This change causes cipher_test to test the EVP cipher interfaces with various chunk sizes and adds a couple of large tests of GCM. This is sufficient to uncover the issue that would have been caused by a3d9528e, had the AVX code been enabled. Change-Id: I58d4924c0bcd11a0999c24a0fb77fc5eee71130f Reviewed-on: https://boringssl-review.googlesource.com/7192 Reviewed-by: David Benjamin <davidben@google.com>
2016-02-24Unify AEAD and EVP code paths for AES-GCM.Brian Smith
This change makes the AEAD and EVP code paths use the same code for AES-GCM. When AVX instructions are enabled in the assembly this will allow them to use the stitched AES-GCM implementation. Note that the stitched implementations are no-ops for small inputs (smaller than 288 bytes for encryption; smaller than 96 bytes for decryption). This means that only a handful of test cases with longish inputs actually test the stitched code. Change-Id: Iece8003d90448dcac9e0bde1f42ff102ebe1a1c9 Reviewed-on: https://boringssl-review.googlesource.com/7173 Reviewed-by: Adam Langley <agl@google.com>
2016-02-12Clarify some confusing casts involving |size_t|.Brian Smith
Change-Id: I7af2c87fe6e7513aa2603d5e845a4db87ab14fcc Reviewed-on: https://boringssl-review.googlesource.com/7101 Reviewed-by: David Benjamin <davidben@google.com>
2016-01-28Use Barrett reduction in CBC processing rather than tricks.Adam Langley
Division isn't constant-time on Intel chips so the code was adding a large multiple of md_size to try and force the operation to always take the maximum amount of time. I'm less convinced, these days, that compilers aren't going to get smart enough to optimise that away so use Barrett reduction instead. Change-Id: Ib8c514192682a2fcb4b1fb7e7c6dd1301d9888d0 Reviewed-on: https://boringssl-review.googlesource.com/6906 Reviewed-by: David Benjamin <davidben@chromium.org> Reviewed-by: Adam Langley <alangley@gmail.com>
2016-01-26Use |alignas| for alignment.Brian Smith
MSVC doesn't have stdalign.h and so doesn't support |alignas| in C code. Define |alignas(x)| as a synonym for |__decltype(align(x))| instead for it. This also fixes -Wcast-qual warnings in rsaz_exp.c. Change-Id: Ifce9031724cb93f5a4aa1f567e7af61b272df9d5 Reviewed-on: https://boringssl-review.googlesource.com/6924 Reviewed-by: Adam Langley <agl@google.com> Reviewed-by: David Benjamin <davidben@google.com>
2015-12-17Remove the stitched RC4-MD5 code and use the generic one.David Benjamin
This removes 16k from a release-mode build of the bssl tool. Now that we've finished the AEAD refactor, there's no use in keeping this around as a prototype for "stateful AEADs". Before: Did 2264000 RC4-MD5 (16 bytes) seal operations in 1000430us (2263026.9 ops/sec): 36.2 MB/s Did 266000 RC4-MD5 (1350 bytes) seal operations in 1000984us (265738.5 ops/sec): 358.7 MB/s Did 50000 RC4-MD5 (8192 bytes) seal operations in 1014209us (49299.5 ops/sec): 403.9 MB/s After: Did 1895000 RC4-MD5 (16 bytes) seal operations in 1000239us (1894547.2 ops/sec): 30.3 MB/s Did 199000 RC4-MD5 (1350 bytes) seal operations in 1001361us (198729.5 ops/sec): 268.3 MB/s Did 39000 RC4-MD5 (8192 bytes) seal operations in 1014832us (38430.0 ops/sec): 314.8 MB/s There is a non-trivial performance hit, but this cipher doesn't matter much and the stitched mode code reaches into MD5_CTX and RC4_KEY in somewhat unfortunate ways. Change-Id: I9ecd28d6afb54e90ce61baecc641742af2ae6269 Reviewed-on: https://boringssl-review.googlesource.com/6752 Reviewed-by: Adam Langley <agl@google.com>
2015-12-17Save some mallocs in computing the MAC for e_tls.c.David Benjamin
We can reuse the HMAC_CTX that stores the key. The API is kind of unfortunate as, in principle, it should be possible to do an allocation-averse HMAC with a shared key on multiple threads at once (EVP_AEAD_CTX is normally logically const). At some point it may be worth rethinking those APIs somewhat. But these "stateful AEADs" are already stateful in their EVP_CIPHER_CTX, so this is fine. Each cipher was run individually to minimize the effect of other ciphers doing their mallocs. (Although the cost of a malloc is presumably going to depend a lot on the malloc implementation and what's happened before in the process, so take these numbers with a bucket of salt. They vary widely even with the same arguments.) Taking malloc out of seal/open also helps with the malloc tests. DTLS currently cannot distinguish a malloc failure (should be fatal) from a decryption failure (not fatal), so the malloc tests get stuck. But this doesn't completely get us there since tls_cbc.c mallocs. This also assumes EVP_CIPHER_CTX, EVP_MD_CTX, and HMAC_CTX are all clever about reusing their allocations when reset (which they are). Before: Did 1315000 AES-128-CBC-SHA1 (16 bytes) seal operations in 1000087us (1314885.6 ops/sec): 21.0 MB/s Did 181000 AES-128-CBC-SHA1 (1350 bytes) seal operations in 1004918us (180114.2 ops/sec): 243.2 MB/s Did 34000 AES-128-CBC-SHA1 (8192 bytes) seal operations in 1024250us (33195.0 ops/sec): 271.9 MB/s After: Did 1766000 AES-128-CBC-SHA1 (16 bytes) seal operations in 1000319us (1765436.8 ops/sec): 28.2 MB/s Did 187000 AES-128-CBC-SHA1 (1350 bytes) seal operations in 1004002us (186254.6 ops/sec): 251.4 MB/s Did 35000 AES-128-CBC-SHA1 (8192 bytes) seal operations in 1014885us (34486.7 ops/sec): 282.5 MB/s Before: Did 391000 DES-EDE3-CBC-SHA1 (16 bytes) seal operations in 1000038us (390985.1 ops/sec): 6.3 MB/s Did 16000 DES-EDE3-CBC-SHA1 (1350 bytes) seal operations in 1060226us (15091.1 ops/sec): 20.4 MB/s Did 2827 DES-EDE3-CBC-SHA1 (8192 bytes) seal operations in 1035971us (2728.8 ops/sec): 22.4 MB/s After: Did 444000 DES-EDE3-CBC-SHA1 (16 bytes) seal operations in 1001814us (443196.0 ops/sec): 7.1 MB/s Did 17000 DES-EDE3-CBC-SHA1 (1350 bytes) seal operations in 1042535us (16306.4 ops/sec): 22.0 MB/s Did 2590 DES-EDE3-CBC-SHA1 (8192 bytes) seal operations in 1012378us (2558.3 ops/sec): 21.0 MB/s Before: Did 1316000 AES-256-CBC-SHA1 (16 bytes) seal operations in 1000510us (1315329.2 ops/sec): 21.0 MB/s Did 157000 AES-256-CBC-SHA1 (1350 bytes) seal operations in 1002944us (156539.1 ops/sec): 211.3 MB/s Did 29000 AES-256-CBC-SHA1 (8192 bytes) seal operations in 1030284us (28147.6 ops/sec): 230.6 MB/s After: Did 1645000 AES-256-CBC-SHA1 (16 bytes) seal operations in 1000313us (1644485.3 ops/sec): 26.3 MB/s Did 162000 AES-256-CBC-SHA1 (1350 bytes) seal operations in 1003060us (161505.8 ops/sec): 218.0 MB/s Did 36000 AES-256-CBC-SHA1 (8192 bytes) seal operations in 1014819us (35474.3 ops/sec): 290.6 MB/s Before: Did 1435000 RC4-SHA1 (16 bytes) seal operations in 1000245us (1434648.5 ops/sec): 23.0 MB/s Did 207000 RC4-SHA1 (1350 bytes) seal operations in 1004675us (206036.8 ops/sec): 278.1 MB/s Did 38000 RC4-SHA1 (8192 bytes) seal operations in 1022712us (37156.1 ops/sec): 304.4 MB/s After: Did 1853000 RC4-SHA1 (16 bytes) seal operations in 1000433us (1852198.0 ops/sec): 29.6 MB/s Did 206000 RC4-SHA1 (1350 bytes) seal operations in 1002370us (205512.9 ops/sec): 277.4 MB/s Did 42000 RC4-SHA1 (8192 bytes) seal operations in 1024209us (41007.3 ops/sec): 335.9 MB/s Change-Id: I0edb89bddf146cf91a8e7a99c56b2278c8f38094 Reviewed-on: https://boringssl-review.googlesource.com/6751 Reviewed-by: Adam Langley <agl@google.com>
2015-12-17Point EVP_aead_chacha20_poly1305 at the standardized version.David Benjamin
The consumers have all been updated, so we can move EVP_aead_chacha20_poly1305 to its final state. Unfortunately, the _rfc7539-suffixed version will need to stick around for just a hair longer. Also the tls1.h macros, but the remaining consumers are okay with that changing underneath them. Change-Id: Ibbb70ec1860d6ac6a7e1d7b45e70fe692bf5ebe5 Reviewed-on: https://boringssl-review.googlesource.com/6600 Reviewed-by: Adam Langley <agl@google.com>
2015-12-17Fix ChaCha20-Poly1305 tests.David Benjamin
https://boringssl-review.googlesource.com/6101 was mismerged from *ring* and lost some tests. Also add the corresponding tag truncation tests for the new construction. So long as we have that feature, we should have tests for it. (Although, do we actually need to support it?) Change-Id: I70784cbac345e0ad11b496102856c53932b7362e Reviewed-on: https://boringssl-review.googlesource.com/6682 Reviewed-by: Adam Langley <agl@google.com>
2015-11-20avoid clashes with libc's 'open' in e_chacha20poly1305.cMostyn Bramley-Moore
Some strange toolchains can have an implicit (or explicit) fcntl.h include, so let's avoid using the name 'open' for local functions. This should not cause any trouble. Change-Id: Ie131b5920ac23938013c2c03302b97a7418c7180 Reviewed-on: https://boringssl-review.googlesource.com/6540 Reviewed-by: David Benjamin <davidben@chromium.org> Reviewed-by: Adam Langley <agl@google.com>
2015-11-17Use UINT64_C instead of OPENSSL_U64.David Benjamin
stdint.h already has macros for this. The spec says that, in C++, __STDC_CONSTANT_MACROS is needed, so define it for bytestring_test.cc. Chromium seems to use these macros without trouble, so I'm assuming we can rely on them. Change-Id: I56d178689b44d22c6379911bbb93d3b01dd832a3 Reviewed-on: https://boringssl-review.googlesource.com/6510 Reviewed-by: Adam Langley <agl@google.com>
2015-11-12Remove stl_compat.h.David Benjamin
Chromium's toolchains may now assume C++11 library support, so we may freely use C++11 features. (Chromium's still in the process of deciding what to allow, but we use Google's style guide directly, toolchain limitations aside.) Change-Id: I1c7feb92b7f5f51d9091a4c686649fb574ac138d Reviewed-on: https://boringssl-review.googlesource.com/6465 Reviewed-by: Adam Langley <agl@google.com>
2015-11-04Add SSL_get_ivs.Adam Langley
This function allows one to extract the current IVs from an SSL connection. This is needed for the CBC cipher suites with implicit IVs because, for those, the IV can't be extracted from the handshake key material. Change-Id: I247a1d0813b7a434b3cfc88db86d2fe8754344b6 Reviewed-on: https://boringssl-review.googlesource.com/6433 Reviewed-by: Adam Langley <agl@google.com>
2015-11-04Improve crypto/digest/md32_common.h mechanism.Brian Smith
The documentation in md32_common.h is now (more) correct with respect to the most important details of the layout of |HASH_CTX|. The documentation explaining why sha512.c doesn't use md32_common.h is now more accurate as well. Before, the C implementations of HASH_BLOCK_DATA_ORDER took a pointer to the |HASH_CTX| and the assembly language implementations took a pointer to the hash state |h| member of |HASH_CTX|. (This worked because |h| is always the first member of |HASH_CTX|.) Now, the C implementations take a pointer directly to |h| too. The definitions of |MD4_CTX|, |MD5_CTX|, and |SHA1_CTX| were changed to be consistent with |SHA256_CTX| and |SHA512_CTX| in storing the hash state in an array. This will break source compatibility with any external code that accesses the hash state directly, but will not affect binary compatibility. The second parameter of |HASH_BLOCK_DATA_ORDER| is now of type |const uint8_t *|; previously it was |void *| and all implementations had a |uint8_t *data| variable to access it as an array of bytes. This change paves the way for future refactorings such as automatically generating the |*_Init| functions and/or sharing one I-U-F implementation across all digest algorithms. Change-Id: I6e9dd09ff057c67941021d324a4fa1d39f58b0db Reviewed-on: https://boringssl-review.googlesource.com/6405 Reviewed-by: Adam Langley <agl@google.com>
2015-11-03Revert "Improve crypto/digest/md32_common.h mechanism."Adam Langley
This reverts commit 00461cf201b66205653fd6159ae260f453738641. Sadly it broke wpa_supplicant.
2015-11-03Improve crypto/digest/md32_common.h mechanism.Brian Smith
The documentation in md32_common.h is now (more) correct with respect to the most important details of the layout of |HASH_CTX|. The documentation explaining why sha512.c doesn't use md32_common.h is now more accurate as well. Before, the C implementations of HASH_BLOCK_DATA_ORDER took a pointer to the |HASH_CTX| and the assembly language implementations tool a pointer to the hash state |h| member of |HASH_CTX|. (This worked because |h| is always the first member of |HASH_CTX|.) Now, the C implementations take a pointer directly to |h| too. The definitions of |MD4_CTX|, |MD5_CTX|, and |SHA1_CTX| were changed to be consistent with |SHA256_CTX| and |SHA512_CTX| in storing the hash state in an array. This will break source compatibility with any external code that accesses the hash state directly, but will not affect binary compatibility. The second parameter of |HASH_BLOCK_DATA_ORDER| is now of type |const uint8_t *|; previously it was |void *| and all implementations had a |uint8_t *data| variable to access it as an array of bytes. This change paves the way for future refactorings such as automatically generating the |*_Init| functions and/or sharing one I-U-F implementation across all digest algorithms. Change-Id: I30513bb40b5f1d2c8932551d54073c35484b3f8b Reviewed-on: https://boringssl-review.googlesource.com/6401 Reviewed-by: Adam Langley <agl@google.com>
2015-10-29Revert most of "Refactor ChaCha20-Poly1305 AEAD nonce handling."David Benjamin
This reverts most of commit 271777f5ac6c7f7d1aaf95b91c5a5bef86da6363. The old ChaCha20-Poly1305, though being transitioned to the old name, should not change in behavior. This also avoids adding a special-case to SSL_AEAD_CTX. Also revert the name change to SSL_CIPHER_is_CHACHA20POLY1305. The one consumer for that function doesn't need to distinguish the old and new variants, so avoid unnecessary turbulence. Change-Id: I5a6f97fccc5839d4d25e74e304dc002329d21b4b Reviewed-on: https://boringssl-review.googlesource.com/6385 Reviewed-by: Adam Langley <agl@google.com>
2015-10-27For now, give the unsuffixed ChaCha20 AEAD name to the old version.Adam Langley
QUIC has a complex relationship with BoringSSL owing to it living both in Chromium and the Google-internal repository. In order for it to handle the ChaCha20-Poly1305 AEAD switch more easily this change gives the unsuffixed name to the old AEAD, for now. Once QUIC has moved to the “_old” version the unsuffixed name can be given to the new version. Change-Id: Id8a77be6e3fe2358d78e022413fe088e5a274dca Reviewed-on: https://boringssl-review.googlesource.com/6361 Reviewed-by: David Benjamin <davidben@chromium.org> Reviewed-by: Adam Langley <alangley@gmail.com>
2015-10-27Add more tests for the RFC 7539 ChaCha20-Poly1305 AEAD.Brian Smith
The tests in crypto/cipher/test/chacha20_poly1305_deprecated_tests.txt were adapted to the RFC 7539 AEAD construction by recalculating the tags. Also a few additional vectors were added. These vectors were verified against nettle. See https://github.com/briansmith/nettle/commit/feb7292bf19dfc635f126b9f3c0d147cdee30c87. Change-Id: Ib3f2797d5825bc1e32c55f845b5070b6993e4aff Reviewed-on: https://boringssl-review.googlesource.com/6144 Reviewed-by: Adam Langley <alangley@gmail.com>
2015-10-27Refactor ChaCha20-Poly1305 AEAD nonce handling.Brian Smith
This change reduces unnecessary copying and makes the pre-RFC-7539 nonces 96 bits just like the AES-GCM, AES-CCM, and RFC 7539 ChaCha20-Poly1305 cipher suites. Also, all the symbols related to the pre-RFC-7539 cipher suites now have "_OLD" appended, in preparation for adding the RFC 7539 variants. Change-Id: I1f85bd825b383c3134df0b6214266069ded029ae Reviewed-on: https://boringssl-review.googlesource.com/6103 Reviewed-by: Adam Langley <alangley@gmail.com>
2015-10-27Add the RFC 7539 ChaCha20-Poly1305 AEAD.Brian Smith
Change-Id: I07dfde7cc304d903c2253600905cc3e6257716c5 Reviewed-on: https://boringssl-review.googlesource.com/6101 Reviewed-by: Adam Langley <alangley@gmail.com>
2015-10-27Change |CRYPTO_chacha_20| to use 96-bit nonces, 32-bit counters.Brian Smith
The new function |CRYPTO_chacha_96_bit_nonce_from_64_bit_nonce| can be used to adapt code from that uses 64 bit nonces, in a way that is compatible with the old semantics. Change-Id: I83d5b2d482e006e82982f58c9f981e8078c3e1b0 Reviewed-on: https://boringssl-review.googlesource.com/6100 Reviewed-by: Adam Langley <alangley@gmail.com>
2015-10-27Fix the shared builders by exporting GCM symbols.Adam Langley
gcm_test.cc needs to access the internal GCM symbols. This is unfortunate because it means that they have to be marked OPENSSL_EXPORT just for this. To compensate, modes.h is removed and its contents copied into crypto/modes/internal.h. Change-Id: I1777b2ef8afd154c43417137673a28598a7ec30e Reviewed-on: https://boringssl-review.googlesource.com/6360 Reviewed-by: Adam Langley <alangley@gmail.com>
2015-10-27Make |gcm128_context| memcpy-safe.Brian Smith
This removes the confusion about whether |gcm128_context| copies the key (it didn't) or whether the caller is responsible for keeping the key alive for the lifetime of the |gcm128_context| (it was). Change-Id: Ia0ad0a8223e664381fbbfb56570b2545f51cad9f Reviewed-on: https://boringssl-review.googlesource.com/6053 Reviewed-by: Adam Langley <alangley@gmail.com>
2015-10-26Add a run_tests target to run all tests.David Benjamin
It's very annoying having to remember the right incant every time I want to switch around between my build, build-release, build-asan, etc., output directories. Unfortunately, this target is pretty unfriendly without CMake 3.2+ (and Ninja 1.5+). This combination gives a USES_TERMINAL flag to add_custom_target which uses Ninja's "console" pool, otherwise the output buffering gets in the way. Ubuntu LTS is still on an older CMake, so do a version check in the meantime. CMake also has its own test mechanism (CTest), but this doesn't use it. It seems to prefer knowing what all the tests are and then tries to do its own output management and parallelizing and such. We already have our own runners. all_tests.go could actually be converted tidily, but generate_build_files.py also needs to read it, and runner.go has very specific needs. Naming the target ninja -C build test would be nice, but CTest squats that name and CMake grumps when you use a reserved name, so I've gone with run_tests. Change-Id: Ibd20ebd50febe1b4e91bb19921f3bbbd9fbcf66c Reviewed-on: https://boringssl-review.googlesource.com/6270 Reviewed-by: Adam Langley <alangley@gmail.com>
2015-10-21Allow ARM capabilities to be set at compile time.Adam Langley
Some ARM environments don't support |getauxval| or signals and need to configure the capabilities of the chip at compile time. This change adds defines that allow them to do so. Change-Id: I4e6987f69dd13444029bc7ac7ed4dbf8fb1faa76 Reviewed-on: https://boringssl-review.googlesource.com/6280 Reviewed-by: Adam Langley <agl@google.com>
2015-10-01Fix |max_tag_len| for TLS CBC AEADs.Brian Smith
Change-Id: Iba21583a4de08039fab78e526c91003fbd327592 Reviewed-on: https://boringssl-review.googlesource.com/6058 Reviewed-by: Adam Langley <agl@google.com>
2015-10-01Remove always-zero |bulk| variables in crypto/cipher/e_aes.c.Brian Smith
Change-Id: I36b2bb0e10c627ae6efa9d133df53b814922e652 Reviewed-on: https://boringssl-review.googlesource.com/6051 Reviewed-by: David Benjamin <davidben@chromium.org> Reviewed-by: Adam Langley <agl@google.com>
2015-10-01Add tests from cipher_test.txt to the AEAD test suite.Brian Smith
Change-Id: I819b5473e35e1f71192d3a336252ae4506c4230b Reviewed-on: https://boringssl-review.googlesource.com/6055 Reviewed-by: Adam Langley <agl@google.com>
2015-09-29Make dummy functions static.Adam Langley
To avoid too much #if soup, e_aes.c uses a lot of dummy functions that just call |abort|. This change makes them all static, which they should have been all along. Change-Id: I696f8a0560cf99631ed7adb42d1af10003db4a63 Reviewed-on: https://boringssl-review.googlesource.com/6004 Reviewed-by: Adam Langley <agl@google.com>
2015-09-12Restore the NULL-SHA ciphersuite. (Alas.)Matt Braithwaite
Change-Id: Ia5398f3b86a13fb20dba053f730b51a0e57b9aa4 Reviewed-on: https://boringssl-review.googlesource.com/5791 Reviewed-by: Adam Langley <agl@google.com>
2015-08-26Move arm_arch.h and fix up lots of include paths.Adam Langley
arm_arch.h is included from ARM asm files, but lives in crypto/, not openssl/include/. Since the asm files are often built from a different location than their position in the source tree, relative include paths are unlikely to work so, rather than having crypto/ be a de-facto, second global include path, this change moves arm_arch.h to include/openssl/. It also removes entries from many include paths because they should be needed as relative includes are always based on the locations of the source file. Change-Id: I638ff43d641ca043a4fc06c0d901b11c6ff73542 Reviewed-on: https://boringssl-review.googlesource.com/5746 Reviewed-by: Adam Langley <agl@google.com>
2015-08-25Add EVP_AEAD_CTX_zero.David Benjamin
Match the other stack-allocated types in that we expose a wrapper function to get them into the zero state. Makes it more amenable to templates like ScopedOpenSSLContext. Change-Id: Ibc7b2b1bc0421ce5ccc84760c78c0b143441ab0f Reviewed-on: https://boringssl-review.googlesource.com/5753 Reviewed-by: Adam Langley <agl@google.com>
2015-08-21Re-add |EVP_des_ede|, which is ECB.Matt Braithwaite
(I couldn't find an authoritative source of test data, including in OpenSSL's source, so I used OpenSSL's implementation to produce the test ciphertext.) This benefits globalplatform. Change-Id: Ifb79e77afb7efed1c329126a1a459bbf7ce6ca00 Reviewed-on: https://boringssl-review.googlesource.com/5725 Reviewed-by: Adam Langley <agl@google.com>