提交 5e4430e7 编写于 作者: B Ben Laurie

More size_tification.

上级 4d6e1e4f
......@@ -65,11 +65,12 @@ int ASN1_PRINTABLE_type(const unsigned char *s, size_t len)
int c;
int ia5=0;
int t61=0;
int ignore_len = 0;
if (len <= 0) len= -1;
if (len == 0) ignore_len = 1;
if (s == NULL) return(V_ASN1_PRINTABLESTRING);
while ((*s) && (len-- != 0))
while (*s && !ignore_len && len-- != 0)
{
c= *(s++);
#ifndef CHARSET_EBCDIC
......
......@@ -65,7 +65,7 @@
typedef struct
{
unsigned char *pbData;
int cbData;
size_t cbData;
} MYBLOB;
/* 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 i2d_ASN1_SET(STACK_OF(BLOCK) *a, unsigned char **pp,
i2d_of_void *i2d, int ex_tag, int ex_class,
int is_set)
size_t i2d_ASN1_SET(STACK_OF(BLOCK) *a, unsigned char **pp,
i2d_of_void *i2d, int ex_tag, int ex_class,
int is_set)
{
int ret=0,r;
size_t ret=0,r;
int i;
unsigned char *p;
unsigned char *pStart, *pTempMem;
......
......@@ -416,13 +416,13 @@ void EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth,
void EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth,
int (*param_decode)(EVP_PKEY *pkey,
const unsigned char **pder, int derlen),
const unsigned char **pder, size_t derlen),
int (*param_encode)(const EVP_PKEY *pkey, unsigned char **pder),
int (*param_missing)(const EVP_PKEY *pk),
int (*param_copy)(EVP_PKEY *to, const EVP_PKEY *from),
int (*param_cmp)(const EVP_PKEY *a, const EVP_PKEY *b),
int (*param_print)(BIO *out, const EVP_PKEY *pkey, int indent,
ASN1_PCTX *pctx))
ASN1_PCTX *pctx))
{
ameth->param_decode = param_decode;
ameth->param_encode = param_encode;
......
......@@ -310,12 +310,12 @@ typedef struct ASN1_VALUE_st ASN1_VALUE;
DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name)
#define DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \
type *d2i_##name(type **a, const unsigned char **in, long len); \
type *d2i_##name(type **a, const unsigned char **in, size_t len); \
int i2d_##name(type *a, unsigned char **out); \
DECLARE_ASN1_ITEM(itname)
#define DECLARE_ASN1_ENCODE_FUNCTIONS_const(type, name) \
type *d2i_##name(type **a, const unsigned char **in, long len); \
type *d2i_##name(type **a, const unsigned char **in, size_t len); \
int i2d_##name(const type *a, unsigned char **out); \
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, \
const ASN1_PCTX *pctx);
#define D2I_OF(type) type *(*)(type **,const unsigned char **,long)
#define D2I_OF(type) type *(*)(type **,const unsigned char **,size_t)
#define I2D_OF(type) int (*)(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) \
((void**) (1 ? p : (type**)0))
#define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const unsigned char **,long)
#define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const unsigned char **,size_t)
#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)
......@@ -887,9 +887,9 @@ ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s,time_t t,
int ASN1_TIME_check(ASN1_TIME *t);
ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out);
int i2d_ASN1_SET(STACK_OF(BLOCK) *a, unsigned char **pp,
i2d_of_void *i2d, int ex_tag, int ex_class,
int is_set);
size_t i2d_ASN1_SET(STACK_OF(BLOCK) *a, unsigned char **pp,
i2d_of_void *i2d, int ex_tag, int ex_class,
int is_set);
STACK_OF(BLOCK) *d2i_ASN1_SET(STACK_OF(BLOCK) **a, const unsigned char **pp,
size_t length, d2i_of_void *d2i,
void (*free_func)(BLOCK), int ex_tag,
......
......@@ -315,7 +315,7 @@ int asn1_const_Finish(ASN1_const_CTX *c)
return _asn1_Finish(c);
}
int asn1_GetSequence(ASN1_const_CTX *c, long *length)
int asn1_GetSequence(ASN1_const_CTX *c, size_t *length)
{
const unsigned char *q;
......
......@@ -84,24 +84,24 @@ struct evp_pkey_asn1_method_st
int (*pub_encode)(X509_PUBKEY *pub, const EVP_PKEY *pk);
int (*pub_cmp)(const EVP_PKEY *a, const EVP_PKEY *b);
int (*pub_print)(BIO *out, const EVP_PKEY *pkey, int indent,
ASN1_PCTX *pctx);
ASN1_PCTX *pctx);
int (*priv_decode)(EVP_PKEY *pk, PKCS8_PRIV_KEY_INFO *p8inf);
int (*priv_encode)(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pk);
int (*priv_print)(BIO *out, const EVP_PKEY *pkey, int indent,
ASN1_PCTX *pctx);
ASN1_PCTX *pctx);
int (*pkey_size)(const EVP_PKEY *pk);
int (*pkey_bits)(const EVP_PKEY *pk);
int (*param_decode)(EVP_PKEY *pkey,
const unsigned char **pder, int derlen);
const unsigned char **pder, size_t derlen);
int (*param_encode)(const EVP_PKEY *pkey, unsigned char **pder);
int (*param_missing)(const EVP_PKEY *pk);
int (*param_copy)(EVP_PKEY *to, const EVP_PKEY *from);
int (*param_cmp)(const EVP_PKEY *a, const EVP_PKEY *b);
int (*param_print)(BIO *out, const EVP_PKEY *pkey, int indent,
ASN1_PCTX *pctx);
ASN1_PCTX *pctx);
void (*pkey_free)(EVP_PKEY *pkey);
int (*pkey_ctrl)(EVP_PKEY *pkey, int op, long arg1, void *arg2);
......@@ -109,7 +109,7 @@ struct evp_pkey_asn1_method_st
/* Legacy functions for old PEM */
int (*old_priv_decode)(EVP_PKEY *pkey,
const unsigned char **pder, int derlen);
const unsigned char **pder, size_t derlen);
int (*old_priv_encode)(const EVP_PKEY *pkey, unsigned char **pder);
} /* EVP_PKEY_ASN1_METHOD */;
......
......@@ -569,8 +569,8 @@ err:\
#define M_ASN1_I2D_finish() *pp=p; \
return(r);
int asn1_GetSequence(ASN1_const_CTX *c, long *length);
void asn1_add_error(const unsigned char *address,int offset);
int asn1_GetSequence(ASN1_const_CTX *c, size_t *length);
void asn1_add_error(const unsigned char *address, int offset);
#ifdef __cplusplus
}
#endif
......
......@@ -856,7 +856,7 @@ typedef struct ASN1_STREAM_ARG_st {
IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname)
#define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \
stname *d2i_##fname(stname **a, const unsigned char **in, long len) \
stname *d2i_##fname(stname **a, const unsigned char **in, size_t len) \
{ \
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.
*/
#define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \
stname *d2i_##fname(stname **a, const unsigned char **in, long len) \
stname *d2i_##fname(stname **a, const unsigned char **in, size_t len) \
{ \
return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
} \
......
......@@ -128,7 +128,7 @@ err:
/* This works like d2i_PrivateKey() except it automatically works out the type */
EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp,
long length)
size_t length)
{
STACK_OF(ASN1_TYPE) *inkey;
const unsigned char *p;
......
......@@ -73,7 +73,7 @@
#endif
EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp,
long length)
size_t length)
{
EVP_PKEY *ret;
......
......@@ -142,7 +142,7 @@ int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a, long *num, unsigned char *data,
ASN1_INTEGER *ai=NULL;
ASN1_OCTET_STRING *os=NULL;
const unsigned char *p;
long length;
size_t length;
ASN1_const_CTX c;
if ((a->type != V_ASN1_SEQUENCE) || (a->value.sequence == NULL))
......
......@@ -69,7 +69,7 @@ int i2d_X509_PKEY(X509_PKEY *a, unsigned char **pp)
return(0);
}
X509_PKEY *d2i_X509_PKEY(X509_PKEY **a, const unsigned char **pp, long length)
X509_PKEY *d2i_X509_PKEY(X509_PKEY **a, const unsigned char **pp, size_t length)
{
int i;
M_ASN1_D2I_vars(a,X509_PKEY *,X509_PKEY_new);
......
......@@ -187,7 +187,7 @@ EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
*/
EVP_PKEY *d2i_PUBKEY(EVP_PKEY **a, const unsigned char **pp,
long length)
size_t length)
{
X509_PUBKEY *xpk;
EVP_PKEY *pktmp;
......@@ -220,7 +220,7 @@ int i2d_PUBKEY(EVP_PKEY *a, unsigned char **pp)
*/
#ifndef OPENSSL_NO_RSA
RSA *d2i_RSA_PUBKEY(RSA **a, const unsigned char **pp,
long length)
size_t length)
{
EVP_PKEY *pkey;
RSA *key;
......@@ -260,7 +260,7 @@ int i2d_RSA_PUBKEY(RSA *a, unsigned char **pp)
#ifndef OPENSSL_NO_DSA
DSA *d2i_DSA_PUBKEY(DSA **a, const unsigned char **pp,
long length)
size_t length)
{
EVP_PKEY *pkey;
DSA *key;
......@@ -299,7 +299,7 @@ int i2d_DSA_PUBKEY(DSA *a, unsigned char **pp)
#endif
#ifndef OPENSSL_NO_EC
EC_KEY *d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp, long length)
EC_KEY *d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp, size_t length)
{
EVP_PKEY *pkey;
EC_KEY *key;
......
......@@ -62,7 +62,7 @@
#include "bf_locl.h"
#include "bf_pi.h"
void BF_set_key(BF_KEY *key, int len, const unsigned char *data)
void BF_set_key(BF_KEY *key, size_t len, const unsigned char *data)
{
int i;
BF_LONG *p,ri,in[2];
......
......@@ -60,6 +60,7 @@
#define HEADER_BLOWFISH_H
#include <openssl/e_os2.h>
#include <unistd.h>
#ifdef __cplusplus
extern "C" {
......@@ -105,7 +106,7 @@ typedef struct bf_key_st
} BF_KEY;
void BF_set_key(BF_KEY *key, int len, const unsigned char *data);
void BF_set_key(BF_KEY *key, size_t len, const unsigned char *data);
void BF_encrypt(BF_LONG *data,const BF_KEY *key);
void BF_decrypt(BF_LONG *data,const BF_KEY *key);
......
......@@ -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_generate_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, long length);
DH * d2i_DHparams(DH **a,const unsigned char **pp, size_t length);
int i2d_DHparams(const DH *a,unsigned char **pp);
#ifndef OPENSSL_NO_FP_API
int DHparams_print_fp(FILE *fp, const DH *x);
......
......@@ -296,7 +296,7 @@ static void update_buflen(const BIGNUM *b, size_t *pbuflen)
}
static int dh_param_decode(EVP_PKEY *pkey,
const unsigned char **pder, int derlen)
const unsigned char **pder, size_t derlen)
{
DH *dh;
if (!(dh = d2i_DHparams(NULL, pder, derlen)))
......
......@@ -177,7 +177,7 @@ struct dsa_st
DSA_SIG * DSA_SIG_new(void);
void DSA_SIG_free(DSA_SIG *a);
int i2d_DSA_SIG(const DSA_SIG *a, unsigned char **pp);
DSA_SIG * d2i_DSA_SIG(DSA_SIG **v, const unsigned char **pp, long length);
DSA_SIG * d2i_DSA_SIG(DSA_SIG **v, const unsigned char **pp, size_t length);
DSA_SIG * DSA_do_sign(const unsigned char *dgst,int dlen,DSA *dsa);
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);
void *DSA_get_ex_data(DSA *d, int idx);
DSA * d2i_DSAPublicKey(DSA **a, const unsigned char **pp, long length);
DSA * d2i_DSAPrivateKey(DSA **a, const unsigned char **pp, long length);
DSA * d2i_DSAparams(DSA **a, const unsigned char **pp, long length);
DSA * d2i_DSAPublicKey(DSA **a, const unsigned char **pp, size_t length);
DSA * d2i_DSAPrivateKey(DSA **a, const unsigned char **pp, size_t length);
DSA * d2i_DSAparams(DSA **a, const unsigned char **pp, size_t length);
/* Deprecated version */
#ifndef OPENSSL_NO_DEPRECATED
......
......@@ -480,7 +480,7 @@ err:
}
static int dsa_param_decode(EVP_PKEY *pkey,
const unsigned char **pder, int derlen)
const unsigned char **pder, size_t derlen)
{
DSA *dsa;
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,
const unsigned char **pder, int derlen)
const unsigned char **pder, size_t derlen)
{
DSA *dsa;
if (!(dsa = d2i_DSAPrivateKey (NULL, pder, derlen)))
......
......@@ -661,7 +661,7 @@ int EC_GROUP_get_pentanomial_basis(const EC_GROUP *, unsigned int *k1,
typedef struct ecpk_parameters_st ECPKPARAMETERS;
EC_GROUP *d2i_ECPKParameters(EC_GROUP **, const unsigned char **in, long len);
EC_GROUP *d2i_ECPKParameters(EC_GROUP **, const unsigned char **in, size_t len);
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)
......@@ -810,7 +810,7 @@ int EC_KEY_check_key(const EC_KEY *key);
* \param len length of the DER encoded private key
* \return the decoded private key or NULL if an error occurred.
*/
EC_KEY *d2i_ECPrivateKey(EC_KEY **key, const unsigned char **in, long len);
EC_KEY *d2i_ECPrivateKey(EC_KEY **key, const unsigned char **in, size_t len);
/** Encodes a private key object and stores the result in a buffer.
* \param key the EC_KEY object to encode
......
......@@ -520,7 +520,7 @@ err:
}
static int eckey_param_decode(EVP_PKEY *pkey,
const unsigned char **pder, int derlen)
const unsigned char **pder, size_t derlen)
{
EC_KEY *eckey;
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,
const unsigned char **pder, int derlen)
const unsigned char **pder, size_t derlen)
{
EC_KEY *ec;
if (!(ec = d2i_ECPrivateKey (NULL, pder, derlen)))
......
......@@ -1050,7 +1050,7 @@ EC_GROUP *ec_asn1_pkparameters2group(const ECPKPARAMETERS *params)
/* EC_GROUP <-> DER encoding of ECPKPARAMETERS */
EC_GROUP *d2i_ECPKParameters(EC_GROUP **a, const unsigned char **in, long len)
EC_GROUP *d2i_ECPKParameters(EC_GROUP **a, const unsigned char **in, size_t len)
{
EC_GROUP *group = NULL;
ECPKPARAMETERS *params = NULL;
......@@ -1099,7 +1099,7 @@ int i2d_ECPKParameters(const EC_GROUP *a, unsigned char **out)
/* some EC_KEY functions */
EC_KEY *d2i_ECPrivateKey(EC_KEY **a, const unsigned char **in, long len)
EC_KEY *d2i_ECPrivateKey(EC_KEY **a, const unsigned char **in, size_t len)
{
int ok=0;
EC_KEY *ret=NULL;
......
......@@ -106,7 +106,7 @@ int i2d_ECDSA_SIG(const ECDSA_SIG *sig, unsigned char **pp);
* \param len length of the buffer
* \return pointer to the decoded ECDSA_SIG structure (or NULL)
*/
ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **sig, const unsigned char **pp, long len);
ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **sig, const unsigned char **pp, size_t len);
/** Computes the ECDSA signature of the given hash value using
* the supplied private key and returns the created signature.
......
......@@ -105,7 +105,7 @@ int test_builtin(BIO *);
/* functions to change the RAND_METHOD */
int change_rand(void);
int restore_rand(void);
int fbytes(unsigned char *buf, int num);
int fbytes(unsigned char *buf, size_t num);
RAND_METHOD fake_rand;
const RAND_METHOD *old_rand;
......@@ -152,7 +152,7 @@ static const char *numbers[8] = {
"1712787255652165239672857892369562652652652356758119494040"
"40041670216363"};
int fbytes(unsigned char *buf, int num)
int fbytes(unsigned char *buf, size_t num)
{
int ret;
BIGNUM *tmp = NULL;
......
......@@ -129,14 +129,14 @@ void EVP_EncodeInit(EVP_ENCODE_CTX *ctx)
}
void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,
const unsigned char *in, int inl)
const unsigned char *in, size_t inl)
{
int i,j;
size_t i,j;
unsigned int total=0;
*outl=0;
if (inl == 0) return;
OPENSSL_assert(ctx->length <= (int)sizeof(ctx->enc_data));
OPENSSL_assert(ctx->length <= sizeof(ctx->enc_data));
if ((ctx->num+inl) < ctx->length)
{
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;
}
int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int dlen)
int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, size_t dlen)
{
int i,ret=0;
unsigned long l;
......@@ -233,9 +233,10 @@ void EVP_DecodeInit(EVP_ENCODE_CTX *ctx)
* 1 for full line
*/
int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,
const unsigned char *in, int inl)
const unsigned char *in, size_t inl)
{
int seof= -1,eof=0,rv= -1,ret=0,i,v,tmp,n,ln,tmp2,exp_nl;
int seof= -1,eof=0,rv= -1,ret=0,i,v,tmp,ln,tmp2,exp_nl;
size_t n;
unsigned char *d;
n=ctx->num;
......@@ -356,7 +357,7 @@ end:
return(rv);
}
int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n)
int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, size_t n)
{
int i,ret=0,a,b,c,d;
unsigned long l;
......
......@@ -160,7 +160,7 @@ struct env_md_st
{
int type;
int pkey_type;
int md_size;
size_t md_size;
unsigned long flags;
int (*init)(EVP_MD_CTX *ctx);
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,
void *key);
int required_pkey_type[5]; /*EVP_PKEY_xxx */
int block_size;
int ctx_size; /* how big does the ctx->md_data need to be */
size_t block_size;
size_t ctx_size; /* how big does the ctx->md_data need to be */
/* control function */
int (*md_ctrl)(EVP_MD_CTX *ctx, int cmd, int p1, void *p2);
} /* EVP_MD */;
......@@ -292,16 +292,16 @@ struct env_md_ctx_st
struct evp_cipher_st
{
int nid;
int block_size;
int key_len; /* Default value for variable length ciphers */
int iv_len;
size_t block_size;
size_t key_len; /* Default value for variable length ciphers */
size_t iv_len;
unsigned long flags; /* Various flags */
int (*init)(EVP_CIPHER_CTX *ctx, const unsigned char *key,
const unsigned char *iv, int enc); /* init key */
int (*do_cipher)(EVP_CIPHER_CTX *ctx, unsigned char *out,
const unsigned char *in, size_t inl);/* encrypt/decrypt data */
int (*cleanup)(EVP_CIPHER_CTX *); /* cleanup ctx */
int ctx_size; /* how big ctx->cipher_data needs to be */
size_t 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 (*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 */
......@@ -355,7 +355,7 @@ struct evp_cipher_ctx_st
const EVP_CIPHER *cipher;
ENGINE *engine; /* functional reference if 'cipher' is ENGINE-provided */
int encrypt; /* encrypt or decrypt */
int buf_len; /* number we have left */
size_t buf_len; /* number we have left */
unsigned char oiv[EVP_MAX_IV_LENGTH]; /* original 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 */
void *app_data; /* application stuff */
int key_len; /* May change for variable length cipher */
size_t key_len; /* May change for variable length cipher */
unsigned long flags; /* Various flags */
void *cipher_data; /* per EVP data */
int final_used;
size_t final_used;
int block_mask;
unsigned char final[EVP_MAX_BLOCK_LENGTH];/* possible final block */
} /* EVP_CIPHER_CTX */;
typedef struct evp_Encode_Ctx_st
{
int num; /* number saved in a partial encode/decode */
int length; /* The length is either the output line length
size_t num; /* number saved in a partial encode/decode */
size_t length; /* The length is either the output line length
* (in input bytes) or the shortest input line
* length that is ok. Once decoding begins,
* 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_name(e) OBJ_nid2sn(EVP_MD_nid(e))
int EVP_MD_pkey_type(const EVP_MD *md);
int EVP_MD_size(const EVP_MD *md);
int EVP_MD_block_size(const EVP_MD *md);
size_t EVP_MD_size(const EVP_MD *md);
size_t EVP_MD_block_size(const EVP_MD *md);
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))
......@@ -429,17 +429,17 @@ const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx);
int EVP_CIPHER_nid(const EVP_CIPHER *cipher);
#define EVP_CIPHER_name(e) OBJ_nid2sn(EVP_CIPHER_nid(e))
int EVP_CIPHER_block_size(const EVP_CIPHER *cipher);
int EVP_CIPHER_key_length(const EVP_CIPHER *cipher);
int EVP_CIPHER_iv_length(const EVP_CIPHER *cipher);
size_t EVP_CIPHER_block_size(const EVP_CIPHER *cipher);
size_t EVP_CIPHER_key_length(const EVP_CIPHER *cipher);
size_t EVP_CIPHER_iv_length(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)
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_block_size(const EVP_CIPHER_CTX *ctx);
int EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx);
int EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx);
size_t EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx);
size_t EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx);
size_t 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_set_app_data(EVP_CIPHER_CTX *ctx, void *data);
#define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c))
......@@ -471,10 +471,8 @@ 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_ctx(b,c_pp) BIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0,(char *)c_pp)
int EVP_Cipher(EVP_CIPHER_CTX *c,
unsigned char *out,
const unsigned char *in,
unsigned int inl);
size_t EVP_Cipher(EVP_CIPHER_CTX *c, unsigned char *out,
const unsigned char *in, size_t inl);
#define EVP_add_cipher_alias(n,alias) \
OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
......@@ -510,25 +508,27 @@ char * EVP_get_pw_prompt(void);
int EVP_BytesToKey(const EVP_CIPHER *type,const EVP_MD *md,
const unsigned char *salt, const unsigned char *data,
int datal, int count, unsigned char *key,unsigned char *iv);
size_t datal, int count, unsigned char *key,unsigned char *iv);
int EVP_EncryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher,
const unsigned char *key, const unsigned char *iv);
int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl,
const unsigned char *key, const unsigned char *iv);
int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
int *outl, const unsigned char *in, int inl);
int *outl, const unsigned char *in, size_t inl);
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_DecryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher,
const unsigned char *key, const unsigned char *iv);
int EVP_DecryptInit_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_DecryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher,
ENGINE *impl, const unsigned char *key,
const unsigned char *iv);
int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
int *outl, const unsigned char *in, int inl);
int *outl, const unsigned char *in, size_t inl);
int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);
int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);
int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm,
int *outl);
int EVP_CipherInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher,
const unsigned char *key,const unsigned char *iv,
......@@ -537,54 +537,53 @@ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl
const unsigned char *key,const unsigned char *iv,
int enc);
int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
int *outl, const unsigned char *in, int inl);
int *outl, const unsigned char *in, size_t inl);
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_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,
unsigned int siglen,EVP_PKEY *pkey);
size_t siglen,EVP_PKEY *pkey);
int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey);
int EVP_DigestSignFinal(EVP_MD_CTX *ctx,
unsigned char *sigret, size_t *siglen);
unsigned char *sigret, size_t *siglen);
int EVP_DigestVerifyInit(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);
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,
const unsigned char *ek, int ekl, const unsigned char *iv,
EVP_PKEY *priv);
const unsigned char *ek, size_t ekl,
const unsigned char *iv, EVP_PKEY *priv);
int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,
unsigned char **ek, int *ekl, unsigned char *iv,
EVP_PKEY **pubk, int npubk);
int EVP_SealFinal(EVP_CIPHER_CTX *ctx,unsigned char *out,int *outl);
unsigned char **ek, int *ekl, unsigned char *iv,
EVP_PKEY **pubk, int npubk);
int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
void EVP_EncodeInit(EVP_ENCODE_CTX *ctx);
void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl,
const unsigned char *in,int inl);
void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl);
int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int n);
void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,
const unsigned char *in, size_t inl);
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);
void EVP_DecodeInit(EVP_ENCODE_CTX *ctx);
int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl,
const unsigned char *in, int inl);
int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned
char *out, int *outl);
int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n);
const unsigned char *in, size_t inl);
int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl);
int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, size_t n);
void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a);
int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a);
EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void);
void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *a);
int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen);
int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, size_t keylen);
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_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key);
......@@ -850,13 +849,13 @@ EVP_PKEY * EVP_PKEY_new(void);
void EVP_PKEY_free(EVP_PKEY *pkey);
EVP_PKEY * d2i_PublicKey(int type,EVP_PKEY **a, const unsigned char **pp,
long length);
size_t length);
int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp);
EVP_PKEY * d2i_PrivateKey(int type,EVP_PKEY **a, const unsigned char **pp,
long length);
EVP_PKEY * d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp,
long length);
size_t length);
int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp);
int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from);
......@@ -962,13 +961,13 @@ void EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth,
ASN1_PCTX *pctx));
void EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth,
int (*param_decode)(EVP_PKEY *pkey,
const unsigned char **pder, int derlen),
const unsigned char **pder, size_t derlen),
int (*param_encode)(const EVP_PKEY *pkey, unsigned char **pder),
int (*param_missing)(const EVP_PKEY *pk),
int (*param_copy)(EVP_PKEY *to, const EVP_PKEY *from),
int (*param_cmp)(const EVP_PKEY *a, const EVP_PKEY *b),
int (*param_print)(BIO *out, const EVP_PKEY *pkey, int indent,
ASN1_PCTX *pctx));
ASN1_PCTX *pctx));
void EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth,
void (*pkey_free)(EVP_PKEY *pkey));
......
......@@ -209,7 +209,8 @@ skip_to_init:
OPENSSL_assert(EVP_CIPHER_CTX_iv_length(ctx) <=
(int)sizeof(ctx->iv));
if(iv) memcpy(ctx->oiv, iv, EVP_CIPHER_CTX_iv_length(ctx));
if(iv) memcpy(ctx->oiv, iv,
EVP_CIPHER_CTX_iv_length(ctx));
memcpy(ctx->iv, ctx->oiv, EVP_CIPHER_CTX_iv_length(ctx));
break;
......@@ -229,7 +230,7 @@ skip_to_init:
}
int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
const unsigned char *in, int inl)
const unsigned char *in, size_t inl)
{
if (ctx->encrypt)
return EVP_EncryptUpdate(ctx,out,outl,in,inl);
......@@ -275,9 +276,11 @@ 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,
const unsigned char *in, int inl)
const unsigned char *in, size_t inl)
{
int i,j,bl;
size_t i;
size_t bl;
size_t j;
if (inl <= 0)
{
......@@ -381,7 +384,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,
const unsigned char *in, int inl)
const unsigned char *in, size_t inl)
{
int fix_len;
unsigned int b;
......@@ -515,10 +518,10 @@ int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *c)
return 1;
}
int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *c, int keylen)
int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *c, size_t keylen)
{
if(c->cipher->flags & EVP_CIPH_CUSTOM_KEY_LENGTH)
return EVP_CIPHER_CTX_ctrl(c, EVP_CTRL_SET_KEY_LENGTH, keylen, NULL);
return EVP_CIPHER_CTX_ctrl(c, EVP_CTRL_SET_KEY_LENGTH, (int)keylen, NULL);
if(c->key_len == keylen) return 1;
if((keylen > 0) && (c->cipher->flags & EVP_CIPH_VARIABLE_LENGTH))
{
......
......@@ -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,
const unsigned char *salt, const unsigned char *data, int datal,
const unsigned char *salt, const unsigned char *data, size_t datal,
int count, unsigned char *key, unsigned char *iv)
{
EVP_MD_CTX c;
......
......@@ -168,17 +168,18 @@ int EVP_CIPHER_type(const EVP_CIPHER *ctx)
}
}
int EVP_CIPHER_block_size(const EVP_CIPHER *e)
size_t EVP_CIPHER_block_size(const EVP_CIPHER *e)
{
return e->block_size;
}
int EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx)
size_t EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx)
{
return ctx->cipher->block_size;
}
int EVP_Cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl)
size_t EVP_Cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
const unsigned char *in, size_t inl)
{
return ctx->cipher->do_cipher(ctx,out,in,inl);
}
......@@ -208,22 +209,22 @@ void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data)
ctx->app_data = data;
}
int EVP_CIPHER_iv_length(const EVP_CIPHER *cipher)
size_t EVP_CIPHER_iv_length(const EVP_CIPHER *cipher)
{
return cipher->iv_len;
}
int EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx)
size_t EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx)
{
return ctx->cipher->iv_len;
}
int EVP_CIPHER_key_length(const EVP_CIPHER *cipher)
size_t EVP_CIPHER_key_length(const EVP_CIPHER *cipher)
{
return cipher->key_len;
}
int EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx)
size_t EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx)
{
return ctx->key_len;
}
......@@ -238,7 +239,7 @@ int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx)
return ctx->cipher->nid;
}
int EVP_MD_block_size(const EVP_MD *md)
size_t EVP_MD_block_size(const EVP_MD *md)
{
return md->block_size;
}
......@@ -253,7 +254,7 @@ int EVP_MD_pkey_type(const EVP_MD *md)
return md->pkey_type;
}
int EVP_MD_size(const EVP_MD *md)
size_t EVP_MD_size(const EVP_MD *md)
{
if (!md)
return -1;
......
......@@ -67,8 +67,8 @@
#include <openssl/rsa.h>
int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,
const unsigned char *ek, int ekl, const unsigned char *iv,
EVP_PKEY *priv)
const unsigned char *ek, size_t ekl, const unsigned char *iv,
EVP_PKEY *priv)
{
unsigned char *key=NULL;
int i,size=0,ret=0;
......
......@@ -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,
const unsigned char **pder, int derlen)
const unsigned char **pder, size_t derlen)
{
ASN1_OCTET_STRING *os;
os = ASN1_OCTET_STRING_new();
......
......@@ -61,7 +61,7 @@
#include "cryptlib.h"
#include <openssl/hmac.h>
void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, size_t len,
const EVP_MD *md, ENGINE *impl)
{
int i,j,reset=0;
......@@ -113,8 +113,7 @@ void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
EVP_MD_CTX_copy_ex(&ctx->md_ctx,&ctx->i_ctx);
}
void HMAC_Init(HMAC_CTX *ctx, const void *key, int len,
const EVP_MD *md)
void HMAC_Init(HMAC_CTX *ctx, const void *key, size_t len, const EVP_MD *md)
{
if(key && md)
HMAC_CTX_init(ctx);
......@@ -165,7 +164,7 @@ void HMAC_CTX_cleanup(HMAC_CTX *ctx)
memset(ctx,0,sizeof *ctx);
}
unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len,
unsigned char *HMAC(const EVP_MD *evp_md, const void *key, size_t key_len,
const unsigned char *d, size_t n, unsigned char *md,
unsigned int *md_len)
{
......
......@@ -90,13 +90,13 @@ void HMAC_CTX_cleanup(HMAC_CTX *ctx);
#define HMAC_cleanup(ctx) HMAC_CTX_cleanup(ctx) /* deprecated */
void HMAC_Init(HMAC_CTX *ctx, const void *key, int len,
void HMAC_Init(HMAC_CTX *ctx, const void *key, size_t len,
const EVP_MD *md); /* deprecated */
void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, size_t len,
const EVP_MD *md, ENGINE *impl);
void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len);
void HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len);
unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len,
unsigned char *HMAC(const EVP_MD *evp_md, const void *key, size_t key_len,
const unsigned char *d, size_t n, unsigned char *md,
unsigned int *md_len);
void HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx);
......
......@@ -65,7 +65,7 @@
ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o)
{
ASN1_OBJECT *r;
int i;
size_t i;
char *ln=NULL,*sn=NULL;
unsigned char *data=NULL;
......
......@@ -71,7 +71,8 @@
#endif
#ifndef OPENSSL_NO_FP_API
STACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u)
STACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk,
pem_password_cb *cb, void *u)
{
BIO *b;
STACK_OF(X509_INFO) *ret;
......@@ -88,7 +89,8 @@ STACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, pem_p
}
#endif
STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u)
STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk,
pem_password_cb *cb, void *u)
{
X509_INFO *xi=NULL;
char *name=NULL,*header=NULL;
......
......@@ -155,10 +155,10 @@ int rand_predictable=0;
const char RAND_version[]="RAND" OPENSSL_VERSION_PTEXT;
static void ssleay_rand_cleanup(void);
static void ssleay_rand_seed(const void *buf, int num);
static void ssleay_rand_add(const void *buf, int num, double add_entropy);
static int ssleay_rand_bytes(unsigned char *buf, int num);
static int ssleay_rand_pseudo_bytes(unsigned char *buf, int num);
static void ssleay_rand_seed(const void *buf, size_t num);
static void ssleay_rand_add(const void *buf, size_t num, double add_entropy);
static int ssleay_rand_bytes(unsigned char *buf, size_t num);
static int ssleay_rand_pseudo_bytes(unsigned char *buf, size_t num);
static int ssleay_rand_status(void);
RAND_METHOD rand_ssleay_meth={
......@@ -187,9 +187,10 @@ static void ssleay_rand_cleanup(void)
initialized=0;
}
static void ssleay_rand_add(const void *buf, int num, double add)
static void ssleay_rand_add(const void *buf, size_t num, double add)
{
int i,j,k,st_idx;
int i,st_idx;
size_t j,k;
long md_c[2];
unsigned char local_md[MD_DIGEST_LENGTH];
EVP_MD_CTX m;
......@@ -315,15 +316,16 @@ static void ssleay_rand_add(const void *buf, int num, double add)
#endif
}
static void ssleay_rand_seed(const void *buf, int num)
static void ssleay_rand_seed(const void *buf, size_t num)
{
ssleay_rand_add(buf, num, (double)num);
}
static int ssleay_rand_bytes(unsigned char *buf, int num)
static int ssleay_rand_bytes(unsigned char *buf, size_t num)
{
static volatile int stirred_pool = 0;
int i,j,k,st_num,st_idx;
int i,st_num,st_idx;
size_t j,k;
int num_ceil;
int ok;
long md_c[2];
......@@ -511,7 +513,7 @@ static int ssleay_rand_bytes(unsigned char *buf, int num)
/* pseudo-random bytes that are guaranteed to be unique but not
unpredictable */
static int ssleay_rand_pseudo_bytes(unsigned char *buf, int num)
static int ssleay_rand_pseudo_bytes(unsigned char *buf, size_t num)
{
int ret;
unsigned long err;
......
......@@ -80,11 +80,11 @@ extern "C" {
struct rand_meth_st
{
void (*seed)(const void *buf, int num);
int (*bytes)(unsigned char *buf, int num);
void (*seed)(const void *buf, size_t num);
int (*bytes)(unsigned char *buf, size_t num);
void (*cleanup)(void);
void (*add)(const void *buf, int num, double entropy);
int (*pseudorand)(unsigned char *buf, int num);
void (*add)(const void *buf, size_t num, double entropy);
int (*pseudorand)(unsigned char *buf, size_t num);
int (*status)(void);
};
......@@ -99,17 +99,17 @@ int RAND_set_rand_engine(ENGINE *engine);
#endif
RAND_METHOD *RAND_SSLeay(void);
void RAND_cleanup(void );
int RAND_bytes(unsigned char *buf,int num);
int RAND_pseudo_bytes(unsigned char *buf,int num);
void RAND_seed(const void *buf,int num);
void RAND_add(const void *buf,int num,double entropy);
int RAND_bytes(unsigned char *buf,size_t num);
int RAND_pseudo_bytes(unsigned char *buf,size_t num);
void RAND_seed(const void *buf,size_t num);
void RAND_add(const void *buf,size_t num,double entropy);
int RAND_load_file(const char *file,long max_bytes);
int RAND_write_file(const char *file);
const char *RAND_file_name(char *file,size_t num);
int RAND_status(void);
int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes);
int RAND_query_egd_bytes(const char *path, unsigned char *buf, size_t bytes);
int RAND_egd(const char *path);
int RAND_egd_bytes(const char *path,int bytes);
int RAND_egd_bytes(const char *path, size_t bytes);
int RAND_poll(void);
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
......
......@@ -133,11 +133,11 @@ struct sockaddr_un {
# define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
#endif
int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
int RAND_query_egd_bytes(const char *path, unsigned char *buf, size_t bytes)
{
int ret = 0;
struct sockaddr_un addr;
int len, num, numbytes;
size_t len, num, numbytes;
int fd = -1;
int success;
unsigned char egdbuf[2], tempbuf[255], *retrievebuf;
......@@ -281,7 +281,7 @@ int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
}
int RAND_egd_bytes(const char *path, int bytes)
int RAND_egd_bytes(const char *path, size_t bytes)
{
int num, ret = 0;
......
......@@ -137,21 +137,21 @@ void RAND_cleanup(void)
RAND_set_rand_method(NULL);
}
void RAND_seed(const void *buf, int num)
void RAND_seed(const void *buf, size_t num)
{
const RAND_METHOD *meth = RAND_get_rand_method();
if (meth && meth->seed)
meth->seed(buf,num);
}
void RAND_add(const void *buf, int num, double entropy)
void RAND_add(const void *buf, size_t num, double entropy)
{
const RAND_METHOD *meth = RAND_get_rand_method();
if (meth && meth->add)
meth->add(buf,num,entropy);
}
int RAND_bytes(unsigned char *buf, int num)
int RAND_bytes(unsigned char *buf, size_t num)
{
const RAND_METHOD *meth = RAND_get_rand_method();
if (meth && meth->bytes)
......@@ -159,7 +159,7 @@ int RAND_bytes(unsigned char *buf, int num)
return(-1);
}
int RAND_pseudo_bytes(unsigned char *buf, int num)
int RAND_pseudo_bytes(unsigned char *buf, size_t num)
{
const RAND_METHOD *meth = RAND_get_rand_method();
if (meth && meth->pseudorand)
......
......@@ -157,7 +157,7 @@ int RAND_poll(void)
pid_t curr_pid = getpid();
#if defined(DEVRANDOM) || defined(DEVRANDOM_EGD)
unsigned char tmpbuf[ENTROPY_NEEDED];
int n = 0;
size_t n = 0;
#endif
#ifdef DEVRANDOM
static const char *randomfiles[] = { DEVRANDOM };
......@@ -261,7 +261,7 @@ int RAND_poll(void)
if (try_read)
{
r = read(fd,(unsigned char *)tmpbuf+n, ENTROPY_NEEDED-n);
r = read(fd,tmpbuf+n,ENTROPY_NEEDED-n);
if (r > 0)
n += r;
#if defined(OPENSSL_SYS_BEOS_R5)
......
......@@ -105,7 +105,8 @@ int RAND_load_file(const char *file, long bytes)
#ifndef OPENSSL_NO_POSIX_IO
struct stat sb;
#endif
int i,ret=0,n;
int i,ret=0;
size_t n;
FILE *in;
if (file == NULL) return(0);
......@@ -162,7 +163,8 @@ err:
int RAND_write_file(const char *file)
{
unsigned char buf[BUFSIZE];
int i,ret=0,rand_err=0;
int ret=0,rand_err=0;
size_t i;
FILE *out = NULL;
int n;
#ifndef OPENSSL_NO_POSIX_IO
......@@ -226,7 +228,7 @@ int RAND_write_file(const char *file)
if (out == NULL) goto err;
#ifndef NO_CHMOD
chmod(file,0600);
chmod(file,(mode_t)0600);
#endif
n=RAND_DATA;
for (;;)
......@@ -236,7 +238,7 @@ int RAND_write_file(const char *file)
if (RAND_bytes(buf,i) <= 0)
rand_err=1;
i=fwrite(buf,1,i,out);
if (i <= 0)
if (i == 0)
{
ret=0;
break;
......
......@@ -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,
const unsigned char **pder, int derlen)
const unsigned char **pder, size_t derlen)
{
RSA *rsa;
if (!(rsa = d2i_RSAPrivateKey (NULL, pder, derlen)))
......
......@@ -287,7 +287,7 @@ typedef struct ESS_signing_cert
TS_REQ *TS_REQ_new(void);
void TS_REQ_free(TS_REQ *a);
int i2d_TS_REQ(const TS_REQ *a, unsigned char **pp);
TS_REQ *d2i_TS_REQ(TS_REQ **a, const unsigned char **pp, long length);
TS_REQ *d2i_TS_REQ(TS_REQ **a, const unsigned char **pp, size_t length);
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);
int i2d_TS_MSG_IMPRINT(const TS_MSG_IMPRINT *a, unsigned char **pp);
TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT(TS_MSG_IMPRINT **a,
const unsigned char **pp, long length);
const unsigned char **pp, size_t length);
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);
void TS_RESP_free(TS_RESP *a);
int i2d_TS_RESP(const TS_RESP *a, unsigned char **pp);
TS_RESP *d2i_TS_RESP(TS_RESP **a, const unsigned char **pp, long length);
TS_RESP *d2i_TS_RESP(TS_RESP **a, const unsigned char **pp, size_t length);
TS_TST_INFO *PKCS7_to_TS_TST_INFO(PKCS7 *token);
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);
int i2d_TS_STATUS_INFO(const TS_STATUS_INFO *a, unsigned char **pp);
TS_STATUS_INFO *d2i_TS_STATUS_INFO(TS_STATUS_INFO **a,
const unsigned char **pp, long length);
const unsigned char **pp, size_t length);
TS_STATUS_INFO *TS_STATUS_INFO_dup(TS_STATUS_INFO *a);
TS_TST_INFO *TS_TST_INFO_new(void);
void TS_TST_INFO_free(TS_TST_INFO *a);
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,
long length);
size_t length);
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);
......@@ -344,7 +344,7 @@ TS_ACCURACY *TS_ACCURACY_new(void);
void TS_ACCURACY_free(TS_ACCURACY *a);
int i2d_TS_ACCURACY(const TS_ACCURACY *a, unsigned char **pp);
TS_ACCURACY *d2i_TS_ACCURACY(TS_ACCURACY **a, const unsigned char **pp,
long length);
size_t length);
TS_ACCURACY *TS_ACCURACY_dup(TS_ACCURACY *a);
ESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_new(void);
......@@ -352,14 +352,15 @@ void ESS_ISSUER_SERIAL_free(ESS_ISSUER_SERIAL *a);
int i2d_ESS_ISSUER_SERIAL(const ESS_ISSUER_SERIAL *a,
unsigned char **pp);
ESS_ISSUER_SERIAL *d2i_ESS_ISSUER_SERIAL(ESS_ISSUER_SERIAL **a,
const unsigned char **pp, long length);
const unsigned char **pp,
size_t length);
ESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_dup(ESS_ISSUER_SERIAL *a);
ESS_CERT_ID *ESS_CERT_ID_new(void);
void ESS_CERT_ID_free(ESS_CERT_ID *a);
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,
long length);
size_t length);
ESS_CERT_ID *ESS_CERT_ID_dup(ESS_CERT_ID *a);
ESS_SIGNING_CERT *ESS_SIGNING_CERT_new(void);
......@@ -367,7 +368,7 @@ void ESS_SIGNING_CERT_free(ESS_SIGNING_CERT *a);
int i2d_ESS_SIGNING_CERT(const ESS_SIGNING_CERT *a,
unsigned char **pp);
ESS_SIGNING_CERT *d2i_ESS_SIGNING_CERT(ESS_SIGNING_CERT **a,
const unsigned char **pp, long length);
const unsigned char **pp, size_t length);
ESS_SIGNING_CERT *ESS_SIGNING_CERT_dup(ESS_SIGNING_CERT *a);
void ERR_load_TS_strings(void);
......
......@@ -793,21 +793,21 @@ int X509_get_pubkey_parameters(EVP_PKEY *pkey,
STACK_OF(X509) *chain);
int i2d_PUBKEY(EVP_PKEY *a,unsigned char **pp);
EVP_PKEY * d2i_PUBKEY(EVP_PKEY **a,const unsigned char **pp,
long length);
size_t length);
#ifndef OPENSSL_NO_RSA
int i2d_RSA_PUBKEY(RSA *a,unsigned char **pp);
RSA * d2i_RSA_PUBKEY(RSA **a,const unsigned char **pp,
long length);
size_t length);
#endif
#ifndef OPENSSL_NO_DSA
int i2d_DSA_PUBKEY(DSA *a,unsigned char **pp);
DSA * d2i_DSA_PUBKEY(DSA **a,const unsigned char **pp,
long length);
size_t length);
#endif
#ifndef OPENSSL_NO_EC
int i2d_EC_PUBKEY(EC_KEY *a, unsigned char **pp);
EC_KEY *d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp,
long length);
size_t length);
#endif
DECLARE_ASN1_FUNCTIONS(X509_SIG)
......@@ -862,8 +862,9 @@ int X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x);
X509_PKEY * X509_PKEY_new(void );
void X509_PKEY_free(X509_PKEY *a);
int i2d_X509_PKEY(X509_PKEY *a,unsigned char **pp);
X509_PKEY * d2i_X509_PKEY(X509_PKEY **a,const unsigned char **pp,long length);
int i2d_X509_PKEY(X509_PKEY *a, unsigned char **pp);
X509_PKEY * d2i_X509_PKEY(X509_PKEY **a, const unsigned char **pp,
size_t length);
DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKI)
DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKAC)
......
......@@ -108,7 +108,7 @@ static int getModulusAndExponent(const unsigned char *token, long *exponentLengt
/* RAND number functions */
/*-----------------------*/
static int cca_get_random_bytes(unsigned char*, int );
static int cca_get_random_bytes(unsigned char*, size_t);
static int cca_random_status(void);
#ifndef OPENSSL_NO_RSA
......@@ -927,7 +927,7 @@ static int cca_random_status(void)
return 1;
}
static int cca_get_random_bytes(unsigned char* buf, int num)
static int cca_get_random_bytes(unsigned char* buf, size_t num)
{
long ret_code;
long reason_code;
......
......@@ -127,7 +127,7 @@ static int hwcrhk_mod_exp_dh(const DH *dh, BIGNUM *r,
#endif
/* RAND stuff */
static int hwcrhk_rand_bytes(unsigned char *buf, int num);
static int hwcrhk_rand_bytes(unsigned char *buf, size_t num);
static int hwcrhk_rand_status(void);
/* KM stuff */
......@@ -1097,7 +1097,7 @@ static int hwcrhk_mod_exp_dh(const DH *dh, BIGNUM *r,
#endif
/* Random bytes are good */
static int hwcrhk_rand_bytes(unsigned char *buf, int num)
static int hwcrhk_rand_bytes(unsigned char *buf, size_t num)
{
char tempbuf[1024];
HWCryptoHook_ErrMsgBuf rmsg;
......
......@@ -141,7 +141,7 @@ static int cswift_mod_exp_dh(const DH *dh, BIGNUM *r,
#endif
/* RAND stuff */
static int cswift_rand_bytes(unsigned char *buf, int num);
static int cswift_rand_bytes(unsigned char *buf, size_t num);
static int cswift_rand_status(void);
/* 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
/* Random bytes are good */
static int cswift_rand_bytes(unsigned char *buf, int num)
static int cswift_rand_bytes(unsigned char *buf, size_t num)
{
SW_CONTEXT_HANDLE hac;
SW_STATUS swrc;
......
......@@ -96,9 +96,9 @@ static int surewarehk_rsa_sign(int flen,const unsigned char *from,unsigned char
#endif
/* RAND stuff */
static int surewarehk_rand_bytes(unsigned char *buf, int num);
static void surewarehk_rand_seed(const void *buf, int num);
static void surewarehk_rand_add(const void *buf, int num, double entropy);
static int surewarehk_rand_bytes(unsigned char *buf, size_t num);
static void surewarehk_rand_seed(const void *buf, size_t num);
static void surewarehk_rand_add(const void *buf, size_t num, double entropy);
/* KM stuff */
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, int num)
static int surewarehk_rand_bytes(unsigned char *buf, size_t num)
{
int ret=0;
char msg[64]="ENGINE_rand_bytes";
......@@ -629,7 +629,7 @@ static int surewarehk_rand_bytes(unsigned char *buf, int num)
return ret==1 ? 1 : 0;
}
static void surewarehk_rand_seed(const void *buf, int num)
static void surewarehk_rand_seed(const void *buf, size_t num)
{
int ret=0;
char msg[64]="ENGINE_rand_seed";
......@@ -644,7 +644,7 @@ static void surewarehk_rand_seed(const void *buf, int num)
}
}
static void surewarehk_rand_add(const void *buf, int num, double entropy)
static void surewarehk_rand_add(const void *buf, size_t num, double entropy)
{
surewarehk_rand_seed(buf,num);
}
......
......@@ -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_set_generate_session_id(SSL *, GEN_SESSION_CB);
int SSL_has_matching_session_id(const SSL *ssl, const unsigned char *id,
unsigned int id_len);
size_t id_len);
SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a,const unsigned char **pp,
long length);
size_t length);
#ifdef HEADER_X509_H
X509 * SSL_get_peer_certificate(const SSL *s);
......
......@@ -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,
long length)
size_t length)
{
int version,ssl_version=0,i;
long id;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册