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-04-19Reimplement PKCS#12 key derivation.David Benjamin
This is avoids pulling in BIGNUM for doing a straight-forward addition on a block-sized value, and avoids a ton of mallocs. It's also -Wconversion-clean, unlike the old one. In doing so, this replaces the HMAC_MAX_MD_CBLOCK with EVP_MAX_MD_BLOCK_SIZE. By having the maximum block size available, most of the temporary values in the key derivation don't need to be malloc'd. BUG=22 Change-Id: I940a62bba4ea32bf82b1190098f3bf185d4cc7fe Reviewed-on: https://boringssl-review.googlesource.com/7688 Reviewed-by: Steven Valdez <svaldez@google.com> Reviewed-by: David Benjamin <davidben@google.com>
2015-11-12Remove condition which always evaluates to true (size_t >= 0).Piotr Sikora
Found with -Wtype-limits. Change-Id: I5580f179425bc6b09ff2a8559fce121b0cc8ae14 Signed-off-by: Piotr Sikora <piotrsikora@google.com> Reviewed-on: https://boringssl-review.googlesource.com/6463 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-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-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-07-16Fix typo in |HMAC_CTX_cleanup|.Adam Langley
This was part of https://boringssl-review.googlesource.com/#/c/2710, but that got lost because I was gumption-trapped by the number of changes in x509/ that I didn't really want to make. Change-Id: Iaf5bc8bcc2e3cfbb1b37aa477462ee8f824135db Reviewed-on: https://boringssl-review.googlesource.com/5440 Reviewed-by: Adam Langley <agl@google.com>
2015-06-25Remove EVP_PKEY_HMAC.David Benjamin
This removes EVP_PKEY_HMAC and all the support code around it. EVP_MD requires a lot of extra glue to support HMAC. This lets us prune it all away. As a bonus, it removes a (minor) dependency from EVP to the legacy ASN.1 stack. Change-Id: I5a9e3e39f518429828dbf13d14647fb37d9dc35a Reviewed-on: https://boringssl-review.googlesource.com/5120 Reviewed-by: Adam Langley <agl@google.com>
2015-06-02Remove HMAC_CTX_set_flags.David Benjamin
It's never called externally and for good reason; the only flag to set is EVP_MD_CTX_FLAG_NO_INIT which is an implementation detail of EVP_PKEY_HMAC (hopefully to be removed eventually). Indeed, only EVP_PKEY_HMAC ever calls this function. Except there's no need to because the HMAC_CTX has already been initialized at that point. (And were it not initialized, that call would not bode well for the poor HMAC_CTX.) The legacy EVP_PKEY_HMAC API has test coverage and still works after this change. Change-Id: I2fb0bede3c24ad1519f9433f957606de15ba86c7 Reviewed-on: https://boringssl-review.googlesource.com/4970 Reviewed-by: Adam Langley <agl@google.com>
2015-06-02Add additional HMAC tests.David Benjamin
Not terribly important given that we already have NIST vectors, but may as well. These tests come from upstream's 2cfbdd71dde0c3ddf4597eb20cc3e3fb8485fc15. Change-Id: I4f8dadc7d5d1599d0b75ecdef06f2fc6a5cd8003 Reviewed-on: https://boringssl-review.googlesource.com/4962 Reviewed-by: Adam Langley <agl@google.com>
2015-06-02EVP_Digest*Update, EVP_DigestFinal, and HMAC_Update can never fail.David Benjamin
Enough code fails to check their return codes anyway. We ought to make it official. Change-Id: Ie646360fd7073ea943036f5e21bed13df7e1b77a Reviewed-on: https://boringssl-review.googlesource.com/4954 Reviewed-by: Adam Langley <agl@google.com>
2015-05-21Add malloc test support to unit tests.David Benjamin
Currently far from passing and I haven't even tried with a leak checker yet. Also bn_test is slow. Change-Id: I4fe2783aa5f7897839ca846062ae7e4a367d2469 Reviewed-on: https://boringssl-review.googlesource.com/4794 Reviewed-by: Adam Langley <agl@google.com>
2015-05-12Add evp_test, loosely based on upstream's version.David Benjamin
This imports the EVP_PKEY test data of upstream's evptests.txt, but modified to fit our test framework and with a new test driver. The remainder of the test data will be imported separately into aead_test and cipher_test. Some minor changes to the test format were made to account for test framework differences. One test has different results since we don't support RSA signatures with omitted (rather than NULL) parameters. Otherwise, the biggest difference in test format is that the ad-hoc result strings are replaced with checking ERR_peek_error. Change-Id: I758869abbeb843f5f2ac6c1cbd87333baec08ec3 Reviewed-on: https://boringssl-review.googlesource.com/4703 Reviewed-by: Adam Langley <agl@google.com>
2015-05-12Add file-based test framework and convert hmac_test.David Benjamin
This adds a file-based test framework to crypto/test. It knows how to parse formats similar to either upstream's evp_test and our aead_test. hmac_test has been converted to that with tests from upstream's evp_test. Upstream tests it against the deprecated EVP_PKEY_HMAC API, which will be tested by running evp_test against the same input file, to avoid having to duplicate the test vectors. hmac_test runs those same inputs against the supported HMAC_CTX APIs. Change-Id: I9d2b6adb9be519760d1db282b9d43efd6f9adffb Reviewed-on: https://boringssl-review.googlesource.com/4701 Reviewed-by: Adam Langley <agl@google.com>
2015-04-13Remove gotos from HMAC code.Brian Smith
Change-Id: Ic17257e65207ada658f781f4b35ec0cf75bb5474 Reviewed-on: https://boringssl-review.googlesource.com/4151 Reviewed-by: Adam Langley <agl@google.com>
2015-04-01Convert hmac_test to C++.David Benjamin
Change-Id: I50db70385634c51ed692ac0ebf9732f46130ca41 Reviewed-on: https://boringssl-review.googlesource.com/4125 Reviewed-by: Adam Langley <agl@google.com>
2015-03-03Forbid reusing HMAC key without reusing the hash function.David Benjamin
There's no good reason to do this, and it doesn't work; HMAC checks the length of the key and runs it through the hash function if too long. The reuse occurs after this check. This allows us to shave 132 bytes off HMAC_CTX as this was the only reason it ever stored the original key. It also slightly simplifies HMAC_Init_ex's logic. Change-Id: Ib56aabc3630b7178f1ee7c38ef6370c9638efbab Reviewed-on: https://boringssl-review.googlesource.com/3733 Reviewed-by: Adam Langley <agl@google.com>
2015-03-03Use HMAC_Init_ex, not HMAC_Init, in HMAC.David Benjamin
We've already initialized the context, HMAC_Init has questionable behavior around NULL keys, and this avoids a size_t truncation. Change-Id: Iab6bfc24fe22d46ca4c01be6129efe0630d553e6 Reviewed-on: https://boringssl-review.googlesource.com/3732 Reviewed-by: Adam Langley <agl@google.com>
2015-02-02Remove string.h from base.h.Adam Langley
Including string.h in base.h causes any file that includes a BoringSSL header to include string.h. Generally this wouldn't be a problem, although string.h might slow down the compile if it wasn't otherwise needed. However, it also causes problems for ipsec-tools in Android because OpenSSL didn't have this behaviour. This change removes string.h from base.h and, instead, adds it to each .c file that requires it. Change-Id: I5968e50b0e230fd3adf9b72dd2836e6f52d6fb37 Reviewed-on: https://boringssl-review.googlesource.com/3200 Reviewed-by: David Benjamin <davidben@chromium.org> Reviewed-by: Adam Langley <agl@google.com>
2015-01-29Test HMAC_CTX initial state and remove now unneccessary code.David Benjamin
The special-case in HMAC is no longer needed. Test that HMAC_CTX is initialized with the zero key. Change-Id: I4ee2b495047760765c7d7fdfb4ccb510723aa263 Reviewed-on: https://boringssl-review.googlesource.com/3121 Reviewed-by: Adam Langley <agl@google.com>
2015-01-29Change CMakeLists.txt to two-space indent.Adam Langley
find -name CMakeLists.txt -type f | xargs sed -e 's/\t/ /g' -i Change-Id: I01636b1849c00ba918f48828252492d99b0403ac
2015-01-28Initialize HMAC keys to zero.Eric Roman
In an attempt to assign a zero-length HMAC key, consumers might incorrectly call: HMAC_Init_ex(key=NULL, key_len=0) This does not work as expected since |key==NULL| has special semantics. This bug may consequently result in uninitialized memory being used for the HMAC key data. This workaround doesn't fix all the problems associated with this pattern, however by defaulting to a zero key the results are more predictable than before. BUG=http://crbug.com/449409 Change-Id: I777276d57c61f1c0cce80b18e28a9b063784733f Reviewed-on: https://boringssl-review.googlesource.com/3040 Reviewed-by: Adam Langley <agl@google.com>
2015-01-14Introduce HMAC_CTX_copy_ex and deprecate HMAC_CTX_copy.David Benjamin
HMAC_CTX_copy's documentation is off. It actually follows the old copy functions which call FOO_init on dest first. Notably this means that they leak memory if dest is currently in use. Add HMAC_CTX_copy_ex as an analog of EVP_MD_CTX_copy and deprecate HMAC_CTX_copy. (EVP_CIPHER_CTX_copy, in contrast, was correct from the start.) Change-Id: I48566c858663d3f659bd356200cf862e196576c9 Reviewed-on: https://boringssl-review.googlesource.com/2694 Reviewed-by: Adam Langley <agl@google.com>
2014-12-19Properly handle key_len=0 for HMACNick Harper
The expectation when calling HMAC with key=NULL and keylen=0 is to compute HMAC on the provided data with a key of length 0 instead of using the "previous" key, which in the case of HMAC() is whatever bytes happen to be left on the stack when the HMAC_CTX struct is allocated. Change-Id: I52a95e262ee4e15f1af3136cb9c07f42f40ce122 Reviewed-on: https://boringssl-review.googlesource.com/2660 Reviewed-by: Adam Langley <agl@google.com>
2014-09-12Add a CRYPTO_library_init and static-initializer-less build option.David Benjamin
Chromium does not like static initializers, and the CPU logic uses one to initialize CPU bits. However, the crypto library lacks an explicit initialization function, which could complicate (no compile-time errors) porting existing code which uses crypto/, but not ssl/. Add an explicit CRYPTO_library_init function, but make it a no-op by default. It only does anything (and is required) if building with BORINGSSL_NO_STATIC_INITIALIZER. Change-Id: I6933bdc3447fb382b1f87c788e5b8142d6f3fe39 Reviewed-on: https://boringssl-review.googlesource.com/1770 Reviewed-by: Adam Langley <agl@google.com>
2014-07-15Move public headers to include/openssl/Adam Langley
Previously, public headers lived next to the respective code and there were symlinks from include/openssl to them. This doesn't work on Windows. This change moves the headers to live in include/openssl. In cases where some symlinks pointed to the same header, I've added a file that just includes the intended target. These cases are all for backwards-compat. Change-Id: I6e285b74caf621c644b5168a4877db226b07fd92 Reviewed-on: https://boringssl-review.googlesource.com/1180 Reviewed-by: David Benjamin <davidben@chromium.org> Reviewed-by: Adam Langley <agl@google.com>
2014-06-21Inital import.Adam Langley
Initial fork from f2d678e6e89b6508147086610e985d4e8416e867 (1.0.2 beta). (This change contains substantial changes from the original and effectively starts a new history.)