aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/asn1
diff options
context:
space:
mode:
authorRalf S. Engelschall <rse@openssl.org>1998-12-21 10:56:39 +0000
committerRalf S. Engelschall <rse@openssl.org>1998-12-21 10:56:39 +0000
commit58964a492275ca9a59a0cd9c8155cb2491b4b909 (patch)
treec7b16876a5789463bbbb468ef4829c8129b3d718 /crypto/asn1
parentd02b48c63a58ea4367a0e905979f140b7d090f86 (diff)
downloadopenssl-58964a492275ca9a59a0cd9c8155cb2491b4b909.tar.gz
Import of old SSLeay release: SSLeay 0.9.0b
Diffstat (limited to 'crypto/asn1')
-rw-r--r--crypto/asn1/Makefile.ssl8
-rw-r--r--crypto/asn1/a_bitstr.c48
-rw-r--r--crypto/asn1/a_bmp.c90
-rw-r--r--crypto/asn1/a_bool.c2
-rw-r--r--crypto/asn1/a_bytes.c31
-rw-r--r--crypto/asn1/a_d2i_fp.c5
-rw-r--r--crypto/asn1/a_digest.c2
-rw-r--r--crypto/asn1/a_dup.c2
-rw-r--r--crypto/asn1/a_hdr.c2
-rw-r--r--crypto/asn1/a_i2d_fp.c4
-rw-r--r--crypto/asn1/a_int.c5
-rw-r--r--crypto/asn1/a_meth.c2
-rw-r--r--crypto/asn1/a_object.c60
-rw-r--r--crypto/asn1/a_octet.c2
-rw-r--r--crypto/asn1/a_print.c2
-rw-r--r--crypto/asn1/a_set.c2
-rw-r--r--crypto/asn1/a_sign.c2
-rw-r--r--crypto/asn1/a_type.c10
-rw-r--r--crypto/asn1/a_utctm.c24
-rw-r--r--crypto/asn1/a_verify.c2
-rw-r--r--crypto/asn1/asn1.err294
-rw-r--r--crypto/asn1/asn1.h371
-rw-r--r--crypto/asn1/asn1_err.c16
-rw-r--r--crypto/asn1/asn1_lib.c17
-rw-r--r--crypto/asn1/asn1_mac.h7
-rw-r--r--crypto/asn1/asn1_par.c10
-rw-r--r--crypto/asn1/d2i_dhp.c2
-rw-r--r--crypto/asn1/d2i_dsap.c2
-rw-r--r--crypto/asn1/d2i_pr.c2
-rw-r--r--crypto/asn1/d2i_pu.c2
-rw-r--r--crypto/asn1/d2i_r_pr.c2
-rw-r--r--crypto/asn1/d2i_r_pu.c2
-rw-r--r--crypto/asn1/d2i_s_pr.c2
-rw-r--r--crypto/asn1/d2i_s_pu.c2
-rw-r--r--crypto/asn1/evp_asn1.c193
-rw-r--r--crypto/asn1/f.c80
-rw-r--r--crypto/asn1/f_int.c2
-rw-r--r--crypto/asn1/f_string.c2
-rw-r--r--crypto/asn1/i2d_dhp.c2
-rw-r--r--crypto/asn1/i2d_dsap.c2
-rw-r--r--crypto/asn1/i2d_pr.c2
-rw-r--r--crypto/asn1/i2d_pu.c2
-rw-r--r--crypto/asn1/i2d_r_pr.c2
-rw-r--r--crypto/asn1/i2d_r_pu.c2
-rw-r--r--crypto/asn1/i2d_s_pr.c2
-rw-r--r--crypto/asn1/i2d_s_pu.c2
-rw-r--r--crypto/asn1/n_pkey.c11
-rw-r--r--crypto/asn1/p7_dgst.c2
-rw-r--r--crypto/asn1/p7_enc.c2
-rw-r--r--crypto/asn1/p7_enc_c.c2
-rw-r--r--crypto/asn1/p7_evp.c2
-rw-r--r--crypto/asn1/p7_i_s.c2
-rw-r--r--crypto/asn1/p7_lib.c2
-rw-r--r--crypto/asn1/p7_recip.c4
-rw-r--r--crypto/asn1/p7_s_e.c2
-rw-r--r--crypto/asn1/p7_signd.c2
-rw-r--r--crypto/asn1/p7_signi.c2
-rw-r--r--crypto/asn1/pkcs8.c5
-rw-r--r--crypto/asn1/t_pkey.c15
-rw-r--r--crypto/asn1/t_req.c4
-rw-r--r--crypto/asn1/t_x509.c6
-rw-r--r--crypto/asn1/x_algor.c2
-rw-r--r--crypto/asn1/x_attrib.c2
-rw-r--r--crypto/asn1/x_cinf.c2
-rw-r--r--crypto/asn1/x_crl.c18
-rw-r--r--crypto/asn1/x_exten.c11
-rw-r--r--crypto/asn1/x_info.c5
-rw-r--r--crypto/asn1/x_name.c2
-rw-r--r--crypto/asn1/x_pkey.c5
-rw-r--r--crypto/asn1/x_pubkey.c14
-rw-r--r--crypto/asn1/x_req.c5
-rw-r--r--crypto/asn1/x_sig.c2
-rw-r--r--crypto/asn1/x_spki.c2
-rw-r--r--crypto/asn1/x_val.c2
-rw-r--r--crypto/asn1/x_x509.c5
75 files changed, 1044 insertions, 425 deletions
diff --git a/crypto/asn1/Makefile.ssl b/crypto/asn1/Makefile.ssl
index a39e009d27..30751bd156 100644
--- a/crypto/asn1/Makefile.ssl
+++ b/crypto/asn1/Makefile.ssl
@@ -35,7 +35,8 @@ LIBSRC= a_object.c a_bitstr.c a_utctm.c a_int.c a_octet.c a_print.c \
p7_dgst.c p7_s_e.c p7_enc.c p7_lib.c \
f_int.c f_string.c i2d_dhp.c i2d_dsap.c d2i_dhp.c d2i_dsap.c n_pkey.c \
a_hdr.c x_pkey.c a_bool.c x_exten.c \
- asn1_par.c asn1_lib.c $(ERRC).c a_meth.c a_bytes.c
+ asn1_par.c asn1_lib.c $(ERRC).c a_meth.c a_bytes.c \
+ evp_asn1.c
LIBOBJ= a_object.o a_bitstr.o a_utctm.o a_int.o a_octet.o a_print.o \
a_type.o a_set.o a_dup.o a_d2i_fp.o a_i2d_fp.o \
a_sign.o a_digest.o a_verify.o \
@@ -49,7 +50,8 @@ LIBOBJ= a_object.o a_bitstr.o a_utctm.o a_int.o a_octet.o a_print.o \
p7_dgst.o p7_s_e.o p7_enc.o p7_lib.o \
f_int.o f_string.o i2d_dhp.o i2d_dsap.o d2i_dhp.o d2i_dsap.o n_pkey.o \
a_hdr.o x_pkey.o a_bool.o x_exten.o \
- asn1_par.o asn1_lib.o $(ERRC).o a_meth.o a_bytes.o
+ asn1_par.o asn1_lib.o $(ERRC).o a_meth.o a_bytes.o \
+ evp_asn1.o
SRC= $(LIBSRC)
@@ -113,6 +115,6 @@ clean:
errors:
perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h
- perl ../err/err_genc.pl $(ERR).h $(ERRC).c
+ perl ../err/err_genc.pl -s $(ERR).h $(ERRC).c
# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/crypto/asn1/a_bitstr.c b/crypto/asn1/a_bitstr.c
index eb99ebca2f..2c10120651 100644
--- a/crypto/asn1/a_bitstr.c
+++ b/crypto/asn1/a_bitstr.c
@@ -1,5 +1,5 @@
/* crypto/asn1/a_bitstr.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
@@ -156,3 +156,49 @@ err:
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 w,v,iv;
+ unsigned char *c;
+
+ w=n/8;
+ v=1<<(7-(n&0x07));
+ iv= ~v;
+
+ if (a == NULL) return(0);
+ if ((a->length < (w+1)) || (a->data == NULL))
+ {
+ if (!value) return(1); /* Don't need to set */
+ if (a->data == NULL)
+ c=(unsigned char *)Malloc(w+1);
+ else
+ c=(unsigned char *)Realloc(a->data,w+1);
+ if (c == NULL) return(0);
+ a->data=c;
+ a->length=w+1;
+ c[w]=0;
+ }
+ a->data[w]=((a->data[w])&iv)|v;
+ while ((a->length > 0) && (a->data[a->length-1] == 0))
+ a->length--;
+ return(1);
+ }
+
+int ASN1_BIT_STRING_get_bit(a,n)
+ASN1_BIT_STRING *a;
+int n;
+ {
+ int w,v;
+
+ w=n/8;
+ v=1<<(7-(n&0x07));
+ if ((a == NULL) || (a->length < (w+1)) || (a->data == NULL))
+ return(0);
+ return((a->data[w]&v) != 0);
+ }
+
diff --git a/crypto/asn1/a_bmp.c b/crypto/asn1/a_bmp.c
new file mode 100644
index 0000000000..774502b1fc
--- /dev/null
+++ b/crypto/asn1/a_bmp.c
@@ -0,0 +1,90 @@
+/* crypto/asn1/a_bmp.c */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to. The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code. The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * "This product includes cryptographic software written by
+ * Eric Young (eay@cryptsoft.com)"
+ * The word 'cryptographic' can be left out if the rouines from the library
+ * being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ * the apps directory (application code) you must include an acknowledgement:
+ * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed. i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#include <stdio.h>
+#include "cryptlib.h"
+#include "asn1.h"
+
+/* ASN1err(ASN1_F_D2I_ASN1_INTEGER,ASN1_R_EXPECTING_AN_INTEGER);
+ */
+
+int i2d_ASN1_BMPSTRING(a, pp)
+ASN1_BMPSTRING *a;
+unsigned char **pp;
+ {
+ return(i2d_ASN1_bytes((ASN1_STRING *)a,pp,
+ V_ASN1_BMPSTRING,V_ASN1_UNIVERSAL));
+ }
+
+ASN1_BMPSTRING *d2i_ASN1_BMPSTRING(a, pp, length)
+ASN1_BMPSTRING **a;
+unsigned char **pp;
+long length;
+ {
+ ASN1_BMPSTRING *ret=NULL;
+
+ ret=(ASN1_BMPSTRING *)d2i_ASN1_bytes((ASN1_STRING **)a,
+ pp,length,V_ASN1_BMPSTRING,V_ASN1_UNIVERSAL);
+ if (ret == NULL)
+ {
+ ASN1err(ASN1_F_D2I_ASN1_BMPSTRING,ASN1_R_ERROR_STACK);
+ return(NULL);
+ }
+ return(ret);
+ }
+
diff --git a/crypto/asn1/a_bool.c b/crypto/asn1/a_bool.c
index 83607b58ef..41a95aa278 100644
--- a/crypto/asn1/a_bool.c
+++ b/crypto/asn1/a_bool.c
@@ -1,5 +1,5 @@
/* crypto/asn1/a_bool.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
diff --git a/crypto/asn1/a_bytes.c b/crypto/asn1/a_bytes.c
index 0c9132498c..14168d61ad 100644
--- a/crypto/asn1/a_bytes.c
+++ b/crypto/asn1/a_bytes.c
@@ -1,5 +1,5 @@
/* crypto/asn1/a_bytes.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
@@ -67,14 +67,14 @@
*/
static unsigned long tag2bit[32]={
-0, 0, 0, 0, /* tags 0 - 3 */
+0, 0, 0, B_ASN1_BIT_STRING, /* tags 0 - 3 */
B_ASN1_OCTET_STRING, 0, 0, B_ASN1_UNKNOWN,/* tags 4- 7 */
B_ASN1_UNKNOWN, B_ASN1_UNKNOWN, B_ASN1_UNKNOWN, B_ASN1_UNKNOWN,/* tags 8-11 */
B_ASN1_UNKNOWN, B_ASN1_UNKNOWN, B_ASN1_UNKNOWN, B_ASN1_UNKNOWN,/* tags 12-15 */
0, 0, B_ASN1_NUMERICSTRING,B_ASN1_PRINTABLESTRING,
B_ASN1_T61STRING,B_ASN1_VIDEOTEXSTRING,B_ASN1_IA5STRING,0,
0,B_ASN1_GRAPHICSTRING,B_ASN1_ISO64STRING,B_ASN1_GENERALSTRING,
-B_ASN1_UNIVERSALSTRING,B_ASN1_UNKNOWN,B_ASN1_UNKNOWN,B_ASN1_UNKNOWN,
+B_ASN1_UNIVERSALSTRING,B_ASN1_UNKNOWN,B_ASN1_BMPSTRING,B_ASN1_UNKNOWN,
};
#ifndef NOPROTO
@@ -97,13 +97,6 @@ int type;
int inf,tag,xclass;
int i=0;
- if ((a == NULL) || ((*a) == NULL))
- {
- if ((ret=ASN1_STRING_new()) == NULL) return(NULL);
- }
- else
- ret=(*a);
-
p= *pp;
inf=ASN1_get_object(&p,&len,&tag,&xclass,length);
if (inf & 0x80) goto err;
@@ -118,6 +111,18 @@ int type;
i=ASN1_R_WRONG_TYPE;
goto err;
}
+
+ /* If a bit-string, exit early */
+ if (tag == V_ASN1_BIT_STRING)
+ return(d2i_ASN1_BIT_STRING(a,pp,length));
+
+ if ((a == NULL) || ((*a) == NULL))
+ {
+ if ((ret=ASN1_STRING_new()) == NULL) return(NULL);
+ }
+ else
+ ret=(*a);
+
if (len != 0)
{
s=(unsigned char *)Malloc((int)len+1);
@@ -157,6 +162,10 @@ int xclass;
unsigned char *p;
if (a == NULL) return(0);
+
+ if (tag == V_ASN1_BIT_STRING)
+ return(i2d_ASN1_BIT_STRING(a,pp));
+
ret=a->length;
r=ASN1_object_size(0,ret,tag);
if (pp == NULL) return(r);
@@ -229,7 +238,7 @@ int Pclass;
{
if (len != 0)
{
- if (ret->length < len)
+ if ((ret->length < len) || (ret->data == NULL))
{
if (ret->data != NULL) Free((char *)ret->data);
s=(unsigned char *)Malloc((int)len);
diff --git a/crypto/asn1/a_d2i_fp.c b/crypto/asn1/a_d2i_fp.c
index 5c9c9cf09b..d952836a91 100644
--- a/crypto/asn1/a_d2i_fp.c
+++ b/crypto/asn1/a_d2i_fp.c
@@ -1,5 +1,5 @@
/* crypto/asn1/a_d2i_fp.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
@@ -63,7 +63,7 @@
#define HEADER_SIZE 8
-#ifndef WIN16
+#ifndef NO_FP_API
char *ASN1_d2i_fp(xnew,d2i,in,x)
char *(*xnew)();
char *(*d2i)();
@@ -108,6 +108,7 @@ unsigned char **x;
return(NULL);
}
+ ERR_clear_error();
for (;;)
{
if (want >= (len-off))
diff --git a/crypto/asn1/a_digest.c b/crypto/asn1/a_digest.c
index 8f395d958a..8ddb65b0dc 100644
--- a/crypto/asn1/a_digest.c
+++ b/crypto/asn1/a_digest.c
@@ -1,5 +1,5 @@
/* crypto/asn1/a_digest.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
diff --git a/crypto/asn1/a_dup.c b/crypto/asn1/a_dup.c
index 51ed105ff2..961b4cb069 100644
--- a/crypto/asn1/a_dup.c
+++ b/crypto/asn1/a_dup.c
@@ -1,5 +1,5 @@
/* crypto/asn1/a_dup.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
diff --git a/crypto/asn1/a_hdr.c b/crypto/asn1/a_hdr.c
index b7de335fc1..4fb7a5fa75 100644
--- a/crypto/asn1/a_hdr.c
+++ b/crypto/asn1/a_hdr.c
@@ -1,5 +1,5 @@
/* crypto/asn1/a_hdr.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
diff --git a/crypto/asn1/a_i2d_fp.c b/crypto/asn1/a_i2d_fp.c
index eab127e6e0..66c3df68d5 100644
--- a/crypto/asn1/a_i2d_fp.c
+++ b/crypto/asn1/a_i2d_fp.c
@@ -1,5 +1,5 @@
/* crypto/asn1/a_i2d_fp.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
@@ -61,7 +61,7 @@
#include "buffer.h"
#include "asn1_mac.h"
-#ifndef WIN16
+#ifndef NO_FP_API
int ASN1_i2d_fp(i2d,out,x)
int (*i2d)();
FILE *out;
diff --git a/crypto/asn1/a_int.c b/crypto/asn1/a_int.c
index ce0921d59a..df79cf99bb 100644
--- a/crypto/asn1/a_int.c
+++ b/crypto/asn1/a_int.c
@@ -1,5 +1,5 @@
/* crypto/asn1/a_int.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
@@ -251,7 +251,8 @@ ASN1_INTEGER *a;
if (a->length > sizeof(long))
{
- return(0xFFFFFFFFL);
+ /* hmm... a bit ugly */
+ return(0xffffffffL);
}
if (a->data == NULL)
return(0);
diff --git a/crypto/asn1/a_meth.c b/crypto/asn1/a_meth.c
index 0beb958aa6..513625c305 100644
--- a/crypto/asn1/a_meth.c
+++ b/crypto/asn1/a_meth.c
@@ -1,5 +1,5 @@
/* crypto/asn1/a_meth.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
diff --git a/crypto/asn1/a_object.c b/crypto/asn1/a_object.c
index 897915cf49..5a7eeef8d8 100644
--- a/crypto/asn1/a_object.c
+++ b/crypto/asn1/a_object.c
@@ -1,5 +1,5 @@
/* crypto/asn1/a_object.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
@@ -64,7 +64,7 @@
/* ASN1err(ASN1_F_ASN1_OBJECT_NEW,ASN1_R_EXPECTING_AN_OBJECT);
* ASN1err(ASN1_F_D2I_ASN1_OBJECT,ASN1_R_BAD_OBJECT_HEADER);
- * ASN1err(ASN1_F_I2A_ASN1_OBJECT,ASN1_R_BAD_OBJECT_HEADER);
+ * ASN1err(ASN1_F_I2T_ASN1_OBJECT,ASN1_R_BAD_OBJECT_HEADER);
*/
int i2d_ASN1_OBJECT(a, pp)
@@ -180,19 +180,23 @@ err:
return(0);
}
-int i2a_ASN1_OBJECT(bp,a)
-BIO *bp;
+int i2t_ASN1_OBJECT(buf,buf_len,a)
+char *buf;
+int buf_len;
ASN1_OBJECT *a;
{
- int j,i,idx=0,n=0,len,nid,reason=ERR_R_BUF_LIB;
+ int i,idx=0,n=0,len,nid;
unsigned long l;
unsigned char *p;
- char buf[20];
char *s;
+ char tbuf[32];
+
+ if (buf_len <= 0) return(0);
if ((a == NULL) || (a->data == NULL))
{
- return(BIO_write(bp,"NULL",4));
+ buf[0]='\0';
+ return(0);
}
nid=OBJ_obj2nid(a);
@@ -215,10 +219,11 @@ ASN1_OBJECT *a;
if (i > 2) i=2;
l-=(long)(i*40);
- sprintf(buf,"%d.%ld",i,l);
- i=strlen(buf);
- if (BIO_write(bp,buf,i) != i)
- goto err;
+ sprintf(tbuf,"%d.%ld",i,l);
+ i=strlen(tbuf);
+ strncpy(buf,tbuf,buf_len);
+ buf_len-=i;
+ buf+=i;
n+=i;
l=0;
@@ -227,9 +232,12 @@ ASN1_OBJECT *a;
l|=p[idx]&0x7f;
if (!(p[idx] & 0x80))
{
- sprintf(buf,".%ld",l);
- i=strlen(buf);
- if (BIO_write(bp,buf,i) != i) goto err;
+ sprintf(tbuf,".%ld",l);
+ i=strlen(tbuf);
+ if (buf_len > 0)
+ strncpy(buf,tbuf,buf_len);
+ buf_len-=i;
+ buf+=i;
n+=i;
l=0;
}
@@ -241,14 +249,26 @@ ASN1_OBJECT *a;
s=(char *)OBJ_nid2ln(nid);
if (s == NULL)
s=(char *)OBJ_nid2sn(nid);
- j=strlen(s);
- if (BIO_write(bp,s,j) != j) goto err;
- n=j;
+ strncpy(buf,s,buf_len);
+ n=strlen(s);
}
+ buf[buf_len-1]='\0';
return(n);
-err:
- ASN1err(ASN1_F_I2A_ASN1_OBJECT,reason);
- return(-1);
+ }
+
+int i2a_ASN1_OBJECT(bp,a)
+BIO *bp;
+ASN1_OBJECT *a;
+ {
+ char buf[80];
+ int i;
+
+ if ((a == NULL) || (a->data == NULL))
+ return(BIO_write(bp,"NULL",4));
+ i=i2t_ASN1_OBJECT(buf,80,a);
+ if (i > 80) i=80;
+ BIO_write(bp,buf,i);
+ return(i);
}
ASN1_OBJECT *d2i_ASN1_OBJECT(a, pp, length)
diff --git a/crypto/asn1/a_octet.c b/crypto/asn1/a_octet.c
index e4ef15a995..be3f172a8c 100644
--- a/crypto/asn1/a_octet.c
+++ b/crypto/asn1/a_octet.c
@@ -1,5 +1,5 @@
/* crypto/asn1/a_octet.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
diff --git a/crypto/asn1/a_print.c b/crypto/asn1/a_print.c
index a1bbc35ca1..3023361dee 100644
--- a/crypto/asn1/a_print.c
+++ b/crypto/asn1/a_print.c
@@ -1,5 +1,5 @@
/* crypto/asn1/a_print.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
diff --git a/crypto/asn1/a_set.c b/crypto/asn1/a_set.c
index 5752fbb5fd..17c49946cf 100644
--- a/crypto/asn1/a_set.c
+++ b/crypto/asn1/a_set.c
@@ -1,5 +1,5 @@
/* crypto/asn1/a_set.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
diff --git a/crypto/asn1/a_sign.c b/crypto/asn1/a_sign.c
index 2925ce3ad3..02188e68c4 100644
--- a/crypto/asn1/a_sign.c
+++ b/crypto/asn1/a_sign.c
@@ -1,5 +1,5 @@
/* crypto/asn1/a_sign.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
diff --git a/crypto/asn1/a_type.c b/crypto/asn1/a_type.c
index abaf70dcb8..7c0004084c 100644
--- a/crypto/asn1/a_type.c
+++ b/crypto/asn1/a_type.c
@@ -1,5 +1,5 @@
/* crypto/asn1/a_type.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
@@ -115,6 +115,9 @@ unsigned char **pp;
case V_ASN1_UNIVERSALSTRING:
r=M_i2d_ASN1_UNIVERSALSTRING(a->value.universalstring,pp);
break;
+ case V_ASN1_BMPSTRING:
+ r=M_i2d_ASN1_BMPSTRING(a->value.bmpstring,pp);
+ break;
case V_ASN1_UTCTIME:
r=i2d_ASN1_UTCTIME(a->value.utctime,pp);
break;
@@ -213,6 +216,11 @@ long length;
M_d2i_ASN1_UNIVERSALSTRING(NULL,&p,max-p)) == NULL)
goto err;
break;
+ case V_ASN1_BMPSTRING:
+ if ((ret->value.bmpstring=
+ M_d2i_ASN1_BMPSTRING(NULL,&p,max-p)) == NULL)
+ goto err;
+ break;
case V_ASN1_UTCTIME:
if ((ret->value.utctime=
d2i_ASN1_UTCTIME(NULL,&p,max-p)) == NULL)
diff --git a/crypto/asn1/a_utctm.c b/crypto/asn1/a_utctm.c
index cc3c692fc9..17a7abbb67 100644
--- a/crypto/asn1/a_utctm.c
+++ b/crypto/asn1/a_utctm.c
@@ -1,5 +1,5 @@
/* crypto/asn1/a_utctm.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
@@ -152,6 +152,28 @@ err:
return(0);
}
+int ASN1_UTCTIME_set_string(s,str)
+ASN1_UTCTIME *s;
+char *str;
+ {
+ ASN1_UTCTIME t;
+
+ t.type=V_ASN1_UTCTIME;
+ t.length=strlen(str);
+ t.data=(unsigned char *)str;
+ if (ASN1_UTCTIME_check(&t))
+ {
+ if (s != NULL)
+ {
+ ASN1_STRING_set((ASN1_STRING *)s,
+ (unsigned char *)str,t.length);
+ }
+ return(1);
+ }
+ else
+ return(0);
+ }
+
ASN1_UTCTIME *ASN1_UTCTIME_set(s, t)
ASN1_UTCTIME *s;
time_t t;
diff --git a/crypto/asn1/a_verify.c b/crypto/asn1/a_verify.c
index 567552f782..03fc63dbef 100644
--- a/crypto/asn1/a_verify.c
+++ b/crypto/asn1/a_verify.c
@@ -1,5 +1,5 @@
/* crypto/asn1/a_verify.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
diff --git a/crypto/asn1/asn1.err b/crypto/asn1/asn1.err
index cbf27ab5fd..c8b7011488 100644
--- a/crypto/asn1/asn1.err
+++ b/crypto/asn1/asn1.err
@@ -18,108 +18,111 @@
#define ASN1_F_ASN1_SIGN 114
#define ASN1_F_ASN1_STRING_NEW 115
#define ASN1_F_ASN1_STRING_TYPE_NEW 116
-#define ASN1_F_ASN1_TYPE_NEW 117
-#define ASN1_F_ASN1_UTCTIME_NEW 118
-#define ASN1_F_ASN1_VERIFY 119
-#define ASN1_F_BN_TO_ASN1_INTEGER 120
-#define ASN1_F_D2I_ASN1_BIT_STRING 121
-#define ASN1_F_D2I_ASN1_BOOLEAN 122
-#define ASN1_F_D2I_ASN1_BYTES 123
-#define ASN1_F_D2I_ASN1_HEADER 124
-#define ASN1_F_D2I_ASN1_INTEGER 125
-#define ASN1_F_D2I_ASN1_OBJECT 126
-#define ASN1_F_D2I_ASN1_OCTET_STRING 127
-#define ASN1_F_D2I_ASN1_PRINT_TYPE 128
-#define ASN1_F_D2I_ASN1_SET 129
-#define ASN1_F_D2I_ASN1_TYPE 130
-#define ASN1_F_D2I_ASN1_TYPE_BYTES 131
-#define ASN1_F_D2I_ASN1_UTCTIME 132
-#define ASN1_F_D2I_DHPARAMS 133
-#define ASN1_F_D2I_DSAPARAMS 134
-#define ASN1_F_D2I_DSAPRIVATEKEY 135
-#define ASN1_F_D2I_DSAPUBLICKEY 136
-#define ASN1_F_D2I_NETSCAPE_PKEY 137
-#define ASN1_F_D2I_NETSCAPE_RSA 138
-#define ASN1_F_D2I_NETSCAPE_RSA_2 139
-#define ASN1_F_D2I_NETSCAPE_SPKAC 140
-#define ASN1_F_D2I_NETSCAPE_SPKI 141
-#define ASN1_F_D2I_PKCS7 142
-#define ASN1_F_D2I_PKCS7_DIGEST 143
-#define ASN1_F_D2I_PKCS7_ENCRYPT 144
-#define ASN1_F_D2I_PKCS7_ENC_CONTENT 145
-#define ASN1_F_D2I_PKCS7_ENVELOPE 146
-#define ASN1_F_D2I_PKCS7_ISSUER_AND_SERIAL 147
-#define ASN1_F_D2I_PKCS7_RECIP_INFO 148
-#define ASN1_F_D2I_PKCS7_SIGNED 149
-#define ASN1_F_D2I_PKCS7_SIGNER_INFO 150
-#define ASN1_F_D2I_PKCS7_SIGN_ENVELOPE 151
-#define ASN1_F_D2I_PRIVATEKEY 152
-#define ASN1_F_D2I_PUBLICKEY 153
-#define ASN1_F_D2I_RSAPRIVATEKEY 154
-#define ASN1_F_D2I_RSAPUBLICKEY 155
-#define ASN1_F_D2I_X509 156
-#define ASN1_F_D2I_X509_ALGOR 157
-#define ASN1_F_D2I_X509_ATTRIBUTE 158
-#define ASN1_F_D2I_X509_CINF 159
-#define ASN1_F_D2I_X509_CRL 160
-#define ASN1_F_D2I_X509_CRL_INFO 161
-#define ASN1_F_D2I_X509_EXTENSION 162
-#define ASN1_F_D2I_X509_KEY 163
-#define ASN1_F_D2I_X509_NAME 164
-#define ASN1_F_D2I_X509_NAME_ENTRY 165
-#define ASN1_F_D2I_X509_PKEY 166
-#define ASN1_F_D2I_X509_PUBKEY 167
-#define ASN1_F_D2I_X509_REQ 168
-#define ASN1_F_D2I_X509_REQ_INFO 169
-#define ASN1_F_D2I_X509_REVOKED 170
-#define ASN1_F_D2I_X509_SIG 171
-#define ASN1_F_D2I_X509_VAL 172
-#define ASN1_F_I2A_ASN1_OBJECT 173
-#define ASN1_F_I2D_ASN1_HEADER 174
-#define ASN1_F_I2D_DHPARAMS 175
-#define ASN1_F_I2D_DSAPARAMS 176
-#define ASN1_F_I2D_DSAPRIVATEKEY 177
-#define ASN1_F_I2D_DSAPUBLICKEY 178
-#define ASN1_F_I2D_NETSCAPE_RSA 179
-#define ASN1_F_I2D_PKCS7 180
-#define ASN1_F_I2D_PRIVATEKEY 181
-#define ASN1_F_I2D_PUBLICKEY 182
-#define ASN1_F_I2D_RSAPRIVATEKEY 183
-#define ASN1_F_I2D_RSAPUBLICKEY 184
-#define ASN1_F_I2D_X509_ATTRIBUTE 185
-#define ASN1_F_NETSCAPE_PKEY_NEW 186
-#define ASN1_F_NETSCAPE_SPKAC_NEW 187
-#define ASN1_F_NETSCAPE_SPKI_NEW 188
-#define ASN1_F_PKCS7_DIGEST_NEW 189
-#define ASN1_F_PKCS7_ENCRYPT_NEW 190
-#define ASN1_F_PKCS7_ENC_CONTENT_NEW 191
-#define ASN1_F_PKCS7_ENVELOPE_NEW 192
-#define ASN1_F_PKCS7_ISSUER_AND_SERIAL_NEW 193
-#define ASN1_F_PKCS7_NEW 194
-#define ASN1_F_PKCS7_RECIP_INFO_NEW 195
-#define ASN1_F_PKCS7_SIGNED_NEW 196
-#define ASN1_F_PKCS7_SIGNER_INFO_NEW 197
-#define ASN1_F_PKCS7_SIGN_ENVELOPE_NEW 198
-#define ASN1_F_X509_ALGOR_NEW 199
-#define ASN1_F_X509_ATTRIBUTE_NEW 200
-#define ASN1_F_X509_CINF_NEW 201
-#define ASN1_F_X509_CRL_INFO_NEW 202
-#define ASN1_F_X509_CRL_NEW 203
-#define ASN1_F_X509_DHPARAMS_NEW 204
-#define ASN1_F_X509_EXTENSION_NEW 205
-#define ASN1_F_X509_INFO_NEW 206
-#define ASN1_F_X509_KEY_NEW 207
-#define ASN1_F_X509_NAME_ENTRY_NEW 208
-#define ASN1_F_X509_NAME_NEW 209
-#define ASN1_F_X509_NEW 210
-#define ASN1_F_X509_PKEY_NEW 211
-#define ASN1_F_X509_PUBKEY_NEW 212
-#define ASN1_F_X509_REQ_INFO_NEW 213
-#define ASN1_F_X509_REQ_NEW 214
-#define ASN1_F_X509_REVOKED_NEW 215
-#define ASN1_F_X509_SIG_NEW 216
-#define ASN1_F_X509_VAL_FREE 217
-#define ASN1_F_X509_VAL_NEW 218
+#define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 117
+#define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 118
+#define ASN1_F_ASN1_TYPE_NEW 119
+#define ASN1_F_ASN1_UTCTIME_NEW 120
+#define ASN1_F_ASN1_VERIFY 121
+#define ASN1_F_BN_TO_ASN1_INTEGER 122
+#define ASN1_F_D2I_ASN1_BIT_STRING 123
+#define ASN1_F_D2I_ASN1_BMPSTRING 124
+#define ASN1_F_D2I_ASN1_BOOLEAN 125
+#define ASN1_F_D2I_ASN1_BYTES 126
+#define ASN1_F_D2I_ASN1_HEADER 127
+#define ASN1_F_D2I_ASN1_INTEGER 128
+#define ASN1_F_D2I_ASN1_OBJECT 129
+#define ASN1_F_D2I_ASN1_OCTET_STRING 130
+#define ASN1_F_D2I_ASN1_PRINT_TYPE 131
+#define ASN1_F_D2I_ASN1_SET 132
+#define ASN1_F_D2I_ASN1_TYPE 133
+#define ASN1_F_D2I_ASN1_TYPE_BYTES 134
+#define ASN1_F_D2I_ASN1_UTCTIME 135
+#define ASN1_F_D2I_DHPARAMS 136
+#define ASN1_F_D2I_DSAPARAMS 137
+#define ASN1_F_D2I_DSAPRIVATEKEY 138
+#define ASN1_F_D2I_DSAPUBLICKEY 139
+#define ASN1_F_D2I_NETSCAPE_PKEY 140
+#define ASN1_F_D2I_NETSCAPE_RSA 141
+#define ASN1_F_D2I_NETSCAPE_RSA_2 142
+#define ASN1_F_D2I_NETSCAPE_SPKAC 143
+#define ASN1_F_D2I_NETSCAPE_SPKI 144
+#define ASN1_F_D2I_PKCS7 145
+#define ASN1_F_D2I_PKCS7_DIGEST 146
+#define ASN1_F_D2I_PKCS7_ENCRYPT 147
+#define ASN1_F_D2I_PKCS7_ENC_CONTENT 148
+#define ASN1_F_D2I_PKCS7_ENVELOPE 149
+#define ASN1_F_D2I_PKCS7_ISSUER_AND_SERIAL 150
+#define ASN1_F_D2I_PKCS7_RECIP_INFO 151
+#define ASN1_F_D2I_PKCS7_SIGNED 152
+#define ASN1_F_D2I_PKCS7_SIGNER_INFO 153
+#define ASN1_F_D2I_PKCS7_SIGN_ENVELOPE 154
+#define ASN1_F_D2I_PRIVATEKEY 155
+#define ASN1_F_D2I_PUBLICKEY 156
+#define ASN1_F_D2I_RSAPRIVATEKEY 157
+#define ASN1_F_D2I_RSAPUBLICKEY 158
+#define ASN1_F_D2I_X509 159
+#define ASN1_F_D2I_X509_ALGOR 160
+#define ASN1_F_D2I_X509_ATTRIBUTE 161
+#define ASN1_F_D2I_X509_CINF 162
+#define ASN1_F_D2I_X509_CRL 163
+#define ASN1_F_D2I_X509_CRL_INFO 164
+#define ASN1_F_D2I_X509_EXTENSION 165
+#define ASN1_F_D2I_X509_KEY 166
+#define ASN1_F_D2I_X509_NAME 167
+#define ASN1_F_D2I_X509_NAME_ENTRY 168
+#define ASN1_F_D2I_X509_PKEY 169
+#define ASN1_F_D2I_X509_PUBKEY 170
+#define ASN1_F_D2I_X509_REQ 171
+#define ASN1_F_D2I_X509_REQ_INFO 172
+#define ASN1_F_D2I_X509_REVOKED 173
+#define ASN1_F_D2I_X509_SIG 174
+#define ASN1_F_D2I_X509_VAL 175
+#define ASN1_F_I2D_ASN1_HEADER 176
+#define ASN1_F_I2D_DHPARAMS 177
+#define ASN1_F_I2D_DSAPARAMS 178
+#define ASN1_F_I2D_DSAPRIVATEKEY 179
+#define ASN1_F_I2D_DSAPUBLICKEY 180
+#define ASN1_F_I2D_NETSCAPE_RSA 181
+#define ASN1_F_I2D_PKCS7 182
+#define ASN1_F_I2D_PRIVATEKEY 183
+#define ASN1_F_I2D_PUBLICKEY 184
+#define ASN1_F_I2D_RSAPRIVATEKEY 185
+#define ASN1_F_I2D_RSAPUBLICKEY 186
+#define ASN1_F_I2D_X509_ATTRIBUTE 187
+#define ASN1_F_I2T_ASN1_OBJECT 188
+#define ASN1_F_NETSCAPE_PKEY_NEW 189
+#define ASN1_F_NETSCAPE_SPKAC_NEW 190
+#define ASN1_F_NETSCAPE_SPKI_NEW 191
+#define ASN1_F_PKCS7_DIGEST_NEW 192
+#define ASN1_F_PKCS7_ENCRYPT_NEW 193
+#define ASN1_F_PKCS7_ENC_CONTENT_NEW 194
+#define ASN1_F_PKCS7_ENVELOPE_NEW 195
+#define ASN1_F_PKCS7_ISSUER_AND_SERIAL_NEW 196
+#define ASN1_F_PKCS7_NEW 197
+#define ASN1_F_PKCS7_RECIP_INFO_NEW 198
+#define ASN1_F_PKCS7_SIGNED_NEW 199
+#define ASN1_F_PKCS7_SIGNER_INFO_NEW 200
+#define ASN1_F_PKCS7_SIGN_ENVELOPE_NEW 201
+#define ASN1_F_X509_ALGOR_NEW 202
+#define ASN1_F_X509_ATTRIBUTE_NEW 203
+#define ASN1_F_X509_CINF_NEW 204
+#define ASN1_F_X509_CRL_INFO_NEW 205
+#define ASN1_F_X509_CRL_NEW 206
+#define ASN1_F_X509_DHPARAMS_NEW 207
+#define ASN1_F_X509_EXTENSION_NEW 208
+#define ASN1_F_X509_INFO_NEW 209
+#define ASN1_F_X509_KEY_NEW 210
+#define ASN1_F_X509_NAME_ENTRY_NEW 211
+#define ASN1_F_X509_NAME_NEW 212
+#define ASN1_F_X509_NEW 213
+#define ASN1_F_X509_PKEY_NEW 214
+#define ASN1_F_X509_PUBKEY_NEW 215
+#define ASN1_F_X509_REQ_INFO_NEW 216
+#define ASN1_F_X509_REQ_NEW 217
+#define ASN1_F_X509_REVOKED_NEW 218
+#define ASN1_F_X509_SIG_NEW 219
+#define ASN1_F_X509_VAL_FREE 220
+#define ASN1_F_X509_VAL_NEW 221
/* Reason codes. */
#define ASN1_R_BAD_CLASS 100
@@ -133,46 +136,47 @@
#define ASN1_R_BN_LIB 108
#define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 109
#define ASN1_R_BUFFER_TOO_SMALL 110
-#define ASN1_R_DECODING_ERROR 111
-#define ASN1_R_ERROR_STACK 112
-#define ASN1_R_EXPECTING_AN_INTEGER 113
-#define ASN1_R_EXPECTING_AN_OBJECT 114
-#define ASN1_R_EXPECTING_AN_OCTET_STRING 115
-#define ASN1_R_EXPECTING_A_BIT_STRING 116
-#define ASN1_R_EXPECTING_A_BOOLEAN 117
-#define ASN1_R_EXPECTING_A_SEQUENCE 118
-#define ASN1_R_EXPECTING_A_UTCTIME 119
-#define ASN1_R_FIRST_NUM_TOO_LARGE 120
-#define ASN1_R_HEADER_TOO_LONG 121
-#define ASN1_R_INVALID_DIGIT 122
-#define ASN1_R_INVALID_SEPARATOR 123
-#define ASN1_R_INVALID_TIME_FORMAT 124
-#define ASN1_R_IV_TOO_LARGE 125
-#define ASN1_R_LENGTH_ERROR 126
-#define ASN1_R_LENGTH_MISMATCH 127
-#define ASN1_R_MISSING_EOS 128
-#define ASN1_R_MISSING_SECOND_NUMBER 129
-#define ASN1_R_NON_HEX_CHARACTERS 130
-#define ASN1_R_NOT_ENOUGH_DATA 131
-#define ASN1_R_ODD_NUMBER_OF_CHARS 132
-#define ASN1_R_PARSING 133
-#define ASN1_R_PRIVATE_KEY_HEADER_MISSING 134
-#define ASN1_R_SECOND_NUMBER_TOO_LARGE 135
-#define ASN1_R_SHORT_LINE 136
-#define ASN1_R_STRING_TOO_SHORT 137
-#define ASN1_R_TAG_VALUE_TOO_HIGH 138
-#define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 139
-#define ASN1_R_TOO_LONG 140
-#define ASN1_R_UNABLE_TO_DECODE_RSA_KEY 141
-#define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY 142
-#define ASN1_R_UNKNOWN_ATTRIBUTE_TYPE 143
-#define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 144
-#define ASN1_R_UNKNOWN_OBJECT_TYPE 145
-#define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 146
-#define ASN1_R_UNSUPPORTED_CIPHER 147
-#define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM 148
-#define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 149
-#define ASN1_R_UTCTIME_TOO_LONG 150
-#define ASN1_R_WRONG_PRINTABLE_TYPE 151
-#define ASN1_R_WRONG_TAG 152
-#define ASN1_R_WRONG_TYPE 153
+#define ASN1_R_DATA_IS_WRONG 111
+#define ASN1_R_DECODING_ERROR 112
+#define ASN1_R_ERROR_STACK 113
+#define ASN1_R_EXPECTING_AN_INTEGER 114
+#define ASN1_R_EXPECTING_AN_OBJECT 115
+#define ASN1_R_EXPECTING_AN_OCTET_STRING 116
+#define ASN1_R_EXPECTING_A_BIT_STRING 117
+#define ASN1_R_EXPECTING_A_BOOLEAN 118
+#define ASN1_R_EXPECTING_A_SEQUENCE 119
+#define ASN1_R_EXPECTING_A_UTCTIME 120
+#define ASN1_R_FIRST_NUM_TOO_LARGE 121
+#define ASN1_R_HEADER_TOO_LONG 122
+#define ASN1_R_INVALID_DIGIT 123
+#define ASN1_R_INVALID_SEPARATOR 124
+#define ASN1_R_INVALID_TIME_FORMAT 125
+#define ASN1_R_IV_TOO_LARGE 126
+#define ASN1_R_LENGTH_ERROR 127
+#define ASN1_R_LENGTH_MISMATCH 128
+#define ASN1_R_MISSING_EOS 129
+#define ASN1_R_MISSING_SECOND_NUMBER 130
+#define ASN1_R_NON_HEX_CHARACTERS 131
+#define ASN1_R_NOT_ENOUGH_DATA 132
+#define ASN1_R_ODD_NUMBER_OF_CHARS 133
+#define ASN1_R_PARSING 134
+#define ASN1_R_PRIVATE_KEY_HEADER_MISSING 135
+#define ASN1_R_SECOND_NUMBER_TOO_LARGE 136
+#define ASN1_R_SHORT_LINE 137
+#define ASN1_R_STRING_TOO_SHORT 138
+#define ASN1_R_TAG_VALUE_TOO_HIGH 139
+#define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 140
+#define ASN1_R_TOO_LONG 141
+#define ASN1_R_UNABLE_TO_DECODE_RSA_KEY 142
+#define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY 143
+#define ASN1_R_UNKNOWN_ATTRIBUTE_TYPE 144
+#define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 145
+#define ASN1_R_UNKNOWN_OBJECT_TYPE 146
+#define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 147
+#define ASN1_R_UNSUPPORTED_CIPHER 148
+#define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM 149
+#define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 150
+#define ASN1_R_UTCTIME_TOO_LONG 151
+#define ASN1_R_WRONG_PRINTABLE_TYPE 152
+#define ASN1_R_WRONG_TAG 153
+#define ASN1_R_WRONG_TYPE 154
diff --git a/crypto/asn1/asn1.h b/crypto/asn1/asn1.h
index cdc342946d..9793db365d 100644
--- a/crypto/asn1/asn1.h
+++ b/crypto/asn1/asn1.h
@@ -1,5 +1,5 @@
/* crypto/asn1/asn1.h */
-/* 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
@@ -86,6 +86,8 @@ extern "C" {
#define V_ASN1_OCTET_STRING 4
#define V_ASN1_NULL 5
#define V_ASN1_OBJECT 6
+#define V_ASN1_OBJECT_DESCRIPTOR 7
+#define V_ASN1_EXTERNAL 8
#define V_ASN1_REAL 9
#define V_ASN1_ENUMERATED 10 /* microsoft weirdness */
#define V_ASN1_SEQUENCE 16
@@ -103,6 +105,7 @@ extern "C" {
#define V_ASN1_VISIBLESTRING 26 /* alias */
#define V_ASN1_GENERALSTRING 27 /**/
#define V_ASN1_UNIVERSALSTRING 28 /**/
+#define V_ASN1_BMPSTRING 30
/* For use with d2i_ASN1_type_bytes() */
#define B_ASN1_NUMERICSTRING 0x0001
@@ -115,6 +118,8 @@ extern "C" {
#define B_ASN1_GENERALSTRING 0x0080
#define B_ASN1_UNIVERSALSTRING 0x0100
#define B_ASN1_OCTET_STRING 0x0200
+#define B_ASN1_BIT_STRING 0x0400
+#define B_ASN1_BMPSTRING 0x0800
#define B_ASN1_UNKNOWN 0x1000
#ifndef DEBUG
@@ -126,8 +131,10 @@ extern "C" {
#define ASN1_T61STRING ASN1_STRING
#define ASN1_IA5STRING ASN1_STRING
#define ASN1_UTCTIME ASN1_STRING
+#define ASN1_GENERALIZEDTIME ASN1_STRING
#define ASN1_GENERALSTRING ASN1_STRING
#define ASN1_UNIVERSALSTRING ASN1_STRING
+#define ASN1_BMPSTRING ASN1_STRING
#else
@@ -187,6 +194,13 @@ typedef struct asn1_universalstring_st
unsigned char *data;
} ASN1_UNIVERSALSTRING;
+typedef struct asn1_bmpstring_st
+ {
+ int length;
+ int type;
+ unsigned char *data;
+ } ASN1_BMPSTRING;
+
typedef struct asn1_utctime_st
{
int length;
@@ -194,6 +208,13 @@ typedef struct asn1_utctime_st
unsigned char *data;
} ASN1_UTCTIME;
+typedef struct asn1_generalizedtime_st
+ {
+ int length;
+ int type;
+ unsigned char *data;
+ } ASN1_GENERALIZEDTIME;
+
#endif
typedef struct asn1_ctx_st
@@ -247,8 +268,10 @@ typedef struct asn1_type_st
ASN1_T61STRING * t61string;
ASN1_IA5STRING * ia5string;
ASN1_GENERALSTRING * generalstring;
+ ASN1_BMPSTRING * bmpstring;
ASN1_UNIVERSALSTRING * universalstring;
ASN1_UTCTIME * utctime;
+ ASN1_GENERALIZEDTIME * generalizedtime;
/* set and sequence are left complete and still
* contain the set or sequence bytes */
ASN1_STRING * set;
@@ -272,6 +295,7 @@ typedef struct asn1_header_st
ASN1_METHOD *meth;
} ASN1_HEADER;
+#define ASN1_STRING_length(x) ((x)->length)
#define ASN1_STRING_type(x) ((x)->type)
#define ASN1_STRING_data(x) ((x)->data)
@@ -321,7 +345,9 @@ typedef struct asn1_header_st
B_ASN1_PRINTABLESTRING| \
B_ASN1_T61STRING| \
B_ASN1_IA5STRING| \
+ B_ASN1_BIT_STRING| \
B_ASN1_UNIVERSALSTRING|\
+ B_ASN1_BMPSTRING|\
B_ASN1_UNKNOWN)
#define ASN1_PRINTABLESTRING_new() (ASN1_PRINTABLESTRING_STRING *)\
@@ -362,7 +388,16 @@ typedef struct asn1_header_st
/* d2i_ASN1_UTCTIME() is a function */
/* ASN1_UTCTIME_set() is a function */
/* ASN1_UTCTIME_check() is a function */
-/* ASN1_UTCTIME_set() is a function */
+
+#define ASN1_GENERALIZEDTIME_new() (ASN1_GENERALIZEDTIME *)\
+ ASN1_STRING_type_new(V_ASN1_GENERALIZEDTIME)
+#define ASN1_GENERALIZEDTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a)
+#define ASN1_GENERALIZEDTIME_dup(a) (ASN1_UTCTIME *)ASN1_STRING_dup(\
+ (ASN1_STRING *)a)
+/* DOES NOT EXIST YET i2d_ASN1_GENERALIZEDTIME() is a function */
+/* DOES NOT EXIST YET d2i_ASN1_GENERALIZEDTIME() is a function */
+/* DOES NOT EXIST YET ASN1_GENERALIZEDTIME_set() is a function */
+/* DOES NOT EXIST YET ASN1_GENERALIZEDTIME_check() is a function */
#define ASN1_GENERALSTRING_new() (ASN1_GENERALSTRING *)\
ASN1_STRING_type_new(V_ASN1_GENERALSTRING)
@@ -384,6 +419,16 @@ typedef struct asn1_header_st
(ASN1_UNIVERSALSTRING *)d2i_ASN1_type_bytes\
((ASN1_STRING **)a,pp,l,B_ASN1_UNIVERSALSTRING)
+#define ASN1_BMPSTRING_new() (ASN1_BMPSTRING *)\
+ ASN1_STRING_type_new(V_ASN1_BMPSTRING)
+#define ASN1_BMPSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
+#define M_i2d_ASN1_BMPSTRING(a,pp) \
+ i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_BMPSTRING,\
+ V_ASN1_UNIVERSAL)
+#define M_d2i_ASN1_BMPSTRING(a,pp,l) \
+ (ASN1_BMPSTRING *)d2i_ASN1_type_bytes\
+ ((ASN1_STRING **)a,pp,l,B_ASN1_BMPSTRING)
+
#ifndef NOPROTO
ASN1_TYPE * ASN1_TYPE_new(void );
void ASN1_TYPE_free(ASN1_TYPE *a);
@@ -408,6 +453,9 @@ int ASN1_STRING_set(ASN1_STRING *str,unsigned char *data, int len);
int i2d_ASN1_BIT_STRING(ASN1_BIT_STRING *a,unsigned char **pp);
ASN1_BIT_STRING *d2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,unsigned char **pp,
long length);
+int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value);
+int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n);
+
int i2d_ASN1_BOOLEAN(int a,unsigned char **pp);
int d2i_ASN1_BOOLEAN(int *a,unsigned char **pp,long length);
@@ -418,6 +466,7 @@ ASN1_INTEGER *d2i_ASN1_INTEGER(ASN1_INTEGER **a,unsigned char **pp,
int ASN1_UTCTIME_check(ASN1_UTCTIME *a);
ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s,time_t t);
+int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, char *str);
int i2d_ASN1_OCTET_STRING(ASN1_OCTET_STRING *a,unsigned char **pp);
ASN1_OCTET_STRING *d2i_ASN1_OCTET_STRING(ASN1_OCTET_STRING **a,
@@ -451,6 +500,7 @@ int i2a_ASN1_OBJECT(BIO *bp,ASN1_OBJECT *a);
int a2i_ASN1_STRING(BIO *bp,ASN1_STRING *bs,char *buf,int size);
int i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type);
#endif
+int i2t_ASN1_OBJECT(char *buf,int buf_len,ASN1_OBJECT *a);
int a2d_ASN1_OBJECT(unsigned char *out,int olen, char *buf, int num);
ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data,int len,
@@ -486,7 +536,7 @@ int ASN1_object_size(int constructed, int length, int tag);
/* Used to implement other functions */
char *ASN1_dup(int (*i2d)(),char *(*d2i)(),char *x);
-#ifndef WIN16
+#ifndef NO_FP_API
char *ASN1_d2i_fp(char *(*xnew)(),char *(*d2i)(),FILE *fp,unsigned char **x);
int ASN1_i2d_fp(int (*i2d)(),FILE *out,unsigned char *x);
#endif
@@ -515,6 +565,15 @@ ASN1_METHOD *RSAPrivateKey_asn1_meth(void);
ASN1_METHOD *ASN1_IA5STRING_asn1_meth(void);
ASN1_METHOD *ASN1_BIT_STRING_asn1_meth(void);
+int ASN1_TYPE_set_octetstring(ASN1_TYPE *a,
+ unsigned char *data, int len);
+int ASN1_TYPE_get_octetstring(ASN1_TYPE *a,
+ unsigned char *data, int max_len);
+int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num,
+ unsigned char *data, int len);
+int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a,long *num,
+ unsigned char *data, int max_len);
+
#else
ASN1_TYPE * ASN1_TYPE_new();
@@ -536,12 +595,15 @@ int ASN1_STRING_cmp();
int ASN1_STRING_set();
int i2d_ASN1_BIT_STRING();
ASN1_BIT_STRING *d2i_ASN1_BIT_STRING();
+int ASN1_BIT_STRING_set_bit();
+int ASN1_BIT_STRING_get_bit();
int i2d_ASN1_BOOLEAN();
int d2i_ASN1_BOOLEAN();
int i2d_ASN1_INTEGER();
ASN1_INTEGER *d2i_ASN1_INTEGER();
int ASN1_UTCTIME_check();
ASN1_UTCTIME *ASN1_UTCTIME_set();
+int ASN1_UTCTIME_set_string();
int i2d_ASN1_OCTET_STRING();
ASN1_OCTET_STRING *d2i_ASN1_OCTET_STRING();
int i2d_ASN1_PRINTABLE();
@@ -570,7 +632,7 @@ int ASN1_check_infinite_end();
void ASN1_put_object();
int ASN1_object_size();
char *ASN1_dup();
-#ifndef WIN16
+#ifndef NO_FP_API
char *ASN1_d2i_fp();
int ASN1_i2d_fp();
#endif
@@ -583,6 +645,7 @@ int ASN1_parse();
int i2a_ASN1_INTEGER();
int a2i_ASN1_INTEGER();
int i2a_ASN1_OBJECT();
+int i2t_ASN1_OBJECT();
int a2i_ASN1_STRING();
int i2a_ASN1_STRING();
@@ -597,6 +660,12 @@ ASN1_METHOD *ASN1_IA5STRING_asn1_meth();
ASN1_METHOD *ASN1_BIT_STRING_asn1_meth();
int ASN1_UNIVERSALSTRING_to_string();
+
+int ASN1_TYPE_set_octetstring();
+int ASN1_TYPE_get_octetstring();
+int ASN1_TYPE_set_int_octetstring();
+int ASN1_TYPE_get_int_octetstring();
+
#endif
/* BEGIN ERROR CODES */
@@ -620,108 +689,111 @@ int ASN1_UNIVERSALSTRING_to_string();
#define ASN1_F_ASN1_SIGN 114
#define ASN1_F_ASN1_STRING_NEW 115
#define ASN1_F_ASN1_STRING_TYPE_NEW 116
-#define ASN1_F_ASN1_TYPE_NEW 117
-#define ASN1_F_ASN1_UTCTIME_NEW 118
-#define ASN1_F_ASN1_VERIFY 119
-#define ASN1_F_BN_TO_ASN1_INTEGER 120
-#define ASN1_F_D2I_ASN1_BIT_STRING 121
-#define ASN1_F_D2I_ASN1_BOOLEAN 122
-#define ASN1_F_D2I_ASN1_BYTES 123
-#define ASN1_F_D2I_ASN1_HEADER 124
-#define ASN1_F_D2I_ASN1_INTEGER 125
-#define ASN1_F_D2I_ASN1_OBJECT 126
-#define ASN1_F_D2I_ASN1_OCTET_STRING 127
-#define ASN1_F_D2I_ASN1_PRINT_TYPE 128
-#define ASN1_F_D2I_ASN1_SET 129
-#define ASN1_F_D2I_ASN1_TYPE 130
-#define ASN1_F_D2I_ASN1_TYPE_BYTES 131
-#define ASN1_F_D2I_ASN1_UTCTIME 132
-#define ASN1_F_D2I_DHPARAMS 133
-#define ASN1_F_D2I_DSAPARAMS 134
-#define ASN1_F_D2I_DSAPRIVATEKEY 135
-#define ASN1_F_D2I_DSAPUBLICKEY 136
-#define ASN1_F_D2I_NETSCAPE_PKEY 137
-#define ASN1_F_D2I_NETSCAPE_RSA 138
-#define ASN1_F_D2I_NETSCAPE_RSA_2 139
-#define ASN1_F_D2I_NETSCAPE_SPKAC 140
-#define ASN1_F_D2I_NETSCAPE_SPKI 141
-#define ASN1_F_D2I_PKCS7 142
-#define ASN1_F_D2I_PKCS7_DIGEST 143
-#define ASN1_F_D2I_PKCS7_ENCRYPT 144
-#define ASN1_F_D2I_PKCS7_ENC_CONTENT 145
-#define ASN1_F_D2I_PKCS7_ENVELOPE 146
-#define ASN1_F_D2I_PKCS7_ISSUER_AND_SERIAL 147
-#define ASN1_F_D2I_PKCS7_RECIP_INFO 148
-#define ASN1_F_D2I_PKCS7_SIGNED 149
-#define ASN1_F_D2I_PKCS7_SIGNER_INFO 150
-#define ASN1_F_D2I_PKCS7_SIGN_ENVELOPE 151
-#define ASN1_F_D2I_PRIVATEKEY 152
-#define ASN1_F_D2I_PUBLICKEY 153
-#define ASN1_F_D2I_RSAPRIVATEKEY 154
-#define ASN1_F_D2I_RSAPUBLICKEY 155
-#define ASN1_F_D2I_X509 156
-#define ASN1_F_D2I_X509_ALGOR 157
-#define ASN1_F_D2I_X509_ATTRIBUTE 158
-#define ASN1_F_D2I_X509_CINF 159
-#define ASN1_F_D2I_X509_CRL 160
-#define ASN1_F_D2I_X509_CRL_INFO 161
-#define ASN1_F_D2I_X509_EXTENSION 162
-#define ASN1_F_D2I_X509_KEY 163
-#define ASN1_F_D2I_X509_NAME 164
-#define ASN1_F_D2I_X509_NAME_ENTRY 165
-#define ASN1_F_D2I_X509_PKEY 166
-#define ASN1_F_D2I_X509_PUBKEY 167
-#define ASN1_F_D2I_X509_REQ 168
-#define ASN1_F_D2I_X509_REQ_INFO 169
-#define ASN1_F_D2I_X509_REVOKED 170
-#define ASN1_F_D2I_X509_SIG 171
-#define ASN1_F_D2I_X509_VAL 172
-#define ASN1_F_I2A_ASN1_OBJECT 173
-#define ASN1_F_I2D_ASN1_HEADER 174
-#define ASN1_F_I2D_DHPARAMS 175
-#define ASN1_F_I2D_DSAPARAMS 176
-#define ASN1_F_I2D_DSAPRIVATEKEY 177
-#define ASN1_F_I2D_DSAPUBLICKEY 178
-#define ASN1_F_I2D_NETSCAPE_RSA 179
-#define ASN1_F_I2D_PKCS7 180
-#define ASN1_F_I2D_PRIVATEKEY 181
-#define ASN1_F_I2D_PUBLICKEY 182
-#define ASN1_F_I2D_RSAPRIVATEKEY 183
-#define ASN1_F_I2D_RSAPUBLICKEY 184
-#define ASN1_F_I2D_X509_ATTRIBUTE 185
-#define ASN1_F_NETSCAPE_PKEY_NEW 186
-#define ASN1_F_NETSCAPE_SPKAC_NEW 187
-#define ASN1_F_NETSCAPE_SPKI_NEW 188
-#define ASN1_F_PKCS7_DIGEST_NEW 189
-#define ASN1_F_PKCS7_ENCRYPT_NEW 190
-#define ASN1_F_PKCS7_ENC_CONTENT_NEW 191
-#define ASN1_F_PKCS7_ENVELOPE_NEW 192
-#define ASN1_F_PKCS7_ISSUER_AND_SERIAL_NEW 193
-#define ASN1_F_PKCS7_NEW 194
-#define ASN1_F_PKCS7_RECIP_INFO_NEW 195
-#define ASN1_F_PKCS7_SIGNED_NEW 196
-#define ASN1_F_PKCS7_SIGNER_INFO_NEW 197
-#define ASN1_F_PKCS7_SIGN_ENVELOPE_NEW 198
-#define ASN1_F_X509_ALGOR_NEW 199
-#define ASN1_F_X509_ATTRIBUTE_NEW 200
-#define ASN1_F_X509_CINF_NEW 201
-#define ASN1_F_X509_CRL_INFO_NEW 202
-#define ASN1_F_X509_CRL_NEW 203
-#define ASN1_F_X509_DHPARAMS_NEW 204
-#define ASN1_F_X509_EXTENSION_NEW 205
-#define ASN1_F_X509_INFO_NEW 206
-#define ASN1_F_X509_KEY_NEW 207
-#define ASN1_F_X509_NAME_ENTRY_NEW 208
-#define ASN1_F_X509_NAME_NEW 209
-#define ASN1_F_X509_NEW 210
-#define ASN1_F_X509_PKEY_NEW 211
-#define ASN1_F_X509_PUBKEY_NEW 212
-#define ASN1_F_X509_REQ_INFO_NEW 213
-#define ASN1_F_X509_REQ_NEW 214
-#define ASN1_F_X509_REVOKED_NEW 215
-#define ASN1_F_X509_SIG_NEW 216
-#define ASN1_F_X509_VAL_FREE 217
-#define ASN1_F_X509_VAL_NEW 218
+#define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 117
+#define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 118
+#define ASN1_F_ASN1_TYPE_NEW 119
+#define ASN1_F_ASN1_UTCTIME_NEW 120
+#define ASN1_F_ASN1_VERIFY 121
+#define ASN1_F_BN_TO_ASN1_INTEGER 122
+#define ASN1_F_D2I_ASN1_BIT_STRING 123
+#define ASN1_F_D2I_ASN1_BMPSTRING 124
+#define ASN1_F_D2I_ASN1_BOOLEAN 125
+#define ASN1_F_D2I_ASN1_BYTES 126
+#define ASN1_F_D2I_ASN1_HEADER 127
+#define ASN1_F_D2I_ASN1_INTEGER 128
+#define ASN1_F_D2I_ASN1_OBJECT 129
+#define ASN1_F_D2I_ASN1_OCTET_STRING 130
+#define ASN1_F_D2I_ASN1_PRINT_TYPE 131
+#define ASN1_F_D2I_ASN1_SET 132
+#define ASN1_F_D2I_ASN1_TYPE 133
+#define ASN1_F_D2I_ASN1_TYPE_BYTES 134
+#define ASN1_F_D2I_ASN1_UTCTIME 135
+#define ASN1_F_D2I_DHPARAMS 136
+#define ASN1_F_D2I_DSAPARAMS 137
+#define ASN1_F_D2I_DSAPRIVATEKEY 138
+#define ASN1_F_D2I_DSAPUBLICKEY 139
+#define ASN1_F_D2I_NETSCAPE_PKEY 140
+#define ASN1_F_D2I_NETSCAPE_RSA 141
+#define ASN1_F_D2I_NETSCAPE_RSA_2 142
+#define ASN1_F_D2I_NETSCAPE_SPKAC 143
+#define ASN1_F_D2I_NETSCAPE_SPKI 144
+#define ASN1_F_D2I_PKCS7 145
+#define ASN1_F_D2I_PKCS7_DIGEST 146
+#define ASN1_F_D2I_PKCS7_ENCRYPT 147
+#define ASN1_F_D2I_PKCS7_ENC_CONTENT 148
+#define ASN1_F_D2I_PKCS7_ENVELOPE 149
+#define ASN1_F_D2I_PKCS7_ISSUER_AND_SERIAL 150
+#define ASN1_F_D2I_PKCS7_RECIP_INFO 151
+#define ASN1_F_D2I_PKCS7_SIGNED 152
+#define ASN1_F_D2I_PKCS7_SIGNER_INFO 153
+#define ASN1_F_D2I_PKCS7_SIGN_ENVELOPE 154
+#define ASN1_F_D2I_PRIVATEKEY 155
+#define ASN1_F_D2I_PUBLICKEY 156
+#define ASN1_F_D2I_RSAPRIVATEKEY 157
+#define ASN1_F_D2I_RSAPUBLICKEY 158
+#define ASN1_F_D2I_X509 159
+#define ASN1_F_D2I_X509_ALGOR 160
+#define ASN1_F_D2I_X509_ATTRIBUTE 161
+#define ASN1_F_D2I_X509_CINF 162
+#define ASN1_F_D2I_X509_CRL 163
+#define ASN1_F_D2I_X509_CRL_INFO 164
+#define ASN1_F_D2I_X509_EXTENSION 165
+#define ASN1_F_D2I_X509_KEY 166
+#define ASN1_F_D2I_X509_NAME 167
+#define ASN1_F_D2I_X509_NAME_ENTRY 168
+#define ASN1_F_D2I_X509_PKEY 169
+#define ASN1_F_D2I_X509_PUBKEY 170
+#define ASN1_F_D2I_X509_REQ 171
+#define ASN1_F_D2I_X509_REQ_INFO 172
+#define ASN1_F_D2I_X509_REVOKED 173
+#define ASN1_F_D2I_X509_SIG 174
+#define ASN1_F_D2I_X509_VAL 175
+#define ASN1_F_I2D_ASN1_HEADER 176
+#define ASN1_F_I2D_DHPARAMS 177
+#define ASN1_F_I2D_DSAPARAMS 178
+#define ASN1_F_I2D_DSAPRIVATEKEY 179
+#define ASN1_F_I2D_DSAPUBLICKEY 180
+#define ASN1_F_I2D_NETSCAPE_RSA 181
+#define ASN1_F_I2D_PKCS7 182
+#define ASN1_F_I2D_PRIVATEKEY 183
+#define ASN1_F_I2D_PUBLICKEY 184
+#define ASN1_F_I2D_RSAPRIVATEKEY 185
+#define ASN1_F_I2D_RSAPUBLICKEY 186
+#define ASN1_F_I2D_X509_ATTRIBUTE 187
+#define ASN1_F_I2T_ASN1_OBJECT 188
+#define ASN1_F_NETSCAPE_PKEY_NEW 189
+#define ASN1_F_NETSCAPE_SPKAC_NEW 190
+#define ASN1_F_NETSCAPE_SPKI_NEW 191
+#define ASN1_F_PKCS7_DIGEST_NEW 192
+#define ASN1_F_PKCS7_ENCRYPT_NEW 193
+#define ASN1_F_PKCS7_ENC_CONTENT_NEW 194
+#define ASN1_F_PKCS7_ENVELOPE_NEW 195
+#define ASN1_F_PKCS7_ISSUER_AND_SERIAL_NEW 196
+#define ASN1_F_PKCS7_NEW 197
+#define ASN1_F_PKCS7_RECIP_INFO_NEW 198
+#define ASN1_F_PKCS7_SIGNED_NEW 199
+#define ASN1_F_PKCS7_SIGNER_INFO_NEW 200
+#define ASN1_F_PKCS7_SIGN_ENVELOPE_NEW 201
+#define ASN1_F_X509_ALGOR_NEW 202
+#define ASN1_F_X509_ATTRIBUTE_NEW 203
+#define ASN1_F_X509_CINF_NEW 204
+#define ASN1_F_X509_CRL_INFO_NEW 205
+#define ASN1_F_X509_CRL_NEW 206
+#define ASN1_F_X509_DHPARAMS_NEW 207
+#define ASN1_F_X509_EXTENSION_NEW 208
+#define ASN1_F_X509_INFO_NEW 209
+#define ASN1_F_X509_KEY_NEW 210
+#define ASN1_F_X509_NAME_ENTRY_NEW 211
+#define ASN1_F_X509_NAME_NEW 212
+#define ASN1_F_X509_NEW 213
+#define ASN1_F_X509_PKEY_NEW 214
+#define ASN1_F_X509_PUBKEY_NEW 215
+#define ASN1_F_X509_REQ_INFO_NEW 216
+#define ASN1_F_X509_REQ_NEW 217
+#define ASN1_F_X509_REVOKED_NEW 218
+#define ASN1_F_X509_SIG_NEW 219
+#define ASN1_F_X509_VAL_FREE 220
+#define ASN1_F_X509_VAL_NEW 221
/* Reason codes. */
#define ASN1_R_BAD_CLASS 100
@@ -735,49 +807,50 @@ int ASN1_UNIVERSALSTRING_to_string();
#define ASN1_R_BN_LIB 108
#define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 109
#define ASN1_R_BUFFER_TOO_SMALL 110
-#define ASN1_R_DECODING_ERROR 111
-#define ASN1_R_ERROR_STACK 112
-#define ASN1_R_EXPECTING_AN_INTEGER 113
-#define ASN1_R_EXPECTING_AN_OBJECT 114
-#define ASN1_R_EXPECTING_AN_OCTET_STRING 115
-#define ASN1_R_EXPECTING_A_BIT_STRING 116
-#define ASN1_R_EXPECTING_A_BOOLEAN 117
-#define ASN1_R_EXPECTING_A_SEQUENCE 118
-#define ASN1_R_EXPECTING_A_UTCTIME 119
-#define ASN1_R_FIRST_NUM_TOO_LARGE 120
-#define ASN1_R_HEADER_TOO_LONG 121
-#define ASN1_R_INVALID_DIGIT 122
-#define ASN1_R_INVALID_SEPARATOR 123
-#define ASN1_R_INVALID_TIME_FORMAT 124
-#define ASN1_R_IV_TOO_LARGE 125
-#define ASN1_R_LENGTH_ERROR 126
-#define ASN1_R_LENGTH_MISMATCH 127
-#define ASN1_R_MISSING_EOS 128
-#define ASN1_R_MISSING_SECOND_NUMBER 129
-#define ASN1_R_NON_HEX_CHARACTERS 130
-#define ASN1_R_NOT_ENOUGH_DATA 131
-#define ASN1_R_ODD_NUMBER_OF_CHARS 132
-#define ASN1_R_PARSING 133
-#define ASN1_R_PRIVATE_KEY_HEADER_MISSING 134
-#define ASN1_R_SECOND_NUMBER_TOO_LARGE 135
-#define ASN1_R_SHORT_LINE 136
-#define ASN1_R_STRING_TOO_SHORT 137
-#define ASN1_R_TAG_VALUE_TOO_HIGH 138
-#define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 139
-#define ASN1_R_TOO_LONG 140
-#define ASN1_R_UNABLE_TO_DECODE_RSA_KEY 141
-#define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY 142
-#define ASN1_R_UNKNOWN_ATTRIBUTE_TYPE 143
-#define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 144
-#define ASN1_R_UNKNOWN_OBJECT_TYPE 145
-#define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 146
-#define ASN1_R_UNSUPPORTED_CIPHER 147
-#define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM 148
-#define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 149
-#define ASN1_R_UTCTIME_TOO_LONG 150
-#define ASN1_R_WRONG_PRINTABLE_TYPE 151
-#define ASN1_R_WRONG_TAG 152
-#define ASN1_R_WRONG_TYPE 153
+#define ASN1_R_DATA_IS_WRONG 111
+#define ASN1_R_DECODING_ERROR 112
+#define ASN1_R_ERROR_STACK 113
+#define ASN1_R_EXPECTING_AN_INTEGER 114
+#define ASN1_R_EXPECTING_AN_OBJECT 115
+#define ASN1_R_EXPECTING_AN_OCTET_STRING 116
+#define ASN1_R_EXPECTING_A_BIT_STRING 117
+#define ASN1_R_EXPECTING_A_BOOLEAN 118
+#define ASN1_R_EXPECTING_A_SEQUENCE 119
+#define ASN1_R_EXPECTING_A_UTCTIME 120
+#define ASN1_R_FIRST_NUM_TOO_LARGE 121
+#define ASN1_R_HEADER_TOO_LONG 122
+#define ASN1_R_INVALID_DIGIT 123
+#define ASN1_R_INVALID_SEPARATOR 124
+#define ASN1_R_INVALID_TIME_FORMAT 125
+#define ASN1_R_IV_TOO_LARGE 126
+#define ASN1_R_LENGTH_ERROR 127
+#define ASN1_R_LENGTH_MISMATCH 128
+#define ASN1_R_MISSING_EOS 129
+#define ASN1_R_MISSING_SECOND_NUMBER 130
+#define ASN1_R_NON_HEX_CHARACTERS 131
+#define ASN1_R_NOT_ENOUGH_DATA 132
+#define ASN1_R_ODD_NUMBER_OF_CHARS 133
+#define ASN1_R_PARSING 134
+#define ASN1_R_PRIVATE_KEY_HEADER_MISSING 135
+#define ASN1_R_SECOND_NUMBER_TOO_LARGE 136
+#define ASN1_R_SHORT_LINE 137
+#define ASN1_R_STRING_TOO_SHORT 138
+#define ASN1_R_TAG_VALUE_TOO_HIGH 139
+#define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 140
+#define ASN1_R_TOO_LONG 141
+#define ASN1_R_UNABLE_TO_DECODE_RSA_KEY 142
+#define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY 143
+#define ASN1_R_UNKNOWN_ATTRIBUTE_TYPE 144
+#define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 145
+#define ASN1_R_UNKNOWN_OBJECT_TYPE 146
+#define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 147
+#define ASN1_R_UNSUPPORTED_CIPHER 148
+#define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM 149
+#define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 150
+#define ASN1_R_UTCTIME_TOO_LONG 151
+#define ASN1_R_WRONG_PRINTABLE_TYPE 152
+#define ASN1_R_WRONG_TAG 153
+#define ASN1_R_WRONG_TYPE 154
#ifdef __cplusplus
}
diff --git a/crypto/asn1/asn1_err.c b/crypto/asn1/asn1_err.c
index 5e6a41b952..03c2858e7d 100644
--- a/crypto/asn1/asn1_err.c
+++ b/crypto/asn1/asn1_err.c
@@ -60,6 +60,7 @@
#include "asn1.h"
/* BEGIN ERROR CODES */
+#ifndef NO_ERR
static ERR_STRING_DATA ASN1_str_functs[]=
{
{ERR_PACK(0,ASN1_F_A2D_ASN1_OBJECT,0), "a2d_ASN1_OBJECT"},
@@ -79,11 +80,14 @@ static ERR_STRING_DATA ASN1_str_functs[]=
{ERR_PACK(0,ASN1_F_ASN1_SIGN,0), "ASN1_SIGN"},
{ERR_PACK(0,ASN1_F_ASN1_STRING_NEW,0), "ASN1_STRING_new"},
{ERR_PACK(0,ASN1_F_ASN1_STRING_TYPE_NEW,0), "ASN1_STRING_type_new"},
+{ERR_PACK(0,ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING,0), "ASN1_TYPE_get_int_octetstring"},
+{ERR_PACK(0,ASN1_F_ASN1_TYPE_GET_OCTETSTRING,0), "ASN1_TYPE_get_octetstring"},
{ERR_PACK(0,ASN1_F_ASN1_TYPE_NEW,0), "ASN1_TYPE_new"},
{ERR_PACK(0,ASN1_F_ASN1_UTCTIME_NEW,0), "ASN1_UTCTIME_NEW"},
{ERR_PACK(0,ASN1_F_ASN1_VERIFY,0), "ASN1_VERIFY"},
{ERR_PACK(0,ASN1_F_BN_TO_ASN1_INTEGER,0), "BN_to_ASN1_INTEGER"},
{ERR_PACK(0,ASN1_F_D2I_ASN1_BIT_STRING,0), "d2i_ASN1_BIT_STRING"},
+{ERR_PACK(0,ASN1_F_D2I_ASN1_BMPSTRING,0), "D2I_ASN1_BMPSTRING"},
{ERR_PACK(0,ASN1_F_D2I_ASN1_BOOLEAN,0), "d2i_ASN1_BOOLEAN"},
{ERR_PACK(0,ASN1_F_D2I_ASN1_BYTES,0), "d2i_ASN1_bytes"},
{ERR_PACK(0,ASN1_F_D2I_ASN1_HEADER,0), "d2i_ASN1_HEADER"},
@@ -135,7 +139,6 @@ static ERR_STRING_DATA ASN1_str_functs[]=
{ERR_PACK(0,ASN1_F_D2I_X509_REVOKED,0), "D2I_X509_REVOKED"},
{ERR_PACK(0,ASN1_F_D2I_X509_SIG,0), "D2I_X509_SIG"},
{ERR_PACK(0,ASN1_F_D2I_X509_VAL,0), "D2I_X509_VAL"},
-{ERR_PACK(0,ASN1_F_I2A_ASN1_OBJECT,0), "i2a_ASN1_OBJECT"},
{ERR_PACK(0,ASN1_F_I2D_ASN1_HEADER,0), "i2d_ASN1_HEADER"},
{ERR_PACK(0,ASN1_F_I2D_DHPARAMS,0), "I2D_DHPARAMS"},
{ERR_PACK(0,ASN1_F_I2D_DSAPARAMS,0), "I2D_DSAPARAMS"},
@@ -148,6 +151,7 @@ static ERR_STRING_DATA ASN1_str_functs[]=
{ERR_PACK(0,ASN1_F_I2D_RSAPRIVATEKEY,0), "I2D_RSAPRIVATEKEY"},
{ERR_PACK(0,ASN1_F_I2D_RSAPUBLICKEY,0), "I2D_RSAPUBLICKEY"},
{ERR_PACK(0,ASN1_F_I2D_X509_ATTRIBUTE,0), "I2D_X509_ATTRIBUTE"},
+{ERR_PACK(0,ASN1_F_I2T_ASN1_OBJECT,0), "i2t_ASN1_OBJECT"},
{ERR_PACK(0,ASN1_F_NETSCAPE_PKEY_NEW,0), "NETSCAPE_PKEY_NEW"},
{ERR_PACK(0,ASN1_F_NETSCAPE_SPKAC_NEW,0), "NETSCAPE_SPKAC_NEW"},
{ERR_PACK(0,ASN1_F_NETSCAPE_SPKI_NEW,0), "NETSCAPE_SPKI_NEW"},
@@ -197,6 +201,7 @@ static ERR_STRING_DATA ASN1_str_reasons[]=
{ASN1_R_BN_LIB ,"bn lib"},
{ASN1_R_BOOLEAN_IS_WRONG_LENGTH ,"boolean is wrong length"},
{ASN1_R_BUFFER_TOO_SMALL ,"buffer too small"},
+{ASN1_R_DATA_IS_WRONG ,"data is wrong"},
{ASN1_R_DECODING_ERROR ,"decoding error"},
{ASN1_R_ERROR_STACK ,"error stack"},
{ASN1_R_EXPECTING_AN_INTEGER ,"expecting an integer"},
@@ -243,14 +248,19 @@ static ERR_STRING_DATA ASN1_str_reasons[]=
{0,NULL},
};
+#endif
+
void ERR_load_ASN1_strings()
{
static int init=1;
- if (init)
- {
+ if (init);
+ {;
init=0;
+#ifndef NO_ERR
ERR_load_strings(ERR_LIB_ASN1,ASN1_str_functs);
ERR_load_strings(ERR_LIB_ASN1,ASN1_str_reasons);
+#endif
+
}
}
diff --git a/crypto/asn1/asn1_lib.c b/crypto/asn1/asn1_lib.c
index bdd706bcf1..ff30b25836 100644
--- a/crypto/asn1/asn1_lib.c
+++ b/crypto/asn1/asn1_lib.c
@@ -1,5 +1,5 @@
/* crypto/asn1/asn1_lib.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
@@ -69,7 +69,7 @@ static int asn1_get_length();
static void asn1_put_length();
#endif
-char *ASN1_version="ASN1 part of SSLeay 0.8.1b 29-Jun-1998";
+char *ASN1_version="ASN1 part of SSLeay 0.9.0b 29-Jun-1998";
int ASN1_check_infinite_end(p,len)
unsigned char **p;
@@ -133,8 +133,8 @@ long omax;
#ifdef undef
fprintf(stderr,"p=%d + *plength=%d > omax=%d + *pp=%d (%d > %d)\n",
p,*plength,omax,*pp,(p+ *plength),omax+ *pp);
-#endif
+#endif
if ((p+ *plength) > (omax+ *pp))
{
ASN1err(ASN1_F_ASN1_GET_OBJECT,ASN1_R_TOO_LONG);
@@ -431,3 +431,14 @@ ASN1_STRING *a,*b;
return(i);
}
+void asn1_add_error(address,offset)
+unsigned char *address;
+int offset;
+ {
+ char buf1[16],buf2[16];
+
+ sprintf(buf1,"%lu",(unsigned long)address);
+ sprintf(buf2,"%d",offset);
+ ERR_add_error_data(4,"address=",buf1," offset=",buf2);
+ }
+
diff --git a/crypto/asn1/asn1_mac.h b/crypto/asn1/asn1_mac.h
index e4ce0aaa7c..4fba70e4bb 100644
--- a/crypto/asn1/asn1_mac.h
+++ b/crypto/asn1/asn1_mac.h
@@ -1,5 +1,5 @@
/* crypto/asn1/asn1_mac.h */
-/* 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
@@ -91,6 +91,7 @@ extern "C" {
M_ASN1_D2I_Finish_2(a); \
err:\
ASN1err((e),c.error); \
+ asn1_add_error(*pp,(int)(c.q- *pp)); \
if ((ret != NULL) && ((a == NULL) || (*a != ret))) func(ret); \
return(NULL)
@@ -257,7 +258,7 @@ err:\
{ \
unsigned char *q=p; \
f(a,&p); \
- *q=(V_ASN1_CONTEXT_SPECIFIC|t); \
+ *q=(V_ASN1_CONTEXT_SPECIFIC|t|(*q&V_ASN1_CONSTRUCTED));\
}
#define M_ASN1_I2D_put_SET(a,f) i2d_ASN1_SET(a,&p,f,V_ASN1_SET,\
@@ -307,8 +308,10 @@ err:\
#ifndef NOPROTO
int asn1_GetSequence(ASN1_CTX *c, long *length);
+void asn1_add_error(unsigned char *address,int offset);
#else
int asn1_GetSequence();
+void asn1_add_error();
#endif
#ifdef __cplusplus
diff --git a/crypto/asn1/asn1_par.c b/crypto/asn1/asn1_par.c
index c6cbe1dfa5..3906227d21 100644
--- a/crypto/asn1/asn1_par.c
+++ b/crypto/asn1/asn1_par.c
@@ -1,5 +1,5 @@
/* crypto/asn1/asn1_par.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
@@ -144,7 +144,8 @@ int indent;
p="GENERALSTRING";
else if (tag == V_ASN1_UNIVERSALSTRING)
p="UNIVERSALSTRING";
-
+ else if (tag == V_ASN1_BMPSTRING)
+ p="BMPSTRING";
else
p2="(unknown)";
@@ -184,6 +185,7 @@ int indent;
int nl,hl,j,r;
ASN1_OBJECT *o=NULL;
ASN1_OCTET_STRING *os=NULL;
+ /* ASN1_BMPSTRING *bmp=NULL;*/
p= *pp;
tot=p+length;
@@ -299,6 +301,10 @@ int indent;
}
BIO_printf(bp,":%d",ii);
}
+ else if (tag == V_ASN1_BMPSTRING)
+ {
+ /* do the BMP thang */
+ }
else if (tag == V_ASN1_OCTET_STRING)
{
int i,printable=1;
diff --git a/crypto/asn1/d2i_dhp.c b/crypto/asn1/d2i_dhp.c
index 6ae3e0efa3..616a308100 100644
--- a/crypto/asn1/d2i_dhp.c
+++ b/crypto/asn1/d2i_dhp.c
@@ -1,5 +1,5 @@
/* crypto/asn1/d2i_dhp.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
diff --git a/crypto/asn1/d2i_dsap.c b/crypto/asn1/d2i_dsap.c
index d0732af23a..2c8ac7bbcf 100644
--- a/crypto/asn1/d2i_dsap.c
+++ b/crypto/asn1/d2i_dsap.c
@@ -1,5 +1,5 @@
/* crypto/asn1/d2i_dsap.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
diff --git a/crypto/asn1/d2i_pr.c b/crypto/asn1/d2i_pr.c
index 0b60aee4c0..b9eaa9629b 100644
--- a/crypto/asn1/d2i_pr.c
+++ b/crypto/asn1/d2i_pr.c
@@ -1,5 +1,5 @@
/* crypto/asn1/d2i_pr.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
diff --git a/crypto/asn1/d2i_pu.c b/crypto/asn1/d2i_pu.c
index 142742e844..5d6192f1e5 100644
--- a/crypto/asn1/d2i_pu.c
+++ b/crypto/asn1/d2i_pu.c
@@ -1,5 +1,5 @@
/* crypto/asn1/d2i_pu.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
diff --git a/crypto/asn1/d2i_r_pr.c b/crypto/asn1/d2i_r_pr.c
index af95f30a56..0c53aa94bf 100644
--- a/crypto/asn1/d2i_r_pr.c
+++ b/crypto/asn1/d2i_r_pr.c
@@ -1,5 +1,5 @@
/* crypto/asn1/d2i_r_pr.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
diff --git a/crypto/asn1/d2i_r_pu.c b/crypto/asn1/d2i_r_pu.c
index 0febef6b36..778b792b1e 100644
--- a/crypto/asn1/d2i_r_pu.c
+++ b/crypto/asn1/d2i_r_pu.c
@@ -1,5 +1,5 @@
/* crypto/asn1/d2i_r_pu.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
diff --git a/crypto/asn1/d2i_s_pr.c b/crypto/asn1/d2i_s_pr.c
index 987db4e3c2..32ff8ba4b3 100644
--- a/crypto/asn1/d2i_s_pr.c
+++ b/crypto/asn1/d2i_s_pr.c
@@ -1,5 +1,5 @@
/* crypto/asn1/d2i_s_pr.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
diff --git a/crypto/asn1/d2i_s_pu.c b/crypto/asn1/d2i_s_pu.c
index dfffa82030..1002f41cd8 100644
--- a/crypto/asn1/d2i_s_pu.c
+++ b/crypto/asn1/d2i_s_pu.c
@@ -1,5 +1,5 @@
/* crypto/asn1/d2i_s_pu.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
diff --git a/crypto/asn1/evp_asn1.c b/crypto/asn1/evp_asn1.c
new file mode 100644
index 0000000000..ebe34a3362
--- /dev/null
+++ b/crypto/asn1/evp_asn1.c
@@ -0,0 +1,193 @@
+/* crypto/asn1/evp_asn1.c */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to. The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code. The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * "This product includes cryptographic software written by
+ * Eric Young (eay@cryptsoft.com)"
+ * The word 'cryptographic' can be left out if the rouines from the library
+ * being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ * the apps directory (application code) you must include an acknowledgement:
+ * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed. i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#include <stdio.h>
+#include "cryptlib.h"
+#include "asn1.h"
+#include "asn1_mac.h"
+
+int ASN1_TYPE_set_octetstring(a,data,len)
+ASN1_TYPE *a;
+unsigned char *data;
+int len;
+ {
+ ASN1_STRING *os;
+
+ if ((os=ASN1_OCTET_STRING_new()) == NULL) return(0);
+ if (!ASN1_OCTET_STRING_set(os,data,len)) return(0);
+ ASN1_TYPE_set(a,V_ASN1_OCTET_STRING,(char *)os);
+ return(1);
+ }
+
+int ASN1_TYPE_get_octetstring(a,data,max_len)
+ASN1_TYPE *a;
+unsigned char *data;
+int max_len; /* for returned value */
+ {
+ int ret,num;
+ unsigned char *p;
+
+ if ((a->type != V_ASN1_OCTET_STRING) || (a->value.octet_string == NULL))
+ {
+ ASN1err(ASN1_F_ASN1_TYPE_GET_OCTETSTRING,ASN1_R_DATA_IS_WRONG);
+ return(-1);
+ }
+ p=ASN1_STRING_data(a->value.octet_string);
+ ret=ASN1_STRING_length(a->value.octet_string);
+ if (ret < max_len)
+ num=ret;
+ else
+ num=max_len;
+ memcpy(data,p,num);
+ return(ret);
+ }
+
+int ASN1_TYPE_set_int_octetstring(a,num,data,len)
+ASN1_TYPE *a;
+long num;
+unsigned char *data;
+int len;
+ {
+ int n,size;
+ ASN1_OCTET_STRING os,*osp;
+ ASN1_INTEGER in;
+ unsigned char *p;
+ unsigned char buf[32]; /* when they have 256bit longs,
+ * I'll be in trouble */
+ in.data=buf;
+ in.length=32;
+ os.data=data;
+ os.type=V_ASN1_OCTET_STRING;
+ os.length=len;
+ ASN1_INTEGER_set(&in,num);
+ n = i2d_ASN1_INTEGER(&in,NULL);
+ n+=M_i2d_ASN1_OCTET_STRING(&os,NULL);
+
+ size=ASN1_object_size(1,n,V_ASN1_SEQUENCE);
+
+ if ((osp=ASN1_STRING_new()) == NULL) return(0);
+ /* Grow the 'string' */
+ ASN1_STRING_set(osp,NULL,size);
+
+ ASN1_STRING_length(osp)=size;
+ p=ASN1_STRING_data(osp);
+
+ ASN1_put_object(&p,1,n,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL);
+ i2d_ASN1_INTEGER(&in,&p);
+ M_i2d_ASN1_OCTET_STRING(&os,&p);
+
+ ASN1_TYPE_set(a,V_ASN1_SEQUENCE,(char *)osp);
+ return(1);
+ }
+
+/* we return the actual length... */
+int ASN1_TYPE_get_int_octetstring(a,num,data,max_len)
+ASN1_TYPE *a;
+long *num;
+unsigned char *data;
+int max_len; /* for returned value */
+ {
+ int ret= -1,n;
+ ASN1_INTEGER *ai=NULL;
+ ASN1_OCTET_STRING *os=NULL;
+ unsigned char *p;
+ long length;
+ ASN1_CTX c;
+
+ if ((a->type != V_ASN1_SEQUENCE) || (a->value.sequence == NULL))
+ {
+ goto err;
+ }
+ p=ASN1_STRING_data(a->value.sequence);
+ length=ASN1_STRING_length(a->value.sequence);
+
+ c.pp= &p;
+ c.p=p;
+ c.max=p+length;
+ c.error=ASN1_R_DATA_IS_WRONG;
+
+ M_ASN1_D2I_start_sequence();
+ c.q=c.p;
+ if ((ai=d2i_ASN1_INTEGER(NULL,&c.p,c.slen)) == NULL) goto err;
+ c.slen-=(c.p-c.q);
+ c.q=c.p;
+ if ((os=d2i_ASN1_OCTET_STRING(NULL,&c.p,c.slen)) == NULL) goto err;
+ c.slen-=(c.p-c.q);
+ if (!M_ASN1_D2I_end_sequence()) goto err;
+
+ if (num != NULL)
+ *num=ASN1_INTEGER_get(ai);
+
+ ret=ASN1_STRING_length(os);
+ if (max_len > ret)
+ n=ret;
+ else
+ n=max_len;
+
+ if (data != NULL)
+ memcpy(data,ASN1_STRING_data(os),n);
+ if (0)
+ {
+err:
+ ASN1err(ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING,ASN1_R_DATA_IS_WRONG);
+ }
+ if (os != NULL) ASN1_OCTET_STRING_free(os);
+ if (ai != NULL) ASN1_INTEGER_free(ai);
+ return(ret);
+ }
+
diff --git a/crypto/asn1/f.c b/crypto/asn1/f.c
new file mode 100644
index 0000000000..2ab3a262ac
--- /dev/null
+++ b/crypto/asn1/f.c
@@ -0,0 +1,80 @@
+/* crypto/asn1/f.c */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to. The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code. The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * "This product includes cryptographic software written by
+ * Eric Young (eay@cryptsoft.com)"
+ * The word 'cryptographic' can be left out if the rouines from the library
+ * being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ * the apps directory (application code) you must include an acknowledgement:
+ * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed. i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+#include <stdio.h>
+#include "asn1.h"
+#include "err.h"
+
+main()
+ {
+ ASN1_TYPE *at;
+ char buf[512];
+ int n;
+ long l;
+
+ at=ASN1_TYPE_new();
+
+ n=ASN1_TYPE_set_int_octetstring(at,98736,"01234567",8);
+ printf("%d\n",n);
+ n=ASN1_TYPE_get_int_octetstring(at,&l,buf,8);
+ buf[8]='\0';
+ printf("%ld %d %d\n",l,n,buf[8]);
+ buf[8]='\0';
+ printf("%s\n",buf);
+ ERR_load_crypto_strings();
+ ERR_print_errors_fp(stderr);
+ }
diff --git a/crypto/asn1/f_int.c b/crypto/asn1/f_int.c
index f786b12d68..4817c45cb7 100644
--- a/crypto/asn1/f_int.c
+++ b/crypto/asn1/f_int.c
@@ -1,5 +1,5 @@
/* crypto/asn1/f_int.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
diff --git a/crypto/asn1/f_string.c b/crypto/asn1/f_string.c
index 68001c3245..ab2837824e 100644
--- a/crypto/asn1/f_string.c
+++ b/crypto/asn1/f_string.c
@@ -1,5 +1,5 @@
/* crypto/asn1/f_string.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
diff --git a/crypto/asn1/i2d_dhp.c b/crypto/asn1/i2d_dhp.c
index 087b6b8f6c..a454025ce3 100644
--- a/crypto/asn1/i2d_dhp.c
+++ b/crypto/asn1/i2d_dhp.c
@@ -1,5 +1,5 @@
/* crypto/asn1/i2d_dhp.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
diff --git a/crypto/asn1/i2d_dsap.c b/crypto/asn1/i2d_dsap.c
index e051c99886..94ecff1525 100644
--- a/crypto/asn1/i2d_dsap.c
+++ b/crypto/asn1/i2d_dsap.c
@@ -1,5 +1,5 @@
/* crypto/asn1/i2d_dsap.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
diff --git a/crypto/asn1/i2d_pr.c b/crypto/asn1/i2d_pr.c
index 361beb9fdd..b6b821d73c 100644
--- a/crypto/asn1/i2d_pr.c
+++ b/crypto/asn1/i2d_pr.c
@@ -1,5 +1,5 @@
/* crypto/asn1/i2d_pr.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
diff --git a/crypto/asn1/i2d_pu.c b/crypto/asn1/i2d_pu.c
index 2694cd4423..1b854252b7 100644
--- a/crypto/asn1/i2d_pu.c
+++ b/crypto/asn1/i2d_pu.c
@@ -1,5 +1,5 @@
/* crypto/asn1/i2d_pu.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
diff --git a/crypto/asn1/i2d_r_pr.c b/crypto/asn1/i2d_r_pr.c
index fa9389760a..aadbb92d8e 100644
--- a/crypto/asn1/i2d_r_pr.c
+++ b/crypto/asn1/i2d_r_pr.c
@@ -1,5 +1,5 @@
/* crypto/asn1/i2d_r_pr.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
diff --git a/crypto/asn1/i2d_r_pu.c b/crypto/asn1/i2d_r_pu.c
index 31dc8363ba..3c54f6709d 100644
--- a/crypto/asn1/i2d_r_pu.c
+++ b/crypto/asn1/i2d_r_pu.c
@@ -1,5 +1,5 @@
/* crypto/asn1/i2d_r_pu.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
diff --git a/crypto/asn1/i2d_s_pr.c b/crypto/asn1/i2d_s_pr.c
index 0c0a5c6f57..6e95305548 100644
--- a/crypto/asn1/i2d_s_pr.c
+++ b/crypto/asn1/i2d_s_pr.c
@@ -1,5 +1,5 @@
/* crypto/asn1/i2d_s_pr.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
diff --git a/crypto/asn1/i2d_s_pu.c b/crypto/asn1/i2d_s_pu.c
index cfb7c11f8b..5cf2877069 100644
--- a/crypto/asn1/i2d_s_pu.c
+++ b/crypto/asn1/i2d_s_pu.c
@@ -1,5 +1,5 @@
/* crypto/asn1/i2d_s_pu.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
diff --git a/crypto/asn1/n_pkey.c b/crypto/asn1/n_pkey.c
index 6353d18c53..5110c91bec 100644
--- a/crypto/asn1/n_pkey.c
+++ b/crypto/asn1/n_pkey.c
@@ -1,5 +1,5 @@
/* crypto/asn1/n_pkey.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
@@ -81,14 +81,11 @@ typedef struct netscape_pkey_st
* ASN1err(ASN1_F_NETSCAPE_PKEY_NEW,ASN1_R_DECODING_ERROR);
*/
#ifndef NOPROTO
-static RSA *d2i_Netscape_RSA_2(RSA **a, unsigned char **pp, long length,
- int (*cb)());
static int i2d_NETSCAPE_PKEY(NETSCAPE_PKEY *a, unsigned char **pp);
static NETSCAPE_PKEY *d2i_NETSCAPE_PKEY(NETSCAPE_PKEY **a,unsigned char **pp, long length);
static NETSCAPE_PKEY *NETSCAPE_PKEY_new(void);
static void NETSCAPE_PKEY_free(NETSCAPE_PKEY *);
#else
-static RSA *d2i_Netscape_RSA_2();
static int i2d_NETSCAPE_PKEY();
static NETSCAPE_PKEY *d2i_NETSCAPE_PKEY();
static NETSCAPE_PKEY *NETSCAPE_PKEY_new();
@@ -183,6 +180,8 @@ int (*cb)();
EVP_BytesToKey(EVP_rc4(),EVP_md5(),NULL,buf,
strlen((char *)buf),1,key,NULL);
memset(buf,0,256);
+
+ EVP_CIPHER_CTX_init(&ctx);
EVP_EncryptInit(&ctx,EVP_rc4(),key,NULL);
EVP_EncryptUpdate(&ctx,os2.data,&i,os2.data,os2.length);
EVP_EncryptFinal(&ctx,&(os2.data[i]),&j);
@@ -234,7 +233,7 @@ int (*cb)();
M_ASN1_D2I_Finish(a,RSA_free,ASN1_F_D2I_NETSCAPE_RSA);
}
-static RSA *d2i_Netscape_RSA_2(a,pp,length,cb)
+RSA *d2i_Netscape_RSA_2(a,pp,length,cb)
RSA **a;
unsigned char **pp;
long length;
@@ -274,6 +273,8 @@ int (*cb)();
EVP_BytesToKey(EVP_rc4(),EVP_md5(),NULL,buf,
strlen((char *)buf),1,key,NULL);
memset(buf,0,256);
+
+ EVP_CIPHER_CTX_init(&ctx);
EVP_DecryptInit(&ctx,EVP_rc4(),key,NULL);
EVP_DecryptUpdate(&ctx,os->data,&i,os->data,os->length);
EVP_DecryptFinal(&ctx,&(os->data[i]),&j);
diff --git a/crypto/asn1/p7_dgst.c b/crypto/asn1/p7_dgst.c
index 206c2a6bb3..f71ed8eb1d 100644
--- a/crypto/asn1/p7_dgst.c
+++ b/crypto/asn1/p7_dgst.c
@@ -1,5 +1,5 @@
/* crypto/asn1/p7_dgst.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
diff --git a/crypto/asn1/p7_enc.c b/crypto/asn1/p7_enc.c
index ce4bedb113..874dd78389 100644
--- a/crypto/asn1/p7_enc.c
+++ b/crypto/asn1/p7_enc.c
@@ -1,5 +1,5 @@
/* crypto/asn1/p7_enc.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
diff --git a/crypto/asn1/p7_enc_c.c b/crypto/asn1/p7_enc_c.c
index b27d443533..2860d3e925 100644
--- a/crypto/asn1/p7_enc_c.c
+++ b/crypto/asn1/p7_enc_c.c
@@ -1,5 +1,5 @@
/* crypto/asn1/p7_enc_c.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
diff --git a/crypto/asn1/p7_evp.c b/crypto/asn1/p7_evp.c
index a41d09db77..4db0a7fe62 100644
--- a/crypto/asn1/p7_evp.c
+++ b/crypto/asn1/p7_evp.c
@@ -1,5 +1,5 @@
/* crypto/asn1/p7_evp.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
diff --git a/crypto/asn1/p7_i_s.c b/crypto/asn1/p7_i_s.c
index 413c7e1e69..9b00c556d9 100644
--- a/crypto/asn1/p7_i_s.c
+++ b/crypto/asn1/p7_i_s.c
@@ -1,5 +1,5 @@
/* crypto/asn1/p7_i_s.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
diff --git a/crypto/asn1/p7_lib.c b/crypto/asn1/p7_lib.c
index b745df0944..2134e0974a 100644
--- a/crypto/asn1/p7_lib.c
+++ b/crypto/asn1/p7_lib.c
@@ -1,5 +1,5 @@
/* crypto/asn1/p7_lib.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
diff --git a/crypto/asn1/p7_recip.c b/crypto/asn1/p7_recip.c
index e4ebda0060..f02233f5a8 100644
--- a/crypto/asn1/p7_recip.c
+++ b/crypto/asn1/p7_recip.c
@@ -1,5 +1,5 @@
/* crypto/asn1/p7_recip.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
@@ -113,6 +113,7 @@ PKCS7_RECIP_INFO *PKCS7_RECIP_INFO_new()
M_ASN1_New(ret->issuer_and_serial,PKCS7_ISSUER_AND_SERIAL_new);
M_ASN1_New(ret->key_enc_algor,X509_ALGOR_new);
M_ASN1_New(ret->enc_key,ASN1_OCTET_STRING_new);
+ ret->cert=NULL;
return(ret);
M_ASN1_New_Error(ASN1_F_PKCS7_RECIP_INFO_NEW);
}
@@ -125,6 +126,7 @@ PKCS7_RECIP_INFO *a;
PKCS7_ISSUER_AND_SERIAL_free(a->issuer_and_serial);
X509_ALGOR_free(a->key_enc_algor);
ASN1_OCTET_STRING_free(a->enc_key);
+ if (a->cert != NULL) X509_free(a->cert);
Free((char *)a);
}
diff --git a/crypto/asn1/p7_s_e.c b/crypto/asn1/p7_s_e.c
index df5fa3ff8c..d344211456 100644
--- a/crypto/asn1/p7_s_e.c
+++ b/crypto/asn1/p7_s_e.c
@@ -1,5 +1,5 @@
/* crypto/asn1/p7_s_e.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
diff --git a/crypto/asn1/p7_signd.c b/crypto/asn1/p7_signd.c
index 23dc7ce268..40f9a44fa8 100644
--- a/crypto/asn1/p7_signd.c
+++ b/crypto/asn1/p7_signd.c
@@ -1,5 +1,5 @@
/* crypto/asn1/p7_signd.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
diff --git a/crypto/asn1/p7_signi.c b/crypto/asn1/p7_signi.c
index d6682e0359..0da92169fc 100644
--- a/crypto/asn1/p7_signi.c
+++ b/crypto/asn1/p7_signi.c
@@ -1,5 +1,5 @@
/* crypto/asn1/p7_signi.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
diff --git a/crypto/asn1/pkcs8.c b/crypto/asn1/pkcs8.c
index bd0d191530..03fdadd51a 100644
--- a/crypto/asn1/pkcs8.c
+++ b/crypto/asn1/pkcs8.c
@@ -1,5 +1,5 @@
/* crypto/asn1/pkcs8.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
@@ -122,6 +122,9 @@ X509 *a;
if (a == NULL) return;
i=CRYPTO_add_lock(&a->references,-1,CRYPTO_LOCK_X509_KEY);
+#ifdef REF_PRINT
+ REF_PRINT("X509_KEY",a);
+#endif
if (i > 0) return;
#ifdef REF_CHECK
if (i < 0)
diff --git a/crypto/asn1/t_pkey.c b/crypto/asn1/t_pkey.c
index 09a5abec67..bc518d59a2 100644
--- a/crypto/asn1/t_pkey.c
+++ b/crypto/asn1/t_pkey.c
@@ -1,5 +1,5 @@
/* crypto/asn1/t_pkey.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
@@ -82,7 +82,7 @@ static int print();
#endif
#ifndef NO_RSA
-#ifndef WIN16
+#ifndef NO_FP_API
int RSA_print_fp(fp,x,off)
FILE *fp;
RSA *x;
@@ -153,7 +153,7 @@ err:
#endif /* NO_RSA */
#ifndef NO_DSA
-#ifndef WIN16
+#ifndef NO_FP_API
int DSA_print_fp(fp,x,off)
FILE *fp;
DSA *x;
@@ -283,7 +283,7 @@ int off;
}
#ifndef NO_DH
-#ifndef WIN16
+#ifndef NO_FP_API
int DHparams_print_fp(fp,x)
FILE *fp;
DH *x;
@@ -329,15 +329,18 @@ DH *x;
(int)x->length) <= 0) goto err;
}
ret=1;
+ if (0)
+ {
err:
+ DHerr(DH_F_DHPARAMS_PRINT,reason);
+ }
if (m != NULL) Free((char *)m);
- DHerr(DH_F_DHPARAMS_PRINT,reason);
return(ret);
}
#endif
#ifndef NO_DSA
-#ifndef WIN16
+#ifndef NO_FP_API
int DSAparams_print_fp(fp,x)
FILE *fp;
DSA *x;
diff --git a/crypto/asn1/t_req.c b/crypto/asn1/t_req.c
index 922f6b3923..7df749a48f 100644
--- a/crypto/asn1/t_req.c
+++ b/crypto/asn1/t_req.c
@@ -1,5 +1,5 @@
/* crypto/asn1/t_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
@@ -63,7 +63,7 @@
#include "objects.h"
#include "x509.h"
-#ifndef WIN16
+#ifndef NO_FP_API
int X509_REQ_print_fp(fp,x)
FILE *fp;
X509_REQ *x;
diff --git a/crypto/asn1/t_x509.c b/crypto/asn1/t_x509.c
index 8ff0a85166..b10fbbb992 100644
--- a/crypto/asn1/t_x509.c
+++ b/crypto/asn1/t_x509.c
@@ -1,5 +1,5 @@
/* crypto/asn1/t_x509.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
@@ -69,7 +69,7 @@
#include "objects.h"
#include "x509.h"
-#ifndef WIN16
+#ifndef NO_FP_API
int X509_print_fp(fp,x)
FILE *fp;
X509 *x;
@@ -304,7 +304,7 @@ ASN1_UTCTIME *tm;
for (i=0; i<10; i++)
if ((v[i] > '9') || (v[i] < '0')) goto err;
y= (v[0]-'0')*10+(v[1]-'0');
- if (y < 70) y+=100;
+ if (y < 50) y+=100;
M= (v[2]-'0')*10+(v[3]-'0');
if ((M > 12) || (M < 1)) goto err;
d= (v[4]-'0')*10+(v[5]-'0');
diff --git a/crypto/asn1/x_algor.c b/crypto/asn1/x_algor.c
index 1a23812c96..0ed2c87b64 100644
--- a/crypto/asn1/x_algor.c
+++ b/crypto/asn1/x_algor.c
@@ -1,5 +1,5 @@
/* crypto/asn1/x_algor.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
diff --git a/crypto/asn1/x_attrib.c b/crypto/asn1/x_attrib.c
index bce6f3aad5..e52ced8627 100644
--- a/crypto/asn1/x_attrib.c
+++ b/crypto/asn1/x_attrib.c
@@ -1,5 +1,5 @@
/* crypto/asn1/x_attrib.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
diff --git a/crypto/asn1/x_cinf.c b/crypto/asn1/x_cinf.c
index e5cc2af722..4fc2cc9f6e 100644
--- a/crypto/asn1/x_cinf.c
+++ b/crypto/asn1/x_cinf.c
@@ -1,5 +1,5 @@
/* crypto/asn1/x_cinf.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
diff --git a/crypto/asn1/x_crl.c b/crypto/asn1/x_crl.c
index 22cb99fb00..13acdab427 100644
--- a/crypto/asn1/x_crl.c
+++ b/crypto/asn1/x_crl.c
@@ -1,5 +1,5 @@
/* crypto/asn1/x_crl.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
@@ -130,7 +130,8 @@ unsigned char **pp;
M_ASN1_I2D_len(a->sig_alg,i2d_X509_ALGOR);
M_ASN1_I2D_len(a->issuer,i2d_X509_NAME);
M_ASN1_I2D_len(a->lastUpdate,i2d_ASN1_UTCTIME);
- M_ASN1_I2D_len(a->nextUpdate,i2d_ASN1_UTCTIME);
+ if (a->nextUpdate != NULL)
+ { M_ASN1_I2D_len(a->nextUpdate,i2d_ASN1_UTCTIME); }
M_ASN1_I2D_len_SEQ_opt(a->revoked,i2d_X509_REVOKED);
M_ASN1_I2D_len_EXP_set_opt(a->extensions,i2d_X509_EXTENSION,0,
V_ASN1_SEQUENCE,v1);
@@ -144,7 +145,8 @@ unsigned char **pp;
M_ASN1_I2D_put(a->sig_alg,i2d_X509_ALGOR);
M_ASN1_I2D_put(a->issuer,i2d_X509_NAME);
M_ASN1_I2D_put(a->lastUpdate,i2d_ASN1_UTCTIME);
- M_ASN1_I2D_put(a->nextUpdate,i2d_ASN1_UTCTIME);
+ if (a->nextUpdate != NULL)
+ { M_ASN1_I2D_put(a->nextUpdate,i2d_ASN1_UTCTIME); }
M_ASN1_I2D_put_SEQ_opt(a->revoked,i2d_X509_REVOKED);
M_ASN1_I2D_put_EXP_set_opt(a->extensions,i2d_X509_EXTENSION,0,
V_ASN1_SEQUENCE,v1);
@@ -175,7 +177,7 @@ long length;
M_ASN1_D2I_get(ret->sig_alg,d2i_X509_ALGOR);
M_ASN1_D2I_get(ret->issuer,d2i_X509_NAME);
M_ASN1_D2I_get(ret->lastUpdate,d2i_ASN1_UTCTIME);
- M_ASN1_D2I_get(ret->nextUpdate,d2i_ASN1_UTCTIME);
+ M_ASN1_D2I_get_opt(ret->nextUpdate,d2i_ASN1_UTCTIME,V_ASN1_UTCTIME);
if (ret->revoked != NULL)
{
while (sk_num(ret->revoked))
@@ -264,7 +266,7 @@ X509_CRL_INFO *X509_CRL_INFO_new()
M_ASN1_New(ret->sig_alg,X509_ALGOR_new);
M_ASN1_New(ret->issuer,X509_NAME_new);
M_ASN1_New(ret->lastUpdate,ASN1_UTCTIME_new);
- M_ASN1_New(ret->nextUpdate,ASN1_UTCTIME_new);
+ ret->nextUpdate=NULL;
M_ASN1_New(ret->revoked,sk_new_null);
M_ASN1_New(ret->extensions,sk_new_null);
ret->revoked->comp=(int (*)())X509_REVOKED_cmp;
@@ -303,7 +305,8 @@ X509_CRL_INFO *a;
X509_ALGOR_free(a->sig_alg);
X509_NAME_free(a->issuer);
ASN1_UTCTIME_free(a->lastUpdate);
- ASN1_UTCTIME_free(a->nextUpdate);
+ if (a->nextUpdate)
+ ASN1_UTCTIME_free(a->nextUpdate);
sk_pop_free(a->revoked,X509_REVOKED_free);
sk_pop_free(a->extensions,X509_EXTENSION_free);
Free((char *)a);
@@ -317,6 +320,9 @@ X509_CRL *a;
if (a == NULL) return;
i=CRYPTO_add(&a->references,-1,CRYPTO_LOCK_X509_CRL);
+#ifdef REF_PRINT
+ REF_PRINT("X509_CRL",a);
+#endif
if (i > 0) return;
#ifdef REF_CHECK
if (i < 0)
diff --git a/crypto/asn1/x_exten.c b/crypto/asn1/x_exten.c
index 89daf3f226..54ffe2f00b 100644
--- a/crypto/asn1/x_exten.c
+++ b/crypto/asn1/x_exten.c
@@ -1,5 +1,5 @@
/* crypto/asn1/x_exten.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
@@ -108,6 +108,10 @@ long length;
M_ASN1_D2I_start_sequence();
M_ASN1_D2I_get(ret->object,d2i_ASN1_OBJECT);
+ if ((ret->argp != NULL) && (ret->ex_free != NULL))
+ ret->ex_free(ret);
+ ret->argl=0;
+ ret->argp=NULL;
ret->netscape_hack=0;
if ((c.slen != 0) &&
(M_ASN1_next == (V_ASN1_UNIVERSAL|V_ASN1_BOOLEAN)))
@@ -132,6 +136,9 @@ X509_EXTENSION *X509_EXTENSION_new()
M_ASN1_New(ret->value,ASN1_OCTET_STRING_new);
ret->critical=0;
ret->netscape_hack=0;
+ ret->argl=0L;
+ ret->argp=NULL;
+ ret->ex_free=NULL;
return(ret);
M_ASN1_New_Error(ASN1_F_X509_EXTENSION_NEW);
}
@@ -140,6 +147,8 @@ void X509_EXTENSION_free(a)
X509_EXTENSION *a;
{
if (a == NULL) return;
+ if ((a->argp != NULL) && (a->ex_free != NULL))
+ a->ex_free(a);
ASN1_OBJECT_free(a->object);
ASN1_OCTET_STRING_free(a->value);
Free((char *)a);
diff --git a/crypto/asn1/x_info.c b/crypto/asn1/x_info.c
index e46c67298f..b55f0ce77a 100644
--- a/crypto/asn1/x_info.c
+++ b/crypto/asn1/x_info.c
@@ -1,5 +1,5 @@
/* crypto/asn1/x_info.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
@@ -92,6 +92,9 @@ X509_INFO *x;
if (x == NULL) return;
i=CRYPTO_add(&x->references,-1,CRYPTO_LOCK_X509_INFO);
+#ifdef REF_PRINT
+ REF_PRINT("X509_INFO",x);
+#endif
if (i > 0) return;
#ifdef REF_CHECK
if (i < 0)
diff --git a/crypto/asn1/x_name.c b/crypto/asn1/x_name.c
index c03f9169cb..28b9c34b58 100644
--- a/crypto/asn1/x_name.c
+++ b/crypto/asn1/x_name.c
@@ -1,5 +1,5 @@
/* crypto/asn1/x_name.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
diff --git a/crypto/asn1/x_pkey.c b/crypto/asn1/x_pkey.c
index ced975b40e..1d4d926129 100644
--- a/crypto/asn1/x_pkey.c
+++ b/crypto/asn1/x_pkey.c
@@ -1,5 +1,5 @@
/* crypto/asn1/x_pkey.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
@@ -136,6 +136,9 @@ X509_PKEY *x;
if (x == NULL) return;
i=CRYPTO_add(&x->references,-1,CRYPTO_LOCK_X509_PKEY);
+#ifdef REF_PRINT
+ REF_PRINT("X509_PKEY",x);
+#endif
if (i > 0) return;
#ifdef REF_CHECK
if (i < 0)
diff --git a/crypto/asn1/x_pubkey.c b/crypto/asn1/x_pubkey.c
index b1a2499d34..a309cf74a7 100644
--- a/crypto/asn1/x_pubkey.c
+++ b/crypto/asn1/x_pubkey.c
@@ -1,5 +1,5 @@
/* crypto/asn1/x_pubkey.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
@@ -211,12 +211,16 @@ X509_PUBKEY *key;
long j;
int type;
unsigned char *p;
+#ifndef NO_DSA
X509_ALGOR *a;
+#endif
+
+ if (key == NULL) goto err;
+
+ if (key->pkey != NULL) return(key->pkey);
+
+ if (key->public_key == NULL) goto err;
- if (key->pkey != NULL)
- {
- return(key->pkey);
- }
type=OBJ_obj2nid(key->algor->algorithm);
p=key->public_key->data;
j=key->public_key->length;
diff --git a/crypto/asn1/x_req.c b/crypto/asn1/x_req.c
index 02b31add17..ff0be13d37 100644
--- a/crypto/asn1/x_req.c
+++ b/crypto/asn1/x_req.c
@@ -1,5 +1,5 @@
/* 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
@@ -226,6 +226,9 @@ X509_REQ *a;
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)
diff --git a/crypto/asn1/x_sig.c b/crypto/asn1/x_sig.c
index 186c404e86..f0a2e4c27a 100644
--- a/crypto/asn1/x_sig.c
+++ b/crypto/asn1/x_sig.c
@@ -1,5 +1,5 @@
/* crypto/asn1/x_sig.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
diff --git a/crypto/asn1/x_spki.c b/crypto/asn1/x_spki.c
index bfeb0659a6..4a80df44b8 100644
--- a/crypto/asn1/x_spki.c
+++ b/crypto/asn1/x_spki.c
@@ -1,5 +1,5 @@
/* crypto/asn1/x_spki.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
diff --git a/crypto/asn1/x_val.c b/crypto/asn1/x_val.c
index e2e4d00436..a9c390f88c 100644
--- a/crypto/asn1/x_val.c
+++ b/crypto/asn1/x_val.c
@@ -1,5 +1,5 @@
/* crypto/asn1/x_val.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
diff --git a/crypto/asn1/x_x509.c b/crypto/asn1/x_x509.c
index d80a5cbc01..bc466ce0f6 100644
--- a/crypto/asn1/x_x509.c
+++ b/crypto/asn1/x_x509.c
@@ -1,5 +1,5 @@
/* crypto/asn1/x_x509.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
@@ -137,6 +137,9 @@ X509 *a;
if (a == NULL) return;
i=CRYPTO_add(&a->references,-1,CRYPTO_LOCK_X509);
+#ifdef REF_PRINT
+ REF_PRINT("X509",a);
+#endif
if (i > 0) return;
#ifdef REF_CHECK
if (i < 0)