/* crypto/asn1/x_req.c */
-/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
#include <stdio.h>
#include "cryptlib.h"
-#include "asn1_mac.h"
-#include "x509.h"
-
-/*
- * ASN1err(ASN1_F_D2I_X509_REQ,ASN1_R_LENGTH_MISMATCH);
- * ASN1err(ASN1_F_D2I_X509_REQ_INFO,ASN1_R_LENGTH_MISMATCH);
- * ASN1err(ASN1_F_X509_REQ_NEW,ASN1_R_LENGTH_MISMATCH);
- * ASN1err(ASN1_F_X509_REQ_INFO_NEW,ASN1_R_LENGTH_MISMATCH);
- */
+#include <openssl/asn1_mac.h>
+#include <openssl/x509.h>
-int i2d_X509_REQ_INFO(a,pp)
-X509_REQ_INFO *a;
-unsigned char **pp;
+int i2d_X509_REQ_INFO(X509_REQ_INFO *a, unsigned char **pp)
{
M_ASN1_I2D_vars(a);
*/
if (a->req_kludge)
{
- M_ASN1_I2D_len_IMP_set_opt(a->attributes,i2d_X509_ATTRIBUTE,0);
+ M_ASN1_I2D_len_IMP_SET_opt_type(X509_ATTRIBUTE,a->attributes,i2d_X509_ATTRIBUTE,0);
}
else
{
- M_ASN1_I2D_len_IMP_set(a->attributes, i2d_X509_ATTRIBUTE,0);
+ M_ASN1_I2D_len_IMP_SET_type(X509_ATTRIBUTE,a->attributes,
+ i2d_X509_ATTRIBUTE,0);
}
M_ASN1_I2D_seq_total();
*/
if (a->req_kludge)
{
- M_ASN1_I2D_put_IMP_set_opt(a->attributes,i2d_X509_ATTRIBUTE,0);
+ M_ASN1_I2D_put_IMP_SET_opt_type(X509_ATTRIBUTE,a->attributes,
+ i2d_X509_ATTRIBUTE,0);
}
else
{
- M_ASN1_I2D_put_IMP_set(a->attributes,i2d_X509_ATTRIBUTE,0);
+ M_ASN1_I2D_put_IMP_SET_type(X509_ATTRIBUTE,a->attributes,
+ i2d_X509_ATTRIBUTE,0);
}
M_ASN1_I2D_finish();
}
-X509_REQ_INFO *d2i_X509_REQ_INFO(a,pp,length)
-X509_REQ_INFO **a;
-unsigned char **pp;
-long length;
+X509_REQ_INFO *d2i_X509_REQ_INFO(X509_REQ_INFO **a, unsigned char **pp,
+ long length)
{
M_ASN1_D2I_vars(a,X509_REQ_INFO *,X509_REQ_INFO_new);
ret->req_kludge=1;
else
{
- M_ASN1_D2I_get_IMP_set(ret->attributes,d2i_X509_ATTRIBUTE,0);
+ M_ASN1_D2I_get_IMP_set_type(X509_ATTRIBUTE,ret->attributes,
+ d2i_X509_ATTRIBUTE,
+ X509_ATTRIBUTE_free,0);
}
M_ASN1_D2I_Finish(a,X509_REQ_INFO_free,ASN1_F_D2I_X509_REQ_INFO);
}
-X509_REQ_INFO *X509_REQ_INFO_new()
+X509_REQ_INFO *X509_REQ_INFO_new(void)
{
X509_REQ_INFO *ret=NULL;
+ ASN1_CTX c;
M_ASN1_New_Malloc(ret,X509_REQ_INFO);
M_ASN1_New(ret->version,ASN1_INTEGER_new);
M_ASN1_New(ret->subject,X509_NAME_new);
M_ASN1_New(ret->pubkey,X509_PUBKEY_new);
- M_ASN1_New(ret->attributes,sk_new_null);
+ M_ASN1_New(ret->attributes,sk_X509_ATTRIBUTE_new_null);
ret->req_kludge=0;
return(ret);
M_ASN1_New_Error(ASN1_F_X509_REQ_INFO_NEW);
}
-void X509_REQ_INFO_free(a)
-X509_REQ_INFO *a;
+void X509_REQ_INFO_free(X509_REQ_INFO *a)
{
if (a == NULL) return;
ASN1_INTEGER_free(a->version);
X509_NAME_free(a->subject);
X509_PUBKEY_free(a->pubkey);
- sk_pop_free(a->attributes,X509_ATTRIBUTE_free);
+ sk_X509_ATTRIBUTE_pop_free(a->attributes,X509_ATTRIBUTE_free);
Free((char *)a);
}
-int i2d_X509_REQ(a,pp)
-X509_REQ *a;
-unsigned char **pp;
+int i2d_X509_REQ(X509_REQ *a, unsigned char **pp)
{
M_ASN1_I2D_vars(a);
M_ASN1_I2D_len(a->req_info, i2d_X509_REQ_INFO);
M_ASN1_I2D_finish();
}
-X509_REQ *d2i_X509_REQ(a,pp,length)
-X509_REQ **a;
-unsigned char **pp;
-long length;
+X509_REQ *d2i_X509_REQ(X509_REQ **a, unsigned char **pp, long length)
{
M_ASN1_D2I_vars(a,X509_REQ *,X509_REQ_new);
M_ASN1_D2I_Finish(a,X509_REQ_free,ASN1_F_D2I_X509_REQ);
}
-X509_REQ *X509_REQ_new()
+X509_REQ *X509_REQ_new(void)
{
X509_REQ *ret=NULL;
+ ASN1_CTX c;
M_ASN1_New_Malloc(ret,X509_REQ);
ret->references=1;
M_ASN1_New_Error(ASN1_F_X509_REQ_NEW);
}
-void X509_REQ_free(a)
-X509_REQ *a;
+void X509_REQ_free(X509_REQ *a)
{
int i;
if (a == NULL) return;
i=CRYPTO_add(&a->references,-1,CRYPTO_LOCK_X509_REQ);
+#ifdef REF_PRINT
+ REF_PRINT("X509_REQ",a);
+#endif
if (i > 0) return;
#ifdef REF_CHECK
if (i < 0)