Revert the size_t modifications from HEAD that had led to more

knock-on work than expected - they've been extracted into a patch
series that can be completed elsewhere, or in a different branch,
before merging back to HEAD.
This commit is contained in:
Geoff Thorpe 2008-11-12 03:58:08 +00:00
parent 2401debe83
commit 6343829a39
100 changed files with 559 additions and 646 deletions

View File

@ -148,9 +148,7 @@ typedef fd_mask fd_set;
#define PORT_STR "4433" #define PORT_STR "4433"
#define PROTOCOL "tcp" #define PROTOCOL "tcp"
int do_server(int port, int type, int *ret, int do_server(int port, int type, int *ret, int (*cb) (char *hostname, int s, unsigned char *context), unsigned char *context);
int (*cb) (char *hostname, int s, unsigned char *context),
unsigned char *context);
#ifdef HEADER_X509_H #ifdef HEADER_X509_H
int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx); int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx);
#endif #endif
@ -164,12 +162,11 @@ int extract_port(char *str, short *port_ptr);
int extract_host_port(char *str,char **host_ptr,unsigned char *ip,short *p); int extract_host_port(char *str,char **host_ptr,unsigned char *ip,short *p);
long MS_CALLBACK bio_dump_callback(BIO *bio, int cmd, const char *argp, long MS_CALLBACK bio_dump_callback(BIO *bio, int cmd, const char *argp,
size_t argi, long argl, long ret); int argi, long argl, long ret);
#ifdef HEADER_SSL_H #ifdef HEADER_SSL_H
void MS_CALLBACK apps_ssl_info_callback(const SSL *s, int where, int ret); void MS_CALLBACK apps_ssl_info_callback(const SSL *s, int where, int ret);
void MS_CALLBACK msg_cb(int write_p, int version, int content_type, void MS_CALLBACK msg_cb(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg);
const void *buf, size_t len, SSL *ssl, void *arg);
void MS_CALLBACK tlsext_cb(SSL *s, int client_server, int type, void MS_CALLBACK tlsext_cb(SSL *s, int client_server, int type,
unsigned char *data, int len, unsigned char *data, int len,
void *arg); void *arg);

View File

@ -260,7 +260,7 @@ int set_cert_key_stuff(SSL_CTX *ctx, X509 *cert, EVP_PKEY *key)
} }
long MS_CALLBACK bio_dump_callback(BIO *bio, int cmd, const char *argp, long MS_CALLBACK bio_dump_callback(BIO *bio, int cmd, const char *argp,
size_t argi, long argl, long ret) int argi, long argl, long ret)
{ {
BIO *out; BIO *out;

View File

@ -279,9 +279,7 @@ static int init_client_ip(int *sock, unsigned char ip[4], int port, int type)
return(1); return(1);
} }
int do_server(int port, int type, int *ret, int do_server(int port, int type, int *ret, int (*cb)(char *hostname, int s, unsigned char *context), unsigned char *context)
int (*cb)(char *hostname, int s, unsigned char *context),
unsigned char *context)
{ {
int sock; int sock;
char *name = NULL; char *name = NULL;

View File

@ -60,13 +60,12 @@
#include "cryptlib.h" #include "cryptlib.h"
#include <openssl/asn1.h> #include <openssl/asn1.h>
int ASN1_BIT_STRING_set(ASN1_BIT_STRING *x, unsigned char *d, size_t len) int ASN1_BIT_STRING_set(ASN1_BIT_STRING *x, unsigned char *d, int len)
{ return M_ASN1_BIT_STRING_set(x, d, len); } { return M_ASN1_BIT_STRING_set(x, d, len); }
int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp) int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp)
{ {
int ret,j,bits; int ret,j,bits,len;
size_t len;
unsigned char *p,*d; unsigned char *p,*d;
if (a == NULL) return(0); if (a == NULL) return(0);
@ -115,7 +114,7 @@ int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp)
} }
ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,
const unsigned char **pp, size_t len) const unsigned char **pp, long len)
{ {
ASN1_BIT_STRING *ret=NULL; ASN1_BIT_STRING *ret=NULL;
const unsigned char *p; const unsigned char *p;
@ -145,13 +144,13 @@ ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,
if (len-- > 1) /* using one because of the bits left byte */ if (len-- > 1) /* using one because of the bits left byte */
{ {
s=OPENSSL_malloc(len); s=(unsigned char *)OPENSSL_malloc((int)len);
if (s == NULL) if (s == NULL)
{ {
i=ERR_R_MALLOC_FAILURE; i=ERR_R_MALLOC_FAILURE;
goto err; goto err;
} }
memcpy(s,p,len); memcpy(s,p,(int)len);
s[len-1]&=(0xff<<i); s[len-1]&=(0xff<<i);
p+=len; p+=len;
} }
@ -174,10 +173,9 @@ err:
/* These next 2 functions from Goetz Babin-Ebell <babinebell@trustcenter.de> /* These next 2 functions from Goetz Babin-Ebell <babinebell@trustcenter.de>
*/ */
int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, size_t n, int value) int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value)
{ {
int v,iv; int w,v,iv;
size_t w;
unsigned char *c; unsigned char *c;
w=n/8; w=n/8;
@ -194,9 +192,11 @@ int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, size_t n, int value)
{ {
if (!value) return(1); /* Don't need to set */ if (!value) return(1); /* Don't need to set */
if (a->data == NULL) if (a->data == NULL)
c=OPENSSL_malloc(w+1); c=(unsigned char *)OPENSSL_malloc(w+1);
else else
c=OPENSSL_realloc_clean(a->data, a->length, w+1); c=(unsigned char *)OPENSSL_realloc_clean(a->data,
a->length,
w+1);
if (c == NULL) if (c == NULL)
{ {
ASN1err(ASN1_F_ASN1_BIT_STRING_SET_BIT,ERR_R_MALLOC_FAILURE); ASN1err(ASN1_F_ASN1_BIT_STRING_SET_BIT,ERR_R_MALLOC_FAILURE);
@ -212,7 +212,7 @@ int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, size_t n, int value)
return(1); return(1);
} }
int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, size_t n) int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n)
{ {
int w,v; int w,v;
@ -230,7 +230,7 @@ int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, size_t n)
* 'len' is the length of 'flags'. * 'len' is the length of 'flags'.
*/ */
int ASN1_BIT_STRING_check(ASN1_BIT_STRING *a, int ASN1_BIT_STRING_check(ASN1_BIT_STRING *a,
unsigned char *flags, size_t flags_len) unsigned char *flags, int flags_len)
{ {
int i, ok; int i, ok;
/* Check if there is one bit set at all. */ /* Check if there is one bit set at all. */

View File

@ -75,11 +75,11 @@ int i2d_ASN1_BOOLEAN(int a, unsigned char **pp)
return(r); return(r);
} }
int d2i_ASN1_BOOLEAN(int *a, const unsigned char **pp, size_t length) int d2i_ASN1_BOOLEAN(int *a, const unsigned char **pp, long length)
{ {
int ret= -1; int ret= -1;
const unsigned char *p; const unsigned char *p;
size_t len; long len;
int inf,tag,xclass; int inf,tag,xclass;
int i=0; int i=0;

View File

@ -64,12 +64,12 @@ static int asn1_collate_primitive(ASN1_STRING *a, ASN1_const_CTX *c);
/* type is a 'bitmap' of acceptable string types. /* type is a 'bitmap' of acceptable string types.
*/ */
ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a, const unsigned char **pp, ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a, const unsigned char **pp,
size_t length, int type) long length, int type)
{ {
ASN1_STRING *ret=NULL; ASN1_STRING *ret=NULL;
const unsigned char *p; const unsigned char *p;
unsigned char *s; unsigned char *s;
size_t len; long len;
int inf,tag,xclass; int inf,tag,xclass;
int i=0; int i=0;
@ -155,12 +155,12 @@ int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass)
} }
ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp, ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp,
size_t length, int Ptag, int Pclass) long length, int Ptag, int Pclass)
{ {
ASN1_STRING *ret=NULL; ASN1_STRING *ret=NULL;
const unsigned char *p; const unsigned char *p;
unsigned char *s; unsigned char *s;
size_t len; long len;
int inf,tag,xclass; int inf,tag,xclass;
int i=0; int i=0;

View File

@ -176,7 +176,7 @@ int i2c_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp)
/* Convert just ASN1 INTEGER content octets to ASN1_INTEGER structure */ /* Convert just ASN1 INTEGER content octets to ASN1_INTEGER structure */
ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp, ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp,
size_t len) long len)
{ {
ASN1_INTEGER *ret=NULL; ASN1_INTEGER *ret=NULL;
const unsigned char *p, *pend; const unsigned char *p, *pend;
@ -196,7 +196,7 @@ ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp,
/* We must OPENSSL_malloc stuff, even for 0 bytes otherwise it /* We must OPENSSL_malloc stuff, even for 0 bytes otherwise it
* signifies a missing NULL parameter. */ * signifies a missing NULL parameter. */
s=OPENSSL_malloc(len+1); s=(unsigned char *)OPENSSL_malloc((int)len+1);
if (s == NULL) if (s == NULL)
{ {
i=ERR_R_MALLOC_FAILURE; i=ERR_R_MALLOC_FAILURE;
@ -246,7 +246,7 @@ ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp,
p++; p++;
len--; len--;
} }
memcpy(s,p,len); memcpy(s,p,(int)len);
} }
if (ret->data != NULL) OPENSSL_free(ret->data); if (ret->data != NULL) OPENSSL_free(ret->data);
@ -269,12 +269,12 @@ err:
*/ */
ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp, ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp,
size_t length) long length)
{ {
ASN1_INTEGER *ret=NULL; ASN1_INTEGER *ret=NULL;
const unsigned char *p; const unsigned char *p;
unsigned char *to,*s; unsigned char *to,*s;
size_t len; long len;
int inf,tag,xclass; int inf,tag,xclass;
int i; int i;
@ -302,7 +302,7 @@ ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp,
/* We must OPENSSL_malloc stuff, even for 0 bytes otherwise it /* We must OPENSSL_malloc stuff, even for 0 bytes otherwise it
* signifies a missing NULL parameter. */ * signifies a missing NULL parameter. */
s=OPENSSL_malloc(len+1); s=(unsigned char *)OPENSSL_malloc((int)len+1);
if (s == NULL) if (s == NULL)
{ {
i=ERR_R_MALLOC_FAILURE; i=ERR_R_MALLOC_FAILURE;
@ -316,7 +316,7 @@ ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp,
p++; p++;
len--; len--;
} }
memcpy(s,p,len); memcpy(s,p,(int)len);
p+=len; p+=len;
} }
@ -405,7 +405,7 @@ long ASN1_INTEGER_get(const ASN1_INTEGER *a)
ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai) ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai)
{ {
ASN1_INTEGER *ret; ASN1_INTEGER *ret;
size_t len,j; int len,j;
if (ai == NULL) if (ai == NULL)
ret=M_ASN1_INTEGER_new(); ret=M_ASN1_INTEGER_new();
@ -423,7 +423,7 @@ ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai)
len=((j == 0)?0:((j/8)+1)); len=((j == 0)?0:((j/8)+1));
if (ret->length < len+4) if (ret->length < len+4)
{ {
unsigned char *new_data=OPENSSL_realloc(ret->data, len+4U); unsigned char *new_data=OPENSSL_realloc(ret->data, len+4);
if (!new_data) if (!new_data)
{ {
ASN1err(ASN1_F_BN_TO_ASN1_INTEGER,ERR_R_MALLOC_FAILURE); ASN1err(ASN1_F_BN_TO_ASN1_INTEGER,ERR_R_MALLOC_FAILURE);

View File

@ -80,15 +80,15 @@ static int is_printable(unsigned long value);
* The 'ncopy' form checks minimum and maximum size limits too. * The 'ncopy' form checks minimum and maximum size limits too.
*/ */
int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, size_t len, int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len,
int inform, unsigned long mask) int inform, unsigned long mask)
{ {
return ASN1_mbstring_ncopy(out, in, len, inform, mask, 0, 0); return ASN1_mbstring_ncopy(out, in, len, inform, mask, 0, 0);
} }
int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, size_t len, int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
int inform, unsigned long mask, size_t minsize, int inform, unsigned long mask,
size_t maxsize) long minsize, long maxsize)
{ {
int str_type; int str_type;
int ret; int ret;
@ -145,14 +145,14 @@ int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, size_t len,
if((minsize > 0) && (nchar < minsize)) { if((minsize > 0) && (nchar < minsize)) {
ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY, ASN1_R_STRING_TOO_SHORT); ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY, ASN1_R_STRING_TOO_SHORT);
BIO_snprintf(strbuf, sizeof strbuf, "%ld", (long)minsize); BIO_snprintf(strbuf, sizeof strbuf, "%ld", minsize);
ERR_add_error_data(2, "minsize=", strbuf); ERR_add_error_data(2, "minsize=", strbuf);
return -1; return -1;
} }
if((maxsize > 0) && (nchar > maxsize)) { if((maxsize > 0) && (nchar > maxsize)) {
ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY, ASN1_R_STRING_TOO_LONG); ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY, ASN1_R_STRING_TOO_LONG);
BIO_snprintf(strbuf, sizeof strbuf, "%ld", (long)maxsize); BIO_snprintf(strbuf, sizeof strbuf, "%ld", maxsize);
ERR_add_error_data(2, "maxsize=", strbuf); ERR_add_error_data(2, "maxsize=", strbuf);
return -1; return -1;
} }

View File

@ -83,13 +83,11 @@ int i2d_ASN1_OBJECT(ASN1_OBJECT *a, unsigned char **pp)
return(objsize); return(objsize);
} }
size_t a2d_ASN1_OBJECT(unsigned char *out, size_t olen, const char *buf, int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num)
int num)
{ {
int i,len=0,c, use_bn; int i,first,len=0,c, use_bn;
unsigned first;
char ftmp[24], *tmp = ftmp; char ftmp[24], *tmp = ftmp;
size_t tmpsize = sizeof ftmp; int tmpsize = sizeof ftmp;
const char *p; const char *p;
unsigned long l; unsigned long l;
BIGNUM *bl = NULL; BIGNUM *bl = NULL;
@ -152,11 +150,11 @@ size_t a2d_ASN1_OBJECT(unsigned char *out, size_t olen, const char *buf,
if (use_bn) if (use_bn)
{ {
if (!BN_mul_word(bl, 10L) if (!BN_mul_word(bl, 10L)
|| !BN_add_signed_word(bl, c-'0')) || !BN_add_word(bl, c-'0'))
goto err; goto err;
} }
else else
l=l*10L+(c-'0'); l=l*10L+(long)(c-'0');
} }
if (len == 0) if (len == 0)
{ {
@ -229,7 +227,7 @@ err:
return(0); return(0);
} }
int i2t_ASN1_OBJECT(char *buf, size_t buf_len, ASN1_OBJECT *a) int i2t_ASN1_OBJECT(char *buf, int buf_len, ASN1_OBJECT *a)
{ {
return OBJ_obj2txt(buf, buf_len, a, 0); return OBJ_obj2txt(buf, buf_len, a, 0);
} }
@ -237,7 +235,7 @@ int i2t_ASN1_OBJECT(char *buf, size_t buf_len, ASN1_OBJECT *a)
int i2a_ASN1_OBJECT(BIO *bp, ASN1_OBJECT *a) int i2a_ASN1_OBJECT(BIO *bp, ASN1_OBJECT *a)
{ {
char buf[80], *p = buf; char buf[80], *p = buf;
size_t i; int i;
if ((a == NULL) || (a->data == NULL)) if ((a == NULL) || (a->data == NULL))
return(BIO_write(bp,"NULL",4)); return(BIO_write(bp,"NULL",4));
@ -258,14 +256,13 @@ int i2a_ASN1_OBJECT(BIO *bp, ASN1_OBJECT *a)
} }
ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
size_t length) long length)
{ {
const unsigned char *p; const unsigned char *p;
size_t len; long len;
int tag,xclass; int tag,xclass;
int inf,i; int inf,i;
ASN1_OBJECT *ret = NULL; ASN1_OBJECT *ret = NULL;
p= *pp; p= *pp;
inf=ASN1_get_object(&p,&len,&tag,&xclass,length); inf=ASN1_get_object(&p,&len,&tag,&xclass,length);
if (inf & 0x80) if (inf & 0x80)
@ -287,7 +284,7 @@ err:
return(NULL); return(NULL);
} }
ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
size_t len) long len)
{ {
ASN1_OBJECT *ret=NULL; ASN1_OBJECT *ret=NULL;
const unsigned char *p; const unsigned char *p;
@ -312,15 +309,15 @@ ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
{ {
ret->length=0; ret->length=0;
if (data != NULL) OPENSSL_free(data); if (data != NULL) OPENSSL_free(data);
data=OPENSSL_malloc(len ? len : 1); data=(unsigned char *)OPENSSL_malloc(len ? (int)len : 1);
if (data == NULL) if (data == NULL)
{ i=ERR_R_MALLOC_FAILURE; goto err; } { i=ERR_R_MALLOC_FAILURE; goto err; }
ret->flags|=ASN1_OBJECT_FLAG_DYNAMIC_DATA; ret->flags|=ASN1_OBJECT_FLAG_DYNAMIC_DATA;
} }
memcpy(data,p,len); memcpy(data,p,(int)len);
/* reattach data to object, after which it remains const */ /* reattach data to object, after which it remains const */
ret->data =data; ret->data =data;
ret->length=len; ret->length=(int)len;
ret->sn=NULL; ret->sn=NULL;
ret->ln=NULL; ret->ln=NULL;
/* ret->flags=ASN1_OBJECT_FLAG_DYNAMIC; we know it is dynamic */ /* ret->flags=ASN1_OBJECT_FLAG_DYNAMIC; we know it is dynamic */
@ -376,7 +373,7 @@ void ASN1_OBJECT_free(ASN1_OBJECT *a)
OPENSSL_free(a); OPENSSL_free(a);
} }
ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, size_t len, ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len,
const char *sn, const char *ln) const char *sn, const char *ln)
{ {
ASN1_OBJECT o; ASN1_OBJECT o;

View File

@ -63,11 +63,9 @@
ASN1_OCTET_STRING *ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *x) ASN1_OCTET_STRING *ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *x)
{ return M_ASN1_OCTET_STRING_dup(x); } { return M_ASN1_OCTET_STRING_dup(x); }
int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a, int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a, const ASN1_OCTET_STRING *b)
const ASN1_OCTET_STRING *b)
{ return M_ASN1_OCTET_STRING_cmp(a, b); } { return M_ASN1_OCTET_STRING_cmp(a, b); }
int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *x, const unsigned char *d, int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *x, const unsigned char *d, int len)
size_t len)
{ return M_ASN1_OCTET_STRING_set(x, d, len); } { return M_ASN1_OCTET_STRING_set(x, d, len); }

View File

