projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
support numeric strings in ASN1_generate_nconf
[openssl.git]
/
crypto
/
asn1
/
asn1_gen.c
diff --git
a/crypto/asn1/asn1_gen.c
b/crypto/asn1/asn1_gen.c
index 097b4b8ecfe5223dedfff740f60953f3ad2df0fa..dd5853c02fd12e47cbc8e298355bb5c3b6cb2ac9 100644
(file)
--- a/
crypto/asn1/asn1_gen.c
+++ b/
crypto/asn1/asn1_gen.c
@@
-88,7
+88,7
@@
struct tag_name_st
{
struct tag_name_st
{
- char *strnam;
+ c
onst c
har *strnam;
int len;
int tag;
};
int len;
int tag;
};
@@
-141,7
+141,9
@@
ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf)
int i, len;
unsigned char *orig_der = NULL, *new_der = NULL;
int i, len;
unsigned char *orig_der = NULL, *new_der = NULL;
- unsigned char *cpy_start, *p;
+ const unsigned char *cpy_start;
+ unsigned char *p;
+ const unsigned char *cp;
int cpy_len;
long hdr_len;
int hdr_constructed = 0, hdr_tag, hdr_class;
int cpy_len;
long hdr_len;
int hdr_constructed = 0, hdr_tag, hdr_class;
@@
-249,10
+251,10
@@
ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf)
/* Copy across original encoding */
memcpy(p, cpy_start, cpy_len);
/* Copy across original encoding */
memcpy(p, cpy_start, cpy_len);
- p = new_der;
+
c
p = new_der;
/* Obtain new ASN1_TYPE structure */
/* Obtain new ASN1_TYPE structure */
- ret = d2i_ASN1_TYPE(NULL, &p, len);
+ ret = d2i_ASN1_TYPE(NULL, &
c
p, len);
err:
if (orig_der)
err:
if (orig_der)
@@
-469,10
+471,12
@@
static ASN1_TYPE *asn1_multi(int utype, const char *section, X509V3_CTX *cnf)
is_set = 0;
is_set = 0;
- derlen = i2d_ASN1_SET((STACK *)sk, NULL, i2d_ASN1_TYPE, utype, V_ASN1_UNIVERSAL, is_set);
+ derlen = i2d_ASN1_SET_OF_ASN1_TYPE(sk, NULL, i2d_ASN1_TYPE, utype,
+ V_ASN1_UNIVERSAL, is_set);
der = OPENSSL_malloc(derlen);
p = der;
der = OPENSSL_malloc(derlen);
p = der;
- i2d_ASN1_SET((STACK *)sk, &p, i2d_ASN1_TYPE, utype, V_ASN1_UNIVERSAL, is_set);
+ i2d_ASN1_SET_OF_ASN1_TYPE(sk, &p, i2d_ASN1_TYPE, utype,
+ V_ASN1_UNIVERSAL, is_set);
if (!(ret = ASN1_TYPE_new()))
goto bad;
if (!(ret = ASN1_TYPE_new()))
goto bad;
@@
-508,13
+512,13
@@
static int append_exp(tag_exp_arg *arg, int exp_tag, int exp_class, int exp_cons
/* Can only have IMPLICIT if permitted */
if ((arg->imp_tag != -1) && !imp_ok)
{
/* Can only have IMPLICIT if permitted */
if ((arg->imp_tag != -1) && !imp_ok)
{
- ASN1err(ASN1_F_APPEND_
TAG
, ASN1_R_ILLEGAL_IMPLICIT_TAG);
+ ASN1err(ASN1_F_APPEND_
EXP
, ASN1_R_ILLEGAL_IMPLICIT_TAG);
return 0;
}
if (arg->exp_count == ASN1_FLAG_EXP_MAX)
{
return 0;
}
if (arg->exp_count == ASN1_FLAG_EXP_MAX)
{
- ASN1err(ASN1_F_APPEND_
TAG
, ASN1_R_DEPTH_EXCEEDED);
+ ASN1err(ASN1_F_APPEND_
EXP
, ASN1_R_DEPTH_EXCEEDED);
return 0;
}
return 0;
}
@@
-544,7
+548,7
@@
static int append_exp(tag_exp_arg *arg, int exp_tag, int exp_class, int exp_cons
static int asn1_str2tag(const char *tagstr, int len)
{
static int asn1_str2tag(const char *tagstr, int len)
{
- int i;
+
unsigned
int i;
static struct tag_name_st *tntmp, tnst [] = {
ASN1_GEN_STR("BOOL", V_ASN1_BOOLEAN),
ASN1_GEN_STR("BOOLEAN", V_ASN1_BOOLEAN),
static struct tag_name_st *tntmp, tnst [] = {
ASN1_GEN_STR("BOOL", V_ASN1_BOOLEAN),
ASN1_GEN_STR("BOOLEAN", V_ASN1_BOOLEAN),
@@
-578,6
+582,10
@@
static int asn1_str2tag(const char *tagstr, int len)
ASN1_GEN_STR("T61", V_ASN1_T61STRING),
ASN1_GEN_STR("T61STRING", V_ASN1_T61STRING),
ASN1_GEN_STR("TELETEXSTRING", V_ASN1_T61STRING),
ASN1_GEN_STR("T61", V_ASN1_T61STRING),
ASN1_GEN_STR("T61STRING", V_ASN1_T61STRING),
ASN1_GEN_STR("TELETEXSTRING", V_ASN1_T61STRING),
+ ASN1_GEN_STR("GeneralString", V_ASN1_GENERALSTRING),
+ ASN1_GEN_STR("GENSTR", V_ASN1_GENERALSTRING),
+ ASN1_GEN_STR("NUMERIC", V_ASN1_NUMERICSTRING),
+ ASN1_GEN_STR("NUMERICSTRING", V_ASN1_NUMERICSTRING),
/* Special cases */
ASN1_GEN_STR("SEQUENCE", V_ASN1_SEQUENCE),
/* Special cases */
ASN1_GEN_STR("SEQUENCE", V_ASN1_SEQUENCE),
@@
-595,7
+603,7
@@
static int asn1_str2tag(const char *tagstr, int len)
/* SEQUENCE wrapper */
ASN1_GEN_STR("SEQWRAP", ASN1_GEN_FLAG_SEQWRAP),
/* SET wrapper */
/* SEQUENCE wrapper */
ASN1_GEN_STR("SEQWRAP", ASN1_GEN_FLAG_SEQWRAP),
/* SET wrapper */
- ASN1_GEN_STR("SETWRAP", ASN1_GEN_FLAG_SE
Q
WRAP),
+ ASN1_GEN_STR("SETWRAP", ASN1_GEN_FLAG_SE
T
WRAP),
/* BIT STRING wrapper */
ASN1_GEN_STR("BITWRAP", ASN1_GEN_FLAG_BITWRAP),
ASN1_GEN_STR("FORM", ASN1_GEN_FLAG_FORMAT),
/* BIT STRING wrapper */
ASN1_GEN_STR("BITWRAP", ASN1_GEN_FLAG_BITWRAP),
ASN1_GEN_STR("FORM", ASN1_GEN_FLAG_FORMAT),
@@
-720,6
+728,8
@@
static ASN1_TYPE *asn1_str2type(const char *str, int format, int utype)
case V_ASN1_UTF8STRING:
case V_ASN1_VISIBLESTRING:
case V_ASN1_UNIVERSALSTRING:
case V_ASN1_UTF8STRING:
case V_ASN1_VISIBLESTRING:
case V_ASN1_UNIVERSALSTRING:
+ case V_ASN1_GENERALSTRING:
+ case V_ASN1_NUMERICSTRING:
if (format == ASN1_GEN_FORMAT_ASCII)
format = MBSTRING_ASC;
if (format == ASN1_GEN_FORMAT_ASCII)
format = MBSTRING_ASC;