Make the algorithm implementations depend on the corresponding
[oweals/openssl.git] / crypto / asn1 / a_set.c
index 406c68face2e477a5994161c7c9a0ceb94100d7c..caf5a1419c98cbe201acbacfc8e24b99ecd58eab 100644 (file)
 
 #include <stdio.h>
 #include "cryptlib.h"
-#include "asn1_mac.h"
+#include <openssl/asn1_mac.h>
 
-/* ASN1err(ASN1_F_ASN1_TYPE_NEW,ERR_R_MALLOC_FAILURE);
- */
 typedef struct
     {
     unsigned char *pbData;
@@ -118,7 +116,7 @@ int i2d_ASN1_SET(STACK *a, unsigned char **pp, int (*func)(), int ex_tag,
                }
 
         pStart  = p; /* Catch the beg of Setblobs*/
-        rgSetBlob = (MYBLOB *)Malloc( sk_num(a) * sizeof(MYBLOB)); /* In this array
+        rgSetBlob = (MYBLOB *)OPENSSL_malloc( sk_num(a) * sizeof(MYBLOB)); /* In this array
 we will store the SET blobs */
 
         for (i=0; i<sk_num(a); i++)
@@ -135,7 +133,7 @@ SetBlob
  /* Now we have to sort the blobs. I am using a simple algo.
     *Sort ptrs *Copy to temp-mem *Copy from temp-mem to user-mem*/
         qsort( rgSetBlob, sk_num(a), sizeof(MYBLOB), SetBlobCmp);
-        pTempMem = Malloc(totSize);
+        pTempMem = OPENSSL_malloc(totSize);
 
 /* Copy to temp mem */
         p = pTempMem;
@@ -147,20 +145,20 @@ SetBlob
 
 /* Copy back to user mem*/
         memcpy(pStart, pTempMem, totSize);
-        Free(pTempMem);
-        Free(rgSetBlob);
+        OPENSSL_free(pTempMem);
+        OPENSSL_free(rgSetBlob);
 
         return(r);
         }
 
 STACK *d2i_ASN1_SET(STACK **a, unsigned char **pp, long length,
-            char *(*func)(), void (*free_func)(), int ex_tag, int ex_class)
+            char *(*func)(), void (*free_func)(void *), int ex_tag, int ex_class)
        {
        ASN1_CTX c;
        STACK *ret=NULL;
 
        if ((a == NULL) || ((*a) == NULL))
-               { if ((ret=sk_new(NULL)) == NULL) goto err; }
+               { if ((ret=sk_new_null()) == NULL) goto err; }
        else
                ret=(*a);