Add type-safe STACKs and SETs.
This commit is contained in:
@@ -74,7 +74,7 @@ static EVP_CIPHER *ssl_cipher_methods[SSL_ENC_NUM_IDX]={
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
};
|
||||
|
||||
static STACK /* SSL_COMP */ *ssl_comp_methods=NULL;
|
||||
static STACK_OF(SSL_COMP) *ssl_comp_methods=NULL;
|
||||
|
||||
#define SSL_MD_MD5_IDX 0
|
||||
#define SSL_MD_SHA1_IDX 1
|
||||
@@ -211,9 +211,9 @@ SSL_COMP **comp;
|
||||
{
|
||||
|
||||
ctmp.id=s->compress_meth;
|
||||
i=sk_find(ssl_comp_methods,(char *)&ctmp);
|
||||
i=sk_SSL_COMP_find(ssl_comp_methods,&ctmp);
|
||||
if (i >= 0)
|
||||
*comp=(SSL_COMP *)sk_value(ssl_comp_methods,i);
|
||||
*comp=sk_SSL_COMP_value(ssl_comp_methods,i);
|
||||
else
|
||||
*comp=NULL;
|
||||
}
|
||||
@@ -298,14 +298,15 @@ CIPHER_ORDER **head,*curr,**tail;
|
||||
*tail=curr;
|
||||
}
|
||||
|
||||
STACK *ssl_create_cipher_list(ssl_method,cipher_list,cipher_list_by_id,str)
|
||||
STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(ssl_method,cipher_list,
|
||||
cipher_list_by_id,str)
|
||||
SSL_METHOD *ssl_method;
|
||||
STACK **cipher_list,**cipher_list_by_id;
|
||||
STACK_OF(SSL_CIPHER) **cipher_list,**cipher_list_by_id;
|
||||
char *str;
|
||||
{
|
||||
SSL_CIPHER *c;
|
||||
char *l;
|
||||
STACK *ret=NULL,*ok=NULL;
|
||||
STACK_OF(SSL_CIPHER) *ret=NULL,*ok=NULL;
|
||||
#define CL_BUF 40
|
||||
char buf[CL_BUF];
|
||||
char *tmp_str=NULL;
|
||||
@@ -340,7 +341,7 @@ char *str;
|
||||
|
||||
num=ssl_method->num_ciphers();
|
||||
|
||||
if ((ret=(STACK *)sk_new(NULL)) == NULL) goto err;
|
||||
if ((ret=sk_SSL_CIPHER_new(NULL)) == NULL) goto err;
|
||||
if ((ca_list=(STACK *)sk_new(cmp_by_name)) == NULL) goto err;
|
||||
|
||||
mask =SSL_kFZA;
|
||||
@@ -573,7 +574,7 @@ end_loop:
|
||||
{
|
||||
if (curr->active)
|
||||
{
|
||||
sk_push(ret,(char *)curr->cipher);
|
||||
sk_SSL_CIPHER_push(ret,curr->cipher);
|
||||
#ifdef CIPHER_DEBUG
|
||||
printf("<%s>\n",curr->cipher->name);
|
||||
#endif
|
||||
@@ -583,15 +584,15 @@ end_loop:
|
||||
if (cipher_list != NULL)
|
||||
{
|
||||
if (*cipher_list != NULL)
|
||||
sk_free(*cipher_list);
|
||||
sk_SSL_CIPHER_free(*cipher_list);
|
||||
*cipher_list=ret;
|
||||
}
|
||||
|
||||
if (cipher_list_by_id != NULL)
|
||||
{
|
||||
if (*cipher_list_by_id != NULL)
|
||||
sk_free(*cipher_list_by_id);
|
||||
*cipher_list_by_id=sk_dup(ret);
|
||||
sk_SSL_CIPHER_free(*cipher_list_by_id);
|
||||
*cipher_list_by_id=sk_SSL_CIPHER_dup(ret);
|
||||
}
|
||||
|
||||
if ( (cipher_list_by_id == NULL) ||
|
||||
@@ -599,14 +600,14 @@ end_loop:
|
||||
(cipher_list == NULL) ||
|
||||
(*cipher_list == NULL))
|
||||
goto err;
|
||||
sk_set_cmp_func(*cipher_list_by_id,ssl_cipher_ptr_id_cmp);
|
||||
sk_SSL_CIPHER_set_cmp_func(*cipher_list_by_id,ssl_cipher_ptr_id_cmp);
|
||||
|
||||
ok=ret;
|
||||
ret=NULL;
|
||||
err:
|
||||
if (tmp_str) Free(tmp_str);
|
||||
if (ops != NULL) Free(ops);
|
||||
if (ret != NULL) sk_free(ret);
|
||||
if (ret != NULL) sk_SSL_CIPHER_free(ret);
|
||||
if (ca_list != NULL) sk_free(ca_list);
|
||||
if (list != NULL) Free(list);
|
||||
return(ok);
|
||||
@@ -794,17 +795,17 @@ int *alg_bits;
|
||||
}
|
||||
|
||||
SSL_COMP *ssl3_comp_find(sk,n)
|
||||
STACK *sk;
|
||||
STACK_OF(SSL_COMP) *sk;
|
||||
int n;
|
||||
{
|
||||
SSL_COMP *ctmp;
|
||||
int i,nn;
|
||||
|
||||
if ((n == 0) || (sk == NULL)) return(NULL);
|
||||
nn=sk_num(sk);
|
||||
nn=sk_SSL_COMP_num(sk);
|
||||
for (i=0; i<nn; i++)
|
||||
{
|
||||
ctmp=(SSL_COMP *)sk_value(sk,i);
|
||||
ctmp=sk_SSL_COMP_value(sk,i);
|
||||
if (ctmp->id == n)
|
||||
return(ctmp);
|
||||
}
|
||||
@@ -817,7 +818,7 @@ SSL_COMP **a,**b;
|
||||
return((*a)->id-(*b)->id);
|
||||
}
|
||||
|
||||
STACK *SSL_COMP_get_compression_methods()
|
||||
STACK_OF(SSL_COMP) *SSL_COMP_get_compression_methods()
|
||||
{
|
||||
return(ssl_comp_methods);
|
||||
}
|
||||
@@ -827,16 +828,16 @@ int id;
|
||||
COMP_METHOD *cm;
|
||||
{
|
||||
SSL_COMP *comp;
|
||||
STACK *sk;
|
||||
STACK_OF(SSL_COMP) *sk;
|
||||
|
||||
comp=(SSL_COMP *)Malloc(sizeof(SSL_COMP));
|
||||
comp->id=id;
|
||||
comp->method=cm;
|
||||
if (ssl_comp_methods == NULL)
|
||||
sk=ssl_comp_methods=sk_new(sk_comp_cmp);
|
||||
sk=ssl_comp_methods=sk_SSL_COMP_new(sk_comp_cmp);
|
||||
else
|
||||
sk=ssl_comp_methods;
|
||||
if ((sk == NULL) || !sk_push(sk,(char *)comp))
|
||||
if ((sk == NULL) || !sk_SSL_COMP_push(sk,comp))
|
||||
{
|
||||
SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD,ERR_R_MALLOC_FAILURE);
|
||||
return(0);
|
||||
|
Reference in New Issue
Block a user