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-06-14Remove ASN.1 BIOs.David Benjamin
These are more remnants of CMS. Nothing uses them directly. Removing them means more code we don't have to think about when importing upstream patches. Also take out a bunch of dead prototypes nearby. Change-Id: Ife094d9d2078570006d1355fa4e3323f435be608 Reviewed-on: https://boringssl-review.googlesource.com/8244 Reviewed-by: David Benjamin <davidben@google.com>
2016-06-14Remove ASN1_parse and ASN1_parse_dump.David Benjamin
These are more pretty-printers for generic ASN.1 structures. They're never called externally and otherwise are only used in the X509V3_EXT_PARSE_UNKNOWN mode for the X509 pretty-print functions. That makes unknown extensions pretty-print as ASN.1 structures. This is a rather useless feature, so have that fall through to X509V3_EXT_DUMP_UNKNOWN which does a hexdump instead. (The immediate trigger is I don't know what |op| is in upstream's 8c918b7b9c93ba38790ffd1a83e23c3684e66f57 and don't think it is worth the time to puzzle that out and verify it. Better ditch this code completely.) Change-Id: I0217906367d83056030aea64ef344d4fedf74763 Reviewed-on: https://boringssl-review.googlesource.com/8243 Reviewed-by: David Benjamin <davidben@google.com>
2016-06-14Remove ASN.1 print hooks.David Benjamin
These functions are never instantiated. (They're a remnant of the PKCS#7 and CMS bits.) Next time upstream touches this code, we don't have to puzzle through the diff and import it. Change-Id: I67c2102ae13e8e0527d858e1c63637dd442a4ffb Reviewed-on: https://boringssl-review.googlesource.com/8242 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-01ASN1_get_object should not accept large universal tags.David Benjamin
The high bits of the type get used for the V_ASN1_NEG bit, so when used with ASN1_ANY/ASN1_TYPE, universal tags become ambiguous. This allows one to create a negative zero, which should be impossible. Impose an upper bound on universal tags accepted by crypto/asn1 and add a test. BUG=590615 Change-Id: I363e01ebfde621c8865101f5bcbd5f323fb59e79 Reviewed-on: https://boringssl-review.googlesource.com/7238 Reviewed-by: Adam Langley <agl@google.com>
2016-02-27Move ASN1_bn_print to a static function in evp/print.c.David Benjamin
It's not used anywhere else, in the library or consumers (Google ones or ones I could find on Debian codesearch). This is a sufficiently specialized function that the risk of a third-party library newly depending on it is low. This removes the last include of asn1.h or x509.h in crypto/evp. (This is almost entirely cosmetic because it wasn't keeping the static linker from doing the right thing anyway. But if we were want to separate the legacy ASN.1 stack into its own decrepit-like target, we'll need to be pickier about separation.) Change-Id: I9be97c9321572e3a2ed093e1d50036b7654cff41 Reviewed-on: https://boringssl-review.googlesource.com/7080 Reviewed-by: Adam Langley <agl@google.com>
2015-12-22Remove ASN1_R_MALLOC_FAILURE.David Benjamin
There was a TODO to remove it once asn1_mac.h was trimmed. This has now happened. Remove it and reset error codes for crypto/asn1. Change-Id: Iaf2f3e75741914415372939471b135618910f95d Reviewed-on: https://boringssl-review.googlesource.com/6761 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-08-29Fix the type of ASN1_i2d_bio's last argument.David Benjamin
It's supposed to be void*. The only reason this was working was that it was only called in C which happily casts from void* to T*. (But if called in C++ in a macro, it breaks.) Change-Id: I7f765c3572b9b4815ae58da852be1e742de1bd96 Reviewed-on: https://boringssl-review.googlesource.com/5760 Reviewed-by: Adam Langley <agl@google.com>
2015-08-06Drop DEFINE_STACK_OF.Adam Langley
We never need to define the actual structs because we always cast them before use. The types only exist to be distinct, and they can do that without a definition. Change-Id: I1e1ca0833b383f3be422675cb7b90dacbaf82acf Reviewed-on: https://boringssl-review.googlesource.com/5593 Reviewed-by: David Benjamin <davidben@chromium.org> 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-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-04-13Eliminate unnecessary includes from low-level crypto modules.Brian Smith
Beyond generally eliminating unnecessary includes, eliminate as many includes of headers that declare/define particularly error-prone functionality like strlen, malloc, and free. crypto/err/internal.h was added to remove the dependency on openssl/thread.h from the public openssl/err.h header. The include of <stdlib.h> in openssl/mem.h was retained since it defines OPENSSL_malloc and friends as macros around the stdlib.h functions. The public x509.h, x509v3.h, and ssl.h headers were not changed in order to minimize breakage of source compatibility with external code. Change-Id: I0d264b73ad0a720587774430b2ab8f8275960329 Reviewed-on: https://boringssl-review.googlesource.com/4220 Reviewed-by: Adam Langley <agl@google.com>
2015-03-19Fix a couple of issues with building with strict C99.Adam Langley
C99 doesn't, technically, allow empty statements. Thus if a #define'ed function ends in a semicolon, and the use of it also ends in a semicolon, then the compiler sees “;;” at the end. Since a choice has to be made, I prefer that the semicolon exist at the “callsite” of a #define'ed fuction. But I haven't gone and changed everything to follow that in this patch. Change-Id: I1343e52a5ac6255db49aa053048d0df3225bcf43 Reviewed-on: https://boringssl-review.googlesource.com/3890 Reviewed-by: David Benjamin <davidben@chromium.org> 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-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-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-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-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 misspelled error code.David Benjamin
One ASN1_R_UNKNOWN_FORMAT got mispelled into ASN1_R_UNKOWN_FORMAT and duplicated. Change-Id: If123ef848ffe68afa021f5f3e3fb08eac92c5f94 Reviewed-on: https://boringssl-review.googlesource.com/1911 Reviewed-by: Adam Langley <agl@google.com>
2014-10-01Fix Windows shared library build.David Benjamin
Windows is much pickier about dllimport/dllexport. Declare it on the declaration, not the definition. Also ensure that the declaration precedes the definition. Finally, remove a stray OPENSSL_EXPORT. Change-Id: Id50b9de5acbe5adf1b15b22dd60b7a5c13a80cce Reviewed-on: https://boringssl-review.googlesource.com/1862 Reviewed-by: Adam Langley <agl@google.com>
2014-08-19Remove some dead code.Adam Langley
This change removes the old ASN.1 functions (ASN1_seq_unpack and ASN1_seq_pack) which have always been disabled in BoringSSL. It also removes code enabled by OPENSSL_EXPORT_VAR_AS_FUNCTION, which we have never used. Change-Id: I1fe323abf945a8a5828a04cc195c072e100a5095 Reviewed-on: https://boringssl-review.googlesource.com/1556 Reviewed-by: David Benjamin <davidben@chromium.org> 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.)