summaryrefslogtreecommitdiffstats
path: root/crypto/pkcs7
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2002-01-02 11:54:38 +0000
committerRichard Levitte <levitte@openssl.org>2002-01-02 11:54:38 +0000
commit67fec850e1ccbbe921648b7f0b7ebeb4f1c084f6 (patch)
tree5881a9d103dc23ef9a6a881181bff8190b991011 /crypto/pkcs7
parent82db6e1646af7d0df0b86bfbedfea1efaebcc27a (diff)
Allow verification of other types than DATA.
Submitted by Leonard Janke <leonard@votehere.net>
Diffstat (limited to 'crypto/pkcs7')
-rw-r--r--crypto/pkcs7/pk7_doit.c53
1 files changed, 46 insertions, 7 deletions
diff --git a/crypto/pkcs7/pk7_doit.c b/crypto/pkcs7/pk7_doit.c
index fce4a841a6..f016fdb2e2 100644
--- a/crypto/pkcs7/pk7_doit.c
+++ b/crypto/pkcs7/pk7_doit.c
@@ -67,6 +67,38 @@ static int add_attribute(STACK_OF(X509_ATTRIBUTE) **sk, int nid, int atrtype,
void *value);
static ASN1_TYPE *get_attribute(STACK_OF(X509_ATTRIBUTE) *sk, int nid);
+static int PKCS7_type_is_other(PKCS7* p7)
+ {
+ int isOther=1;
+
+ int nid=OBJ_obj2nid(p7->type);
+
+ switch( nid )
+ {
+ case NID_pkcs7_data:
+ case NID_pkcs7_signed:
+ case NID_pkcs7_enveloped:
+ case NID_pkcs7_signedAndEnveloped:
+ case NID_pkcs7_digest:
+ case NID_pkcs7_encrypted:
+ isOther=0;
+ break;
+ default:
+ isOther=1;
+ }
+
+ return isOther;
+
+ }
+
+static int PKCS7_type_is_octet_string(PKCS7* p7)
+ {
+ if ( 0==PKCS7_type_is_other(p7) )
+ return 0;
+
+ return (V_ASN1_OCTET_STRING==p7->d.other->type) ? 1 : 0;
+ }
+
BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio)
{
int i,j;
@@ -222,13 +254,20 @@ BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio)
if (PKCS7_is_detached(p7))
bio=BIO_new(BIO_s_null());
else {
- if (PKCS7_type_is_signed(p7) &&
- PKCS7_type_is_data(p7->d.sign->contents)) {
- ASN1_OCTET_STRING *os;
- os=p7->d.sign->contents->d.data;
- if (os->length > 0) bio =
- BIO_new_mem_buf(os->data, os->length);
- }
+ if (PKCS7_type_is_signed(p7) ) {
+ if ( PKCS7_type_is_data(p7->d.sign->contents)) {
+ ASN1_OCTET_STRING *os;
+ os=p7->d.sign->contents->d.data;
+ if (os->length > 0)
+ bio = BIO_new_mem_buf(os->data, os->length);
+ }
+ else if ( PKCS7_type_is_octet_string(p7->d.sign->contents) ) {
+ ASN1_OCTET_STRING *os;
+ os=p7->d.sign->contents->d.other->value.octet_string;
+ if (os->length > 0)
+ bio = BIO_new_mem_buf(os->data, os->length);
+ }
+ }
if(bio == NULL) {
bio=BIO_new(BIO_s_mem());
BIO_set_mem_eof_return(bio,0);