aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/evp/digest.c
Commit message (Collapse)AuthorAgeFilesLines
* Copyright consolidation 04/10Rich Salz2016-05-171-107/+6
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* Remove #error from include files.Rich Salz2016-03-201-3/+1
| | | | | | | | Don't have #error statements in header files, but instead wrap the contents of that file in #ifndef OPENSSL_NO_xxx This means it is now always safe to include the header file. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Fix a potential double free in EVP_DigestInit_exMatt Caswell2016-03-181-1/+3
| | | | | | | | | | There is a potential double free in EVP_DigestInit_ex. This is believed to be reached only as a result of programmer error - but we should fix it anyway. Issue reported by Guido Vranken. Reviewed-by: Richard Levitte <levitte@openssl.org>
* GH715: ENGINE_finish can take NULLRich Salz2016-02-251-13/+8
| | | | | | | Simplifies calling code. Also fixed up any !ptr tests that were nearby, turning them into NULL tests. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Fix GH 327.Rich Salz2016-02-111-1/+1
| | | | | | | Valgrind complains about using unitialized memory. So call OPENSSL_zalloc, not malloc. Reviewed-by: Richard Levitte <levitte@openssl.org>
* GH601: Various spelling fixes.FdaSilvaYY2016-02-051-1/+1
| | | | | Signed-off-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
* Remove /* foo.c */ commentsRich Salz2016-01-261-1/+0
| | | | | | | | | | | | This was done by the following find . -name '*.[ch]' | /tmp/pl where /tmp/pl is the following three-line script: print unless $. == 1 && m@/\* .*\.[ch] \*/@; close ARGV if eof; # Close file to reset $. And then some hand-editing of other files. Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
* Fix a possible memleakRichard Levitte2016-01-021-0/+7
| | | | | | | | If there's a failure allocating md_data, the destination pctx will have a shared pointer with the source EVP_MD_CTX, which will lead to problems when either the source or the destination is freed. Reviewed-by: Stephen Henson <steve@openssl.org>
* Cleanup: fix all sources that used EVP_MD_CTX_(create|init|destroy)Richard Levitte2015-12-071-2/+2
| | | | Reviewed-by: Rich Salz <rsalz@openssl.org>
* Cleanup: rename EVP_MD_CTX_(create|init|destroy) to EVP_MD_CTX_(new|reset|free)Richard Levitte2015-12-071-9/+9
| | | | | | | | | Looking over names, it seems like we usually use names ending with _new and _free as object constructors and destructors. Also, since EVP_MD_CTX_init is now used to reset a EVP_MD_CTX, it might as well be named accordingly. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Remove EVP_MD_CTX_cleanup and put its functionality into EVP_MD_CTX_initRichard Levitte2015-12-071-52/+44
| | | | | | | | | | | The idea is that with EVP_MD_CTX_create() and EVP_MD_CTX_destroy(), EVP_MD_CTX_cleanup and EVP_MD_CTX_init is not used the same as before. Instead, we need a single function that can be used to reinitialise an existing EVP_MD_CTX that's been created with EVP_MD_CTX_create() previously. Combining EVP_MD_CTX_cleanup and EVP_MD_CTX_init into that one function is the answer. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Add inclusion of internal/evp_int.h to all crypto/ files that need itRichard Levitte2015-12-071-0/+1
| | | | | | These are the files that add new EVP_MDs. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Have other crypto/evp files include evp_locl.hRichard Levitte2015-12-071-0/+1
| | | | | | | Note: this does not include the files in crypto/evp that are just instanciations of EVP_MD. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Add EVP_MD_CTX_ctrl function.Dr. Stephen Henson2015-11-241-0/+11
| | | | Reviewed-by: Tim Hudson <tjh@openssl.org>
* Continue standardising malloc style for libcryptoMatt Caswell2015-11-091-2/+2
| | | | | | | Continuing from previous commit ensure our style is consistent for malloc return checks. Reviewed-by: Kurt Roeckx <kurt@openssl.org>
* Identify and move common internal libcrypto header filesRichard Levitte2015-05-141-1/+1
| | | | | | | | | | | | | There are header files in crypto/ that are used by a number of crypto/ submodules. Move those to crypto/include/internal and adapt the affected source code and Makefiles. The header files that got moved are: crypto/cryptolib.h crypto/md32_common.h Reviewed-by: Rich Salz <rsalz@openssl.org>
* memset, memcpy, sizeof consistency fixesRich Salz2015-05-051-2/+2
| | | | | | | | 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-041-4/+4
| | | | | | | | | | | | | 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>
* free cleanup almost the finaleRich Salz2015-04-301-2/+1
| | | | | | | | | | 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 cleanupRich Salz2015-03-281-2/+1
| | | | | | | | | 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>
* 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>
* Run util/openssl-format-source -v -c .Matt Caswell2015-01-221-224/+209
| | | | Reviewed-by: Tim Hudson <tjh@openssl.org>
* Ignore NULL parameter in EVP_MD_CTX_destroy.Dr. Stephen Henson2013-12-201-2/+5
| | | | (cherry picked from commit a6c62f0c25a756c263a80ce52afbae888028e986)
* Fix memory leak: free up ENGINE functional reference if digest is notDr. Stephen Henson2010-03-051-0/+1
| | | | found in an ENGINE.
* Add patch to crypto/evp which didn't apply from PR#2124Dr. Stephen Henson2009-12-091-0/+6
|
* PR: 2124Dr. Stephen Henson2009-12-091-3/+13
| | | | | | Submitted by: Jan Pechanec <Jan.Pechanec@Sun.COM> Check for memory allocation failures.
* Formatting.Ben Laurie2008-11-041-2/+1
|
* Copy update callback across when copying EVP_MD_CTX.Dr. Stephen Henson2007-04-121-0/+2
| | | | Remove unnecessary reference to EVP_MD_CTX in HMAC pkey method.
* Experimental HMAC support via EVP_PKEY_METHOD.Dr. Stephen Henson2007-04-111-3/+16
|
* Allow digests to supply S/MIME micalg values from a ctrl.Dr. Stephen Henson2006-07-101-0/+2
| | | | | Send ctrls to EVP_PKEY_METHOD during signing of PKCS7 structure so customisation is possible.
* Update EVP_MD_CTX_copy_ex() to use EVP_PKEY_CTX_dup().Dr. Stephen Henson2006-05-251-0/+10
|
* Fix more error codes.Bodo Möller2005-05-111-5/+5
| | | | | (Also improve util/ck_errf.pl script, and occasionally fix source code formatting.)
* size_t-fication of message digest APIs. We should size_t-fy more APIs...Andy Polyakov2004-05-151-3/+3
|
* Constify d2i, s2i, c2i and r2i functions and other associatedRichard Levitte2004-03-151-1/+1
| | | | | | | | functions and macros. This change has associated tags: LEVITTE_before_const and LEVITTE_after_const. Those will be removed when this change has been properly reviewed.
* Add flag to avoid continuousDr. Stephen Henson2004-02-011-3/+12
| | | | | | | memory allocate when calling EVP_MD_CTX_copy_ex(). Without this HMAC is several times slower than < 0.9.7.
* Fixes for EVP_DigestInit_ex() and OPENSSL_NO_ENGINE.Dr. Stephen Henson2003-03-121-1/+1
|
* Add the possibility to build without the ENGINE framework.Richard Levitte2003-01-301-1/+12
| | | | PR: 287
* Cleanse memory using the new OPENSSL_cleanse() function.Richard Levitte2002-11-281-1/+1
| | | | I've covered all the memset()s I felt safe modifying, but may have missed some.
* Security fixes brought forward from 0.9.7.Ben Laurie2002-11-131-0/+2
|
* Make ciphers and digests obtain an ENGINE functional referenceDr. Stephen Henson2002-03-091-1/+9
| | | | if impl is explicitly supplied.
* The 'type' parameter, an EVP_MD pointer, represents the type of digestGeoff Thorpe2002-01-251-1/+1
| | | | | | required as well as a default implementation (when no ENGINE provides a replacement implementation). This change makes sure the correct implementation's "init()" handler is used rather than assuming 'type'.
* Constification, add config to /dev/crypto.Ben Laurie2002-01-181-1/+1
|
* Retain compatibility of EVP_DigestInit() and EVP_DigestFinal()Dr. Stephen Henson2001-10-161-3/+19
| | | | | | with existing code. Modify library to use digest *_ex() functions.
* Don't clean up stuff twice.Ben Laurie2001-09-261-2/+9
|
* This changes EVP's cipher and digest code to hook via the ENGINE support.Geoff Thorpe2001-09-251-0/+58
| | | | | | | | | | See crypto/engine/README for details. - it also removes openbsd_hw.c from the build (that functionality is going to be available in the openbsd ENGINE in a upcoming commit) - evp_test has had the extra initialisation added so it will use (if possible) any ENGINEs supporting the algorithms required.
* typoBodo Möller2001-09-101-0/+1
|
* Get rid of hazardous EVP_DigestInit_dbg/EVP_DigestInit caseBodo Möller2001-09-101-34/+78
| | | | | | | | | | | | | distinction (which does not work well because if CRYPTO_MDEBUG is defined at library compile time, it is not necessarily defined at application compile time; and memory debugging now can be reconfigured at run-time anyway). To get the intended semantics, we could just use the EVP_DigestInit_dbg unconditionally (which uses the caller's __FILE__ and __LINE__ for memory leak debugging), but this would make memory debugging inconsistent. Instead, callers can use CRYPTO_push_info() to track down memory leaks. Also fix indentation, and add OpenSSL copyright.
* Add a cleanup function for MDs.Ben Laurie2001-09-071-0/+2
|
* Make MD functions take EVP_MD_CTX * instead of void *, add copy() function.Ben Laurie2001-09-021-10/+20
|
* Only OPENSSL_free() non-NULL pointers.Geoff Thorpe2001-09-011-4/+6
|