a_set.c (68651) | a_set.c (100936) |
---|---|
1/* crypto/asn1/a_set.c */ 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 * All rights reserved. 4 * 5 * This package is an SSL implementation written 6 * by Eric Young (eay@cryptsoft.com). 7 * The implementation was written so as to conform with Netscapes SSL. 8 * --- 102 unchanged lines hidden (view full) --- 111 for (i=0; i<sk_num(a); i++) 112 func(sk_value(a,i),&p); 113 114 *pp=p; 115 return(r); 116 } 117 118 pStart = p; /* Catch the beg of Setblobs*/ | 1/* crypto/asn1/a_set.c */ 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 * All rights reserved. 4 * 5 * This package is an SSL implementation written 6 * by Eric Young (eay@cryptsoft.com). 7 * The implementation was written so as to conform with Netscapes SSL. 8 * --- 102 unchanged lines hidden (view full) --- 111 for (i=0; i<sk_num(a); i++) 112 func(sk_value(a,i),&p); 113 114 *pp=p; 115 return(r); 116 } 117 118 pStart = p; /* Catch the beg of Setblobs*/ |
119 rgSetBlob = (MYBLOB *)OPENSSL_malloc( sk_num(a) * sizeof(MYBLOB)); /* In this array | 119 if (!(rgSetBlob = (MYBLOB *)OPENSSL_malloc( sk_num(a) * sizeof(MYBLOB)))) return 0; /* In this array |
120we will store the SET blobs */ 121 122 for (i=0; i<sk_num(a); i++) 123 { 124 rgSetBlob[i].pbData = p; /* catch each set encode blob */ 125 func(sk_value(a,i),&p); 126 rgSetBlob[i].cbData = p - rgSetBlob[i].pbData; /* Length of this 127SetBlob 128*/ 129 } 130 *pp=p; 131 totSize = p - pStart; /* This is the total size of all set blobs */ 132 133 /* Now we have to sort the blobs. I am using a simple algo. 134 *Sort ptrs *Copy to temp-mem *Copy from temp-mem to user-mem*/ 135 qsort( rgSetBlob, sk_num(a), sizeof(MYBLOB), SetBlobCmp); | 120we will store the SET blobs */ 121 122 for (i=0; i<sk_num(a); i++) 123 { 124 rgSetBlob[i].pbData = p; /* catch each set encode blob */ 125 func(sk_value(a,i),&p); 126 rgSetBlob[i].cbData = p - rgSetBlob[i].pbData; /* Length of this 127SetBlob 128*/ 129 } 130 *pp=p; 131 totSize = p - pStart; /* This is the total size of all set blobs */ 132 133 /* Now we have to sort the blobs. I am using a simple algo. 134 *Sort ptrs *Copy to temp-mem *Copy from temp-mem to user-mem*/ 135 qsort( rgSetBlob, sk_num(a), sizeof(MYBLOB), SetBlobCmp); |
136 pTempMem = OPENSSL_malloc(totSize); | 136 if (!(pTempMem = OPENSSL_malloc(totSize))) return 0; |
137 138/* Copy to temp mem */ 139 p = pTempMem; 140 for(i=0; i<sk_num(a); ++i) 141 { 142 memcpy(p, rgSetBlob[i].pbData, rgSetBlob[i].cbData); 143 p += rgSetBlob[i].cbData; 144 } --- 73 unchanged lines hidden --- | 137 138/* Copy to temp mem */ 139 p = pTempMem; 140 for(i=0; i<sk_num(a); ++i) 141 { 142 memcpy(p, rgSetBlob[i].pbData, rgSetBlob[i].cbData); 143 p += rgSetBlob[i].cbData; 144 } --- 73 unchanged lines hidden --- |