As ftruncate is not availabe on all platforms, switch back to
[oweals/openssl.git] / crypto / asn1 / a_bitstr.c
index 275de43eb6c1e27d1e9fec379e6ce979f702e7c8..b36d62079a968c5295e950f9a3c8a0bfdf8d6249 100644 (file)
 
 #include <stdio.h>
 #include "cryptlib.h"
-#include "asn1.h"
+#include <openssl/asn1.h>
 
-/* ASN1err(ASN1_F_ASN1_STRING_NEW,ASN1_R_STRING_TOO_SHORT);
- * ASN1err(ASN1_F_D2I_ASN1_BIT_STRING,ASN1_R_EXPECTING_A_BIT_STRING);
- */
+ASN1_BIT_STRING *ASN1_BIT_STRING_new(void)
+{ return M_ASN1_BIT_STRING_new(); }
+
+void ASN1_BIT_STRING_free(ASN1_BIT_STRING *x)
+{ M_ASN1_BIT_STRING_free(x); }
+
+int ASN1_BIT_STRING_set(ASN1_BIT_STRING *x, unsigned char *d, int len)
+{ return M_ASN1_BIT_STRING_set(x, d, len); }
 
-int i2d_ASN1_BIT_STRING(a,pp)
-ASN1_BIT_STRING *a;
-unsigned char **pp;
+int i2d_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp)
        {
        int ret,j,r,bits,len;
        unsigned char *p,*d;
@@ -116,10 +119,8 @@ unsigned char **pp;
        return(r);
        }
 
-ASN1_BIT_STRING *d2i_ASN1_BIT_STRING(a, pp, length)
-ASN1_BIT_STRING **a;
-unsigned char **pp;
-long length;
+ASN1_BIT_STRING *d2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, unsigned char **pp,
+            long length)
        {
        ASN1_BIT_STRING *ret=NULL;
        unsigned char *p,*s;
@@ -129,7 +130,7 @@ long length;
 
        if ((a == NULL) || ((*a) == NULL))
                {
-               if ((ret=ASN1_BIT_STRING_new()) == NULL) return(NULL);
+               if ((ret=M_ASN1_BIT_STRING_new()) == NULL) return(NULL);
                }
        else
                ret=(*a);
@@ -181,16 +182,13 @@ long length;
 err:
        ASN1err(ASN1_F_D2I_ASN1_BIT_STRING,i);
        if ((ret != NULL) && ((a == NULL) || (*a != ret)))
-               ASN1_BIT_STRING_free(ret);
+               M_ASN1_BIT_STRING_free(ret);
        return(NULL);
        }
 
 /* These next 2 functions from Goetz Babin-Ebell <babinebell@trustcenter.de>
  */
-int ASN1_BIT_STRING_set_bit(a,n,value)
-ASN1_BIT_STRING *a;
-int n;
-int value;
+int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value)
        {
        int w,v,iv;
        unsigned char *c;
@@ -220,9 +218,7 @@ int value;
        return(1);
        }
 
-int ASN1_BIT_STRING_get_bit(a,n)
-ASN1_BIT_STRING *a;
-int n;
+int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n)
        {
        int w,v;