diff options
author | beck <> | 2014-04-17 13:37:50 +0000 |
---|---|---|
committer | beck <> | 2014-04-17 13:37:50 +0000 |
commit | bddb7c686e3d1aeb156722adc64b6c35ae720f87 (patch) | |
tree | 7595a93a27385c367802aa17ecf20f96551cf14d /src/lib/libssl/ssl_ciph.c | |
parent | ecec66222d758996a4ff2671ca5026d9ede5ef76 (diff) | |
download | openbsd-bddb7c686e3d1aeb156722adc64b6c35ae720f87.tar.gz openbsd-bddb7c686e3d1aeb156722adc64b6c35ae720f87.tar.bz2 openbsd-bddb7c686e3d1aeb156722adc64b6c35ae720f87.zip |
Change library to use intrinsic memory allocation functions instead of
OPENSSL_foo wrappers. This changes:
OPENSSL_malloc->malloc
OPENSSL_free->free
OPENSSL_relloc->realloc
OPENSSL_freeFunc->free
Diffstat (limited to 'src/lib/libssl/ssl_ciph.c')
-rw-r--r-- | src/lib/libssl/ssl_ciph.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/lib/libssl/ssl_ciph.c b/src/lib/libssl/ssl_ciph.c index 4bd3be0d41..b56a93d4cb 100644 --- a/src/lib/libssl/ssl_ciph.c +++ b/src/lib/libssl/ssl_ciph.c | |||
@@ -456,12 +456,12 @@ load_builtin_compressions(void) | |||
456 | MemCheck_off(); | 456 | MemCheck_off(); |
457 | ssl_comp_methods = sk_SSL_COMP_new(sk_comp_cmp); | 457 | ssl_comp_methods = sk_SSL_COMP_new(sk_comp_cmp); |
458 | if (ssl_comp_methods != NULL) { | 458 | if (ssl_comp_methods != NULL) { |
459 | comp = (SSL_COMP *)OPENSSL_malloc(sizeof(SSL_COMP)); | 459 | comp = (SSL_COMP *)malloc(sizeof(SSL_COMP)); |
460 | if (comp != NULL) { | 460 | if (comp != NULL) { |
461 | comp->method = COMP_zlib(); | 461 | comp->method = COMP_zlib(); |
462 | if (comp->method && | 462 | if (comp->method && |
463 | comp->method->type == NID_undef) | 463 | comp->method->type == NID_undef) |
464 | OPENSSL_free(comp); | 464 | free(comp); |
465 | else { | 465 | else { |
466 | comp->id = SSL_COMP_ZLIB_IDX; | 466 | comp->id = SSL_COMP_ZLIB_IDX; |
467 | comp->name = comp->method->name; | 467 | comp->name = comp->method->name; |
@@ -1037,7 +1037,7 @@ ssl_cipher_strength_sort(CIPHER_ORDER **head_p, CIPHER_ORDER **tail_p) | |||
1037 | curr = curr->next; | 1037 | curr = curr->next; |
1038 | } | 1038 | } |
1039 | 1039 | ||
1040 | number_uses = OPENSSL_malloc((max_strength_bits + 1) * sizeof(int)); | 1040 | number_uses = malloc((max_strength_bits + 1) * sizeof(int)); |
1041 | if (!number_uses) { | 1041 | if (!number_uses) { |
1042 | SSLerr(SSL_F_SSL_CIPHER_STRENGTH_SORT, ERR_R_MALLOC_FAILURE); | 1042 | SSLerr(SSL_F_SSL_CIPHER_STRENGTH_SORT, ERR_R_MALLOC_FAILURE); |
1043 | return (0); | 1043 | return (0); |
@@ -1061,7 +1061,7 @@ ssl_cipher_strength_sort(CIPHER_ORDER **head_p, CIPHER_ORDER **tail_p) | |||
1061 | if (number_uses[i] > 0) | 1061 | if (number_uses[i] > 0) |
1062 | ssl_cipher_apply_rule(0, 0, 0, 0, 0, 0, 0, CIPHER_ORD, i, head_p, tail_p); | 1062 | ssl_cipher_apply_rule(0, 0, 0, 0, 0, 0, 0, CIPHER_ORD, i, head_p, tail_p); |
1063 | 1063 | ||
1064 | OPENSSL_free(number_uses); | 1064 | free(number_uses); |
1065 | return (1); | 1065 | return (1); |
1066 | } | 1066 | } |
1067 | 1067 | ||
@@ -1336,7 +1336,7 @@ STACK_OF(SSL_CIPHER) | |||
1336 | #ifdef KSSL_DEBUG | 1336 | #ifdef KSSL_DEBUG |
1337 | printf("ssl_create_cipher_list() for %d ciphers\n", num_of_ciphers); | 1337 | printf("ssl_create_cipher_list() for %d ciphers\n", num_of_ciphers); |
1338 | #endif /* KSSL_DEBUG */ | 1338 | #endif /* KSSL_DEBUG */ |
1339 | co_list = (CIPHER_ORDER *)OPENSSL_malloc(sizeof(CIPHER_ORDER) * num_of_ciphers); | 1339 | co_list = (CIPHER_ORDER *)malloc(sizeof(CIPHER_ORDER) * num_of_ciphers); |
1340 | if (co_list == NULL) { | 1340 | if (co_list == NULL) { |
1341 | SSLerr(SSL_F_SSL_CREATE_CIPHER_LIST, ERR_R_MALLOC_FAILURE); | 1341 | SSLerr(SSL_F_SSL_CREATE_CIPHER_LIST, ERR_R_MALLOC_FAILURE); |
1342 | return(NULL); /* Failure */ | 1342 | return(NULL); /* Failure */ |
@@ -1380,7 +1380,7 @@ STACK_OF(SSL_CIPHER) | |||
1380 | /* Now sort by symmetric encryption strength. The above ordering remains | 1380 | /* Now sort by symmetric encryption strength. The above ordering remains |
1381 | * in force within each class */ | 1381 | * in force within each class */ |
1382 | if (!ssl_cipher_strength_sort(&head, &tail)) { | 1382 | if (!ssl_cipher_strength_sort(&head, &tail)) { |
1383 | OPENSSL_free(co_list); | 1383 | free(co_list); |
1384 | return NULL; | 1384 | return NULL; |
1385 | } | 1385 | } |
1386 | 1386 | ||
@@ -1398,9 +1398,9 @@ STACK_OF(SSL_CIPHER) | |||
1398 | */ | 1398 | */ |
1399 | num_of_group_aliases = sizeof(cipher_aliases) / sizeof(SSL_CIPHER); | 1399 | num_of_group_aliases = sizeof(cipher_aliases) / sizeof(SSL_CIPHER); |
1400 | num_of_alias_max = num_of_ciphers + num_of_group_aliases + 1; | 1400 | num_of_alias_max = num_of_ciphers + num_of_group_aliases + 1; |
1401 | ca_list = OPENSSL_malloc(sizeof(SSL_CIPHER *) * num_of_alias_max); | 1401 | ca_list = malloc(sizeof(SSL_CIPHER *) * num_of_alias_max); |
1402 | if (ca_list == NULL) { | 1402 | if (ca_list == NULL) { |
1403 | OPENSSL_free(co_list); | 1403 | free(co_list); |
1404 | SSLerr(SSL_F_SSL_CREATE_CIPHER_LIST, ERR_R_MALLOC_FAILURE); | 1404 | SSLerr(SSL_F_SSL_CREATE_CIPHER_LIST, ERR_R_MALLOC_FAILURE); |
1405 | return(NULL); /* Failure */ | 1405 | return(NULL); /* Failure */ |
1406 | } | 1406 | } |
@@ -1425,11 +1425,11 @@ STACK_OF(SSL_CIPHER) | |||
1425 | if (ok && (strlen(rule_p) > 0)) | 1425 | if (ok && (strlen(rule_p) > 0)) |
1426 | ok = ssl_cipher_process_rulestr(rule_p, &head, &tail, ca_list); | 1426 | ok = ssl_cipher_process_rulestr(rule_p, &head, &tail, ca_list); |
1427 | 1427 | ||
1428 | OPENSSL_free((void *)ca_list); /* Not needed anymore */ | 1428 | free((void *)ca_list); /* Not needed anymore */ |
1429 | 1429 | ||
1430 | if (!ok) | 1430 | if (!ok) |
1431 | { /* Rule processing failure */ | 1431 | { /* Rule processing failure */ |
1432 | OPENSSL_free(co_list); | 1432 | free(co_list); |
1433 | return (NULL); | 1433 | return (NULL); |
1434 | } | 1434 | } |
1435 | 1435 | ||
@@ -1438,7 +1438,7 @@ STACK_OF(SSL_CIPHER) | |||
1438 | * if we cannot get one. | 1438 | * if we cannot get one. |
1439 | */ | 1439 | */ |
1440 | if ((cipherstack = sk_SSL_CIPHER_new_null()) == NULL) { | 1440 | if ((cipherstack = sk_SSL_CIPHER_new_null()) == NULL) { |
1441 | OPENSSL_free(co_list); | 1441 | free(co_list); |
1442 | return (NULL); | 1442 | return (NULL); |
1443 | } | 1443 | } |
1444 | 1444 | ||
@@ -1454,7 +1454,7 @@ STACK_OF(SSL_CIPHER) | |||
1454 | #endif | 1454 | #endif |
1455 | } | 1455 | } |
1456 | } | 1456 | } |
1457 | OPENSSL_free(co_list); /* Not needed any longer */ | 1457 | free(co_list); /* Not needed any longer */ |
1458 | 1458 | ||
1459 | tmp_cipher_list = sk_SSL_CIPHER_dup(cipherstack); | 1459 | tmp_cipher_list = sk_SSL_CIPHER_dup(cipherstack); |
1460 | if (tmp_cipher_list == NULL) { | 1460 | if (tmp_cipher_list == NULL) { |
@@ -1642,9 +1642,9 @@ char | |||
1642 | 1642 | ||
1643 | if (buf == NULL) { | 1643 | if (buf == NULL) { |
1644 | len = 128; | 1644 | len = 128; |
1645 | buf = OPENSSL_malloc(len); | 1645 | buf = malloc(len); |
1646 | if (buf == NULL) | 1646 | if (buf == NULL) |
1647 | return("OPENSSL_malloc Error"); | 1647 | return("malloc Error"); |
1648 | } else if (len < 128) | 1648 | } else if (len < 128) |
1649 | return("Buffer too small"); | 1649 | return("Buffer too small"); |
1650 | 1650 | ||
@@ -1767,19 +1767,19 @@ SSL_COMP_add_compression_method(int id, COMP_METHOD *cm) | |||
1767 | } | 1767 | } |
1768 | 1768 | ||
1769 | MemCheck_off(); | 1769 | MemCheck_off(); |
1770 | comp = (SSL_COMP *)OPENSSL_malloc(sizeof(SSL_COMP)); | 1770 | comp = (SSL_COMP *)malloc(sizeof(SSL_COMP)); |
1771 | comp->id = id; | 1771 | comp->id = id; |
1772 | comp->method = cm; | 1772 | comp->method = cm; |
1773 | load_builtin_compressions(); | 1773 | load_builtin_compressions(); |
1774 | if (ssl_comp_methods && | 1774 | if (ssl_comp_methods && |
1775 | sk_SSL_COMP_find(ssl_comp_methods, comp) >= 0) { | 1775 | sk_SSL_COMP_find(ssl_comp_methods, comp) >= 0) { |
1776 | OPENSSL_free(comp); | 1776 | free(comp); |
1777 | MemCheck_on(); | 1777 | MemCheck_on(); |
1778 | SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD, SSL_R_DUPLICATE_COMPRESSION_ID); | 1778 | SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD, SSL_R_DUPLICATE_COMPRESSION_ID); |
1779 | return (1); | 1779 | return (1); |
1780 | } else if ((ssl_comp_methods == NULL) || | 1780 | } else if ((ssl_comp_methods == NULL) || |
1781 | !sk_SSL_COMP_push(ssl_comp_methods, comp)) { | 1781 | !sk_SSL_COMP_push(ssl_comp_methods, comp)) { |
1782 | OPENSSL_free(comp); | 1782 | free(comp); |
1783 | MemCheck_on(); | 1783 | MemCheck_on(); |
1784 | SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD, ERR_R_MALLOC_FAILURE); | 1784 | SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD, ERR_R_MALLOC_FAILURE); |
1785 | return (1); | 1785 | return (1); |