projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove --classic build entirely
[openssl.git]
/
crypto
/
asn1
/
tasn_fre.c
diff --git
a/crypto/asn1/tasn_fre.c
b/crypto/asn1/tasn_fre.c
index bdc26f9bb4bf241f0224bdea2dda9f21bfa93410..2fc036fb666f6ee831ca22cfbae4fde407117b92 100644
(file)
--- a/
crypto/asn1/tasn_fre.c
+++ b/
crypto/asn1/tasn_fre.c
@@
-1,4
+1,3
@@
-/* tasn_fre.c */
/*
* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project
* 2000.
/*
* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project
* 2000.
@@
-61,24
+60,25
@@
#include <openssl/asn1.h>
#include <openssl/asn1t.h>
#include <openssl/objects.h>
#include <openssl/asn1.h>
#include <openssl/asn1t.h>
#include <openssl/objects.h>
+#include "asn1_locl.h"
-static void asn1_item_
combine
_free(ASN1_VALUE **pval, const ASN1_ITEM *it,
-
int combine
);
+static void asn1_item_
embed
_free(ASN1_VALUE **pval, const ASN1_ITEM *it,
+
int embed
);
/* Free up an ASN1 structure */
void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it)
{
/* Free up an ASN1 structure */
void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it)
{
- asn1_item_
combine
_free(&val, it, 0);
+ asn1_item_
embed
_free(&val, it, 0);
}
void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
{
}
void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
{
- asn1_item_
combine
_free(pval, it, 0);
+ asn1_item_
embed
_free(pval, it, 0);
}
}
-static void asn1_item_
combine
_free(ASN1_VALUE **pval, const ASN1_ITEM *it,
-
int combine
)
+static void asn1_item_
embed
_free(ASN1_VALUE **pval, const ASN1_ITEM *it,
+
int embed
)
{
const ASN1_TEMPLATE *tt = NULL, *seqtt;
const ASN1_EXTERN_FUNCS *ef;
{
const ASN1_TEMPLATE *tt = NULL, *seqtt;
const ASN1_EXTERN_FUNCS *ef;
@@
-99,13
+99,13
@@
static void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it,
case ASN1_ITYPE_PRIMITIVE:
if (it->templates)
case ASN1_ITYPE_PRIMITIVE:
if (it->templates)
-
ASN
1_template_free(pval, it->templates);
+
asn
1_template_free(pval, it->templates);
else
else
-
ASN
1_primitive_free(pval, it);
+
asn
1_primitive_free(pval, it);
break;
case ASN1_ITYPE_MSTRING:
break;
case ASN1_ITYPE_MSTRING:
-
ASN
1_primitive_free(pval, it);
+
asn
1_primitive_free(pval, it);
break;
case ASN1_ITYPE_CHOICE:
break;
case ASN1_ITYPE_CHOICE:
@@
-120,11
+120,11
@@
static void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it,
tt = it->templates + i;
pchval = asn1_get_field_ptr(pval, tt);
tt = it->templates + i;
pchval = asn1_get_field_ptr(pval, tt);
-
ASN
1_template_free(pchval, tt);
+
asn
1_template_free(pchval, tt);
}
if (asn1_cb)
asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL);
}
if (asn1_cb)
asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL);
- if (
!combine
) {
+ if (
embed == 0
) {
OPENSSL_free(*pval);
*pval = NULL;
}
OPENSSL_free(*pval);
*pval = NULL;
}
@@
-158,11
+158,11
@@
static void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it,
if (!seqtt)
continue;
pseqval = asn1_get_field_ptr(pval, seqtt);
if (!seqtt)
continue;
pseqval = asn1_get_field_ptr(pval, seqtt);
-
ASN
1_template_free(pseqval, seqtt);
+
asn
1_template_free(pseqval, seqtt);
}
if (asn1_cb)
asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL);
}
if (asn1_cb)
asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL);
- if (
!combine
) {
+ if (
embed == 0
) {
OPENSSL_free(*pval);
*pval = NULL;
}
OPENSSL_free(*pval);
*pval = NULL;
}
@@
-170,8
+170,14
@@
static void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it,
}
}
}
}
-void
ASN
1_template_free(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
+void
asn
1_template_free(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
{
{
+ int embed = tt->flags & ASN1_TFLG_EMBED;
+ ASN1_VALUE *tval;
+ if (embed) {
+ tval = (ASN1_VALUE *)pval;
+ pval = &tval;
+ }
if (tt->flags & ASN1_TFLG_SK_MASK) {
STACK_OF(ASN1_VALUE) *sk = (STACK_OF(ASN1_VALUE) *)*pval;
int i;
if (tt->flags & ASN1_TFLG_SK_MASK) {
STACK_OF(ASN1_VALUE) *sk = (STACK_OF(ASN1_VALUE) *)*pval;
int i;
@@
-179,17
+185,16
@@
void ASN1_template_free(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
for (i = 0; i < sk_ASN1_VALUE_num(sk); i++) {
ASN1_VALUE *vtmp = sk_ASN1_VALUE_value(sk, i);
for (i = 0; i < sk_ASN1_VALUE_num(sk); i++) {
ASN1_VALUE *vtmp = sk_ASN1_VALUE_value(sk, i);
- asn1_item_
combine_free(&vtmp, ASN1_ITEM_ptr(tt->item), 0
);
+ asn1_item_
embed_free(&vtmp, ASN1_ITEM_ptr(tt->item), embed
);
}
sk_ASN1_VALUE_free(sk);
*pval = NULL;
} else {
}
sk_ASN1_VALUE_free(sk);
*pval = NULL;
} else {
- asn1_item_combine_free(pval, ASN1_ITEM_ptr(tt->item),
- tt->flags & ASN1_TFLG_COMBINE);
+ asn1_item_embed_free(pval, ASN1_ITEM_ptr(tt->item), embed);
}
}
}
}
-void
ASN
1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
+void
asn
1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
{
int utype;
{
int utype;
@@
-237,7
+242,7
@@
void ASN1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
break;
case V_ASN1_ANY:
break;
case V_ASN1_ANY:
-
ASN
1_primitive_free(pval, NULL);
+
asn
1_primitive_free(pval, NULL);
OPENSSL_free(*pval);
break;
OPENSSL_free(*pval);
break;
@@
-245,6
+250,5
@@
void ASN1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
ASN1_STRING_free((ASN1_STRING *)*pval);
break;
}
ASN1_STRING_free((ASN1_STRING *)*pval);
break;
}
- if (*pval)
- *pval = NULL;
+ *pval = NULL;
}
}