@ -60,17 +60,16 @@
#include "cryptlib.h" #include "cryptlib.h"
#include <openssl/asn1.h> #include <openssl/asn1.h>
int ASN1_PRINTABLE_type(const unsigned char *s, size_t len) int ASN1_PRINTABLE_type(const unsigned char *s, int len)
{ {
int c; int c;
int ia5=0; int ia5=0;
int t61=0; int t61=0;
int ignore_len = 0;
if (len == 0) ignore_len = 1; if (len <= 0) len= -1;
if (s == NULL) return(V_ASN1_PRINTABLESTRING); if (s == NULL) return(V_ASN1_PRINTABLESTRING);
while (*s && !ignore_len && len-- != 0) while ((*s) && (len-- != 0))
{ {
c= *(s++); c= *(s++);
#ifndef CHARSET_EBCDIC #ifndef CHARSET_EBCDIC

View File

@ -65,7 +65,7 @@
typedef struct typedef struct
{ {
unsigned char *pbData; unsigned char *pbData;
size_t cbData; int cbData;
} MYBLOB; } MYBLOB;
/* SetBlobCmp /* SetBlobCmp
@ -85,11 +85,11 @@ static int SetBlobCmp(const void *elem1, const void *elem2 )
} }
/* int is_set: if TRUE, then sort the contents (i.e. it isn't a SEQUENCE) */ /* int is_set: if TRUE, then sort the contents (i.e. it isn't a SEQUENCE) */
size_t i2d_ASN1_SET(STACK_OF(BLOCK) *a, unsigned char **pp, int i2d_ASN1_SET(STACK_OF(BLOCK) *a, unsigned char **pp,
i2d_of_void *i2d, int ex_tag, int ex_class, i2d_of_void *i2d, int ex_tag, int ex_class,
int is_set) int is_set)
{ {
size_t ret=0,r; int ret=0,r;
int i; int i;
unsigned char *p; unsigned char *p;
unsigned char *pStart, *pTempMem; unsigned char *pStart, *pTempMem;
@ -164,7 +164,7 @@ SetBlob
} }
STACK_OF(BLOCK) *d2i_ASN1_SET(STACK_OF(BLOCK) **a, const unsigned char **pp, STACK_OF(BLOCK) *d2i_ASN1_SET(STACK_OF(BLOCK) **a, const unsigned char **pp,
size_t length, d2i_of_void *d2i, long length, d2i_of_void *d2i,
void (*free_func)(BLOCK), int ex_tag, void (*free_func)(BLOCK), int ex_tag,
int ex_class) int ex_class)
{ {

View File

@ -121,7 +121,7 @@ int ASN1_STRING_set_default_mask_asc(char *p)
*/ */
ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, const unsigned char *in, ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, const unsigned char *in,
size_t inlen, int inform, int nid) int inlen, int inform, int nid)
{ {
ASN1_STRING_TABLE *tbl; ASN1_STRING_TABLE *tbl;
ASN1_STRING *str = NULL; ASN1_STRING *str = NULL;

View File

@ -135,12 +135,11 @@ int ASN1_TIME_check(ASN1_TIME *t)
} }
/* Convert an ASN1_TIME structure to GeneralizedTime */ /* Convert an ASN1_TIME structure to GeneralizedTime */
ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out)
ASN1_GENERALIZEDTIME **out)
{ {
ASN1_GENERALIZEDTIME *ret; ASN1_GENERALIZEDTIME *ret;
char *str; char *str;
size_t newlen; int newlen;
if (!ASN1_TIME_check(t)) return NULL; if (!ASN1_TIME_check(t)) return NULL;

View File

@ -73,7 +73,7 @@
* -4 = character encoded incorrectly (not minimal length). * -4 = character encoded incorrectly (not minimal length).
*/ */
int UTF8_getc(const unsigned char *str, size_t len, unsigned long *val) int UTF8_getc(const unsigned char *str, int len, unsigned long *val)
{ {
const unsigned char *p; const unsigned char *p;
unsigned long value; unsigned long value;
@ -152,7 +152,7 @@ int UTF8_getc(const unsigned char *str, size_t len, unsigned long *val)
* It will need at most 6 characters. * It will need at most 6 characters.
*/ */
int UTF8_putc(unsigned char *str, size_t len, unsigned long value) int UTF8_putc(unsigned char *str, int len, unsigned long value)
{ {
if(!str) len = 6; /* Maximum we will need */ if(!str) len = 6; /* Maximum we will need */
else if(len <= 0) return -1; else if(len <= 0) return -1;

View File

@ -416,7 +416,7 @@ void EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth,
void EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth, void EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth,
int (*param_decode)(EVP_PKEY *pkey, int (*param_decode)(EVP_PKEY *pkey,
const unsigned char **pder, size_t derlen), const unsigned char **pder, int derlen),
int (*param_encode)(const EVP_PKEY *pkey, unsigned char **pder), int (*param_encode)(const EVP_PKEY *pkey, unsigned char **pder),
int (*param_missing)(const EVP_PKEY *pk), int (*param_missing)(const EVP_PKEY *pk),
int (*param_copy)(EVP_PKEY *to, const EVP_PKEY *from), int (*param_copy)(EVP_PKEY *to, const EVP_PKEY *from),

View File

@ -180,7 +180,7 @@ typedef struct asn1_ctx_st
int inf; /* constructed if 0x20, indefinite is 0x21 */ int inf; /* constructed if 0x20, indefinite is 0x21 */
int tag; /* tag from last 'get object' */ int tag; /* tag from last 'get object' */
int xclass; /* class from last 'get object' */ int xclass; /* class from last 'get object' */
size_t slen; /* length of last 'get object' */ long slen; /* length of last 'get object' */
unsigned char *max; /* largest value of p allowed */ unsigned char *max; /* largest value of p allowed */
unsigned char *q;/* temporary variable */ unsigned char *q;/* temporary variable */
unsigned char **pp;/* variable */ unsigned char **pp;/* variable */
@ -195,7 +195,7 @@ typedef struct asn1_const_ctx_st
int inf; /* constructed if 0x20, indefinite is 0x21 */ int inf; /* constructed if 0x20, indefinite is 0x21 */
int tag; /* tag from last 'get object' */ int tag; /* tag from last 'get object' */
int xclass; /* class from last 'get object' */ int xclass; /* class from last 'get object' */
size_t slen; /* length of last 'get object' */ long slen; /* length of last 'get object' */
const unsigned char *max; /* largest value of p allowed */ const unsigned char *max; /* largest value of p allowed */
const unsigned char *q;/* temporary variable */ const unsigned char *q;/* temporary variable */
const unsigned char **pp;/* variable */ const unsigned char **pp;/* variable */
@ -212,7 +212,7 @@ typedef struct asn1_object_st
{ {
const char *sn,*ln; const char *sn,*ln;
int nid; int nid;
size_t length; int length;
const unsigned char *data; /* data remains const after init */ const unsigned char *data; /* data remains const after init */
int flags; /* Should we free this one */ int flags; /* Should we free this one */
} ASN1_OBJECT; } ASN1_OBJECT;
@ -233,7 +233,7 @@ typedef struct asn1_object_st
/* This is the base type that holds just about everything :-) */ /* This is the base type that holds just about everything :-) */
typedef struct asn1_string_st typedef struct asn1_string_st
{ {
size_t length; int length;
int type; int type;
unsigned char *data; unsigned char *data;
/* The value of the following field depends on the type being /* The value of the following field depends on the type being
@ -251,7 +251,7 @@ typedef struct asn1_string_st
typedef struct ASN1_ENCODING_st typedef struct ASN1_ENCODING_st
{ {
unsigned char *enc; /* DER encoding */ unsigned char *enc; /* DER encoding */
size_t len; /* Length of encoding */ long len; /* Length of encoding */
int modified; /* set to 1 if 'enc' is invalid */ int modified; /* set to 1 if 'enc' is invalid */
} ASN1_ENCODING; } ASN1_ENCODING;
@ -310,12 +310,12 @@ typedef struct ASN1_VALUE_st ASN1_VALUE;
DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name)
#define DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \ #define DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \
type *d2i_##name(type **a, const unsigned char **in, size_t len); \ type *d2i_##name(type **a, const unsigned char **in, long len); \
int i2d_##name(type *a, unsigned char **out); \ int i2d_##name(type *a, unsigned char **out); \
DECLARE_ASN1_ITEM(itname) DECLARE_ASN1_ITEM(itname)
#define DECLARE_ASN1_ENCODE_FUNCTIONS_const(type, name) \ #define DECLARE_ASN1_ENCODE_FUNCTIONS_const(type, name) \
type *d2i_##name(type **a, const unsigned char **in, size_t len); \ type *d2i_##name(type **a, const unsigned char **in, long len); \
int i2d_##name(const type *a, unsigned char **out); \ int i2d_##name(const type *a, unsigned char **out); \
DECLARE_ASN1_ITEM(name) DECLARE_ASN1_ITEM(name)
@ -337,7 +337,7 @@ typedef struct ASN1_VALUE_st ASN1_VALUE;
int fname##_print_ctx(BIO *out, stname *x, int indent, \ int fname##_print_ctx(BIO *out, stname *x, int indent, \
const ASN1_PCTX *pctx); const ASN1_PCTX *pctx);
#define D2I_OF(type) type *(*)(type **,const unsigned char **,size_t) #define D2I_OF(type) type *(*)(type **,const unsigned char **,long)
#define I2D_OF(type) int (*)(type *,unsigned char **) #define I2D_OF(type) int (*)(type *,unsigned char **)
#define I2D_OF_const(type) int (*)(const type *,unsigned char **) #define I2D_OF_const(type) int (*)(const type *,unsigned char **)
@ -352,7 +352,7 @@ typedef struct ASN1_VALUE_st ASN1_VALUE;
#define CHECKED_PPTR_OF(type, p) \ #define CHECKED_PPTR_OF(type, p) \
((void**) (1 ? p : (type**)0)) ((void**) (1 ? p : (type**)0))
#define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const unsigned char **,size_t) #define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const unsigned char **,long)
#define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type(type *,unsigned char **) #define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type(type *,unsigned char **)
#define TYPEDEF_D2I2D_OF(type) TYPEDEF_D2I_OF(type); TYPEDEF_I2D_OF(type) #define TYPEDEF_D2I2D_OF(type) TYPEDEF_D2I_OF(type); TYPEDEF_I2D_OF(type)
@ -778,9 +778,9 @@ ASN1_OBJECT * ASN1_OBJECT_new(void );
void ASN1_OBJECT_free(ASN1_OBJECT *a); void ASN1_OBJECT_free(ASN1_OBJECT *a);
int i2d_ASN1_OBJECT(ASN1_OBJECT *a,unsigned char **pp); int i2d_ASN1_OBJECT(ASN1_OBJECT *a,unsigned char **pp);
ASN1_OBJECT * c2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp, ASN1_OBJECT * c2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp,
size_t length); long length);
ASN1_OBJECT * d2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp, ASN1_OBJECT * d2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp,
size_t length); long length);
DECLARE_ASN1_ITEM(ASN1_OBJECT) DECLARE_ASN1_ITEM(ASN1_OBJECT)
@ -795,24 +795,23 @@ ASN1_STRING * ASN1_STRING_type_new(int type );
int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b); int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b);
/* Since this is used to store all sorts of things, via macros, for now, make /* Since this is used to store all sorts of things, via macros, for now, make
its data void * */ its data void * */
int ASN1_STRING_set(ASN1_STRING *str, const void *data, size_t len); int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len);
void ASN1_STRING_set0(ASN1_STRING *str, void *data, size_t len); void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len);
size_t ASN1_STRING_length(const ASN1_STRING *x); int ASN1_STRING_length(const ASN1_STRING *x);
void ASN1_STRING_length_set(ASN1_STRING *x, size_t n); void ASN1_STRING_length_set(ASN1_STRING *x, int n);
int ASN1_STRING_type(ASN1_STRING *x); int ASN1_STRING_type(ASN1_STRING *x);
unsigned char * ASN1_STRING_data(ASN1_STRING *x); unsigned char * ASN1_STRING_data(ASN1_STRING *x);
DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING) DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING)
int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a,unsigned char **pp); int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a,unsigned char **pp);
ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,const unsigned char **pp,
const unsigned char **pp, size_t length); long length);
int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d, int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d,
size_t length); int length );
int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, size_t n, int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value);
int value); int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n);
int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, size_t n);
int ASN1_BIT_STRING_check(ASN1_BIT_STRING *a, int ASN1_BIT_STRING_check(ASN1_BIT_STRING *a,
unsigned char *flags, size_t flags_len); unsigned char *flags, int flags_len);
#ifndef OPENSSL_NO_BIO #ifndef OPENSSL_NO_BIO
int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs, int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs,
@ -823,14 +822,14 @@ int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, char *name, int value,
BIT_STRING_BITNAME *tbl); BIT_STRING_BITNAME *tbl);
int i2d_ASN1_BOOLEAN(int a,unsigned char **pp); int i2d_ASN1_BOOLEAN(int a,unsigned char **pp);
int d2i_ASN1_BOOLEAN(int *a, const unsigned char **pp, size_t length); int d2i_ASN1_BOOLEAN(int *a,const unsigned char **pp,long length);
DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER) DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER)
int i2c_ASN1_INTEGER(ASN1_INTEGER *a,unsigned char **pp); int i2c_ASN1_INTEGER(ASN1_INTEGER *a,unsigned char **pp);
ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a,const unsigned char **pp, ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a,const unsigned char **pp,
size_t length); long length);
ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a,const unsigned char **pp, ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a,const unsigned char **pp,
size_t length); long length);
ASN1_INTEGER * ASN1_INTEGER_dup(const ASN1_INTEGER *x); ASN1_INTEGER * ASN1_INTEGER_dup(const ASN1_INTEGER *x);
int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y); int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y);
@ -855,8 +854,7 @@ int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str);
DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING) DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING)
ASN1_OCTET_STRING * ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *a); ASN1_OCTET_STRING * ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *a);
int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a, const ASN1_OCTET_STRING *b); int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a, const ASN1_OCTET_STRING *b);
int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data, int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data, int len);
size_t len);
DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING) DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING)
DECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING) DECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING)
@ -864,8 +862,8 @@ DECLARE_ASN1_FUNCTIONS(ASN1_UTF8STRING)
DECLARE_ASN1_FUNCTIONS(ASN1_NULL) DECLARE_ASN1_FUNCTIONS(ASN1_NULL)
DECLARE_ASN1_FUNCTIONS(ASN1_BMPSTRING) DECLARE_ASN1_FUNCTIONS(ASN1_BMPSTRING)
int UTF8_getc(const unsigned char *str, size_t len, unsigned long *val); int UTF8_getc(const unsigned char *str, int len, unsigned long *val);
int UTF8_putc(unsigned char *str, size_t len, unsigned long value); int UTF8_putc(unsigned char *str, int len, unsigned long value);
DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, ASN1_PRINTABLE) DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, ASN1_PRINTABLE)
@ -887,11 +885,11 @@ ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s,time_t t,
int ASN1_TIME_check(ASN1_TIME *t); int ASN1_TIME_check(ASN1_TIME *t);
ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out); ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out);
size_t i2d_ASN1_SET(STACK_OF(BLOCK) *a, unsigned char **pp, int i2d_ASN1_SET(STACK_OF(BLOCK) *a, unsigned char **pp,
i2d_of_void *i2d, int ex_tag, int ex_class, i2d_of_void *i2d, int ex_tag, int ex_class,
int is_set); int is_set);
STACK_OF(BLOCK) *d2i_ASN1_SET(STACK_OF(BLOCK) **a, const unsigned char **pp, STACK_OF(BLOCK) *d2i_ASN1_SET(STACK_OF(BLOCK) **a, const unsigned char **pp,
size_t length, d2i_of_void *d2i, long length, d2i_of_void *d2i,
void (*free_func)(BLOCK), int ex_tag, void (*free_func)(BLOCK), int ex_tag,
int ex_class); int ex_class);
@ -904,11 +902,10 @@ int i2a_ASN1_OBJECT(BIO *bp,ASN1_OBJECT *a);
int a2i_ASN1_STRING(BIO *bp,ASN1_STRING *bs,char *buf,int size); int a2i_ASN1_STRING(BIO *bp,ASN1_STRING *bs,char *buf,int size);
int i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type); int i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type);
#endif #endif
int i2t_ASN1_OBJECT(char *buf,size_t buf_len,ASN1_OBJECT *a); int i2t_ASN1_OBJECT(char *buf,int buf_len,ASN1_OBJECT *a);
size_t a2d_ASN1_OBJECT(unsigned char *out, size_t olen, const char *buf, int a2d_ASN1_OBJECT(unsigned char *out,int olen, const char *buf, int num);
int num); ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data,int len,
ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, size_t len,
const char *sn, const char *ln); const char *sn, const char *ln);
int ASN1_INTEGER_set(ASN1_INTEGER *a, long v); int ASN1_INTEGER_set(ASN1_INTEGER *a, long v);
@ -923,29 +920,29 @@ BIGNUM *ASN1_ENUMERATED_to_BN(ASN1_ENUMERATED *ai,BIGNUM *bn);
/* General */ /* General */
/* given a string, return the correct type, max is the maximum length */ /* given a string, return the correct type, max is the maximum length */
int ASN1_PRINTABLE_type(const unsigned char *s, size_t max); int ASN1_PRINTABLE_type(const unsigned char *s, int max);
int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass); int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass);
ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp, ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp,
size_t length, int Ptag, int Pclass); long length, int Ptag, int Pclass);
unsigned long ASN1_tag2bit(int tag); unsigned long ASN1_tag2bit(int tag);
/* type is one or more of the B_ASN1_ values. */ /* type is one or more of the B_ASN1_ values. */
ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a,const unsigned char **pp, ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a,const unsigned char **pp,
size_t length,int type); long length,int type);
/* PARSING */ /* PARSING */
int asn1_Finish(ASN1_CTX *c); int asn1_Finish(ASN1_CTX *c);
int asn1_const_Finish(ASN1_const_CTX *c); int asn1_const_Finish(ASN1_const_CTX *c);
/* SPECIALS */ /* SPECIALS */
int ASN1_get_object(const unsigned char **pp, size_t *plength, int *ptag, int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag,
int *pclass, size_t omax); int *pclass, long omax);
int ASN1_check_infinite_end(unsigned char **p, size_t len); int ASN1_check_infinite_end(unsigned char **p,long len);
int ASN1_const_check_infinite_end(const unsigned char **p, size_t len); int ASN1_const_check_infinite_end(const unsigned char **p,long len);
void ASN1_put_object(unsigned char **pp, int constructed, size_t length, void ASN1_put_object(unsigned char **pp, int constructed, int length,
int tag, int xclass); int tag, int xclass);
int ASN1_put_eoc(unsigned char **pp); int ASN1_put_eoc(unsigned char **pp);
size_t ASN1_object_size(int constructed, size_t length, int tag); int ASN1_object_size(int constructed, int length, int tag);
/* Used to implement other functions */ /* Used to implement other functions */
void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, char *x); void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, char *x);
@ -1026,9 +1023,8 @@ int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v);
int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags); int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags);
int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num, int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num,
unsigned char *buf, int off); unsigned char *buf, int off);
int ASN1_parse(BIO *bp, const unsigned char *pp, size_t len, int indent); int ASN1_parse(BIO *bp,const unsigned char *pp,long len,int indent);
int ASN1_parse_dump(BIO *bp, const unsigned char *pp, size_t len, int indent, int ASN1_parse_dump(BIO *bp,const unsigned char *pp,long len,int indent,int dump);
int dump);
#endif #endif
const char *ASN1_tag2str(int tag); const char *ASN1_tag2str(int tag);
@ -1039,18 +1035,18 @@ DECLARE_ASN1_FUNCTIONS(NETSCAPE_X509)
int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s); int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s);
int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, int ASN1_TYPE_set_octetstring(ASN1_TYPE *a,
unsigned char *data, size_t len); unsigned char *data, int len);
int ASN1_TYPE_get_octetstring(ASN1_TYPE *a, int ASN1_TYPE_get_octetstring(ASN1_TYPE *a,
unsigned char *data, size_t max_len); unsigned char *data, int max_len);
int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num,
unsigned char *data, size_t len); unsigned char *data, int len);
int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a,long *num, int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a,long *num,
unsigned char *data, size_t max_len); unsigned char *data, int max_len);
STACK_OF(BLOCK) *ASN1_seq_unpack(const unsigned char *buf, size_t len, STACK_OF(BLOCK) *ASN1_seq_unpack(const unsigned char *buf, int len,
d2i_of_void *d2i, void (*free_func)(BLOCK)); d2i_of_void *d2i, void (*free_func)(BLOCK));
unsigned char *ASN1_seq_pack(STACK_OF(BLOCK) *safes, i2d_of_void *i2d, unsigned char *ASN1_seq_pack(STACK_OF(BLOCK) *safes, i2d_of_void *i2d,
unsigned char **buf, size_t *len); unsigned char **buf, int *len );
void *ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i); void *ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i);
void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it); void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it);
ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d, ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d,
@ -1066,15 +1062,14 @@ ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_OCTET_STRING **
void ASN1_STRING_set_default_mask(unsigned long mask); void ASN1_STRING_set_default_mask(unsigned long mask);
int ASN1_STRING_set_default_mask_asc(char *p); int ASN1_STRING_set_default_mask_asc(char *p);
unsigned long ASN1_STRING_get_default_mask(void); unsigned long ASN1_STRING_get_default_mask(void);
int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, size_t len, int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len,
int inform, unsigned long mask); int inform, unsigned long mask);
int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, size_t len, int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
int inform, unsigned long mask, int inform, unsigned long mask,
size_t minsize, size_t maxsize); long minsize, long maxsize);
ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out,
const unsigned char *in, size_t inlen, const unsigned char *in, int inlen, int inform, int nid);
int inform, int nid);
ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid); ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid);
int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long); int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long);
void ASN1_STRING_TABLE_cleanup(void); void ASN1_STRING_TABLE_cleanup(void);
@ -1084,11 +1079,9 @@ void ASN1_STRING_TABLE_cleanup(void);
/* Old API compatible functions */ /* Old API compatible functions */
ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it); ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it);
void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it); void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it);
ASN1_VALUE * ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in, ASN1_VALUE * ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in, long len, const ASN1_ITEM *it);
size_t len, const ASN1_ITEM *it);
int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it); int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);
int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out, int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);
const ASN1_ITEM *it);
void ASN1_add_oid_module(void); void ASN1_add_oid_module(void);

View File

@ -145,7 +145,7 @@ ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf)
unsigned char *p; unsigned char *p;
const unsigned char *cp; const unsigned char *cp;
int cpy_len; int cpy_len;
size_t hdr_len; long hdr_len;
int hdr_constructed = 0, hdr_tag, hdr_class; int hdr_constructed = 0, hdr_tag, hdr_class;
int r; int r;

View File

@ -62,8 +62,7 @@
#include <openssl/asn1.h> #include <openssl/asn1.h>
#include <openssl/asn1_mac.h> #include <openssl/asn1_mac.h>
static int asn1_get_length(const unsigned char **pp, int *inf, size_t *rl, static int asn1_get_length(const unsigned char **pp,int *inf,long *rl,int max);
size_t max);
static void asn1_put_length(unsigned char **pp, int length); static void asn1_put_length(unsigned char **pp, int length);
const char ASN1_version[]="ASN.1" OPENSSL_VERSION_PTEXT; const char ASN1_version[]="ASN.1" OPENSSL_VERSION_PTEXT;
@ -81,29 +80,27 @@ static int _asn1_check_infinite_end(const unsigned char **p, long len)
return(0); return(0);
} }
int ASN1_check_infinite_end(unsigned char **p, size_t len) int ASN1_check_infinite_end(unsigned char **p, long len)
{ {
return _asn1_check_infinite_end((const unsigned char **)p, len); return _asn1_check_infinite_end((const unsigned char **)p, len);
} }
int ASN1_const_check_infinite_end(const unsigned char **p, size_t len) int ASN1_const_check_infinite_end(const unsigned char **p, long len)
{ {
return _asn1_check_infinite_end(p, len); return _asn1_check_infinite_end(p, len);
} }
int ASN1_get_object(const unsigned char **pp, size_t *plength, int *ptag, int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag,
int *pclass, size_t omax) int *pclass, long omax)
{ {
int i,ret; int i,ret;
long l; long l;
const unsigned char *p= *pp; const unsigned char *p= *pp;
int tag,xclass,inf; int tag,xclass,inf;
size_t max=omax; long max=omax;
if (!max)
goto err;
if (!max) goto err;
ret=(*p&V_ASN1_CONSTRUCTED); ret=(*p&V_ASN1_CONSTRUCTED);
xclass=(*p&V_ASN1_PRIVATE); xclass=(*p&V_ASN1_PRIVATE);
i= *p&V_ASN1_PRIMITIVE_TAG; i= *p&V_ASN1_PRIMITIVE_TAG;
@ -154,8 +151,7 @@ err:
return(0x80); return(0x80);
} }
static int asn1_get_length(const unsigned char **pp, int *inf, size_t *rl, static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, int max)
size_t max)
{ {
const unsigned char *p= *pp; const unsigned char *p= *pp;
unsigned long ret=0; unsigned long ret=0;
@ -196,8 +192,8 @@ static int asn1_get_length(const unsigned char **pp, int *inf, size_t *rl,
/* class 0 is constructed /* class 0 is constructed
* constructed == 2 for indefinite length constructed */ * constructed == 2 for indefinite length constructed */
void ASN1_put_object(unsigned char **pp, int constructed, size_t length, void ASN1_put_object(unsigned char **pp, int constructed, int length, int tag,
int tag, int xclass) int xclass)
{ {
unsigned char *p= *pp; unsigned char *p= *pp;
int i, ttag; int i, ttag;
@ -258,7 +254,7 @@ static void asn1_put_length(unsigned char **pp, int length)
*pp=p; *pp=p;
} }
size_t ASN1_object_size(int constructed, size_t length, int tag) int ASN1_object_size(int constructed, int length, int tag)
{ {
int ret; int ret;
@ -315,7 +311,7 @@ int asn1_const_Finish(ASN1_const_CTX *c)
return _asn1_Finish(c); return _asn1_Finish(c);
} }
int asn1_GetSequence(ASN1_const_CTX *c, size_t *length) int asn1_GetSequence(ASN1_const_CTX *c, long *length)
{ {
const unsigned char *q; const unsigned char *q;
@ -371,7 +367,7 @@ ASN1_STRING *ASN1_STRING_dup(const ASN1_STRING *str)
return ret; return ret;
} }
int ASN1_STRING_set(ASN1_STRING *str, const void *_data, size_t len) int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len)
{ {
unsigned char *c; unsigned char *c;
const char *data=_data; const char *data=_data;
@ -408,7 +404,7 @@ int ASN1_STRING_set(ASN1_STRING *str, const void *_data, size_t len)
return(1); return(1);
} }
void ASN1_STRING_set0(ASN1_STRING *str, void *data, size_t len) void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len)
{ {
if (str->data) if (str->data)
OPENSSL_free(str->data); OPENSSL_free(str->data);
@ -473,10 +469,10 @@ void asn1_add_error(const unsigned char *address, int offset)
ERR_add_error_data(4,"address=",buf1," offset=",buf2); ERR_add_error_data(4,"address=",buf1," offset=",buf2);
} }
size_t ASN1_STRING_length(const ASN1_STRING *x) int ASN1_STRING_length(const ASN1_STRING *x)
{ return M_ASN1_STRING_length(x); } { return M_ASN1_STRING_length(x); }
void ASN1_STRING_length_set(ASN1_STRING *x, size_t len) void ASN1_STRING_length_set(ASN1_STRING *x, int len)
{ M_ASN1_STRING_length_set(x, len); return; } { M_ASN1_STRING_length_set(x, len); return; }
int ASN1_STRING_type(ASN1_STRING *x) int ASN1_STRING_type(ASN1_STRING *x)

View File

@ -95,7 +95,7 @@ struct evp_pkey_asn1_method_st
int (*pkey_bits)(const EVP_PKEY *pk); int (*pkey_bits)(const EVP_PKEY *pk);
int (*param_decode)(EVP_PKEY *pkey, int (*param_decode)(EVP_PKEY *pkey,
const unsigned char **pder, size_t derlen); const unsigned char **pder, int derlen);
int (*param_encode)(const EVP_PKEY *pkey, unsigned char **pder); int (*param_encode)(const EVP_PKEY *pkey, unsigned char **pder);
int (*param_missing)(const EVP_PKEY *pk); int (*param_missing)(const EVP_PKEY *pk);
int (*param_copy)(EVP_PKEY *to, const EVP_PKEY *from); int (*param_copy)(EVP_PKEY *to, const EVP_PKEY *from);
@ -109,7 +109,7 @@ struct evp_pkey_asn1_method_st
/* Legacy functions for old PEM */ /* Legacy functions for old PEM */
int (*old_priv_decode)(EVP_PKEY *pkey, int (*old_priv_decode)(EVP_PKEY *pkey,
const unsigned char **pder, size_t derlen); const unsigned char **pder, int derlen);
int (*old_priv_encode)(const EVP_PKEY *pkey, unsigned char **pder); int (*old_priv_encode)(const EVP_PKEY *pkey, unsigned char **pder);
} /* EVP_PKEY_ASN1_METHOD */; } /* EVP_PKEY_ASN1_METHOD */;

