List Info

Thread: OpenSSL: openssl/crypto/cms/ cms.h cms_asn1.c cms_lcl.h openssl/...




OpenSSL: openssl/crypto/cms/ cms.h cms_asn1.c cms_lcl.h openssl/...
country flaguser name
Germany
2008-03-24 17:14:03
  OpenSSL CVS Repository
  http://cvs.openssl.org/
 
____________________________________________________________
________________

  Server: cvs.openssl.org                  Name:   Dr.
Stephen Henson
  Root:   /v/openssl/cvs                   Email:  steveopenssl.org
  Module: openssl                          Date:  
24-Mar-2008 23:14:02
  Branch: HEAD                             Handle:
2008032422140101

  Modified files:
    openssl/crypto/cms      cms.h cms_asn1.c cms_lcl.h
    openssl/crypto/x509v3   v3_alt.c v3err.c x509v3.h

  Log:
    Add signed receipt ASN1 structures. Initial GENERAL_NAME
utility
    functions.

  Summary:
    Revision    Changes     Path
    1.17        +2  -0      openssl/crypto/cms/cms.h
    1.6         +13 -0      openssl/crypto/cms/cms_asn1.c
    1.7         +32 -0      openssl/crypto/cms/cms_lcl.h
    1.37        +69 -47     openssl/crypto/x509v3/v3_alt.c
    1.41        +3  -1      openssl/crypto/x509v3/v3err.c
    1.116       +6  -0      openssl/crypto/x509v3/x509v3.h
 
____________________________________________________________
________________

  patch -p0 <<' .'
  Index: openssl/crypto/cms/cms.h
 
============================================================
================
  $ cvs diff -u -r1.16 -r1.17 cms.h
  --- openssl/crypto/cms/cms.h	19 Mar 2008 19:34:29
-0000	1.16
  +++ openssl/crypto/cms/cms.h	24 Mar 2008 22:14:01
-0000	1.17
   -71,6 +71,8 
   typedef struct CMS_CertificateChoices
CMS_CertificateChoices;
   typedef struct CMS_RevocationInfoChoice_st
CMS_RevocationInfoChoice;
   typedef struct CMS_RecipientInfo_st CMS_RecipientInfo;
  +typedef struct CMS_ReceiptRequest_st CMS_ReceiptRequest;
  +typedef struct CMS_Receipt_st CMS_Receipt;
   
   DECLARE_STACK_OF(CMS_SignerInfo)
   DECLARE_ASN1_FUNCTIONS(CMS_ContentInfo)
   .
  patch -p0 <<' .'
  Index: openssl/crypto/cms/cms_asn1.c
 
============================================================
================
  $ cvs diff -u -r1.5 -r1.6 cms_asn1.c
  --- openssl/crypto/cms/cms_asn1.c	16 Mar 2008 21:05:37
-0000	1.5
  +++ openssl/crypto/cms/cms_asn1.c	24 Mar 2008 22:14:01
-0000	1.6
   -53,6 +53,7 
   
   #include <openssl/asn1t.h>
   #include <openssl/pem.h>
  +#include <openssl/x509v3.h>
   #include "cms.h"
   #include "cms_lcl.h"
   
   -357,3 +358,15 
   				V_ASN1_SET, CMS_ATTRIBUTES, X509_ATTRIBUTE)
   ASN1_ITEM_TEMPLATE_END(CMS_Attributes_Verify)
   
  +
  +
  +ASN1_CHOICE(CMS_ReceiptsFrom) = {
  +  ASN1_IMP(CMS_ReceiptsFrom, d.allOrFirstTier, LONG, 0),
  +  ASN1_IMP_SEQUENCE_OF(CMS_ReceiptsFrom, d.receiptList,
GENERAL_NAME, 1)
  +} ASN1_CHOICE_END(CMS_ReceiptsFrom)
  +
  +ASN1_SEQUENCE(CMS_ReceiptRequest) = {
  +  ASN1_SIMPLE(CMS_ReceiptRequest,
signedContentIdentifier, ASN1_OCTET_STRING),
  +  ASN1_SIMPLE(CMS_ReceiptRequest, receiptsFrom,
CMS_ReceiptsFrom)
  +} ASN1_SEQUENCE_END(CMS_ReceiptRequest)
  +
   .
  patch -p0 <<' .'
  Index: openssl/crypto/cms/cms_lcl.h
 
============================================================
================
  $ cvs diff -u -r1.6 -r1.7 cms_lcl.h
  --- openssl/crypto/cms/cms_lcl.h	17 Mar 2008 13:38:51
