summaryrefslogtreecommitdiffstats
path: root/crypto
AgeCommit message (Collapse)Author
2016-09-17Remove an useless definition.FdaSilvaYY
APP_INFO is currently a field of MEM struct. Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1583)
2016-09-14Add some sanity checks around usage of t_fromb64()Matt Caswell
The internal SRP function t_fromb64() converts from base64 to binary. It does not validate that the size of the destination is sufficiently large - that is up to the callers. In some places there was such a check, but not in others. Add an argument to t_fromb64() to provide the size of the destination buffer and validate that we don't write too much data. Also add some sanity checks to the callers where appropriate. With thanks to Shi Lei for reporting this issue. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-09-13bn/bn_lcl.h: improve interoperability with clang and Android NDK.Andy Polyakov
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-09-11VMS: be less picky when loading DSOsRichard Levitte
The DSO API was picky about casing of symbol names on VMS. There's really no reason to be that picky, it's mostly just annoying. Therefore, we take away the possibility to flag for a choice, and will instead first try to find a symbol with exact case, and failing that, we try to find it in upper case. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-09-10Fix EC_KEY_print so it prints out private key informationTim Hudson
even when the public key is not present in an EC_KEY Reviewed-by: Stephen Henson <steve@openssl.org>
2016-09-08If errno is ENXIO in BSS_new_file(), set BIO_R_NO_SUCH_FILERichard Levitte
VMS sets that errno when the device part of a file spec is malformed or a logical name that doesn't exist. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-09-08Fix mem leaks during auto-deinitMatt Caswell
Certain functions are automatically called during auto-deinit in order to deallocate resources. However, if we have never entered a function which marks lib crypto as inited then they never get called. This can happen if the user only ever makes use of a small sub-set of functions that don't hit the auto-init code. This commit ensures all such resources deallocated by these functions also init libcrypto when they are initially allocated. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Ben Laurie <ben@openssl.org>
2016-09-08chacha/asm/chacha-ppc.pl: add missing .text directive.Andy Polyakov
RT#4667 Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-09-07Avoid EVP_PKEY_cmp() crash on EC keys without public componentDavid Woodhouse
Some hardware devices don't provide the public EC_POINT data. The only way for X509_check_private_key() to validate that the key matches a given certificate is to actually perform a sign operation and then verify it using the public key in the certificate. Maybe that can come later, as discussed in issue 1532. But for now let's at least make it fail gracefully and not crash. GH: 1532 Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1547) (cherry picked from commit 92ed7fa575a80955f3bb6efefca9bf576a953586)
2016-09-07GH1537: Avoid double-free in the EVP_PKEY APIAlex Gaynor
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-09-06Misc BN fixesRich Salz
Never output -0; make "negative zero" an impossibility. Do better checking on BN_rand top/bottom requirements and #bits. Update doc. Ignoring trailing garbage in BN_asc2bn. Port this commit from boringSSL: https://boringssl.googlesource.com/boringssl/+/899b9b19a4cd3fe526aaf5047ab9234cdca19f7d%5E!/ Ensure |BN_div| never gives negative zero in the no_branch code. Have |bn_correct_top| fix |bn->neg| if the input is zero so that we don't have negative zeros lying around. Thanks to Brian Smith for noticing. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-09-03modes/asm/ghash-armv4.pl: improve interoperability with Android NDK.Andy Polyakov
Reviewed-by: Tim Hudson <tjh@openssl.org>
2016-09-02MIPS assembly pack: adapt it for MIPS[32|64]R6.Andy Polyakov
MIPS[32|64]R6 is binary and source incompatible with previous MIPS ISA specifications. Fortunately it's still possible to resolve differences in source code with standard pre-processor and switching to trap-free version of addition and subtraction instructions. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-08-31crypto/bn/*: x86[_64] division instruction doesn't handle constants, change ↵Andy Polyakov
constraint from 'g' to 'r'. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org>
2016-08-31Code cleanup UIRich Salz
Remove NULL check on parameter, and use NULL not ! on buffer. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-08-29Add ecp_nistz256-ppc64 module.Andy Polyakov
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-08-29perlasm/ppc-xlate.pl: recognize .type directive.Andy Polyakov
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-08-29bn/asm/ppc.pl: harmonize .size directive in bn_mul_words.Andy Polyakov
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-08-29Remove comment tags from structs (coding style)Rich Salz
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-08-29Use uppercase name for PCT_ enumRich Salz
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-08-26Improve the definition of STITCHED_CALL in e_rc4_hmac_md5.cRichard Levitte
The definition of STITCHED_CALL relies on OPENSSL_NO_ASM. However, when a configuration simply lacks the assembler implementation for RC4 (which is where we have implemented the stitched call), OPENSSL_NO_ASM isn't implemented. Better, then, to rely on specific macros that indicated that RC4 (and MD5) are implemented in assembler. For this to work properly, we must also make sure Configure adds the definition of RC4_ASM among the C flags. Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-08-25Windows: UTF-8 opt-in for command-line arguments and console input.Andy Polyakov
User can make Windows openssl.exe to treat command-line arguments and console input as UTF-8 By setting OPENSSL_WIN32_UTF8 environment variable (to any value). This is likely to be required for data interchangeability with other OSes and PKCS#12 containers generated with Windows CryptoAPI. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-08-25Don't switch password formats using global state.Andy Polyakov
To avoid possible race conditions don't switch password format using global state in crypto/pkcs12 Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-08-25Fix an uninitialised read on an error pathMatt Caswell
Found by Coverity. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-08-24Un-delete still documented X509_STORE_CTX_set_verifyViktor Dukhovni
It should not have been removed. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-08-24ec/asm/ecp_nistz256-x86_64.pl: /cmovb/cmovc/ as nasm doesn't recognize cmovb.Andy Polyakov
Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
2016-08-24CRYPTO_atomic_add(): check that the object is lock freeRichard Levitte
If not, fall back to our own code, using the given mutex Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-08-24CRYPTO_atomic_add(): use acquire release memory order rather than relaxedRichard Levitte
For increments, the relaxed model is fine. For decrements, it's recommended to use the acquire release model. We therefore go for the latter. Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-08-24Check for __GNUC__ to use GNU C atomic buildinsRichard Levitte
Note: we trust any other compiler that fully implements GNU extension to define __GNUC__ RT#4642 Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-08-24Avoid overflow in MDC2_Update()Dr. Stephen Henson
Thanks to Shi Lei for reporting this issue. CVE-2016-6303 Reviewed-by: Matt Caswell <matt@openssl.org>
2016-08-24Remove useless assignmentMatt Caswell
The variable assignment c1 is never read before it is overwritten. Reviewed-by: Tim Hudson <tjh@openssl.org>
2016-08-24ec/ecp_nistz256: harmonize is_infinity with ec_GFp_simple_is_at_infinity.Andy Polyakov
RT#4625 Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-08-24ec/ecp_nistz256: harmonize is_infinity with ec_GFp_simple_is_at_infinity.Andy Polyakov
RT#4625 Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-08-24ec/asm/ecp_nistz256-*.pl: addition to perform stricter reduction.Andy Polyakov
Addition was not preserving inputs' property of being fully reduced. Thanks to Brian Smith for reporting this. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-08-24ec/asm/ecp_nistz256-x86_64.pl: addition to perform stricter reduction.Andy Polyakov
Addition was not preserving inputs' property of being fully reduced. Thanks to Brian Smith for reporting this. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-08-24evp/bio_enc.c: stop using pointer arithmetic for error detection.Andy Polyakov
Thanks to David Benjamin for reporting this. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-08-24Fix no-sockMatt Caswell
The declaration of bio_type_lock is independent of no-sock so should not be inside OPENSSL_NO_SOCK guards. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-08-23Fix math in BN_bn2dec comment.David Benjamin
The bound on log(2)/3 on the second line is incorrect and has an extra zero compared to the divisions in the third line. log(2)/3 = 0.10034... which is bounded by 0.101 and not 0.1001. The divisions actually correspond to 0.101 which is fine. The third line also dropped a factor of three. The actual code appears to be fine. Just the comments are wrong. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
2016-08-23SCT_set_source resets validation_statusRob Percival
This makes it consistent with all of the other SCT setters. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
2016-08-23Document that o2i_SCT_signature can leave the SCT in an inconsistent stateRob Percival
Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
2016-08-23Removes {i2o,o2i}_SCT_signature from the CT public APIRob Percival
They may return if an SCT_signature struct is added in the future that allows them to be refactored to conform to the i2d/d2i function signature conventions. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
2016-08-23Prevent double-free of CTLOG public keyRob Percival
Previously, if ct_v1_log_id_from_pkey failed, public_key would be freed by CTLOG_free at the end of the function, and then again by the caller (who would assume ownership was not transferred when CTLOG_new returned NULL). Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
2016-08-23Internalizes SCT_verify and removes SCT_verify_v1Rob Percival
SCT_verify is impossible to call through the public API (SCT_CTX_new() is not part of the public API), so rename it to SCT_CTX_verify and move it out of the public API. SCT_verify_v1 is redundant, since SCT_validate does the same verification (by calling SCT_verify) and more. The API is less confusing with a single verification function (SCT_validate). Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
2016-08-23Constify a bit X509_NAME_get_entryFdaSilvaYY
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-08-23Constify some X509_NAME, ASN1 printing codeFdaSilvaYY
ASN1_buf_print, asn1_print_*, X509_NAME_oneline, X509_NAME_print Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-08-23Constify some input parameters.FdaSilvaYY
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-08-23Constify some inputs buffersFdaSilvaYY
remove useless cast to call ASN1_STRING_set Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-08-23Constify ASN1_PCTX_*FdaSilvaYY
... add a static keyword. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-08-23Add some sanity checks when checking CRL scoresMatt Caswell
Reviewed-by: Tim Hudson <tjh@openssl.org>
2016-08-23Remove some dead codeMatt Caswell
The assignment to ret is dead, because ret is assigned again later. Reviewed-by: Tim Hudson <tjh@openssl.org>