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-06-28Switch perlasm calling convention.David Benjamin
Depending on architecture, perlasm differed on which one or both of: perl foo.pl flavor output.S perl foo.pl flavor > output.S Upstream has now unified on the first form after making a number of changes to their files (the second does not even work for their x86 files anymore). Sync those portions of our perlasm scripts with upstream and update CMakeLists.txt and generate_build_files.py per the new convention. This imports various commits like this one: 184bc45f683c76531d7e065b6553ca9086564576 (this was done by taking a diff, so I don't have the full list) Confirmed that generate_build_files.py sees no change. BUG=14 Change-Id: Id2fb5b8bc2a7369d077221b5df9a6947d41f50d2 Reviewed-on: https://boringssl-review.googlesource.com/8518 Reviewed-by: Adam Langley <agl@google.com>
2016-04-27Banish SSL_add_dir_cert_subjects_to_stack and OPENSSL_DIR_CTX to decrepit.David Benjamin
There was only one function that required BoringSSL to know how to read directories. Unfortunately, it does have some callers and it's not immediately obvious whether the code is unreachable. Rather than worry about that, just toss it all into decrepit. In doing so, do away with the Windows and PNaCl codepaths. Only implement OPENSSL_DIR_CTX on Linux. Change-Id: Ie64d20254f2f632fadc3f248bbf5a8293ab2b451 Reviewed-on: https://boringssl-review.googlesource.com/7661 Reviewed-by: Adam Langley <agl@google.com>
2016-04-27Import `newhope' (post-quantum key exchange).Matt Braithwaite
This derives from the reference implementation: Source: https://github.com/tpoeppelmann/newhope/tree/master/ref at bc06c1ac Paper: https://eprint.iacr.org/2015/1092 However, it does not interoperate, due to the replacement of SHAKE-128 with AES-CTR (for polynomial generation) and the replacement of SHA-3 with SHA-256 (for key whitening). Change-Id: I6a55507aea85331245e2fbd41bae5cc049fdca3c Reviewed-on: https://boringssl-review.googlesource.com/7690 Reviewed-by: Adam Langley <agl@google.com>
2016-04-26Add standalone PKCS#8 and SPKI fuzzers.David Benjamin
We already had coverage for our new EVP_PKEY parsers, but it's good to have some that cover them directly. The initial corpus was generated manually with der-ascii and should cover most of the insanity around EC key serialization. BUG=15 Change-Id: I7aaf56876680bfd5a89f5e365c5052eee03ba862 Reviewed-on: https://boringssl-review.googlesource.com/7728 Reviewed-by: Adam Langley <agl@google.com>
2016-04-12Revert "Banish SSL_add_dir_cert_subjects_to_stack and OPENSSL_DIR_CTX to ↵David Benjamin
decrepit." This reverts commit 112c4dd1ff895bf5af0d64488234b0fc40b616bc. Accidentally used the wrong push line.
2016-04-12Banish SSL_add_dir_cert_subjects_to_stack and OPENSSL_DIR_CTX to decrepit.David Benjamin
There was only one function that required BoringSSL to know how to read directories. Unfortunately, it does have some callers and it's not immediately obvious whether the code is unreachable. Rather than worry about that, just toss it all into decrepit. In doing so, do away with the Windows and PNaCl codepaths. Only implement OPENSSL_DIR_CTX on Linux. Change-Id: I3eb55b098e3aa042b422bb7da115c0812685553e
2016-03-26Rewrite ARM feature detection.David Benjamin
This removes the thread-unsafe SIGILL-based detection and the multi-consumer-hostile CRYPTO_set_NEON_capable API. (Changing OPENSSL_armcap_P after initialization is likely to cause problems.) The right way to detect ARM features on Linux is getauxval. On aarch64, we should be able to rely on this, so use it straight. Split this out into its own file. The #ifdefs in the old cpu-arm.c meant it shared all but no code with its arm counterpart anyway. Unfortunately, various versions of Android have different missing APIs, so, on arm, we need a series of workarounds. Previously, we used a SIGILL fallback based on OpenSSL's logic, but this is inherently not thread-safe. (SIGILL also does not tell us if the OS knows how to save and restore NEON state.) Instead, base the behavior on Android NDK's cpu-features library, what Chromium currently uses with CRYPTO_set_NEON_capable: - Android before API level 20 does not provide getauxval. Where missing, we can read from /proc/self/auxv. - On some versions of Android, /proc/self/auxv is also not readable, so use /proc/cpuinfo's Features line. - Linux only advertises optional features in /proc/cpuinfo. ARMv8 makes NEON mandatory, so /proc/cpuinfo can't be used without additional effort. Finally, we must blacklist a particular chip because the NEON unit is broken (https://crbug.com/341598). Unfortunately, this means CRYPTO_library_init now depends on /proc being available, which will require some care with Chromium's sandbox. The simplest solution is to just call CRYPTO_library_init before entering the sandbox. It's worth noting that Chromium's current EnsureOpenSSLInit function already depends on /proc/cpuinfo to detect the broken CPU, by way of base::CPU. android_getCpuFeatures also interally depends on it. We were already relying on both of those being stateful and primed prior to entering the sandbox. BUG=chromium:589200 Change-Id: Ic5d1c341aab5a614eb129d8aa5ada2809edd6af8 Reviewed-on: https://boringssl-review.googlesource.com/7506 Reviewed-by: David Benjamin <davidben@google.com>
2016-02-24Append to CMAKE_ASM_FLAGS rather than replace it.David Benjamin
Otherwise we clobber things like -m32. Change-Id: I9457e4b50dc3063643c31d19c7935276b8a312a1 Reviewed-on: https://boringssl-review.googlesource.com/7209 Reviewed-by: Adam Langley <agl@google.com>
2016-02-24Set --noexecstack for assembly files in the standalone build.David Benjamin
See also upstream's 2966c2ec31e81187da3fbbe1499a6aa3acfd355f. Change-Id: Iad0a0f11accb4fa2bd93667239dd7462f9fdbd7f Reviewed-on: https://boringssl-review.googlesource.com/7180 Reviewed-by: Adam Langley <agl@google.com>
2015-11-18Add X25519 and Ed25519 support.Adam Langley
(Ed25519 support is disabled when |OPENSSL_SMALL| is defined.) libcrypto.a sizes: x86-64 -O3 -march=native: +78012 (1584902 → 1662914) x86-64 -O3 -march=native -DOPENSSL_SMALL: +10596 (1356206 → 1366802) Android armv7 Thumb -O2 -DOPENSSL_SMALL: +13132 (1258462 → 1271594) Change-Id: I6a7e64d481e4ce4daa7d5057578081358746cfb9 Reviewed-on: https://boringssl-review.googlesource.com/6497 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-20Replace cpuid assembly with C code.David Benjamin
Rather, take a leaf out of Chromium's book and use MSVC's __cpuid and _xgetbv built-in, with an inline assembly emulated version for other compilers. This preserves the behavior of the original assembly with the following differences: - CPUs without cpuid aren't support. Chromium's base/cpu.cc doesn't check, and SSE2 support is part of our baseline; the perlasm code is always built with OPENSSL_IA32_SSE2. - The clear_xmm block in cpu-x86-asm.pl is removed. This was used to clear some XMM-using features if OSXSAVE was set but XCR0 reports the OS doesn't use XSAVE to store SSE state. This wasn't present in the x86_64 and seems wrong. Section 13.5.2 of the Intel manual, volume 1, explicitly says SSE may still be used in this case; the OS may save that state in FXSAVE instead. A side discussion on upstream's RT#2633 agrees. - The old code ran some AMD CPUs through the "intel" codepath and some went straight to "generic" after duplicating some, but not all, logic. The AMD copy didn't clear some reserved bits and didn't query CPUID 7 for AVX2 support. This is moot since AMD CPUs today don't support AVX2, but it seems they're expected to in the future? - Setting bit 10 is dropped. This doesn't appear to be queried anywhere, was 32-bit only, and seems a remnant of upstream's 14e21f863a3e3278bb8660ea9844e92e52e1f2f7. Change-Id: I0548877c97e997f7beb25e15f3fea71c68a951d2 Reviewed-on: https://boringssl-review.googlesource.com/5434 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-20Add infrastructure for reference counts.Adam Langley
OpenSSL has traditionally done reference counting with |int|s and the |CRYPTO_add| function. Unless a special callback is installed (rare), this is implemented by doing the reference count operations under a lock. This change adds infrastructure for handling reference counts and uses atomic operations when C11 support is available. Change-Id: Ia023ce432319efd00f77a7340da27d16ee4b63c3 Reviewed-on: https://boringssl-review.googlesource.com/4771 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-05-08Support Trusty, an embedded platform.Adam Langley
Trusty doesn't have setjmp.h and nor does it have threads. Change-Id: I005f7a009a13e6632513be9fab2bbe62294519a4 Reviewed-on: https://boringssl-review.googlesource.com/4660 Reviewed-by: Adam Langley <agl@google.com>
2015-05-08Add support for CMAC (RFC 4493).Adam Langley
The interface for this is very similar to upstream, but the code is quite different. Support for “resuming” (i.e. calling |CMAC_Final| and then computing the CMAC for an extension of the message) has been dropped. Also, calling |CMAC_Init| with magic argument to reset it has been replaced with |CMAC_Reset|. Lastly, a one-shot function has been added because it can save an allocation and that's what most callers actually appear to want to do. Change-Id: I9345220218bdb16ebe6ca356928d7c6f055d83f6 Reviewed-on: https://boringssl-review.googlesource.com/4630 Reviewed-by: David Benjamin <davidben@chromium.org> Reviewed-by: Adam Langley <agl@google.com>
2015-05-05Add support for building with the Android NDK.Adam Langley
Previously I've been using the Linaro toolchains and just building static binaries. However, the Linaro toolchains have a broken pthread_rwlock_wrlock—it does nothing and then unlocking corrupts the lock. Building with the Android NDK avoids this. These build instructions depend on https://github.com/taka-no-me/android-cmake which people will need to clone into util/ if they want to use the Android NDK. Change-Id: Ic64919f9399af2a57e8df4fb4b3400865ddb2427 Reviewed-on: https://boringssl-review.googlesource.com/4600 Reviewed-by: Adam Langley <agl@google.com>
2015-04-2132-bit ARM perlasm should be 'linux32', not 'elf'.David Benjamin
arm-xlate.pl conditions some things on the flavour matching /linux/. This change will need to be mirrored in update_gypi_and_asm.py. Change-Id: I60483aaf40fd13181173373f12f6d3651a2a8a0c Reviewed-on: https://boringssl-review.googlesource.com/4460 Reviewed-by: Adam Langley <agl@google.com>
2015-04-20Add arm-xlate.pl and initial iOS asm support.David Benjamin
This is as partial import of upstream's 9b05cbc33e7895ed033b1119e300782d9e0cf23c. It includes the perlasm changes, but not the CPU feature detection bits as we do those differently. This is largely so we don't diverge from upstream, but it'll help with iOS assembly in the future. sha512-armv8.pl is modified slightly from upstream to switch from conditioning on the output file to conditioning on an extra argument. This makes our previous change from upstream (removing the 'open STDOUT' line) more explicit. BUG=338886 Change-Id: Ic8ca1388ae20e94566f475bad3464ccc73f445df Reviewed-on: https://boringssl-review.googlesource.com/4405 Reviewed-by: Adam Langley <agl@google.com>
2015-04-16Remove the ability to set custom ex_data implementations.David Benjamin
This is never used and we can make the built-in one performant. Change-Id: I6fc7639ba852349933789e73762bc3fa1341b2ff Reviewed-on: https://boringssl-review.googlesource.com/4370 Reviewed-by: Adam Langley <agl@google.com>
2015-04-03Fix the standalone shared library build.David Benjamin
BUG=473360 Change-Id: I6dc06eb425dd10c8d6a40d17f94405ea6f2f3905 Reviewed-on: https://boringssl-review.googlesource.com/4210 Reviewed-by: Adam Langley <agl@google.com>
2015-04-01Add native support for onces and thread-local storage.Adam Langley
Historically, OpenSSL has used callbacks for anything thread related, but we don't actually have that many threading libraries to worry about: just pthreads and Windows (I hope). That suggests that it's quite reasonable to handle threading ourselves, and eliminate the need for users to remember to install the thread callbacks. The first user of this would be ERR, which currently simulates thread-local storage using a lock around a hash table keyed by the TID. (Although I suspect that change will need some CMake work in order that libpthread is automatically included with libcrypto when linking tests etc, but not on Windows and without lots of ifs.) Change-Id: I4dd088e3794506747f875c1f3e92b9bc6700fad2 Reviewed-on: https://boringssl-review.googlesource.com/4010 Reviewed-by: Adam Langley <agl@google.com>
2015-03-27Build 32-bit assembly with SSE2 enabled.David Benjamin
This affects bignum and sha. Also now that we're passing the SSE2 flag, revert the change to ghash-x86.pl which unconditionally sets $sse2, just to minimize upstream divergence. Chromium assumes SSE2 support, so relying on it is okay. See https://crbug.com/349320. Note: this change needs to be mirrored in Chromium to take. bssl speed numbers: SSE2: Did 552 RSA 2048 signing operations in 3007814us (183.5 ops/sec) Did 19003 RSA 2048 verify operations in 3070779us (6188.3 ops/sec) Did 72 RSA 4096 signing operations in 3055885us (23.6 ops/sec) Did 4650 RSA 4096 verify operations in 3024926us (1537.2 ops/sec) Without SSE2: Did 350 RSA 2048 signing operations in 3042021us (115.1 ops/sec) Did 11760 RSA 2048 verify operations in 3003197us (3915.8 ops/sec) Did 46 RSA 4096 signing operations in 3042692us (15.1 ops/sec) Did 3400 RSA 4096 verify operations in 3083035us (1102.8 ops/sec) SSE2: Did 16407000 SHA-1 (16 bytes) operations in 3000141us (5468743.0 ops/sec): 87.5 MB/s Did 4367000 SHA-1 (256 bytes) operations in 3000436us (1455455.1 ops/sec): 372.6 MB/s Did 185000 SHA-1 (8192 bytes) operations in 3002666us (61611.9 ops/sec): 504.7 MB/s Did 9444000 SHA-256 (16 bytes) operations in 3000052us (3147945.4 ops/sec): 50.4 MB/s Did 2283000 SHA-256 (256 bytes) operations in 3000457us (760884.1 ops/sec): 194.8 MB/s Did 89000 SHA-256 (8192 bytes) operations in 3016024us (29509.0 ops/sec): 241.7 MB/s Did 5550000 SHA-512 (16 bytes) operations in 3000350us (1849784.2 ops/sec): 29.6 MB/s Did 1820000 SHA-512 (256 bytes) operations in 3001039us (606456.6 ops/sec): 155.3 MB/s Did 93000 SHA-512 (8192 bytes) operations in 3007874us (30918.8 ops/sec): 253.3 MB/s Without SSE2: Did 10573000 SHA-1 (16 bytes) operations in 3000261us (3524026.7 ops/sec): 56.4 MB/s Did 2937000 SHA-1 (256 bytes) operations in 3000621us (978797.4 ops/sec): 250.6 MB/s Did 123000 SHA-1 (8192 bytes) operations in 3033202us (40551.2 ops/sec): 332.2 MB/s Did 5846000 SHA-256 (16 bytes) operations in 3000294us (1948475.7 ops/sec): 31.2 MB/s Did 1377000 SHA-256 (256 bytes) operations in 3000335us (458948.8 ops/sec): 117.5 MB/s Did 54000 SHA-256 (8192 bytes) operations in 3027962us (17833.8 ops/sec): 146.1 MB/s Did 2075000 SHA-512 (16 bytes) operations in 3000967us (691443.8 ops/sec): 11.1 MB/s Did 638000 SHA-512 (256 bytes) operations in 3000576us (212625.8 ops/sec): 54.4 MB/s Did 30000 SHA-512 (8192 bytes) operations in 3042797us (9859.3 ops/sec): 80.8 MB/s BUG=430237 Change-Id: I47d1c1ffcd71afe4f4a192272f8cb92af9505ee1 Reviewed-on: https://boringssl-review.googlesource.com/4130 Reviewed-by: Adam Langley <agl@google.com>
2015-02-23Find perl using the CMake's standard FindPerl module.David Benjamin
This gives a standard PERL_EXECUTABLE configuration knob which is useful for specifying a perl to use without having it in PATH. Change-Id: I4b196b77e0b4666081a3f291fee3654c47925844 Reviewed-on: https://boringssl-review.googlesource.com/3570 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-02Probe for NEON support if getauxval is missing.Adam Langley
Android didn't have getauxval until Jelly Bean (4.1). This means that BoringSSL running on older Androids won't be able to detect NEON support. (This is moot for Chromium because Chromium calls android_getCpuFeatures and sets the NEON flag itself, but other users of BoringSSL on Android probably won't do that.) This change mirrors a little of what upstream does and tries running a NEON instruction with a handler for SIGILL installed. Change-Id: I853b85c37ffb049b240582d71fcf07adedc37a30 Reviewed-on: https://boringssl-review.googlesource.com/3190 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-28Honor the standard BUILD_SHARED_LIBS cmake variable.David Benjamin
The variable switches the default type for add_library from STATIC to SHARED. We can condition additional stuff on that for convenience. (tabtest still doesn't build.) BoringSSL as any kind of stable system shared library is still very much unsupported, but this is probably handy for making sure we don't forget all those pesky OPENSSL_EXPORTs. Change-Id: I66ab80bcddbf3724e03e85384141fdf4f4acbc2e Reviewed-on: https://boringssl-review.googlesource.com/3092 Reviewed-by: Adam Langley <agl@google.com>
2015-01-27Run x86 perlasm on UNIX with -fPIC.David Benjamin
This matches the Chromium build. Change-Id: I6ebd01c6ecb67c79577f98cf468dc204721595ef Reviewed-on: https://boringssl-review.googlesource.com/3063 Reviewed-by: Adam Langley <agl@google.com>
2015-01-15aarch64 support.Adam Langley
This is an initial cut at aarch64 support. I have only qemu to test it however—hopefully hardware will be coming soon. This also affects 32-bit ARM in that aarch64 chips can run 32-bit code and we would like to be able to take advantage of the crypto operations even in 32-bit mode. AES and GHASH should Just Work in this case: the -armx.pl files can be built for either 32- or 64-bit mode based on the flavour argument given to the Perl script. SHA-1 and SHA-256 don't work like this however because they've never support for multiple implementations, thus BoringSSL built for 32-bit won't use the SHA instructions on an aarch64 chip. No dedicated ChaCha20 or Poly1305 support yet. Change-Id: Ib275bc4894a365c8ec7c42f4e91af6dba3bd686c Reviewed-on: https://boringssl-review.googlesource.com/2801 Reviewed-by: Adam Langley <agl@google.com>
2014-12-18Implement HKDF.Nick Harper
See https://tools.ietf.org/html/rfc5869. Change-Id: I6d012d8c38806df80aa44350d3a86eaff499ac05 Reviewed-on: https://boringssl-review.googlesource.com/2533 Reviewed-by: Adam Langley <agl@google.com>
2014-11-11Constant-time utilities.Adam Langley
Pull constant-time methods out to a separate header, add tests. (Imported from upstream's 9a9b0c0401cae443f115ff19921d347b20aa396b and 27739e92659d38cdefa21e51b7f52b81a7ac3388) Change-Id: Id570f5c531aca791112929e6258989f43c8a78d7
2014-11-01Build with yasm on Win64 as well.David Benjamin
Chromium's doesn't have built-in support for ml64.exe. Seems easier to just build consistently with Yasm on both Win32 and Win64. (This will require an equivalent change in Chromium's build, but keep upstream and downstream builds consistent.) Also don't set CMAKE_ASM_NASM_COMPILER explicitly; cmake's default ASM_NASM behavior will search for both nasm or yasm in %PATH%. Leave it unset so it can be overwritten on the command-line to point to a particular yasm. Update BUILDING accordingly. Verified the tests still pass. Change-Id: I7e434be474b5b2d49e3bafbced5b41cc0246bd00 Reviewed-on: https://boringssl-review.googlesource.com/2104 Reviewed-by: Adam Langley <agl@google.com>
2014-10-30Build Win32 with Yasm rather than MASM.David Benjamin
Although x86masm.pl exists, upstream's documentation suggest only x86nasm.pl is supported. Yasm seems to handle it fine with a small change. Change-Id: Ia77be57c6b743527225924b2b398f2f07a084a7f Reviewed-on: https://boringssl-review.googlesource.com/2092 Reviewed-by: Adam Langley <agl@google.com>
2014-10-30Get MASM output working on Win32.David Benjamin
We were building the NASM flavor with MASM which is why it didn't work. Get the MASM output working: cpuid and cmove are not available in MASM unless the file declares .686. Also work around MASM rejecting a very long line in SHA-256. The follow-up change will get the NASM flavor working. We should probably use that one as it's documented as supported upstream. But let's make this one functional too. Change-Id: Ica69cc042a7250c7bc9ba9325caab597cd4ce616 Reviewed-on: https://boringssl-review.googlesource.com/2091 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-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-12Windows build fixes.Adam Langley
Windows doesn't have ssize_t, sadly. There's SSIZE_T, but defining an OPENSSL_SSIZE_T seems worse than just using an int. Change-Id: I09bb5aa03f96da78b619e551f92ed52ce24d9f3f Reviewed-on: https://boringssl-review.googlesource.com/1352 Reviewed-by: Adam Langley <agl@google.com>
2014-07-31Use asm directives to protect OPENSSL_cleanse.Adam Langley
Compilers have a bad habit of removing "superfluous" memset calls that are trying to zero memory. For example, when memset()ing a buffer and then free()ing it, the compiler might decide that the memset is unobservable and thus can be removed. Previously we tried to stop this by a) implementing memset in assembly on x86 and b) putting the function in its own file for other platforms. This change removes those tricks in favour of using asm directives to scare the compiler away. As best as our compiler folks can tell, this is sufficient and will continue to be so. Change-Id: I40e0a62c3043038bafd8c63a91814a75a3c59269 Reviewed-on: https://boringssl-review.googlesource.com/1339 Reviewed-by: David Benjamin <davidben@chromium.org> Reviewed-by: Adam Langley <agl@google.com>
2014-06-24Include some build fixes for OS X.Adam Langley
Apart from the obvious little issues, this also works around a (seeming) libtool/linker: a.c defines a symbol: int kFoo; b.c uses it: extern int kFoo; int f() { return kFoo; } compile them: $ gcc -c a.c $ gcc -c b.c and create a dummy main in order to run it, main.c: int f(); int main() { return f(); } this works as expected: $ gcc main.c a.o b.o but, if we make an archive: $ ar q lib.a a.o b.o and use that: $ gcc main.c lib.a Undefined symbols for architecture x86_64 "_kFoo", referenced from: _f in lib.a(b.o) (It doesn't matter what order the .o files are put into the .a) Linux and Windows don't seem to have this problem. nm on a.o shows that the symbol is of type "C", which is a "common symbol"[1]. Basically the linker will merge multiple common symbol definitions together. If ones makes a.c read: int kFoo = 0; Then one gets a type "D" symbol - a "data section symbol" and everything works just fine. This might actually be a libtool bug instead of an ld bug: Looking at `xxd lib.a | less`, the __.SYMDEF SORTED index at the beginning of the archive doesn't contain an entry for kFoo unless initialised. Change-Id: I4cdad9ba46e9919221c3cbd79637508959359427
2014-06-24Remove crypto/comp and SSL_COMP support code.David Benjamin
Now that the consuming code in ssl/ is removed, there is no need for this. Leave SSL_COMP and STACK_OF(SSL_COMP) for now so as not to break any code which manipulates the output of SSL_COMP_get_compression_methods to disable compression. Change-Id: Idf0a5debd96589ef6e7e56acf5d9259412b7d7a1
2014-06-21ChaCha20-Poly1305 support.Adam Langley
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.)