Browse Source

Add ctrl to EVP_MD and EVP_PKEY_CTX to EVP_MD_CTX. These will be used
for enhanced sign/verify operations.

Dr. Stephen Henson 18 years ago
parent
commit
0965991600
1 changed files with 36 additions and 0 deletions
  1. 36 0
      crypto/evp/evp.h

+ 36 - 0
crypto/evp/evp.h

@@ -176,6 +176,8 @@ struct env_md_st
 	int required_pkey_type[5]; /*EVP_PKEY_xxx */
 	int block_size;
 	int ctx_size; /* how big does the ctx->md_data need to be */
+	/* control function */
+	int (*md_ctrl)(EVP_MD_CTX *ctx, int cmd, int p1, void *p2);
 	} /* EVP_MD */;
 
 typedef int evp_sign_method(int type,const unsigned char *m,
@@ -197,6 +199,30 @@ typedef int evp_verify_method(int type,const unsigned char *m,
 
 #define EVP_MD_FLAG_PKEY_METHOD_SIGNATURE	0x0004
 
+/* DigestAlgorithmIdentifier flags... */
+
+#define EVP_MD_FLAG_DIGALGID_MASK		0x0018
+
+/* NULL or absent parameter accepted. Use NULL */
+
+#define EVP_MD_FLAG_DIGALGID_NULL		0x0000
+
+/* NULL or absent parameter accepted. Use NULL for PKCS#1 otherwise absent */
+
+#define EVP_MD_FLAG_DIGALGID_ABSENT		0x0008
+
+/* Custom handling via ctrl */
+
+#define EVP_MD_FLAG_DIGALGID_CUSTOM		0x0018
+
+/* Digest ctrls */
+
+#define	EVP_MD_CTRL_DIGALGID			0x1
+
+/* Minimum Algorithm specific ctrl value */
+
+#define	EVP_MD_CTRL_ALG_CTRL			0x1000
+
 #define EVP_PKEY_NULL_method	NULL,NULL,{0,0,0,0}
 
 #ifndef OPENSSL_NO_DSA
@@ -237,6 +263,8 @@ struct env_md_ctx_st
 	ENGINE *engine; /* functional reference if 'digest' is ENGINE-provided */
 	unsigned long flags;
 	void *md_data;
+	/* Public key context for sign/verify */
+	EVP_PKEY_CTX *pctx;
 	} /* EVP_MD_CTX */;
 
 /* values for EVP_MD_CTX flags */
@@ -248,6 +276,14 @@ struct env_md_ctx_st
 #define EVP_MD_CTX_FLAG_REUSE		0x0004 /* Don't free up ctx->md_data
 						* in EVP_MD_CTX_cleanup */
 
+/* MD operational flags */
+
+#define EVP_MD_CTX_FLAG_OP_MASK		0x00f0
+
+#define EVP_MD_CTX_FLAG_OP_DIGEST	0x0000
+#define EVP_MD_CTX_FLAG_OP_SIGN		0x0010
+#define EVP_MD_CTX_FLAG_OP_VERIFY	0x0020
+
 struct evp_cipher_st
 	{
 	int nid;