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

Allow digests to supply S/MIME micalg values from a ctrl.

Send ctrls to EVP_PKEY_METHOD during signing of PKCS7 structure so
customisation is possible.
parent 0ee2166c
Loading
Loading
Loading
Loading
+10 −0
Original line number Original line Diff line number Diff line
@@ -4,6 +4,16 @@


 Changes between 0.9.8b and 0.9.9  [xx XXX xxxx]
 Changes between 0.9.8b and 0.9.9  [xx XXX xxxx]


  *) Allow digests to supply their own micalg string for S/MIME type using
     the ctrl EVP_MD_CTRL_MICALG.
     [Steve Henson]

  *) During PKCS7 signing pass the PKCS7 SignerInfo structure to the
     EVP_PKEY_METHOD before and after signing via the EVP_PKEY_CTRL_PKCS7_SIGN
     ctrl. It can then customise the structure before and/or after signing
     if necessary.
     [Steve Henson]

  *) New function OBJ_add_sigid() to allow application defined signature OIDs
  *) New function OBJ_add_sigid() to allow application defined signature OIDs
     to be added to OpenSSLs internal tables. New function OBJ_sigid_free()
     to be added to OpenSSLs internal tables. New function OBJ_sigid_free()
     to free up any added signature OIDs.
     to free up any added signature OIDs.
+3 −0
Original line number Original line Diff line number Diff line
@@ -169,6 +169,9 @@ static int pkey_dsa_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
		dctx->md = p2;
		dctx->md = p2;
		return 1;
		return 1;


		case EVP_PKEY_CTRL_PKCS7_SIGN:
		return 1;

		default:
		default:
		return -2;
		return -2;


+1 −0
Original line number Original line Diff line number Diff line
@@ -230,6 +230,7 @@ static int pkey_ec_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)


		case EVP_PKEY_CTRL_PEER_KEY:
		case EVP_PKEY_CTRL_PEER_KEY:
		/* Default behaviour is OK */
		/* Default behaviour is OK */
		case EVP_PKEY_CTRL_PKCS7_SIGN:
		return 1;
		return 1;


		default:
		default:
+2 −0
Original line number Original line Diff line number Diff line
@@ -332,6 +332,8 @@ int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx)
		OPENSSL_cleanse(ctx->md_data,ctx->digest->ctx_size);
		OPENSSL_cleanse(ctx->md_data,ctx->digest->ctx_size);
		OPENSSL_free(ctx->md_data);
		OPENSSL_free(ctx->md_data);
		}
		}
	if (ctx->pctx)
		EVP_PKEY_CTX_free(ctx->pctx);
#ifndef OPENSSL_NO_ENGINE
#ifndef OPENSSL_NO_ENGINE
	if(ctx->engine)
	if(ctx->engine)
		/* The EVP_MD we used belongs to an ENGINE, release the
		/* The EVP_MD we used belongs to an ENGINE, release the
+9 −3
Original line number Original line Diff line number Diff line
@@ -218,6 +218,7 @@ typedef int evp_verify_method(int type,const unsigned char *m,
/* Digest ctrls */
/* Digest ctrls */


#define	EVP_MD_CTRL_DIGALGID			0x1
#define	EVP_MD_CTRL_DIGALGID			0x1
#define	EVP_MD_CTRL_MICALG			0x2


/* Minimum Algorithm specific ctrl value */
/* Minimum Algorithm specific ctrl value */


@@ -455,6 +456,9 @@ typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
#define EVP_SignDigestUpdate(a,b,c)	EVP_DigestUpdate(a,b,c)
#define EVP_SignDigestUpdate(a,b,c)	EVP_DigestUpdate(a,b,c)
#define EVP_VerifyDigestUpdate(a,b,c)	EVP_DigestUpdate(a,b,c)
#define EVP_VerifyDigestUpdate(a,b,c)	EVP_DigestUpdate(a,b,c)


#define EVP_DigestSignUpdate(a,b,c)		EVP_DigestUpdate(a,b,c)
#define EVP_DigestVerifyUpdate(a,b,c)		EVP_DigestUpdate(a,b,c)

#ifdef CONST_STRICT
#ifdef CONST_STRICT
void BIO_set_md(BIO *,const EVP_MD *md);
void BIO_set_md(BIO *,const EVP_MD *md);
#else
#else
@@ -986,6 +990,8 @@ void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth,
#define EVP_PKEY_CTRL_PKCS7_ENCRYPT	3
#define EVP_PKEY_CTRL_PKCS7_ENCRYPT	3
#define EVP_PKEY_CTRL_PKCS7_DECRYPT	4
#define EVP_PKEY_CTRL_PKCS7_DECRYPT	4


#define EVP_PKEY_CTRL_PKCS7_SIGN	5

#define EVP_PKEY_ALG_CTRL		0x1000
#define EVP_PKEY_ALG_CTRL		0x1000


#define EVP_PKEY_FLAG_AUTOARGLEN	2
#define EVP_PKEY_FLAG_AUTOARGLEN	2
Loading