aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/evp
Commit message (Collapse)AuthorAgeFilesLines
* RT3841: memset() cipher_data when allocatedRich Salz2015-05-131-0/+1
| | | | | | | | | | If an EVP implementation (such as an engine) fails out early, it's possible to call EVP_CIPHER_CTX_cleanup() which will call ctx->cipher->cleanup() before the cipher_data has been initialized via ctx->cipher->init(). Guarantee it's all-bytes-zero as soon as it is allocated. Reviewed-by: Matt Caswell <matt@openssl.org>
* Remove Kerberos support from libsslMatt Caswell2015-05-131-28/+0
| | | | | | | Remove RFC2712 Kerberos support from libssl. This code and the associated standard is no longer considered fit-for-purpose. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Use p==NULL not !p (in if statements, mainly)Rich Salz2015-05-114-6/+8
| | | | Reviewed-by: Tim Hudson <tjh@openssl.org>
* Use "==0" instead of "!strcmp" etcRich Salz2015-05-062-2/+2
| | | | | | | For the various string-compare routines (strcmp, strcasecmp, str.*cmp) use "strcmp()==0" instead of "!strcmp()" Reviewed-by: Tim Hudson <tjh@openssl.org>
* Initialize potentially uninitialized local variablesGunnar Kudrjavets2015-05-063-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | Compiling OpenSSL code with MSVC and /W4 results in a number of warnings. One category of warnings is particularly interesting - C4701 (potentially uninitialized local variable 'name' used). This warning pretty much means that there's a code path which results in uninitialized variables being used or returned. Depending on compiler, its options, OS, values in registers and/or stack, the results can be nondeterministic. Cases like this are very hard to debug so it's rational to fix these issues. This patch contains a set of trivial fixes for all the C4701 warnings (just initializing variables to 0 or NULL or appropriate error code) to make sure that deterministic values will be returned from all the execution paths. RT#3835 Signed-off-by: Matt Caswell <matt@openssl.org> Matt's note: All of these appear to be bogus warnings, i.e. there isn't actually a code path where an unitialised variable could be used - its just that the compiler hasn't been able to figure that out from the logic. So this commit is just about silencing spurious warnings. Reviewed-by: Rich Salz <rsalz@openssl.org>
* memset, memcpy, sizeof consistency fixesRich Salz2015-05-055-10/+7
| | | | | | | | Just as with the OPENSSL_malloc calls, consistently use sizeof(*ptr) for memset and memcpy. Remove needless casts for those functions. For memset, replace alternative forms of zero with 0. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Use safer sizeof variant in mallocRich Salz2015-05-048-14/+16
| | | | | | | | | | | | | For a local variable: TYPE *p; Allocations like this are "risky": p = OPENSSL_malloc(sizeof(TYPE)); if the type of p changes, and the malloc call isn't updated, you could get memory corruption. Instead do this: p = OPENSSL_malloc(sizeof(*p)); Also fixed a few memset() calls that I noticed while doing this. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Add OSSL_NELEM macro.Dr. Stephen Henson2015-05-031-3/+2
| | | | | | | Add OSSL_NELEM macro to e_os.h to determine the number of elements in an array. Reviewed-by: Tim Hudson <tjh@openssl.org>
* free null cleanup finaleRich Salz2015-05-011-4/+2
| | | | | | Don't check for NULL before calling OPENSSL_free Reviewed-by: Richard Levitte <levitte@openssl.org>
* Sanity check EVP_EncodeUpdate buffer lenMatt Caswell2015-04-301-1/+1
| | | | | | | | | There was already a sanity check to ensure the passed buffer length is not zero. Extend this to ensure that it also not negative. Thanks to Kevin Wojtysiak (Int3 Solutions) and Paramjot Oberoi (Int3 Solutions) for reporting this issue. Reviewed-by: Andy Polyakov <appro@openssl.org>
* Sanity check EVP_CTRL_AEAD_TLS_AADMatt Caswell2015-04-304-7/+18
| | | | | | | | | | The various implementations of EVP_CTRL_AEAD_TLS_AAD expect a buffer of at least 13 bytes long. Add sanity checks to ensure that the length is at least that. Also add a new constant (EVP_AEAD_TLS1_AAD_LEN) to evp.h to represent this length. Thanks to Kevin Wojtysiak (Int3 Solutions) and Paramjot Oberoi (Int3 Solutions) for reporting this issue. Reviewed-by: Andy Polyakov <appro@openssl.org>
* free cleanup almost the finaleRich Salz2015-04-305-10/+5
| | | | | | | | | | Add OPENSSL_clear_free which merges cleanse and free. (Names was picked to be similar to BN_clear_free, etc.) Removed OPENSSL_freeFunc macro. Fixed the small simple ones that are left: CRYPTO_free CRYPTO_free_locked OPENSSL_free_locked Reviewed-by: Richard Levitte <levitte@openssl.org>
* free NULL cleanup 5aRich Salz2015-04-301-2/+1
| | | | | | | | | Don't check for NULL before calling a free routine. This gets X509_.*free: x509_name_ex_free X509_policy_tree_free X509_VERIFY_PARAM_free X509_STORE_free X509_STORE_CTX_free X509_PKEY_free X509_OBJECT_free_contents X509_LOOKUP_free X509_INFO_free Reviewed-by: Richard Levitte <levitte@openssl.org>
* remove malloc castsRich Salz2015-04-286-6/+6
| | | | | | | Following ANSI C rules, remove the casts from calls to OPENSSL_malloc and OPENSSL_realloc. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Big apps cleanup (option-parsing, etc)Rich Salz2015-04-241-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is merges the old "rsalz-monolith" branch over to master. The biggest change is that option parsing switch from cascasding 'else if strcmp("-foo")' to a utility routine and somethin akin to getopt. Also, an error in the command line no longer prints the full summary; use -help (or --help :) for that. There have been many other changes and code-cleanup, see bullet list below. Special thanks to Matt for the long and detailed code review. TEMPORARY: For now, comment out CRYPTO_mem_leaks() at end of main Tickets closed: RT3515: Use 3DES in pkcs12 if built with no-rc2 RT1766: s_client -reconnect and -starttls broke RT2932: Catch write errors RT2604: port should be 'unsigned short' RT2983: total_bytes undeclared #ifdef RENEG RT1523: Add -nocert to fix output in x509 app RT3508: Remove unused variable introduced by b09eb24 RT3511: doc fix; req default serial is random RT1325,2973: Add more extensions to c_rehash RT2119,3407: Updated to dgst.pod RT2379: Additional typo fix RT2693: Extra include of string.h RT2880: HFS is case-insensitive filenames RT3246: req command prints version number wrong Other changes; incompatibilities marked with *: Add SCSV support Add -misalign to speed command Make dhparam, dsaparam, ecparam, x509 output C in proper style Make some internal ocsp.c functions void Only display cert usages with -help in verify Use global bio_err, remove "BIO*err" parameter from functions For filenames, - always means stdin (or stdout as appropriate) Add aliases for -des/aes "wrap" ciphers. *Remove support for IISSGC (server gated crypto) *The undocumented OCSP -header flag is now "-header name=value" *Documented the OCSP -header flag Reviewed-by: Matt Caswell <matt@openssl.org>
* make updateEmilia Kasper2015-04-011-2/+1
| | | | Reviewed-by: Matt Caswell <matt@openssl.org>
* Remove EXHEADER, TEST, APPS, links:, install: and uninstall: where relevantRichard Levitte2015-03-311-20/+2
| | | | | | | | | | | | With no more symlinks, there's no need for those variables, or the links target. This also goes for all install: and uninstall: targets that do nothing but copy $(EXHEADER) files, since that's now taken care of by the top Makefile. Also, removed METHTEST from test/Makefile. It looks like an old test that's forgotten... Reviewed-by: Rich Salz <rsalz@openssl.org>
* Stop symlinking, move files to intended directoryRichard Levitte2015-03-315-5825/+0
| | | | | | | | | | | | | Rather than making include/openssl/foo.h a symlink to crypto/foo/foo.h, this change moves the file to include/openssl/foo.h once and for all. Likewise, move crypto/foo/footest.c to test/footest.c, instead of symlinking it there. Originally-by: Geoff Thorpe <geoff@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
* Remove duplicate code.Dr. Stephen Henson2015-03-302-24/+7
| | | | | | | Update code to use ASN1_TYPE_pack_sequence and ASN1_TYPE_unpack_sequence instead of performing the same operation manually. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Remove unnecessary asn1_mac.h includes.Dr. Stephen Henson2015-03-301-1/+0
| | | | Reviewed-by: Rich Salz <rsalz@openssl.org>
* free NULL cleanupRich Salz2015-03-288-34/+18
| | | | | | | | | EVP_.*free; this gets: EVP_CIPHER_CTX_free EVP_PKEY_CTX_free EVP_PKEY_asn1_free EVP_PKEY_asn1_set_free EVP_PKEY_free EVP_PKEY_free_it EVP_PKEY_meth_free; and also EVP_CIPHER_CTX_cleanup Reviewed-by: Kurt Roeckx <kurt@openssl.org>
* Engage vpaes-armv8 module.Andy Polyakov2015-03-281-0/+3
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* RAND_bytes updatesMatt Caswell2015-03-253-4/+7
| | | | | | | Ensure RAND_bytes return value is checked correctly, and that we no longer use RAND_pseudo_bytes. Reviewed-by: Richard Levitte <levitte@openssl.org>
* free NULL cleanupRich Salz2015-03-241-3/+1
| | | | | | | | Start ensuring all OpenSSL "free" routines allow NULL, and remove any if check before calling them. This gets DH_free, DSA_free, RSA_free Reviewed-by: Matt Caswell <matt@openssl.org>
* make ASN1_OBJECT opaqueDr. Stephen Henson2015-03-241-1/+1
| | | | Reviewed-by: Matt Caswell <matt@openssl.org>
* make dependDr. Stephen Henson2015-03-241-46/+43
| | | | Reviewed-by: Matt Caswell <matt@openssl.org>
* Move some EVP internals to evp_int.hDr. Stephen Henson2015-03-245-69/+4
| | | | | | Move EVP internals to evp_int.h, remove -Ievp hack from crypto/Makefile Reviewed-by: Matt Caswell <matt@openssl.org>
* Move some ASN.1 internals to asn1_int.hDr. Stephen Henson2015-03-243-3/+3
| | | | | | | | Move ASN.1 internals used across multiple directories into new internal header file asn1_int.h remove crypto/Makefile hack which allowed other directories to include "asn1_locl.h" Reviewed-by: Matt Caswell <matt@openssl.org>
* Add AES unwrap test with invalid key.Dr. Stephen Henson2015-03-201-0/+9
| | | | | | | This tests the unwrap algorithm with an invalid key. The result should be rejected without returning any plaintext. Reviewed-by: Emilia Käsper <emilia@openssl.org>
* Fix memory leak.Dr. Stephen Henson2015-03-201-4/+16
| | | | Reviewed-by: Emilia Käsper <emilia@openssl.org>
* Fix EVP_DigestInit_ex with NULL digestMatt Caswell2015-03-121-3/+6
| | | | | | | | Calling EVP_DigestInit_ex which has already had the digest set up for it should be possible. You are supposed to be able to pass NULL for the type. However currently this seg faults. Reviewed-by: Andy Polyakov <appro@openssl.org>
* Merge OPENSSL_NO_EC{DH,DSA} into OPENSSL_NO_ECRich Salz2015-03-112-2/+2
| | | | | | Suggested by John Foley <foleyj@cisco.com>. Reviewed-by: Matt Caswell <matt@openssl.org>
* add RIPEMD160 whirlpool testsDr. Stephen Henson2015-03-042-2/+71
| | | | | | | Add RIPEMD160 and whirlpool test data. Add Count keyword to repeatedly call EVP_DigestUpate. Reviewed-by: Matt Caswell <matt@openssl.org>
* reformat evp_test.cDr. Stephen Henson2015-02-271-9/+9
| | | | Reviewed-by: Matt Caswell <matt@openssl.org>
* Add OCB support and test vectors for evp_test.Dr. Stephen Henson2015-02-272-19/+164
| | | | Reviewed-by: Matt Caswell <matt@openssl.org>
* Skip unsupported digests in evp_testDr. Stephen Henson2015-02-271-1/+8
| | | | Reviewed-by: Matt Caswell <matt@openssl.org>
* add MD4 test dataDr. Stephen Henson2015-02-271-0/+22
| | | | Reviewed-by: Matt Caswell <matt@openssl.org>
* Skip unsupported ciphers in evp_test.Dr. Stephen Henson2015-02-271-1/+7
| | | | Reviewed-by: Matt Caswell <matt@openssl.org>
* Add algorithm skip support.Dr. Stephen Henson2015-02-271-18/+53
| | | | | | | | Add support for skipping disabled algorithms: if an attempt to load a public or private key results in an unknown algorithm error then any test using that key is automatically skipped. Reviewed-by: Tim Hudson <tjh@openssl.org>
* Fix evp_extra_test.c with no-ecMatt Caswell2015-02-261-0/+6
| | | | | | | When OpenSSL is configured with no-ec, then the new evp_extra_test fails to pass. This change adds appropriate OPENSSL_NO_EC guards around the code. Reviewed-by: Tim Hudson <tjh@openssl.org>
* Import evp_test.c from BoringSSL. Unfortunately we already have a fileMatt Caswell2015-02-252-1/+484
| | | | | | called evp_test.c, so I have called this one evp_extra_test.c Reviewed-by: Emilia Käsper <emilia@openssl.org>
* evp/evp_test.c: avoid crashes when referencing uninitialized pointers.Andy Polyakov2015-02-221-0/+2
| | | | | | For some reason failure surfaced on ARM platforms. Reviewed-by: Matt Caswell <matt@openssl.org>
* More RSA tests.Dr. Stephen Henson2015-02-141-0/+34
| | | | Reviewed-by: Andy Polyakov <appro@openssl.org>
* remove unused method declarationDr. Stephen Henson2015-02-131-1/+1
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* Add leak detection, fix leaks.Dr. Stephen Henson2015-02-131-6/+14
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* Add EVP_PKEY test data.Dr. Stephen Henson2015-02-131-0/+136
| | | | | | Add some EVP_PKEY test data for sign and verify tests including failure cases. Reviewed-by: Richard Levitte <levitte@openssl.org>
* EVP_PKEY support for evp_testDr. Stephen Henson2015-02-131-0/+272
| | | | | | | | | | Add two new keywords "PublicKey" and "PrivateKey". These will load a key in PEM format from the lines immediately following the keyword and assign it a name according to the value. These will be used later for public and private key testing operations. Add tests for Sign, Verify, VerifyRecover and Decrypt. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Add CMAC test data.Dr. Stephen Henson2015-02-131-0/+26
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* Add HMAC test data.Dr. Stephen Henson2015-02-131-1/+96
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* MAC support for evp_testDr. Stephen Henson2015-02-131-2/+166
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>