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
path: root/crypto
AgeCommit message (Collapse)Author
2015-02-03Fix patch collision of d062c8af and 2b2d66d4.Adam Langley
These two patches conflicted but, because it wasn't a textual conflict, Gerrit didn't notice. Change-Id: I53464127e5e71dfa2f6c8a8847b41968671c2047
2015-02-02Fix AES-256 NIDs.Adam Langley
Thanks to an anonymous bug report. Change-Id: Icdde78c82c8ee13fb64e0124712b240295677f63 Reviewed-on: https://boringssl-review.googlesource.com/3260 Reviewed-by: David Benjamin <davidben@chromium.org> Reviewed-by: Adam Langley <agl@google.com>
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-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-31Enable more warnings & treat warnings as errors on Windows.Brian Smith
Change-Id: I2bf0144aaa8b670ff00b8e8dfe36bd4d237b9a8a Reviewed-on: https://boringssl-review.googlesource.com/3140 Reviewed-by: Adam Langley <agl@google.com>
2015-01-31Fix misleading comment.Douglas Katzman
|num_rounds| is neither a parameter nor manifest constant. Change-Id: I6c1d3a3819731f53fdd01eef6bb4de8a45176a1d Reviewed-on: https://boringssl-review.googlesource.com/3180 Reviewed-by: Adam Langley <agl@google.com>
2015-01-31Add a script to generate the ChaCha ARM asm.Adam Langley
Obviously I shouldn't be doing this by hand each time. Change-Id: I64e3f5ede5c47eddbff3b18172a95becc681b486 Reviewed-on: https://boringssl-review.googlesource.com/3170 Reviewed-by: David Benjamin <davidben@chromium.org> Reviewed-by: Adam Langley <agl@google.com>
2015-01-30Another fix for the regenerated chacha_vec_arm.S.Adam Langley
I put the header back, but missed the #endif at the end of the file. Regenerating this is clearly too error prone – I'll write a script to do it for the future. Change-Id: I06968c9f7a4673f5942725e727c67cb4e01d361a
2015-01-30Convert latin-1 files to UTF-8.Adam Langley
A handful of latin-1 codepoints existed a trio of files. This change switches the encoding to UTF-8. Change-Id: I00309e4d1ee3101e0cc02abc53196eafa17a4fa5
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-29Update the command line for generating the ChaCha asm.Adam Langley
This command line matches what was used to generate the current file. Change-Id: I2f730768f4efc1b23860cc7b27d5005311c554ea
2015-01-29Don't require alignment in ChaCha20 on ARM.Adam Langley
By copying the input and output data via an aligned buffer, the alignment requirements for the NEON ChaCha implementation on ARM can be eliminted. This does, however, reduce the speed when aligned buffers are used. However, updating the GCC version used to generate the ASM more than makes up for that. On a SnapDragon 801 (OnePlus One) the aligned speed was 214.6 MB/s and the unaligned speed was 112.1 MB/s. Now both are 218.4 MB/s. A Nexus 7 also shows a slight speed up. Change-Id: I68321ba56767fa5354b31a1491a539b299236e9a Reviewed-on: https://boringssl-review.googlesource.com/3132 Reviewed-by: Adam Langley <agl@google.com>
2015-01-29Define WIN32_LEAN_AND_MEAN in the build system, not in the code.Brian Smith
This avoids a conflict with the Chromium build system, which defines WIN32_LEAN_AND_MEAN with a different value. BUG=crbug.com/453196 Change-Id: Ia15ec7c20325c1961af4f32e5208266e5f846f35 Reviewed-on: https://boringssl-review.googlesource.com/3150 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-28Add unit-tests for PBKDF2.Eric Roman
BUG=http://crbug.com/449409 Change-Id: I0f7de3ef0e43588d55955e92ba16ebb02a97d099 Reviewed-on: https://boringssl-review.googlesource.com/3080 Reviewed-by: Adam Langley <agl@google.com>
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-28Revert "Add a test for CONF_parse_list."David Benjamin
This reverts commit cd5c892a871389dfa077bda6eec64ffa62dac722. We'd rather get rid of crypto/conf altogether, and these tests will require that we OPENSSL_EXPORT conf.h's functions. Change-Id: I271511ba321201e60de94e5c79c4b565ce31728f Reviewed-on: https://boringssl-review.googlesource.com/3120 Reviewed-by: Adam Langley <agl@google.com>
2015-01-28Clean up use of Windows Platform SDK headers.Brian Smith
Define WIN32_LEAN_AND_MEAN before including Windows Platform SDK headers to preempt naming conflicts and to make the build faster. Avoid including those headers in BoringSSL headers. Document that Platform SDK 8.1 or later is required on Windows. Change-Id: I907ada21dc722527ea37e839c71c5157455a7003 Reviewed-on: https://boringssl-review.googlesource.com/3100 Reviewed-by: Adam Langley <agl@google.com>
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-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-27Fix buffer size in aead_test.c.David Benjamin
out2 wasn't sized to account for stateful AEAD open requiring a seal overhead's worth of scratch space. Also, pass in sizeof(out2) rather than a computed ciphertext length, so the max_out check would have actually caught this. Change-Id: Ibe689424f6c8ad550b3a45266699892076e7ba5e Reviewed-on: https://boringssl-review.googlesource.com/3060 Reviewed-by: Adam Langley <agl@google.com>
2015-01-27Fix unused variable warning in OPENSSL_NO_ASM build.David Benjamin
Te4 is used in in crypto/aes/aes.c. It's used upstream in an alternate implementation of AES_set_encrypt_key not included in our version. Change-Id: I5704dbc714bdb05ef515cbf2aff5e43c3b62c5b2 Reviewed-on: https://boringssl-review.googlesource.com/3061 Reviewed-by: Adam Langley <agl@google.com>
2015-01-27Add a test for CONF_parse_list.David Benjamin
Change-Id: I7af0753cac07756a75d03a4820a16f3f8b18d7ba Reviewed-on: https://boringssl-review.googlesource.com/3026 Reviewed-by: Adam Langley <agl@google.com>
2015-01-26Remove duplication of common DH parameters.Adam Langley
Previously, the data for the common DH parameters was given twice: once with 64-bit limbs and again with 32-bit limbs. A simple macro can eliminate this duplication. Change-Id: I15af008a769616f8146845cc8dd0e6526aa142ba Reviewed-on: https://boringssl-review.googlesource.com/2950 Reviewed-by: David Benjamin <davidben@chromium.org> Reviewed-by: Adam Langley <agl@google.com>
2015-01-26Remove unused modexp512-x86_64.pl.David Benjamin
See upstream's c436e05bdc7f49985a750df64122c960240b3ae1. Change-Id: I7cbe5315a769450e4630dd4e8f465cdfd45c2e08 Reviewed-on: https://boringssl-review.googlesource.com/3025 Reviewed-by: Adam Langley <agl@google.com>
2015-01-26Fix segfault with empty fields as last in the config.David Benjamin
(Imported from upstream's 2747d73c1466c487daf64a1234b6fe2e8a62ac75.) Also fix up some stylistic issues in conf.c and clarify empty case in documentation. Change-Id: Ibacabfab2339d7566d51db4b3ac4579aec0d1fbf Reviewed-on: https://boringssl-review.googlesource.com/3023 Reviewed-by: Adam Langley <agl@google.com>
2015-01-26Use inner algorithm when printing certificate.David Benjamin
(Imported from upstream's 004efdbb41f731d36bf12d251909aaa08704a756.) The outer algorithm is already printed at the bottom of the function. This allows any tools which print the X509 this way to determine if there is a mismatch. This is also the point where the TBSCertificate is printed, not the Certificate. See upstream's RT #3665. Change-Id: I89baa4e4b626abf8813545a90eaa4409489ad893 Reviewed-on: https://boringssl-review.googlesource.com/3022 Reviewed-by: Adam Langley <agl@google.com>
2015-01-26sha256-armv4.pl: fix typo.David Benjamin
(Imported from upstream's 52cab5635603c1a7a00bc6f92401c84ec8920298.) Change-Id: I97b89c03e1a05063100f94b87e06afb2028371ff Reviewed-on: https://boringssl-review.googlesource.com/3021 Reviewed-by: Adam Langley <agl@google.com>
2015-01-26Add Broadwell performance results.David Benjamin
(Imported from upstream's b3d7294976c58e0e05d0ee44a0e7c9c3b8515e05.) May as well avoid diverging. Change-Id: I3edec4fe15b492dd3bfb3146a8944acc6575f861 Reviewed-on: https://boringssl-review.googlesource.com/3020 Reviewed-by: Adam Langley <agl@google.com>
2015-01-23Don't expect bsaes functions on ARMv6.Adam Langley
The bsaes-armv7.S asm has an #if __ARM_ARCH__>=7 around its contents, i.e. it's not just switched at runtime – it only compiles for >= ARMv7. I mistakenly regressed e_aes.c in 3e652657 to always expected bsaes functions to exist on ARM. This change fixes that. Change-Id: Ifd9111438508909a0627b25aee3e2f11e62e3ee8
2015-01-21Remove support for passing a C-String to PKCS5_PBKDF2_HMAC*().Eric Roman
Before it was possible to pass a NULL-terminated C-string to the PBKDF2 functions, and indicate the parameter was a C-string by passing a length of -1. This is not relied on anywhere in the BoringSSL code, and the API contract is possible to misuse as it is not the common way of doing things. (A problem would arise when passing in a large unsigned length that subsequently gets interpreted as -1). Change-Id: Ifbd31ff76e183fa74e9fa346908daf4bfb8fc3da Reviewed-on: https://boringssl-review.googlesource.com/2953 Reviewed-by: David Benjamin <davidben@chromium.org> Reviewed-by: Adam Langley <agl@google.com>
2015-01-17Recognize common DH parameter sets.Emanuele Pucciarelli
Recognize the four most commonly offered safe DH parameter sets when negotiating multiplicative, ephemeral Diffie-Hellman. These values were found from a scan of the Alexa common sites. When a known safe prime is used, reduce the private key size correspondingly. Change-Id: I655eb7a5c743c0b389698c0471d16db5a0966652
2015-01-17Include arm_arch.h in e_aes.c.Adam Langley
Not sure why this is working in CMake build, but the Chromium trybots aren't happy without it. Change-Id: I810740786c4f3cb9ba786891fdcd6053eea3afcb
2015-01-16Update SHA-1/256/512 asm for ARM from upstream.Adam Langley
This change syncs these asm files with upstream's 1.0.2 branch. The important change is that they contain ARMv8 code that allows 32-bit ARM code to use the hardware support in ARMv8 when running on such a chip. Change-Id: Id37cb1ff0cbc98a8e328612df7cf60340ca96064 Reviewed-on: https://boringssl-review.googlesource.com/2921 Reviewed-by: David Benjamin <davidben@chromium.org> Reviewed-by: Adam Langley <agl@google.com>
2015-01-16Follow-ups from recent patch train.David Benjamin
Comment fixups and a mismerge in aead_test. Also some buffer was larger than needed. Change-Id: I0e158089f42801575833684912f9edb206f61007 Reviewed-on: https://boringssl-review.googlesource.com/2870 Reviewed-by: Adam Langley <agl@google.com>
2015-01-16Free all error queues on shutdown.Adam Langley
As feared, 2bca0988 did cause some leak checkers to get upset about the state_hash pointer getting cleared. This change makes err_shutdown free all the error queues to try and avoid this. Hopefully this doesn't upset TSAN in turn. BUG=448296 Change-Id: I827da63c793dcabc73168ece052cdcd3d3cc64e3 Reviewed-on: https://boringssl-review.googlesource.com/2890 Reviewed-by: David Benjamin <davidben@chromium.org> Reviewed-by: Adam Langley <agl@google.com>
2015-01-16Use a weak pointer for getauxval.Adam Langley
The Android SDK version against which Chromium builds is too old to include sys/auxv.h. This change switches the ARM code to use a weak pointer for getauxval and to hard code the aux value numbers. It also switches the license on cpu-arm.c because there's no OpenSSL left in there now. Change-Id: I440cb9d533a06d8b245b189d8e5148fa33e29412 Reviewed-on: https://boringssl-review.googlesource.com/2880 Reviewed-by: David Benjamin <davidben@chromium.org> Reviewed-by: Adam Langley <agl@google.com>
2015-01-15Always write the Poly1305 tag to an aligned buffer.Adam Langley
With GCC 4.9 and -O2 (and only -O2, -O1 and -O3 didn't trigger it), the Poly1305 code can end up writing to an unaligned address otherwise and that triggers a bus error on ARM. Change-Id: Ifbeb7e2066a893d91d6f63c6565bac7d5542ef81 Reviewed-on: https://boringssl-review.googlesource.com/2850 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>
2015-01-15RT3662: Allow leading . in nameConstraintsDavid Benjamin
Change by SteveH from original by John Denker (in the RT) (Imported from upstream's 77ff1f3b8bfaa348956c5096a2b829f2e767b4f1) Confirmed by inspection of source that this matches mozilla::pkix behavior. See https://mxr.mozilla.org/mozilla-central/source/security/pkix/lib/pkixnames.cpp#939 Change-Id: Ic4e7d011f7c10cbc83e5267550063b0ebe9648fb Reviewed-on: https://boringssl-review.googlesource.com/2848 Reviewed-by: Adam Langley <agl@google.com>
2015-01-15Tag a number of globals as const.David Benjamin
Change-Id: I6f334911f153395a2e5e26adfd08912a1d8c558b Reviewed-on: https://boringssl-review.googlesource.com/2847 Reviewed-by: Adam Langley <agl@google.com>
2015-01-15Remove ECDH_KDF_X9_62 and associated EVP glue.David Benjamin
Removes a bit of unused code. This effectively reverts upstream's 25af7a5dbc05c7359d1d7f472d50d65a9d876b7e. It's new with OpenSSL 1.0.2 so nothing can be using it yet. We can restore it with tests if we end up wanting it later. (Also I think it might be misnamed. The KDF seems to be defined in X9.63, not X9.62.) Change-Id: I482daf681e0cf5c3bbdc72c57793f91448deaee8 Reviewed-on: https://boringssl-review.googlesource.com/2846 Reviewed-by: Adam Langley <agl@google.com>
2015-01-15Define the error case's output in RSA_message_index_PKCS1_type_2.David Benjamin
The use in s3_srvr.c doesn't care (it doesn't even have to be in bounds), but it's good to have the value be initialized and not a function of the input. (The old uninitialized case wasn't hit in s3_srvr.c because of the earlier bounds check.) Change-Id: Ib6b418b3c140aa564f8a46da3d34bb2b69f06195 Reviewed-on: https://boringssl-review.googlesource.com/2845 Reviewed-by: Adam Langley <agl@google.com>
2015-01-15Return error when a bit string indicates an invalid amount of bits leftDavid Benjamin
(Imported from upstream's 5a1e8c67a90aead86ccc2dda324e8f897d1a044d) Change-Id: Idfba7eb8244c1926e7921119767cb32605a74202 Reviewed-on: https://boringssl-review.googlesource.com/2836 Reviewed-by: Adam Langley <agl@google.com>
2015-01-15Reject invalid constructed encodings.David Benjamin
According to X6.90 null, object identifier, boolean, integer and enumerated types can only have primitive encodings: return an error if any of these are received with a constructed encoding. (Imported from upstream's 89f40f369f414b52e00f7230b0e3ce99e430a508.) Change-Id: Ia5d15eef72e379119f50fdbac4e92c4761bf5eaf Reviewed-on: https://boringssl-review.googlesource.com/2835 Reviewed-by: Adam Langley <agl@google.com>
2015-01-15Add tests for padding variations.David Benjamin
Test that SSLv3 accepts arbitrary padding bytes (hello, POODLE) and rejects non-minimal padding, while TLS accepts non-minimal padding but rejects arbitrary padding bytes. Also test what happens when the MAC is correct, but there is no padding. This is the case that triggers a failing padding_ok check after the MAC check on padding_len = 0 passes. Change-Id: Ia1444c526437899fc57ceafcbcef9c8f5cb9a6c5 Reviewed-on: https://boringssl-review.googlesource.com/2702 Reviewed-by: Adam Langley <agl@google.com>
2015-01-14Implement SSLv3 ciphers with stateful AEADs.David Benjamin
This introduces another knob into SSL_AEAD_CTX to omit the version from the ad parameter. It also allows us to fold a few more SSL3_ENC_METHOD hooks together. Change-Id: I6540d410d4722f734093554fb434dab6e5217d4f Reviewed-on: https://boringssl-review.googlesource.com/2698 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>
2015-01-14Drop SSLv3 parts of crypto/cipher/tls_cbc.c.David Benjamin
CBC modes in SSLv3 are bust already with POODLE and we're moving away from it. Align all the names from 'ssl3' and 'tls1' to 'tls', to match the names of the TLS-only AEADs. Change-Id: If742296a8e2633ef42a484e4d873b4a83558b6aa Reviewed-on: https://boringssl-review.googlesource.com/2693 Reviewed-by: Adam Langley <agl@google.com>
2015-01-14Implement all TLS ciphers with stateful AEADs.David Benjamin
The EVP_CIPHER codepath should no longer be used with TLS. It still exists for DTLS and SSLv3. The AEAD construction in TLS does not allow for variable-overhead AEADs, so stateful AEADs do not include the length in the ad parameter. Rather the AEADs internally append the unpadded length once it is known. EVP_aead_rc4_md5_tls is modified to account for this. Tests are added (and RC4-MD5's regenerated) for each of the new AEADs. The cipher tests are all moved into crypto/cipher/test because there's now a lot of them and they clutter the directory listing. In ssl/, the stateful AEAD logic is also modified to account for stateful AEADs with a fixed IV component, and for AEADs which use a random nonce (for the explicit-IV CBC mode ciphers). The new implementation fixes a bug/quirk in stateless CBC mode ciphers where the fixed IV portion of the keyblock was generated regardless. This is at the end, so it's only relevant for EAP-TLS which generates a MSK from the end of the key block. Change-Id: I2d8b8aa11deb43bde2fd733f4f90b5d5b8cb1334 Reviewed-on: https://boringssl-review.googlesource.com/2692 Reviewed-by: Adam Langley <agl@google.com>