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 "Move C++ helpers into |bssl| namespace."Adam Langley
This reverts commit 09feb0f3d95a2bc58ce0faaf14256d3bd30f52a4. (In order to make WebRTC happy this also needs to be reverted.)
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-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-07-12Move C++ helpers into |bssl| namespace.Adam Langley
We currently have the situation where the |tool| and |bssl_shim| code includes scoped_types.h from crypto/test and ssl/test. That's weird and shouldn't happen. Also, our C++ consumers might quite like to have access to the scoped types. Thus this change moves some of the template code to base.h and puts it all in a |bssl| namespace to prepare for scattering these types into their respective headers. In order that all the existing test code be able to access these types, it's all moved into the same namespace. Change-Id: I3207e29474dc5fcc344ace43119df26dae04eabb Reviewed-on: https://boringssl-review.googlesource.com/8730 Reviewed-by: David Benjamin <davidben@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-06-08Fix some missing initsDavid Benjamin
(Imported from upstream's f792c663048f19347a1bb72125e535e4fb2ecf39.) Change-Id: If9bbb10de3ea858076bd9587d21ec331e837dd53 Reviewed-on: https://boringssl-review.googlesource.com/8171 Reviewed-by: Steven Valdez <svaldez@google.com> Reviewed-by: David Benjamin <davidben@google.com>
2016-05-03Fix ASN1_INTEGER handling.David Benjamin
Only treat an ASN1_ANY type as an integer if it has the V_ASN1_INTEGER tag: V_ASN1_NEG_INTEGER is an internal only value which is never used for on the wire encoding. (Imported from upstream's d4b25980020821d4685752ecb9105c0902109ab5.) This is redundant with our fb2c6f8c8565e1e2d85c24408050c96521acbcdc which I think is a much better fix (having two notions of "type" depending on whether we're in an ASN1_TYPE or an ASN1_STRING is fragile), so I think we should keep our restriction too. Still, this is also worth doing. Change-Id: I6ea54aae7b517a59c6e563d8c993d0ee22e25bee Reviewed-on: https://boringssl-review.googlesource.com/7848 Reviewed-by: Adam Langley <agl@google.com>
2016-05-03Don't free ret->data if malloc fails.David Benjamin
Issue reported by Guido Vranken. (Imported from upstream's 64eaf6c928f4066d62aa86f805796ef05bd0b1cc.) Change-Id: I99793abb4e1b5da5b70468b207ec03013fff674a Reviewed-on: https://boringssl-review.googlesource.com/7843 Reviewed-by: Adam Langley <agl@google.com>
2016-04-26Fix buffer overrun in ASN1_parse() and signed/unsigned warning.Steven Valdez
(Imported from upstream's 2442382e11c022aaab4fdc6975bd15d5a75c4db2 and 0ca67644ddedfd656d43a6639d89a6236ff64652) Change-Id: I601ef07e39f936e8f3e30412fd90cd339d712dc4 Reviewed-on: https://boringssl-review.googlesource.com/7742 Reviewed-by: David Benjamin <davidben@google.com>
2016-04-26Harden ASN.1 BIO handling of large amounts of data.Steven Valdez
If the ASN.1 BIO is presented with a large length field read it in chunks of increasing size checking for EOF on each read. This prevents small files allocating excessive amounts of data. CVE-2016-2109 Thanks to Brian Carpenter for reporting this issue. (Imported from upstream's f32774087f7b3db1f789688368d16d917757421e) Change-Id: Id1b0d4436c4879d0ba7d3b7482b937cafffa28f7 Reviewed-on: https://boringssl-review.googlesource.com/7741 Reviewed-by: David Benjamin <davidben@google.com>
2016-03-26Fix build when using Visual Studio 2015 Update 1.Brian Smith
Many of the compatibility issues are described at https://msdn.microsoft.com/en-us/library/mt612856.aspx. The macros that suppressed warnings on a per-function basis no longer work in Update 1, so replace them with #pragmas. Update 1 warns when |size_t| arguments to |printf| are casted, so stop doing that casting. Unfortunately, this requires an ugly hack to continue working in MSVC 2013 as MSVC 2013 doesn't support "%zu". Finally, Update 1 has new warnings, some of which need to be suppressed. --- Updated by davidben to give up on suppressing warnings in crypto/x509 and crypto/x509v3 as those directories aren't changed much from upstream. In each of these cases, upstream opted just blindly initialize the variable, so do the same. Also switch C4265 to level 4, per Microsoft's recommendation and work around a bug in limits.h that happens to get fixed by Google include order style. (limits.h is sensitive to whether corecrt.h, pulled in by stddef.h and some other headers, is included before it. The reason it affected just one file is we often put the file's header first, which means base.h is pulling in stddef.h. Relying on this is ugly, but it's no worse than what everything else is doing and this doesn't seem worth making something as tame as limits.h so messy to use.) Change-Id: I02d1f935356899f424d3525d03eca401bfa3e6cd Reviewed-on: https://boringssl-review.googlesource.com/7480 Reviewed-by: David Benjamin <davidben@google.com>
2016-03-20Add missing internal includes.Piotr Sikora
Partially fixes build with -Wmissing-prototypes -Wmissing-declarations. Change-Id: I51209c30f532899f57cfdd9a50cff0a8ee3da5b5 Signed-off-by: Piotr Sikora <piotrsikora@google.com> Reviewed-on: https://boringssl-review.googlesource.com/7512 Reviewed-by: David Benjamin <davidben@google.com>
2016-03-20Make local functions static.Piotr Sikora
Partially fixes build with -Wmissing-prototypes -Wmissing-declarations. Change-Id: I6048f5b7ef31560399b25ed9880156bc7d8abac2 Signed-off-by: Piotr Sikora <piotrsikora@google.com> Reviewed-on: https://boringssl-review.googlesource.com/7511 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-01Add a few more large tag tests to asn1_test.David Benjamin
While we're here, may as well test others. Change-Id: I711528641a3f7dd035c696c3c1d6b035437c91cc Reviewed-on: https://boringssl-review.googlesource.com/7239 Reviewed-by: Adam Langley <agl@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-29Fix possible memory leak on BUF_MEM_grow_clean failureAdam Langley
(Imported from upstream's e9cf5f03666bb82f0184e4f013702d0b164afdca and 29305f4edc886db349f2beedb345f9dd93311c09) Change-Id: I0fa019e9d337676a84a7a6c103d2c4e14e18aede Reviewed-on: https://boringssl-review.googlesource.com/7240 Reviewed-by: David Benjamin <davidben@google.com>
2016-02-29Fix encoding bug in i2c_ASN1_INTEGERAdam Langley
(Imported from upstream's 3661bb4e7934668bd99ca777ea8b30eedfafa871.) Fix bug where i2c_ASN1_INTEGER mishandles zero if it is marked as negative. Thanks to Huzaifa Sidhpurwala <huzaifas@redhat.com> and Hanno Böck <hanno@hboeck.de> for reporting this issue. BUG=590615 Change-Id: I8959e8ae01510a5924862a3f353be23130eee554 Reviewed-on: https://boringssl-review.googlesource.com/7199 Reviewed-by: David Benjamin <davidben@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>
2016-01-19OpenSSL reformat x509/, x509v3/, pem/ and asn1/.Adam Langley
OpenSSL upstream did a bulk reformat. We still have some files that have the old OpenSSL style and this makes applying patches to them more manual, and thus more error-prone, than it should be. This change is the result of running util/openssl-format-source -v -c . in the enumerated directories. A few files were in BoringSSL style and have not been touched. This change should be formatting only; no semantic difference. Change-Id: I75ced2970ae22b9facb930a79798350a09c5111e Reviewed-on: https://boringssl-review.googlesource.com/6904 Reviewed-by: David Benjamin <davidben@chromium.org> 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-12-15Limit depth of ASN1 parse printing.David Benjamin
(Imported from upstream's d88ef40a1e5c81d0d32b4a431e55f5456e678dd2 and 943c4ca62b3f5a160340d57aecb9413407a06e15.) Change-Id: Idd52aebae6839695be0f3a8a7659adeec6650b98 Reviewed-on: https://boringssl-review.googlesource.com/6556 Reviewed-by: Adam Langley <agl@google.com>
2015-12-03Fix leak with ASN.1 combine.David Benjamin
When parsing a combined structure pass a flag to the decode routine so on error a pointer to the parent structure is not zeroed as this will leak any additional components in the parent. This can leak memory in any application parsing PKCS#7 or CMS structures. CVE-2015-3195. Thanks to Adam Langley (Google/BoringSSL) for discovering this bug using libFuzzer. PR#4131 (Imported from upstream's cc598f321fbac9c04da5766243ed55d55948637d, with test from our original report. Verified ASan trips up on the test without the fix.) Change-Id: I007d93f172b2f16bf6845d685d72717ed840276c Reviewed-on: https://boringssl-review.googlesource.com/6615 Reviewed-by: Adam Langley <agl@google.com>
2015-11-12Become partially -Wmissing-variable-declarations-clean.David Benjamin
There's a few things that will be kind of a nuisance and possibly not worth it (crypto/asn1 dumps a lot of undeclared things, etc.). But it caught some mistakes. Even without the warning, making sure to include the externs before defining a function helps catch type mismatches. Change-Id: I3dab282aaba6023e7cebc94ed7a767a5d7446b08 Reviewed-on: https://boringssl-review.googlesource.com/6484 Reviewed-by: Adam Langley <agl@google.com>
2015-10-31Fix several warnings that arise in Android.Adam Langley
Android is now using Ninja so it doesn't spew so much to the terminal and thus any warnings in BoringSSL (which builds really early in the process) and much more obvious. Thus this change fixes a few warnings that appear in the Android build. Change-Id: Id255ace90fece772a1c3a718c877559ce920b960 Reviewed-on: https://boringssl-review.googlesource.com/6400 Reviewed-by: David Benjamin <davidben@chromium.org> Reviewed-by: Adam Langley <agl@google.com>
2015-09-29d2i: don't update input pointer on failureDavid Benjamin
(Imported from upstream's 728bcd59d3d41e152aead0d15acc51a8958536d3.) Actually this one was reported by us, but the commit message doesn't mention this. This is slightly modified from upstream's version to fix some problems noticed in import. Specifically one of d2i_X509_AUX's success paths is bust and d2i_PrivateKey still updates on one error path. Resolve the latter by changing both it and d2i_AutoPrivateKey to explicitly hit the error path on ret == NULL. This lets us remove the NULL check in d2i_AutoPrivateKey. We'll want to report the problems back upstream. Change-Id: Ifcfc965ca6d5ec0a08ac154854bd351cafbaba25 Reviewed-on: https://boringssl-review.googlesource.com/5948 Reviewed-by: Adam Langley <agl@google.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-26Move arm_arch.h and fix up lots of include paths.Adam Langley
arm_arch.h is included from ARM asm files, but lives in crypto/, not openssl/include/. Since the asm files are often built from a different location than their position in the source tree, relative include paths are unlikely to work so, rather than having crypto/ be a de-facto, second global include path, this change moves arm_arch.h to include/openssl/. It also removes entries from many include paths because they should be needed as relative includes are always based on the locations of the source file. Change-Id: I638ff43d641ca043a4fc06c0d901b11c6ff73542 Reviewed-on: https://boringssl-review.googlesource.com/5746 Reviewed-by: Adam Langley <agl@google.com>
2015-07-16Remove the func parameter to OPENSSL_PUT_ERROR.David Benjamin
Much of this was done automatically with find . -name '*.c' | xargs sed -E -i '' -e 's/(OPENSSL_PUT_ERROR\([a-zA-Z_0-9]+, )[a-zA-Z_0-9]+, ([a-zA-Z_0-9]+\);)/\1\2/' find . -name '*.c' | xargs sed -E -i '' -e 's/(OPENSSL_PUT_ERROR\([a-zA-Z_0-9]+, )[a-zA-Z_0-9]+, ([a-zA-Z_0-9]+\);)/\1\2/' BUG=468039 Change-Id: I4c75fd95dff85ab1d4a546b05e6aed1aeeb499d8 Reviewed-on: https://boringssl-review.googlesource.com/5276 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-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-05-05Don't set *pval to NULL in asn1_item_ex_combine_new.David Benjamin
While *pval is usually a pointer in rare circumstances it can be a long value. One some platforms (e.g. WIN64) where sizeof(long) < sizeof(ASN1_VALUE *) this will write past the field. *pval is initialised correctly in the rest of ASN1_item_ex_new so setting it to NULL is unecessary anyway. Thanks to Julien Kauffmann for reporting this issue. (Imported from upstream's f617b4969a9261b9d7d381670aefbe2cf766a2cb.) Change-Id: I8cc777f7ab126dcef3a0278a82d3fc91faf4c231 Reviewed-on: https://boringssl-review.googlesource.com/4510 Reviewed-by: Adam Langley <agl@google.com>
2015-04-23Ensure BN_asc2bn, BN_dec2bn, and BN_hex2bn never give -0.David Benjamin
See upstream's a0eed48d37a4b7beea0c966caf09ad46f4a92a44. Rather than import that, we should just ensure neg + zero isn't a possible state. Add some tests for asc2bn and dec2bn while we're here. Also fix a bug with dec2bn where it doesn't actually ignore trailing data as it's supposed to. Change-Id: I2385b67b740e57020c75a247bee254085ab7ce15 Reviewed-on: https://boringssl-review.googlesource.com/4484 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-04-13Enable MSVC warning C4701, use of potentially uninitialized variable.Brian Smith
C4701 is "potentially uninitialized local variable 'buf' used". It sometimes results in false positives, which can now be suppressed using the macro OPENSSL_SUPPRESS_POTENTIALLY_UNINITIALIZED_WARNINGS. Change-Id: I15068b5a48e1c704702e7752982b9ead855e7633 Reviewed-on: https://boringssl-review.googlesource.com/3160 Reviewed-by: Adam Langley <agl@google.com>
2015-04-08Prune away (almost) all of asn1_mac.hDavid Benjamin
Amazingly, asn1_GetSequence isn't completely unused? Keep that around for now and ditch everything else. This lets us enable C4311 in MSVC which is actually a pretty reasonable warning. Change-Id: I43bb9206b1745e8a68224f3a435713d2a74e04ea Reviewed-on: https://boringssl-review.googlesource.com/4256 Reviewed-by: Adam Langley <agl@google.com>
2015-03-21Clean up error reporting.Håvard Molland
Quite a few functions reported wrong function names when pushing to the error stack. Change-Id: I84d89dbefd2ecdc89ffb09799e673bae17be0e0f Reviewed-on: https://boringssl-review.googlesource.com/4080 Reviewed-by: David Benjamin <davidben@chromium.org> Reviewed-by: Adam Langley <agl@google.com>
2015-03-19Fix ASN1_TYPE_cmpDavid Benjamin
Fix segmentation violation when ASN1_TYPE_cmp is passed a boolean type. This can be triggered during certificate verification so could be a DoS attack against a client or a server enabling client authentication. CVE-2015-0286 (Imported from upstream's e677e8d13595f7b3287f8feef7676feb301b0e8a.) Change-Id: I5faefc190568504bb5895ed9816a6d80432cfa45 Reviewed-on: https://boringssl-review.googlesource.com/4048 Reviewed-by: Adam Langley <agl@google.com>
2015-03-19Free up ADB and CHOICE if already initialised.David Benjamin
CVE-2015-0287 (Imported from upstream's b485d976340d3ca080060c3c7dee9102e2200762.) Change-Id: Ie8dac46ccc95a4eee9ef535d8620217202f13ca1 Reviewed-on: https://boringssl-review.googlesource.com/4046 Reviewed-by: Adam Langley <agl@google.com>
2015-03-19Allocate string types directly.David Benjamin
Allocate and free ASN.1 string types directly instead of going through the ASN.1 item code. (Imported from upstream's 3d6aa6d441fe8124d247dffee5c68c2e5efd8258.) Change-Id: I617283e67071a792f219ed08f19078afc223e2f5 Reviewed-on: https://boringssl-review.googlesource.com/4041 Reviewed-by: Adam Langley <agl@google.com>
2015-03-19Fix regression in ASN1_UTCTIME_cmp_time_tDavid Benjamin
Previously, ASN1_UTCTIME_cmp_time_t would return 1 if s > t, -1 if s < t, and 0 if s == t. This behavior was broken in upstream's 904348a4922333106b613754136305db229475ea, resulting in the opposite time comparison behavior. PR#3706 (Imported from upstream's da27006df06853a33b132133699a7aa9d4277920.) Change-Id: I9c1c28ba21d82ff4b587e33b262f46be4e846ff9 Reviewed-on: https://boringssl-review.googlesource.com/4043 Reviewed-by: Adam Langley <agl@google.com>
2015-03-19ASN.1 print fix.David Benjamin
When printing out an ASN.1 structure, if the type is an item template don't fall through and attempt to interpret as a primitive type. (Imported from upstream's 5dc1247a7494f50c88ce7492518bbe0ce6f124fa.) Change-Id: Ica39757792cbf3f83879953b67838927ddbdb809 Reviewed-on: https://boringssl-review.googlesource.com/4009 Reviewed-by: Adam Langley <agl@google.com>
2015-03-19Fix asn1_item_print_ctxDavid Benjamin
The call to asn1_do_adb can return NULL on error, so we should check the return value before attempting to use it. (Imported from upstream's 34a7ed0c39aa3ab67eea1e106577525eaf0d7a00.) Change-Id: Ia43cdc73b5f1d16e6fc907b5aaf13c9df5a9958c Reviewed-on: https://boringssl-review.googlesource.com/4007 Reviewed-by: Adam Langley <agl@google.com>
2015-03-19ASN1_primitive_new NULL param handlingDavid Benjamin
ASN1_primitive_new takes an ASN1_ITEM * param |it|. There are a couple of conditional code paths that check whether |it| is NULL or not - but later |it| is deref'd unconditionally. If |it| was ever really NULL then this would seg fault. In practice ASN1_primitive_new is marked as an internal function in the public header file. The only places it is ever used internally always pass a non NULL parameter for |it|. Therefore, change the code to sanity check that |it| is not NULL, and remove the conditional checking. (Imported from upstream's 9e488fd6ab2c295941e91a47ab7bcd346b7540c7) Change-Id: Icbb13cd00d0ec5529871b678b0bcc465956a7572 Reviewed-on: https://boringssl-review.googlesource.com/4006 Reviewed-by: Adam Langley <agl@google.com>
2015-03-19Fix wrong numbers being passed as string lengthsDavid Benjamin
(Imported from upstream's 0b142f022e2c5072295e00ebc11c5b707a726d74.) Modified further because these ought to just be BIO_puts. Change-Id: I8b70d70d0f626bb19b455adb4f0e08bacf453c1d Reviewed-on: https://boringssl-review.googlesource.com/4002 Reviewed-by: Adam Langley <agl@google.com>
2015-03-13Error codes are uint32_t, not unsigned long.David Benjamin
Fix a few remnants of them being unsigned long. Also rename extremely unhelpful variable names in SSL_get_error. i is now ret_code to match the header. Change-Id: Ic31d6626bfe09c9e21c03691dfc716c5573833ea Reviewed-on: https://boringssl-review.googlesource.com/3881 Reviewed-by: Adam Langley <agl@google.com>
2015-03-10Fix two unchecked mallocs in crypto/asn1.David Benjamin
Imported from upstream's 918bb8652969fd53f0c390c1cd909265ed502c7e. (The remainder is in code we've since deleted.) Change-Id: Ie878272114086ba60a0fd5eae059b641b00ec0c4 Reviewed-on: https://boringssl-review.googlesource.com/3831 Reviewed-by: Adam Langley <agl@google.com>