X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=crypto%2Fasn1%2Fa_set.c;h=4d07dc043b81286ebbd8e8e85f79d6851b4a00e5;hp=a140cc14ad865fe39c84d3bb8363f61d6f8804aa;hb=b9b9f853b54046db6e0af3ecd5716da30c6bfd16;hpb=4098e89cbf1212e2fb796d64725f259ac680cb56 diff --git a/crypto/asn1/a_set.c b/crypto/asn1/a_set.c index a140cc14ad..4d07dc043b 100644 --- a/crypto/asn1/a_set.c +++ b/crypto/asn1/a_set.c @@ -58,10 +58,10 @@ #include #include "cryptlib.h" -#include "asn1_mac.h" +#include + +#ifndef NO_ASN1_OLD -/* ASN1err(ASN1_F_ASN1_TYPE_NEW,ERR_R_MALLOC_FAILURE); - */ typedef struct { unsigned char *pbData; @@ -73,8 +73,8 @@ typedef struct */ static int SetBlobCmp(const void *elem1, const void *elem2 ) { - MYBLOB *b1 = (MYBLOB *)elem1; - MYBLOB *b2 = (MYBLOB *)elem2; + const MYBLOB *b1 = (const MYBLOB *)elem1; + const MYBLOB *b2 = (const MYBLOB *)elem2; int r; r = memcmp(b1->pbData, b2->pbData, @@ -84,14 +84,10 @@ static int SetBlobCmp(const void *elem1, const void *elem2 ) return b1->cbData-b2->cbData; } -int i2d_ASN1_SET(a,pp,func,ex_tag,ex_class,is_set) -STACK *a; -unsigned char **pp; -int (*func)(); -int ex_tag; -int ex_class; -int is_set; /* if TRUE, then sort the contents (i.e. it isn't a SEQUENCE) */ - +/* int is_set: if TRUE, then sort the contents (i.e. it isn't a SEQUENCE) */ +int i2d_ASN1_SET(STACK_OF(OPENSSL_BLOCK) *a, unsigned char **pp, + i2d_of_void *i2d, int ex_tag, int ex_class, + int is_set) { int ret=0,r; int i; @@ -101,8 +97,8 @@ int is_set; /* if TRUE, then sort the contents (i.e. it isn't a SEQUENCE) */ int totSize; if (a == NULL) return(0); - for (i=sk_num(a)-1; i>=0; i--) - ret+=func(sk_value(a,i),NULL); + for (i=sk_OPENSSL_BLOCK_num(a)-1; i>=0; i--) + ret+=i2d(sk_OPENSSL_BLOCK_value(a,i),NULL); r=ASN1_object_size(1,ret,ex_tag); if (pp == NULL) return(r); @@ -113,23 +109,28 @@ int is_set; /* if TRUE, then sort the contents (i.e. it isn't a SEQUENCE) */ /* And then again by Ben */ /* And again by Steve */ - if(!is_set || (sk_num(a) < 2)) + if(!is_set || (sk_OPENSSL_BLOCK_num(a) < 2)) { - for (i=0; i