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-06Set output EC_KEY to NULL when d2i_ECPrivateKey() fails.Eric Roman
BUG=crbug.com/445679 Change-Id: Ia012d806964bd7240148779797eccd326484f364 Reviewed-on: https://boringssl-review.googlesource.com/2722 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-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-11-11Remove pkey_ctrl.Adam Langley
It only included ASN1_PKEY_CTRL_DEFAULT_MD_NID and that's unused in BoringSSL. Change-Id: Idfcbd0f26f6448ce307c53ddef334f2e63c85a64
2014-11-05Rename example_sign to evp_test.David Benjamin
This stopped being a sample program a bit ago. Change-Id: I23301fd71a373f995847dcfd64346bd262811f39 Reviewed-on: https://boringssl-review.googlesource.com/2131 Reviewed-by: Adam Langley <agl@google.com>
2014-11-05Allow PKCS#8 in d2i_AutoPrivateKey.David Benjamin
This got lost in the initial commit. Add a test for d2i_AutoPrivateKey. BUG=crbug.com/428671 Change-Id: Ib4f6114b03536edcfe3b1720a513f57f748e81d2 Reviewed-on: https://boringssl-review.googlesource.com/2130 Reviewed-by: Adam Langley <agl@google.com>
2014-11-04Remove unused EVP_PKEY_ASN1_METHODs and flags.David Benjamin
The only alias, EVP_PKEY_RSA2, is handled programmatically. ASN1_PKEY_ALIAS and ASN1_PKEY_DYNAMIC are then unused and unexported and can be removed. Change-Id: I990650636bac3b802c8b439257c67ce7a3f8bc70 Reviewed-on: https://boringssl-review.googlesource.com/2124 Reviewed-by: Adam Langley <agl@google.com>
2014-11-04Remove remnants of EVP_MD_FLAG_PKEY_METHOD_SIGNATURE.David Benjamin
Some archaeology: it was added in upstream's ee1d9ec019a7584482bd95891404f1cad66a4a0a. This seems to come from upstream's arrangement where an EVP_MD can specify both the signing algorithm and the message digest. (Most of the usual hash algorithms were tied to RSA.) The flag is set on EVP_MDs that should use the EVP_PKEY's method table in EVP_Sign* rather than the one attached to the EVP_MD (there's also required_pkey_type to filter on EVP_PKEY to prevent a mismatch). Without the flag, the old codepath is hit where they're tied together. Interestingly, EVP_md5 does not have the flag, but I suppose this is because no one would sign ECDSA + MD5. EVP_DigestSign* also postdates this and doesn't use the legacy mechanism anyway. Upstream also has, e.g., EVP_ecdsa(). Although those too have since also gained the flag in bce1af776247fee153223ea156228810779483ce. Let's get rid of these TODOs. We don't have the old codepath. It's unclear if upstream really does either at this point. Note: EVP_PKEY_RSA_method in upstream is actually a macro that expands to three fields, which is why it's so difficult to figure out what's going on with those structs. Change-Id: I1aea4d3f79f1eb1755063bb96c1c65276c6e3643 Reviewed-on: https://boringssl-review.googlesource.com/2122 Reviewed-by: Adam Langley <agl@google.com>
2014-10-28Make EVP_DigestVerifyFinal return only zero or one.David Benjamin
It was already almost there. Just a malloc failure away. now all the EVP_Digest{Sign,Verify}* functions may be used without worrying about -1 return values. Change-Id: I96a9750b300010615979bd5f1522b1d241764665 Reviewed-on: https://boringssl-review.googlesource.com/2064 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 tests for AlgorithmIdentifier support in EVP.David Benjamin
Change-Id: I6691c93cfebfb06132e847d7c0bd3dd6bf076cab Reviewed-on: https://boringssl-review.googlesource.com/1917 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 EVP_PKEY_CTX case in rsa_pss_to_ctx.David Benjamin
We only ever use the EVP_PKEY case, not the EVP_PKEY_CTX one. Change-Id: Ibead854f793663da0a9e474599507d9c3ff920cb Reviewed-on: https://boringssl-review.googlesource.com/1915 Reviewed-by: Adam Langley <agl@google.com>
2014-10-10Fix rsa_pss_to_ctx return value.David Benjamin
It should return 0 for failure, not -1; the call site was expecting 0 anyway. Change-Id: I24ab5d3695b8ac438e40be1a4fd74ecd3b845f5a Reviewed-on: https://boringssl-review.googlesource.com/1914 Reviewed-by: Adam Langley <agl@google.com>
2014-10-10RSA_encrypt and RSA_sign_raw aren't the same.David Benjamin
Change-Id: Ie09ab12baf59b8c1d628396424ce6cadf43bf0e1 Reviewed-on: https://boringssl-review.googlesource.com/1913 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-09-03Fix minor issues found by Clang's analysis.Adam Langley
Thanks to Denis Denisov for running the analysis. Change-Id: I80810261e013423e746fd8d8afefb3581cffccc0 Reviewed-on: https://boringssl-review.googlesource.com/1701 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-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-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-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>
2014-07-18Remove RSA_SSLV23_PADDING.David Benjamin
It's unused with SSLv2 gone. Also, being a decryption padding check, it really should be constant-time and isn't. Change-Id: I96be02cb50f9bf0229b9174eccd80fa338bf8e3e Reviewed-on: https://boringssl-review.googlesource.com/1254 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-11Perform bounds checks in hmac_signctx.David Benjamin
Match the other EVP_DigestSignFinal implementations. Fix the instances in ssl/t1_enc.c which were not following the EVP_DigestSignFinal contract; on entry, *out_len should contain the size of the buffer. Change-Id: Icd44d97a4c98704dea975798c0101d5a37274d17 Reviewed-on: https://boringssl-review.googlesource.com/1130 Reviewed-by: Adam Langley <agl@google.com>
2014-07-10Fix EVP_PKEY_FLAG_AUTOARGLEN behavior.David Benjamin
Converting check_autoarg from a macro to a function lost the behavior. Instead, just move the logic into p_rsa.c which was the only EVP_PKEY implementation that even needed the flag. Also document this behavior on each of the functions. Make note of the out = NULL case only returning the maximum output size, and not necessarily the actual size. For testing, update example_sign to determine the signature size using the NULL behavior rather than querying the RSA key. Change-Id: Iec6c2862028a5cfdefe8faa0e8c471755070898a Reviewed-on: https://boringssl-review.googlesource.com/1121 Reviewed-by: Adam Langley <agl@google.com>
2014-07-03Typo in EVP_PKEY_asn1_find_str.David Benjamin
Other importing an EC PRIVATE KEY doesn't work. Change-Id: I58b4e88d287cd7fc772a1958df5878ecff1c5b06 Reviewed-on: https://boringssl-review.googlesource.com/1090 Reviewed-by: Adam Langley <agl@google.com>
2014-06-21remove duplicate 0x for default RSASSA-PSS salt lenAdam Langley
(Imported from upstream's 42d73874edb4eb6681b769d9850afebe97adf329)
2014-06-21Improvements in constant-time OAEP decoding.Adam Langley
This change adds a new function, BN_bn2bin_padded, that attempts, as much as possible, to serialise a BIGNUM in constant time. This is used to avoid some timing leaks in RSA decryption.
2014-06-21AEAD interface.Adam Langley
This change adds an AEAD interface to EVP and an AES-GCM implementation suitable for use in TLS.
2014-06-21Fix EC crash.Adam Langley
This change saves several EC routines from crashing when an EC_KEY is missing a public key. The public key is optional in the EC private key format and, without this patch, running the following through `openssl ec` causes a crash: -----BEGIN EC PRIVATE KEY----- MBkCAQEECAECAwQFBgcIoAoGCCqGSM49AwEH -----END EC PRIVATE KEY-----
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.)