summaryrefslogtreecommitdiffstats
path: root/crypto
AgeCommit message (Collapse)Author
2015-04-30free cleanup almost the finaleRich Salz
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>
2015-04-30free NULL cleanup 5aRich Salz
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>
2015-04-30free NULL cleanup 8Rich Salz
Do not check for NULL before calling a free routine. This addresses: ASN1_BIT_STRING_free ASN1_GENERALIZEDTIME_free ASN1_INTEGER_free ASN1_OBJECT_free ASN1_OCTET_STRING_free ASN1_PCTX_free ASN1_SCTX_free ASN1_STRING_clear_free ASN1_STRING_free ASN1_TYPE_free ASN1_UTCTIME_free M_ASN1_free_of Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-04-28realloc of NULL is like mallocRich Salz
ANSI C, and OpenSSL's malloc wrapper do this, also. Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-04-28remove malloc castsRich Salz
Following ANSI C rules, remove the casts from calls to OPENSSL_malloc and OPENSSL_realloc. Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-04-28ERR_ cleanupRich Salz
Remove ERR_[gs]et_implementation as they were not undocumented and useless (the data structure was opaque). Halve the number of lock/unlock calls in almost all ERR_ functions by letting the caller of get_hash or int_thread_set able to lock. Very useful when looping, such as adding errors, or when getting the hash and immediately doing a lookup on it. Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-04-28NISTZ256: owur'ize.Emilia Kasper
__owur'ize static methods to catch calling errors within the module. Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-04-27NISTZ256: use EC_POINT API and check errors.Emilia Kasper
Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-04-27CRYPTO_mem_leaks should ignore it's BIO argument.Rich Salz
CRYPTO_mem_leaks takes a BIO* argument. It's not a leak if that argument hasn't been free'd. Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-04-27NISTZ256: don't swallow malloc errorsEmilia Kasper
Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-04-27NISTZ256: set Z_is_one to boolean 0/1 as is customary.Emilia Kasper
Cosmetic, no real effect. Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-04-27Error checking and memory leak fixes in NISTZ256.Emilia Kasper
Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-04-24Big apps cleanup (option-parsing, etc)Rich Salz
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>
2015-04-24Fix error checking and memory leaks in NISTZ256 precomputation.Emilia Kasper
Thanks to Brian Smith for reporting these issues. Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-04-24Correctly set Z_is_one on the return value in the NISTZ256 implementation.Emilia Kasper
Also add a few comments about constant-timeness. Thanks to Brian Smith for reporting this issue. Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-04-22Fix CRYPTO_strdupLoganaden Velvindron
The function CRYPTO_strdup (aka OPENSSL_strdup) fails to check the return value from CRYPTO_malloc to see if it is NULL before attempting to use it. This patch adds a NULL check. RT3786 Signed-off-by: Matt Caswell <matt@openssl.org> (cherry picked from commit 37b0cf936744d9edb99b5dd82cae78a7eac6ad60) Reviewed-by: Rich Salz <rsalz@openssl.org> (cherry picked from commit 20d21389c8b6f5b754573ffb6a4dc4f3986f2ca4)
2015-04-21Add ec/asm/ecp_nistz256-sparcv9.pl.Andy Polyakov
Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-04-21modes/asm/ghashv8-armx.pl: additional performance data.Andy Polyakov
Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-04-20aes/asm/aesni-x86.pl: fix typo affecting Windows build.Andy Polyakov
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-04-20aes/asm/aesni-x86[_64].pl update.Andy Polyakov
This addresses - request for improvement for faster key setup in RT#3576; - clearing registers and stack in RT#3554 (this is more of a gesture to see if there will be some traction from compiler side); - more commentary around input parameters handling and stack layout (desired when RT#3553 was reviewed); - minor size and single block performance optimization (was lying around); Reviewed-by: Matt Caswell <matt@openssl.org>
2015-04-20Add assembly support for 32-bit iOS.Andy Polyakov
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-04-20Add ecp_nistz256-armv8 module.Andy Polyakov
Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-04-20crypto/ec/ecp_nistp[224|521].c: fix formatting.Andy Polyakov
Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-04-20ec/ecp_nistp*.c: fix SEGVs.Andy Polyakov
Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-04-20Add ARMv8 Montgomery multiplication module.Andy Polyakov
Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-04-20aes/asm/vpaes-armv8.pl: make it compile on iOS.Andy Polyakov
Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-04-18Fix encoding bug in i2c_ASN1_INTEGERDr. Stephen Henson
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. Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-04-16Code style: space after 'if'Viktor Dukhovni
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-04-16Reject empty generation strings.Dr. Stephen Henson
Reported by Hanno Böck <hanno@hboeck.de> Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-04-16Limit depth of nested sequences when generating ASN.1Dr. Stephen Henson
Reported by Hanno Böck <hanno@hboeck.de> PR#3800 Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-04-11free NULL cleanup 9Rich Salz
Ongoing work to skip NULL check before calling free routine. This gets: ecp_nistz256_pre_comp_free nistp224_pre_comp_free nistp256_pre_comp_free nistp521_pre_comp_free PKCS7_free PKCS7_RECIP_INFO_free PKCS7_SIGNER_INFO_free sk_PKCS7_pop_free PKCS8_PRIV_KEY_INFO_free PKCS12_free PKCS12_SAFEBAG_free PKCS12_free sk_PKCS12_SAFEBAG_pop_free SSL_CONF_CTX_free SSL_CTX_free SSL_SESSION_free SSL_free ssl_cert_free ssl_sess_cert_free Reviewed-by: Kurt Roeckx <kurt@openssl.org>
2015-04-11Fix memory leakRich Salz
It should have freed them when != NULL, not when == NULL. Reviewed-by: Kurt Roeckx <kurt@roeckx.be> Reviewed-by: Viktor Dukhovni <openssl-users@dukhovni.org>
2015-04-11do_dirname: Don't change gen on failuresKurt Roeckx
It would set gen->d.dirn to a freed pointer in case X509V3_NAME_from_section failed. Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-04-11X509_VERIFY_PARAM_free: Check param for NULLKurt Roeckx
Reviewed-by: Viktor Dukhovni <openssl-users@dukhovni.org>
2015-04-10Don't set *pval to NULL in ASN1_item_ex_new.Dr. Stephen Henson
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. Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-04-10Fix ECDH key identifier support.Dr. Stephen Henson
PR#3789 Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-04-04Appease clang -WshadowRichard Levitte
The macros BSWAP4 and BSWAP8 have statetemnt expressions implementations that use local variable names that shadow variables outside the macro call, generating warnings like this e_aes_cbc_hmac_sha1.c:263:14: warning: declaration shadows a local variable [-Wshadow] seqnum = BSWAP8(blocks[0].q[0]); ^ ../modes/modes_lcl.h:41:29: note: expanded from macro 'BSWAP8' ^ e_aes_cbc_hmac_sha1.c:223:12: note: previous declaration is here size_t ret = 0; ^ Have clang be quiet by modifying the macro variable names slightly (suffixing them with an underscore). Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-04-04Appease clang -Wempty-translation-unitRichard Levitte
ebcdic.c:284:7: warning: ISO C requires a translation unit to contain at least one declaration [-Wempty-translation-unit] ^ 1 warning generated. Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-04-03make dependDr. Stephen Henson
Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-04-03Remove old ASN.1 functions.Dr. Stephen Henson
Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-04-03Remove unnecessary use of ASN1_const_CTXDr. Stephen Henson
Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-04-02modes/asm/ghashv8-armx.pl: up to 90% performance improvement.Andy Polyakov
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-04-02sha/asm/sha*-armv8.pl: add Denver and X-Gene esults.Andy Polyakov
Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-04-02aes/asm/aesv8-armx.pl: optimize for Cortex-A5x.Andy Polyakov
ARM has optimized Cortex-A5x pipeline to favour pairs of complementary AES instructions. While modified code improves performance of post-r0p0 Cortex-A53 performance by >40% (for CBC decrypt and CTR), it hurts original r0p0. We favour later revisions, because one can't prevent future from coming. Improvement on post-r0p0 Cortex-A57 exceeds 50%, while new code is not slower on r0p0, or Apple A7 for that matter. [Update even SHA results for latest Cortex-A53.] Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-04-02perlasm/arm-xlate.pl update (fix end-less loop and prepare for 32-bit iOS).Andy Polyakov
Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-04-01make updateEmilia Kasper
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-03-31Remove SSL_TASK, the DECnet Based SSL EngineRichard Levitte
This engine is for VMS only, and isn't really part of the core OpenSSL but rather a side project of its own that just happens to have tagged along for a long time. The reasons why it has remained within the OpenSSL source are long lost in history, and there not being any real reason for it to remain here, it's time for it to move out. This side project will appear as a project in its own right, the location of which will be announced later on. Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-03-31Remove old ASN.1 code from evp_asn1.cDr. Stephen Henson
Rewrite ASN1_TYPE_set_int_octetstring and ASN1_TYPE_get_int_octetstring to use the new ASN.1 code instead of the old macros. Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-03-31Remove EXHEADER, TEST, APPS, links:, install: and uninstall: where relevantRichard Levitte
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>
2015-03-31Stop symlinking, move files to intended directoryRichard Levitte
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>