-0000	1.6
  +++ openssl/crypto/cms/cms_lcl.h	24 Mar 2008 22:14:01
-0000	1.7
   -91,6 +91,7 
   typedef struct CMS_KEKRecipientInfo_st
CMS_KEKRecipientInfo;
   typedef struct CMS_PasswordRecipientInfo_st
CMS_PasswordRecipientInfo;
   typedef struct CMS_OtherRecipientInfo_st
CMS_OtherRecipientInfo;
  +typedef struct CMS_ReceiptsFrom_st CMS_ReceiptsFrom;
   
   struct CMS_ContentInfo_st
   	{
   -374,6 +375,37 
    	ASN1_TYPE *keyAttr;
   	};
   
  +/* ESS structures */
  +
  +#ifdef HEADER_X509V3_H
  +
  +struct CMS_ReceiptRequest_st
  +	{
  +	ASN1_OCTET_STRING *signedContentIdentifier;
  +	CMS_ReceiptsFrom *receiptsFrom;
  +	GENERAL_NAMES *receiptsTo;
  +	};
  +
  +
  +struct CMS_ReceiptsFrom_st
  +	{
  +	int type;
  +	union
  +		{
  +		long allOrFirstTier;
  +		GENERAL_NAMES *receiptList;
  +		} d;
  +	};
  +#endif
  +
  +struct CMS_Receipt_st
  +	{
  +	long version;
  +	ASN1_OBJECT *contentType;
  +	ASN1_OCTET_STRING *signedContentIdentifier;
  +	ASN1_OCTET_STRING *originatorSignatureValue;
  +	};
  +
   DECLARE_ASN1_FUNCTIONS(CMS_ContentInfo)
   DECLARE_ASN1_ITEM(CMS_SignerInfo)
   DECLARE_ASN1_ITEM(CMS_IssuerAndSerialNumber)
   .
  patch -p0 <<' .'
  Index: openssl/crypto/x509v3/v3_alt.c
 
============================================================
================
  $ cvs diff -u -r1.36 -r1.37 v3_alt.c
  --- openssl/crypto/x509v3/v3_alt.c	21 Jan 2007 13:07:16
-0000	1.36
  +++ openssl/crypto/x509v3/v3_alt.c	24 Mar 2008 22:14:02
