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-27Revert md_len removal from SHA256_CTX and SHA512_CTX.David Benjamin
This reverts commits: - 91586371422dae70481c39752e55f01f50e9a93a - a90aa643024459c1698dbec84f4c79a3238b3db8 - c0d8b83b4462a0eb1889f32dbd7f46e83f4dbc81 It turns out code outside of BoringSSL also mismatches Init and Update/Final functions. Since this is largely cosmetic, it's probably not worth the cost to do this. Change-Id: I14e7b299172939f69ced2114be45ccba1dbbb704 Reviewed-on: https://boringssl-review.googlesource.com/7793 Reviewed-by: Adam Langley <agl@google.com>
2016-04-27Pull HASH_MAKE_STRING out of md32_common.h.David Benjamin
This is in preparation for taking md_len out of SHA256_CTX by allowing us to do something similar to SHA512_CTX. md32_common.h now emits a static "finish" function which Final composes with the extraction step. Change-Id: I314fb31e2482af642fd280500cc0e4716aef1ac6 Reviewed-on: https://boringssl-review.googlesource.com/7721 Reviewed-by: Adam Langley <agl@google.com>
2016-04-19Make EVP_MD_CTX size functions return size_t.David Benjamin
The EVP_MD versions do, so the types should bubble up. BUG=22 Change-Id: Ibccbc9ff35bbfd3d164fc28bcdd53ed97c0ab338 Reviewed-on: https://boringssl-review.googlesource.com/7687 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-22Fix potential double free in EVP_DigestInit_exSteven Valdez
There is a potential double free in EVP_DigestInit_ex. This is believed to be reached only as a result of programmer error - but we should fix it anyway. (Imported from upstream's e78dc7e279ed98e1ab9845a70d14dafdfdc88f58) Change-Id: I1da7be7db7afcbe9f30f168df000d64ed73d7edd Reviewed-on: https://boringssl-review.googlesource.com/7541 Reviewed-by: David Benjamin <davidben@google.com>
2016-01-28Remove the arch-specific HOST_c2l/HOST_l2c implementations.David Benjamin
These do not appear to have much discernable effect on performance. Three comparison runs: Before: Did 5414000 SHA-1 (16 bytes) operations in 1000009us (5413951.3 ops/sec): 86.6 MB/s Did 1607000 SHA-1 (256 bytes) operations in 1000403us (1606352.6 ops/sec): 411.2 MB/s Did 70000 SHA-1 (8192 bytes) operations in 1014426us (69004.5 ops/sec): 565.3 MB/s Did 2991000 SHA-256 (16 bytes) operations in 1000204us (2990390.0 ops/sec): 47.8 MB/s Did 741000 SHA-256 (256 bytes) operations in 1000371us (740725.2 ops/sec): 189.6 MB/s Did 31000 SHA-256 (8192 bytes) operations in 1019327us (30412.2 ops/sec): 249.1 MB/s Did 2340000 SHA-512 (16 bytes) operations in 1000312us (2339270.1 ops/sec): 37.4 MB/s Did 880000 SHA-512 (256 bytes) operations in 1000879us (879227.2 ops/sec): 225.1 MB/s Did 44000 SHA-512 (8192 bytes) operations in 1013355us (43420.1 ops/sec): 355.7 MB/s After: Did 5259000 SHA-1 (16 bytes) operations in 1000013us (5258931.6 ops/sec): 84.1 MB/s Did 1547000 SHA-1 (256 bytes) operations in 1000011us (1546983.0 ops/sec): 396.0 MB/s Did 69000 SHA-1 (8192 bytes) operations in 1001089us (68924.9 ops/sec): 564.6 MB/s Did 2984000 SHA-256 (16 bytes) operations in 1000207us (2983382.4 ops/sec): 47.7 MB/s Did 734000 SHA-256 (256 bytes) operations in 1000317us (733767.4 ops/sec): 187.8 MB/s Did 31000 SHA-256 (8192 bytes) operations in 1021065us (30360.5 ops/sec): 248.7 MB/s Did 2324000 SHA-512 (16 bytes) operations in 1000116us (2323730.4 ops/sec): 37.2 MB/s Did 828000 SHA-512 (256 bytes) operations in 1001046us (827134.8 ops/sec): 211.7 MB/s Did 43000 SHA-512 (8192 bytes) operations in 1003381us (42855.1 ops/sec): 351.1 MB/s --- Before: Did 5415000 SHA-1 (16 bytes) operations in 1000055us (5414702.2 ops/sec): 86.6 MB/s Did 1604000 SHA-1 (256 bytes) operations in 1000524us (1603159.9 ops/sec): 410.4 MB/s Did 71000 SHA-1 (8192 bytes) operations in 1007686us (70458.5 ops/sec): 577.2 MB/s Did 2984000 SHA-256 (16 bytes) operations in 1000472us (2982592.2 ops/sec): 47.7 MB/s Did 738000 SHA-256 (256 bytes) operations in 1000885us (737347.4 ops/sec): 188.8 MB/s Did 30000 SHA-256 (8192 bytes) operations in 1020475us (29398.1 ops/sec): 240.8 MB/s Did 2297000 SHA-512 (16 bytes) operations in 1000391us (2296102.2 ops/sec): 36.7 MB/s Did 882000 SHA-512 (256 bytes) operations in 1000389us (881657.0 ops/sec): 225.7 MB/s Did 43000 SHA-512 (8192 bytes) operations in 1001313us (42943.6 ops/sec): 351.8 MB/s After: Did 5228000 SHA-1 (16 bytes) operations in 1000035us (5227817.0 ops/sec): 83.6 MB/s Did 1575000 SHA-1 (256 bytes) operations in 1000410us (1574354.5 ops/sec): 403.0 MB/s Did 69000 SHA-1 (8192 bytes) operations in 1004180us (68712.8 ops/sec): 562.9 MB/s Did 2884000 SHA-256 (16 bytes) operations in 1000093us (2883731.8 ops/sec): 46.1 MB/s Did 718000 SHA-256 (256 bytes) operations in 1000413us (717703.6 ops/sec): 183.7 MB/s Did 31000 SHA-256 (8192 bytes) operations in 1030257us (30089.6 ops/sec): 246.5 MB/s Did 2286000 SHA-512 (16 bytes) operations in 1000172us (2285606.9 ops/sec): 36.6 MB/s Did 979000 SHA-512 (256 bytes) operations in 1000384us (978624.2 ops/sec): 250.5 MB/s Did 47000 SHA-512 (8192 bytes) operations in 1017846us (46175.9 ops/sec): 378.3 MB/s --- Before: Did 5429000 SHA-1 (16 bytes) operations in 1000104us (5428435.4 ops/sec): 86.9 MB/s Did 1604000 SHA-1 (256 bytes) operations in 1000473us (1603241.7 ops/sec): 410.4 MB/s Did 69000 SHA-1 (8192 bytes) operations in 1002621us (68819.6 ops/sec): 563.8 MB/s Did 3021000 SHA-256 (16 bytes) operations in 1000152us (3020540.9 ops/sec): 48.3 MB/s Did 735000 SHA-256 (256 bytes) operations in 1000048us (734964.7 ops/sec): 188.2 MB/s Did 31000 SHA-256 (8192 bytes) operations in 1019902us (30395.1 ops/sec): 249.0 MB/s Did 2301000 SHA-512 (16 bytes) operations in 1000207us (2300523.8 ops/sec): 36.8 MB/s Did 881000 SHA-512 (256 bytes) operations in 1001122us (880012.6 ops/sec): 225.3 MB/s Did 44000 SHA-512 (8192 bytes) operations in 1015313us (43336.4 ops/sec): 355.0 MB/s After: Did 5264000 SHA-1 (16 bytes) operations in 1000061us (5263678.9 ops/sec): 84.2 MB/s Did 1587000 SHA-1 (256 bytes) operations in 1000293us (1586535.1 ops/sec): 406.2 MB/s Did 71000 SHA-1 (8192 bytes) operations in 1007587us (70465.4 ops/sec): 577.3 MB/s Did 2967000 SHA-256 (16 bytes) operations in 1000240us (2966288.1 ops/sec): 47.5 MB/s Did 737000 SHA-256 (256 bytes) operations in 1000874us (736356.4 ops/sec): 188.5 MB/s Did 31000 SHA-256 (8192 bytes) operations in 1019630us (30403.2 ops/sec): 249.1 MB/s Did 2326000 SHA-512 (16 bytes) operations in 1000413us (2325039.8 ops/sec): 37.2 MB/s Did 885000 SHA-512 (256 bytes) operations in 1000253us (884776.2 ops/sec): 226.5 MB/s Did 44000 SHA-512 (8192 bytes) operations in 1013216us (43426.1 ops/sec): 355.7 MB/s Change-Id: Ifd4500f4e9f41ffc0f73542141e8888b4d7f1e0b Reviewed-on: https://boringssl-review.googlesource.com/6652 Reviewed-by: Adam Langley <alangley@gmail.com>
2016-01-26Remove calls to ERR_load_crypto_strings.David Benjamin
Since the error string logic was rewritten, this hasn't done anything. Change-Id: Icb73dca65e852bb3c7d04c260d591906ec72c15f Reviewed-on: https://boringssl-review.googlesource.com/6961 Reviewed-by: Adam Langley <agl@google.com>
2015-12-17Fix build.David Benjamin
There were a couple more asm lines to turn into __asm__ when the patches got reordered slightly. Change-Id: I44be5caee6d09bb3db5dea4791592b12d175822c Reviewed-on: https://boringssl-review.googlesource.com/6741 Reviewed-by: Adam Langley <agl@google.com>
2015-12-16Mark platform-specific HOST_[c2l|l2c] as (void).Adam Langley
I skipped a patch when landing and so 793c21e2 caused a build failure when platform-specific versions of these macros were used. Change-Id: I8ed6dbb92a511ef306d45087c3eb87781fdfed31 Reviewed-on: https://boringssl-review.googlesource.com/6740 Reviewed-by: Adam Langley <agl@google.com>
2015-12-16Remove asm __asm__ define.David Benjamin
It's only used in one file. No sense in polluting the namespace here. Change-Id: Iaf3870a4be2d2cad950f4d080e25fe7f0d3929c7 Reviewed-on: https://boringssl-review.googlesource.com/6660 Reviewed-by: Adam Langley <agl@google.com>
2015-12-16Make HOST_l2c return void.David Benjamin
Nothing ever uses the return value. It'd be better off discarding it rather than make callers stick (void) everywhere. Change-Id: Ia28c970a1e5a27db441e4511249589d74408849b Reviewed-on: https://boringssl-review.googlesource.com/6653 Reviewed-by: Adam Langley <agl@google.com>
2015-12-16Store the partial block as uint8_t, not uint32_t.David Benjamin
The uint32_t likely dates to them using HASH_LONG everywhere. Nothing ever touches c->data as a uint32_t, only bytes. (Which makes sense seeing as it stores the partial block.) Change-Id: I634cb7f2b6306523aa663f8697b7dc92aa491320 Reviewed-on: https://boringssl-review.googlesource.com/6651 Reviewed-by: Adam Langley <agl@google.com>
2015-12-16Use the straight-forward ROTATE macro.David Benjamin
I would hope any sensible compiler would recognize the rotation. (If not, we should at least pull this into crypto/internal.h.) Confirmed that clang at least produces the exact same instructions for sha256_block_data_order for release + NO_ASM. This is also mostly moot as SHA-1 and SHA-256 both have assembly versions on x86 that sidestep most of this. For the digests, take it out of md32_common.h since it doesn't use the macro. md32_common.h isn't sure whether it's a multiply-included header or not. It should be, but it has an #include guard (doesn't quite do what you'd want) and will get HOST_c2l, etc., confused if one tries to include it twice. Change-Id: I1632801de6473ffd2c6557f3412521ec5d6b305c Reviewed-on: https://boringssl-review.googlesource.com/6650 Reviewed-by: Adam Langley <agl@google.com>
2015-12-16Reformat md32_common.h, part 2.David Benjamin
Manual tweaks and then clang-formatted again. Change-Id: I809fdb71b2135343e5c1264dd659b464780fc54a Reviewed-on: https://boringssl-review.googlesource.com/6649 Reviewed-by: Adam Langley <agl@google.com>
2015-12-16Reformat md32_common.h, part 1.David Benjamin
We've tweaked it already and upstream's using a different indentation style now anyway. This is the first of two commits. For verifiability, this is the output of clang-format with no modifications. Change-Id: Ia30f20bee0cc8046aedf9ac7106cc4630e8d93e6 Reviewed-on: https://boringssl-review.googlesource.com/6648 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-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-09-18Fix some malloc failure crashes.David Benjamin
EVP_MD_CTX_copy_ex was implemented with a memcpy, which doesn't work well when some of the pointers need to be copied, and ssl_verify_cert_chain didn't account for set_ex_data failing. Change-Id: Ieb556aeda6ab2e4c810f27012fefb1e65f860023 Reviewed-on: https://boringssl-review.googlesource.com/5911 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-19Suppress missing return value check warning in |EVP_DigestFinal|.Brian Smith
This is harmless, but it wasn't annoted with |(void)| so Coverity complained about it. Change-Id: Ie3405b0c0545944d49973d4bf29f8aeb6b965211 Reviewed-on: https://boringssl-review.googlesource.com/5612 Reviewed-by: David Benjamin <davidben@chromium.org> Reviewed-by: Adam Langley <agl@google.com>
2015-08-19|EVP_get_digestbyname| and |EVP_get_digestbynid|: recognize MD4.Matt Braithwaite
This benefits nodejs. Change-Id: I21bf7e64c2a44e96f27b427ad4bd44551c33221c Reviewed-on: https://boringssl-review.googlesource.com/5721 Reviewed-by: Adam Langley <agl@google.com>
2015-07-16Remove the func parameter to OPENSSL_PUT_ERROR.David Benjamin
Much of this was done automatically with find . -name '*.c' | xargs sed -E -i '' -e 's/(OPENSSL_PUT_ERROR\([a-zA-Z_0-9]+, )[a-zA-Z_0-9]+, ([a-zA-Z_0-9]+\);)/\1\2/' find . -name '*.c' | xargs sed -E -i '' -e 's/(OPENSSL_PUT_ERROR\([a-zA-Z_0-9]+, )[a-zA-Z_0-9]+, ([a-zA-Z_0-9]+\);)/\1\2/' BUG=468039 Change-Id: I4c75fd95dff85ab1d4a546b05e6aed1aeeb499d8 Reviewed-on: https://boringssl-review.googlesource.com/5276 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-05Explicitly cast |CHECK| result to |void| to avoid compiler complaint.Matt Braithwaite
Change-Id: Ie7b376da1a157d144e9c4651722630dbf9c45436 Reviewed-on: https://boringssl-review.googlesource.com/5021 Reviewed-by: Adam Langley <agl@google.com>
2015-06-04Add |EVP_get_digestbyname|.Matt Braithwaite
Change-Id: If7078ea68f037caf8e26fa0b714e96e64d50dfa9 Reviewed-on: https://boringssl-review.googlesource.com/5000 Reviewed-by: Adam Langley <agl@google.com>
2015-06-03Avoid unused variable warnings with assert.Adam Langley
It would be nice if assert(x) reduced to ((void) x) when NDEBUG was defined, but it doesn't. Because of this, locally define CHECK, which does. This avoids warnings with Clang. Change-Id: I70882741da4984a025bcfaac1969032387f369de Reviewed-on: https://boringssl-review.googlesource.com/4991 Reviewed-by: David Benjamin <davidben@chromium.org> Reviewed-by: Adam Langley <agl@google.com>
2015-06-02Unexport and prune EVP_MD_CTX flags.David Benjamin
The only flag is EVP_MD_CTX_FLAG_NO_INIT and no good can possibly come of anyone outside EVP_PKEY_HMAC calling it. (And indeed no one calls it. EVP_MD_CTX_set_flags has a caller in wpa_supplicant, but it uses EVP_MD_CTX_FLAG_NON_FIPS_ALLOW which we don't define. The call is guarded by a pair of ifdefs for some FIPS mode wpa_supplicant.) Change-Id: I70ab8ffa646f3f75dfa4d37c96b9e82448ff1e40 Reviewed-on: https://boringssl-review.googlesource.com/4971 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-06-02Fix integer types in low-level hash functions.David Benjamin
Use sized integer types rather than unsigned char/int/long. The latter two are especially a mess as they're both used in lieu of uint32_t. Sometimes the code just blindly uses unsigned long and sometimes it uses unsigned int when an LP64 architecture would notice. Change-Id: I4c5c6aaf82cfe9fe523435588d286726a7c43056 Reviewed-on: https://boringssl-review.googlesource.com/4952 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-04-13Replace MD5 in examples with SHA-256.Brian Smith
Avoiding superflous references to MD5 makes it easier to audit the code to find unsafe uses of it. It also avoids subtly encouraging users to choose MD5 instead of a better alternative. Change-Id: Ic78eb5dfbf44aac39e4e4eb29050e3337c4445cc Reviewed-on: https://boringssl-review.googlesource.com/3926 Reviewed-by: Adam Langley <agl@google.com>
2015-04-13Eliminate unnecessary includes from low-level crypto modules.Brian Smith
Beyond generally eliminating unnecessary includes, eliminate as many includes of headers that declare/define particularly error-prone functionality like strlen, malloc, and free. crypto/err/internal.h was added to remove the dependency on openssl/thread.h from the public openssl/err.h header. The include of <stdlib.h> in openssl/mem.h was retained since it defines OPENSSL_malloc and friends as macros around the stdlib.h functions. The public x509.h, x509v3.h, and ssl.h headers were not changed in order to minimize breakage of source compatibility with external code. Change-Id: I0d264b73ad0a720587774430b2ab8f8275960329 Reviewed-on: https://boringssl-review.googlesource.com/4220 Reviewed-by: Adam Langley <agl@google.com>
2015-04-13Remove crypto/obj dependencies from low-level crypto tests.Brian Smith
The only dependency the low-level crypto modules have on code in crypto/obj is their use of OBJ_nid2sn, which is trivial to avoid. This facilitates future simplification of crypto/obj, including possibly the removal of functions like OBJ_nid2sn and the complex build infrastructure that supports them. This change also removes EVP_CIPHER_name and EVP_MD_name. Change-Id: I34ce7dc7e58d5c08b52f95d25eba3963590cf2f7 Reviewed-on: https://boringssl-review.googlesource.com/3932 Reviewed-by: Adam Langley <agl@google.com>
2015-04-01Convert digest_test to C++.David Benjamin
Change-Id: Ibc8c3d8740cbd03dfb0d1ff9834fed66601dd479 Reviewed-on: https://boringssl-review.googlesource.com/4123 Reviewed-by: Adam Langley <agl@google.com>
2015-02-10Precompute sorted array for error strings.Adam Langley
Previously, error strings were kept in arrays for each subdirectory and err.c would iterate over them all and insert them at init time to a hash table. This means that, even if you have a shared library and lots of processes using that, each process has ~30KB of private memory from building that hash table. This this change, all the error strings are built into a sorted list and are thus static data. This means that processes can share the error information and it actually saves binary space because of all the pointer overhead in the old scheme. Also it saves the time taken building the hash table at startup. This removes support for externally-supplied error string data. Change-Id: Ifca04f335c673a048e1a3e76ff2b69c7264635be
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-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-06Add void in place of empty function arguments.Adam Langley
Since this is C89 we need to maintain this ancient practice. Change-Id: I7223e7c38a35cf551b6e3c9159d2e21ebf7e62be Reviewed-on: https://boringssl-review.googlesource.com/2631 Reviewed-by: David Benjamin <davidben@chromium.org> Reviewed-by: Adam Langley <agl@google.com>
2014-12-02Add EVP_md5_sha1.David Benjamin
Use it in ssl3_cert_verify_hash so signing a pre-TLS-1.2 handshake hash can go through RSA_sign and be intercepted via RSA_METHOD appropriately. This avoids Windows needing to intercept sign_raw. (CAPI keys cannot provide sign_raw, unless the input size happens to be that of NID_md5_sha1.) Also use it in processing ServerKeyExchange to avoid special-casing RSA. BUG=crbug.com/437023 Change-Id: Ia07433f468b75fdf7bfc8fa90c9751639b2478e6 Reviewed-on: https://boringssl-review.googlesource.com/2420 Reviewed-by: David Benjamin <davidben@google.com>
2014-11-06Add digest_test with tests for all existing EVP_MDs.David Benjamin
Remove the existing md5_test and sha1_test. They now are all covered by digest_test. For good measure, test the one-shot functions too. Change-Id: I8e144cc563fb8817144e26cbd2e10c15642464ba Reviewed-on: https://boringssl-review.googlesource.com/2211 Reviewed-by: Adam Langley <agl@google.com>
2014-10-01Silence warnings about unused values.Ben Laurie
Change-Id: Iabfb85d90554b25e0a545a8ef3a3e9a607770132 Reviewed-on: https://boringssl-review.googlesource.com/1850 Reviewed-by: Adam Langley <agl@google.com>
2014-09-19Add misc functions for easier porting.Adam Langley
Android requested that the wpa_supplicant go upstream. This change adds some dummy functions and reinstates DSA_dup_DH in order to make the diff smaller and easier for upstream. Change-Id: I77ac271b8652bae5a0bbe16afde51d9096f3dfb5 Reviewed-on: https://boringssl-review.googlesource.com/1740 Reviewed-by: Adam Langley <agl@google.com>
2014-08-27Readd MD4.Adam Langley
Sadly this is needed by wpa_supplicant for NTLM hashes. Change-Id: I1c362c676a11ee01f301ff6fbd33d0669396ea23 Reviewed-on: https://boringssl-review.googlesource.com/1620 Reviewed-by: Adam Langley <agl@google.com>
2014-08-05Correct endif comment in md32_common.hAlex Chernyakhovsky
PEDANTIC was not closed, but rather the compiler being used. Change-Id: I743118f1481adddcd163406be72926fff6c87338 Reviewed-on: https://boringssl-review.googlesource.com/1388 Reviewed-by: Adam Langley <agl@google.com>