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
2015-01-06Fix a couple of minor compiler warnings.Adam Langley
One about a possible uninitialised variable (incorrect, but it's easier to keep the compiler happy) and one warning about "const static" being backwards. Change-Id: Ic5976a5f0b48f32e09682e31b65d8ea1c27e5b88 Reviewed-on: https://boringssl-review.googlesource.com/2632 Reviewed-by: David Benjamin <davidben@chromium.org> Reviewed-by: Adam Langley <agl@google.com>
2014-11-19Add malloc failure tests.Adam Langley
This commit fixes a number of crashes caused by malloc failures. They were found using the -malloc-test=0 option to runner.go which runs tests many times, causing a different allocation call to fail in each case. (This test only works on Linux and only looks for crashes caused by allocation failures, not memory leaks or other errors.) This is not the complete set of crashes! More can be found by collecting core dumps from running with -malloc-test=0. Change-Id: Ia61d19f51e373bccb7bc604642c51e043a74bd83 Reviewed-on: https://boringssl-review.googlesource.com/2320 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-11-11Omit version for v1 certificates.Adam Langley
When calling X509_set_version to set v1 certificate, that should mean that the version number field is omitted. (Imported from upstream's 8c0d19d8577c9a96b65622bfa92d0affd6bbb4ac) Change-Id: If433fda7b6ccbd899f3379a38581c351cf4a82da
2014-11-11Extra return in check_issued.Adam Langley
(Imported from upstream's b8d687bb561384bb3d52027cbf637fa4852c4225) Change-Id: I5155b8fa165fbb83a0ba6790571fec28e22cd45c
2014-11-11ASN1_STRING_to_UTF8 missing initializer.Adam Langley
(Imported from upstream's b85d461cdf92b1d76d903c245ec01fd7398179d8) Change-Id: I85f620a5a924c3fe73aa394b39ab8ab343c4c7eb
2014-11-06Fix error handling in X509_PURPOSE_add and X509_TRUST_add.David Benjamin
Two leaks can happen: if idx is -1, the newly allocated entry may not be freed. Also, for X509_PURPOSE_add, if only one BUF_strdup succeeds, it will leak. Restructure both so that the allocations happen ahead of time and are properly cleaned up. This avoids leaving an existing entry in a half-broken state. Found (sort of) by scan-build; because of all the indirections and DYNAMIC flags, it doesn't actually realize the leak's been fixed. Change-Id: I5521889bd14e007b3f62b6a4906d7c346698b48c Reviewed-on: https://boringssl-review.googlesource.com/2209 Reviewed-by: Adam Langley <agl@google.com>
2014-11-06Shush some dead assignments.David Benjamin
Appease clang scan-build a bit. I'm not sure it's actually worth silencing all of them because some of them look like preserving invariants between local variables, but some are clearly pointless or can be restructured slightly. Change-Id: I0bc81e2589bb402ff3ef0182d7a8921e31b85052 Reviewed-on: https://boringssl-review.googlesource.com/2205 Reviewed-by: Adam Langley <agl@google.com>
2014-11-06Fix leaks in and de-macro X509_PKEY_new.David Benjamin
Caught by clang scan-build. Change-Id: I075ae0423ec72493f21608ab5704e2984ca3e86c Reviewed-on: https://boringssl-review.googlesource.com/2202 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-10Add EVP_DigestVerifyInitFromAlgorithm and EVP_DigestSignAlgorithm.David Benjamin
Factor the AlgorithmIdentifier portions of ASN1_item_sign and ASN1_item_verify out. This makes it possible to initialize a signature context from an AlgorithmIdentifier without needing the data parsed into an ASN1_ITEM/void* pair and reserialized. Change-Id: Idc2e06b1310a3f801aa25de323d39d2b7a44ef50 Reviewed-on: https://boringssl-review.googlesource.com/1916 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-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-07Fix a_{digest,verify}.c error codepaths.David Benjamin
Not that these functions can actually fail. The only codepaths that do so are user errors. Change-Id: I9fcbd402ab6574b5423ae22b462a0e1192ef01d7 Reviewed-on: https://boringssl-review.googlesource.com/1900 Reviewed-by: Adam Langley <agl@google.com>
2014-10-01Don't compare signed vs. unsigned.David Benjamin
This resolves a pile of MSVC warnings in Chromium. Change-Id: Ib9a29cb88d8ed8ec4118d153260f775be059a803 Reviewed-on: https://boringssl-review.googlesource.com/1865 Reviewed-by: Adam Langley <agl@google.com>
2014-09-12Add a CRYPTO_library_init and static-initializer-less build option.David Benjamin
Chromium does not like static initializers, and the CPU logic uses one to initialize CPU bits. However, the crypto library lacks an explicit initialization function, which could complicate (no compile-time errors) porting existing code which uses crypto/, but not ssl/. Add an explicit CRYPTO_library_init function, but make it a no-op by default. It only does anything (and is required) if building with BORINGSSL_NO_STATIC_INITIALIZER. Change-Id: I6933bdc3447fb382b1f87c788e5b8142d6f3fe39 Reviewed-on: https://boringssl-review.googlesource.com/1770 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-27Remove hack in parsing PKCS#12.Adam Langley
This change removes the previous OpenSSL/NSS hack in PKCS#12 parsing and limits the hacks purely to the BER->DER conversion function, where they belong. PKCS#7 and #12 switch between implicit and explicit tags in different places and sometimes only implicitly define that they are using implicit tags. This change fixes a previous confusion where an implicit tag was thought to be explicit. Change-Id: Ib68c78cf2a1bfcbf90a296cb98313ab86ed2a1f3 Reviewed-on: https://boringssl-review.googlesource.com/1640 Reviewed-by: Adam Langley <agl@google.com>
2014-08-26Introduce EVP_DecodeBase64.David Benjamin
This fixes several of the problems with the old API. - Padding was completely ignored. - ='s in the middle of the input were accepted. - It tries to be helpful and strips leading/trailing whitespace. Change-Id: I99b9d5e6583f7eaf9bf0b6ee9ca39799811b58dc Reviewed-on: https://boringssl-review.googlesource.com/1602 Reviewed-by: Adam Langley <agl@google.com>
2014-08-26Rework support for ASN.1 BER.Adam Langley
Previously, the ASN.1 functions in bytestring were capable of processing indefinite length elements when the _ber functions were used. That works well enough for PKCS#3, but NSS goes a bit crazy with BER encoding and PKCS#12. Rather than complicate the core bytestring functions further, the BER support is removed from them and moved to a separate function that converts from BER to DER (if needed). Change-Id: I2212b28e99bab9fab8c61f80d2012d3e5a3cc2f0 Reviewed-on: https://boringssl-review.googlesource.com/1591 Reviewed-by: Adam Langley <agl@google.com>
2014-08-21Convert all zero-argument functions to '(void)'David Benjamin
Otherwise, in C, it becomes a K&R function declaration which doesn't actually type-check the number of arguments. Change-Id: I0731a9fefca46fb1c266bfb1c33d464cf451a22e Reviewed-on: https://boringssl-review.googlesource.com/1582 Reviewed-by: Adam Langley <agl@google.com>
2014-08-14Add EVP_EncodedLength.Adam Langley
Several callers of EVP_EncodeBlock are doing ad-hoc versions of this function without any overflow checks. Change-Id: I4d0cad2347ea8c44b42465e8b14b2783db69ee8f Reviewed-on: https://boringssl-review.googlesource.com/1511 Reviewed-by: David Benjamin <davidben@chromium.org> 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-07Use EVP_PKEY_dup instead of manually incrementing the refcount.David Benjamin
Reference counting should be internal to the type, otherwise callers need to know which lock to use. Change-Id: If4d805876a321ef6dece115c805e605584ff311e Reviewed-on: https://boringssl-review.googlesource.com/1414 Reviewed-by: Adam Langley <agl@google.com>
2014-08-04Remove OPENSSL_NO_CHAIN_VERIFYAlex Chernyakhovsky
Change-Id: Iaff2a1b4c394aa0d3d5a33cb75cf4f165d3c2abc Reviewed-on: https://boringssl-review.googlesource.com/1387 Reviewed-by: Adam Langley <agl@google.com>
2014-07-30Fix error-handling bugs.David Benjamin
Caught by clang scan-build. Change-Id: I133d0338fe38172d687c02099d909366a59ee95b Reviewed-on: https://boringssl-review.googlesource.com/1343 Reviewed-by: Adam Langley <agl@google.com>
2014-07-30Fix mis-sized allocation in x509_vpm.cDavid Benjamin
Caught by clang scan-build. (The allocation was larger than it should have been.) Change-Id: Ideb800118f65aaba1ee85b7611c8a705671025a8 Reviewed-on: https://boringssl-review.googlesource.com/1340 Reviewed-by: Adam Langley <agl@google.com>
2014-07-29Tolerate critical AKID in CRLs.Adam Langley
PR#3014 (Imported from upstream's 22228d2d407763d234a2463f694df77dca8158fc) Change-Id: I23ee7dd6b295c3141fe3f5897673dd932831a4f6
2014-07-29Memory leak and NULL dereference fixes.Adam Langley
PR#3403 (Imported from upstream's e42c208235a86beee16ff0d0e6ca4e164a57d21a) Change-Id: Ibcdd8c95604f661055bfb1e91b15fd3686a04c0d
2014-07-16base64: fix underflow in EVP_EncodeBlock.Adam Langley
When I switched the base64 code to use size_t, I missed that one of the loops was counting down, not up, and depended on the loop variable going negative. Additionally this change fixes a bug in NETSCAPE_SPKI_b64_encode where the size of the result buffer was incorrectly calculated and a possible memory leak. Change-Id: Ibdf644244291274f50b314f3bb13a61b46858ca1 Reviewed-on: https://boringssl-review.googlesource.com/1220 Reviewed-by: David Benjamin <davidben@chromium.org> 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-07-08Remove OPENSSL_NO_RSAAlex Chernyakhovsky
Building without RSA support is unreasonable. Changes were made by running find . -type f -name *.c | xargs unifdef -m -U OPENSSL_NO_RSA find . -type f -name *.h | xargs unifdef -m -U OPENSSL_NO_RSA using unifdef 2.10 and some newlines were removed manually. Change-Id: Iea559e2d4b3d1053f28a4a9cc2f7a3d1f6cabd61 Reviewed-on: https://boringssl-review.googlesource.com/1095 Reviewed-by: Adam Langley <agl@google.com>
2014-07-07Remove CHARSET_EBCDICAlex Chernyakhovsky
Since crypto/ebcdic.{c,h} are not present in BoringSSL, remove the #ifdefs Changes were made by running find . -type f -name *.c | xargs unifdef -m -U CHARSET_EBCDIC find . -type f -name *.h | xargs unifdef -m -U CHARSET_EBCDIC using unifdef 2.10. An additional two ifdefs (CHARSET_EBCDIC_not) were removed manually. Change-Id: Ie174bb00782cc44c63b0f9fab69619b3a9f66d42 Reviewed-on: https://boringssl-review.googlesource.com/1093 Reviewed-by: Adam Langley <agl@google.com>
2014-06-21Try both old and new X.509 hashes.Adam Langley
Ensure the library can find the right files under /etc/ssl/certs when running on older systems. There are many symbolic links under /etc/ssl/certs created by using hash of the PEM certificates in order for OpenSSL to find those certificates. Openssl has a tool to help you create hash symbolic links (tools/c_rehash). However newer versions of the library changed the hash algorithm, which makes it unable to run properly on systems that use the old /etc/ssl/certs layout (e.g. Ubuntu Lucid). This patch gives a way to find a certificate according to its hash by using both the old and new algorithms. http://crbug.com/111045 is used to track this issue. (Imported from Chromium: http://src.chromium.org/viewvc/chrome/trunk/deps/third_party/openssl/patches.chromium/0003-x509_hash_name_algorithm_change.patch?revision=231571) Change-Id: Idbc27aba7685c991f8b94cfea38cf4f3f4b38adc
2014-06-21Fixes to host checking.Adam Langley
Fixes to host checking wild card support and add support for setting host checking flags when verifying a certificate chain. (Imported from upstream's a2219f6be36d12f02b6420dd95f819cf364baf1d)
2014-06-21Don't try and verify signatures if key is NULL (CVE-2013-0166)Adam Langley
Add additional check to catch this in ASN1_item_verify too. (Imported from upstream's e9b4b8afbd129adc18d3fe71ca2ab34fe61d8640)
2014-06-21For self signed root only indicate one error.Adam Langley
(Imported from upstream's bdfc0e284c89dd5781259cc19aa264aded538492.)
2014-06-21x509/by_dir.c: fix run-away pointer.Adam Langley
fix run-away pointer (and potential SEGV) when adding duplicates in add_cert_dir. PR: 3261 Reported by: Marian Done (Imported from upstream's 83fe7b9c8321d5ffb6bfe67df85ed66ceb97102f)
2014-06-21Include TA in checks/callback with partial chains.Adam Langley
When a chain is complete and ends in a trusted root checks are also performed on the TA and the callback notified with ok==1. For consistency do the same for chains where the TA is not self signed. (Imported from upstream's b07e4f2f46fc286c306353d5e362cbc22c8547fb)
2014-06-21Add cert_self_signed function to simplify verify.Adam Langley
(Imported from upstream's ced6dc5cefca57b08e077951a9710c33b709e99e)
2014-06-21Simplify X509_STORE_CTX_get1_chain.Adam Langley
(Imported from upstream's bf2d129194d5a8f2ccf5ff5261ab755e4fc9f98e)
2014-06-21Remove redundant accessor.Adam Langley
You can do the same thing, and more, with X509_ALGOR_[gs]et0(). (Imported from upstream's 40b0d0765ec8d34654be099456dc1dfb6e1bd3ff)
2014-06-21Add more accessors.Adam Langley
(Imported from upstream's cacdfcb2479984d9bfcc79b623118d8af6fea169)
2014-06-21Add accessor for x509.cert_info.Adam Langley
(Imported from upstream's 519ad9b3845c475d29db8b84b59bde7edecb4e70.)
2014-06-21Const correctness.Adam Langley
This change fixes a number of build warnings.
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.)