summaryrefslogtreecommitdiff
path: root/src/lib/libssl/ssl_ciph.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/ssl_ciph.c')
-rw-r--r--src/lib/libssl/ssl_ciph.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/lib/libssl/ssl_ciph.c b/src/lib/libssl/ssl_ciph.c
index 7436a50ad1..f63163f26c 100644
--- a/src/lib/libssl/ssl_ciph.c
+++ b/src/lib/libssl/ssl_ciph.c
@@ -518,7 +518,7 @@ static int ssl_cipher_strength_sort(CIPHER_ORDER *list, CIPHER_ORDER **head_p,
518 curr = curr->next; 518 curr = curr->next;
519 } 519 }
520 520
521 number_uses = Malloc((max_strength_bits + 1) * sizeof(int)); 521 number_uses = OPENSSL_malloc((max_strength_bits + 1) * sizeof(int));
522 if (!number_uses) 522 if (!number_uses)
523 { 523 {
524 SSLerr(SSL_F_SSL_CIPHER_STRENGTH_SORT,ERR_R_MALLOC_FAILURE); 524 SSLerr(SSL_F_SSL_CIPHER_STRENGTH_SORT,ERR_R_MALLOC_FAILURE);
@@ -545,7 +545,7 @@ static int ssl_cipher_strength_sort(CIPHER_ORDER *list, CIPHER_ORDER **head_p,
545 ssl_cipher_apply_rule(0, 0, 0, 0, CIPHER_ORD, i, 545 ssl_cipher_apply_rule(0, 0, 0, 0, CIPHER_ORD, i,
546 list, head_p, tail_p); 546 list, head_p, tail_p);
547 547
548 Free(number_uses); 548 OPENSSL_free(number_uses);
549 return(1); 549 return(1);
550 } 550 }
551 551
@@ -738,7 +738,7 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
738 * it is used for allocation. 738 * it is used for allocation.
739 */ 739 */
740 num_of_ciphers = ssl_method->num_ciphers(); 740 num_of_ciphers = ssl_method->num_ciphers();
741 list = (CIPHER_ORDER *)Malloc(sizeof(CIPHER_ORDER) * num_of_ciphers); 741 list = (CIPHER_ORDER *)OPENSSL_malloc(sizeof(CIPHER_ORDER) * num_of_ciphers);
742 if (list == NULL) 742 if (list == NULL)
743 { 743 {
744 SSLerr(SSL_F_SSL_CREATE_CIPHER_LIST,ERR_R_MALLOC_FAILURE); 744 SSLerr(SSL_F_SSL_CREATE_CIPHER_LIST,ERR_R_MALLOC_FAILURE);
@@ -759,10 +759,10 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
759 num_of_group_aliases = sizeof(cipher_aliases) / sizeof(SSL_CIPHER); 759 num_of_group_aliases = sizeof(cipher_aliases) / sizeof(SSL_CIPHER);
760 num_of_alias_max = num_of_ciphers + num_of_group_aliases + 1; 760 num_of_alias_max = num_of_ciphers + num_of_group_aliases + 1;
761 ca_list = 761 ca_list =
762 (SSL_CIPHER **)Malloc(sizeof(SSL_CIPHER *) * num_of_alias_max); 762 (SSL_CIPHER **)OPENSSL_malloc(sizeof(SSL_CIPHER *) * num_of_alias_max);
763 if (ca_list == NULL) 763 if (ca_list == NULL)
764 { 764 {
765 Free(list); 765 OPENSSL_free(list);
766 SSLerr(SSL_F_SSL_CREATE_CIPHER_LIST,ERR_R_MALLOC_FAILURE); 766 SSLerr(SSL_F_SSL_CREATE_CIPHER_LIST,ERR_R_MALLOC_FAILURE);
767 return(NULL); /* Failure */ 767 return(NULL); /* Failure */
768 } 768 }
@@ -788,20 +788,20 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
788 ok = ssl_cipher_process_rulestr(rule_p, list, &head, &tail, 788 ok = ssl_cipher_process_rulestr(rule_p, list, &head, &tail,
789 ca_list); 789 ca_list);
790 790
791 Free(ca_list); /* Not needed anymore */ 791 OPENSSL_free(ca_list); /* Not needed anymore */
792 792
793 if (!ok) 793 if (!ok)
794 { /* Rule processing failure */ 794 { /* Rule processing failure */
795 Free(list); 795 OPENSSL_free(list);
796 return(NULL); 796 return(NULL);
797 } 797 }
798 /* 798 /*
799 * Allocate new "cipherstack" for the result, return with error 799 * Allocate new "cipherstack" for the result, return with error
800 * if we cannot get one. 800 * if we cannot get one.
801 */ 801 */
802 if ((cipherstack = sk_SSL_CIPHER_new(NULL)) == NULL) 802 if ((cipherstack = sk_SSL_CIPHER_new_null()) == NULL)
803 { 803 {
804 Free(list); 804 OPENSSL_free(list);
805 return(NULL); 805 return(NULL);
806 } 806 }
807 807
@@ -819,7 +819,7 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
819#endif 819#endif
820 } 820 }
821 } 821 }
822 Free(list); /* Not needed any longer */ 822 OPENSSL_free(list); /* Not needed any longer */
823 823
824 /* 824 /*
825 * The following passage is a little bit odd. If pointer variables 825 * The following passage is a little bit odd. If pointer variables
@@ -975,13 +975,14 @@ char *SSL_CIPHER_description(SSL_CIPHER *cipher, char *buf, int len)
975 975
976 if (buf == NULL) 976 if (buf == NULL)
977 { 977 {
978 buf=Malloc(128); 978 len=128;
979 if (buf == NULL) return("Malloc Error"); 979 buf=OPENSSL_malloc(len);
980 if (buf == NULL) return("OPENSSL_malloc Error");
980 } 981 }
981 else if (len < 128) 982 else if (len < 128)
982 return("Buffer too small"); 983 return("Buffer too small");
983 984
984 sprintf(buf,format,cipher->name,ver,kx,au,enc,mac,exp); 985 BIO_snprintf(buf,len,format,cipher->name,ver,kx,au,enc,mac,exp);
985 return(buf); 986 return(buf);
986 } 987 }
987 988
@@ -1036,7 +1037,8 @@ SSL_COMP *ssl3_comp_find(STACK_OF(SSL_COMP) *sk, int n)
1036 return(NULL); 1037 return(NULL);
1037 } 1038 }
1038 1039
1039static int sk_comp_cmp(SSL_COMP **a,SSL_COMP **b) 1040static int sk_comp_cmp(const SSL_COMP * const *a,
1041 const SSL_COMP * const *b)
1040 { 1042 {
1041 return((*a)->id-(*b)->id); 1043 return((*a)->id-(*b)->id);
1042 } 1044 }
@@ -1051,7 +1053,7 @@ int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm)
1051 SSL_COMP *comp; 1053 SSL_COMP *comp;
1052 STACK_OF(SSL_COMP) *sk; 1054 STACK_OF(SSL_COMP) *sk;
1053 1055
1054 comp=(SSL_COMP *)Malloc(sizeof(SSL_COMP)); 1056 comp=(SSL_COMP *)OPENSSL_malloc(sizeof(SSL_COMP));
1055 comp->id=id; 1057 comp->id=id;
1056 comp->method=cm; 1058 comp->method=cm;
1057 if (ssl_comp_methods == NULL) 1059 if (ssl_comp_methods == NULL)