#define PORT_STR "4433"
#define PROTOCOL "tcp"
-int do_server(int port, int type, int *ret, int (*cb) (char *hostname, int s, unsigned char *context), unsigned char *context);
+int do_server(int port, int type, int *ret,
+ int (*cb) (char *hostname, int s, unsigned char *context),
+ unsigned char *context);
#ifdef HEADER_X509_H
int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx);
#endif
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,
- int argi, long argl, long ret);
+ size_t argi, long argl, long ret);
#ifdef HEADER_SSL_H
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, const void *buf, size_t len, SSL *ssl, void *arg);
+void MS_CALLBACK msg_cb(int write_p, int version, int content_type,
+ const void *buf, size_t len, SSL *ssl, void *arg);
void MS_CALLBACK tlsext_cb(SSL *s, int client_server, int type,
unsigned char *data, int len,
void *arg);
}
long MS_CALLBACK bio_dump_callback(BIO *bio, int cmd, const char *argp,
- int argi, long argl, long ret)
+ size_t argi, long argl, long ret)
{
BIO *out;
return(1);
}
-int do_server(int port, int type, int *ret, int (*cb)(char *hostname, int s, unsigned char *context), unsigned char *context)
+int do_server(int port, int type, int *ret,
+ int (*cb)(char *hostname, int s, unsigned char *context),
+ unsigned char *context)
{
int sock;
char *name = NULL;
#include "cryptlib.h"
#include <openssl/asn1.h>
-int ASN1_BIT_STRING_set(ASN1_BIT_STRING *x, unsigned char *d, int len)
-{ return M_ASN1_BIT_STRING_set(x, d, len); }
+int ASN1_BIT_STRING_set(ASN1_BIT_STRING *x, unsigned char *d, size_t len)
+ { return M_ASN1_BIT_STRING_set(x, d, len); }
int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp)
{
- int ret,j,bits,len;
+ int ret,j,bits;
+ size_t len;
unsigned char *p,*d;
if (a == NULL) return(0);
}
ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,
- const unsigned char **pp, long len)
+ const unsigned char **pp, size_t len)
{
ASN1_BIT_STRING *ret=NULL;
const unsigned char *p;
if (len-- > 1) /* using one because of the bits left byte */
{
- s=(unsigned char *)OPENSSL_malloc((int)len);
+ s=OPENSSL_malloc(len);
if (s == NULL)
{
i=ERR_R_MALLOC_FAILURE;
goto err;
}
- memcpy(s,p,(int)len);
+ memcpy(s,p,len);
s[len-1]&=(0xff<<i);
p+=len;
}
/* These next 2 functions from Goetz Babin-Ebell <babinebell@trustcenter.de>
*/
-int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value)
+int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, size_t n, int value)
{
- int w,v,iv;
+ int v,iv;
+ size_t w;
unsigned char *c;
w=n/8;
{
if (!value) return(1); /* Don't need to set */
if (a->data == NULL)
- c=(unsigned char *)OPENSSL_malloc(w+1);
+ c=OPENSSL_malloc(w+1);
else
- c=(unsigned char *)OPENSSL_realloc_clean(a->data,
- a->length,
- w+1);
+ c=OPENSSL_realloc_clean(a->data, a->length, w+1);
if (c == NULL)
{
ASN1err(ASN1_F_ASN1_BIT_STRING_SET_BIT,ERR_R_MALLOC_FAILURE);
return(1);
}
-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 w,v;
* 'len' is the length of 'flags'.
*/
int ASN1_BIT_STRING_check(ASN1_BIT_STRING *a,
- unsigned char *flags, int flags_len)
+ unsigned char *flags, size_t flags_len)
{
int i, ok;
/* Check if there is one bit set at all. */
return(r);
}
-int d2i_ASN1_BOOLEAN(int *a, const unsigned char **pp, long length)
+int d2i_ASN1_BOOLEAN(int *a, const unsigned char **pp, size_t length)
{
int ret= -1;
const unsigned char *p;
- long len;
+ size_t len;
int inf,tag,xclass;
int i=0;
/* type is a 'bitmap' of acceptable string types.
*/
ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a, const unsigned char **pp,
- long length, int type)
+ size_t length, int type)
{
ASN1_STRING *ret=NULL;
const unsigned char *p;
unsigned char *s;
- long len;
+ size_t len;
int inf,tag,xclass;
int i=0;
}
ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp,
- long length, int Ptag, int Pclass)
+ size_t length, int Ptag, int Pclass)
{
ASN1_STRING *ret=NULL;
const unsigned char *p;
unsigned char *s;
- long len;
+ size_t len;
int inf,tag,xclass;
int i=0;
/* Convert just ASN1 INTEGER content octets to ASN1_INTEGER structure */
ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp,
- long len)
+ size_t len)
{
ASN1_INTEGER *ret=NULL;
const unsigned char *p, *pend;
/* We must OPENSSL_malloc stuff, even for 0 bytes otherwise it
* signifies a missing NULL parameter. */
- s=(unsigned char *)OPENSSL_malloc((int)len+1);
+ s=OPENSSL_malloc(len+1);
if (s == NULL)
{
i=ERR_R_MALLOC_FAILURE;
p++;
len--;
}
- memcpy(s,p,(int)len);
+ memcpy(s,p,len);
}
if (ret->data != NULL) OPENSSL_free(ret->data);
*/
ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp,
- long length)
+ size_t length)
{
ASN1_INTEGER *ret=NULL;
const unsigned char *p;
unsigned char *to,*s;
- long len;
+ size_t len;
int inf,tag,xclass;
int i;
/* We must OPENSSL_malloc stuff, even for 0 bytes otherwise it
* signifies a missing NULL parameter. */
- s=(unsigned char *)OPENSSL_malloc((int)len+1);
+ s=OPENSSL_malloc(len+1);
if (s == NULL)
{
i=ERR_R_MALLOC_FAILURE;
p++;
len--;
}
- memcpy(s,p,(int)len);
+ memcpy(s,p,len);
p+=len;
}
ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai)
{
ASN1_INTEGER *ret;
- int len,j;
+ size_t len,j;
if (ai == NULL)
ret=M_ASN1_INTEGER_new();
len=((j == 0)?0:((j/8)+1));
if (ret->length < len+4)
{
- unsigned char *new_data=OPENSSL_realloc(ret->data, len+4);
+ unsigned char *new_data=OPENSSL_realloc(ret->data, len+4U);
if (!new_data)
{
ASN1err(ASN1_F_BN_TO_ASN1_INTEGER,ERR_R_MALLOC_FAILURE);
* The 'ncopy' form checks minimum and maximum size limits too.
*/
-int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len,
- int inform, unsigned long mask)
+int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, size_t len,
+ int inform, unsigned long mask)
{
return ASN1_mbstring_ncopy(out, in, len, inform, mask, 0, 0);
}
-int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
- int inform, unsigned long mask,
- long minsize, long maxsize)
+int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, size_t len,
+ int inform, unsigned long mask, size_t minsize,
+ size_t maxsize)
{
int str_type;
int ret;
if((minsize > 0) && (nchar < minsize)) {
ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY, ASN1_R_STRING_TOO_SHORT);
- BIO_snprintf(strbuf, sizeof strbuf, "%ld", minsize);
+ BIO_snprintf(strbuf, sizeof strbuf, "%ld", (long)minsize);
ERR_add_error_data(2, "minsize=", strbuf);
return -1;
}
if((maxsize > 0) && (nchar > maxsize)) {
ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY, ASN1_R_STRING_TOO_LONG);
- BIO_snprintf(strbuf, sizeof strbuf, "%ld", maxsize);
+ BIO_snprintf(strbuf, sizeof strbuf, "%ld", (long)maxsize);
ERR_add_error_data(2, "maxsize=", strbuf);
return -1;
}
return(objsize);
}
-int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num)
+size_t a2d_ASN1_OBJECT(unsigned char *out, size_t olen, const char *buf,
+ int num)
{
- int i,first,len=0,c, use_bn;
+ int i,len=0,c, use_bn;
+ unsigned first;
char ftmp[24], *tmp = ftmp;
- int tmpsize = sizeof ftmp;
+ size_t tmpsize = sizeof ftmp;
const char *p;
unsigned long l;
BIGNUM *bl = NULL;
if (use_bn)
{
if (!BN_mul_word(bl, 10L)
- || !BN_add_word(bl, c-'0'))
+ || !BN_add_signed_word(bl, c-'0'))
goto err;
}
else
- l=l*10L+(long)(c-'0');
+ l=l*10L+(c-'0');
}
if (len == 0)
{
return(0);
}
-int i2t_ASN1_OBJECT(char *buf, int buf_len, ASN1_OBJECT *a)
+int i2t_ASN1_OBJECT(char *buf, size_t buf_len, ASN1_OBJECT *a)
{
return OBJ_obj2txt(buf, buf_len, a, 0);
}
int i2a_ASN1_OBJECT(BIO *bp, ASN1_OBJECT *a)
{
char buf[80], *p = buf;
- int i;
+ size_t i;
if ((a == NULL) || (a->data == NULL))
return(BIO_write(bp,"NULL",4));
}
ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
- long length)
+ size_t length)
{
const unsigned char *p;
- long len;
+ size_t len;
int tag,xclass;
int inf,i;
ASN1_OBJECT *ret = NULL;
+
p= *pp;
inf=ASN1_get_object(&p,&len,&tag,&xclass,length);
if (inf & 0x80)
return(NULL);
}
ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
- long len)
+ size_t len)
{
ASN1_OBJECT *ret=NULL;
const unsigned char *p;
{
ret->length=0;
if (data != NULL) OPENSSL_free(data);
- data=(unsigned char *)OPENSSL_malloc(len ? (int)len : 1);
+ data=OPENSSL_malloc(len ? len : 1);
if (data == NULL)
{ i=ERR_R_MALLOC_FAILURE; goto err; }
ret->flags|=ASN1_OBJECT_FLAG_DYNAMIC_DATA;
}
- memcpy(data,p,(int)len);
+ memcpy(data,p,len);
/* reattach data to object, after which it remains const */
- ret->data =data;
- ret->length=(int)len;
+ ret->data=data;
+ ret->length=len;
ret->sn=NULL;
ret->ln=NULL;
/* ret->flags=ASN1_OBJECT_FLAG_DYNAMIC; we know it is dynamic */
OPENSSL_free(a);
}
-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)
{
ASN1_OBJECT o;
#include <openssl/asn1.h>
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, const ASN1_OCTET_STRING *b)
-{ return M_ASN1_OCTET_STRING_cmp(a, b); }
+int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a,
+ const ASN1_OCTET_STRING *b)
+ { return M_ASN1_OCTET_STRING_cmp(a, b); }
-int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *x, const unsigned char *d, int len)
-{ return M_ASN1_OCTET_STRING_set(x, d, len); }
+int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *x, const unsigned char *d,
+ size_t len)
+ { return M_ASN1_OCTET_STRING_set(x, d, len); }
#include "cryptlib.h"
#include <openssl/asn1.h>
-int ASN1_PRINTABLE_type(const unsigned char *s, int len)
+int ASN1_PRINTABLE_type(const unsigned char *s, size_t len)
{
int c;
int ia5=0;
}
STACK_OF(BLOCK) *d2i_ASN1_SET(STACK_OF(BLOCK) **a, const unsigned char **pp,
- long length, d2i_of_void *d2i,
+ size_t length, d2i_of_void *d2i,
void (*free_func)(BLOCK), int ex_tag,
int ex_class)
{
*/
ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, const unsigned char *in,
- int inlen, int inform, int nid)
+ size_t inlen, int inform, int nid)
{
ASN1_STRING_TABLE *tbl;
ASN1_STRING *str = NULL;
}
/* Convert an ASN1_TIME structure to GeneralizedTime */
-ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out)
+ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t,
+ ASN1_GENERALIZEDTIME **out)
{
ASN1_GENERALIZEDTIME *ret;
char *str;
- int newlen;
+ size_t newlen;
if (!ASN1_TIME_check(t)) return NULL;
* -4 = character encoded incorrectly (not minimal length).
*/
-int UTF8_getc(const unsigned char *str, int len, unsigned long *val)
+int UTF8_getc(const unsigned char *str, size_t len, unsigned long *val)
{
const unsigned char *p;
unsigned long value;
* It will need at most 6 characters.
*/
-int UTF8_putc(unsigned char *str, int len, unsigned long value)
+int UTF8_putc(unsigned char *str, size_t len, unsigned long value)
{
if(!str) len = 6; /* Maximum we will need */
else if(len <= 0) return -1;
int inf; /* constructed if 0x20, indefinite is 0x21 */
int tag; /* tag from last 'get object' */
int xclass; /* class from last 'get object' */
- long slen; /* length of last 'get object' */
+ size_t slen; /* length of last 'get object' */
unsigned char *max; /* largest value of p allowed */
unsigned char *q;/* temporary variable */
unsigned char **pp;/* variable */
int inf; /* constructed if 0x20, indefinite is 0x21 */
int tag; /* tag from last 'get object' */
int xclass; /* class from last 'get object' */
- long slen; /* length of last 'get object' */
+ size_t slen; /* length of last 'get object' */
const unsigned char *max; /* largest value of p allowed */
const unsigned char *q;/* temporary variable */
const unsigned char **pp;/* variable */
{
const char *sn,*ln;
int nid;
- int length;
+ size_t length;
const unsigned char *data; /* data remains const after init */
int flags; /* Should we free this one */
} ASN1_OBJECT;
/* This is the base type that holds just about everything :-) */
typedef struct asn1_string_st
{
- int length;
+ size_t length;
int type;
unsigned char *data;
/* The value of the following field depends on the type being
typedef struct ASN1_ENCODING_st
{
unsigned char *enc; /* DER encoding */
- long len; /* Length of encoding */
+ size_t len; /* Length of encoding */
int modified; /* set to 1 if 'enc' is invalid */
} ASN1_ENCODING;
void ASN1_OBJECT_free(ASN1_OBJECT *a);
int i2d_ASN1_OBJECT(ASN1_OBJECT *a,unsigned char **pp);
ASN1_OBJECT * c2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp,
- long length);
+ size_t length);
ASN1_OBJECT * d2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp,
- long length);
+ size_t length);
DECLARE_ASN1_ITEM(ASN1_OBJECT)
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
its data void * */
-int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len);
-void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len);
-int ASN1_STRING_length(const ASN1_STRING *x);
-void ASN1_STRING_length_set(ASN1_STRING *x, int n);
+int ASN1_STRING_set(ASN1_STRING *str, const void *data, size_t len);
+void ASN1_STRING_set0(ASN1_STRING *str, void *data, size_t len);
+size_t ASN1_STRING_length(const ASN1_STRING *x);
+void ASN1_STRING_length_set(ASN1_STRING *x, size_t n);
int ASN1_STRING_type(ASN1_STRING *x);
unsigned char * ASN1_STRING_data(ASN1_STRING *x);
DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING)
int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a,unsigned char **pp);
-ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,const unsigned char **pp,
- long length);
+ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,
+ const unsigned char **pp, size_t length);
int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d,
- int length );
-int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value);
-int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n);
-int ASN1_BIT_STRING_check(ASN1_BIT_STRING *a,
- unsigned char *flags, int flags_len);
+ size_t length);
+int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, size_t n,
+ int value);
+int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, size_t n);
+int ASN1_BIT_STRING_check(ASN1_BIT_STRING *a,
+ unsigned char *flags, size_t flags_len);
#ifndef OPENSSL_NO_BIO
int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs,
int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, char *name, int value,
BIT_STRING_BITNAME *tbl);
-int i2d_ASN1_BOOLEAN(int a,unsigned char **pp);
-int d2i_ASN1_BOOLEAN(int *a,const unsigned char **pp,long length);
+int i2d_ASN1_BOOLEAN(int a, unsigned char **pp);
+int d2i_ASN1_BOOLEAN(int *a, const unsigned char **pp, size_t length);
DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER)
int i2c_ASN1_INTEGER(ASN1_INTEGER *a,unsigned char **pp);
ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a,const unsigned char **pp,
- long length);
+ size_t length);
ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a,const unsigned char **pp,
- long length);
+ size_t length);
ASN1_INTEGER * ASN1_INTEGER_dup(const ASN1_INTEGER *x);
int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y);
DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING)
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_set(ASN1_OCTET_STRING *str, const unsigned char *data, int len);
+int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data,
+ size_t len);
DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING)
DECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING)
DECLARE_ASN1_FUNCTIONS(ASN1_NULL)
DECLARE_ASN1_FUNCTIONS(ASN1_BMPSTRING)
-int UTF8_getc(const unsigned char *str, int len, unsigned long *val);
-int UTF8_putc(unsigned char *str, int len, unsigned long value);
+int UTF8_getc(const unsigned char *str, size_t len, unsigned long *val);
+int UTF8_putc(unsigned char *str, size_t len, unsigned long value);
DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, ASN1_PRINTABLE)
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,
- long length, d2i_of_void *d2i,
+ size_t length, d2i_of_void *d2i,
void (*free_func)(BLOCK), int ex_tag,
int ex_class);
int a2i_ASN1_STRING(BIO *bp,ASN1_STRING *bs,char *buf,int size);
int i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type);
#endif
-int i2t_ASN1_OBJECT(char *buf,int buf_len,ASN1_OBJECT *a);
+int i2t_ASN1_OBJECT(char *buf,size_t buf_len,ASN1_OBJECT *a);
-int a2d_ASN1_OBJECT(unsigned char *out,int olen, const char *buf, int num);
-ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data,int len,
- const char *sn, const char *ln);
+size_t a2d_ASN1_OBJECT(unsigned char *out, size_t olen, const char *buf,
+ int num);
+ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, size_t len,
+ const char *sn, const char *ln);
int ASN1_INTEGER_set(ASN1_INTEGER *a, long v);
long ASN1_INTEGER_get(const ASN1_INTEGER *a);
/* General */
/* given a string, return the correct type, max is the maximum length */
-int ASN1_PRINTABLE_type(const unsigned char *s, int max);
+int ASN1_PRINTABLE_type(const unsigned char *s, size_t max);
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,
- long length, int Ptag, int Pclass);
+ size_t length, int Ptag, int Pclass);
unsigned long ASN1_tag2bit(int tag);
/* type is one or more of the B_ASN1_ values. */
ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a,const unsigned char **pp,
- long length,int type);
+ size_t length,int type);
/* PARSING */
int asn1_Finish(ASN1_CTX *c);
int asn1_const_Finish(ASN1_const_CTX *c);
/* SPECIALS */
-int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag,
- int *pclass, long omax);
-int ASN1_check_infinite_end(unsigned char **p,long len);
-int ASN1_const_check_infinite_end(const unsigned char **p,long len);
-void ASN1_put_object(unsigned char **pp, int constructed, int length,
- int tag, int xclass);
+int ASN1_get_object(const unsigned char **pp, size_t *plength, int *ptag,
+ int *pclass, size_t omax);
+int ASN1_check_infinite_end(unsigned char **p, size_t len);
+int ASN1_const_check_infinite_end(const unsigned char **p, size_t len);
+void ASN1_put_object(unsigned char **pp, int constructed, size_t length,
+ int tag, int xclass);
int ASN1_put_eoc(unsigned char **pp);
-int ASN1_object_size(int constructed, int length, int tag);
+size_t ASN1_object_size(int constructed, size_t length, int tag);
/* Used to implement other functions */
void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, char *x);
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,
unsigned char *buf, int off);
-int ASN1_parse(BIO *bp,const unsigned char *pp,long len,int indent);
-int ASN1_parse_dump(BIO *bp,const unsigned char *pp,long len,int indent,int dump);
+int ASN1_parse(BIO *bp, const unsigned char *pp, size_t len, int indent);
+int ASN1_parse_dump(BIO *bp, const unsigned char *pp, size_t len, int indent,
+ int dump);
#endif
const char *ASN1_tag2str(int tag);
int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s);
int ASN1_TYPE_set_octetstring(ASN1_TYPE *a,
- unsigned char *data, int len);
+ unsigned char *data, size_t len);
int ASN1_TYPE_get_octetstring(ASN1_TYPE *a,
- unsigned char *data, int max_len);
+ unsigned char *data, size_t max_len);
int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num,
- unsigned char *data, int len);
-int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a,long *num,
- unsigned char *data, int max_len);
+ unsigned char *data, size_t len);
+int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a, long *num,
+ unsigned char *data, size_t max_len);
-STACK_OF(BLOCK) *ASN1_seq_unpack(const unsigned char *buf, int len,
+STACK_OF(BLOCK) *ASN1_seq_unpack(const unsigned char *buf, size_t len,
d2i_of_void *d2i, void (*free_func)(BLOCK));
unsigned char *ASN1_seq_pack(STACK_OF(BLOCK) *safes, i2d_of_void *i2d,
- unsigned char **buf, int *len );
+ unsigned char **buf, size_t *len);
void *ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i);
void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it);
ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d,
ASN1_OCTET_STRING **oct);
-#define ASN1_pack_string_of(type,obj,i2d,oct) \
+#define ASN1_pack_string_of(type,obj,i2d,oct) \
(ASN1_pack_string(CHECKED_PTR_OF(type, obj), \
CHECKED_I2D_OF(type, i2d), \
oct))
void ASN1_STRING_set_default_mask(unsigned long mask);
int ASN1_STRING_set_default_mask_asc(char *p);
unsigned long ASN1_STRING_get_default_mask(void);
-int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len,
+int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, size_t len,
int inform, unsigned long mask);
-int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
+int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, size_t len,
int inform, unsigned long mask,
- long minsize, long maxsize);
+ size_t minsize, size_t maxsize);
ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out,
- const unsigned char *in, int inlen, int inform, int nid);
+ const unsigned char *in, size_t inlen,
+ int inform, int nid);
ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid);
int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long);
void ASN1_STRING_TABLE_cleanup(void);
/* Old API compatible functions */
ASN1_VALUE *ASN1_item_new(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, long len, const ASN1_ITEM *it);
+ASN1_VALUE * ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in,
+ size_t len, 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, const ASN1_ITEM *it);
+int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out,
+ const ASN1_ITEM *it);
void ASN1_add_oid_module(void);
unsigned char *p;
const unsigned char *cp;
int cpy_len;
- long hdr_len;
+ size_t hdr_len;
int hdr_constructed = 0, hdr_tag, hdr_class;
int r;
#include <openssl/asn1.h>
#include <openssl/asn1_mac.h>
-static int asn1_get_length(const unsigned char **pp,int *inf,long *rl,int max);
+static int asn1_get_length(const unsigned char **pp, int *inf, size_t *rl,
+ size_t max);
static void asn1_put_length(unsigned char **pp, int length);
const char ASN1_version[]="ASN.1" OPENSSL_VERSION_PTEXT;
return(0);
}
-int ASN1_check_infinite_end(unsigned char **p, long len)
+int ASN1_check_infinite_end(unsigned char **p, size_t len)
{
return _asn1_check_infinite_end((const unsigned char **)p, len);
}
-int ASN1_const_check_infinite_end(const unsigned char **p, long len)
+int ASN1_const_check_infinite_end(const unsigned char **p, size_t len)
{
return _asn1_check_infinite_end(p, len);
}
-int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag,
- int *pclass, long omax)
+int ASN1_get_object(const unsigned char **pp, size_t *plength, int *ptag,
+ int *pclass, size_t omax)
{
int i,ret;
long l;
const unsigned char *p= *pp;
int tag,xclass,inf;
- long max=omax;
+ size_t max=omax;
+
+ if (!max)
+ goto err;
- if (!max) goto err;
ret=(*p&V_ASN1_CONSTRUCTED);
xclass=(*p&V_ASN1_PRIVATE);
i= *p&V_ASN1_PRIMITIVE_TAG;
return(0x80);
}
-static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, int max)
+static int asn1_get_length(const unsigned char **pp, int *inf, size_t *rl,
+ size_t max)
{
const unsigned char *p= *pp;
unsigned long ret=0;
/* class 0 is constructed
* constructed == 2 for indefinite length constructed */
-void ASN1_put_object(unsigned char **pp, int constructed, int length, int tag,
- int xclass)
+void ASN1_put_object(unsigned char **pp, int constructed, size_t length,
+ int tag, int xclass)
{
unsigned char *p= *pp;
int i, ttag;
*pp=p;
}
-int ASN1_object_size(int constructed, int length, int tag)
+size_t ASN1_object_size(int constructed, size_t length, int tag)
{
int ret;
return ret;
}
-int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len)
+int ASN1_STRING_set(ASN1_STRING *str, const void *_data, size_t len)
{
unsigned char *c;
const char *data=_data;
return(1);
}
-void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len)
+void ASN1_STRING_set0(ASN1_STRING *str, void *data, size_t len)
{
if (str->data)
OPENSSL_free(str->data);
ERR_add_error_data(4,"address=",buf1," offset=",buf2);
}
-int ASN1_STRING_length(const ASN1_STRING *x)
-{ return M_ASN1_STRING_length(x); }
+size_t ASN1_STRING_length(const ASN1_STRING *x)
+ { return M_ASN1_STRING_length(x); }
-void ASN1_STRING_length_set(ASN1_STRING *x, int len)
-{ M_ASN1_STRING_length_set(x, len); return; }
+void ASN1_STRING_length_set(ASN1_STRING *x, size_t len)
+ { M_ASN1_STRING_length_set(x, len); return; }
int ASN1_STRING_type(ASN1_STRING *x)
-{ return M_ASN1_STRING_type(x); }
+ { return M_ASN1_STRING_type(x); }
unsigned char * ASN1_STRING_data(ASN1_STRING *x)
-{ return M_ASN1_STRING_data(x); }
+ { return M_ASN1_STRING_data(x); }
(V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \
{ \
int Tinf,Ttag,Tclass; \
- long Tlen; \
+ size_t Tlen; \
\
c.q=c.p; \
Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \
#include <openssl/asn1.h>
static int asn1_print_info(BIO *bp, int tag, int xclass,int constructed,
- int indent);
-static int asn1_parse2(BIO *bp, const unsigned char **pp, long length,
- int offset, int depth, int indent, int dump);
+ int indent);
+static int asn1_parse2(BIO *bp, const unsigned char **pp, size_t length,
+ int offset, int depth, int indent, int dump);
static int asn1_print_info(BIO *bp, int tag, int xclass, int constructed,
- int indent)
+ int indent)
{
static const char fmt[]="%-18s";
char str[128];
return(0);
}
-int ASN1_parse(BIO *bp, const unsigned char *pp, long len, int indent)
+int ASN1_parse(BIO *bp, const unsigned char *pp, size_t len, int indent)
{
return(asn1_parse2(bp,&pp,len,0,0,indent,0));
}
-int ASN1_parse_dump(BIO *bp, const unsigned char *pp, long len, int indent, int dump)
+int ASN1_parse_dump(BIO *bp, const unsigned char *pp, size_t len, int indent,
+ int dump)
{
return(asn1_parse2(bp,&pp,len,0,0,indent,dump));
}
-static int asn1_parse2(BIO *bp, const unsigned char **pp, long length, int offset,
- int depth, int indent, int dump)
+static int asn1_parse2(BIO *bp, const unsigned char **pp, size_t length,
+ int offset, int depth, int indent, int dump)
{
const unsigned char *p,*ep,*tot,*op,*opp;
- long len;
+ size_t len;
int tag,xclass,ret=0;
int nl,hl,j,r;
ASN1_OBJECT *o=NULL;
if (j != (V_ASN1_CONSTRUCTED | 1))
{
if (BIO_printf(bp,"d=%-2d hl=%ld l=%4ld ",
- depth,(long)hl,len) <= 0)
+ depth,(long)hl,(long)len) <= 0)
goto end;
}
else
{
if (BIO_printf(bp,"d=%-2d hl=%ld l=inf ",
- depth,(long)hl) <= 0)
+ depth,(long)hl) <= 0)
goto end;
}
if (!asn1_print_info(bp,tag,xclass,j,(indent)?depth:0))
if (len > length)
{
BIO_printf(bp,
- "length is greater than %ld\n",length);
+ "length is greater than %ld\n",
+ (long)length);
ret=0;
goto end;
}
/* Turn an ASN1 encoded SEQUENCE OF into a STACK of structures */
-STACK_OF(BLOCK) *ASN1_seq_unpack(const unsigned char *buf, int len,
+STACK_OF(BLOCK) *ASN1_seq_unpack(const unsigned char *buf, size_t len,
d2i_of_void *d2i, void (*free_func)(BLOCK))
{
STACK_OF(BLOCK) *sk;
*/
unsigned char *ASN1_seq_pack(STACK_OF(BLOCK) *safes, i2d_of_void *i2d,
- unsigned char **buf, int *len)
+ unsigned char **buf, size_t *len)
{
int safelen;
unsigned char *safe, *p;
#include <openssl/asn1.h>
#include <openssl/asn1_mac.h>
-int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, int len)
+int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, size_t len)
{
ASN1_STRING *os;
/* int max_len: for returned value */
int ASN1_TYPE_get_octetstring(ASN1_TYPE *a, unsigned char *data,
- int max_len)
+ size_t max_len)
{
int ret,num;
unsigned char *p;
}
int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, unsigned char *data,
- int len)
+ size_t len)
{
int n,size;
ASN1_OCTET_STRING os,*osp;
* case, set it to zero */
/* int max_len: for returned value */
int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a, long *num, unsigned char *data,
- int max_len)
+ size_t max_len)
{
int ret= -1,n;
ASN1_INTEGER *ai=NULL;
*/
ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval,
- const unsigned char **in, long len, const ASN1_ITEM *it)
+ const unsigned char **in, size_t len,
+ const ASN1_ITEM *it)
{
ASN1_TLC c;
ASN1_VALUE *ptmpval = NULL;
{
int i;
int ptag, pclass;
- long plen;
+ size_t plen;
const unsigned char *p, *q;
p = *in;
q = p;
#define BIO_cb_pre(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 *,int, long,long);
-void BIO_set_callback(BIO *b,
- long (*callback)(struct bio_st *,int,const char *,int, long,long));
+long (*BIO_get_callback(const BIO *b)) (struct bio_st *, int, const char *,
+ size_t, long, long);
+void BIO_set_callback(BIO *b, long (*callback)(struct bio_st *, int,
+ const char *, size_t, long,
+ long));
char *BIO_get_callback_arg(const BIO *b);
void BIO_set_callback_arg(BIO *b, char *arg);
{
BIO_METHOD *method;
/* bio, mode, argp, argi, argl, ret */
- long (*callback)(struct bio_st *,int,const char *,int, long,long);
+ long (*callback)(struct bio_st *,int,const char *,size_t, long,long);
char *cb_arg; /* first argument for the callback */
int init;
void BIO_vfree(BIO *a);
int BIO_read(BIO *b, void *data, int len);
int BIO_gets(BIO *bp,char *buf, int size);
-int BIO_write(BIO *b, const void *data, int len);
+int BIO_write(BIO *b, const void *data, size_t len);
int BIO_puts(BIO *bp,const char *buf);
int BIO_indent(BIO *b,int indent,int max);
long BIO_ctrl(BIO *bp,int cmd,long larg,void *parg);
int BIO_nwrite0(BIO *bio, char **buf);
int BIO_nwrite(BIO *bio, char **buf, int num);
-long BIO_debug_callback(BIO *bio,int cmd,const char *argp,int argi,
- long argl,long ret);
+long BIO_debug_callback(BIO *bio, int cmd, const char *argp, size_t argi,
+ long argl, long ret);
BIO_METHOD *BIO_s_mem(void);
BIO *BIO_new_mem_buf(void *buf, int len);
#include <openssl/err.h>
long MS_CALLBACK BIO_debug_callback(BIO *bio, int cmd, const char *argp,
- int argi, long argl, long ret)
+ size_t argi, long argl, long ret)
{
BIO *b;
MS_STATIC char buf[256];
b->flags |= flags;
}
-long (*BIO_get_callback(const BIO *b))(struct bio_st *,int,const char *,int, long,long)
+long (*BIO_get_callback(const BIO *b))(struct bio_st *, int, const char *,
+ size_t, long, long)
{
return b->callback;
}
-void BIO_set_callback(BIO *b, long (*cb)(struct bio_st *,int,const char *,int, long,long))
+void BIO_set_callback(BIO *b, long (*cb)(struct bio_st *, int, const char *,
+ size_t, long, long))
{
b->callback = cb;
}
int BIO_read(BIO *b, void *out, int outl)
{
int i;
- long (*cb)(BIO *,int,const char *,int,long,long);
+ long (*cb)(BIO *, int, const char *, size_t, long, long);
if ((b == NULL) || (b->method == NULL) || (b->method->bread == NULL))
{
return(i);
}
-int BIO_write(BIO *b, const void *in, int inl)
+int BIO_write(BIO *b, const void *in, size_t inl)
{
int i;
- long (*cb)(BIO *,int,const char *,int,long,long);
+ long (*cb)(BIO *,int,const char *,size_t,long,long);
if (b == NULL)
return(0);
}
if ((cb != NULL) &&
- ((i=(int)cb(b,BIO_CB_WRITE,in,inl,0L,1L)) <= 0))
+ ((i=cb(b,BIO_CB_WRITE,in,inl,0L,1L)) <= 0))
return(i);
if (!b->init)
int BIO_puts(BIO *b, const char *in)
{
int i;
- long (*cb)(BIO *,int,const char *,int,long,long);
+ long (*cb)(BIO *, int, const char *, size_t, long, long);
if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL))
{
int BIO_gets(BIO *b, char *in, int inl)
{
int i;
- long (*cb)(BIO *,int,const char *,int,long,long);
+ long (*cb)(BIO *, int, const char *, size_t, long, long);
if ((b == NULL) || (b->method == NULL) || (b->method->bgets == NULL))
{
long BIO_ctrl(BIO *b, int cmd, long larg, void *parg)
{
long ret;
- long (*cb)(BIO *,int,const char *,int,long,long);
+ long (*cb)(BIO *, int, const char *, size_t, long, long);
if (b == NULL) return(0);
long BIO_callback_ctrl(BIO *b, int cmd, void (*fp)(struct bio_st *, int, const char *, int, long, long))
{
long ret;
- long (*cb)(BIO *,int,const char *,int,long,long);
+ long (*cb)(BIO *, int, const char *, size_t, long, long);
if (b == NULL) return(0);
return ret;
}
-BN_ULONG bn_add_words (BN_ULONG *rp, BN_ULONG *ap, BN_ULONG *bp,int n)
+BN_ULONG bn_add_words (BN_ULONG *rp, BN_ULONG *ap, BN_ULONG *bp, size_t n)
{ BN_ULONG ret=0,i=0;
if (n <= 0) return 0;
struct bignum_st
{
BN_ULONG *d; /* Pointer to an array of 'BN_BITS2' bit chunks. */
- int top; /* Index of last used d +1. */
+ size_t top; /* Index of last used d +1. */
/* The next are internal book keeping for bn_expand. */
- int dmax; /* Size of the d array. */
+ size_t dmax; /* Size of the d array. */
int neg; /* one if the number is negative */
int flags;
};
void BN_CTX_start(BN_CTX *ctx);
BIGNUM *BN_CTX_get(BN_CTX *ctx);
void BN_CTX_end(BN_CTX *ctx);
-int BN_rand(BIGNUM *rnd, int bits, int top,int bottom);
-int BN_pseudo_rand(BIGNUM *rnd, int bits, int top,int bottom);
+int BN_rand(BIGNUM *rnd, size_t bits, int top,int bottom);
+int BN_pseudo_rand(BIGNUM *rnd, size_t bits, int top,int bottom);
int BN_rand_range(BIGNUM *rnd, const BIGNUM *range);
int BN_pseudo_rand_range(BIGNUM *rnd, const BIGNUM *range);
int BN_num_bits(const BIGNUM *a);
void BN_clear_free(BIGNUM *a);
BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b);
void BN_swap(BIGNUM *a, BIGNUM *b);
-BIGNUM *BN_bin2bn(const unsigned char *s,int len,BIGNUM *ret);
+BIGNUM *BN_bin2bn(const unsigned char *s, size_t len, BIGNUM *ret);
int BN_bn2bin(const BIGNUM *a, unsigned char *to);
-BIGNUM *BN_mpi2bn(const unsigned char *s,int len,BIGNUM *ret);
+BIGNUM *BN_mpi2bn(const unsigned char *s, size_t len, BIGNUM *ret);
int BN_bn2mpi(const BIGNUM *a, unsigned char *to);
int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w);
int BN_mul_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_set_word(BIGNUM *a, BN_ULONG w);
BN_ULONG BN_get_word(const BIGNUM *a);
#else
int BN_print(void *fp, const BIGNUM *a);
#endif
-int BN_reciprocal(BIGNUM *r, const BIGNUM *m, int len, BN_CTX *ctx);
+int BN_reciprocal(BIGNUM *r, const BIGNUM *m, size_t len, BN_CTX *ctx);
int BN_rshift(BIGNUM *r, const BIGNUM *a, int n);
int BN_rshift1(BIGNUM *r, const BIGNUM *a);
void BN_clear(BIGNUM *a);
#define bn_expand(a,bits) ((((((bits+BN_BITS2-1))/BN_BITS2)) <= (a)->dmax)?\
(a):bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2))
#define bn_wexpand(a,words) (((words) <= (a)->dmax)?(a):bn_expand2((a),(words)))
-BIGNUM *bn_expand2(BIGNUM *a, int words);
+BIGNUM *bn_expand2(BIGNUM *a, size_t words);
#ifndef OPENSSL_NO_DEPRECATED
-BIGNUM *bn_dup_expand(const BIGNUM *a, int words); /* unused */
+BIGNUM *bn_dup_expand(const BIGNUM *a, size_t words); /* unused */
#endif
/* Bignum consistency macros
bn_pollute(a); \
}
-BN_ULONG bn_mul_add_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, int num, BN_ULONG w);
-void bn_sqr_words(BN_ULONG *rp, const BN_ULONG *ap, int num);
+BN_ULONG bn_mul_add_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, size_t num, BN_ULONG w);
+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_add_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,int num);
+BN_ULONG bn_add_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,
+ size_t num);
+BN_ULONG bn_sub_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,
+ size_t num);
/* Primes from RFC 2409 */
BIGNUM *get_rfc2409_prime_768(BIGNUM *bn);
BIGNUM *get_rfc3526_prime_6144(BIGNUM *bn);
BIGNUM *get_rfc3526_prime_8192(BIGNUM *bn);
-int BN_bntest_rand(BIGNUM *rnd, int bits, int top,int bottom);
+int BN_bntest_rand(BIGNUM *rnd, size_t bits, int top, int bottom);
/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
/* unsigned add of b to a */
int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
{
- int max,min,dif;
+ size_t max,min,dif;
BN_ULONG *ap,*bp,*rp,carry,t1,t2;
const BIGNUM *tmp;
/* unsigned subtraction of b from a, a must be larger than b. */
int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
{
- int max,min,dif;
+ size_t max,min,dif;
register BN_ULONG t1,t2,*ap,*bp,*rp;
int i,carry;
#if defined(IRIX_CC_BUG) && !defined(LINT)
int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
{
- int max;
+ size_t max;
int add=0,neg=0;
const BIGNUM *tmp;
int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
BN_CTX *ctx)
{
- int norm_shift,i,loop;
+ int norm_shift,i;
+ size_t loop;
BIGNUM *tmp,wnum,*snum,*sdiv,*res;
BN_ULONG *resp,*wnump;
BN_ULONG d0,d1;
- int num_n,div_n;
+ size_t num_n,div_n;
/* 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
resp= &(res->d[loop-1]);
/* 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)
{
BIGNUM *tmp,wnum,*snum,*sdiv,*res;
BN_ULONG *resp,*wnump;
BN_ULONG d0,d1;
- int num_n,div_n;
+ size_t num_n,div_n;
bn_check_top(dv);
bn_check_top(rm);
/* Setup to 'res' */
res->neg= (num->neg^divisor->neg);
- if (!bn_wexpand(res,(loop+1))) goto err;
+ if (!bn_wexpand(res,loop+1U)) goto err;
res->top=loop-1;
resp= &(res->d[loop-1]);
/* space for temp */
- if (!bn_wexpand(tmp,(div_n+1))) goto err;
+ if (!bn_wexpand(tmp,div_n+1U)) goto err;
/* if res->top == 0 then clear the neg value otherwise decrease
* the resp pointer */
* as cache lines are concerned. The following functions are used to transfer a BIGNUM
* from/to that table. */
-static int MOD_EXP_CTIME_COPY_TO_PREBUF(BIGNUM *b, int top, unsigned char *buf, int idx, int width)
+static int MOD_EXP_CTIME_COPY_TO_PREBUF(BIGNUM *b, size_t top,
+ unsigned char *buf, int idx, int width)
{
size_t i, j;
return 1;
}
-static int MOD_EXP_CTIME_COPY_FROM_PREBUF(BIGNUM *b, int top, unsigned char *buf, int idx, int width)
+static int MOD_EXP_CTIME_COPY_FROM_PREBUF(BIGNUM *b, size_t top,
+ unsigned char *buf, int idx,
+ int width)
{
size_t i, j;
const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
{
int i,bits,ret=0,idx,window,wvalue;
- int top;
+ size_t top;
BIGNUM *r;
const BIGNUM *aa;
BN_MONT_CTX *mont=NULL;
int numPowers;
unsigned char *powerbufFree=NULL;
- int powerbufLen = 0;
+ size_t powerbufLen = 0;
unsigned char *powerbuf=NULL;
BIGNUM *computeTemp=NULL, *am=NULL;
*/
numPowers = 1 << window;
powerbufLen = sizeof(m->d[0])*top*numPowers;
- if ((powerbufFree=(unsigned char*)OPENSSL_malloc(powerbufLen+MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH)) == NULL)
+ if ((powerbufFree=OPENSSL_malloc(powerbufLen+MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH)) == NULL)
goto err;
powerbuf = MOD_EXP_CTIME_ALIGN(powerbufFree);
#define HEADER_BN_LCL_H
#include <openssl/bn.h>
+#include <unistd.h>
#ifdef __cplusplus
extern "C" {
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 cl, int dl);
-void bn_mul_recursive(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b,int n2,
- int dna,int dnb,BN_ULONG *t);
-void bn_mul_part_recursive(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b,
- int n,int tna,int tnb,BN_ULONG *t);
-void bn_sqr_recursive(BN_ULONG *r,const BN_ULONG *a, int n2, BN_ULONG *t);
-void bn_mul_low_normal(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b, int n);
-void bn_mul_low_recursive(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b,int n2,
- BN_ULONG *t);
-void bn_mul_high(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b,BN_ULONG *l,int n2,
- BN_ULONG *t);
+void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, size_t n2,
+ int dna, int dnb, BN_ULONG *t);
+void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b,
+ int n, int tna, int tnb, BN_ULONG *t);
+void bn_sqr_recursive(BN_ULONG *r, const BN_ULONG *a, int n2, BN_ULONG *t);
+void bn_mul_low_normal(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n);
+void bn_mul_low_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2,
+ BN_ULONG *t);
+void bn_mul_high(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, BN_ULONG *l, int n2,
+ BN_ULONG *t);
BN_ULONG bn_add_part_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b,
- int cl, int dl);
+ size_t cl, ssize_t dl);
BN_ULONG bn_sub_part_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b,
- int cl, int 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 cl, int 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);
#ifdef __cplusplus
}
/* This is used both by bn_expand2() and bn_dup_expand() */
/* The caller MUST check that words > b->dmax before calling this */
-static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
+static BN_ULONG *bn_expand_internal(const BIGNUM *b, size_t words)
{
BN_ULONG *A,*a = NULL;
const BN_ULONG *B;
*/
#ifndef OPENSSL_NO_DEPRECATED
-BIGNUM *bn_dup_expand(const BIGNUM *b, int words)
+BIGNUM *bn_dup_expand(const BIGNUM *b, size_t words)
{
BIGNUM *r = NULL;
* It is mostly used by the various BIGNUM routines. If there is an error,
* NULL is returned. If not, 'b' is returned. */
-BIGNUM *bn_expand2(BIGNUM *b, int words)
+BIGNUM *bn_expand2(BIGNUM *b, size_t words)
{
bn_check_top(b);
return(1);
}
-BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
+BIGNUM *BN_bin2bn(const unsigned char *s, size_t len, BIGNUM *ret)
{
unsigned int i,m;
unsigned int n;
}
i=((n-1)/BN_BYTES)+1;
m=((n-1)%(BN_BYTES));
- if (bn_wexpand(ret, (int)i) == NULL)
+ if (bn_wexpand(ret, i) == NULL)
{
if (bn) BN_free(bn);
return NULL;
int BN_set_bit(BIGNUM *a, int n)
{
- int i,j,k;
+ size_t i,j,k;
if (n < 0)
return 0;
return(num+4+ext);
}
-BIGNUM *BN_mpi2bn(const unsigned char *d, int n, BIGNUM *a)
+BIGNUM *BN_mpi2bn(const unsigned char *d, size_t n, BIGNUM *a)
{
long len;
int neg=0;
assembler counterparts for the systems that use assembler files. */
BN_ULONG bn_sub_part_words(BN_ULONG *r,
- const BN_ULONG *a, const BN_ULONG *b,
- int cl, int dl)
+ const BN_ULONG *a, const BN_ULONG *b,
+ size_t cl, ssize_t dl)
{
BN_ULONG c, t;
}
else
{
- int save_dl = dl;
+ ssize_t save_dl = dl;
#ifdef BN_COUNT
fprintf(stderr, " bn_sub_part_words %d + %d (dl > 0, c = %d)\n", cl, dl, c);
#endif
#endif
BN_ULONG bn_add_part_words(BN_ULONG *r,
- const BN_ULONG *a, const BN_ULONG *b,
- int cl, int dl)
+ const BN_ULONG *a, const BN_ULONG *b,
+ size_t cl, ssize_t dl)
{
BN_ULONG c, l, t;
if (dl < 0)
{
- int save_dl = dl;
+ ssize_t save_dl = dl;
#ifdef BN_COUNT
fprintf(stderr, " bn_add_part_words %d + %d (dl < 0, c = %d)\n", cl, dl, c);
#endif
* a[1]*b[1]
*/
/* 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, int n2,
- int dna, int dnb, BN_ULONG *t)
+void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, size_t n2,
+ int dna, int dnb, BN_ULONG *t)
{
int n=n2/2,c1,c2;
int tna=n+dna, tnb=n+dnb;
* r[32] holds (b[1]*b[1])
*/
- c1=(int)(bn_add_words(t,r,&(r[n2]),n2));
+ c1=bn_add_words(t,r,&(r[n2]),n2);
if (neg) /* if t[32] is negative */
{
- c1-=(int)(bn_sub_words(&(t[n2]),t,&(t[n2]),n2));
+ c1-=bn_sub_words(&(t[n2]),t,&(t[n2]),n2);
}
else
{
/* Might have a carry */
- c1+=(int)(bn_add_words(&(t[n2]),&(t[n2]),t,n2));
+ c1+=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])
* r[32] holds (b[1]*b[1])
* c1 holds the carry bits
*/
- c1+=(int)(bn_add_words(&(r[n]),&(r[n]),&(t[n2]),n2));
+ c1+=bn_add_words(&(r[n]),&(r[n]),&(t[n2]),n2);
if (c1)
{
p= &(r[n+n2]);
return 1;
}
-typedef BN_ULONG (*bn_addsub_f)(BN_ULONG *,const BN_ULONG *,const BN_ULONG *,int);
+typedef BN_ULONG (*bn_addsub_f)(BN_ULONG *, const BN_ULONG *, const BN_ULONG *,
+ size_t);
#define nist_set_224(to, from, a1, a2, a3, a4, a5, a6, a7) \
{ \
}
int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *field,
- BN_CTX *ctx)
+ BN_CTX *ctx)
{
int top = a->top, i;
int carry;
char *buf;
char *p;
- buf=(char *)OPENSSL_malloc(a->top*BN_BYTES*2+2);
+ buf=OPENSSL_malloc(a->top*BN_BYTES*2+2);
if (buf == NULL)
{
BNerr(BN_F_BN_BN2HEX,ERR_R_MALLOC_FAILURE);
i=BN_num_bits(a)*3;
num=(i/10+i/1000+1)+1;
bn_data=(BN_ULONG *)OPENSSL_malloc((num/BN_DEC_NUM+1)*sizeof(BN_ULONG));
- buf=(char *)OPENSSL_malloc(num+3);
+ buf=OPENSSL_malloc(num+3);
if ((buf == NULL) || (bn_data == NULL))
{
BNerr(BN_F_BN_BN2DEC,ERR_R_MALLOC_FAILURE);
return(ret);
}
-int BN_rand(BIGNUM *rnd, int bits, int top, int bottom)
+int BN_rand(BIGNUM *rnd, size_t bits, int top, int bottom)
{
return bnrand(0, rnd, bits, top, bottom);
}
-int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom)
+int BN_pseudo_rand(BIGNUM *rnd, size_t bits, int top, int bottom)
{
return bnrand(1, rnd, bits, top, bottom);
}
#if 1
-int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom)
+int BN_bntest_rand(BIGNUM *rnd, size_t bits, int top, int bottom)
{
return bnrand(2, rnd, bits, top, bottom);
}
/* random number r: 0 <= r < range */
static int bn_rand_range(int pseudo, BIGNUM *r, const BIGNUM *range)
{
- int (*bn_rand)(BIGNUM *, int, int, int) = pseudo ? BN_pseudo_rand : BN_rand;
+ int (*bn_rand)(BIGNUM *, size_t, int, int)
+ = pseudo ? BN_pseudo_rand : BN_rand;
int n;
int count = 100;
* we can do faster division if the remainder is not required.
*/
/* r := 2^len / m */
-int BN_reciprocal(BIGNUM *r, const BIGNUM *m, int len, BN_CTX *ctx)
+int BN_reciprocal(BIGNUM *r, const BIGNUM *m, size_t len, BN_CTX *ctx)
{
int ret= -1;
BIGNUM *t;
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 i;
#define MemCheck_off() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE)
#define is_MemCheck_on() CRYPTO_is_mem_check_on()
-#define OPENSSL_malloc(num) CRYPTO_malloc((int)num,__FILE__,__LINE__)
+#define OPENSSL_malloc(num) CRYPTO_malloc(num,__FILE__,__LINE__)
#define OPENSSL_strdup(str) CRYPTO_strdup((str),__FILE__,__LINE__)
#define OPENSSL_realloc(addr,num) \
CRYPTO_realloc((char *)addr,(int)num,__FILE__,__LINE__)
void (*f)(void *));
int CRYPTO_set_locked_mem_ex_functions(void *(*m)(size_t,const char *,int),
void (*free_func)(void *));
-int CRYPTO_set_mem_debug_functions(void (*m)(void *,int,const char *,int,int),
- void (*r)(void *,void *,int,const char *,int,int),
+int CRYPTO_set_mem_debug_functions(void (*m)(void *,size_t,const char *,int,
+ int),
+ void (*r)(void *,void *,size_t,const char *,
+ int,int),
void (*f)(void *,int),
void (*so)(long),
long (*go)(void));
void (**f)(void *));
void CRYPTO_get_locked_mem_ex_functions(void *(**m)(size_t,const char *,int),
void (**f)(void *));
-void CRYPTO_get_mem_debug_functions(void (**m)(void *,int,const char *,int,int),
- void (**r)(void *,void *,int,const char *,int,int),
+void CRYPTO_get_mem_debug_functions(void (**m)(void *,size_t,const char *,int,
+ int),
+ void (**r)(void *,void *,size_t,
+ const char *,int,int),
void (**f)(void *,int),
void (**so)(long),
long (**go)(void));
-void *CRYPTO_malloc_locked(int num, const char *file, int line);
+void *CRYPTO_malloc_locked(size_t num, const char *file, int line);
void CRYPTO_free_locked(void *);
-void *CRYPTO_malloc(int num, const char *file, int line);
+void *CRYPTO_malloc(size_t num, const char *file, int line);
char *CRYPTO_strdup(const char *str, const char *file, int line);
void CRYPTO_free(void *);
-void *CRYPTO_realloc(void *addr,int num, const char *file, int line);
-void *CRYPTO_realloc_clean(void *addr,int old_num,int num,const char *file,
- int line);
-void *CRYPTO_remalloc(void *addr,int num, const char *file, int line);
+void *CRYPTO_realloc(void *addr, size_t num, const char *file, int line);
+void *CRYPTO_realloc_clean(void *addr, size_t old_num, size_t num,
+ const char *file, int line);
+void *CRYPTO_remalloc(void *addr, size_t num, const char *file, int line);
void OPENSSL_cleanse(void *ptr, size_t len);
* 0: called before the actual memory allocation has taken place
* 1: called after the actual memory allocation has taken place
*/
-void CRYPTO_dbg_malloc(void *addr,int num,const char *file,int line,int before_p);
-void CRYPTO_dbg_realloc(void *addr1,void *addr2,int num,const char *file,int line,int before_p);
+void CRYPTO_dbg_malloc(void *addr,size_t 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);
/* Tell the debugging code about options. By default, the following values
* apply:
/* XXX use correct function pointer types */
#ifdef CRYPTO_MDEBUG
/* use default functions from mem_dbg.c */
-static void (*malloc_debug_func)(void *,int,const char *,int,int)
+static void (*malloc_debug_func)(void *,size_t,const char *,int,int)
= CRYPTO_dbg_malloc;
-static void (*realloc_debug_func)(void *,void *,int,const char *,int,int)
+static void (*realloc_debug_func)(void *,void *,size_t,const char *,int,int)
= CRYPTO_dbg_realloc;
static void (*free_debug_func)(void *,int) = CRYPTO_dbg_free;
static void (*set_debug_options_func)(long) = CRYPTO_dbg_set_options;
return 1;
}
-int CRYPTO_set_mem_debug_functions(void (*m)(void *,int,const char *,int,int),
- void (*r)(void *,void *,int,const char *,int,int),
+int CRYPTO_set_mem_debug_functions(void (*m)(void *,size_t,const char *,int,int),
+ void (*r)(void *,void *,size_t,const char *,int,int),
void (*f)(void *,int),
void (*so)(long),
long (*go)(void))
if (f != NULL) *f=free_locked_func;
}
-void CRYPTO_get_mem_debug_functions(void (**m)(void *,int,const char *,int,int),
- void (**r)(void *,void *,int,const char *,int,int),
+void CRYPTO_get_mem_debug_functions(void (**m)(void *,size_t,const char *,int,int),
+ void (**r)(void *,void *,size_t,const char *,int,int),
void (**f)(void *,int),
void (**so)(long),
long (**go)(void))
}
-void *CRYPTO_malloc_locked(int num, const char *file, int line)
+void *CRYPTO_malloc_locked(size_t num, const char *file, int line)
{
void *ret = NULL;
free_debug_func(NULL, 1);
}
-void *CRYPTO_malloc(int num, const char *file, int line)
+void *CRYPTO_malloc(size_t num, const char *file, int line)
{
void *ret = NULL;
return ret;
}
-void *CRYPTO_realloc(void *str, int num, const char *file, int line)
+void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
{
void *ret = NULL;
return ret;
}
-void *CRYPTO_realloc_clean(void *str, int old_len, int num, const char *file,
- int line)
+void *CRYPTO_realloc_clean(void *str, size_t old_len, size_t num,
+ const char *file, int line)
{
void *ret = NULL;
free_debug_func(NULL, 1);
}
-void *CRYPTO_remalloc(void *a, int num, const char *file, int line)
+void *CRYPTO_remalloc(void *a, size_t num, const char *file, int line)
{
if (a != NULL) OPENSSL_free(a);
- a=(char *)OPENSSL_malloc(num);
+ a=OPENSSL_malloc(num);
return(a);
}
static unsigned long break_order_num=0;
-void CRYPTO_dbg_malloc(void *addr, int num, const char *file, int line,
+void CRYPTO_dbg_malloc(void *addr, size_t num, const char *file, int line,
int before_p)
{
MEM *m,*mm;
}
}
-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)
{
MEM m,*mp;
char buf[1024];
char *bufp = buf;
APP_INFO *amip;
- int ami_cnt;
+ size_t ami_cnt;
struct tm *lcl = NULL;
CRYPTO_THREADID ti;
do
{
- int buf_len;
+ size_t buf_len;
int info_len;
ami_cnt++;
struct doall_sorted
{
int type;
- int n;
+ size_t n;
const OBJ_NAME **names;
};
d.n=0;
OBJ_NAME_do_all(type,do_all_sorted_fn,&d);
- qsort((void *)d.names,d.n,sizeof *d.names,do_all_sorted_cmp);
+ qsort(d.names,d.n,sizeof *d.names,do_all_sorted_cmp);
for(n=0 ; n < d.n ; ++n)
fn(d.names[n],arg);
unsigned char *buf;
unsigned char *p;
const unsigned char *cp;
- int i, j;
+ size_t i;
+ size_t j;
if(!no_name) {
if( ((nid = OBJ_sn2nid(s)) != NID_undef) ||
/* Work out size of content octets */
i=a2d_ASN1_OBJECT(NULL,0,s,-1);
- if (i <= 0) {
+ if (i == 0) {
/* Don't clear the error */
/*ERR_clear_error();*/
return NULL;
/* Work out total size */
j = ASN1_object_size(0,i,V_ASN1_OBJECT);
- if((buf=(unsigned char *)OPENSSL_malloc(j)) == NULL) return NULL;
+ if((buf=OPENSSL_malloc(j)) == NULL) return NULL;
p = buf;
/* Write out tag+length */
return op;
}
-int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name)
+int OBJ_obj2txt(char *buf, size_t buf_len, const ASN1_OBJECT *a, int no_name)
{
int i,n=0,len,nid, first, use_bn;
BIGNUM *bl;
goto err;
if (use_bn)
{
- if (!BN_add_word(bl, c & 0x7f))
+ if (!BN_add_word(bl, c & 0x7fU))
goto err;
}
else
int ok=0;
ASN1_OBJECT *op=NULL;
unsigned char *buf;
- int i;
+ size_t i;
i=a2d_ASN1_OBJECT(NULL,0,oid,-1);
- if (i <= 0) return(0);
+ if (i == 0)
+ return 0;
- if ((buf=(unsigned char *)OPENSSL_malloc(i)) == NULL)
+ if ((buf=OPENSSL_malloc(i)) == NULL)
{
OBJerr(OBJ_F_OBJ_CREATE,ERR_R_MALLOC_FAILURE);
return(0);
i=a2d_ASN1_OBJECT(buf,i,oid,-1);
if (i == 0)
goto err;
- op=(ASN1_OBJECT *)ASN1_OBJECT_create(OBJ_new_nid(1),buf,i,sn,ln);
+ op=ASN1_OBJECT_create(OBJ_new_nid(1),buf,i,sn,ln);
if (op == NULL)
goto err;
ok=OBJ_add_object(op);
const char * OBJ_nid2sn(int n);
int OBJ_obj2nid(const ASN1_OBJECT *o);
ASN1_OBJECT * OBJ_txt2obj(const char *s, int no_name);
-int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name);
+int OBJ_obj2txt(char *buf, size_t buf_len, const ASN1_OBJECT *a,
+ int no_name);
int OBJ_txt2nid(const char *s);
int OBJ_ln2nid(const char *s);
int OBJ_sn2nid(const char *s);