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-27Add functions to parse and generate PKCS#7 files with CRLs.Adam Langley
Change-Id: I7b6acc9004beb7b7090de1837814ccdff2e9930e Reviewed-on: https://boringssl-review.googlesource.com/3680 Reviewed-by: David Benjamin <davidben@chromium.org> Reviewed-by: Adam Langley <agl@google.com>
2015-02-27Remove pointless free, and use preferred way of calling d2i_* functionsDavid Benjamin
(Imported from upstream's 535bc8faf69dc4ff39e2ee99195b268cf99b9569) Change-Id: Ia5abf4dce9dc8cdf5a9b77a3e360a40b5f815adf Reviewed-on: https://boringssl-review.googlesource.com/3672 Reviewed-by: Adam Langley <agl@google.com>
2015-02-27Align d2i_ECPrivateKey error-handling with upstream.David Benjamin
Upstream decided to make the caller free the scratch space rather than the callee. May as well match. (Existing code is pretty inconsistent. This API pattern needs to go.) See upstream's 9e442d485008046933cdc7da65080f436a4af089. Change-Id: I7c9fcae5778a74d6ae8e9f546e03fb2cf6e48426 Reviewed-on: https://boringssl-review.googlesource.com/3671 Reviewed-by: Adam Langley <agl@google.com>
2015-02-27Unexport EC_GROUP_copy.David Benjamin
EC_GROUP_copy is an rather unfriendly function; it doesn't work if the groups have different[*] underlying EC_METHODs, but this notion is not exposed through the API. I found no callers of EC_GROUP_copy in external code. This leaves the precompute_mult functions as the remaining mutable API exposed through EC_GROUP. [*] Though, of the two EC_METHODs right now, simple.c is entirely unused. Change-Id: Iabb52518005250fb970e12b3b0ea78b4f6eff4a0 Reviewed-on: https://boringssl-review.googlesource.com/3631 Reviewed-by: Adam Langley <agl@google.com>
2015-02-26Use EC_GROUP_dup and EC_POINT_dup in EC_KEY_copy.David Benjamin
They do the same thing. This removes all callers of EC_GROUP_copy outside EC_GROUP_dup. Change-Id: I65433ee36040de79e56483dfece774e01e2e2743 Reviewed-on: https://boringssl-review.googlesource.com/3630 Reviewed-by: Adam Langley <agl@google.com>
2015-02-26Remove explicit .hiddens from x86_64 perlasm files.David Benjamin
This reverts the non-ARM portions of 97999919bbe85ab213d283e18e597e028f8685d1. x86_64 perlasm already makes .globl imply .hidden. (Confusingly, ARM does not.) Since we don't need it, revert those to minimize divergence with upstream. Change-Id: I2d205cfb1183e65d4f18a62bde187d206b1a96de Reviewed-on: https://boringssl-review.googlesource.com/3610 Reviewed-by: Adam Langley <agl@google.com>
2015-02-26EC_GROUP_cmp should return zero if the groups match.Adam Langley
(I got this wrong when reading the OpenSSL code.) Change-Id: Ib289ef41d0ab5a3157ad8b9454d2de96d1f86c22 Reviewed-on: https://boringssl-review.googlesource.com/3620 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-23Use TCP sockets rather than socketpairs in the SSL tests.David Benjamin
This involves more synchronization with child exits as the kernel no longer closes the pre-created pipes for free, but it works on Windows. As long as TCP_NODELAY is set, the performance seems comparable. Though it does involve dealing with graceful socket shutdown. I couldn't get that to work on Windows without draining the socket; not even SO_LINGER worked. Current (untested) theory is that Windows refuses to gracefully shutdown a socket if the peer sends data after we've stopped reading. cmd.ExtraFiles doesn't work on Windows; it doesn't use fds natively, so you can't pass fds 4 and 5. (stdin/stdout/stderr are special slots in CreateProcess.) We can instead use the syscall module directly and mark handles as inheritable (and then pass the numerical values out-of-band), but that requires synchronizing all of our shim.Start() calls and assuming no other thread is spawning a process. PROC_THREAD_ATTRIBUTE_HANDLE_LIST fixes threading problems, but requires wrapping more syscalls. exec.Cmd also doesn't let us launch the process ourselves. Plus it still requires every handle in the list be marked inheritable, so it doesn't help if some other thread is launching a process with bInheritHandles TRUE but NOT using PROC_THREAD_ATTRIBUTE_HANDLE_LIST. (Like Go, though we can take syscall.ForkLock there.) http://blogs.msdn.com/b/oldnewthing/archive/2011/12/16/10248328.aspx The more natively Windows option seems to be named pipes, but that too requires wrapping more system calls. (To be fair, that isn't too painful.) They also involve a listening server, so we'd still have to synchronize with shim.Wait() a la net.TCPListener. Then there's DuplicateHandle, but then we need an out-of-band signal. All in all, one cross-platform implementation with a TCP sockets seems simplest. Change-Id: I38233e309a0fa6814baf61e806732138902347c0 Reviewed-on: https://boringssl-review.googlesource.com/3563 Reviewed-by: Adam Langley <agl@google.com>
2015-02-23perlasm/x86masm.pl: make it work.David Benjamin
Though this doesn't mean that masm becomes supported, the script is still provided on don't-ask-in-case-of-doubt-use-nasm basis. See RT#3650 for background. (Imported from upstream's 2f8d82d6418c4de8330e2870c1ca6386dc9e1b34) The data_word changes were already fixed with our 3e700bb3e812730f60bec529a14c0d35ea9665aa, but best to avoid diverging there. Change-Id: Iab5455534e8bd632fb2b247ff792d411b105f17a Reviewed-on: https://boringssl-review.googlesource.com/3581 Reviewed-by: Adam Langley <agl@google.com>
2015-02-23sha/asm/sha1-586.pl: fix typo.David Benjamin
The typo doesn't affect supported configuration, only unsupported masm. (Imported from upstream's 3372c4fffa0556a688f8f1f550b095051398f596) Change-Id: Ib6a2f1d9f6fc244a33da1e079188acdf69d5e2f3 Reviewed-on: https://boringssl-review.googlesource.com/3580 Reviewed-by: Adam Langley <agl@google.com>
2015-02-23EVP_CIPHER_CTX_cleanup cannot fail.David Benjamin
There is exactly one implementation and it doesn't fail. Plus a cleanup function that can fail is very bad manners; the caller has no choice but to leak at that point. Change-Id: I5b524617ef37bc7d92273472fa742416ea7dfd43 Reviewed-on: https://boringssl-review.googlesource.com/3564 Reviewed-by: Adam Langley <agl@google.com>
2015-02-21Never set RC4_CHAR.Adam Langley
RC4_CHAR is a bit in the x86(-64) CPUID information that switches the RC4 asm code from using an array of 256 uint32_t's to 256 uint8_t's. It was originally written for the P4, where the uint8_t style was faster. (On modern chips, setting RC4_CHAR took RC4-MD5 from 458 to 304 MB/s. Although I wonder whether, on a server with many connections, using less cache wouldn't be better.) However, I'm not too worried about a slowdown of RC4 on P4 systems these days (the last new P4 chip was released nine years ago) and I want the code to be simplier. Also, RC4_CHAR was set when the CPUID family was 15, but Intel actually lists 15 as a special code meaning "also check the extended family bits", which the asm didn't do. The RC4_CHAR support remains in the RC4 asm code to avoid drift with upstream. Change-Id: If3febc925a83a76f453b9e9f8de5ee43759927c6 Reviewed-on: https://boringssl-review.googlesource.com/3550 Reviewed-by: David Benjamin <davidben@chromium.org> Reviewed-by: Adam Langley <agl@google.com>
2015-02-21Tidy up RC4 a little.Adam Langley
RC4_CHUNK is always defined, RC4_INT is always uint32_t and the "register" keyword is an anachronism. Change-Id: Ia752af30ba6bac0ee6216ce189fcf3888de73c6e Reviewed-on: https://boringssl-review.googlesource.com/3544 Reviewed-by: Adam Langley <agl@google.com>
2015-02-21Add the CTX parameter back to EC_GROUP_cmp.Adam Langley
It was a mistake to remove this in the first place. Change-Id: Icd97b4db01e49151daa41dd892f9da573ddc2842 Reviewed-on: https://boringssl-review.googlesource.com/3541 Reviewed-by: David Benjamin <davidben@chromium.org> Reviewed-by: Adam Langley <agl@google.com>
2015-02-21Hide all asm symbols.Adam Langley
We are leaking asm symbols in Android builds because the asm code isn't affected by -fvisibility=hidden. This change hides all asm symbols. This assumes that no asm symbols are public API and that should be true. Some points to note: In crypto/rc4/asm/rc4-md5-x86_64.pl there are |RC4_set_key| and |RC4_options| functions which aren't getting marked as hidden. That's because those functions aren't actually ever generated. (I'm just trying to minimise drift with upstream here.) In crypto/rc4/asm/rc4-x86_64.pl there's |RC4_options| which is "public" API, except that we've never had it in the header files. So I've just deleted it. Since we have an internal caller, we'll probably have to put it back in the future, but it can just be done in rc4.c to save problems. BUG=448386 Change-Id: I3846617a0e3d73ec9e5ec3638a53364adbbc6260 Reviewed-on: https://boringssl-review.googlesource.com/3520 Reviewed-by: David Benjamin <davidben@chromium.org> Reviewed-by: Adam Langley <agl@google.com>
2015-02-19Mark OPENSSL_armcap_P as hidden in ARM asm.Adam Langley
This is an import from ARM. Without this, one of the Android builds of BoringSSL was failing with: (sha512-armv4.o): requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC This is (I believe) a very misleading error message. The R_ARM_REL32 relocation type is the correct type for position independent code. But unless the target symbol is hidden then the linker doesn't know that it's not going to be overridden by a different ELF module. Chromium probably gets away with this because of different default compiler flags than Android. Change-Id: I967eabc4d6b33d1e6635caaf6e7a306e4e77c101 Reviewed-on: https://boringssl-review.googlesource.com/3471 Reviewed-by: Adam Langley <agl@google.com>
2015-02-18Remove X509_get_pubkey_parameters.David Benjamin
It's never called in outside code. This too seems to be a remnant of the DSA PKIX optional parameter stuff. This is confirmed both by a removed comment and by the brief documentation at http://www.umich.edu/~x509/ssleay/x509_pkey.html RFC 5480 does not allow ECDSA keys to be missing parameters, so this logic is incorrect for ECDSA anyway. It was also failing to check EVP_PKEY_copy_parameters' return value. And that logic looks pretty suspect if you have a chain made up multiple certificate types. Change-Id: Id6c60659a0162356c7f3eae5c797047366baae1c Reviewed-on: https://boringssl-review.googlesource.com/3485 Reviewed-by: Adam Langley <agl@google.com>
2015-02-17Add some missing error failure checks.David Benjamin
Found while diagnosing some crashes and hangs in the malloc tests. This (and the follow-up) get us further but does not quite let the malloc tests pass quietly, even without valgrind. DTLS silently ignores some malloc failures (confusion with silently dropping bad packets) which then translate to hangs. Change-Id: Ief06a671e0973d09d2883432b89a86259e346653 Reviewed-on: https://boringssl-review.googlesource.com/3482 Reviewed-by: Adam Langley <agl@google.com>
2015-02-14Switch nonce type in chacha_vec.c to uint32_t.Adam Langley
This was suggested in https://boringssl-review.googlesource.com/#/c/3460 but I forgot to upload the change before submitting in Gerrit. Change-Id: I3a333fe2e8880603a9027638dd013f21d8270638
2015-02-13Don't require the ChaCha nonce to be aligned on ARM.Adam Langley
Change-Id: I34ee66fcc53d3371591beee3373c46598c31b5c5 Reviewed-on: https://boringssl-review.googlesource.com/3460 Reviewed-by: David Benjamin <davidben@chromium.org> Reviewed-by: Adam Langley <agl@google.com>
2015-02-13Remove support for zero lengths from do_x509_check.Adam Langley
Change-Id: I9ea838850d4c7ea8280cacb1a275b2d6cee1cbbe
2015-02-13Update API to use (char *) for email addresses and hostnames.Adam Langley
Reduces number of silly casts in OpenSSL code and likely most applications. Consistent with (char *) for "peername" value from X509_check_host() and X509_VERIFY_PARAM_get0_peername(). (Imported from upstream's e83c913723fac7432a7706812f12394aaa00e8ce.) Change-Id: Id0fc11773a0cee8933978cd4bdbd8251fd7cfb5f
2015-02-13Set optional peername when X509_check_host() succeeds.Adam Langley
Pass address of X509_VERIFY_PARAM_ID peername to X509_check_host(). (Imported from upstream's 55fe56837a65ff505b492aa6aee748bf5fa91fec.) Change-Id: Ic21bfb361b8eb25677c4c2175882fa95ea44fc31
2015-02-13New peername element in X509_VERIFY_PARAM_ID.Adam Langley
Declaration, memory management, accessor and documentation. (Imported from upstream's 1eb57ae2b78c119bfba7ab647951130e968d1664.) Change-Id: Ifa9672e46445e44a78001b0f9430a93c138d73d7
2015-02-13More complete input validation of X509_check_mumble.Adam Langley
(Imported from upstream's 3d15d58e55b97207188e87708a0e7f49b4bfd7fd.) Change-Id: Iae9e3f839e03c22dc45ac2151884e7afcf31af7b
2015-02-13Multiple verifier reference identities.Adam Langley
(Imported from upstream's 8abffa4a73fcbf6536e0a42d736ed9211a8204ea, 9624b50d51de25bb2e3a72e81fe45032d80ea5c2 and 41e3ebd5abacfdf98461cdeb6fa97a4175b7aad3.) Change-Id: Ic9099eb5704b19b4500229e89351371cc6184f9d
2015-02-13Add sk_deep_copy and its macro.Adam Langley
The next change imported from upstream needs this function. Change-Id: I547efa1f7f46f0558e88047837a26ede32b19275
2015-02-13X509_check_mumble() failure is <= 0, not just 0.Adam Langley
(This change is for a future change that increases the range of the return values.) (Imported from upstream's 3fc0b1edad0c75d7beb51fa77f63ffe817295e2c.) Change-Id: I221d4ee0e90586f89f731e01ff4d813058173211
2015-02-13Drop hostlen from X509_VERIFY_PARAM_ID.Adam Langley
Just store NUL-terminated strings. This works better when we add support for multiple hostnames. (Imported from upstream's d93edc0aab98377f42dd19312248597a018a7889.) Change-Id: Ib3bf8a8c654b829b4432782ba21ba55c3d4a0582
2015-02-13Fix more memory leaks on malloc failure.David Benjamin
Caught by malloc valgrind tests on Basic-Client-Sync. Also one by inspection and verified with valgrind. Those should pass now with the exception of CRYPTO_free_ex_data being internally implemented with malloc. (Clearly we next should make our malloc tests assert that the containing function fails to catch when we fail to check for some error and things silently move one.) Change-Id: I56c51dc8a32a7d3c7ac907d54015dc241728c761 Reviewed-on: https://boringssl-review.googlesource.com/3440 Reviewed-by: Adam Langley <agl@google.com>
2015-02-12Add in missing curly braces part 3.David Benjamin
Everything else. Change-Id: Iac02b144465b4e7b6d69ea22ff2aaf52695ae732
2015-02-12Add in missing curly braces part 2.David Benjamin
ECC code. Change-Id: I1a960620edbb30e10dcbab0e8053a1deb9db3262 Reviewed-on: https://boringssl-review.googlesource.com/3402 Reviewed-by: Adam Langley <agl@google.com>
2015-02-12Fix standalone build on Win64.David Benjamin
Win64 fires significantly more warnings than Win32. Also some recent changes made it grumpy. (We might want to reconsider enabling all of MSVC's warnings. Given the sorts of warnings some of these are, I'm not sure MSVC's version of -Wall -Werror is actually tenable. Plus, diverging from the Chromium build, especially before the bots are ready, is going to break pretty readily.) Change-Id: If3b8feccf910ceab4a233b0731e7624d7da46f87 Reviewed-on: https://boringssl-review.googlesource.com/3420 Reviewed-by: Adam Langley <agl@google.com>
2015-02-12Reset all the error codes.David Benjamin
This saves about 6-7k of error data. Change-Id: Ic28593d4a1f5454f00fb2399d281c351ee57fb14 Reviewed-on: https://boringssl-review.googlesource.com/3385 Reviewed-by: Adam Langley <agl@google.com>
2015-02-12Fix cross-module errors.David Benjamin
Some files in crypto/x509 were moved from crypto/asn1, so they emit errors from another module. Fix make_errors.go to account for this: cross module errors must use the foreign module as the first argument to OPENSSL_PUT_ERROR. Both the function code and the error code should be declared in the foreign module. Update make_errors.go to ignore cross-module error lines when deciding which function tokens to emit. Change-Id: Ic38377ddd56e22d033ef91318c30510762f6445d Reviewed-on: https://boringssl-review.googlesource.com/3383 Reviewed-by: Adam Langley <agl@google.com>
2015-02-11Add in missing curly braces part 1.David Benjamin
Everything before crypto/ec. Change-Id: Icbfab8e4ffe5cc56bf465eb57d3fdad3959a085c Reviewed-on: https://boringssl-review.googlesource.com/3401 Reviewed-by: Adam Langley <agl@google.com>
2015-02-11Fix some function parameters in OPENSSL_PUT_ERROR.David Benjamin
We have got to get rid of that parameter... Change-Id: I17f2d1282636f7d077f21dabdc135eecf9300998 Reviewed-on: https://boringssl-review.googlesource.com/3384 Reviewed-by: Adam Langley <agl@google.com>
2015-02-10Split error string data across multiple lines.David Benjamin
Otherwise running git grep for a single function gives a ton of noise. Change-Id: I18900d6269fd2be39ef9b579419aee1c7eca9143 Reviewed-on: https://boringssl-review.googlesource.com/3382 Reviewed-by: Adam Langley <agl@google.com>
2015-02-10Make err_data_generate.go reproducible.David Benjamin
Sort all the files before processing them. Change-Id: Id6b4519fa22f1770bb2ba2a792f5c27de9ea452d Reviewed-on: https://boringssl-review.googlesource.com/3380 Reviewed-by: Adam Langley <agl@google.com>
2015-02-10Remove more bits of ERR_STRING_DATA.Adam Langley
Also, Clang doesn't like static asserts with the same message and ERR_free_strings should still free the error queues, although it's badly misnamed now. Change-Id: Ibff8eb50f93c0b56c3eeb17a300e8501a31c3ab8 Reviewed-on: https://boringssl-review.googlesource.com/3370 Reviewed-by: David Benjamin <davidben@chromium.org> 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-10Fix memory leak on malloc failure.David Benjamin
Found by running malloc tests with -valgrind. Unfortunately, the next one is deep in crypto/asn1 itself, so I'm going to stop here for now. Change-Id: I7a33971ee07c6b7b7a98715f2f18e0f29380c0a1 Reviewed-on: https://boringssl-review.googlesource.com/3350 Reviewed-by: Adam Langley <agl@google.com>
2015-02-09Fix some unchecked mallocs.David Benjamin
BUG=456599 Change-Id: Id0652c2aff1cb8a5de35350feb8410285b3fef20 Reviewed-on: https://boringssl-review.googlesource.com/3330 Reviewed-by: Adam Langley <agl@google.com>
2015-02-06Fix memory-leak in evp_test.Adam Langley
Change-Id: Ibdaeeaa45dbdb31921ae7e99a4eb3708f99ccaa9 Reviewed-on: https://boringssl-review.googlesource.com/3301 Reviewed-by: Adam Langley <agl@google.com>
2015-02-06Remove support for dynamic METHODs.Adam Langley
The ENGINE code had a concept of a stable-ABI for METHODs, because that might be a useful thing in the future when people want to have blobs that wrap PKCS#11 or something. However, at the moment nobody uses this feature and it didn't work very well anyway: I hadn't updated |ENGINE_free| to free them all and |set_method| was copying the methods, but not resetting the |is_static| flag. This change removes support for non-static methods. We can always put it back later if we need. Change-Id: Ic7401c8cb1cadd46b26a215f85bc48562efe9919 Reviewed-on: https://boringssl-review.googlesource.com/3300 Reviewed-by: Adam Langley <agl@google.com>
2015-02-03Don't probe for NEON with SIGILL on aarch64.Adam Langley
We assume that AArch64 systems are modern enough to have getauxval. Change-Id: I4cc74f04ca5ed50b8ca1cfd00afeaaa01c6caca0 Reviewed-on: https://boringssl-review.googlesource.com/3280 Reviewed-by: Adam Langley <agl@google.com>
2015-02-03Don't accept tag number 31 (long form identifier octets) in CBB_add_asn1.Doug Hogan
Tag number 31 is a long form tag that requires multiple octets. It cannot be handled by adding a single uint8. Changed CBB_add_asn1() to return 0 when it is passed in the extension for tag 31. Change-Id: Ia33936d4f174d1a7176eb11da0b5c7370efb9416
2015-02-03Move free from cbb_init() to only CBB_init().Doug Hogan
CBB_init_fixed() should not call free because it can lead to use after free or double free bugs. The caller should be responsible for creating and destroying the buffer. In the current code, ssl3_get_v2_client_hello() may free s->init_buf->data via CBB_init_fixed(). It can also be freed via SSL_free(s) since ssl3_get_v2_client_hello() doesn't set it to NULL and CBB_init_fixed() can't set the caller's pointer to NULL. Change-Id: Ia05a67ae25af7eb4fb04f08f20d50d912b41e38b
2015-02-03Don't assume alignment of ChaCha key on ARM.Adam Langley
When addressing [1], I checked the AEAD code but brain-farted: a key is aligned in that code, but it's the Poly1305 key, which doesn't matter here. It would be nice to align the ChaCha key too, but Android doesn't have |posix_memalign| in the versions that we care about. It does have |memalign|, but that's documented as "obsolete" and we don't have a concept of an Android OS yet and I don't want to add one just for this. So this change uses the buffer for loading the key again. (Note that we never used to check for alignment of the |key| before calling this. We must have gotten it for free somehow when checking the alignment of |in| and |out|. But there are clearly some paths that don't have an aligned key: https://code.google.com/p/chromium/issues/detail?id=454308.) At least the generation script started paying off immediately ☺. [1] https://boringssl-review.googlesource.com/#/c/3132/1/crypto/chacha/chacha_vec.c@185 Change-Id: I4f893ba0733440fddd453f9636cc2aeaf05076ed Reviewed-on: https://boringssl-review.googlesource.com/3270 Reviewed-by: Adam Langley <agl@google.com>