projects
/
oweals
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make OCSP_id_cmp and OCSP_id_issuer_cmp accept const params
[oweals/openssl.git]
/
crypto
/
asn1
/
a_d2i_fp.c
diff --git
a/crypto/asn1/a_d2i_fp.c
b/crypto/asn1/a_d2i_fp.c
index 9676ab7bc2855b203d9aa212da67a605b41f550d..a1a17901b8f8c12905073827b612c1906168c1ba 100644
(file)
--- a/
crypto/asn1/a_d2i_fp.c
+++ b/
crypto/asn1/a_d2i_fp.c
@@
-10,10
+10,10
@@
#include <stdio.h>
#include <limits.h>
#include "internal/cryptlib.h"
#include <stdio.h>
#include <limits.h>
#include "internal/cryptlib.h"
+#include "internal/numbers.h"
#include <openssl/buffer.h>
#include <openssl/asn1.h>
#include <openssl/buffer.h>
#include <openssl/asn1.h>
-
-static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb);
+#include "internal/asn1_int.h"
#ifndef NO_OLD_ASN1
# ifndef OPENSSL_NO_STDIO
#ifndef NO_OLD_ASN1
# ifndef OPENSSL_NO_STDIO
@@
-25,12
+25,12
@@
void *ASN1_d2i_fp(void *(*xnew) (void), d2i_of_void *d2i, FILE *in, void **x)
if ((b = BIO_new(BIO_s_file())) == NULL) {
ASN1err(ASN1_F_ASN1_D2I_FP, ERR_R_BUF_LIB);
if ((b = BIO_new(BIO_s_file())) == NULL) {
ASN1err(ASN1_F_ASN1_D2I_FP, ERR_R_BUF_LIB);
- return
(NULL)
;
+ return
NULL
;
}
BIO_set_fp(b, in, BIO_NOCLOSE);
ret = ASN1_d2i_bio(xnew, d2i, b, x);
BIO_free(b);
}
BIO_set_fp(b, in, BIO_NOCLOSE);
ret = ASN1_d2i_bio(xnew, d2i, b, x);
BIO_free(b);
- return
(ret)
;
+ return
ret
;
}
# endif
}
# endif
@@
-49,7
+49,7
@@
void *ASN1_d2i_bio(void *(*xnew) (void), d2i_of_void *d2i, BIO *in, void **x)
ret = d2i(x, &p, len);
err:
BUF_MEM_free(b);
ret = d2i(x, &p, len);
err:
BUF_MEM_free(b);
- return
(ret)
;
+ return
ret
;
}
#endif
}
#endif
@@
-69,7
+69,7
@@
void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x)
ret = ASN1_item_d2i(x, &p, len, it);
err:
BUF_MEM_free(b);
ret = ASN1_item_d2i(x, &p, len, it);
err:
BUF_MEM_free(b);
- return
(ret)
;
+ return
ret
;
}
#ifndef OPENSSL_NO_STDIO
}
#ifndef OPENSSL_NO_STDIO
@@
-80,24
+80,24
@@
void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x)
if ((b = BIO_new(BIO_s_file())) == NULL) {
ASN1err(ASN1_F_ASN1_ITEM_D2I_FP, ERR_R_BUF_LIB);
if ((b = BIO_new(BIO_s_file())) == NULL) {
ASN1err(ASN1_F_ASN1_ITEM_D2I_FP, ERR_R_BUF_LIB);
- return
(NULL)
;
+ return
NULL
;
}
BIO_set_fp(b, in, BIO_NOCLOSE);
ret = ASN1_item_d2i_bio(it, b, x);
BIO_free(b);
}
BIO_set_fp(b, in, BIO_NOCLOSE);
ret = ASN1_item_d2i_bio(it, b, x);
BIO_free(b);
- return
(ret)
;
+ return
ret
;
}
#endif
#define HEADER_SIZE 8
#define ASN1_CHUNK_INITIAL_SIZE (16 * 1024)
}
#endif
#define HEADER_SIZE 8
#define ASN1_CHUNK_INITIAL_SIZE (16 * 1024)
-
static
int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb)
+int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb)
{
BUF_MEM *b;
unsigned char *p;
int i;
size_t want = HEADER_SIZE;
{
BUF_MEM *b;
unsigned char *p;
int i;
size_t want = HEADER_SIZE;
-
in
t eos = 0;
+
uint32_
t eos = 0;
size_t off = 0;
size_t len = 0;
size_t off = 0;
size_t len = 0;
@@
-152,16
+152,16
@@
static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb)
if (inf & 1) {
/* no data body so go round again */
if (inf & 1) {
/* no data body so go round again */
- eos++;
- if (eos < 0) {
+ if (eos == UINT32_MAX) {
ASN1err(ASN1_F_ASN1_D2I_READ_BIO, ASN1_R_HEADER_TOO_LONG);
goto err;
}
ASN1err(ASN1_F_ASN1_D2I_READ_BIO, ASN1_R_HEADER_TOO_LONG);
goto err;
}
+ eos++;
want = HEADER_SIZE;
} else if (eos && (slen == 0) && (tag == V_ASN1_EOC)) {
/* eos value, so go back and read another header */
eos--;
want = HEADER_SIZE;
} else if (eos && (slen == 0) && (tag == V_ASN1_EOC)) {
/* eos value, so go back and read another header */
eos--;
- if (eos
<
= 0)
+ if (eos
=
= 0)
break;
else
want = HEADER_SIZE;
break;
else
want = HEADER_SIZE;
@@
-214,7
+214,7
@@
static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb)
goto err;
}
off += slen;
goto err;
}
off += slen;
- if (eos
<
= 0) {
+ if (eos
=
= 0) {
break;
} else
want = HEADER_SIZE;
break;
} else
want = HEADER_SIZE;