diff options
Diffstat (limited to 'networking')
| -rw-r--r-- | networking/ftpd.c | 13 | ||||
| -rw-r--r-- | networking/ifupdown.c | 5 | ||||
| -rw-r--r-- | networking/netstat.c | 7 | ||||
| -rw-r--r-- | networking/ntpd.c | 2 | ||||
| -rw-r--r-- | networking/tls.h | 18 | ||||
| -rw-r--r-- | networking/tls_pstm_montgomery_reduce.c | 4 |
6 files changed, 23 insertions, 26 deletions
diff --git a/networking/ftpd.c b/networking/ftpd.c index c3125410e..96db5d9fd 100644 --- a/networking/ftpd.c +++ b/networking/ftpd.c | |||
| @@ -491,19 +491,18 @@ static void | |||
| 491 | handle_pasv(void) | 491 | handle_pasv(void) |
| 492 | { | 492 | { |
| 493 | unsigned port; | 493 | unsigned port; |
| 494 | char *addr, *response; | 494 | char *response; |
| 495 | 495 | ||
| 496 | port = bind_for_passive_mode(); | 496 | port = bind_for_passive_mode(); |
| 497 | 497 | ||
| 498 | if (G.local_addr->u.sa.sa_family == AF_INET) | 498 | if (G.local_addr->u.sa.sa_family == AF_INET) |
| 499 | addr = xmalloc_sockaddr2dotted_noport(&G.local_addr->u.sa); | 499 | response = xmalloc_sockaddr2dotted_noport(&G.local_addr->u.sa); |
| 500 | else /* seen this in the wild done by other ftp servers: */ | 500 | else /* seen this in the wild done by other ftp servers: */ |
| 501 | addr = xstrdup("0.0.0.0"); | 501 | response = xstrdup("0.0.0.0"); |
| 502 | replace_char(addr, '.', ','); | 502 | replace_char(response, '.', ','); |
| 503 | 503 | ||
| 504 | response = xasprintf(STR(FTP_PASVOK)" PASV ok (%s,%u,%u)\r\n", | 504 | xasprintf_inplace(response, STR(FTP_PASVOK)" PASV ok (%s,%u,%u)\r\n", |
| 505 | addr, (int)(port >> 8), (int)(port & 255)); | 505 | response, (int)(port >> 8), (int)(port & 255)); |
| 506 | free(addr); | ||
| 507 | cmdio_write_raw(response); | 506 | cmdio_write_raw(response); |
| 508 | free(response); | 507 | free(response); |
| 509 | } | 508 | } |
diff --git a/networking/ifupdown.c b/networking/ifupdown.c index 9c3640be7..bc2dca506 100644 --- a/networking/ifupdown.c +++ b/networking/ifupdown.c | |||
| @@ -895,16 +895,15 @@ static struct interfaces_file_t *read_interfaces(const char *filename, struct in | |||
| 895 | while ((buf = xmalloc_fgetline(f)) != NULL) { | 895 | while ((buf = xmalloc_fgetline(f)) != NULL) { |
| 896 | #if ENABLE_DESKTOP | 896 | #if ENABLE_DESKTOP |
| 897 | /* Trailing "\" concatenates lines */ | 897 | /* Trailing "\" concatenates lines */ |
| 898 | //TODO: check how to handle "line\\" (double backslashes) | ||
| 898 | char *p; | 899 | char *p; |
| 899 | while ((p = last_char_is(buf, '\\')) != NULL) { | 900 | while ((p = last_char_is(buf, '\\')) != NULL) { |
| 900 | *p = '\0'; | 901 | *p = '\0'; |
| 901 | rest_of_line = xmalloc_fgetline(f); | 902 | rest_of_line = xmalloc_fgetline(f); |
| 902 | if (!rest_of_line) | 903 | if (!rest_of_line) |
| 903 | break; | 904 | break; |
| 904 | p = xasprintf("%s%s", buf, rest_of_line); | 905 | xasprintf_inplace(buf, "%s%s", buf, rest_of_line); |
| 905 | free(buf); | ||
| 906 | free(rest_of_line); | 906 | free(rest_of_line); |
| 907 | buf = p; | ||
| 908 | } | 907 | } |
| 909 | #endif | 908 | #endif |
| 910 | rest_of_line = buf; | 909 | rest_of_line = buf; |
diff --git a/networking/netstat.c b/networking/netstat.c index 807800a62..d7afa8fdd 100644 --- a/networking/netstat.c +++ b/networking/netstat.c | |||
| @@ -391,7 +391,7 @@ static const char *get_sname(int port, const char *proto, int numeric) | |||
| 391 | 391 | ||
| 392 | static char *ip_port_str(struct sockaddr *addr, int port, const char *proto, int numeric) | 392 | static char *ip_port_str(struct sockaddr *addr, int port, const char *proto, int numeric) |
| 393 | { | 393 | { |
| 394 | char *host, *host_port; | 394 | char *host; |
| 395 | 395 | ||
| 396 | /* Code which used "*" for INADDR_ANY is removed: it's ambiguous | 396 | /* Code which used "*" for INADDR_ANY is removed: it's ambiguous |
| 397 | * in IPv6, while "0.0.0.0" is not. */ | 397 | * in IPv6, while "0.0.0.0" is not. */ |
| @@ -402,9 +402,8 @@ static char *ip_port_str(struct sockaddr *addr, int port, const char *proto, int | |||
| 402 | if (!host) | 402 | if (!host) |
| 403 | host = xmalloc_sockaddr2dotted_noport(addr); | 403 | host = xmalloc_sockaddr2dotted_noport(addr); |
| 404 | 404 | ||
| 405 | host_port = xasprintf("%s:%s", host, get_sname(htons(port), proto, numeric)); | 405 | xasprintf_inplace(host, "%s:%s", host, get_sname(htons(port), proto, numeric)); |
| 406 | free(host); | 406 | return host; |
| 407 | return host_port; | ||
| 408 | } | 407 | } |
| 409 | 408 | ||
| 410 | struct inet_params { | 409 | struct inet_params { |
diff --git a/networking/ntpd.c b/networking/ntpd.c index efe9f5326..595000b11 100644 --- a/networking/ntpd.c +++ b/networking/ntpd.c | |||
| @@ -2395,7 +2395,7 @@ static NOINLINE void ntp_init(char **argv) | |||
| 2395 | while (peers) { | 2395 | while (peers) { |
| 2396 | char *peer = llist_pop(&peers); | 2396 | char *peer = llist_pop(&peers); |
| 2397 | key_entry_t *key_entry = NULL; | 2397 | key_entry_t *key_entry = NULL; |
| 2398 | if (strncmp(peer, "keyno:", 6) == 0) { | 2398 | if (is_prefixed_with(peer, "keyno:")) { |
| 2399 | char *end; | 2399 | char *end; |
| 2400 | int key_id; | 2400 | int key_id; |
| 2401 | peer += 6; | 2401 | peer += 6; |
diff --git a/networking/tls.h b/networking/tls.h index eee5a7617..fde2e4d3d 100644 --- a/networking/tls.h +++ b/networking/tls.h | |||
| @@ -10,7 +10,6 @@ | |||
| 10 | */ | 10 | */ |
| 11 | #include "libbb.h" | 11 | #include "libbb.h" |
| 12 | 12 | ||
| 13 | |||
| 14 | #if !ENABLE_FEATURE_TLS_SCHANNEL | 13 | #if !ENABLE_FEATURE_TLS_SCHANNEL |
| 15 | /* Config tweaks */ | 14 | /* Config tweaks */ |
| 16 | #define HAVE_NATIVE_INT64 | 15 | #define HAVE_NATIVE_INT64 |
| @@ -32,16 +31,18 @@ | |||
| 32 | # define PSTM_32BIT | 31 | # define PSTM_32BIT |
| 33 | # define PSTM_X86 | 32 | # define PSTM_X86 |
| 34 | #endif | 33 | #endif |
| 35 | //#if defined(__GNUC__) && defined(__x86_64__) | 34 | #if defined(__GNUC__) && defined(__x86_64__) |
| 36 | // /* PSTM_X86_64 works correctly, but +782 bytes. */ | 35 | /* PSTM_64BIT + PSTM_X86_64 works correctly, but: |
| 37 | // /* Looks like most of the growth is because of PSTM_64BIT. */ | 36 | * +928 bytes if PSTM_64BIT but !PSTM_X86_64 |
| 37 | * +1003 bytes with INNERMUL8 (loop unrolling in pstm_montgomery_reduce()) | ||
| 38 | * +664 bytes without INNERMUL8 | ||
| 39 | */ | ||
| 38 | //# define PSTM_64BIT | 40 | //# define PSTM_64BIT |
| 39 | //# define PSTM_X86_64 | 41 | //# define PSTM_X86_64 |
| 40 | //#endif | 42 | #endif |
| 41 | //#if SOME_COND #define PSTM_MIPS, #define PSTM_32BIT | 43 | //#if SOME_COND #define PSTM_MIPS, #define PSTM_32BIT |
| 42 | //#if SOME_COND #define PSTM_ARM, #define PSTM_32BIT | 44 | //#if SOME_COND #define PSTM_ARM, #define PSTM_32BIT |
| 43 | 45 | ||
| 44 | |||
| 45 | #define PS_SUCCESS 0 | 46 | #define PS_SUCCESS 0 |
| 46 | #define PS_FAILURE -1 | 47 | #define PS_FAILURE -1 |
| 47 | #define PS_ARG_FAIL -6 /* Failure due to bad function param */ | 48 | #define PS_ARG_FAIL -6 /* Failure due to bad function param */ |
| @@ -52,14 +53,14 @@ | |||
| 52 | #define PS_TRUE 1 | 53 | #define PS_TRUE 1 |
| 53 | #define PS_FALSE 0 | 54 | #define PS_FALSE 0 |
| 54 | 55 | ||
| 56 | #undef ENDIAN_BIG | ||
| 57 | #undef ENDIAN_LITTLE | ||
| 55 | #if BB_BIG_ENDIAN | 58 | #if BB_BIG_ENDIAN |
| 56 | # define ENDIAN_BIG 1 | 59 | # define ENDIAN_BIG 1 |
| 57 | # undef ENDIAN_LITTLE | ||
| 58 | //#???? ENDIAN_32BITWORD | 60 | //#???? ENDIAN_32BITWORD |
| 59 | // controls only STORE32L, which we don't use | 61 | // controls only STORE32L, which we don't use |
| 60 | #else | 62 | #else |
| 61 | # define ENDIAN_LITTLE 1 | 63 | # define ENDIAN_LITTLE 1 |
| 62 | # undef ENDIAN_BIG | ||
| 63 | #endif | 64 | #endif |
| 64 | 65 | ||
| 65 | typedef uint64_t uint64; | 66 | typedef uint64_t uint64; |
| @@ -99,7 +100,6 @@ void tls_get_random(void *buf, unsigned len) FAST_FUNC; | |||
| 99 | #undef min | 100 | #undef min |
| 100 | #define min(x, y) ((x) < (y) ? (x) : (y)) | 101 | #define min(x, y) ((x) < (y) ? (x) : (y)) |
| 101 | 102 | ||
| 102 | |||
| 103 | #include "tls_pstm.h" | 103 | #include "tls_pstm.h" |
| 104 | #include "tls_aes.h" | 104 | #include "tls_aes.h" |
| 105 | #include "tls_aesgcm.h" | 105 | #include "tls_aesgcm.h" |
diff --git a/networking/tls_pstm_montgomery_reduce.c b/networking/tls_pstm_montgomery_reduce.c index 4181a0590..e63e590db 100644 --- a/networking/tls_pstm_montgomery_reduce.c +++ b/networking/tls_pstm_montgomery_reduce.c | |||
| @@ -135,7 +135,7 @@ asm( \ | |||
| 135 | :"0"(_c[LO]), "1"(cy), "r"(mu), "r"(*tmpm++) \ | 135 | :"0"(_c[LO]), "1"(cy), "r"(mu), "r"(*tmpm++) \ |
| 136 | : "%rax", "%rdx", "cc") | 136 | : "%rax", "%rdx", "cc") |
| 137 | 137 | ||
| 138 | #define INNERMUL8 \ | 138 | #define INNERMUL8_disabled_for_bbox \ |
| 139 | asm( \ | 139 | asm( \ |
| 140 | "movq 0(%5),%%rax \n\t" \ | 140 | "movq 0(%5),%%rax \n\t" \ |
| 141 | "movq 0(%2),%%r10 \n\t" \ | 141 | "movq 0(%2),%%r10 \n\t" \ |
| @@ -398,7 +398,7 @@ int32 FAST_FUNC pstm_montgomery_reduce(psPool_t *pool, pstm_int *a, pstm_int *m, | |||
| 398 | _c = c + x; | 398 | _c = c + x; |
| 399 | tmpm = m->dp; | 399 | tmpm = m->dp; |
| 400 | y = 0; | 400 | y = 0; |
| 401 | #ifdef PSTM_X86_64 | 401 | #ifdef INNERMUL8 //bbox: PSTM_X86_64 |
| 402 | for (; y < (pa & ~7); y += 8) { | 402 | for (; y < (pa & ~7); y += 8) { |
| 403 | INNERMUL8; | 403 | INNERMUL8; |
| 404 | _c += 8; | 404 | _c += 8; |
