Commit 72b60351 authored by Dr. Stephen Henson's avatar Dr. Stephen Henson
Browse files

Change EVP_MD_CTX_type so it is more logical and add EVP_MD_CTX_md for

the old functionality.

Various warning fixes.

Initial EVP symmetric cipher docs.
parent 1b8a8088
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -4,6 +4,11 @@

 Changes between 0.9.4 and 0.9.5  [xx XXX 2000]

  *) Change the EVP_MD_CTX_type macro so its meaning consistent with
     EVP_MD_type. The old functionality is available in a new macro called
     EVP_MD_md(). Change code that uses it and update docs.
     [Steve Henson]

  *) ..._ctrl functions now have corresponding ..._callback_ctrl functions
     where the 'void *' argument is replaced by a function pointer argument.
     Previously 'void *' was abused to point to functions, which works on
+1 −1
Original line number Diff line number Diff line
@@ -784,7 +784,7 @@ $rc5_obj =

*** debug-steve
$cc           = gcc
$cflags       = -DL_ENDIAN -DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -DPEDANTIC -g -O2 -m486 -pedantic -Wall -Wshadow -pipe
$cflags       = -DL_ENDIAN -DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -DPEDANTIC -g -O2 -m486 -pedantic -Wall -Werror -Wshadow -pipe
$unistd       = 
$thread_cflag = -D_REENTRANT
$lflags       = 
+2 −1
Original line number Diff line number Diff line
@@ -421,9 +421,10 @@ typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
#define EVP_MD_size(e)			((e)->md_size)
#define EVP_MD_block_size(e)		((e)->block_size)

#define EVP_MD_CTX_md(e)		((e)->digest)
#define EVP_MD_CTX_size(e)		EVP_MD_size((e)->digest)
#define EVP_MD_CTX_block_size(e)	EVP_MD_block_size((e)->digest)
#define EVP_MD_CTX_type(e)		((e)->digest)
#define EVP_MD_CTX_type(e)		EVP_MD_type((e)->digest)

#define EVP_CIPHER_nid(e)		((e)->nid)
#define EVP_CIPHER_block_size(e)	((e)->block_size)
+3 −3
Original line number Diff line number Diff line
@@ -554,7 +554,7 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio)
					PKCS7err(PKCS7_F_PKCS7_DATASIGN,PKCS7_R_INTERNAL_ERROR);
					goto err;
					}
				if (EVP_MD_type(EVP_MD_CTX_type(mdc)) == j)
				if (EVP_MD_CTX_type(mdc) == j)
					break;
				else
					btmp=btmp->next_bio;
@@ -588,7 +588,7 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio)
					V_ASN1_UTCTIME,sign_time);

				/* Add digest */
				md_tmp=EVP_MD_CTX_type(&ctx_tmp);
				md_tmp=EVP_MD_CTX_md(&ctx_tmp);
				EVP_DigestFinal(&ctx_tmp,md_data,&md_len);
				digest=M_ASN1_OCTET_STRING_new();
				M_ASN1_OCTET_STRING_set(digest,md_data,md_len);
@@ -746,7 +746,7 @@ int PKCS7_signatureVerify(BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si,
							PKCS7_R_INTERNAL_ERROR);
			goto err;
			}
		if (EVP_MD_type(EVP_MD_CTX_type(mdc)) == md_type)
		if (EVP_MD_CTX_type(mdc) == md_type)
			break;
		btmp=btmp->next_bio;	
		}
+3 −5
Original line number Diff line number Diff line
@@ -21,9 +21,10 @@ EVP_DigestInit, EVP_DigestUpdate, EVP_DigestFinal - EVP digest routines
 #define EVP_MD_size(e)			((e)->md_size)
 #define EVP_MD_block_size(e)		((e)->block_size)

 #define EVP_MD_CTX_md(e)		(e)->digest)
 #define EVP_MD_CTX_size(e)		EVP_MD_size((e)->digest)
 #define EVP_MD_CTX_block_size(e)	EVP_MD_block_size((e)->digest)
 #define EVP_MD_CTX_type(e)		((e)->digest)
 #define EVP_MD_CTX_type(e)		EVP_MD_type((e)->digest)

 EVP_MD *EVP_md_null(void);
 EVP_MD *EVP_md2(void);
@@ -75,7 +76,7 @@ representing the given message digest when passed an B<EVP_MD> structure.
For example EVP_MD_type(EVP_sha1()) returns B<NID_sha1>. This function is
normally used when setting ASN1 OIDs.

EVP_MD_CTX_type() returns the B<EVP_MD> structure corresponding to the passed
EVP_MD_CTX_md() returns the B<EVP_MD> structure corresponding to the passed
B<EVP_MD_CTX>.

EVP_MD_pkey_type() returns the NID of the public key signing algorithm associated
@@ -170,9 +171,6 @@ digest name passed on the command line.

=head1 BUGS

B<EVP_MD_CTX_type> is not a good name because its name wrongly implies it does
the same as B<EVP_MD_type> but takes an B<EVP_MD_CTX> parameter instead.

Several of the functions do not return values: maybe they should. Although the
internal digest operations will never fail some future hardware based operations
might.
Loading