mirror of
https://github.com/openssl/openssl.git
synced 2024-11-27 05:21:51 +08:00
stack.
This commit is contained in:
parent
426edadf98
commit
6d114240b9
@ -92,7 +92,7 @@ int MAIN(int argc, char **argv)
|
||||
PKCS7_SIGNED *p7s = NULL;
|
||||
X509_CRL *crl=NULL;
|
||||
STACK *certflst=NULL;
|
||||
STACK *crl_stack=NULL;
|
||||
STACK_OF(X509_CRL) *crl_stack=NULL;
|
||||
STACK_OF(X509) *cert_stack=NULL;
|
||||
int ret=1,nocrl=0;
|
||||
|
||||
@ -213,11 +213,11 @@ bad:
|
||||
p7s->contents->type=OBJ_nid2obj(NID_pkcs7_data);
|
||||
|
||||
if (!ASN1_INTEGER_set(p7s->version,1)) goto end;
|
||||
if ((crl_stack=sk_new(NULL)) == NULL) goto end;
|
||||
if ((crl_stack=sk_X509_CRL_new(NULL)) == NULL) goto end;
|
||||
p7s->crl=crl_stack;
|
||||
if (crl != NULL)
|
||||
{
|
||||
sk_push(crl_stack,(char *)crl);
|
||||
sk_X509_CRL_push(crl_stack,crl);
|
||||
crl=NULL; /* now part of p7 for Freeing */
|
||||
}
|
||||
|
||||
|
@ -222,7 +222,7 @@ bad:
|
||||
if (print_certs)
|
||||
{
|
||||
STACK_OF(X509) *certs=NULL;
|
||||
STACK *crls=NULL;
|
||||
STACK_OF(X509_CRL) *crls=NULL;
|
||||
|
||||
i=OBJ_obj2nid(p7->type);
|
||||
switch (i)
|
||||
@ -266,9 +266,9 @@ bad:
|
||||
{
|
||||
X509_CRL *crl;
|
||||
|
||||
for (i=0; i<sk_num(crls); i++)
|
||||
for (i=0; i<sk_X509_CRL_num(crls); i++)
|
||||
{
|
||||
crl=(X509_CRL *)sk_value(crls,i);
|
||||
crl=sk_X509_CRL_value(crls,i);
|
||||
|
||||
X509_NAME_oneline(crl->crl->issuer,buf,256);
|
||||
BIO_puts(out,"issuer= ");
|
||||
|
@ -70,7 +70,7 @@ int i2d_PKCS7_SIGN_ENVELOPE(PKCS7_SIGN_ENVELOPE *a, unsigned char **pp)
|
||||
M_ASN1_I2D_len_SET_type(X509_ALGOR,a->md_algs,i2d_X509_ALGOR);
|
||||
M_ASN1_I2D_len(a->enc_data,i2d_PKCS7_ENC_CONTENT);
|
||||
M_ASN1_I2D_len_IMP_SEQUENCE_opt_type(X509,a->cert,i2d_X509,0);
|
||||
M_ASN1_I2D_len_IMP_SET_opt(a->crl,i2d_X509_CRL,1);
|
||||
M_ASN1_I2D_len_IMP_SET_opt_type(X509_CRL,a->crl,i2d_X509_CRL,1);
|
||||
M_ASN1_I2D_len_SET(a->signer_info,i2d_PKCS7_SIGNER_INFO);
|
||||
|
||||
M_ASN1_I2D_seq_total();
|
||||
@ -80,7 +80,7 @@ int i2d_PKCS7_SIGN_ENVELOPE(PKCS7_SIGN_ENVELOPE *a, unsigned char **pp)
|
||||
M_ASN1_I2D_put_SET_type(X509_ALGOR,a->md_algs,i2d_X509_ALGOR);
|
||||
M_ASN1_I2D_put(a->enc_data,i2d_PKCS7_ENC_CONTENT);
|
||||
M_ASN1_I2D_put_IMP_SEQUENCE_opt_type(X509,a->cert,i2d_X509,0);
|
||||
M_ASN1_I2D_put_IMP_SET_opt(a->crl,i2d_X509_CRL,1);
|
||||
M_ASN1_I2D_put_IMP_SET_opt_type(X509_CRL,a->crl,i2d_X509_CRL,1);
|
||||
M_ASN1_I2D_put_SET(a->signer_info,i2d_PKCS7_SIGNER_INFO);
|
||||
|
||||
M_ASN1_I2D_finish();
|
||||
@ -100,7 +100,8 @@ PKCS7_SIGN_ENVELOPE *d2i_PKCS7_SIGN_ENVELOPE(PKCS7_SIGN_ENVELOPE **a,
|
||||
X509_ALGOR_free);
|
||||
M_ASN1_D2I_get(ret->enc_data,d2i_PKCS7_ENC_CONTENT);
|
||||
M_ASN1_D2I_get_IMP_set_opt_type(X509,ret->cert,d2i_X509,X509_free,0);
|
||||
M_ASN1_D2I_get_IMP_set_opt(ret->crl,d2i_X509_CRL,X509_CRL_free,1);
|
||||
M_ASN1_D2I_get_IMP_set_opt_type(X509_CRL,ret->crl,d2i_X509_CRL,
|
||||
X509_CRL_free,1);
|
||||
M_ASN1_D2I_get_set(ret->signer_info,d2i_PKCS7_SIGNER_INFO,
|
||||
PKCS7_SIGNER_INFO_free);
|
||||
|
||||
@ -133,7 +134,7 @@ void PKCS7_SIGN_ENVELOPE_free(PKCS7_SIGN_ENVELOPE *a)
|
||||
sk_X509_ALGOR_pop_free(a->md_algs,X509_ALGOR_free);
|
||||
PKCS7_ENC_CONTENT_free(a->enc_data);
|
||||
sk_X509_pop_free(a->cert,X509_free);
|
||||
sk_pop_free(a->crl,X509_CRL_free);
|
||||
sk_X509_CRL_pop_free(a->crl,X509_CRL_free);
|
||||
sk_pop_free(a->signer_info,PKCS7_SIGNER_INFO_free);
|
||||
Free((char *)a);
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ int i2d_PKCS7_SIGNED(PKCS7_SIGNED *a, unsigned char **pp)
|
||||
M_ASN1_I2D_len_SET_type(X509_ALGOR,a->md_algs,i2d_X509_ALGOR);
|
||||
M_ASN1_I2D_len(a->contents,i2d_PKCS7);
|
||||
M_ASN1_I2D_len_IMP_SEQUENCE_opt_type(X509,a->cert,i2d_X509,0);
|
||||
M_ASN1_I2D_len_IMP_SET_opt(a->crl,i2d_X509_CRL,1);
|
||||
M_ASN1_I2D_len_IMP_SET_opt_type(X509_CRL,a->crl,i2d_X509_CRL,1);
|
||||
M_ASN1_I2D_len_SET(a->signer_info,i2d_PKCS7_SIGNER_INFO);
|
||||
|
||||
M_ASN1_I2D_seq_total();
|
||||
@ -78,7 +78,7 @@ int i2d_PKCS7_SIGNED(PKCS7_SIGNED *a, unsigned char **pp)
|
||||
M_ASN1_I2D_put_SET_type(X509_ALGOR,a->md_algs,i2d_X509_ALGOR);
|
||||
M_ASN1_I2D_put(a->contents,i2d_PKCS7);
|
||||
M_ASN1_I2D_put_IMP_SEQUENCE_opt_type(X509,a->cert,i2d_X509,0);
|
||||
M_ASN1_I2D_put_IMP_SET_opt(a->crl,i2d_X509_CRL,1);
|
||||
M_ASN1_I2D_put_IMP_SET_opt_type(X509_CRL,a->crl,i2d_X509_CRL,1);
|
||||
M_ASN1_I2D_put_SET(a->signer_info,i2d_PKCS7_SIGNER_INFO);
|
||||
|
||||
M_ASN1_I2D_finish();
|
||||
@ -96,7 +96,8 @@ PKCS7_SIGNED *d2i_PKCS7_SIGNED(PKCS7_SIGNED **a, unsigned char **pp,
|
||||
X509_ALGOR_free);
|
||||
M_ASN1_D2I_get(ret->contents,d2i_PKCS7);
|
||||
M_ASN1_D2I_get_IMP_set_opt_type(X509,ret->cert,d2i_X509,X509_free,0);
|
||||
M_ASN1_D2I_get_IMP_set_opt(ret->crl,d2i_X509_CRL,X509_CRL_free,1);
|
||||
M_ASN1_D2I_get_IMP_set_opt_type(X509_CRL,ret->crl,d2i_X509_CRL,
|
||||
X509_CRL_free,1);
|
||||
M_ASN1_D2I_get_set(ret->signer_info,d2i_PKCS7_SIGNER_INFO,
|
||||
PKCS7_SIGNER_INFO_free);
|
||||
|
||||
@ -126,10 +127,12 @@ void PKCS7_SIGNED_free(PKCS7_SIGNED *a)
|
||||
sk_X509_ALGOR_pop_free(a->md_algs,X509_ALGOR_free);
|
||||
PKCS7_free(a->contents);
|
||||
sk_X509_pop_free(a->cert,X509_free);
|
||||
sk_pop_free(a->crl,X509_CRL_free);
|
||||
sk_X509_CRL_pop_free(a->crl,X509_CRL_free);
|
||||
sk_pop_free(a->signer_info,PKCS7_SIGNER_INFO_free);
|
||||
Free((char *)a);
|
||||
}
|
||||
|
||||
IMPLEMENT_STACK_OF(X509_ALGOR)
|
||||
IMPLEMENT_ASN1_SET_OF(X509_ALGOR)
|
||||
IMPLEMENT_STACK_OF(X509_CRL)
|
||||
IMPLEMENT_ASN1_SET_OF(X509_CRL)
|
||||
|
@ -262,7 +262,7 @@ int PKCS7_add_certificate(PKCS7 *p7, X509 *x509)
|
||||
int PKCS7_add_crl(PKCS7 *p7, X509_CRL *crl)
|
||||
{
|
||||
int i;
|
||||
STACK **sk;
|
||||
STACK_OF(X509_CRL) **sk;
|
||||
|
||||
i=OBJ_obj2nid(p7->type);
|
||||
switch (i)
|
||||
@ -279,10 +279,10 @@ int PKCS7_add_crl(PKCS7 *p7, X509_CRL *crl)
|
||||
}
|
||||
|
||||
if (*sk == NULL)
|
||||
*sk=sk_new_null();
|
||||
*sk=sk_X509_CRL_new_null();
|
||||
|
||||
CRYPTO_add(&crl->references,1,CRYPTO_LOCK_X509_CRL);
|
||||
sk_push(*sk,(char *)crl);
|
||||
sk_X509_CRL_push(*sk,crl);
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ typedef struct pkcs7_signed_st
|
||||
ASN1_INTEGER *version; /* version 1 */
|
||||
STACK_OF(X509_ALGOR) *md_algs; /* md used */
|
||||
STACK_OF(X509) *cert; /* [ 0 ] */
|
||||
STACK /* X509_CRL */ *crl; /* [ 1 ] */
|
||||
STACK_OF(X509_CRL) *crl; /* [ 1 ] */
|
||||
STACK /* PKCS7_SIGNER_INFO */ *signer_info;
|
||||
|
||||
struct pkcs7_st *contents;
|
||||
@ -140,7 +140,7 @@ typedef struct pkcs7_signedandenveloped_st
|
||||
ASN1_INTEGER *version; /* version 1 */
|
||||
STACK_OF(X509_ALGOR) *md_algs; /* md used */
|
||||
STACK_OF(X509) *cert; /* [ 0 ] */
|
||||
STACK /* X509_CRL */ *crl; /* [ 1 ] */
|
||||
STACK_OF(X509_CRL) *crl; /* [ 1 ] */
|
||||
STACK /* PKCS7_SIGNER_INFO */ *signer_info;
|
||||
|
||||
PKCS7_ENC_CONTENT *enc_data;
|
||||
|
@ -275,6 +275,9 @@ typedef struct X509_crl_st
|
||||
int references;
|
||||
} X509_CRL;
|
||||
|
||||
DECLARE_STACK_OF(X509_CRL)
|
||||
DECLARE_ASN1_SET_OF(X509_CRL)
|
||||
|
||||
typedef struct private_key_st
|
||||
{
|
||||
int version;
|
||||
|
Loading…
Reference in New Issue
Block a user