Commit babb3798 authored by Ben Laurie's avatar Ben Laurie
Browse files

Type-checked (and modern C compliant) OBJ_bsearch.

parent 6665ef30
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -4,6 +4,11 @@

 Changes between 0.9.8j and 0.9.9  [xx XXX xxxx]

  *) Type-checked OBJ_bsearch. Also some constification necessitated
     by type-checking.  Still to come: TXT_DB, bsearch(?),
     OBJ_bsearch_ex, qsort, CRYPTO_EX_DATA, ASN1_VALUE, ASN1_STRING,
     CONF_VALUE.  [Ben Laurie]

  *) New function OPENSSL_gmtime_adj() to add a specific number of days and
     seconds to a tm structure directly, instead of going through OS
     specific date routines. This avoids any issues with OS routines such
+1 −0
Original line number Diff line number Diff line
@@ -164,6 +164,7 @@ my %table=(
"debug-ben-openbsd","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::",
"debug-ben-openbsd-debug","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::",
"debug-ben-debug",	"gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::::",
"debug-ben-no-opt",	"gcc: -Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG -Werror -DL_ENDIAN -DTERMIOS -Wall -g3::(unknown)::::::",
"debug-ben-strict",	"gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DCONST_STRICT -O2 -Wall -Wshadow -Werror -Wpointer-arith -Wcast-qual -Wwrite-strings -pipe::(unknown)::::::",
"debug-rse","cc:-DTERMIOS -DL_ENDIAN -pipe -O -g -ggdb3 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
"debug-bodo",	"gcc:-DL_ENDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBIO_PAIR_DEBUG -DPEDANTIC -g -march=i486 -pedantic -Wshadow -Wall::-D_REENTRANT:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
+1 −1
Original line number Diff line number Diff line
@@ -1531,7 +1531,7 @@ static void print_stuff(BIO *bio, SSL *s, int full)
	char buf[BUFSIZ];
	STACK_OF(X509) *sk;
	STACK_OF(X509_NAME) *sk2;
	SSL_CIPHER *c;
	const SSL_CIPHER *c;
	X509_NAME *xn;
	int j,i;
#ifndef OPENSSL_NO_COMP
+1 −1
Original line number Diff line number Diff line
@@ -2182,7 +2182,7 @@ static int www_body(char *hostname, int s, unsigned char *context)
	int ret=1;
	int i,j,k,blank,dot;
	SSL *con;
	SSL_CIPHER *c;
	const SSL_CIPHER *c;
	BIO *io,*ssl_bio,*sbio;
	long total_bytes;

+10 −8
Original line number Diff line number Diff line
@@ -67,7 +67,6 @@ static STACK_OF(ASN1_STRING_TABLE) *stable = NULL;
static void st_free(ASN1_STRING_TABLE *tbl);
static int sk_table_cmp(const ASN1_STRING_TABLE * const *a,
			const ASN1_STRING_TABLE * const *b);
static int table_cmp(const void *a, const void *b);


/* This is the global mask for the mbstring functions: this is use to
@@ -186,22 +185,25 @@ static int sk_table_cmp(const ASN1_STRING_TABLE * const *a,
	return (*a)->nid - (*b)->nid;
}

static int table_cmp(const void *a, const void *b)
DECLARE_OBJ_BSEARCH_CMP_FN(ASN1_STRING_TABLE, ASN1_STRING_TABLE, table_cmp);

static int table_cmp(const ASN1_STRING_TABLE *a, const ASN1_STRING_TABLE *b)
{
	const ASN1_STRING_TABLE *sa = a, *sb = b;
	return sa->nid - sb->nid;
	return a->nid - b->nid;
}

IMPLEMENT_OBJ_BSEARCH_CMP_FN(ASN1_STRING_TABLE, ASN1_STRING_TABLE, table_cmp);

ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid)
{
	int idx;
	ASN1_STRING_TABLE *ttmp;
	ASN1_STRING_TABLE fnd;
	fnd.nid = nid;
	ttmp = (ASN1_STRING_TABLE *) OBJ_bsearch((char *)&fnd,
					(char *)tbl_standard, 
	ttmp = OBJ_bsearch(ASN1_STRING_TABLE, &fnd,
			   ASN1_STRING_TABLE, tbl_standard, 
			   sizeof(tbl_standard)/sizeof(ASN1_STRING_TABLE),
			sizeof(ASN1_STRING_TABLE), table_cmp);
			   table_cmp);
	if(ttmp) return ttmp;
	if(!stable) return NULL;
	idx = sk_ASN1_STRING_TABLE_find(stable, &fnd);
Loading