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-05-03Add checks to X509_NAME_oneline()David Benjamin
Sanity check field lengths and sums to avoid potential overflows and reject excessively large X509_NAME structures. Issue reported by Guido Vranken. (Imported from upstream's 9b08619cb45e75541809b1154c90e1a00450e537.) Change-Id: Ib2e1e7cd086f9c3f0d689d61947f8ec3e9220049 Reviewed-on: https://boringssl-review.googlesource.com/7842 Reviewed-by: Adam Langley <agl@google.com>
2016-03-31Remove some easy obj.h dependencies.David Benjamin
A lot of consumers of obj.h only want the NID values. Others didn't need it at all. This also removes some OBJ_nid2sn and OBJ_nid2ln calls in EVP error paths which isn't worth pulling a large table in for. BUG=chromium:499653 Change-Id: Id6dff578f993012e35b740a13b8e4f9c2edc0744 Reviewed-on: https://boringssl-review.googlesource.com/7563 Reviewed-by: David Benjamin <davidben@google.com>
2016-03-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-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>
2015-12-22Resolve a few old TODOs.David Benjamin
A lot of commented-out code we haven't had to put them back, so these can go now. Also remove the TODO about OAEP having a weird API. The API is wrong, but upstream's shipped it with the wrong API, so that's what it is now. Change-Id: I7da607cf2d877cbede41ccdada31380f812f6dfa Reviewed-on: https://boringssl-review.googlesource.com/6763 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-10-20Ditch remaining filename comments from public headers and ssl/David Benjamin
Change-Id: I8fc795d18aacb0c929b82e7d58514b22103e2106 Reviewed-on: https://boringssl-review.googlesource.com/6292 Reviewed-by: Adam Langley <alangley@gmail.com>
2015-09-01Add X509_CRL_up_ref.David Benjamin
(Imported from upstream's 65cbf983ca4f69b8954f949c2edaaa48824481b3.) Change-Id: I1e5d26ed8da5a44f68d22385b31d413628229c50 Reviewed-on: https://boringssl-review.googlesource.com/5784 Reviewed-by: Adam Langley <agl@google.com>
2015-08-05Don't define typedefs twice.David Benjamin
16f774f8bf13829fef162c7790661785dc4721b2 adds forward declarations for everything in x509.h, but the typedefs are still in x509.h. Some versions of clang flag the duplicate typedefs in C code. Change-Id: Ib6684a238681d8c4fb1f0f91c3a6110013b3f4d6 Reviewed-on: https://boringssl-review.googlesource.com/5580 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-06-24Restore |X509_REQ_print| and friends, from OpenSSL at ce7e647b.Matt Braithwaite
Change-Id: Id388510834ac30b0dbccfef0b8276f57656f1dfd Reviewed-on: https://boringssl-review.googlesource.com/5210 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-02-28Add support for reading PKCS#7 data from PEM files.Adam Langley
(There are times when I actually miss C++ templates.) Change-Id: I3db56e4946ae4fb919105fa33e2cfce3c7542d37 Reviewed-on: https://boringssl-review.googlesource.com/3700 Reviewed-by: Adam Langley <agl@google.com>
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-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-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-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-09Fix various certificate fingerprint issues.Adam Langley
By using non-DER or invalid encodings outside the signed portion of a certificate the fingerprint can be changed without breaking the signature. Although no details of the signed portion of the certificate can be changed this can cause problems with some applications: e.g. those using the certificate fingerprint for blacklists. 1. Reject signatures with non zero unused bits. If the BIT STRING containing the signature has non zero unused bits reject the signature. All current signature algorithms require zero unused bits. 2. Check certificate algorithm consistency. Check the AlgorithmIdentifier inside TBS matches the one in the certificate signature. NB: this will result in signature failure errors for some broken certificates. 3. Check DSA/ECDSA signatures use DER. Reencode DSA/ECDSA signatures and compare with the original received signature. Return an error if there is a mismatch. This will reject various cases including garbage after signature (thanks to Antti Karjalainen and Tuomo Untinen from the Codenomicon CROSS program for discovering this case) and use of BER or invalid ASN.1 INTEGERs (negative or with leading zeroes). CVE-2014-8275 (Imported from upstream's 85cfc188c06bd046420ae70dd6e302f9efe022a9 and 4c52816d35681c0533c25fdd3abb4b7c6962302d) Change-Id: Ic901aea8ea6457df27dc542a11c30464561e322b Reviewed-on: https://boringssl-review.googlesource.com/2783 Reviewed-by: David Benjamin <davidben@chromium.org> Reviewed-by: Adam Langley <agl@google.com>
2014-12-02unifdef OPENSSL_NO_BIO.David Benjamin
Get that out of the way. Change-Id: Ia61f47f1e23595a1d4876a85ae7518f11f4ab6a0 Reviewed-on: https://boringssl-review.googlesource.com/2401 Reviewed-by: Adam Langley <agl@google.com>
2014-11-11Remove i2d_X509_PKEY and d2i_X509_PKEY.David Benjamin
One of them was never implemented upstream or downstream. The other no longer works in BoringSSL. They're not used within BoringSSL (this still compiles), even in X509_INFO, and do not appear to be used by consumers. If they were, we would like to know via a compile failure. This removes the last consumer within BoringSSL of the ASN.1 parsing macros. Change-Id: Ifb72b1fcd0a4f7b3e6b081486f8638110872334b Reviewed-on: https://boringssl-review.googlesource.com/2203 Reviewed-by: Adam Langley <agl@google.com>
2014-10-29Move the X509_NAME typedef into x509.h.David Benjamin
X509_NAME is one of the symbols that collide with wincrypt.h. Move it to x509.h so libraries which only use the pure-crypto portions of BoringSSL without X.509 needn't have to resolve the collision. Change-Id: I057873498e58fe4a4cf264356f9a58d7a15397b7 Reviewed-on: https://boringssl-review.googlesource.com/2080 Reviewed-by: Adam Langley <agl@google.com>
2014-10-14Don't mix and match libraries and errors.David Benjamin
The same library code applies for both the error and the function, so modules cannot easily report errors from each other. Switch evp/algorithm.c's error codes to the EVP library. Remove the original error codes so it's obvious some changes are needed. - X509_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED -> EVP_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED -> EVP_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED (Actually, the X509 version of this error code doesn't exist in OpenSSL. It should have been ASN1.) - ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM -> EVP_R_UNKNOWN_SIGNATURE_ALGORITHM - ASN1_R_WRONG_PUBLIC_KEY_TYPE -> EVP_R_WRONG_PUBLIC_KEY_TYPE - ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM -> EVP_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM Change-Id: I05b1a05b465d800c85f7d63ca74588edf40847b9 Reviewed-on: https://boringssl-review.googlesource.com/1940 Reviewed-by: Adam Langley <agl@google.com>
2014-10-10Remove #if-0'd ASN1_sign.David Benjamin
Verified that nothing uses it. Change-Id: I1755144129e274f3d1680ddb8cb12273070eb078 Reviewed-on: https://boringssl-review.googlesource.com/1912 Reviewed-by: Adam Langley <agl@google.com>
2014-08-28unifdef a bunch of OPENSSL_NO_* ifdefs.David Benjamin
Get all this stuff out of the way. - OPENSSL_NO_MD5 - OPENSSL_NO_SHA - OPENSSL_NO_EC - OPENSSL_NO_ECDSA - OPENSSL_NO_ECDH - OPENSSL_NO_NEXTPROTONEG - OPENSSL_NO_DH - OPENSSL_NO_SSL3 - OPENSSL_NO_RC4 - OPENSSL_NO_RSA Also manually removed a couple instances of OPENSSL_NO_DSA that seemed to be confused anyway. Did some minor manual cleanup. (Removed a few now-pointless 'if (0)'s.) Change-Id: Id540ba97ee22ff2309ab20ceb24c7eabe766d4c4 Reviewed-on: https://boringssl-review.googlesource.com/1662 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-08-07Add PKCS7_bundle_certificates.Adam Langley
This function serialises a PKCS#7 structure containing a number of certificates. Change-Id: Iaf15887e1060d5d201d5a3dd3dca8d51105ee6d6 Reviewed-on: https://boringssl-review.googlesource.com/1431 Reviewed-by: Adam Langley <agl@google.com>
2014-08-07Add X509_up_ref and use it internally.David Benjamin
Avoid needing to manually increment the reference count and using the right lock, both here and in Chromium. Change-Id: If116ebc224cfb1c4711f7e2c06f1fd2c97af21dd Reviewed-on: https://boringssl-review.googlesource.com/1415 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-15Move public headers to include/openssl/Adam Langley
Previously, public headers lived next to the respective code and there were symlinks from include/openssl to them. This doesn't work on Windows. This change moves the headers to live in include/openssl. In cases where some symlinks pointed to the same header, I've added a file that just includes the intended target. These cases are all for backwards-compat. Change-Id: I6e285b74caf621c644b5168a4877db226b07fd92 Reviewed-on: https://boringssl-review.googlesource.com/1180 Reviewed-by: David Benjamin <davidben@chromium.org> Reviewed-by: Adam Langley <agl@google.com>
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.)