-0000	1.37
   -414,22 +414,16 
   	return v2i_GENERAL_NAME_ex(NULL, method, ctx, cnf, 0);
   	}
   
  -GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out,
  +GENERAL_NAME *a2i_GENERAL_NAME(GENERAL_NAME *out,
   				X509V3_EXT_METHOD *method, X509V3_CTX *ctx,
  -						 CONF_VALUE *cnf, int is_nc)
  +				int gen_type, char *value, int is_nc)
   	{
   	char is_string = 0;
  -	int type;
   	GENERAL_NAME *gen = NULL;
   
  -	char *name, *value;
  -
  -	name = cnf->name;
  -	value = cnf->value;
  -
   	if(!value)
   		{
 
-		X509V3err(X509V3_F_V2I_GENERAL_NAME_EX,X509V3_R_MISSING_V
ALUE);
 
+		X509V3err(X509V3_F_A2I_GENERAL_NAME,X509V3_R_MISSING_VALU
E);
   		return NULL;
   		}
   
   -440,74 +434,60 
   		gen = GENERAL_NAME_new();
   		if(gen == NULL)
   			{
 
-			X509V3err(X509V3_F_V2I_GENERAL_NAME_EX,ERR_R_MALLOC_FAIL
URE);
 
+			X509V3err(X509V3_F_A2I_GENERAL_NAME,ERR_R_MALLOC_FAILURE
);
   			return NULL;
   			}
   		}
   
  -	if(!name_cmp(name, "email"))
  -		{
  -		is_string = 1;
  -		type = GEN_EMAIL;
  -		}
  -	else if(!name_cmp(name, "URI"))
  +	switch (gen_type)
   		{
  +		case GEN_URI:
  +		case GEN_EMAIL:
  +		case GEN_DNS:
   		is_string = 1;
  -		type = GEN_URI;
  -		}
  -	else if(!name_cmp(name, "DNS"))
  -		{
  -		is_string = 1;
  -		type = GEN_DNS;
  -		}
  -	else if(!name_cmp(name, "RID"))
  +		break;
  +		
  +		case GEN_RID:
   		{
   		ASN1_OBJECT *obj;
   		if(!(obj = OBJ_txt2obj(value,0)))
   			{
 
-			X509V3err(X509V3_F_V2I_GENERAL_NAME_EX,X509V3_R_BAD_OBJE
CT);
 
+			X509V3err(X509V3_F_A2I_GENERAL_NAME,X509V3_R_BAD_OBJECT)
;
   			ERR_add_error_data(2, "value=", value);
   			goto err;
   			}
   		gen->d.rid = obj;
  -		type = GEN_RID;
   		}
  -	else if(!name_cmp(name, "IP"))
  -		{
  +
  +		case GEN_IPADD:
   		if (is_nc)
   			gen->d.ip = a2i_IPADDRESS_NC(value);
   		else
   			gen->d.ip = a2i_IPADDRESS(value);
   		if(gen->d.ip == NULL)
   			{
 
-			X509V3err(X509V3_F_V2I_GENERAL_NAME_EX,X509V3_R_BAD_IP_A
DDRESS);
 
+			X509V3err(X509V3_F_A2I_GENERAL_NAME,X509V3_R_BAD_IP_ADDR
ESS);
   			ERR_add_error_data(2, "value=", value);
   			goto err;
   			}
  -		type = GEN_IPADD;
  -		}
  -	else if(!name_cmp(name, "dirName"))
  -		{
  -		type = GEN_DIRNAME;
  +		break;
  +
  +		case GEN_DIRNAME:
   		if (!do_dirname(gen, value, ctx))
   			{
 
-			X509V3err(X509V3_F_V2I_GENERAL_NAME_EX,X509V3_R_DIRNAME_
ERROR);
 
+			X509V3err(X509V3_F_A2I_GENERAL_NAME,X509V3_R_DIRNAME_ERR
OR);
   			goto err;
   			}
  -		}
  -	else if(!name_cmp(name, "otherName"))
  -		{
  +		break;
  +
  +		case GEN_OTHERNAME:
   		if (!do_othername(gen, value, ctx))
   			{
 
-			X509V3err(X509V3_F_V2I_GENERAL_NAME_EX,X509V3_R_OTHERNAM
E_ERROR);
 
+			X509V3err(X509V3_F_A2I_GENERAL_NAME,X509V3_R_OTHERNAME_E
RROR);
   			goto err;
   			}
  -		type = GEN_OTHERNAME;
  -		}
  -	else
  -		{
 
-		X509V3err(X509V3_F_V2I_GENERAL_NAME_EX,X509V3_R_UNSUPPORT
ED_OPTION);
  -		ERR_add_error_data(2, "name=", name);
  +		default:
 
+		X509V3err(X509V3_F_A2I_GENERAL_NAME,X509V3_R_UNSUPPORTED_
TYPE);
   		goto err;
   		}
   
   -517,12 +497,12 
   			      !ASN1_STRING_set(gen->d.ia5, (unsigned
char*)value,
   					       strlen(value)))
   			{
 
-			X509V3err(X509V3_F_V2I_GENERAL_NAME_EX,ERR_R_MALLOC_FAIL
URE);
 
+			X509V3err(X509V3_F_A2I_GENERAL_NAME,ERR_R_MALLOC_FAILURE
);
   			goto err;
   			}
   		}
   
  -	gen->type = type;
  +	gen->type = gen_type;
   
   	return gen;
   
   -531,6 +511,48 
   	return NULL;
   	}
   
  +GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out,
  +				X509V3_EXT_METHOD *method, X509V3_CTX *ctx,
  +						 CONF_VALUE *cnf, int is_nc)
  +	{
  +	int type;
  +
  +	char *name, *value;
  +
  +	name = cnf->name;
  +	value = cnf->value;
  +
  +	if(!value)
  +		{
 
+		X509V3err(X509V3_F_V2I_GENERAL_NAME_EX,X509V3_R_MISSING_V
ALUE);
  +		return NULL;
  +		}
  +
  +	if(!name_cmp(name, "email"))
  +		type = GEN_EMAIL;
  +	else if(!name_cmp(name, "URI"))
  +		type = GEN_URI;
  +	else if(!name_cmp(name, "DNS"))
  +		type = GEN_DNS;
  +	else if(!name_cmp(name, "RID"))
  +		type = GEN_RID;
  +	else if(!name_cmp(name, "IP"))
  +		type = GEN_IPADD;
  +	else if(!name_cmp(name, "dirName"))
  +		type = GEN_DIRNAME;
  +	else if(!name_cmp(name, "otherName"))
  +		type = GEN_OTHERNAME;
  +	else
  +		{
 
+		X509V3err(X509V3_F_V2I_GENERAL_NAME_EX,X509V3_R_UNSUPPORT
ED_OPTION);
  +		ERR_add_error_data(2, "name=", name);
  +		return NULL;
  +		}
  +
  +	return a2i_GENERAL_NAME(out, method, ctx, type, value,
is_nc);
  +
  +	}
  +
   static int do_othername(GENERAL_NAME *gen, char *value,
X509V3_CTX *ctx)
   	{
   	char *objtmp = NULL, *p;
   .
  patch -p0 <<' .'
  Index: openssl/crypto/x509v3/v3err.c
 
============================================================
================
  $ cvs diff -u -r1.40 -r1.41 v3err.c
  --- openssl/crypto/x509v3/v3err.c	27 Nov 2006 14:18:05
-0000	1.40
  +++ openssl/crypto/x509v3/v3err.c	24 Mar 2008 22:14:02
-0000	1.41
   -1,6 +1,6 
   /* crypto/x509v3/v3err.c */
   /*
============================================================
========
  - * Copyright (c) 1999-2006 The OpenSSL Project.  All
rights reserved.
  + * Copyright (c) 1999-2007 The OpenSSL Project.  All
rights reserved.
    *
    * Redistribution and use in source and binary forms,
with or without
    * modification, are permitted provided that the
following conditions
   -70,6 +70,7 
   
   static ERR_STRING_DATA X509V3_str_functs[]=
   	{
 
+{ERR_FUNC(X509V3_F_A2I_GENERAL_NAME),	"A2I_GENERAL_NAM
E"},
  
{ERR_FUNC(X509V3_F_ASIDENTIFIERCHOICE_CANONIZE),	"ASIDE
NTIFIERCHOICE_CANONIZE"},
  
{ERR_FUNC(X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL),	"A
SIDENTIFIERCHOICE_IS_CANONICAL"},
   {ERR_FUNC(X509V3_F_COPY_EMAIL),	"COPY_EMAIL"},
   -205,6 +206,7 
  
{ERR_REASON(X509V3_R_UNKNOWN_EXTENSION_NAME),"unknown
extension name"},
   {ERR_REASON(X509V3_R_UNKNOWN_OPTION)     ,"unknown
option"},
   {ERR_REASON(X509V3_R_UNSUPPORTED_OPTION)
,"unsupported option"},
  +{ERR_REASON(X509V3_R_UNSUPPORTED_TYPE)  
,"unsupported type"},
   {ERR_REASON(X509V3_R_USER_TOO_LONG)      ,"user too
long"},
   {0,NULL}
   	};
   .
  patch -p0 <<' .'
  Index: openssl/crypto/x509v3/x509v3.h
 
============================================================
================
  $ cvs diff -u -r1.115 -r1.116 x509v3.h
  --- openssl/crypto/x509v3/x509v3.h	26 Sep 2007 21:56:58
-0000	1.115
  +++ openssl/crypto/x509v3/x509v3.h	24 Mar 2008 22:14:02
-0000	1.116
   -553,6 +553,10 
   DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_CONSTRAINTS)
   DECLARE_ASN1_ITEM(POLICY_CONSTRAINTS)
   
  +GENERAL_NAME *a2i_GENERAL_NAME(GENERAL_NAME *out,
  +				X509V3_EXT_METHOD *method, X509V3_CTX *ctx,
  +				int gen_type, char *value, int is_nc);
  +
   #ifdef HEADER_CONF_H
   GENERAL_NAME *v2i_GENERAL_NAME(X509V3_EXT_METHOD *method,
X509V3_CTX *ctx,
   							CONF_VALUE *cnf);
   -818,6 +822,7 
   /* Error codes for the X509V3 functions. */
   
   /* Function codes. */
  +#define X509V3_F_A2I_GENERAL_NAME			 164
   #define X509V3_F_ASIDENTIFIERCHOICE_CANONIZE		 161
   #define X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL	 162
   #define X509V3_F_COPY_EMAIL				 122
   -950,6 +955,7 
   #define X509V3_R_UNKNOWN_EXTENSION_NAME			 130
   #define X509V3_R_UNKNOWN_OPTION				 120
   #define X509V3_R_UNSUPPORTED_OPTION			 117
  +#define X509V3_R_UNSUPPORTED_TYPE			 167
   #define X509V3_R_USER_TOO_LONG				 132
   
   #ifdef  __cplusplus
   .
____________________________________________________________
__________
OpenSSL Project                                 http://www.openssl.org
CVS Repository Commit List                    
openssl-cvsopenssl.org
Automated List Manager                          
majordomoopenssl.org

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )