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 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-12Assume that MSVC supports C++11.Adam Langley
MSVC doesn't define __cplusplus as 201103 to indicate C++11 support, so just assume that the compiler supports C++11 if _MSC_VER is defined. Change-Id: I27f6eeefe6e8dc522470f36fab76ab36d85eebac Reviewed-on: https://boringssl-review.googlesource.com/8734 Reviewed-by: David Benjamin <davidben@google.com>
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-05-05Do RSA blinding unless |e| is NULL and specifically requested not to.Brian Smith
Change-Id: I189db990df2a3cbf68f820a8f9f16142ccd7070f Reviewed-on: https://boringssl-review.googlesource.com/7595 Reviewed-by: David Benjamin <davidben@google.com>
2016-04-19Require the public exponent to be available in RSA blinding.Brian Smith
Require the public exponent to be available unless |RSA_FLAG_NO_BLINDING| is set on the key. Also, document this. If the public exponent |e| is not available, then we could compute it from |p|, |q|, and |d|. However, there's no reasonable situation in which we'd have |p| or |q| but not |e|; either we have all the CRT parameters, or we have (e, d, n), or we have only (d, n). The calculation to compute |e| exposes the private key to risk of side channel attacks. Also, it was particularly wasteful to compute |e| for each |BN_BLINDING| created, instead of just once before the first |BN_BLINDING| was created. |BN_BLINDING| now no longer needs to contain a duplicate copy of |e|, so it is now more space-efficient. Note that the condition |b->e != NULL| in |bn_blinding_update| was always true since commit cbf56a5683ddda831ff91c46ea48d1fba545db66. Change-Id: Ic2fd6980e0d359dcd53772a7c31bdd0267e316b4 Reviewed-on: https://boringssl-review.googlesource.com/7594 Reviewed-by: David Benjamin <davidben@google.com>
2016-04-18Drop support for engines-provided signature verification.Brian Smith
We do not need to support engine-provided verification methods. Change-Id: Iaad8369d403082b728c831167cc386fdcabfb067 Reviewed-on: https://boringssl-review.googlesource.com/7311 Reviewed-by: David Benjamin <davidben@google.com>
2016-04-14Export RSA_padding_add_PKCS1_OAEP[_mgf1]Adam Langley
This is needed by trousers. As with the PSS function, the version that assumes SHA-1 is put into decrepit. Change-Id: I153e8ea0150e48061b978384b600a7b990d21d03 Reviewed-on: https://boringssl-review.googlesource.com/7670 Reviewed-by: David Benjamin <davidben@google.com>
2016-03-30Drop support for custom |mod_exp| hooks in |RSA_METHOD|.Brian Smith
The documentation in |RSA_METHOD| says that the |ctx| parameter to |mod_exp| can be NULL, however the default implementation doesn't handle that case. That wouldn't matter since internally it is always called with a non-NULL |ctx| and it is static, but an external application could get a pointer to |mod_exp| by extracting it from the default |RSA_METHOD|. That's unlikely, but making that impossible reduces the chances that future refactorings will cause unexpected trouble. Change-Id: Ie0e35e9f107551a16b49c1eb91d0d3386604e594 Reviewed-on: https://boringssl-review.googlesource.com/7580 Reviewed-by: David Benjamin <davidben@google.com>
2016-03-25Always cache Montgomery contexts in RSA.Brian Smith
Simplify the code by always caching Montgomery contexts in the RSA structure, regardless of the |RSA_FLAG_CACHE_PUBLIC| and |RSA_FLAG_CACHE_PRIVATE| flags. Deprecate those flags. Now that we do this no more than once per key per RSA exponent, the private key exponents better because the initialization of the Montgomery contexts isn't perfectly side-channel protected. Change-Id: I4fbcfec0f2f628930bfeb811285b0ae3d103ac5e Reviewed-on: https://boringssl-review.googlesource.com/7521 Reviewed-by: David Benjamin <davidben@google.com>
2016-03-15Align with upstream's error strings, take two.David Benjamin
I messed up a few of these. ASN1_R_UNSUPPORTED_ALGORITHM doesn't exist. X509_R_UNSUPPORTED_ALGORITHM does exist as part of X509_PUBKEY_set, but the SPKI parser doesn't emit this. (I don't mind the legacy code having really weird errors, but since EVP is now limited to things we like, let's try to keep that clean.) To avoid churn in Conscrypt, we'll keep defining X509_R_UNSUPPORTED_ALGORITHM, but not actually do anything with it anymore. Conscrypt was already aware of EVP_R_UNSUPPORTED_ALGORITHM, so this should be fine. (I don't expect EVP_R_UNSUPPORTED_ALGORITHM to go away. The SPKI parsers we like live in EVP now.) A few other ASN1_R_* values didn't quite match upstream, so make those match again. Finally, I got some of the rsa_pss.c values wrong. Each of those corresponds to an (overly specific) RSA_R_* value in upstream. However, those were gone in BoringSSL since even the initial commit. We placed the RSA <-> EVP glue in crypto/evp (so crypto/rsa wouldn't depend on crypto/evp) while upstream placed them in crypto/rsa. Since no one seemed to notice the loss of RSA_R_INVALID_SALT_LENGTH, let's undo all the cross-module errors inserted in crypto/rsa. Instead, since that kind of specificity is not useful, funnel it all into X509_R_INVALID_PSS_PARAMETERS (formerly EVP_R_INVALID_PSS_PARAMETERS, formerly RSA_R_INVALID_PSS_PARAMETERS). Reset the error codes for all affected modules. (That our error code story means error codes are not stable across this kind of refactoring is kind of a problem. Hopefully this will be the last of it.) Change-Id: Ibfb3a0ac340bfc777bc7de6980ef3ddf0a8c84bc Reviewed-on: https://boringssl-review.googlesource.com/7458 Reviewed-by: Emily Stark (Dunn) <estark@google.com> Reviewed-by: David Benjamin <davidben@google.com>
2016-03-12Match upstream's error codes for the old sigalg code.David Benjamin
People seem to condition on these a lot. Since this code has now been moved twice, just make them all cross-module errors rather than leave a trail of renamed error codes in our wake. Change-Id: Iea18ab3d320f03cf29a64a27acca119768c4115c Reviewed-on: https://boringssl-review.googlesource.com/7431 Reviewed-by: Emily Stark (Dunn) <estark@google.com> Reviewed-by: David Benjamin <davidben@google.com>
2016-03-09Always use |BN_mod_exp_mont|/|BN_mod_exp_mont_consttime| in RSA.Brian Smith
This removes a hard dependency on |BN_mod_exp|, which will allow the linker to drop it in programs that don't use other features that require it. Also, remove the |mont| member of |bn_blinding_st| in favor of having callers pass it when necssaary. The |mont| member was a weak reference, and weak references tend to be error-prone. Finally, reduce the scope of some parts of the blinding code to |static|. Change-Id: I16d8ccc2d6d950c1bb40377988daf1a377a21fe6 Reviewed-on: https://boringssl-review.googlesource.com/7111 Reviewed-by: David Benjamin <davidben@google.com>
2016-03-08Add |RSA_[padding_add|verify]_PKCS1_PSS to decrepit.Adam Langley
These functions are just like the _mgf1 versions but omit one of the parameters. It's easier to add them than to patch the callers in some cases. Change-Id: Idee5b81374bf15f2ea89b7e0c06400c2badbb275 Reviewed-on: https://boringssl-review.googlesource.com/7362 Reviewed-by: David Benjamin <davidben@google.com>
2016-02-27Move all signature algorithm code to crypto/x509.David Benjamin
All the signature algorithm logic depends on X509_ALGOR. This also removes the X509_ALGOR-based EVP functions which are no longer used externally. I think those APIs were a mistake on my part. The use in Chromium was unnecessary (and has since been removed anyway). The new X.509 stack will want to process the signatureAlgorithm itself to be able to enforce policies on it. This also moves the RSA_PSS_PARAMS bits to crypto/x509 from crypto/rsa. That struct is also tied to crypto/x509. Any new RSA-PSS code would have to use something else anyway. BUG=499653 Change-Id: I6c4b4573b2800a2e0f863d35df94d048864b7c41 Reviewed-on: https://boringssl-review.googlesource.com/7025 Reviewed-by: Adam Langley <agl@google.com>
2016-01-19Update comments to better document in-place semantics.Adam Langley
(Comment-only change; no functional difference.) Some code was broken by the |d2i_ECDSA_SIG| change in 87897a8c. It was passing in a pointer to an existing |ECDSA_SIG| as the first argument and then simply assuming that the structure would be updated in place. The comments on the function suggested that this was reasonable. This change updates the comments that use similar wording to either note that the function will never update in-place, or else to note that depending on that is a bad idea for the future. I've also audited all the uses of these functions that I can find and, in addition to the one case with |d2i_ECDSA_SIG|, there are several users of |d2i_PrivateKey| that could become a problem in the future. I'll try to fix them before it does become an issue. Change-Id: I769f7b2e0b5308d09ea07dd447e02fc161795071 Reviewed-on: https://boringssl-review.googlesource.com/6902 Reviewed-by: David Benjamin <davidben@chromium.org> Reviewed-by: Adam Langley <agl@google.com>
2015-12-22Simplify RSA key exchange padding check.David Benjamin
This check was fixed a while ago, but it could have been much simpler. In the RSA key exchange, the expected size of the output is known, making the padding check much simpler. There isn't any use in exporting the more general RSA_message_index_PKCS1_type_2. (Without knowing the expected size, any integrity check or swap to randomness or other mitigation is basically doomed to fail.) Verified with the valgrind uninitialized memory trick that we're still constant-time. Also update rsa.h to recommend against using the PKCS#1 v1.5 schemes. Thanks to Ryan Sleevi for the suggestion. Change-Id: I4328076b1d2e5e06617dd8907cdaa702635c2651 Reviewed-on: https://boringssl-review.googlesource.com/6613 Reviewed-by: Adam Langley <agl@google.com>
2015-12-16Remove the CRYPTO_EX_new callback.David Benjamin
This callback is never used. The one caller I've ever seen is in Android code which isn't built with BoringSSL and it was a no-op. It also doesn't actually make much sense. A callback cannot reasonably assume that it sees every, say, SSL_CTX created because the index may be registered after the first SSL_CTX is created. Nor is there any point in an EX_DATA consumer in one file knowing about an SSL_CTX created in completely unrelated code. Replace all the pointers with a typedef to int*. This will ensure code which passes NULL or 0 continues to compile while breaking code which passes an actual function. This simplifies some object creation functions which now needn't worry about CRYPTO_new_ex_data failing. (Also avoids bouncing on the lock, but it's taking a read lock, so this doesn't really matter.) BUG=391192 Change-Id: I02893883c6fa8693682075b7b130aa538a0a1437 Reviewed-on: https://boringssl-review.googlesource.com/6625 Reviewed-by: Adam Langley <agl@google.com>
2015-11-06Constify more BN_MONT_CTX parameters.David Benjamin
Most functions can take this in as const. Note this changes an RSA_METHOD hook, though one I would not expect anyone to override. Change-Id: Ib70ae65e5876b01169bdc594e465e3e3c4319a8b Reviewed-on: https://boringssl-review.googlesource.com/6419 Reviewed-by: Adam Langley <agl@google.com>
2015-11-04Free BN_MONT_CTX in generic code.David Benjamin
Although those are only created by code owned by RSA_METHOD, custom RSA_METHODs shouldn't be allowed to squat our internal fields and then change how you free things. Remove 'method' from their names now that they're not method-specific. Change-Id: I9494ef9a7754ad59ac9fba7fd463b3336d826e0b Reviewed-on: https://boringssl-review.googlesource.com/6423 Reviewed-by: Adam Langley <agl@google.com>
2015-10-20size_t RSA functions.Matt Braithwaite
This extends 79c59a30 to |RSA_public_encrypt|, |RSA_private_encrypt|, and |RSA_public_decrypt|. It benefits Conscrypt, which expects these functions to have the same signature as |RSA_public_private_decrypt|. Change-Id: Id1ce3118e8f20a9f43fd4f7bfc478c72a0c64e4b Reviewed-on: https://boringssl-review.googlesource.com/6286 Reviewed-by: David Benjamin <davidben@chromium.org> Reviewed-by: Adam Langley <agl@google.com>
2015-09-24size_t RSA_private_decrypt's input.David Benjamin
Change-Id: If05761052e235b38d9798b2fe4d8ba44293af891 Reviewed-on: https://boringssl-review.googlesource.com/5944 Reviewed-by: Adam Langley <agl@google.com>
2015-09-23Work around even more Estonian ID card misissuances.David Benjamin
Not content with signing negative RSA moduli, still other Estonian IDs have too many leading zeros. Work around those too. This workaround will be removed in six months. BUG=534766 Change-Id: Ica23b1b1499f9dbe39e94cf7b540900860e8e135 Reviewed-on: https://boringssl-review.googlesource.com/5980 Reviewed-by: Adam Langley <agl@google.com>
2015-09-16Work around broken Estonian smart cards. Again.David Benjamin
Estonian IDs issued between September 2014 to September 2015 are broken and use negative moduli. They last five years and are common enough that we need to work around this bug. Add parallel "buggy" versions of BN_cbs2unsigned and RSA_parse_public_key which tolerate this mistake, to align with OpenSSL's previous behavior. This code is currently hooked up to rsa_pub_decode in RSA_ASN1_METHOD so that d2i_X509 is tolerant. (This isn't a huge deal as the rest of that stack still uses the legacy ASN.1 code which is overly lenient in many other ways.) In future, when Chromium isn't using crypto/x509 and has more unified certificate handling code, we can put client certificates under a slightly different codepath, so this needn't hold for all certificates forever. Then in September 2019, when the broken Estonian certificates all expire, we can purge this codepath altogether. BUG=532048 Change-Id: Iadb245048c71dba2eec45dd066c4a6e077140751 Reviewed-on: https://boringssl-review.googlesource.com/5894 Reviewed-by: Adam Langley <agl@google.com>
2015-09-11Some documentation fixes.David Benjamin
We had a few duplicate section names. Change-Id: I0c9b2a1669ac14392fd577097d5ee8dd80f7c73c Reviewed-on: https://boringssl-review.googlesource.com/5824 Reviewed-by: Adam Langley <agl@google.com>
2015-08-07Make |RSA_PSS_PARAMS| public.Matt Braithwaite
Change-Id: I4a30b80a76cb4bb6e9bc488a915488b0a794520e Reviewed-on: https://boringssl-review.googlesource.com/5591 Reviewed-by: Adam Langley <agl@google.com>
2015-07-16Get rid of err function codes.David Benjamin
Running make_errors.go every time a function is renamed is incredibly tedious. Plus we keep getting them wrong. Instead, sample __func__ (__FUNCTION__ in MSVC) in the OPENSSL_PUT_ERROR macro and store it alongside file and line number. This doesn't change the format of ERR_print_errors, however ERR_error_string_n now uses the placeholder "OPENSSL_internal" rather than an actual function name since that only takes the uint32_t packed error code as input. This updates err scripts to not emit the function string table. The OPENSSL_PUT_ERROR invocations, for now, still include the extra parameter. That will be removed in a follow-up. BUG=468039 Change-Id: Iaa2ef56991fb58892fa8a1283b3b8b995fbb308d Reviewed-on: https://boringssl-review.googlesource.com/5275 Reviewed-by: Adam Langley <agl@google.com>
2015-07-08Parse RSAPrivateKey with CBS.David Benjamin
This removes the version field from RSA and instead handles versioning as part of parsing. (As a bonus, we now correctly limit multi-prime RSA to version 1 keys.) Most consumers are also converted. old_rsa_priv_{de,en}code are left alone for now. Those hooks are passed in parameters which match the old d2i/i2d pattern (they're only used in d2i_PrivateKey and i2d_PrivateKey). Include a test which, among other things, checks that public keys being serialized as private keys are handled properly. BUG=499653 Change-Id: Icdd5f0382c4a84f9c8867024f29756e1a306ba08 Reviewed-on: https://boringssl-review.googlesource.com/5273 Reviewed-by: Adam Langley <agl@google.com>
2015-07-08Parse RSAPublicKey with CBS.David Benjamin
BUG=499653 Change-Id: If5d98ed23e65a84f9f0e303024f91cce078f3d18 Reviewed-on: https://boringssl-review.googlesource.com/5272 Reviewed-by: Adam Langley <agl@google.com>
2015-06-24Restore |RSA_generate_key()| from OpenSSL at b4f0d1a.Matt Braithwaite
The callback arguments are required to be NULL. Change-Id: I266ec46efdaca411a7f0c2b645883b2c5bec1c96 Reviewed-on: https://boringssl-review.googlesource.com/5160 Reviewed-by: Adam Langley <agl@google.com>
2015-06-16Export pkcs1_prefixed_msg as RSA_add_pkcs1_prefix.David Benjamin
Platform crypto APIs for PKCS#1 RSA signatures vary between expecting the caller to prepend the DigestInfo prefix (RSA_sign_raw) and prepending it internally (RSA_sign). Currently, Chromium implements sign or sign_raw as appropriate. To avoid needing both variants, the new asynchronous methods will only expose the higher-level one, sign. To satisfy ports which previously implemented sign_raw, expose the DigestInfo prefix as a utility function. BUG=347404 Change-Id: I04c397b5e9502b2942f6698ecf81662a3c9282e6 Reviewed-on: https://boringssl-review.googlesource.com/4940 Reviewed-by: Adam Langley <agl@google.com>
2015-06-11Correct various documentation typosKenny Root
Some of the documentation had the right explanation but the incorrect function names attached. Change-Id: I7b479dae6d71a5ac7bc86df5a3890508c3b3d09f Reviewed-on: https://boringssl-review.googlesource.com/5090 Reviewed-by: Adam Langley <agl@google.com>
2015-06-05Multi-prime RSA support.Adam Langley
RSA with more than two primes is specified in https://tools.ietf.org/html/rfc3447, although the idea goes back far earier than that. This change ports some of the changes in http://rt.openssl.org/Ticket/Display.html?id=3477&user=guest&pass=guest to BoringSSL—specifically those bits that are under an OpenSSL license. Change-Id: I51e8e345e2148702b8ce12e00518f6ef4683d3e1 Reviewed-on: https://boringssl-review.googlesource.com/4870 Reviewed-by: Adam Langley <agl@google.com>
2015-05-20Convert reference counts in crypto/Adam Langley
This change converts the reference counts in crypto/ to use |CRYPTO_refcount_t|. The reference counts in |X509_PKEY| and |X509_INFO| were never actually used and so were dropped. Change-Id: I75d572cdac1f8c1083c482e29c9519282d7fd16c Reviewed-on: https://boringssl-review.googlesource.com/4772 Reviewed-by: Adam Langley <agl@google.com>
2015-04-16Unexpose the generic ex_data functions.David Benjamin
Callers are required to use the wrappers now. They still need OPENSSL_EXPORT since crypto and ssl get built separately in the standalone shared library build. Change-Id: I61186964e6099b9b589c4cd45b8314dcb2210c89 Reviewed-on: https://boringssl-review.googlesource.com/4372 Reviewed-by: Adam Langley <agl@google.com>
2015-04-15Fix typos in documentation in rsa.h.Brian Smith
Change-Id: I0fb680d088425df8fca558bf8d4213f251eb0a96 Reviewed-on: https://boringssl-review.googlesource.com/4340 Reviewed-by: Adam Langley <agl@google.com>
2015-04-14Compatibility changes for wpa_supplicant and OpenSSH.Adam Langley
OpenSSH, especially, does some terrible things that mean that it needs the EVP_CIPHER structure to be exposed ☹. Damian is open to a better API to replace this, but only if OpenSSL agree too. Either way, it won't be happening soon. Change-Id: I393b7a6af6694d4d2fe9ebcccd40286eff4029bd Reviewed-on: https://boringssl-review.googlesource.com/4330 Reviewed-by: Adam Langley <agl@google.com>
2015-04-14Convert BN_MONT_CTX to new-style locking.Adam Langley
This introduces a per-RSA/DSA/DH lock. This is good for lock contention, although pthread locks are depressingly bloated. Change-Id: I07c4d1606fc35135fc141ebe6ba904a28c8f8a0c Reviewed-on: https://boringssl-review.googlesource.com/4324 Reviewed-by: Adam Langley <agl@google.com>
2015-04-09Fix up whitespace in headers for doc.go.Adam Langley
Also, set sensible defaults for the command-line arguments to doc.go. Change-Id: Iefd2ade4c9095489efa0ae1059007593fc84923a
2015-04-01Export the PSS padding functions.Adam Langley
(system/keymaster is using them now.) Change-Id: I8fba501005b9318b7d3a76bf1715fb772b23c49d Reviewed-on: https://boringssl-review.googlesource.com/4092 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-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>
2014-11-19Add EVP_PKEY_supports_digest.David Benjamin
This is intended for TLS client auth with Windows CAPI- and CNG-backed keys which implement sign over sign_raw and do not support all hash functions. Only plumbed through RSA for now. Change-Id: Ica42e7fb026840f817a169da9372dda226f7d6fd Reviewed-on: https://boringssl-review.googlesource.com/2250 Reviewed-by: Adam Langley <agl@google.com>
2014-08-19Fix minor comment typos.Adam Langley
Change-Id: If7752709727fe33ba38a9d414089253bb2f89ea2 Reviewed-on: https://boringssl-review.googlesource.com/1558 Reviewed-by: David Benjamin <davidben@chromium.org> Reviewed-by: Adam Langley <agl@google.com>
2014-08-19Split off private_transform function in RSA.Adam Langley
This change extracts two, common parts of RSA_decrypt and RSA_sign into a function called |private_transform|. It also allows this to be overridden in a method, which is convenient for opaque keys that only expose the raw RSA transform as it means that the padding code from BoringSSL can be easily reimplemented. One significant change here is that short RSA ciphertexts will no longer be accepted. I think this is correct and OpenSSL has a comment about PGP mistakenly stripping leading zeros. However, these is the possibility that it could break something. Change-Id: I258c5cbbf21314cc9b6e8d2a2b898fd9a440cd40 Reviewed-on: https://boringssl-review.googlesource.com/1554 Reviewed-by: Adam Langley <agl@google.com>
2014-08-04Spell Bleichenbacher's name right.David Benjamin
Change-Id: I2096f760165f7aaa9b5d922a2e6d4d755365087b Reviewed-on: https://boringssl-review.googlesource.com/1372 Reviewed-by: Adam Langley <agl@google.com>
2014-08-01Add visibility rules.Adam Langley
This change marks public symbols as dynamically exported. This means that it becomes viable to build a shared library of libcrypto and libssl with -fvisibility=hidden. On Windows, one not only needs to mark functions for export in a component, but also for import when using them from a different component. Because of this we have to build with |BORINGSSL_IMPLEMENTATION| defined when building the code. Other components, when including our headers, won't have that defined and then the |OPENSSL_EXPORT| tag becomes an import tag instead. See the #defines in base.h In the asm code, symbols are now hidden by default and those that need to be exported are wrapped by a C function. In order to support Chromium, a couple of libssl functions were moved to ssl.h from ssl_locl.h: ssl_get_new_session and ssl_update_cache. Change-Id: Ib4b76e2f1983ee066e7806c24721e8626d08a261 Reviewed-on: https://boringssl-review.googlesource.com/1350 Reviewed-by: Adam Langley <agl@google.com>
2014-07-30Align EVP return values with BoringSSL convention.Adam Langley
Where possible, functions should return one for success and zero for error. The use of additional negative values to indicate an error is, itself, error prone. This change fixes many EVP functions to remove the possibility of negative return values. Existing code that is testing for <= 0 will continue to function, although there is the possibility that some code was differentiating between negative values (error) and zero (invalid signature) for the verify functions and will now show the wrong error message. Change-Id: I982512596bb18a82df65861394dbd7487783bd3d Reviewed-on: https://boringssl-review.googlesource.com/1333 Reviewed-by: Adam Langley <agl@google.com>
2014-07-29Add RSA_check_key function.Adam Langley
This is function that is available in OpenSSL too. Here it only returns zero or one and doesn't do expensive primality checks on p and q. https://code.google.com/p/chromium/issues/detail?id=396250 Change-Id: I7a173da26e06440dbb595fb717e3a620edf23576 Reviewed-on: https://boringssl-review.googlesource.com/1334 Reviewed-by: Adam Langley <agl@google.com>
2014-07-26Improve constant-time padding check in RSA key exchange.David Benjamin
Although the PKCS#1 padding check is internally constant-time, it is not constant time at the crypto/ ssl/ API boundary. Expose a constant-time RSA_message_index_PKCS1_type_2 function and integrate it into the timing-sensitive portion of the RSA key exchange logic. Change-Id: I6fa64ddc9d65564d05529d9b2985da7650d058c3 Reviewed-on: https://boringssl-review.googlesource.com/1301 Reviewed-by: Adam Langley <agl@google.com>
2014-07-19Introduce EVP_PKEY_is_opaque to replace RSA_METHOD_FLAG_NO_CHECK.David Benjamin
Custom RSA and ECDSA keys may not expose the key material. Plumb and "opaque" bit out of the *_METHOD up to EVP_PKEY. Query that in ssl_rsa.c to skip the sanity checks for certificate and key matching. Change-Id: I362a2d5116bfd1803560dfca1d69a91153e895fc Reviewed-on: https://boringssl-review.googlesource.com/1255 Reviewed-by: Adam Langley <agl@google.com>