View File

@ -279,7 +279,7 @@ err:\
(V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \ (V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \
{ \ { \
int Tinf,Ttag,Tclass; \ int Tinf,Ttag,Tclass; \
size_t Tlen; \ long Tlen; \
\ \
c.q=c.p; \ c.q=c.p; \
Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \ Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \
@ -569,7 +569,7 @@ err:\
#define M_ASN1_I2D_finish() *pp=p; \ #define M_ASN1_I2D_finish() *pp=p; \
return(r); return(r);
int asn1_GetSequence(ASN1_const_CTX *c, size_t *length); int asn1_GetSequence(ASN1_const_CTX *c, long *length);
void asn1_add_error(const unsigned char *address,int offset); void asn1_add_error(const unsigned char *address,int offset);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -64,7 +64,7 @@
static int asn1_print_info(BIO *bp, int tag, int xclass,int constructed, static int asn1_print_info(BIO *bp, int tag, int xclass,int constructed,
int indent); int indent);
static int asn1_parse2(BIO *bp, const unsigned char **pp, size_t length, static int asn1_parse2(BIO *bp, const unsigned char **pp, long length,
int offset, int depth, int indent, int dump); int offset, int depth, int indent, int dump);
static int asn1_print_info(BIO *bp, int tag, int xclass, int constructed, static int asn1_print_info(BIO *bp, int tag, int xclass, int constructed,
int indent) int indent)
@ -99,22 +99,21 @@ err:
return(0); return(0);
} }
int ASN1_parse(BIO *bp, const unsigned char *pp, size_t len, int indent) int ASN1_parse(BIO *bp, const unsigned char *pp, long len, int indent)
{ {
return(asn1_parse2(bp,&pp,len,0,0,indent,0)); return(asn1_parse2(bp,&pp,len,0,0,indent,0));
} }
int ASN1_parse_dump(BIO *bp, const unsigned char *pp, size_t len, int indent, int ASN1_parse_dump(BIO *bp, const unsigned char *pp, long len, int indent, int dump)
int dump)
{ {
return(asn1_parse2(bp,&pp,len,0,0,indent,dump)); return(asn1_parse2(bp,&pp,len,0,0,indent,dump));
} }
static int asn1_parse2(BIO *bp, const unsigned char **pp, size_t length, static int asn1_parse2(BIO *bp, const unsigned char **pp, long length, int offset,
int offset, int depth, int indent, int dump) int depth, int indent, int dump)
{ {
const unsigned char *p,*ep,*tot,*op,*opp; const unsigned char *p,*ep,*tot,*op,*opp;
size_t len; long len;
int tag,xclass,ret=0; int tag,xclass,ret=0;
int nl,hl,j,r; int nl,hl,j,r;
ASN1_OBJECT *o=NULL; ASN1_OBJECT *o=NULL;
@ -153,7 +152,7 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, size_t length,
if (j != (V_ASN1_CONSTRUCTED | 1)) if (j != (V_ASN1_CONSTRUCTED | 1))
{ {
if (BIO_printf(bp,"d=%-2d hl=%ld l=%4ld ", if (BIO_printf(bp,"d=%-2d hl=%ld l=%4ld ",
depth,(long)hl,(long)len) <= 0) depth,(long)hl,len) <= 0)
goto end; goto end;
} }
else else
@ -171,8 +170,7 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, size_t length,
if (len > length) if (len > length)
{ {
BIO_printf(bp, BIO_printf(bp,
"length is greater than %ld\n", "length is greater than %ld\n",length);
(long)length);
ret=0; ret=0;
goto end; goto end;
} }

View File

@ -856,7 +856,7 @@ typedef struct ASN1_STREAM_ARG_st {
IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname)
#define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \ #define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \
stname *d2i_##fname(stname **a, const unsigned char **in, size_t len) \ stname *d2i_##fname(stname **a, const unsigned char **in, long len) \
{ \ { \
return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\ return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
} \ } \
@ -875,7 +875,7 @@ typedef struct ASN1_STREAM_ARG_st {
* ASN1 constification is done. * ASN1 constification is done.
*/ */
#define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \ #define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \
stname *d2i_##fname(stname **a, const unsigned char **in, size_t len) \ stname *d2i_##fname(stname **a, const unsigned char **in, long len) \
{ \ { \
return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\ return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
} \ } \

View File

@ -66,7 +66,7 @@
/* Turn an ASN1 encoded SEQUENCE OF into a STACK of structures */ /* Turn an ASN1 encoded SEQUENCE OF into a STACK of structures */
STACK_OF(BLOCK) *ASN1_seq_unpack(const unsigned char *buf, size_t len, STACK_OF(BLOCK) *ASN1_seq_unpack(const unsigned char *buf, int len,
d2i_of_void *d2i, void (*free_func)(BLOCK)) d2i_of_void *d2i, void (*free_func)(BLOCK))
{ {
STACK_OF(BLOCK) *sk; STACK_OF(BLOCK) *sk;
@ -83,7 +83,7 @@ STACK_OF(BLOCK) *ASN1_seq_unpack(const unsigned char *buf, size_t len,
*/ */
unsigned char *ASN1_seq_pack(STACK_OF(BLOCK) *safes, i2d_of_void *i2d, unsigned char *ASN1_seq_pack(STACK_OF(BLOCK) *safes, i2d_of_void *i2d,
unsigned char **buf, size_t *len) unsigned char **buf, int *len)
{ {
int safelen; int safelen;
unsigned char *safe, *p; unsigned char *safe, *p;

View File

@ -128,7 +128,7 @@ err:
/* This works like d2i_PrivateKey() except it automatically works out the type */ /* This works like d2i_PrivateKey() except it automatically works out the type */
EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp, EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp,
size_t length) long length)
{ {
STACK_OF(ASN1_TYPE) *inkey; STACK_OF(ASN1_TYPE) *inkey;
const unsigned char *p; const unsigned char *p;

View File

@ -73,7 +73,7 @@
#endif #endif
EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp, EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp,
size_t length) long length)
{ {
EVP_PKEY *ret; EVP_PKEY *ret;

View File

@ -61,7 +61,7 @@
#include <openssl/asn1.h> #include <openssl/asn1.h>
#include <openssl/asn1_mac.h> #include <openssl/asn1_mac.h>
int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, size_t len) int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, int len)
{ {
ASN1_STRING *os; ASN1_STRING *os;
@ -73,7 +73,7 @@ int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, size_t len)
/* int max_len: for returned value */ /* int max_len: for returned value */
int ASN1_TYPE_get_octetstring(ASN1_TYPE *a, unsigned char *data, int ASN1_TYPE_get_octetstring(ASN1_TYPE *a, unsigned char *data,
size_t max_len) int max_len)
{ {
int ret,num; int ret,num;
unsigned char *p; unsigned char *p;
@ -94,7 +94,7 @@ int ASN1_TYPE_get_octetstring(ASN1_TYPE *a, unsigned char *data,
} }
int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, unsigned char *data, int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, unsigned char *data,
size_t len) int len)
{ {
int n,size; int n,size;
ASN1_OCTET_STRING os,*osp; ASN1_OCTET_STRING os,*osp;
@ -136,13 +136,13 @@ int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, unsigned char *data,
* case, set it to zero */ * case, set it to zero */
/* int max_len: for returned value */ /* int max_len: for returned value */
int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a, long *num, unsigned char *data, int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a, long *num, unsigned char *data,
size_t max_len) int max_len)
{ {
int ret= -1,n; int ret= -1,n;
ASN1_INTEGER *ai=NULL; ASN1_INTEGER *ai=NULL;
ASN1_OCTET_STRING *os=NULL; ASN1_OCTET_STRING *os=NULL;
const unsigned char *p; const unsigned char *p;
size_t length; long length;
ASN1_const_CTX c; ASN1_const_CTX c;
if ((a->type != V_ASN1_SEQUENCE) || (a->value.sequence == NULL)) if ((a->type != V_ASN1_SEQUENCE) || (a->value.sequence == NULL))

View File

@ -126,8 +126,7 @@ unsigned long ASN1_tag2bit(int tag)
*/ */
ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval, ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval,
const unsigned char **in, size_t len, const unsigned char **in, long len, const ASN1_ITEM *it)
const ASN1_ITEM *it)
{ {
ASN1_TLC c; ASN1_TLC c;
ASN1_VALUE *ptmpval = NULL; ASN1_VALUE *ptmpval = NULL;
@ -1244,7 +1243,7 @@ static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass,
{ {
int i; int i;
int ptag, pclass; int ptag, pclass;
size_t plen; long plen;
const unsigned char *p, *q; const unsigned char *p, *q;
p = *in; p = *in;
q = p; q = p;

View File

@ -69,7 +69,7 @@ int i2d_X509_PKEY(X509_PKEY *a, unsigned char **pp)
return(0); return(0);
} }
X509_PKEY *d2i_X509_PKEY(X509_PKEY **a, const unsigned char **pp, size_t length) X509_PKEY *d2i_X509_PKEY(X509_PKEY **a, const unsigned char **pp, long length)
{ {
int i; int i;
M_ASN1_D2I_vars(a,X509_PKEY *,X509_PKEY_new); M_ASN1_D2I_vars(a,X509_PKEY *,X509_PKEY_new);

View File

@ -187,7 +187,7 @@ EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
*/ */
EVP_PKEY *d2i_PUBKEY(EVP_PKEY **a, const unsigned char **pp, EVP_PKEY *d2i_PUBKEY(EVP_PKEY **a, const unsigned char **pp,
size_t length) long length)
{ {
X509_PUBKEY *xpk; X509_PUBKEY *xpk;
EVP_PKEY *pktmp; EVP_PKEY *pktmp;
@ -220,7 +220,7 @@ int i2d_PUBKEY(EVP_PKEY *a, unsigned char **pp)
*/ */
#ifndef OPENSSL_NO_RSA #ifndef OPENSSL_NO_RSA
RSA *d2i_RSA_PUBKEY(RSA **a, const unsigned char **pp, RSA *d2i_RSA_PUBKEY(RSA **a, const unsigned char **pp,
size_t length) long length)
{ {
EVP_PKEY *pkey; EVP_PKEY *pkey;
RSA *key; RSA *key;
@ -260,7 +260,7 @@ int i2d_RSA_PUBKEY(RSA *a, unsigned char **pp)
#ifndef OPENSSL_NO_DSA #ifndef OPENSSL_NO_DSA
DSA *d2i_DSA_PUBKEY(DSA **a, const unsigned char **pp, DSA *d2i_DSA_PUBKEY(DSA **a, const unsigned char **pp,
size_t length) long length)
{ {
EVP_PKEY *pkey; EVP_PKEY *pkey;
DSA *key; DSA *key;
@ -299,7 +299,7 @@ int i2d_DSA_PUBKEY(DSA *a, unsigned char **pp)
#endif #endif
#ifndef OPENSSL_NO_EC #ifndef OPENSSL_NO_EC
EC_KEY *d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp, size_t length) EC_KEY *d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp, long length)
{ {
EVP_PKEY *pkey; EVP_PKEY *pkey;
EC_KEY *key; EC_KEY *key;

View File

@ -62,7 +62,7 @@
#include "bf_locl.h" #include "bf_locl.h"
#include "bf_pi.h" #include "bf_pi.h"
void BF_set_key(BF_KEY *key, size_t len, const unsigned char *data) void BF_set_key(BF_KEY *key, int len, const unsigned char *data)
{ {
int i; int i;
BF_LONG *p,ri,in[2]; BF_LONG *p,ri,in[2];

View File

@ -60,7 +60,6 @@
#define HEADER_BLOWFISH_H #define HEADER_BLOWFISH_H
#include <openssl/e_os2.h> #include <openssl/e_os2.h>
#include <unistd.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -106,7 +105,7 @@ typedef struct bf_key_st
} BF_KEY; } BF_KEY;
void BF_set_key(BF_KEY *key, size_t len, const unsigned char *data); void BF_set_key(BF_KEY *key, int len, const unsigned char *data);
void BF_encrypt(BF_LONG *data,const BF_KEY *key); void BF_encrypt(BF_LONG *data,const BF_KEY *key);
void BF_decrypt(BF_LONG *data,const BF_KEY *key); void BF_decrypt(BF_LONG *data,const BF_KEY *key);

View File

@ -252,11 +252,9 @@ void BIO_clear_flags(BIO *b, int flags);
#define BIO_cb_pre(a) (!((a)&BIO_CB_RETURN)) #define BIO_cb_pre(a) (!((a)&BIO_CB_RETURN))
#define BIO_cb_post(a) ((a)&BIO_CB_RETURN) #define BIO_cb_post(a) ((a)&BIO_CB_RETURN)
long (*BIO_get_callback(const BIO *b)) (struct bio_st *, int, const char *, long (*BIO_get_callback(const BIO *b)) (struct bio_st *,int,const char *,int, long,long);
size_t, long, long); void BIO_set_callback(BIO *b,
void BIO_set_callback(BIO *b, long (*callback)(struct bio_st *, int, long (*callback)(struct bio_st *,int,const char *,int, long,long));
const char *, size_t, long,
long));
char *BIO_get_callback_arg(const BIO *b); char *BIO_get_callback_arg(const BIO *b);
void BIO_set_callback_arg(BIO *b, char *arg); void BIO_set_callback_arg(BIO *b, char *arg);
@ -283,7 +281,7 @@ struct bio_st
{ {
BIO_METHOD *method; BIO_METHOD *method;
/* bio, mode, argp, argi, argl, ret */ /* bio, mode, argp, argi, argl, ret */
long (*callback)(struct bio_st *,int,const char *,size_t, long,long); long (*callback)(struct bio_st *,int,const char *,int, long,long);
char *cb_arg; /* first argument for the callback */ char *cb_arg; /* first argument for the callback */
int init; int init;
@ -573,7 +571,7 @@ int BIO_free(BIO *a);
void BIO_vfree(BIO *a); void BIO_vfree(BIO *a);
int BIO_read(BIO *b, void *data, int len); int BIO_read(BIO *b, void *data, int len);
int BIO_gets(BIO *bp,char *buf, int size); int BIO_gets(BIO *bp,char *buf, int size);
int BIO_write(BIO *b, const void *data, size_t len); int BIO_write(BIO *b, const void *data, int len);
int BIO_puts(BIO *bp,const char *buf); int BIO_puts(BIO *bp,const char *buf);
int BIO_indent(BIO *b,int indent,int max); int BIO_indent(BIO *b,int indent,int max);
long BIO_ctrl(BIO *bp,int cmd,long larg,void *parg); long BIO_ctrl(BIO *bp,int cmd,long larg,void *parg);
@ -594,7 +592,7 @@ int BIO_nread(BIO *bio, char **buf, int num);
int BIO_nwrite0(BIO *bio, char **buf); int BIO_nwrite0(BIO *bio, char **buf);
int BIO_nwrite(BIO *bio, char **buf, int num); int BIO_nwrite(BIO *bio, char **buf, int num);
long BIO_debug_callback(BIO *bio, int cmd, const char *argp, size_t argi, long BIO_debug_callback(BIO *bio,int cmd,const char *argp,int argi,
long argl,long ret); long argl,long ret);
BIO_METHOD *BIO_s_mem(void); BIO_METHOD *BIO_s_mem(void);

View File

@ -64,7 +64,7 @@
#include <openssl/err.h> #include <openssl/err.h>
long MS_CALLBACK BIO_debug_callback(BIO *bio, int cmd, const char *argp, long MS_CALLBACK BIO_debug_callback(BIO *bio, int cmd, const char *argp,
size_t argi, long argl, long ret) int argi, long argl, long ret)
{ {
BIO *b; BIO *b;
MS_STATIC char buf[256]; MS_STATIC char buf[256];

View File

@ -156,14 +156,12 @@ void BIO_set_flags(BIO *b, int flags)
b->flags |= flags; b->flags |= flags;
} }
long (*BIO_get_callback(const BIO *b))(struct bio_st *, int, const char *, long (*BIO_get_callback(const BIO *b))(struct bio_st *,int,const char *,int, long,long)
size_t, long, long)
{ {
return b->callback; return b->callback;
} }
void BIO_set_callback(BIO *b, long (*cb)(struct bio_st *, int, const char *, void BIO_set_callback(BIO *b, long (*cb)(struct bio_st *,int,const char *,int, long,long))
size_t, long, long))
{ {
b->callback = cb; b->callback = cb;
} }
@ -192,7 +190,7 @@ int BIO_method_type(const BIO *b)
int BIO_read(BIO *b, void *out, int outl) int BIO_read(BIO *b, void *out, int outl)
{ {
int i; int i;
long (*cb)(BIO *, int, const char *, size_t, long, long); long (*cb)(BIO *,int,const char *,int,long,long);
if ((b == NULL) || (b->method == NULL) || (b->method->bread == NULL)) if ((b == NULL) || (b->method == NULL) || (b->method->bread == NULL))
{ {
@ -221,10 +219,10 @@ int BIO_read(BIO *b, void *out, int outl)
return(i); return(i);
} }
int BIO_write(BIO *b, const void *in, size_t inl) int BIO_write(BIO *b, const void *in, int inl)
{ {
int i; int i;
long (*cb)(BIO *,int,const char *,size_t,long,long); long (*cb)(BIO *,int,const char *,int,long,long);
if (b == NULL) if (b == NULL)
return(0); return(0);
@ -237,7 +235,7 @@ int BIO_write(BIO *b, const void *in, size_t inl)
} }
if ((cb != NULL) && if ((cb != NULL) &&
((i=cb(b,BIO_CB_WRITE,in,inl,0L,1L)) <= 0)) ((i=(int)cb(b,BIO_CB_WRITE,in,inl,0L,1L)) <= 0))
return(i); return(i);
if (!b->init) if (!b->init)
@ -259,7 +257,7 @@ int BIO_write(BIO *b, const void *in, size_t inl)
int BIO_puts(BIO *b, const char *in) int BIO_puts(BIO *b, const char *in)
{ {
int i; int i;
long (*cb)(BIO *, int, const char *, size_t, long, long); long (*cb)(BIO *,int,const char *,int,long,long);
if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL))
{ {
@ -292,7 +290,7 @@ int BIO_puts(BIO *b, const char *in)
int BIO_gets(BIO *b, char *in, int inl) int BIO_gets(BIO *b, char *in, int inl)
{ {
int i; int i;
long (*cb)(BIO *, int, const char *, size_t, long, long); long (*cb)(BIO *,int,const char *,int,long,long);
if ((b == NULL) || (b->method == NULL) || (b->method->bgets == NULL)) if ((b == NULL) || (b->method == NULL) || (b->method->bgets == NULL))
{ {
@ -353,7 +351,7 @@ char *BIO_ptr_ctrl(BIO *b, int cmd, long larg)
long BIO_ctrl(BIO *b, int cmd, long larg, void *parg) long BIO_ctrl(BIO *b, int cmd, long larg, void *parg)
{ {
long ret; long ret;
long (*cb)(BIO *, int, const char *, size_t, long, long); long (*cb)(BIO *,int,const char *,int,long,long);
if (b == NULL) return(0); if (b == NULL) return(0);
@ -380,7 +378,7 @@ long BIO_ctrl(BIO *b, int cmd, long larg, void *parg)
long BIO_callback_ctrl(BIO *b, int cmd, void (*fp)(struct bio_st *, int, const char *, int, long, long)) long BIO_callback_ctrl(BIO *b, int cmd, void (*fp)(struct bio_st *, int, const char *, int, long, long))
{ {
long ret; long ret;
long (*cb)(BIO *, int, const char *, size_t, long, long); long (*cb)(BIO *,int,const char *,int,long,long);
if (b == NULL) return(0); if (b == NULL) return(0);

View File

@ -1,7 +1,6 @@
#ifdef __SUNPRO_C #ifdef __SUNPRO_C
# include "../bn_asm.c" /* kind of dirty hack for Sun Studio */ # include "../bn_asm.c" /* kind of dirty hack for Sun Studio */
#else #else
#include <stddef.h>
/* /*
* x86_64 BIGNUM accelerator version 0.1, December 2002. * x86_64 BIGNUM accelerator version 0.1, December 2002.
* *
@ -176,7 +175,7 @@ BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d)
return ret; return ret;
} }
BN_ULONG bn_add_words (BN_ULONG *rp, BN_ULONG *ap, BN_ULONG *bp, size_t n) BN_ULONG bn_add_words (BN_ULONG *rp, BN_ULONG *ap, BN_ULONG *bp,int n)
{ BN_ULONG ret=0,i=0; { BN_ULONG ret=0,i=0;
if (n <= 0) return 0; if (n <= 0) return 0;

View File

@ -300,9 +300,9 @@ typedef struct bn_gencb_st BN_GENCB;
struct bignum_st struct bignum_st
{ {
BN_ULONG *d; /* Pointer to an array of 'BN_BITS2' bit chunks. */ BN_ULONG *d; /* Pointer to an array of 'BN_BITS2' bit chunks. */
size_t top; /* Index of last used d +1. */ int top; /* Index of last used d +1. */
/* The next are internal book keeping for bn_expand. */ /* The next are internal book keeping for bn_expand. */
size_t dmax; /* Size of the d array. */ int dmax; /* Size of the d array. */
int neg; /* one if the number is negative */ int neg; /* one if the number is negative */
int flags; int flags;
}; };
@ -414,8 +414,8 @@ void BN_CTX_free(BN_CTX *c);
void BN_CTX_start(BN_CTX *ctx); void BN_CTX_start(BN_CTX *ctx);
BIGNUM *BN_CTX_get(BN_CTX *ctx); BIGNUM *BN_CTX_get(BN_CTX *ctx);
void BN_CTX_end(BN_CTX *ctx); void BN_CTX_end(BN_CTX *ctx);
int BN_rand(BIGNUM *rnd, size_t bits, int top,int bottom); int BN_rand(BIGNUM *rnd, int bits, int top,int bottom);
int BN_pseudo_rand(BIGNUM *rnd, size_t bits, int top,int bottom); int BN_pseudo_rand(BIGNUM *rnd, int bits, int top,int bottom);
int BN_rand_range(BIGNUM *rnd, const BIGNUM *range); int BN_rand_range(BIGNUM *rnd, const BIGNUM *range);
int BN_pseudo_rand_range(BIGNUM *rnd, const BIGNUM *range); int BN_pseudo_rand_range(BIGNUM *rnd, const BIGNUM *range);
int BN_num_bits(const BIGNUM *a); int BN_num_bits(const BIGNUM *a);
@ -425,9 +425,9 @@ void BN_init(BIGNUM *);
void BN_clear_free(BIGNUM *a); void BN_clear_free(BIGNUM *a);
BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b); BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b);
void BN_swap(BIGNUM *a, BIGNUM *b); void BN_swap(BIGNUM *a, BIGNUM *b);
BIGNUM *BN_bin2bn(const unsigned char *s, size_t len, BIGNUM *ret); BIGNUM *BN_bin2bn(const unsigned char *s,int len,BIGNUM *ret);
int BN_bn2bin(const BIGNUM *a, unsigned char *to); int BN_bn2bin(const BIGNUM *a, unsigned char *to);
BIGNUM *BN_mpi2bn(const unsigned char *s, size_t len, BIGNUM *ret); BIGNUM *BN_mpi2bn(const unsigned char *s,int len,BIGNUM *ret);
int BN_bn2mpi(const BIGNUM *a, unsigned char *to); int BN_bn2mpi(const BIGNUM *a, unsigned char *to);
int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
@ -466,8 +466,6 @@ BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w);
BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w); BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w);
int BN_mul_word(BIGNUM *a, BN_ULONG w); int BN_mul_word(BIGNUM *a, BN_ULONG w);
int BN_add_word(BIGNUM *a, BN_ULONG w); int BN_add_word(BIGNUM *a, BN_ULONG w);
/* Note that this will give an error if w is negative */
int BN_add_signed_word(BIGNUM *a, BN_LONG w);
int BN_sub_word(BIGNUM *a, BN_ULONG w); int BN_sub_word(BIGNUM *a, BN_ULONG w);
int BN_set_word(BIGNUM *a, BN_ULONG w); int BN_set_word(BIGNUM *a, BN_ULONG w);
BN_ULONG BN_get_word(const BIGNUM *a); BN_ULONG BN_get_word(const BIGNUM *a);
@ -502,7 +500,7 @@ int BN_print(BIO *fp, const BIGNUM *a);
#else #else
int BN_print(void *fp, const BIGNUM *a); int BN_print(void *fp, const BIGNUM *a);
#endif #endif
int BN_reciprocal(BIGNUM *r, const BIGNUM *m, size_t len, BN_CTX *ctx); int BN_reciprocal(BIGNUM *r, const BIGNUM *m, int len, BN_CTX *ctx);
int BN_rshift(BIGNUM *r, const BIGNUM *a, int n); int BN_rshift(BIGNUM *r, const BIGNUM *a, int n);
int BN_rshift1(BIGNUM *r, const BIGNUM *a); int BN_rshift1(BIGNUM *r, const BIGNUM *a);
void BN_clear(BIGNUM *a); void BN_clear(BIGNUM *a);
@ -666,9 +664,9 @@ const BIGNUM *BN_get0_nist_prime_521(void);
#define bn_expand(a,bits) ((((((bits+BN_BITS2-1))/BN_BITS2)) <= (a)->dmax)?\ #define bn_expand(a,bits) ((((((bits+BN_BITS2-1))/BN_BITS2)) <= (a)->dmax)?\
(a):bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2)) (a):bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2))
#define bn_wexpand(a,words) (((words) <= (a)->dmax)?(a):bn_expand2((a),(words))) #define bn_wexpand(a,words) (((words) <= (a)->dmax)?(a):bn_expand2((a),(words)))
BIGNUM *bn_expand2(BIGNUM *a, size_t words); BIGNUM *bn_expand2(BIGNUM *a, int words);
#ifndef OPENSSL_NO_DEPRECATED #ifndef OPENSSL_NO_DEPRECATED
BIGNUM *bn_dup_expand(const BIGNUM *a, size_t words); /* unused */ BIGNUM *bn_dup_expand(const BIGNUM *a, int words); /* unused */
#endif #endif
/* Bignum consistency macros /* Bignum consistency macros
@ -764,15 +762,12 @@ int RAND_pseudo_bytes(unsigned char *buf,int num);
bn_pollute(a); \ bn_pollute(a); \
} }
BN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, size_t num, BN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w);
BN_ULONG w); BN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w);
BN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, size_t num, BN_ULONG w); void bn_sqr_words(BN_ULONG *rp, const BN_ULONG *ap, int num);
void bn_sqr_words(BN_ULONG *rp, const BN_ULONG *ap, size_t num);
BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d); BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d);
BN_ULONG bn_add_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, BN_ULONG bn_add_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,int num);
size_t num); BN_ULONG bn_sub_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,int num);
BN_ULONG bn_sub_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,
size_t num);
/* Primes from RFC 2409 */ /* Primes from RFC 2409 */
BIGNUM *get_rfc2409_prime_768(BIGNUM *bn); BIGNUM *get_rfc2409_prime_768(BIGNUM *bn);
@ -786,7 +781,7 @@ BIGNUM *get_rfc3526_prime_4096(BIGNUM *bn);
BIGNUM *get_rfc3526_prime_6144(BIGNUM *bn); BIGNUM *get_rfc3526_prime_6144(BIGNUM *bn);
BIGNUM *get_rfc3526_prime_8192(BIGNUM *bn); BIGNUM *get_rfc3526_prime_8192(BIGNUM *bn);
int BN_bntest_rand(BIGNUM *rnd, size_t bits, int top, int bottom); int BN_bntest_rand(BIGNUM *rnd, int bits, int top,int bottom);
/* BEGIN ERROR CODES */ /* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes /* The following lines are auto generated by the script mkerr.pl. Any changes

View File

@ -104,7 +104,7 @@ int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
/* unsigned add of b to a */ /* unsigned add of b to a */
int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
{ {
size_t max,min,dif; int max,min,dif;
BN_ULONG *ap,*bp,*rp,carry,t1,t2; BN_ULONG *ap,*bp,*rp,carry,t1,t2;
const BIGNUM *tmp; const BIGNUM *tmp;
@ -165,7 +165,7 @@ int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
/* unsigned subtraction of b from a, a must be larger than b. */ /* unsigned subtraction of b from a, a must be larger than b. */
int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
{ {
size_t max,min,dif; int max,min,dif;
register BN_ULONG t1,t2,*ap,*bp,*rp; register BN_ULONG t1,t2,*ap,*bp,*rp;
int i,carry; int i,carry;
#if defined(IRIX_CC_BUG) && !defined(LINT) #if defined(IRIX_CC_BUG) && !defined(LINT)
@ -262,7 +262,7 @@ int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
{ {
size_t max; int max;
int add=0,neg=0; int add=0,neg=0;
const BIGNUM *tmp; const BIGNUM *tmp;

View File

@ -143,7 +143,7 @@ void bn_sqr_words(BN_ULONG *r, const BN_ULONG *a, size_t n)
#else /* !(defined(BN_LLONG) || defined(BN_UMULT_HIGH)) */ #else /* !(defined(BN_LLONG) || defined(BN_UMULT_HIGH)) */
BN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, size_t num, BN_ULONG w) BN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w)
{ {
BN_ULONG c=0; BN_ULONG c=0;
BN_ULONG bl,bh; BN_ULONG bl,bh;
@ -172,7 +172,7 @@ BN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, size_t num, BN_ULONG
return(c); return(c);
} }
BN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, size_t num, BN_ULONG w) BN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w)
{ {
BN_ULONG carry=0; BN_ULONG carry=0;
BN_ULONG bl,bh; BN_ULONG bl,bh;
@ -201,7 +201,7 @@ BN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, size_t num, BN_ULONG w)
return(carry); return(carry);
} }
void bn_sqr_words(BN_ULONG *r, const BN_ULONG *a, size_t n) void bn_sqr_words(BN_ULONG *r, const BN_ULONG *a, int n)
{ {
assert(n >= 0); assert(n >= 0);
if (n <= 0) return; if (n <= 0) return;
@ -338,7 +338,7 @@ BN_ULONG bn_add_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, size_t
return((BN_ULONG)ll); return((BN_ULONG)ll);
} }
#else /* !BN_LLONG */ #else /* !BN_LLONG */
BN_ULONG bn_add_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, size_t n) BN_ULONG bn_add_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n)
{ {
BN_ULONG c,l,t; BN_ULONG c,l,t;
@ -390,7 +390,7 @@ BN_ULONG bn_add_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, size_t
} }
#endif /* !BN_LLONG */ #endif /* !BN_LLONG */
BN_ULONG bn_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, size_t n) BN_ULONG bn_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n)
{ {
BN_ULONG t1,t2; BN_ULONG t1,t2;
int c=0; int c=0;

View File

@ -181,12 +181,11 @@ static int BN_div_no_branch(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num,
int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
BN_CTX *ctx) BN_CTX *ctx)
{ {
int norm_shift,i; int norm_shift,i,loop;
size_t loop;
BIGNUM *tmp,wnum,*snum,*sdiv,*res; BIGNUM *tmp,wnum,*snum,*sdiv,*res;
BN_ULONG *resp,*wnump; BN_ULONG *resp,*wnump;
BN_ULONG d0,d1; BN_ULONG d0,d1;
size_t num_n,div_n; int num_n,div_n;
/* Invalid zero-padding would have particularly bad consequences /* Invalid zero-padding would have particularly bad consequences
* in the case of 'num', so don't just rely on bn_check_top() for this one * in the case of 'num', so don't just rely on bn_check_top() for this one
@ -266,7 +265,7 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
resp= &(res->d[loop-1]); resp= &(res->d[loop-1]);
/* space for temp */ /* space for temp */
if (!bn_wexpand(tmp, div_n+1)) goto err; if (!bn_wexpand(tmp,(div_n+1))) goto err;
if (BN_ucmp(&wnum,sdiv) >= 0) if (BN_ucmp(&wnum,sdiv) >= 0)
{ {
@ -430,7 +429,7 @@ static int BN_div_no_branch(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num,
BIGNUM *tmp,wnum,*snum,*sdiv,*res; BIGNUM *tmp,wnum,*snum,*sdiv,*res;
BN_ULONG *resp,*wnump; BN_ULONG *resp,*wnump;
BN_ULONG d0,d1; BN_ULONG d0,d1;
size_t num_n,div_n; int num_n,div_n;
bn_check_top(dv); bn_check_top(dv);
bn_check_top(rm); bn_check_top(rm);
@ -499,12 +498,12 @@ static int BN_div_no_branch(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num,
/* Setup to 'res' */ /* Setup to 'res' */
res->neg= (num->neg^divisor->neg); res->neg= (num->neg^divisor->neg);
if (!bn_wexpand(res,loop+1U)) goto err; if (!bn_wexpand(res,(loop+1))) goto err;
res->top=loop-1; res->top=loop-1;
resp= &(res->d[loop-1]); resp= &(res->d[loop-1]);
/* space for temp */ /* space for temp */
if (!bn_wexpand(tmp,div_n+1U)) goto err; if (!bn_wexpand(tmp,(div_n+1))) goto err;
/* if res->top == 0 then clear the neg value otherwise decrease /* if res->top == 0 then clear the neg value otherwise decrease
* the resp pointer */ * the resp pointer */

View File

@ -521,8 +521,7 @@ err:
* as cache lines are concerned. The following functions are used to transfer a BIGNUM * as cache lines are concerned. The following functions are used to transfer a BIGNUM
* from/to that table. */ * from/to that table. */
static int MOD_EXP_CTIME_COPY_TO_PREBUF(BIGNUM *b, size_t top, static int MOD_EXP_CTIME_COPY_TO_PREBUF(BIGNUM *b, int top, unsigned char *buf, int idx, int width)
unsigned char *buf, int idx, int width)
{ {
size_t i, j; size_t i, j;
@ -542,9 +541,7 @@ static int MOD_EXP_CTIME_COPY_TO_PREBUF(BIGNUM *b, size_t top,
return 1; return 1;
} }
static int MOD_EXP_CTIME_COPY_FROM_PREBUF(BIGNUM *b, size_t top, static int MOD_EXP_CTIME_COPY_FROM_PREBUF(BIGNUM *b, int top, unsigned char *buf, int idx, int width)
unsigned char *buf, int idx,
int width)
{ {
size_t i, j; size_t i, j;
@ -575,14 +572,14 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
{ {
int i,bits,ret=0,idx,window,wvalue; int i,bits,ret=0,idx,window,wvalue;
size_t top; int top;
BIGNUM *r; BIGNUM *r;
const BIGNUM *aa; const BIGNUM *aa;
BN_MONT_CTX *mont=NULL; BN_MONT_CTX *mont=NULL;
int numPowers; int numPowers;
unsigned char *powerbufFree=NULL; unsigned char *powerbufFree=NULL;
size_t powerbufLen = 0; int powerbufLen = 0;
unsigned char *powerbuf=NULL; unsigned char *powerbuf=NULL;
BIGNUM *computeTemp=NULL, *am=NULL; BIGNUM *computeTemp=NULL, *am=NULL;
@ -628,7 +625,7 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
*/ */
numPowers = 1 << window; numPowers = 1 << window;
powerbufLen = sizeof(m->d[0])*top*numPowers; powerbufLen = sizeof(m->d[0])*top*numPowers;
if ((powerbufFree=OPENSSL_malloc(powerbufLen+MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH)) == NULL) if ((powerbufFree=(unsigned char*)OPENSSL_malloc(powerbufLen+MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH)) == NULL)
goto err; goto err;
powerbuf = MOD_EXP_CTIME_ALIGN(powerbufFree); powerbuf = MOD_EXP_CTIME_ALIGN(powerbufFree);

View File

@ -113,7 +113,6 @@
#define HEADER_BN_LCL_H #define HEADER_BN_LCL_H
#include <openssl/bn.h> #include <openssl/bn.h>
#include <unistd.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -469,7 +468,7 @@ void bn_sqr_comba4(BN_ULONG *r,const BN_ULONG *a);
int bn_cmp_words(const BN_ULONG *a,const BN_ULONG *b,int n); int bn_cmp_words(const BN_ULONG *a,const BN_ULONG *b,int n);
int bn_cmp_part_words(const BN_ULONG *a, const BN_ULONG *b, int bn_cmp_part_words(const BN_ULONG *a, const BN_ULONG *b,
int cl, int dl); int cl, int dl);
void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, size_t n2, void bn_mul_recursive(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b,int n2,
int dna,int dnb,BN_ULONG *t); int dna,int dnb,BN_ULONG *t);
void bn_mul_part_recursive(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b, void bn_mul_part_recursive(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b,
int n,int tna,int tnb,BN_ULONG *t); int n,int tna,int tnb,BN_ULONG *t);
@ -480,12 +479,10 @@ void bn_mul_low_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2,
void bn_mul_high(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b,BN_ULONG *l,int n2, void bn_mul_high(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b,BN_ULONG *l,int n2,
BN_ULONG *t); BN_ULONG *t);
BN_ULONG bn_add_part_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, BN_ULONG bn_add_part_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b,
size_t cl, ssize_t dl); int cl, int dl);
BN_ULONG bn_sub_part_words(BN_ULONG *r, BN_ULONG bn_sub_part_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b,
const BN_ULONG *a, const BN_ULONG *b, int cl, int dl);
size_t cl, ssize_t dl); int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, const BN_ULONG *np,const BN_ULONG *n0, int num);
int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,
const BN_ULONG *np,const BN_ULONG *n0, int num);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -315,7 +315,7 @@ BIGNUM *BN_new(void)
/* This is used both by bn_expand2() and bn_dup_expand() */ /* This is used both by bn_expand2() and bn_dup_expand() */
/* The caller MUST check that words > b->dmax before calling this */ /* The caller MUST check that words > b->dmax before calling this */
static BN_ULONG *bn_expand_internal(const BIGNUM *b, size_t words) static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
{ {
BN_ULONG *A,*a = NULL; BN_ULONG *A,*a = NULL;
const BN_ULONG *B; const BN_ULONG *B;
@ -391,7 +391,7 @@ static BN_ULONG *bn_expand_internal(const BIGNUM *b, size_t words)
*/ */
#ifndef OPENSSL_NO_DEPRECATED #ifndef OPENSSL_NO_DEPRECATED
BIGNUM *bn_dup_expand(const BIGNUM *b, size_t words) BIGNUM *bn_dup_expand(const BIGNUM *b, int words)
{ {
BIGNUM *r = NULL; BIGNUM *r = NULL;
@ -442,7 +442,7 @@ BIGNUM *bn_dup_expand(const BIGNUM *b, size_t words)
* It is mostly used by the various BIGNUM routines. If there is an error, * It is mostly used by the various BIGNUM routines. If there is an error,
* NULL is returned. If not, 'b' is returned. */ * NULL is returned. If not, 'b' is returned. */
BIGNUM *bn_expand2(BIGNUM *b, size_t words) BIGNUM *bn_expand2(BIGNUM *b, int words)
{ {
bn_check_top(b); bn_check_top(b);
@ -594,7 +594,7 @@ int BN_set_word(BIGNUM *a, BN_ULONG w)
return(1); return(1);
} }
BIGNUM *BN_bin2bn(const unsigned char *s, size_t len, BIGNUM *ret) BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
{ {
unsigned int i,m; unsigned int i,m;
unsigned int n; unsigned int n;
@ -614,7 +614,7 @@ BIGNUM *BN_bin2bn(const unsigned char *s, size_t len, BIGNUM *ret)
} }
i=((n-1)/BN_BYTES)+1; i=((n-1)/BN_BYTES)+1;
m=((n-1)%(BN_BYTES)); m=((n-1)%(BN_BYTES));
if (bn_wexpand(ret, i) == NULL) if (bn_wexpand(ret, (int)i) == NULL)
{ {
if (bn) BN_free(bn); if (bn) BN_free(bn);
return NULL; return NULL;
@ -718,7 +718,7 @@ int BN_cmp(const BIGNUM *a, const BIGNUM *b)
int BN_set_bit(BIGNUM *a, int n) int BN_set_bit(BIGNUM *a, int n)
{ {
size_t i,j,k; int i,j,k;
if (n < 0) if (n < 0)
return 0; return 0;

View File

@ -88,7 +88,7 @@ int BN_bn2mpi(const BIGNUM *a, unsigned char *d)
return(num+4+ext); return(num+4+ext);
} }
BIGNUM *BN_mpi2bn(const unsigned char *d, size_t n, BIGNUM *a) BIGNUM *BN_mpi2bn(const unsigned char *d, int n, BIGNUM *a)
{ {
long len; long len;
int neg=0; int neg=0;

View File

@ -79,7 +79,7 @@
BN_ULONG bn_sub_part_words(BN_ULONG *r, BN_ULONG bn_sub_part_words(BN_ULONG *r,
const BN_ULONG *a, const BN_ULONG *b, const BN_ULONG *a, const BN_ULONG *b,
size_t cl, ssize_t dl) int cl, int dl)
{ {
BN_ULONG c, t; BN_ULONG c, t;
@ -126,7 +126,7 @@ BN_ULONG bn_sub_part_words(BN_ULONG *r,
} }
else else
{ {
ssize_t save_dl = dl; int save_dl = dl;
#ifdef BN_COUNT #ifdef BN_COUNT
fprintf(stderr, " bn_sub_part_words %d + %d (dl > 0, c = %d)\n", cl, dl, c); fprintf(stderr, " bn_sub_part_words %d + %d (dl > 0, c = %d)\n", cl, dl, c);
#endif #endif
@ -206,7 +206,7 @@ BN_ULONG bn_sub_part_words(BN_ULONG *r,
BN_ULONG bn_add_part_words(BN_ULONG *r, BN_ULONG bn_add_part_words(BN_ULONG *r,
const BN_ULONG *a, const BN_ULONG *b, const BN_ULONG *a, const BN_ULONG *b,
size_t cl, ssize_t dl) int cl, int dl)
{ {
BN_ULONG c, l, t; BN_ULONG c, l, t;
@ -222,7 +222,7 @@ BN_ULONG bn_add_part_words(BN_ULONG *r,
if (dl < 0) if (dl < 0)
{ {
ssize_t save_dl = dl; int save_dl = dl;
#ifdef BN_COUNT #ifdef BN_COUNT
fprintf(stderr, " bn_add_part_words %d + %d (dl < 0, c = %d)\n", cl, dl, c); fprintf(stderr, " bn_add_part_words %d + %d (dl < 0, c = %d)\n", cl, dl, c);
#endif #endif
@ -390,7 +390,7 @@ BN_ULONG bn_add_part_words(BN_ULONG *r,
* a[1]*b[1] * a[1]*b[1]
*/ */
/* dnX may not be positive, but n2/2+dnX has to be */ /* dnX may not be positive, but n2/2+dnX has to be */
void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, size_t n2, void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2,
int dna, int dnb, BN_ULONG *t) int dna, int dnb, BN_ULONG *t)
{ {
int n=n2/2,c1,c2; int n=n2/2,c1,c2;
@ -505,16 +505,16 @@ void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, size_t n2,
* r[32] holds (b[1]*b[1]) * r[32] holds (b[1]*b[1])
*/ */
c1=bn_add_words(t,r,&(r[n2]),n2); c1=(int)(bn_add_words(t,r,&(r[n2]),n2));
if (neg) /* if t[32] is negative */ if (neg) /* if t[32] is negative */
{ {
c1-=bn_sub_words(&(t[n2]),t,&(t[n2]),n2); c1-=(int)(bn_sub_words(&(t[n2]),t,&(t[n2]),n2));
} }
else else
{ {
/* Might have a carry */ /* Might have a carry */
c1+=bn_add_words(&(t[n2]),&(t[n2]),t,n2); c1+=(int)(bn_add_words(&(t[n2]),&(t[n2]),t,n2));
} }
/* t[32] holds (a[0]-a[1])*(b[1]-b[0])+(a[0]*b[0])+(a[1]*b[1]) /* t[32] holds (a[0]-a[1])*(b[1]-b[0])+(a[0]*b[0])+(a[1]*b[1])
@ -522,7 +522,7 @@ void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, size_t n2,
* r[32] holds (b[1]*b[1]) * r[32] holds (b[1]*b[1])
* c1 holds the carry bits * c1 holds the carry bits
*/ */
c1+=bn_add_words(&(r[n]),&(r[n]),&(t[n2]),n2); c1+=(int)(bn_add_words(&(r[n]),&(r[n]),&(t[n2]),n2));
if (c1) if (c1)
{ {
p= &(r[n+n2]); p= &(r[n+n2]);

View File

@ -415,8 +415,7 @@ int BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *field,
return 1; return 1;
} }
typedef BN_ULONG (*bn_addsub_f)(BN_ULONG *, const BN_ULONG *, const BN_ULONG *, typedef BN_ULONG (*bn_addsub_f)(BN_ULONG *,const BN_ULONG *,const BN_ULONG *,int);
size_t);
#define nist_set_224(to, from, a1, a2, a3, a4, a5, a6, a7) \ #define nist_set_224(to, from, a1, a2, a3, a4, a5, a6, a7) \
{ \ { \

View File

@ -71,7 +71,7 @@ char *BN_bn2hex(const BIGNUM *a)
char *buf; char *buf;
char *p; char *p;
buf=OPENSSL_malloc(a->top*BN_BYTES*2+2); buf=(char *)OPENSSL_malloc(a->top*BN_BYTES*2+2);
if (buf == NULL) if (buf == NULL)
{ {
BNerr(BN_F_BN_BN2HEX,ERR_R_MALLOC_FAILURE); BNerr(BN_F_BN_BN2HEX,ERR_R_MALLOC_FAILURE);
@ -116,7 +116,7 @@ char *BN_bn2dec(const BIGNUM *a)
i=BN_num_bits(a)*3; i=BN_num_bits(a)*3;
num=(i/10+i/1000+1)+1; num=(i/10+i/1000+1)+1;
bn_data=(BN_ULONG *)OPENSSL_malloc((num/BN_DEC_NUM+1)*sizeof(BN_ULONG)); bn_data=(BN_ULONG *)OPENSSL_malloc((num/BN_DEC_NUM+1)*sizeof(BN_ULONG));
buf=OPENSSL_malloc(num+3); buf=(char *)OPENSSL_malloc(num+3);
if ((buf == NULL) || (bn_data == NULL)) if ((buf == NULL) || (bn_data == NULL))
{ {
BNerr(BN_F_BN_BN2DEC,ERR_R_MALLOC_FAILURE); BNerr(BN_F_BN_BN2DEC,ERR_R_MALLOC_FAILURE);

View File

@ -208,18 +208,18 @@ err:
return(ret); return(ret);
} }
int BN_rand(BIGNUM *rnd, size_t bits, int top, int bottom) int BN_rand(BIGNUM *rnd, int bits, int top, int bottom)
{ {
return bnrand(0, rnd, bits, top, bottom); return bnrand(0, rnd, bits, top, bottom);
} }
int BN_pseudo_rand(BIGNUM *rnd, size_t bits, int top, int bottom) int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom)
{ {
return bnrand(1, rnd, bits, top, bottom); return bnrand(1, rnd, bits, top, bottom);
} }
#if 1 #if 1
int BN_bntest_rand(BIGNUM *rnd, size_t bits, int top, int bottom) int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom)
{ {
return bnrand(2, rnd, bits, top, bottom); return bnrand(2, rnd, bits, top, bottom);
} }
@ -229,8 +229,7 @@ int BN_bntest_rand(BIGNUM *rnd, size_t bits, int top, int bottom)
/* random number r: 0 <= r < range */ /* random number r: 0 <= r < range */
static int bn_rand_range(int pseudo, BIGNUM *r, const BIGNUM *range) static int bn_rand_range(int pseudo, BIGNUM *r, const BIGNUM *range)
{ {
int (*bn_rand)(BIGNUM *, size_t, int, int) int (*bn_rand)(BIGNUM *, int, int, int) = pseudo ? BN_pseudo_rand : BN_rand;
= pseudo ? BN_pseudo_rand : BN_rand;
int n; int n;
int count = 100; int count = 100;

View File

@ -214,7 +214,7 @@ err:
* we can do faster division if the remainder is not required. * we can do faster division if the remainder is not required.
*/ */
/* r := 2^len / m */ /* r := 2^len / m */
int BN_reciprocal(BIGNUM *r, const BIGNUM *m, size_t len, BN_CTX *ctx) int BN_reciprocal(BIGNUM *r, const BIGNUM *m, int len, BN_CTX *ctx)
{ {
int ret= -1; int ret= -1;
BIGNUM *t; BIGNUM *t;

View File

@ -168,13 +168,6 @@ int BN_add_word(BIGNUM *a, BN_ULONG w)
return(1); return(1);
} }
int BN_add_signed_word(BIGNUM *a, BN_LONG w)
{
if(w < 0)
return 0;
return BN_add_word(a, (BN_ULONG)w);
}
int BN_sub_word(BIGNUM *a, BN_ULONG w) int BN_sub_word(BIGNUM *a, BN_ULONG w)
{ {
int i; int i;

View File

@ -79,7 +79,7 @@ typedef unsigned char u8;
# endif # endif
# define GETU32(p) SWAP(*((u32 *)(p))) # define GETU32(p) SWAP(*((u32 *)(p)))
# define PUTU32(p,v) (*((u32 *)(p)) = SWAP((v))) # define PUTU32(p,v) (*((u32 *)(p)) = SWAP((v)))
#elif defined(__GNUC__) && __GNUC__>=2 && (defined(__i386) || defined(__x86_64)) && !defined(PEDANTIC) #elif defined(__GNUC__) && __GNUC__>=2 && (defined(__i386) || defined(__x86_64))
# if defined(B_ENDIAN) /* stratus.com does it */ # if defined(B_ENDIAN) /* stratus.com does it */
# define GETU32(p) (*(u32 *)(p)) # define GETU32(p) (*(u32 *)(p))
# define PUTU32(p,v) (*(u32 *)(p)=(v)) # define PUTU32(p,v) (*(u32 *)(p)=(v))

View File

@ -365,7 +365,7 @@ int CRYPTO_is_mem_check_on(void);
#define MemCheck_off() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE) #define MemCheck_off() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE)
#define is_MemCheck_on() CRYPTO_is_mem_check_on() #define is_MemCheck_on() CRYPTO_is_mem_check_on()
#define OPENSSL_malloc(num) CRYPTO_malloc(num,__FILE__,__LINE__) #define OPENSSL_malloc(num) CRYPTO_malloc((int)num,__FILE__,__LINE__)
#define OPENSSL_strdup(str) CRYPTO_strdup((str),__FILE__,__LINE__) #define OPENSSL_strdup(str) CRYPTO_strdup((str),__FILE__,__LINE__)
#define OPENSSL_realloc(addr,num) \ #define OPENSSL_realloc(addr,num) \
CRYPTO_realloc((char *)addr,(int)num,__FILE__,__LINE__) CRYPTO_realloc((char *)addr,(int)num,__FILE__,__LINE__)
@ -469,10 +469,8 @@ int CRYPTO_set_mem_ex_functions(void *(*m)(size_t,const char *,int),
void (*f)(void *)); void (*f)(void *));
int CRYPTO_set_locked_mem_ex_functions(void *(*m)(size_t,const char *,int), int CRYPTO_set_locked_mem_ex_functions(void *(*m)(size_t,const char *,int),
void (*free_func)(void *)); void (*free_func)(void *));
int CRYPTO_set_mem_debug_functions(void (*m)(void *,size_t,const char *,int, int CRYPTO_set_mem_debug_functions(void (*m)(void *,int,const char *,int,int),
int), void (*r)(void *,void *,int,const char *,int,int),
void (*r)(void *,void *,size_t,const char *,
int,int),
void (*f)(void *,int), void (*f)(void *,int),
void (*so)(long), void (*so)(long),
long (*go)(void)); long (*go)(void));
@ -483,23 +481,21 @@ void CRYPTO_get_mem_ex_functions(void *(**m)(size_t,const char *,int),
void (**f)(void *)); void (**f)(void *));
void CRYPTO_get_locked_mem_ex_functions(void *(**m)(size_t,const char *,int), void CRYPTO_get_locked_mem_ex_functions(void *(**m)(size_t,const char *,int),
void (**f)(void *)); void (**f)(void *));
void CRYPTO_get_mem_debug_functions(void (**m)(void *,size_t,const char *,int, void CRYPTO_get_mem_debug_functions(void (**m)(void *,int,const char *,int,int),
int), void (**r)(void *,void *,int,const char *,int,int),
void (**r)(void *,void *,size_t,
const char *,int,int),
void (**f)(void *,int), void (**f)(void *,int),
void (**so)(long), void (**so)(long),
long (**go)(void)); long (**go)(void));
void *CRYPTO_malloc_locked(size_t num, const char *file, int line); void *CRYPTO_malloc_locked(int num, const char *file, int line);
void CRYPTO_free_locked(void *); void CRYPTO_free_locked(void *);
void *CRYPTO_malloc(size_t num, const char *file, int line); void *CRYPTO_malloc(int num, const char *file, int line);
char *CRYPTO_strdup(const char *str, const char *file, int line); char *CRYPTO_strdup(const char *str, const char *file, int line);
void CRYPTO_free(void *); void CRYPTO_free(void *);
void *CRYPTO_realloc(void *addr, size_t num, const char *file, int line); void *CRYPTO_realloc(void *addr,int num, const char *file, int line);
void *CRYPTO_realloc_clean(void *addr, size_t old_num, size_t num, void *CRYPTO_realloc_clean(void *addr,int old_num,int num,const char *file,
const char *file, int line); int line);
void *CRYPTO_remalloc(void *addr, size_t num, const char *file, int line); void *CRYPTO_remalloc(void *addr,int num, const char *file, int line);
void OPENSSL_cleanse(void *ptr, size_t len); void OPENSSL_cleanse(void *ptr, size_t len);
@ -520,10 +516,8 @@ int CRYPTO_remove_all_info(void);
* 0: called before the actual memory allocation has taken place * 0: called before the actual memory allocation has taken place
* 1: called after the actual memory allocation has taken place * 1: called after the actual memory allocation has taken place
*/ */
void CRYPTO_dbg_malloc(void *addr,size_t num,const char *file,int line, void CRYPTO_dbg_malloc(void *addr,int num,const char *file,int line,int before_p);
int before_p); void CRYPTO_dbg_realloc(void *addr1,void *addr2,int num,const char *file,int line,int before_p);
void CRYPTO_dbg_realloc(void *addr1,void *addr2,size_t num,const char *file,
int line,int before_p);
void CRYPTO_dbg_free(void *addr,int before_p); void CRYPTO_dbg_free(void *addr,int before_p);
/* Tell the debugging code about options. By default, the following values /* Tell the debugging code about options. By default, the following values
* apply: * apply:

View File

@ -194,7 +194,7 @@ int DH_check(const DH *dh,int *codes);
int DH_check_pub_key(const DH *dh,const BIGNUM *pub_key, int *codes); int DH_check_pub_key(const DH *dh,const BIGNUM *pub_key, int *codes);
int DH_generate_key(DH *dh); int DH_generate_key(DH *dh);
int DH_compute_key(unsigned char *key,const BIGNUM *pub_key,DH *dh); int DH_compute_key(unsigned char *key,const BIGNUM *pub_key,DH *dh);
DH * d2i_DHparams(DH **a,const unsigned char **pp, size_t length); DH * d2i_DHparams(DH **a,const unsigned char **pp, long length);
int i2d_DHparams(const DH *a,unsigned char **pp); int i2d_DHparams(const DH *a,unsigned char **pp);
#ifndef OPENSSL_NO_FP_API #ifndef OPENSSL_NO_FP_API
int DHparams_print_fp(FILE *fp, const DH *x); int DHparams_print_fp(FILE *fp, const DH *x);

View File

@ -296,7 +296,7 @@ static void update_buflen(const BIGNUM *b, size_t *pbuflen)
} }
static int dh_param_decode(EVP_PKEY *pkey, static int dh_param_decode(EVP_PKEY *pkey,
const unsigned char **pder, size_t derlen) const unsigned char **pder, int derlen)
{ {
DH *dh; DH *dh;
if (!(dh = d2i_DHparams(NULL, pder, derlen))) if (!(dh = d2i_DHparams(NULL, pder, derlen)))

View File

@ -177,7 +177,7 @@ struct dsa_st
DSA_SIG * DSA_SIG_new(void); DSA_SIG * DSA_SIG_new(void);
void DSA_SIG_free(DSA_SIG *a); void DSA_SIG_free(DSA_SIG *a);
int i2d_DSA_SIG(const DSA_SIG *a, unsigned char **pp); int i2d_DSA_SIG(const DSA_SIG *a, unsigned char **pp);
DSA_SIG * d2i_DSA_SIG(DSA_SIG **v, const unsigned char **pp, size_t length); DSA_SIG * d2i_DSA_SIG(DSA_SIG **v, const unsigned char **pp, long length);
DSA_SIG * DSA_do_sign(const unsigned char *dgst,int dlen,DSA *dsa); DSA_SIG * DSA_do_sign(const unsigned char *dgst,int dlen,DSA *dsa);
int DSA_do_verify(const unsigned char *dgst,int dgst_len, int DSA_do_verify(const unsigned char *dgst,int dgst_len,
@ -206,9 +206,9 @@ int DSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
int DSA_set_ex_data(DSA *d, int idx, void *arg); int DSA_set_ex_data(DSA *d, int idx, void *arg);
void *DSA_get_ex_data(DSA *d, int idx); void *DSA_get_ex_data(DSA *d, int idx);
DSA * d2i_DSAPublicKey(DSA **a, const unsigned char **pp, size_t length); DSA * d2i_DSAPublicKey(DSA **a, const unsigned char **pp, long length);
DSA * d2i_DSAPrivateKey(DSA **a, const unsigned char **pp, size_t length); DSA * d2i_DSAPrivateKey(DSA **a, const unsigned char **pp, long length);
DSA * d2i_DSAparams(DSA **a, const unsigned char **pp, size_t length); DSA * d2i_DSAparams(DSA **a, const unsigned char **pp, long length);
/* Deprecated version */ /* Deprecated version */
#ifndef OPENSSL_NO_DEPRECATED #ifndef OPENSSL_NO_DEPRECATED

View File

@ -480,7 +480,7 @@ err:
} }
static int dsa_param_decode(EVP_PKEY *pkey, static int dsa_param_decode(EVP_PKEY *pkey,
const unsigned char **pder, size_t derlen) const unsigned char **pder, int derlen)
{ {
DSA *dsa; DSA *dsa;
if (!(dsa = d2i_DSAparams(NULL, pder, derlen))) if (!(dsa = d2i_DSAparams(NULL, pder, derlen)))
@ -517,7 +517,7 @@ static int dsa_priv_print(BIO *bp, const EVP_PKEY *pkey, int indent,
} }
static int old_dsa_priv_decode(EVP_PKEY *pkey, static int old_dsa_priv_decode(EVP_PKEY *pkey,
const unsigned char **pder, size_t derlen) const unsigned char **pder, int derlen)
{ {
DSA *dsa; DSA *dsa;
if (!(dsa = d2i_DSAPrivateKey (NULL, pder, derlen))) if (!(dsa = d2i_DSAPrivateKey (NULL, pder, derlen)))

View File

@ -661,7 +661,7 @@ int EC_GROUP_get_pentanomial_basis(const EC_GROUP *, unsigned int *k1,
typedef struct ecpk_parameters_st ECPKPARAMETERS; typedef struct ecpk_parameters_st ECPKPARAMETERS;
EC_GROUP *d2i_ECPKParameters(EC_GROUP **, const unsigned char **in, size_t len); EC_GROUP *d2i_ECPKParameters(EC_GROUP **, const unsigned char **in, long len);
int i2d_ECPKParameters(const EC_GROUP *, unsigned char **out); int i2d_ECPKParameters(const EC_GROUP *, unsigned char **out);
#define d2i_ECPKParameters_bio(bp,x) ASN1_d2i_bio_of(EC_GROUP,NULL,d2i_ECPKParameters,bp,x) #define d2i_ECPKParameters_bio(bp,x) ASN1_d2i_bio_of(EC_GROUP,NULL,d2i_ECPKParameters,bp,x)
@ -810,7 +810,7 @@ int EC_KEY_check_key(const EC_KEY *key);
* \param len length of the DER encoded private key * \param len length of the DER encoded private key
* \return the decoded private key or NULL if an error occurred. * \return the decoded private key or NULL if an error occurred.
*/ */
EC_KEY *d2i_ECPrivateKey(EC_KEY **key, const unsigned char **in, size_t len); EC_KEY *d2i_ECPrivateKey(EC_KEY **key, const unsigned char **in, long len);
/** Encodes a private key object and stores the result in a buffer. /** Encodes a private key object and stores the result in a buffer.
* \param key the EC_KEY object to encode * \param key the EC_KEY object to encode

View File

@ -520,7 +520,7 @@ err:
} }
static int eckey_param_decode(EVP_PKEY *pkey, static int eckey_param_decode(EVP_PKEY *pkey,
const unsigned char **pder, size_t derlen) const unsigned char **pder, int derlen)
{ {
EC_KEY *eckey; EC_KEY *eckey;
if (!(eckey = d2i_ECParameters(NULL, pder, derlen))) if (!(eckey = d2i_ECParameters(NULL, pder, derlen)))
@ -557,7 +557,7 @@ static int eckey_priv_print(BIO *bp, const EVP_PKEY *pkey, int indent,
} }
static int old_ec_priv_decode(EVP_PKEY *pkey, static int old_ec_priv_decode(EVP_PKEY *pkey,
const unsigned char **pder, size_t derlen) const unsigned char **pder, int derlen)
{ {
EC_KEY *ec; EC_KEY *ec;
if (!(ec = d2i_ECPrivateKey (NULL, pder, derlen))) if (!(ec = d2i_ECPrivateKey (NULL, pder, derlen)))

View File

@ -1050,7 +1050,7 @@ EC_GROUP *ec_asn1_pkparameters2group(const ECPKPARAMETERS *params)
/* EC_GROUP <-> DER encoding of ECPKPARAMETERS */ /* EC_GROUP <-> DER encoding of ECPKPARAMETERS */
EC_GROUP *d2i_ECPKParameters(EC_GROUP **a, const unsigned char **in, size_t len) EC_GROUP *d2i_ECPKParameters(EC_GROUP **a, const unsigned char **in, long len)
{ {
EC_GROUP *group = NULL; EC_GROUP *group = NULL;
ECPKPARAMETERS *params = NULL; ECPKPARAMETERS *params = NULL;
@ -1099,7 +1099,7 @@ int i2d_ECPKParameters(const EC_GROUP *a, unsigned char **out)
/* some EC_KEY functions */ /* some EC_KEY functions */
EC_KEY *d2i_ECPrivateKey(EC_KEY **a, const unsigned char **in, size_t len) EC_KEY *d2i_ECPrivateKey(EC_KEY **a, const unsigned char **in, long len)
{ {
int ok=0; int ok=0;
EC_KEY *ret=NULL; EC_KEY *ret=NULL;

View File

@ -106,7 +106,7 @@ int i2d_ECDSA_SIG(const ECDSA_SIG *sig, unsigned char **pp);
* \param len length of the buffer * \param len length of the buffer
* \return pointer to the decoded ECDSA_SIG structure (or NULL) * \return pointer to the decoded ECDSA_SIG structure (or NULL)
*/ */
ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **sig, const unsigned char **pp, size_t len); ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **sig, const unsigned char **pp, long len);
/** Computes the ECDSA signature of the given hash value using /** Computes the ECDSA signature of the given hash value using
* the supplied private key and returns the created signature. * the supplied private key and returns the created signature.

View File

@ -105,7 +105,7 @@ int test_builtin(BIO *);
/* functions to change the RAND_METHOD */ /* functions to change the RAND_METHOD */
int change_rand(void); int change_rand(void);
int restore_rand(void); int restore_rand(void);
int fbytes(unsigned char *buf, size_t num); int fbytes(unsigned char *buf, int num);
RAND_METHOD fake_rand; RAND_METHOD fake_rand;
const RAND_METHOD *old_rand; const RAND_METHOD *old_rand;
@ -152,7 +152,7 @@ static const char *numbers[8] = {
"1712787255652165239672857892369562652652652356758119494040" "1712787255652165239672857892369562652652652356758119494040"
"40041670216363"}; "40041670216363"};
int fbytes(unsigned char *buf, size_t num) int fbytes(unsigned char *buf, int num)
{ {
int ret; int ret;
BIGNUM *tmp = NULL; BIGNUM *tmp = NULL;

View File

@ -122,8 +122,8 @@ static int des_ede_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
#ifdef KSSL_DEBUG #ifdef KSSL_DEBUG
{ {
int i; int i;
printf("des_ede_cbc_cipher(ctx=%lx, buflen=%ld)\n", (unsigned long)ctx, char *cp;
(unsigned long)ctx->buf_len); printf("des_ede_cbc_cipher(ctx=%lx, buflen=%d)\n", ctx, ctx->buf_len);
printf("\t iv= "); printf("\t iv= ");
for(i=0;i<8;i++) for(i=0;i<8;i++)
printf("%02X",ctx->iv[i]); printf("%02X",ctx->iv[i]);
@ -257,7 +257,7 @@ static int des_ede3_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
#ifdef KSSL_DEBUG #ifdef KSSL_DEBUG
{ {
int i; int i;
printf("des_ede3_init_key(ctx=%lx)\n", (unsigned long)ctx); printf("des_ede3_init_key(ctx=%lx)\n", ctx);
printf("\tKEY= "); printf("\tKEY= ");
for(i=0;i<24;i++) printf("%02X",key[i]); printf("\n"); for(i=0;i<24;i++) printf("%02X",key[i]); printf("\n");
printf("\t IV= "); printf("\t IV= ");

View File

@ -129,14 +129,14 @@ void EVP_EncodeInit(EVP_ENCODE_CTX *ctx)
} }
void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,
const unsigned char *in, size_t inl) const unsigned char *in, int inl)
{ {
size_t i,j; int i,j;
unsigned int total=0; unsigned int total=0;
*outl=0; *outl=0;
if (inl == 0) return; if (inl == 0) return;
OPENSSL_assert(ctx->length <= sizeof(ctx->enc_data)); OPENSSL_assert(ctx->length <= (int)sizeof(ctx->enc_data));
if ((ctx->num+inl) < ctx->length) if ((ctx->num+inl) < ctx->length)
{ {
memcpy(&(ctx->enc_data[ctx->num]),in,inl); memcpy(&(ctx->enc_data[ctx->num]),in,inl);
@ -186,7 +186,7 @@ void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl)
*outl=ret; *outl=ret;
} }
int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, size_t dlen) int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int dlen)
{ {
int i,ret=0; int i,ret=0;
unsigned long l; unsigned long l;
@ -233,10 +233,9 @@ void EVP_DecodeInit(EVP_ENCODE_CTX *ctx)
* 1 for full line * 1 for full line
*/ */
int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,
const unsigned char *in, size_t inl) const unsigned char *in, int inl)
{ {
int seof= -1,eof=0,rv= -1,ret=0,i,v,tmp,ln,tmp2,exp_nl; int seof= -1,eof=0,rv= -1,ret=0,i,v,tmp,n,ln,tmp2,exp_nl;
size_t n;
unsigned char *d; unsigned char *d;
n=ctx->num; n=ctx->num;
@ -357,7 +356,7 @@ end:
return(rv); return(rv);
} }
int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, size_t n) int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n)
{ {
int i,ret=0,a,b,c,d; int i,ret=0,a,b,c,d;
unsigned long l; unsigned long l;

View File

@ -160,7 +160,7 @@ struct env_md_st
{ {
int type; int type;
int pkey_type; int pkey_type;
size_t md_size; int md_size;
unsigned long flags; unsigned long flags;
int (*init)(EVP_MD_CTX *ctx); int (*init)(EVP_MD_CTX *ctx);
int (*update)(EVP_MD_CTX *ctx,const void *data,size_t count); int (*update)(EVP_MD_CTX *ctx,const void *data,size_t count);
@ -175,8 +175,8 @@ struct env_md_st
const unsigned char *sigbuf, unsigned int siglen, const unsigned char *sigbuf, unsigned int siglen,
void *key); void *key);
int required_pkey_type[5]; /*EVP_PKEY_xxx */ int required_pkey_type[5]; /*EVP_PKEY_xxx */
size_t block_size; int block_size;
size_t ctx_size; /* how big does the ctx->md_data need to be */ int ctx_size; /* how big does the ctx->md_data need to be */
/* control function */ /* control function */
int (*md_ctrl)(EVP_MD_CTX *ctx, int cmd, int p1, void *p2); int (*md_ctrl)(EVP_MD_CTX *ctx, int cmd, int p1, void *p2);
} /* EVP_MD */; } /* EVP_MD */;
@ -292,16 +292,16 @@ struct env_md_ctx_st
struct evp_cipher_st struct evp_cipher_st
{ {
int nid; int nid;
size_t block_size; int block_size;
size_t key_len; /* Default value for variable length ciphers */ int key_len; /* Default value for variable length ciphers */
size_t iv_len; int iv_len;
unsigned long flags; /* Various flags */ unsigned long flags; /* Various flags */
int (*init)(EVP_CIPHER_CTX *ctx, const unsigned char *key, int (*init)(EVP_CIPHER_CTX *ctx, const unsigned char *key,
const unsigned char *iv, int enc); /* init key */ const unsigned char *iv, int enc); /* init key */
int (*do_cipher)(EVP_CIPHER_CTX *ctx, unsigned char *out, int (*do_cipher)(EVP_CIPHER_CTX *ctx, unsigned char *out,
const unsigned char *in, size_t inl);/* encrypt/decrypt data */ const unsigned char *in, size_t inl);/* encrypt/decrypt data */
int (*cleanup)(EVP_CIPHER_CTX *); /* cleanup ctx */ int (*cleanup)(EVP_CIPHER_CTX *); /* cleanup ctx */
size_t ctx_size; /* how big ctx->cipher_data needs to be */ int ctx_size; /* how big ctx->cipher_data needs to be */
int (*set_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Populate a ASN1_TYPE with parameters */ int (*set_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Populate a ASN1_TYPE with parameters */
int (*get_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Get parameters from a ASN1_TYPE */ int (*get_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Get parameters from a ASN1_TYPE */
int (*ctrl)(EVP_CIPHER_CTX *, int type, int arg, void *ptr); /* Miscellaneous operations */ int (*ctrl)(EVP_CIPHER_CTX *, int type, int arg, void *ptr); /* Miscellaneous operations */
@ -355,7 +355,7 @@ struct evp_cipher_ctx_st
const EVP_CIPHER *cipher; const EVP_CIPHER *cipher;
ENGINE *engine; /* functional reference if 'cipher' is ENGINE-provided */ ENGINE *engine; /* functional reference if 'cipher' is ENGINE-provided */
int encrypt; /* encrypt or decrypt */ int encrypt; /* encrypt or decrypt */
size_t buf_len; /* number we have left */ int buf_len; /* number we have left */
unsigned char oiv[EVP_MAX_IV_LENGTH]; /* original iv */ unsigned char oiv[EVP_MAX_IV_LENGTH]; /* original iv */
unsigned char iv[EVP_MAX_IV_LENGTH]; /* working iv */ unsigned char iv[EVP_MAX_IV_LENGTH]; /* working iv */
@ -363,18 +363,18 @@ struct evp_cipher_ctx_st
int num; /* used by cfb/ofb mode */ int num; /* used by cfb/ofb mode */
void *app_data; /* application stuff */ void *app_data; /* application stuff */
size_t key_len; /* May change for variable length cipher */ int key_len; /* May change for variable length cipher */
unsigned long flags; /* Various flags */ unsigned long flags; /* Various flags */
void *cipher_data; /* per EVP data */ void *cipher_data; /* per EVP data */
size_t final_used; int final_used;
int block_mask; int block_mask;
unsigned char final[EVP_MAX_BLOCK_LENGTH];/* possible final block */ unsigned char final[EVP_MAX_BLOCK_LENGTH];/* possible final block */
} /* EVP_CIPHER_CTX */; } /* EVP_CIPHER_CTX */;
typedef struct evp_Encode_Ctx_st typedef struct evp_Encode_Ctx_st
{ {
size_t num; /* number saved in a partial encode/decode */ int num; /* number saved in a partial encode/decode */
size_t length; /* The length is either the output line length int length; /* The length is either the output line length
* (in input bytes) or the shortest input line * (in input bytes) or the shortest input line
* length that is ok. Once decoding begins, * length that is ok. Once decoding begins,
* the length is adjusted up each time a longer * the length is adjusted up each time a longer
@ -419,8 +419,8 @@ int EVP_MD_type(const EVP_MD *md);
#define EVP_MD_nid(e) EVP_MD_type(e) #define EVP_MD_nid(e) EVP_MD_type(e)
#define EVP_MD_name(e) OBJ_nid2sn(EVP_MD_nid(e)) #define EVP_MD_name(e) OBJ_nid2sn(EVP_MD_nid(e))
int EVP_MD_pkey_type(const EVP_MD *md); int EVP_MD_pkey_type(const EVP_MD *md);
size_t EVP_MD_size(const EVP_MD *md); int EVP_MD_size(const EVP_MD *md);
size_t EVP_MD_block_size(const EVP_MD *md); int EVP_MD_block_size(const EVP_MD *md);
const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx); const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx);
#define EVP_MD_CTX_size(e) EVP_MD_size(EVP_MD_CTX_md(e)) #define EVP_MD_CTX_size(e) EVP_MD_size(EVP_MD_CTX_md(e))
@ -429,17 +429,17 @@ const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx);
int EVP_CIPHER_nid(const EVP_CIPHER *cipher); int EVP_CIPHER_nid(const EVP_CIPHER *cipher);
#define EVP_CIPHER_name(e) OBJ_nid2sn(EVP_CIPHER_nid(e)) #define EVP_CIPHER_name(e) OBJ_nid2sn(EVP_CIPHER_nid(e))
size_t EVP_CIPHER_block_size(const EVP_CIPHER *cipher); int EVP_CIPHER_block_size(const EVP_CIPHER *cipher);
size_t EVP_CIPHER_key_length(const EVP_CIPHER *cipher); int EVP_CIPHER_key_length(const EVP_CIPHER *cipher);
size_t EVP_CIPHER_iv_length(const EVP_CIPHER *cipher); int EVP_CIPHER_iv_length(const EVP_CIPHER *cipher);
unsigned long EVP_CIPHER_flags(const EVP_CIPHER *cipher); unsigned long EVP_CIPHER_flags(const EVP_CIPHER *cipher);
#define EVP_CIPHER_mode(e) (EVP_CIPHER_flags(e) & EVP_CIPH_MODE) #define EVP_CIPHER_mode(e) (EVP_CIPHER_flags(e) & EVP_CIPH_MODE)
const EVP_CIPHER * EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx); const EVP_CIPHER * EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx);
int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx); int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx);
size_t EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx); int EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx);
size_t EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx); int EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx);
size_t EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx); int EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx);
void * EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx); void * EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx);
void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data); void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data);
#define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c)) #define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c))
@ -471,8 +471,10 @@ void BIO_set_md(BIO *,const EVP_MD *md);
#define BIO_get_cipher_status(b) BIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL) #define BIO_get_cipher_status(b) BIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL)
#define BIO_get_cipher_ctx(b,c_pp) BIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0,(char *)c_pp) #define BIO_get_cipher_ctx(b,c_pp) BIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0,(char *)c_pp)
size_t EVP_Cipher(EVP_CIPHER_CTX *c, unsigned char *out, int EVP_Cipher(EVP_CIPHER_CTX *c,
const unsigned char *in, size_t inl); unsigned char *out,
const unsigned char *in,
unsigned int inl);
#define EVP_add_cipher_alias(n,alias) \ #define EVP_add_cipher_alias(n,alias) \
OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n)) OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
@ -508,27 +510,25 @@ char * EVP_get_pw_prompt(void);
int EVP_BytesToKey(const EVP_CIPHER *type,const EVP_MD *md, int EVP_BytesToKey(const EVP_CIPHER *type,const EVP_MD *md,
const unsigned char *salt, const unsigned char *data, const unsigned char *salt, const unsigned char *data,
size_t datal, int count, unsigned char *key,unsigned char *iv); int datal, int count, unsigned char *key,unsigned char *iv);
int EVP_EncryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, int EVP_EncryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher,
const unsigned char *key, const unsigned char *iv); const unsigned char *key, const unsigned char *iv);
int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl, int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl,
const unsigned char *key, const unsigned char *iv); const unsigned char *key, const unsigned char *iv);
int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
int *outl, const unsigned char *in, size_t inl); int *outl, const unsigned char *in, int inl);
int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
int EVP_DecryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, int EVP_DecryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher,
const unsigned char *key, const unsigned char *iv); const unsigned char *key, const unsigned char *iv);
int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl,
ENGINE *impl, const unsigned char *key, const unsigned char *key, const unsigned char *iv);
const unsigned char *iv);
int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
int *outl, const unsigned char *in, size_t inl); int *outl, const unsigned char *in, int inl);
int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);
int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);
int *outl);
int EVP_CipherInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, int EVP_CipherInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher,
const unsigned char *key,const unsigned char *iv, const unsigned char *key,const unsigned char *iv,
@ -537,7 +537,7 @@ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl
const unsigned char *key,const unsigned char *iv, const unsigned char *key,const unsigned char *iv,
int enc); int enc);
int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
int *outl, const unsigned char *in, size_t inl); int *outl, const unsigned char *in, int inl);
int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);
int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);
@ -545,7 +545,7 @@ int EVP_SignFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s,
EVP_PKEY *pkey); EVP_PKEY *pkey);
int EVP_VerifyFinal(EVP_MD_CTX *ctx,const unsigned char *sigbuf, int EVP_VerifyFinal(EVP_MD_CTX *ctx,const unsigned char *sigbuf,
size_t siglen,EVP_PKEY *pkey); unsigned int siglen,EVP_PKEY *pkey);
int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey); const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey);
@ -558,8 +558,8 @@ int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx,
unsigned char *sig, size_t siglen); unsigned char *sig, size_t siglen);
int EVP_OpenInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *type, int EVP_OpenInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *type,
const unsigned char *ek, size_t ekl, const unsigned char *ek, int ekl, const unsigned char *iv,
const unsigned char *iv, EVP_PKEY *priv); EVP_PKEY *priv);
int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,
@ -569,21 +569,22 @@ int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
void EVP_EncodeInit(EVP_ENCODE_CTX *ctx); void EVP_EncodeInit(EVP_ENCODE_CTX *ctx);
void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl, void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl,
const unsigned char *in, size_t inl); const unsigned char *in,int inl);
void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl); void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl);
int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, size_t n); int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int n);
void EVP_DecodeInit(EVP_ENCODE_CTX *ctx); void EVP_DecodeInit(EVP_ENCODE_CTX *ctx);
int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl, int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl,
const unsigned char *in, size_t inl); const unsigned char *in, int inl);
int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl); int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned
int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, size_t n); char *out, int *outl);
int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n);
void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a); void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a);
int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a); int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a);
EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void); EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void);
void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *a); void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *a);
int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, size_t keylen); int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen);
int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *c, int pad); int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *c, int pad);
int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr); int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr);
int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key); int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key);
@ -849,13 +850,13 @@ EVP_PKEY * EVP_PKEY_new(void);
void EVP_PKEY_free(EVP_PKEY *pkey); void EVP_PKEY_free(EVP_PKEY *pkey);
EVP_PKEY * d2i_PublicKey(int type,EVP_PKEY **a, const unsigned char **pp, EVP_PKEY * d2i_PublicKey(int type,EVP_PKEY **a, const unsigned char **pp,
size_t length); long length);
int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp); int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp);
EVP_PKEY * d2i_PrivateKey(int type,EVP_PKEY **a, const unsigned char **pp, EVP_PKEY * d2i_PrivateKey(int type,EVP_PKEY **a, const unsigned char **pp,
long length); long length);
EVP_PKEY * d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp, EVP_PKEY * d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp,
size_t length); long length);
int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp); int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp);
int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from); int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from);
@ -961,7 +962,7 @@ void EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth,
ASN1_PCTX *pctx)); ASN1_PCTX *pctx));
void EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth, void EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth,
int (*param_decode)(EVP_PKEY *pkey, int (*param_decode)(EVP_PKEY *pkey,
const unsigned char **pder, size_t derlen), const unsigned char **pder, int derlen),
int (*param_encode)(const EVP_PKEY *pkey, unsigned char **pder), int (*param_encode)(const EVP_PKEY *pkey, unsigned char **pder),
int (*param_missing)(const EVP_PKEY *pk), int (*param_missing)(const EVP_PKEY *pk),
int (*param_copy)(EVP_PKEY *to, const EVP_PKEY *from), int (*param_copy)(EVP_PKEY *to, const EVP_PKEY *from),

View File

@ -209,8 +209,7 @@ skip_to_init:
OPENSSL_assert(EVP_CIPHER_CTX_iv_length(ctx) <= OPENSSL_assert(EVP_CIPHER_CTX_iv_length(ctx) <=
(int)sizeof(ctx->iv)); (int)sizeof(ctx->iv));
if(iv) memcpy(ctx->oiv, iv, if(iv) memcpy(ctx->oiv, iv, EVP_CIPHER_CTX_iv_length(ctx));
EVP_CIPHER_CTX_iv_length(ctx));
memcpy(ctx->iv, ctx->oiv, EVP_CIPHER_CTX_iv_length(ctx)); memcpy(ctx->iv, ctx->oiv, EVP_CIPHER_CTX_iv_length(ctx));
break; break;
@ -230,7 +229,7 @@ skip_to_init:
} }
int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
const unsigned char *in, size_t inl) const unsigned char *in, int inl)
{ {
if (ctx->encrypt) if (ctx->encrypt)
return EVP_EncryptUpdate(ctx,out,outl,in,inl); return EVP_EncryptUpdate(ctx,out,outl,in,inl);
@ -276,11 +275,9 @@ int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *im
} }
int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
const unsigned char *in, size_t inl) const unsigned char *in, int inl)
{ {
size_t i; int i,j,bl;
size_t bl;
size_t j;
if (inl <= 0) if (inl <= 0)
{ {
@ -384,7 +381,7 @@ int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
} }
int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
const unsigned char *in, size_t inl) const unsigned char *in, int inl)
{ {
int fix_len; int fix_len;
unsigned int b; unsigned int b;
@ -518,10 +515,10 @@ int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *c)
return 1; return 1;
} }
int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *c, size_t keylen) int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *c, int keylen)
{ {
if(c->cipher->flags & EVP_CIPH_CUSTOM_KEY_LENGTH) if(c->cipher->flags & EVP_CIPH_CUSTOM_KEY_LENGTH)
return EVP_CIPHER_CTX_ctrl(c, EVP_CTRL_SET_KEY_LENGTH, (int)keylen, NULL); return EVP_CIPHER_CTX_ctrl(c, EVP_CTRL_SET_KEY_LENGTH, keylen, NULL);
if(c->key_len == keylen) return 1; if(c->key_len == keylen) return 1;
if((keylen > 0) && (c->cipher->flags & EVP_CIPH_VARIABLE_LENGTH)) if((keylen > 0) && (c->cipher->flags & EVP_CIPH_VARIABLE_LENGTH))
{ {

View File

@ -108,7 +108,7 @@ int EVP_read_pw_string(char *buf, int len, const char *prompt, int verify)
} }
int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md, int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md,
const unsigned char *salt, const unsigned char *data, size_t datal, const unsigned char *salt, const unsigned char *data, int datal,
int count, unsigned char *key, unsigned char *iv) int count, unsigned char *key, unsigned char *iv)
{ {
EVP_MD_CTX c; EVP_MD_CTX c;

View File

@ -168,18 +168,17 @@ int EVP_CIPHER_type(const EVP_CIPHER *ctx)
} }
} }
size_t EVP_CIPHER_block_size(const EVP_CIPHER *e) int EVP_CIPHER_block_size(const EVP_CIPHER *e)
{ {
return e->block_size; return e->block_size;
} }
size_t EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx) int EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx)
{ {
return ctx->cipher->block_size; return ctx->cipher->block_size;
} }
size_t EVP_Cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, int EVP_Cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl)
const unsigned char *in, size_t inl)
{ {
return ctx->cipher->do_cipher(ctx,out,in,inl); return ctx->cipher->do_cipher(ctx,out,in,inl);
} }
@ -209,22 +208,22 @@ void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data)
ctx->app_data = data; ctx->app_data = data;
} }
size_t EVP_CIPHER_iv_length(const EVP_CIPHER *cipher) int EVP_CIPHER_iv_length(const EVP_CIPHER *cipher)
{ {
return cipher->iv_len; return cipher->iv_len;
} }
size_t EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx) int EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx)
{ {
return ctx->cipher->iv_len; return ctx->cipher->iv_len;
} }
size_t EVP_CIPHER_key_length(const EVP_CIPHER *cipher) int EVP_CIPHER_key_length(const EVP_CIPHER *cipher)
{ {
return cipher->key_len; return cipher->key_len;
} }
size_t EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx) int EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx)
{ {
return ctx->key_len; return ctx->key_len;
} }
@ -239,7 +238,7 @@ int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx)
return ctx->cipher->nid; return ctx->cipher->nid;
} }
size_t EVP_MD_block_size(const EVP_MD *md) int EVP_MD_block_size(const EVP_MD *md)
{ {
return md->block_size; return md->block_size;
} }
@ -254,7 +253,7 @@ int EVP_MD_pkey_type(const EVP_MD *md)
return md->pkey_type; return md->pkey_type;
} }
size_t EVP_MD_size(const EVP_MD *md) int EVP_MD_size(const EVP_MD *md)
{ {
if (!md) if (!md)
return -1; return -1;

View File

@ -67,7 +67,7 @@
#include <openssl/rsa.h> #include <openssl/rsa.h>
int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,
const unsigned char *ek, size_t ekl, const unsigned char *iv, const unsigned char *ek, int ekl, const unsigned char *iv,
EVP_PKEY *priv) EVP_PKEY *priv)
{ {
unsigned char *key=NULL; unsigned char *key=NULL;

View File

@ -63,7 +63,7 @@
#include <openssl/x509.h> #include <openssl/x509.h>
int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf, int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf,
size_t siglen,EVP_PKEY *pkey) unsigned int siglen, EVP_PKEY *pkey)
{ {
unsigned char m[EVP_MAX_MD_SIZE]; unsigned char m[EVP_MAX_MD_SIZE];
unsigned int m_len; unsigned int m_len;

View File

@ -104,7 +104,7 @@ static int hmac_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
*/ */
static int old_hmac_decode(EVP_PKEY *pkey, static int old_hmac_decode(EVP_PKEY *pkey,
const unsigned char **pder, size_t derlen) const unsigned char **pder, int derlen)
{ {
ASN1_OCTET_STRING *os; ASN1_OCTET_STRING *os;
os = ASN1_OCTET_STRING_new(); os = ASN1_OCTET_STRING_new();

View File

@ -61,7 +61,7 @@
#include "cryptlib.h" #include "cryptlib.h"
#include <openssl/hmac.h> #include <openssl/hmac.h>
int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, size_t len, int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
const EVP_MD *md, ENGINE *impl) const EVP_MD *md, ENGINE *impl)
{ {
int i,j,reset=0; int i,j,reset=0;
@ -124,7 +124,7 @@ int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, size_t len,
return 0; return 0;
} }
int HMAC_Init(HMAC_CTX *ctx, const void *key, size_t len, const EVP_MD *md) int HMAC_Init(HMAC_CTX *ctx, const void *key, int len, const EVP_MD *md)
{ {
if(key && md) if(key && md)
HMAC_CTX_init(ctx); HMAC_CTX_init(ctx);
@ -188,7 +188,7 @@ void HMAC_CTX_cleanup(HMAC_CTX *ctx)
memset(ctx,0,sizeof *ctx); memset(ctx,0,sizeof *ctx);
} }
unsigned char *HMAC(const EVP_MD *evp_md, const void *key, size_t key_len, unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len,
const unsigned char *d, size_t n, unsigned char *md, const unsigned char *d, size_t n, unsigned char *md,
unsigned int *md_len) unsigned int *md_len)
{ {

View File

@ -90,13 +90,13 @@ void HMAC_CTX_cleanup(HMAC_CTX *ctx);
#define HMAC_cleanup(ctx) HMAC_CTX_cleanup(ctx) /* deprecated */ #define HMAC_cleanup(ctx) HMAC_CTX_cleanup(ctx) /* deprecated */
int HMAC_Init(HMAC_CTX *ctx, const void *key, size_t len, int HMAC_Init(HMAC_CTX *ctx, const void *key, int len,
const EVP_MD *md); /* deprecated */ const EVP_MD *md); /* deprecated */
int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, size_t len, int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
const EVP_MD *md, ENGINE *impl); const EVP_MD *md, ENGINE *impl);
int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len); int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len);
int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len); int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len);
unsigned char *HMAC(const EVP_MD *evp_md, const void *key, size_t key_len, unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len,
const unsigned char *d, size_t n, unsigned char *md, const unsigned char *d, size_t n, unsigned char *md,
unsigned int *md_len); unsigned int *md_len);
int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx); int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx);

View File

@ -103,9 +103,9 @@ static void (*free_locked_func)(void *) = free;
/* XXX use correct function pointer types */ /* XXX use correct function pointer types */
#ifdef CRYPTO_MDEBUG #ifdef CRYPTO_MDEBUG
/* use default functions from mem_dbg.c */ /* use default functions from mem_dbg.c */
static void (*malloc_debug_func)(void *,size_t,const char *,int,int) static void (*malloc_debug_func)(void *,int,const char *,int,int)
= CRYPTO_dbg_malloc; = CRYPTO_dbg_malloc;
static void (*realloc_debug_func)(void *,void *,size_t,const char *,int,int) static void (*realloc_debug_func)(void *,void *,int,const char *,int,int)
= CRYPTO_dbg_realloc; = CRYPTO_dbg_realloc;
static void (*free_debug_func)(void *,int) = CRYPTO_dbg_free; static void (*free_debug_func)(void *,int) = CRYPTO_dbg_free;
static void (*set_debug_options_func)(long) = CRYPTO_dbg_set_options; static void (*set_debug_options_func)(long) = CRYPTO_dbg_set_options;
@ -113,8 +113,8 @@ static long (*get_debug_options_func)(void) = CRYPTO_dbg_get_options;
#else #else
/* applications can use CRYPTO_malloc_debug_init() to select above case /* applications can use CRYPTO_malloc_debug_init() to select above case
* at run-time */ * at run-time */
static void (*malloc_debug_func)(void *,size_t,const char *,int,int) = NULL; static void (*malloc_debug_func)(void *,int,const char *,int,int) = NULL;
static void (*realloc_debug_func)(void *,void *,size_t,const char *,int,int) static void (*realloc_debug_func)(void *,void *,int,const char *,int,int)
= NULL; = NULL;
static void (*free_debug_func)(void *,int) = NULL; static void (*free_debug_func)(void *,int) = NULL;
static void (*set_debug_options_func)(long) = NULL; static void (*set_debug_options_func)(long) = NULL;
@ -178,8 +178,8 @@ int CRYPTO_set_locked_mem_ex_functions(
return 1; return 1;
} }
int CRYPTO_set_mem_debug_functions(void (*m)(void *,size_t,const char *,int,int), int CRYPTO_set_mem_debug_functions(void (*m)(void *,int,const char *,int,int),
void (*r)(void *,void *,size_t,const char *,int,int), void (*r)(void *,void *,int,const char *,int,int),
void (*f)(void *,int), void (*f)(void *,int),
void (*so)(long), void (*so)(long),
long (*go)(void)) long (*go)(void))
@ -233,8 +233,8 @@ void CRYPTO_get_locked_mem_ex_functions(
if (f != NULL) *f=free_locked_func; if (f != NULL) *f=free_locked_func;
} }
void CRYPTO_get_mem_debug_functions(void (**m)(void *,size_t,const char *,int,int), void CRYPTO_get_mem_debug_functions(void (**m)(void *,int,const char *,int,int),
void (**r)(void *,void *,size_t,const char *,int,int), void (**r)(void *,void *,int,const char *,int,int),
void (**f)(void *,int), void (**f)(void *,int),
void (**so)(long), void (**so)(long),
long (**go)(void)) long (**go)(void))
@ -247,7 +247,7 @@ void CRYPTO_get_mem_debug_functions(void (**m)(void *,size_t,const char *,int,in
} }
void *CRYPTO_malloc_locked(size_t num, const char *file, int line) void *CRYPTO_malloc_locked(int num, const char *file, int line)
{ {
void *ret = NULL; void *ret = NULL;
@ -291,7 +291,7 @@ void CRYPTO_free_locked(void *str)
free_debug_func(NULL, 1); free_debug_func(NULL, 1);
} }
void *CRYPTO_malloc(size_t num, const char *file, int line) void *CRYPTO_malloc(int num, const char *file, int line)
{ {
void *ret = NULL; void *ret = NULL;
@ -330,7 +330,7 @@ char *CRYPTO_strdup(const char *str, const char *file, int line)
return ret; return ret;
} }
void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) void *CRYPTO_realloc(void *str, int num, const char *file, int line)
{ {
void *ret = NULL; void *ret = NULL;
@ -351,8 +351,8 @@ void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
return ret; return ret;
} }
void *CRYPTO_realloc_clean(void *str, size_t old_len, size_t num, void *CRYPTO_realloc_clean(void *str, int old_len, int num, const char *file,
const char *file, int line) int line)
{ {
void *ret = NULL; void *ret = NULL;
@ -393,10 +393,10 @@ void CRYPTO_free(void *str)
free_debug_func(NULL, 1); free_debug_func(NULL, 1);
} }
void *CRYPTO_remalloc(void *a, size_t num, const char *file, int line) void *CRYPTO_remalloc(void *a, int num, const char *file, int line)
{ {
if (a != NULL) OPENSSL_free(a); if (a != NULL) OPENSSL_free(a);
a=OPENSSL_malloc(num); a=(char *)OPENSSL_malloc(num);
return(a); return(a);
} }

View File

@ -478,7 +478,7 @@ int CRYPTO_remove_all_info(void)
static unsigned long break_order_num=0; static unsigned long break_order_num=0;
void CRYPTO_dbg_malloc(void *addr, size_t num, const char *file, int line, void CRYPTO_dbg_malloc(void *addr, int num, const char *file, int line,
int before_p) int before_p)
{ {
MEM *m,*mm; MEM *m,*mm;
@ -602,7 +602,7 @@ void CRYPTO_dbg_free(void *addr, int before_p)
} }
} }
void CRYPTO_dbg_realloc(void *addr1, void *addr2, size_t num, void CRYPTO_dbg_realloc(void *addr1, void *addr2, int num,
const char *file, int line, int before_p) const char *file, int line, int before_p)
{ {
MEM m,*mp; MEM m,*mp;
@ -666,7 +666,7 @@ static void print_leak_doall_arg(const MEM *m, MEM_LEAK *l)
char buf[1024]; char buf[1024];
char *bufp = buf; char *bufp = buf;
APP_INFO *amip; APP_INFO *amip;
size_t ami_cnt; int ami_cnt;
struct tm *lcl = NULL; struct tm *lcl = NULL;
CRYPTO_THREADID ti; CRYPTO_THREADID ti;
@ -712,7 +712,7 @@ static void print_leak_doall_arg(const MEM *m, MEM_LEAK *l)
do do
{ {
size_t buf_len; int buf_len;
int info_len; int info_len;
ami_cnt++; ami_cnt++;

View File

@ -289,7 +289,7 @@ void OBJ_NAME_do_all(int type,void (*fn)(const OBJ_NAME *,void *arg),void *arg)
struct doall_sorted struct doall_sorted
{ {
int type; int type;
size_t n; int n;
const OBJ_NAME **names; const OBJ_NAME **names;
}; };
@ -322,7 +322,7 @@ void OBJ_NAME_do_all_sorted(int type,void (*fn)(const OBJ_NAME *,void *arg),
d.n=0; d.n=0;
OBJ_NAME_do_all(type,do_all_sorted_fn,&d); OBJ_NAME_do_all(type,do_all_sorted_fn,&d);
qsort(d.names,d.n,sizeof *d.names,do_all_sorted_cmp); qsort((void *)d.names,d.n,sizeof *d.names,do_all_sorted_cmp);
for(n=0 ; n < d.n ; ++n) for(n=0 ; n < d.n ; ++n)
fn(d.names[n],arg); fn(d.names[n],arg);

View File

@ -431,8 +431,7 @@ ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name)
unsigned char *buf; unsigned char *buf;
unsigned char *p; unsigned char *p;
const unsigned char *cp; const unsigned char *cp;
size_t i; int i, j;
size_t j;
if(!no_name) { if(!no_name) {
if( ((nid = OBJ_sn2nid(s)) != NID_undef) || if( ((nid = OBJ_sn2nid(s)) != NID_undef) ||
@ -442,7 +441,7 @@ ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name)
/* Work out size of content octets */ /* Work out size of content octets */
i=a2d_ASN1_OBJECT(NULL,0,s,-1); i=a2d_ASN1_OBJECT(NULL,0,s,-1);
if (i == 0) { if (i <= 0) {
/* Don't clear the error */ /* Don't clear the error */
/*ERR_clear_error();*/ /*ERR_clear_error();*/
return NULL; return NULL;
@ -450,7 +449,7 @@ ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name)
/* Work out total size */ /* Work out total size */
j = ASN1_object_size(0,i,V_ASN1_OBJECT); j = ASN1_object_size(0,i,V_ASN1_OBJECT);
if((buf=OPENSSL_malloc(j)) == NULL) return NULL; if((buf=(unsigned char *)OPENSSL_malloc(j)) == NULL) return NULL;
p = buf; p = buf;
/* Write out tag+length */ /* Write out tag+length */
@ -464,7 +463,7 @@ ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name)
return op; return op;
} }
int OBJ_obj2txt(char *buf, size_t buf_len, const ASN1_OBJECT *a, int no_name) int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name)
{ {
int i,n=0,len,nid, first, use_bn; int i,n=0,len,nid, first, use_bn;
BIGNUM *bl; BIGNUM *bl;
@ -509,7 +508,7 @@ int OBJ_obj2txt(char *buf, size_t buf_len, const ASN1_OBJECT *a, int no_name)
goto err; goto err;
if (use_bn) if (use_bn)
{ {
if (!BN_add_word(bl, c & 0x7fU)) if (!BN_add_word(bl, c & 0x7f))
goto err; goto err;
} }
else else
@ -783,13 +782,12 @@ int OBJ_create(const char *oid, const char *sn, const char *ln)
int ok=0; int ok=0;
ASN1_OBJECT *op=NULL; ASN1_OBJECT *op=NULL;
unsigned char *buf; unsigned char *buf;
size_t i; int i;
i=a2d_ASN1_OBJECT(NULL,0,oid,-1); i=a2d_ASN1_OBJECT(NULL,0,oid,-1);
if (i == 0) if (i <= 0) return(0);
return 0;
if ((buf=OPENSSL_malloc(i)) == NULL) if ((buf=(unsigned char *)OPENSSL_malloc(i)) == NULL)
{ {
OBJerr(OBJ_F_OBJ_CREATE,ERR_R_MALLOC_FAILURE); OBJerr(OBJ_F_OBJ_CREATE,ERR_R_MALLOC_FAILURE);
return(0); return(0);
@ -797,7 +795,7 @@ int OBJ_create(const char *oid, const char *sn, const char *ln)
i=a2d_ASN1_OBJECT(buf,i,oid,-1); i=a2d_ASN1_OBJECT(buf,i,oid,-1);
if (i == 0) if (i == 0)
goto err; goto err;
op=ASN1_OBJECT_create(OBJ_new_nid(1),buf,i,sn,ln); op=(ASN1_OBJECT *)ASN1_OBJECT_create(OBJ_new_nid(1),buf,i,sn,ln);
if (op == NULL) if (op == NULL)
goto err; goto err;
ok=OBJ_add_object(op); ok=OBJ_add_object(op);

View File

@ -65,7 +65,7 @@
ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o) ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o)
{ {
ASN1_OBJECT *r; ASN1_OBJECT *r;
size_t i; int i;
char *ln=NULL,*sn=NULL; char *ln=NULL,*sn=NULL;
unsigned char *data=NULL; unsigned char *data=NULL;

View File

@ -1006,8 +1006,7 @@ const char * OBJ_nid2ln(int n);
const char * OBJ_nid2sn(int n); const char * OBJ_nid2sn(int n);
int OBJ_obj2nid(const ASN1_OBJECT *o); int OBJ_obj2nid(const ASN1_OBJECT *o);
ASN1_OBJECT * OBJ_txt2obj(const char *s, int no_name); ASN1_OBJECT * OBJ_txt2obj(const char *s, int no_name);
int OBJ_obj2txt(char *buf, size_t buf_len, const ASN1_OBJECT *a, int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name);
int no_name);
int OBJ_txt2nid(const char *s); int OBJ_txt2nid(const char *s);
int OBJ_ln2nid(const char *s); int OBJ_ln2nid(const char *s);
int OBJ_sn2nid(const char *s); int OBJ_sn2nid(const char *s);

View File

@ -71,8 +71,7 @@
#endif #endif
#ifndef OPENSSL_NO_FP_API #ifndef OPENSSL_NO_FP_API
STACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, STACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u)
pem_password_cb *cb, void *u)
{ {
BIO *b; BIO *b;
STACK_OF(X509_INFO) *ret; STACK_OF(X509_INFO) *ret;
@ -89,8 +88,7 @@ STACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk,
} }
#endif #endif
STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u)
pem_password_cb *cb, void *u)
{ {
X509_INFO *xi=NULL; X509_INFO *xi=NULL;
char *name=NULL,*header=NULL; char *name=NULL,*header=NULL;

View File

@ -69,9 +69,8 @@
*/ */
unsigned char * PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass, unsigned char * PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass,
int passlen, unsigned char *in, int inlen, int passlen, unsigned char *in, int inlen, unsigned char **data,
unsigned char **data, size_t *datalen, int *datalen, int en_de)
int en_de)
{ {
unsigned char *out; unsigned char *out;
int outlen, i; int outlen, i;
@ -112,13 +111,12 @@ unsigned char * PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass,
*/ */
void * PKCS12_item_decrypt_d2i(X509_ALGOR *algor, const ASN1_ITEM *it, void * PKCS12_item_decrypt_d2i(X509_ALGOR *algor, const ASN1_ITEM *it,
const char *pass, int passlen, const char *pass, int passlen, ASN1_OCTET_STRING *oct, int zbuf)
ASN1_OCTET_STRING *oct, int zbuf)
{ {
unsigned char *out; unsigned char *out;
const unsigned char *p; const unsigned char *p;
void *ret; void *ret;
size_t outlen; int outlen;
if (!PKCS12_pbe_crypt(algor, pass, passlen, oct->data, oct->length, if (!PKCS12_pbe_crypt(algor, pass, passlen, oct->data, oct->length,
&out, &outlen, 0)) { &out, &outlen, 0)) {
@ -149,8 +147,7 @@ void * PKCS12_item_decrypt_d2i(X509_ALGOR *algor, const ASN1_ITEM *it,
* if zbuf set zero encoding. * if zbuf set zero encoding.
*/ */
ASN1_OCTET_STRING *PKCS12_item_i2d_encrypt(X509_ALGOR *algor, ASN1_OCTET_STRING *PKCS12_item_i2d_encrypt(X509_ALGOR *algor, const ASN1_ITEM *it,
const ASN1_ITEM *it,
const char *pass, int passlen, const char *pass, int passlen,
void *obj, int zbuf) void *obj, int zbuf)
{ {

View File

@ -208,8 +208,7 @@ ASN1_TYPE *PKCS12_get_attr_gen(STACK_OF(X509_ATTRIBUTE) *attrs, int attr_nid);
char *PKCS12_get_friendlyname(PKCS12_SAFEBAG *bag); char *PKCS12_get_friendlyname(PKCS12_SAFEBAG *bag);
unsigned char *PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass, unsigned char *PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass,
int passlen, unsigned char *in, int inlen, int passlen, unsigned char *in, int inlen,
unsigned char **data, size_t *datalen, unsigned char **data, int *datalen, int en_de);
int en_de);
void * PKCS12_item_decrypt_d2i(X509_ALGOR *algor, const ASN1_ITEM *it, void * PKCS12_item_decrypt_d2i(X509_ALGOR *algor, const ASN1_ITEM *it,
const char *pass, int passlen, ASN1_OCTET_STRING *oct, int zbuf); const char *pass, int passlen, ASN1_OCTET_STRING *oct, int zbuf);
ASN1_OCTET_STRING *PKCS12_item_i2d_encrypt(X509_ALGOR *algor, const ASN1_ITEM *it, ASN1_OCTET_STRING *PKCS12_item_i2d_encrypt(X509_ALGOR *algor, const ASN1_ITEM *it,

View File

@ -155,10 +155,10 @@ int rand_predictable=0;
const char RAND_version[]="RAND" OPENSSL_VERSION_PTEXT; const char RAND_version[]="RAND" OPENSSL_VERSION_PTEXT;
static void ssleay_rand_cleanup(void); static void ssleay_rand_cleanup(void);
static void ssleay_rand_seed(const void *buf, size_t num); static void ssleay_rand_seed(const void *buf, int num);
static void ssleay_rand_add(const void *buf, size_t num, double add_entropy); static void ssleay_rand_add(const void *buf, int num, double add_entropy);
static int ssleay_rand_bytes(unsigned char *buf, size_t num); static int ssleay_rand_bytes(unsigned char *buf, int num);
static int ssleay_rand_pseudo_bytes(unsigned char *buf, size_t num); static int ssleay_rand_pseudo_bytes(unsigned char *buf, int num);
static int ssleay_rand_status(void); static int ssleay_rand_status(void);
RAND_METHOD rand_ssleay_meth={ RAND_METHOD rand_ssleay_meth={
@ -187,11 +187,9 @@ static void ssleay_rand_cleanup(void)
initialized=0; initialized=0;
} }
static void ssleay_rand_add(const void *buf, size_t num, double add) static void ssleay_rand_add(const void *buf, int num, double add)
{ {
int i,st_idx; int i,j,k,st_idx;
size_t j;
ssize_t k;
long md_c[2]; long md_c[2];
unsigned char local_md[MD_DIGEST_LENGTH]; unsigned char local_md[MD_DIGEST_LENGTH];
EVP_MD_CTX m; EVP_MD_CTX m;
@ -304,7 +302,7 @@ static void ssleay_rand_add(const void *buf, size_t num, double add)
* other thread's seeding remains without effect (except for * other thread's seeding remains without effect (except for
* the incremented counter). By XORing it we keep at least as * the incremented counter). By XORing it we keep at least as
* much entropy as fits into md. */ * much entropy as fits into md. */
for (k = 0; k < sizeof(md); k++) for (k = 0; k < (int)sizeof(md); k++)
{ {
md[k] ^= local_md[k]; md[k] ^= local_md[k];
} }
@ -317,17 +315,15 @@ static void ssleay_rand_add(const void *buf, size_t num, double add)
#endif #endif
} }
static void ssleay_rand_seed(const void *buf, size_t num) static void ssleay_rand_seed(const void *buf, int num)
{ {
ssleay_rand_add(buf, num, (double)num); ssleay_rand_add(buf, num, (double)num);
} }
static int ssleay_rand_bytes(unsigned char *buf, size_t num) static int ssleay_rand_bytes(unsigned char *buf, int num)
{ {
static volatile int stirred_pool = 0; static volatile int stirred_pool = 0;
int i,st_num,st_idx; int i,j,k,st_num,st_idx;
size_t j;
ssize_t k;
int num_ceil; int num_ceil;
int ok; int ok;
long md_c[2]; long md_c[2];
@ -494,7 +490,7 @@ static int ssleay_rand_bytes(unsigned char *buf, size_t num)
} }
MD_Init(&m); MD_Init(&m);
MD_Update(&m,&(md_c[0]),sizeof(md_c)); MD_Update(&m,(unsigned char *)&(md_c[0]),sizeof(md_c));
MD_Update(&m,local_md,MD_DIGEST_LENGTH); MD_Update(&m,local_md,MD_DIGEST_LENGTH);
CRYPTO_w_lock(CRYPTO_LOCK_RAND); CRYPTO_w_lock(CRYPTO_LOCK_RAND);
MD_Update(&m,md,MD_DIGEST_LENGTH); MD_Update(&m,md,MD_DIGEST_LENGTH);
@ -515,7 +511,7 @@ static int ssleay_rand_bytes(unsigned char *buf, size_t num)
/* pseudo-random bytes that are guaranteed to be unique but not /* pseudo-random bytes that are guaranteed to be unique but not
unpredictable */ unpredictable */
static int ssleay_rand_pseudo_bytes(unsigned char *buf, size_t num) static int ssleay_rand_pseudo_bytes(unsigned char *buf, int num)
{ {
int ret; int ret;
unsigned long err; unsigned long err;

View File

@ -80,11 +80,11 @@ extern "C" {
struct rand_meth_st struct rand_meth_st
{ {
void (*seed)(const void *buf, size_t num); void (*seed)(const void *buf, int num);
int (*bytes)(unsigned char *buf, size_t num); int (*bytes)(unsigned char *buf, int num);
void (*cleanup)(void); void (*cleanup)(void);
void (*add)(const void *buf, size_t num, double entropy); void (*add)(const void *buf, int num, double entropy);
int (*pseudorand)(unsigned char *buf, size_t num); int (*pseudorand)(unsigned char *buf, int num);
int (*status)(void); int (*status)(void);
}; };
@ -99,17 +99,17 @@ int RAND_set_rand_engine(ENGINE *engine);
#endif #endif
RAND_METHOD *RAND_SSLeay(void); RAND_METHOD *RAND_SSLeay(void);
void RAND_cleanup(void ); void RAND_cleanup(void );
int RAND_bytes(unsigned char *buf,size_t num); int RAND_bytes(unsigned char *buf,int num);
int RAND_pseudo_bytes(unsigned char *buf,size_t num); int RAND_pseudo_bytes(unsigned char *buf,int num);
void RAND_seed(const void *buf,size_t num); void RAND_seed(const void *buf,int num);
void RAND_add(const void *buf,size_t num,double entropy); void RAND_add(const void *buf,int num,double entropy);
int RAND_load_file(const char *file,long max_bytes); int RAND_load_file(const char *file,long max_bytes);
int RAND_write_file(const char *file); int RAND_write_file(const char *file);
const char *RAND_file_name(char *file,size_t num); const char *RAND_file_name(char *file,size_t num);
int RAND_status(void); int RAND_status(void);
int RAND_query_egd_bytes(const char *path, unsigned char *buf, size_t bytes); int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes);
int RAND_egd(const char *path); int RAND_egd(const char *path);
int RAND_egd_bytes(const char *path, size_t bytes); int RAND_egd_bytes(const char *path,int bytes);
int RAND_poll(void); int RAND_poll(void);
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)

View File

@ -133,11 +133,11 @@ struct sockaddr_un {
# define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) # define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
#endif #endif
int RAND_query_egd_bytes(const char *path, unsigned char *buf, size_t bytes) int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
{ {
int ret = 0; int ret = 0;
struct sockaddr_un addr; struct sockaddr_un addr;
size_t len, num, numbytes; int len, num, numbytes;
int fd = -1; int fd = -1;
int success; int success;
unsigned char egdbuf[2], tempbuf[255], *retrievebuf; unsigned char egdbuf[2], tempbuf[255], *retrievebuf;
@ -281,7 +281,7 @@ int RAND_query_egd_bytes(const char *path, unsigned char *buf, size_t bytes)
} }
int RAND_egd_bytes(const char *path, size_t bytes) int RAND_egd_bytes(const char *path, int bytes)
{ {
int num, ret = 0; int num, ret = 0;

View File

@ -137,21 +137,21 @@ void RAND_cleanup(void)
RAND_set_rand_method(NULL); RAND_set_rand_method(NULL);
} }
void RAND_seed(const void *buf, size_t num) void RAND_seed(const void *buf, int num)
{ {
const RAND_METHOD *meth = RAND_get_rand_method(); const RAND_METHOD *meth = RAND_get_rand_method();
if (meth && meth->seed) if (meth && meth->seed)
meth->seed(buf,num); meth->seed(buf,num);
} }
void RAND_add(const void *buf, size_t num, double entropy) void RAND_add(const void *buf, int num, double entropy)
{ {
const RAND_METHOD *meth = RAND_get_rand_method(); const RAND_METHOD *meth = RAND_get_rand_method();
if (meth && meth->add) if (meth && meth->add)
meth->add(buf,num,entropy); meth->add(buf,num,entropy);
} }
int RAND_bytes(unsigned char *buf, size_t num) int RAND_bytes(unsigned char *buf, int num)
{ {
const RAND_METHOD *meth = RAND_get_rand_method(); const RAND_METHOD *meth = RAND_get_rand_method();
if (meth && meth->bytes) if (meth && meth->bytes)
@ -159,7 +159,7 @@ int RAND_bytes(unsigned char *buf, size_t num)
return(-1); return(-1);
} }
int RAND_pseudo_bytes(unsigned char *buf, size_t num) int RAND_pseudo_bytes(unsigned char *buf, int num)
{ {
const RAND_METHOD *meth = RAND_get_rand_method(); const RAND_METHOD *meth = RAND_get_rand_method();
if (meth && meth->pseudorand) if (meth && meth->pseudorand)

View File

@ -157,7 +157,7 @@ int RAND_poll(void)
pid_t curr_pid = getpid(); pid_t curr_pid = getpid();
#if defined(DEVRANDOM) || defined(DEVRANDOM_EGD) #if defined(DEVRANDOM) || defined(DEVRANDOM_EGD)
unsigned char tmpbuf[ENTROPY_NEEDED]; unsigned char tmpbuf[ENTROPY_NEEDED];
size_t n = 0; int n = 0;
#endif #endif
#ifdef DEVRANDOM #ifdef DEVRANDOM
static const char *randomfiles[] = { DEVRANDOM }; static const char *randomfiles[] = { DEVRANDOM };
@ -261,7 +261,7 @@ int RAND_poll(void)
if (try_read) if (try_read)
{ {
r = read(fd,tmpbuf+n,ENTROPY_NEEDED-n); r = read(fd,(unsigned char *)tmpbuf+n, ENTROPY_NEEDED-n);
if (r > 0) if (r > 0)
n += r; n += r;
#if defined(OPENSSL_SYS_BEOS_R5) #if defined(OPENSSL_SYS_BEOS_R5)

View File

@ -105,8 +105,7 @@ int RAND_load_file(const char *file, long bytes)
#ifndef OPENSSL_NO_POSIX_IO #ifndef OPENSSL_NO_POSIX_IO
struct stat sb; struct stat sb;
#endif #endif
int i,ret=0; int i,ret=0,n;
size_t n;
FILE *in; FILE *in;
if (file == NULL) return(0); if (file == NULL) return(0);
@ -163,8 +162,7 @@ err:
int RAND_write_file(const char *file) int RAND_write_file(const char *file)
{ {
unsigned char buf[BUFSIZE]; unsigned char buf[BUFSIZE];
int ret=0,rand_err=0; int i,ret=0,rand_err=0;
size_t i;
FILE *out = NULL; FILE *out = NULL;
int n; int n;
#ifndef OPENSSL_NO_POSIX_IO #ifndef OPENSSL_NO_POSIX_IO
@ -228,7 +226,7 @@ int RAND_write_file(const char *file)
if (out == NULL) goto err; if (out == NULL) goto err;
#ifndef NO_CHMOD #ifndef NO_CHMOD
chmod(file,(mode_t)0600); chmod(file,0600);
#endif #endif
n=RAND_DATA; n=RAND_DATA;
for (;;) for (;;)
@ -238,7 +236,7 @@ int RAND_write_file(const char *file)
if (RAND_bytes(buf,i) <= 0) if (RAND_bytes(buf,i) <= 0)
rand_err=1; rand_err=1;
i=fwrite(buf,1,i,out); i=fwrite(buf,1,i,out);
if (i == 0) if (i <= 0)
{ {
ret=0; ret=0;
break; break;

View File

@ -107,7 +107,7 @@ static int rsa_pub_cmp(const EVP_PKEY *a, const EVP_PKEY *b)
} }
static int old_rsa_priv_decode(EVP_PKEY *pkey, static int old_rsa_priv_decode(EVP_PKEY *pkey,
const unsigned char **pder, size_t derlen) const unsigned char **pder, int derlen)
{ {
RSA *rsa; RSA *rsa;
if (!(rsa = d2i_RSAPrivateKey (NULL, pder, derlen))) if (!(rsa = d2i_RSAPrivateKey (NULL, pder, derlen)))

View File

@ -287,7 +287,7 @@ typedef struct ESS_signing_cert
TS_REQ *TS_REQ_new(void); TS_REQ *TS_REQ_new(void);
void TS_REQ_free(TS_REQ *a); void TS_REQ_free(TS_REQ *a);
int i2d_TS_REQ(const TS_REQ *a, unsigned char **pp); int i2d_TS_REQ(const TS_REQ *a, unsigned char **pp);
TS_REQ *d2i_TS_REQ(TS_REQ **a, const unsigned char **pp, size_t length); TS_REQ *d2i_TS_REQ(TS_REQ **a, const unsigned char **pp, long length);
TS_REQ *TS_REQ_dup(TS_REQ *a); TS_REQ *TS_REQ_dup(TS_REQ *a);
@ -300,7 +300,7 @@ TS_MSG_IMPRINT *TS_MSG_IMPRINT_new(void);
void TS_MSG_IMPRINT_free(TS_MSG_IMPRINT *a); void TS_MSG_IMPRINT_free(TS_MSG_IMPRINT *a);
int i2d_TS_MSG_IMPRINT(const TS_MSG_IMPRINT *a, unsigned char **pp); int i2d_TS_MSG_IMPRINT(const TS_MSG_IMPRINT *a, unsigned char **pp);
TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT(TS_MSG_IMPRINT **a, TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT(TS_MSG_IMPRINT **a,
const unsigned char **pp, size_t length); const unsigned char **pp, long length);
TS_MSG_IMPRINT *TS_MSG_IMPRINT_dup(TS_MSG_IMPRINT *a); TS_MSG_IMPRINT *TS_MSG_IMPRINT_dup(TS_MSG_IMPRINT *a);
@ -312,7 +312,7 @@ int i2d_TS_MSG_IMPRINT_bio(BIO *fp, TS_MSG_IMPRINT *a);
TS_RESP *TS_RESP_new(void); TS_RESP *TS_RESP_new(void);
void TS_RESP_free(TS_RESP *a); void TS_RESP_free(TS_RESP *a);
int i2d_TS_RESP(const TS_RESP *a, unsigned char **pp); int i2d_TS_RESP(const TS_RESP *a, unsigned char **pp);
TS_RESP *d2i_TS_RESP(TS_RESP **a, const unsigned char **pp, size_t length); TS_RESP *d2i_TS_RESP(TS_RESP **a, const unsigned char **pp, long length);
TS_TST_INFO *PKCS7_to_TS_TST_INFO(PKCS7 *token); TS_TST_INFO *PKCS7_to_TS_TST_INFO(PKCS7 *token);
TS_RESP *TS_RESP_dup(TS_RESP *a); TS_RESP *TS_RESP_dup(TS_RESP *a);
@ -325,14 +325,14 @@ TS_STATUS_INFO *TS_STATUS_INFO_new(void);
void TS_STATUS_INFO_free(TS_STATUS_INFO *a); void TS_STATUS_INFO_free(TS_STATUS_INFO *a);
int i2d_TS_STATUS_INFO(const TS_STATUS_INFO *a, unsigned char **pp); int i2d_TS_STATUS_INFO(const TS_STATUS_INFO *a, unsigned char **pp);
TS_STATUS_INFO *d2i_TS_STATUS_INFO(TS_STATUS_INFO **a, TS_STATUS_INFO *d2i_TS_STATUS_INFO(TS_STATUS_INFO **a,
const unsigned char **pp, size_t length); const unsigned char **pp, long length);
TS_STATUS_INFO *TS_STATUS_INFO_dup(TS_STATUS_INFO *a); TS_STATUS_INFO *TS_STATUS_INFO_dup(TS_STATUS_INFO *a);
TS_TST_INFO *TS_TST_INFO_new(void); TS_TST_INFO *TS_TST_INFO_new(void);
void TS_TST_INFO_free(TS_TST_INFO *a); void TS_TST_INFO_free(TS_TST_INFO *a);
int i2d_TS_TST_INFO(const TS_TST_INFO *a, unsigned char **pp); int i2d_TS_TST_INFO(const TS_TST_INFO *a, unsigned char **pp);
TS_TST_INFO *d2i_TS_TST_INFO(TS_TST_INFO **a, const unsigned char **pp, TS_TST_INFO *d2i_TS_TST_INFO(TS_TST_INFO **a, const unsigned char **pp,
size_t length); long length);
TS_TST_INFO *TS_TST_INFO_dup(TS_TST_INFO *a); TS_TST_INFO *TS_TST_INFO_dup(TS_TST_INFO *a);
TS_TST_INFO *d2i_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO **a); TS_TST_INFO *d2i_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO **a);
@ -344,7 +344,7 @@ TS_ACCURACY *TS_ACCURACY_new(void);
void TS_ACCURACY_free(TS_ACCURACY *a); void TS_ACCURACY_free(TS_ACCURACY *a);
int i2d_TS_ACCURACY(const TS_ACCURACY *a, unsigned char **pp); int i2d_TS_ACCURACY(const TS_ACCURACY *a, unsigned char **pp);
TS_ACCURACY *d2i_TS_ACCURACY(TS_ACCURACY **a, const unsigned char **pp, TS_ACCURACY *d2i_TS_ACCURACY(TS_ACCURACY **a, const unsigned char **pp,
size_t length); long length);
TS_ACCURACY *TS_ACCURACY_dup(TS_ACCURACY *a); TS_ACCURACY *TS_ACCURACY_dup(TS_ACCURACY *a);
ESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_new(void); ESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_new(void);
@ -352,15 +352,14 @@ void ESS_ISSUER_SERIAL_free(ESS_ISSUER_SERIAL *a);
int i2d_ESS_ISSUER_SERIAL(const ESS_ISSUER_SERIAL *a, int i2d_ESS_ISSUER_SERIAL(const ESS_ISSUER_SERIAL *a,
unsigned char **pp); unsigned char **pp);
ESS_ISSUER_SERIAL *d2i_ESS_ISSUER_SERIAL(ESS_ISSUER_SERIAL **a, ESS_ISSUER_SERIAL *d2i_ESS_ISSUER_SERIAL(ESS_ISSUER_SERIAL **a,
const unsigned char **pp, const unsigned char **pp, long length);
size_t length);
ESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_dup(ESS_ISSUER_SERIAL *a); ESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_dup(ESS_ISSUER_SERIAL *a);
ESS_CERT_ID *ESS_CERT_ID_new(void); ESS_CERT_ID *ESS_CERT_ID_new(void);
void ESS_CERT_ID_free(ESS_CERT_ID *a); void ESS_CERT_ID_free(ESS_CERT_ID *a);
int i2d_ESS_CERT_ID(const ESS_CERT_ID *a, unsigned char **pp); int i2d_ESS_CERT_ID(const ESS_CERT_ID *a, unsigned char **pp);
ESS_CERT_ID *d2i_ESS_CERT_ID(ESS_CERT_ID **a, const unsigned char **pp, ESS_CERT_ID *d2i_ESS_CERT_ID(ESS_CERT_ID **a, const unsigned char **pp,
size_t length); long length);
ESS_CERT_ID *ESS_CERT_ID_dup(ESS_CERT_ID *a); ESS_CERT_ID *ESS_CERT_ID_dup(ESS_CERT_ID *a);
ESS_SIGNING_CERT *ESS_SIGNING_CERT_new(void); ESS_SIGNING_CERT *ESS_SIGNING_CERT_new(void);
@ -368,7 +367,7 @@ void ESS_SIGNING_CERT_free(ESS_SIGNING_CERT *a);
int i2d_ESS_SIGNING_CERT(const ESS_SIGNING_CERT *a, int i2d_ESS_SIGNING_CERT(const ESS_SIGNING_CERT *a,
unsigned char **pp); unsigned char **pp);
ESS_SIGNING_CERT *d2i_ESS_SIGNING_CERT(ESS_SIGNING_CERT **a, ESS_SIGNING_CERT *d2i_ESS_SIGNING_CERT(ESS_SIGNING_CERT **a,
const unsigned char **pp, size_t length); const unsigned char **pp, long length);
ESS_SIGNING_CERT *ESS_SIGNING_CERT_dup(ESS_SIGNING_CERT *a); ESS_SIGNING_CERT *ESS_SIGNING_CERT_dup(ESS_SIGNING_CERT *a);
void ERR_load_TS_strings(void); void ERR_load_TS_strings(void);

View File

@ -793,21 +793,21 @@ int X509_get_pubkey_parameters(EVP_PKEY *pkey,
STACK_OF(X509) *chain); STACK_OF(X509) *chain);
int i2d_PUBKEY(EVP_PKEY *a,unsigned char **pp); int i2d_PUBKEY(EVP_PKEY *a,unsigned char **pp);
EVP_PKEY * d2i_PUBKEY(EVP_PKEY **a,const unsigned char **pp, EVP_PKEY * d2i_PUBKEY(EVP_PKEY **a,const unsigned char **pp,
size_t length); long length);
#ifndef OPENSSL_NO_RSA #ifndef OPENSSL_NO_RSA
int i2d_RSA_PUBKEY(RSA *a,unsigned char **pp); int i2d_RSA_PUBKEY(RSA *a,unsigned char **pp);
RSA * d2i_RSA_PUBKEY(RSA **a,const unsigned char **pp, RSA * d2i_RSA_PUBKEY(RSA **a,const unsigned char **pp,
size_t length); long length);
#endif #endif
#ifndef OPENSSL_NO_DSA #ifndef OPENSSL_NO_DSA
int i2d_DSA_PUBKEY(DSA *a,unsigned char **pp); int i2d_DSA_PUBKEY(DSA *a,unsigned char **pp);
DSA * d2i_DSA_PUBKEY(DSA **a,const unsigned char **pp, DSA * d2i_DSA_PUBKEY(DSA **a,const unsigned char **pp,
size_t length); long length);
#endif #endif
#ifndef OPENSSL_NO_EC #ifndef OPENSSL_NO_EC
int i2d_EC_PUBKEY(EC_KEY *a, unsigned char **pp); int i2d_EC_PUBKEY(EC_KEY *a, unsigned char **pp);
EC_KEY *d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp, EC_KEY *d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp,
size_t length); long length);
#endif #endif
DECLARE_ASN1_FUNCTIONS(X509_SIG) DECLARE_ASN1_FUNCTIONS(X509_SIG)
@ -863,8 +863,7 @@ int X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x);
X509_PKEY * X509_PKEY_new(void ); X509_PKEY * X509_PKEY_new(void );
void X509_PKEY_free(X509_PKEY *a); void X509_PKEY_free(X509_PKEY *a);
int i2d_X509_PKEY(X509_PKEY *a,unsigned char **pp); int i2d_X509_PKEY(X509_PKEY *a,unsigned char **pp);
X509_PKEY * d2i_X509_PKEY(X509_PKEY **a, const unsigned char **pp, X509_PKEY * d2i_X509_PKEY(X509_PKEY **a,const unsigned char **pp,long length);
size_t length);
DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKI) DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKI)
DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKAC) DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKAC)

View File

@ -108,7 +108,7 @@ static int getModulusAndExponent(const unsigned char *token, long *exponentLengt
/* RAND number functions */ /* RAND number functions */
/*-----------------------*/ /*-----------------------*/
static int cca_get_random_bytes(unsigned char*, size_t); static int cca_get_random_bytes(unsigned char*, int );
static int cca_random_status(void); static int cca_random_status(void);
#ifndef OPENSSL_NO_RSA #ifndef OPENSSL_NO_RSA
@ -927,7 +927,7 @@ static int cca_random_status(void)
return 1; return 1;
} }
static int cca_get_random_bytes(unsigned char* buf, size_t num) static int cca_get_random_bytes(unsigned char* buf, int num)
{ {
long ret_code; long ret_code;
long reason_code; long reason_code;

View File

@ -127,7 +127,7 @@ static int hwcrhk_mod_exp_dh(const DH *dh, BIGNUM *r,
#endif #endif
/* RAND stuff */ /* RAND stuff */
static int hwcrhk_rand_bytes(unsigned char *buf, size_t num); static int hwcrhk_rand_bytes(unsigned char *buf, int num);
static int hwcrhk_rand_status(void); static int hwcrhk_rand_status(void);
/* KM stuff */ /* KM stuff */
@ -1097,7 +1097,7 @@ static int hwcrhk_mod_exp_dh(const DH *dh, BIGNUM *r,
#endif #endif
/* Random bytes are good */ /* Random bytes are good */
static int hwcrhk_rand_bytes(unsigned char *buf, size_t num) static int hwcrhk_rand_bytes(unsigned char *buf, int num)
{ {
char tempbuf[1024]; char tempbuf[1024];
HWCryptoHook_ErrMsgBuf rmsg; HWCryptoHook_ErrMsgBuf rmsg;

View File

@ -141,7 +141,7 @@ static int cswift_mod_exp_dh(const DH *dh, BIGNUM *r,
#endif #endif
/* RAND stuff */ /* RAND stuff */
static int cswift_rand_bytes(unsigned char *buf, size_t num); static int cswift_rand_bytes(unsigned char *buf, int num);
static int cswift_rand_status(void); static int cswift_rand_status(void);
/* The definitions for control commands specific to this engine */ /* The definitions for control commands specific to this engine */
@ -1040,7 +1040,7 @@ static int cswift_mod_exp_dh(const DH *dh, BIGNUM *r,
#endif #endif
/* Random bytes are good */ /* Random bytes are good */
static int cswift_rand_bytes(unsigned char *buf, size_t num) static int cswift_rand_bytes(unsigned char *buf, int num)
{ {
SW_CONTEXT_HANDLE hac; SW_CONTEXT_HANDLE hac;
SW_STATUS swrc; SW_STATUS swrc;

View File

@ -96,9 +96,9 @@ static int surewarehk_rsa_sign(int flen,const unsigned char *from,unsigned char
#endif #endif
/* RAND stuff */ /* RAND stuff */
static int surewarehk_rand_bytes(unsigned char *buf, size_t num); static int surewarehk_rand_bytes(unsigned char *buf, int num);
static void surewarehk_rand_seed(const void *buf, size_t num); static void surewarehk_rand_seed(const void *buf, int num);
static void surewarehk_rand_add(const void *buf, size_t num, double entropy); static void surewarehk_rand_add(const void *buf, int num, double entropy);
/* KM stuff */ /* KM stuff */
static EVP_PKEY *surewarehk_load_privkey(ENGINE *e, const char *key_id, static EVP_PKEY *surewarehk_load_privkey(ENGINE *e, const char *key_id,
@ -613,7 +613,7 @@ static void surewarehk_error_handling(char *const msg,int func,int ret)
} }
} }
static int surewarehk_rand_bytes(unsigned char *buf, size_t num) static int surewarehk_rand_bytes(unsigned char *buf, int num)
{ {
int ret=0; int ret=0;
char msg[64]="ENGINE_rand_bytes"; char msg[64]="ENGINE_rand_bytes";
@ -629,7 +629,7 @@ static int surewarehk_rand_bytes(unsigned char *buf, size_t num)
return ret==1 ? 1 : 0; return ret==1 ? 1 : 0;
} }
static void surewarehk_rand_seed(const void *buf, size_t num) static void surewarehk_rand_seed(const void *buf, int num)
{ {
int ret=0; int ret=0;
char msg[64]="ENGINE_rand_seed"; char msg[64]="ENGINE_rand_seed";
@ -644,7 +644,7 @@ static void surewarehk_rand_seed(const void *buf, size_t num)
} }
} }
static void surewarehk_rand_add(const void *buf, size_t num, double entropy) static void surewarehk_rand_add(const void *buf, int num, double entropy)
{ {
surewarehk_rand_seed(buf,num); surewarehk_rand_seed(buf,num);
} }

View File

@ -204,13 +204,11 @@ int dtls1_enc(SSL *s, int send)
{ {
unsigned long ui; unsigned long ui;
printf("EVP_Cipher(ds=%p,rec->data=%p,rec->input=%p,l=%ld) ==>\n", printf("EVP_Cipher(ds=%p,rec->data=%p,rec->input=%p,l=%ld) ==>\n",
(void *)ds,rec->data,rec->input,l); ds,rec->data,rec->input,l);
printf("\tEVP_CIPHER_CTX: %ld buf_len, %ld key_len [%ld %ld], %ld iv_len\n", printf("\tEVP_CIPHER_CTX: %d buf_len, %d key_len [%d %d], %d iv_len\n",
(unsigned long)ds->buf_len, ds->buf_len, ds->cipher->key_len,
(unsigned long)ds->cipher->key_len, DES_KEY_SZ, DES_SCHEDULE_SZ,
(unsigned long)DES_KEY_SZ, ds->cipher->iv_len);
(unsigned long)DES_SCHEDULE_SZ,
(unsigned long)ds->cipher->iv_len);
printf("\t\tIV: "); printf("\t\tIV: ");
for (i=0; i<ds->cipher->iv_len; i++) printf("%02X", ds->iv[i]); for (i=0; i<ds->cipher->iv_len; i++) printf("%02X", ds->iv[i]);
printf("\n"); printf("\n");
@ -234,10 +232,10 @@ int dtls1_enc(SSL *s, int send)
#ifdef KSSL_DEBUG #ifdef KSSL_DEBUG
{ {
unsigned long ki; unsigned long i;
printf("\trec->data="); printf("\trec->data=");
for (ki=0; ki<l; i++) for (i=0; i<l; i++)
printf(" %02x", rec->data[ki]); printf("\n"); printf(" %02x", rec->data[i]); printf("\n");
} }
#endif /* KSSL_DEBUG */ #endif /* KSSL_DEBUG */

View File

@ -1034,7 +1034,7 @@ int ssl3_get_server_certificate(SSL *s)
? 0 : 1; ? 0 : 1;
#ifdef KSSL_DEBUG #ifdef KSSL_DEBUG
printf("pkey,x = %p, %p\n", (void *)pkey,(void *)x); printf("pkey,x = %p, %p\n", pkey,x);
printf("ssl_cert_type(x,pkey) = %d\n", ssl_cert_type(x,pkey)); printf("ssl_cert_type(x,pkey) = %d\n", ssl_cert_type(x,pkey));
printf("cipher, alg, nc = %s, %lx, %lx, %d\n", s->s3->tmp.new_cipher->name, printf("cipher, alg, nc = %s, %lx, %lx, %d\n", s->s3->tmp.new_cipher->name,
s->s3->tmp.new_cipher->algorithm_mkey, s->s3->tmp.new_cipher->algorithm_auth, need_cert); s->s3->tmp.new_cipher->algorithm_mkey, s->s3->tmp.new_cipher->algorithm_auth, need_cert);

View File

@ -1518,9 +1518,9 @@ int SSL_CTX_remove_session(SSL_CTX *,SSL_SESSION *c);
int SSL_CTX_set_generate_session_id(SSL_CTX *, GEN_SESSION_CB); int SSL_CTX_set_generate_session_id(SSL_CTX *, GEN_SESSION_CB);
int SSL_set_generate_session_id(SSL *, GEN_SESSION_CB); int SSL_set_generate_session_id(SSL *, GEN_SESSION_CB);
int SSL_has_matching_session_id(const SSL *ssl, const unsigned char *id, int SSL_has_matching_session_id(const SSL *ssl, const unsigned char *id,
size_t id_len); unsigned int id_len);
SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a,const unsigned char **pp, SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a,const unsigned char **pp,
size_t length); long length);
#ifdef HEADER_X509_H #ifdef HEADER_X509_H
X509 * SSL_get_peer_certificate(const SSL *s); X509 * SSL_get_peer_certificate(const SSL *s);

View File

@ -338,7 +338,7 @@ int i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp)
} }
SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp, SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp,
size_t length) long length)
{ {
int version,ssl_version=0,i; int version,ssl_version=0,i;
long id; long id;

View File

@ -432,7 +432,7 @@ int SSL_set_generate_session_id(SSL *ssl, GEN_SESSION_CB cb)
} }
int SSL_has_matching_session_id(const SSL *ssl, const unsigned char *id, int SSL_has_matching_session_id(const SSL *ssl, const unsigned char *id,
size_t id_len) unsigned int id_len)
{ {
/* A quick examination of SSL_SESSION_hash and SSL_SESSION_cmp shows how /* A quick examination of SSL_SESSION_hash and SSL_SESSION_cmp shows how
* we can "construct" a session to give us the desired check - ie. to * we can "construct" a session to give us the desired check - ie. to

View File

@ -311,16 +311,15 @@ int tls1_change_cipher_state(SSL *s, int which)
printf("\talg= %ld/%ld, comp= %p\n", printf("\talg= %ld/%ld, comp= %p\n",
s->s3->tmp.new_cipher->algorithm_mkey, s->s3->tmp.new_cipher->algorithm_mkey,
s->s3->tmp.new_cipher->algorithm_auth, s->s3->tmp.new_cipher->algorithm_auth,
(void *)comp); comp);
printf("\tevp_cipher == %p ==? &d_cbc_ede_cipher3\n", (void *)c); printf("\tevp_cipher == %p ==? &d_cbc_ede_cipher3\n", c);
printf("\tevp_cipher: nid, blksz= %d, %ld, keylen=%ld, ivlen=%ld\n", printf("\tevp_cipher: nid, blksz= %d, %d, keylen=%d, ivlen=%d\n",
c->nid,(unsigned long)c->block_size, c->nid,c->block_size,c->key_len,c->iv_len);
(unsigned long)c->key_len,(unsigned long)c->iv_len);
printf("\tkey_block: len= %d, data= ", s->s3->tmp.key_block_length); printf("\tkey_block: len= %d, data= ", s->s3->tmp.key_block_length);
{ {
int ki; int i;
for (ki=0; ki<s->s3->tmp.key_block_length; ki++) for (i=0; i<s->s3->tmp.key_block_length; i++)
printf("%02x", key_block[ki]); printf("\n"); printf("%02x", key_block[i]); printf("\n");
} }
#endif /* KSSL_DEBUG */ #endif /* KSSL_DEBUG */
@ -485,13 +484,11 @@ printf("which = %04X\nmac key=",which);
s->session->key_arg_length=0; s->session->key_arg_length=0;
#ifdef KSSL_DEBUG #ifdef KSSL_DEBUG
{ {
int ki; int i;
printf("EVP_CipherInit_ex(dd,c,key=,iv=,which)\n"); printf("EVP_CipherInit_ex(dd,c,key=,iv=,which)\n");
printf("\tkey= "); printf("\tkey= "); for (i=0; i<c->key_len; i++) printf("%02x", key[i]);
for (ki=0; ki<c->key_len; ki++) printf("%02x", key[ki]);
printf("\n"); printf("\n");
printf("\t iv= "); printf("\t iv= "); for (i=0; i<c->iv_len; i++) printf("%02x", iv[i]);
for (ki=0; ki<c->iv_len; ki++) printf("%02x", iv[ki]);
printf("\n"); printf("\n");
} }
#endif /* KSSL_DEBUG */ #endif /* KSSL_DEBUG */
@ -666,13 +663,11 @@ int tls1_enc(SSL *s, int send)
{ {
unsigned long ui; unsigned long ui;
printf("EVP_Cipher(ds=%p,rec->data=%p,rec->input=%p,l=%ld) ==>\n", printf("EVP_Cipher(ds=%p,rec->data=%p,rec->input=%p,l=%ld) ==>\n",
(void *)ds,rec->data,rec->input,l); ds,rec->data,rec->input,l);
printf("\tEVP_CIPHER_CTX: %ld buf_len, %ld key_len [%ld %ld], %ld iv_len\n", printf("\tEVP_CIPHER_CTX: %d buf_len, %d key_len [%d %d], %d iv_len\n",
(unsigned long)ds->buf_len, ds->buf_len, ds->cipher->key_len,
(unsigned long)ds->cipher->key_len, DES_KEY_SZ, DES_SCHEDULE_SZ,
(unsigned long)DES_KEY_SZ, ds->cipher->iv_len);
(unsigned long)DES_SCHEDULE_SZ,
(unsigned long)ds->cipher->iv_len);
printf("\t\tIV: "); printf("\t\tIV: ");
for (i=0; i<ds->cipher->iv_len; i++) printf("%02X", ds->iv[i]); for (i=0; i<ds->cipher->iv_len; i++) printf("%02X", ds->iv[i]);
printf("\n"); printf("\n");
@ -696,10 +691,10 @@ int tls1_enc(SSL *s, int send)
#ifdef KSSL_DEBUG #ifdef KSSL_DEBUG
{ {
unsigned long ki; unsigned long i;
printf("\trec->data="); printf("\trec->data=");
for (ki=0; ki<l; i++) for (i=0; i<l; i++)
printf(" %02x", rec->data[ki]); printf("\n"); printf(" %02x", rec->data[i]); printf("\n");
} }
#endif /* KSSL_DEBUG */ #endif /* KSSL_DEBUG */
@ -922,7 +917,7 @@ int tls1_generate_master_secret(SSL *s, unsigned char *out, unsigned char *p,
int col = 0, sol = 0; int col = 0, sol = 0;
#ifdef KSSL_DEBUG #ifdef KSSL_DEBUG
printf ("tls1_generate_master_secret(%p,%p, %p, %d)\n", (void *)s,out, p,len); printf ("tls1_generate_master_secret(%p,%p, %p, %d)\n", s,out, p,len);
#endif /* KSSL_DEBUG */ #endif /* KSSL_DEBUG */
#ifdef TLSEXT_TYPE_opaque_prf_input #ifdef TLSEXT_TYPE_opaque_prf_input