main/musl: upgrade to git snapshot 2014-02-13

This commit is contained in:
Timo Teräs 2014-02-14 09:01:41 +02:00
parent 8c2ef4a3ef
commit afefb2d592
6 changed files with 1882 additions and 378 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,141 +0,0 @@
From 8546e9be8757a9406a8c05fae9efc55eaab3e984 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
Date: Mon, 13 Jan 2014 13:05:14 +0200
Subject: [PATCH] add legacy functions setkey() and encrypt()
---
src/crypt/crypt_des.c | 12 +++++-----
src/crypt/encrypt.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 69 insertions(+), 6 deletions(-)
create mode 100644 src/crypt/encrypt.c
diff --git a/src/crypt/crypt_des.c b/src/crypt/crypt_des.c
index dc95dca..d5766a7 100644
--- a/src/crypt/crypt_des.c
+++ b/src/crypt/crypt_des.c
@@ -692,7 +692,7 @@ static uint32_t setup_salt(uint32_t salt)
return saltbits;
}
-static void des_setkey(const unsigned char *key, struct expanded_key *ekey)
+void __des_setkey(const unsigned char *key, struct expanded_key *ekey)
{
uint32_t k0, k1, rawkey0, rawkey1;
unsigned int shifts, round, i, ibit;
@@ -753,7 +753,7 @@ static void des_setkey(const unsigned char *key, struct expanded_key *ekey)
/*
* l_in, r_in, l_out, and r_out are in pseudo-"big-endian" format.
*/
-static void do_des(uint32_t l_in, uint32_t r_in,
+void __do_des(uint32_t l_in, uint32_t r_in,
uint32_t *l_out, uint32_t *r_out,
uint32_t count, uint32_t saltbits, const struct expanded_key *ekey)
{
@@ -862,7 +862,7 @@ static void des_cipher(const unsigned char *in, unsigned char *out,
((uint32_t)in[5] << 16) |
((uint32_t)in[4] << 24);
- do_des(rawl, rawr, &l_out, &r_out, count, saltbits, ekey);
+ __do_des(rawl, rawr, &l_out, &r_out, count, saltbits, ekey);
out[0] = l_out >> 24;
out[1] = l_out >> 16;
@@ -894,7 +894,7 @@ static char *_crypt_extended_r_uut(const char *_key, const char *_setting, char
if (*key)
key++;
}
- des_setkey(keybuf, &ekey);
+ __des_setkey(keybuf, &ekey);
if (*setting == _PASSWORD_EFMT1) {
/*
@@ -929,7 +929,7 @@ static char *_crypt_extended_r_uut(const char *_key, const char *_setting, char
q = keybuf;
while (q <= &keybuf[sizeof(keybuf) - 1] && *key)
*q++ ^= *key++ << 1;
- des_setkey(keybuf, &ekey);
+ __des_setkey(keybuf, &ekey);
}
memcpy(output, setting, 9);
@@ -957,7 +957,7 @@ static char *_crypt_extended_r_uut(const char *_key, const char *_setting, char
/*
* Do it.
*/
- do_des(0, 0, &r0, &r1, count, setup_salt(salt), &ekey);
+ __do_des(0, 0, &r0, &r1, count, setup_salt(salt), &ekey);
/*
* Now encode the result...
diff --git a/src/crypt/encrypt.c b/src/crypt/encrypt.c
new file mode 100644
index 0000000..3b414f1
--- /dev/null
+++ b/src/crypt/encrypt.c
@@ -0,0 +1,63 @@
+#include <stdint.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+struct expanded_key {
+ uint32_t l[16], r[16];
+};
+
+void __des_setkey(const unsigned char *key, struct expanded_key *ekey);
+void __do_des(uint32_t l_in, uint32_t r_in,
+ uint32_t *l_out, uint32_t *r_out,
+ uint32_t count, uint32_t saltbits, const struct expanded_key *ekey);
+
+
+static struct expanded_key __encrypt_key;
+
+void setkey(const char *key)
+{
+ unsigned char bkey[8];
+ int i, j;
+
+ for (i = 0; i < 8; i++) {
+ bkey[i] = 0;
+ for (j = 7; j >= 0; j--, key++) {
+ if (*key & 1)
+ bkey[i] |= 1 << j;
+ }
+ }
+
+ __des_setkey(bkey, &__encrypt_key);
+}
+
+void encrypt(char *block, int edflag)
+{
+ struct expanded_key decrypt_key, *key;
+ uint32_t b[2];
+ int i, j;
+ char *p;
+
+ p = block;
+ for (i = 0; i < 2; i++) {
+ b[i] = 0;
+ for (j = 31; j >= 0; j--, p++)
+ if (*p & 1)
+ b[i] |= 1 << j;
+ }
+
+ key = &__encrypt_key;
+ if (edflag) {
+ key = &decrypt_key;
+ for (i = 0; i < 16; i++) {
+ decrypt_key.l[i] = __encrypt_key.l[15-i];
+ decrypt_key.r[i] = __encrypt_key.r[15-i];
+ }
+ }
+
+ __do_des(b[0], b[1], b, b + 1, 1, 0, key);
+
+ p = block;
+ for (i = 0; i < 2; i++)
+ for (j = 31; j >= 0; j--)
+ *p++ = (b[i] & (1 << j)) ? 1 : 0;
+}
--
1.8.5.2

View File

@ -1,162 +0,0 @@
From 643c0776155ec3165198c21708f7a2f88fc02adc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
Date: Mon, 13 Jan 2014 13:29:10 +0200
Subject: [PATCH] use anonymous union to provide bsd and gnu variants of struct
tcphdr and udphdr
---
include/netinet/tcp.h | 92 ++++++++++++++++++++++++++++++++++-----------------
include/netinet/udp.h | 26 ++++++++++-----
2 files changed, 79 insertions(+), 39 deletions(-)
diff --git a/include/netinet/tcp.h b/include/netinet/tcp.h
index 5639b89..09c9279 100644
--- a/include/netinet/tcp.h
+++ b/include/netinet/tcp.h
@@ -44,42 +44,74 @@
#define SOL_TCP 6
#include <sys/types.h>
#include <sys/socket.h>
-#endif
-
-#ifdef _GNU_SOURCE
#include <endian.h>
-struct tcphdr
-{
- u_int16_t source;
- u_int16_t dest;
- u_int32_t seq;
- u_int32_t ack_seq;
+
+typedef u_int32_t tcp_seq;
+
+#define TH_FIN 0x01
+#define TH_SYN 0x02
+#define TH_RST 0x04
+#define TH_PUSH 0x08
+#define TH_ACK 0x10
+#define TH_URG 0x20
+
+struct tcphdr {
+#ifdef __GNUC__
+ __extension__
+#endif
+ union {
+ struct {
+ u_int16_t source;
+ u_int16_t dest;
+ u_int32_t seq;
+ u_int32_t ack_seq;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ u_int16_t res1:4;
+ u_int16_t doff:4;
+ u_int16_t fin:1;
+ u_int16_t syn:1;
+ u_int16_t rst:1;
+ u_int16_t psh:1;
+ u_int16_t ack:1;
+ u_int16_t urg:1;
+ u_int16_t res2:2;
+#else
+ u_int16_t doff:4;
+ u_int16_t res1:4;
+ u_int16_t res2:2;
+ u_int16_t urg:1;
+ u_int16_t ack:1;
+ u_int16_t psh:1;
+ u_int16_t rst:1;
+ u_int16_t syn:1;
+ u_int16_t fin:1;
+#endif
+ u_int16_t window;
+ u_int16_t check;
+ u_int16_t urg_ptr;
+ };
+ struct {
+ u_int16_t th_sport;
+ u_int16_t th_dport;
+ tcp_seq th_seq;
+ tcp_seq th_ack;
#if __BYTE_ORDER == __LITTLE_ENDIAN
- u_int16_t res1:4;
- u_int16_t doff:4;
- u_int16_t fin:1;
- u_int16_t syn:1;
- u_int16_t rst:1;
- u_int16_t psh:1;
- u_int16_t ack:1;
- u_int16_t urg:1;
- u_int16_t res2:2;
+ u_int8_t th_x2:4;
+ u_int8_t th_off:4;
#else
- u_int16_t doff:4;
- u_int16_t res1:4;
- u_int16_t res2:2;
- u_int16_t urg:1;
- u_int16_t ack:1;
- u_int16_t psh:1;
- u_int16_t rst:1;
- u_int16_t syn:1;
- u_int16_t fin:1;
+ u_int8_t th_off:4;
+ u_int8_t th_x2:4;
#endif
- u_int16_t window;
- u_int16_t check;
- u_int16_t urg_ptr;
+ u_int8_t th_flags;
+ u_int16_t th_win;
+ u_int16_t th_sum;
+ u_int16_t th_urp;
+ };
+ };
};
+#endif
+#ifdef _GNU_SOURCE
#define TCPI_OPT_TIMESTAMPS 1
#define TCPI_OPT_SACK 2
#define TCPI_OPT_WSCALE 4
diff --git a/include/netinet/udp.h b/include/netinet/udp.h
index 15b9145..223a5e3 100644
--- a/include/netinet/udp.h
+++ b/include/netinet/udp.h
@@ -8,17 +8,25 @@ extern "C" {
#include <stdint.h>
struct udphdr {
- uint16_t source;
- uint16_t dest;
- uint16_t len;
- uint16_t check;
+#ifdef __GNUC__
+ __extension__
+#endif
+ union {
+ struct {
+ uint16_t source;
+ uint16_t dest;
+ uint16_t len;
+ uint16_t check;
+ };
+ struct {
+ uint16_t uh_sport;
+ uint16_t uh_dport;
+ uint16_t uh_ulen;
+ uint16_t uh_sum;
+ };
+ };
};
-#define uh_sport source
-#define uh_dport dest
-#define uh_ulen len
-#define uh_sum check
-
#define UDP_CORK 1
#define UDP_ENCAP 100
--
1.8.5.2

View File

@ -1,24 +0,0 @@
From b6d93b2791665581ca662adb4cdc9554e17f072f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
Date: Mon, 13 Jan 2014 13:36:03 +0200
Subject: [PATCH] add NO_ADDRESS to alias as NO_DATA like glibc does
---
include/netdb.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/netdb.h b/include/netdb.h
index 2dd799b..dfc70e2 100644
--- a/include/netdb.h
+++ b/include/netdb.h
@@ -131,6 +131,7 @@ int *__h_errno_location(void);
#define TRY_AGAIN 2
#define NO_RECOVERY 3
#define NO_DATA 4
+#define NO_ADDRESS NO_DATA
#endif
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
--
1.8.5.2

View File

@ -1,34 +0,0 @@
From d0d389bcd65c2d8ca519a6dbe6f083d5a34ec249 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
Date: Mon, 13 Jan 2014 21:19:44 +0200
Subject: [PATCH] add TIMEVAL_TO_TIMESPEC and TIMESPEC_TO_TIMEVAL
---
include/sys/time.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/include/sys/time.h b/include/sys/time.h
index b6787c3..9fd791c 100644
--- a/include/sys/time.h
+++ b/include/sys/time.h
@@ -10,6 +10,17 @@ extern "C" {
int gettimeofday (struct timeval *__restrict, void *__restrict);
+#if defined(_GNU_SOURCE)
+#define TIMEVAL_TO_TIMESPEC(tv, ts) { \
+ (ts)->tv_sec = (tv)->tv_sec; \
+ (ts)->tv_nsec = (tv)->tv_usec * 1000; \
+}
+#define TIMESPEC_TO_TIMEVAL(tv, ts) { \
+ (tv)->tv_sec = (ts)->tv_sec; \
+ (tv)->tv_usec = (ts)->tv_nsec / 1000; \
+}
+#endif
+
#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
|| defined(_BSD_SOURCE)
--
1.8.5.2

View File

@ -2,7 +2,7 @@
# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname=musl
pkgver=0.9.15
pkgrel=2
pkgrel=3
pkgdesc="the musl c library (libc) implementation"
url="http://www.musl-libc.org/"
arch="all"
@ -14,11 +14,8 @@ install=""
subpackages="$pkgname-dev $pkgname-utils"
[ "${CTARGET#*musl}" = "$CTARGET" ] && subpackages="$subpackages musl-gcc:crosstool"
source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz
0001-git-0.9.15-to-3e02ce1b411.patch
1001-add-basic-dns-record-parsing-functions.patch
1002-add-legacy-functions-setkey-and-encrypt.patch
1003-use-anonymous-union-to-provide-bsd-and-gnu-variants-.patch
1004-add-NO_ADDRESS-to-alias-as-NO_DATA-like-glibc-does.patch
1005-add-TIMEVAL_TO_TIMESPEC-and-TIMESPEC_TO_TIMEVAL.patch
2001-workaround-gcc-pr58245.patch
getopt_long.c
@ -111,33 +108,24 @@ crosstool() {
}
md5sums="06f590a38c85722ee9343db2416425f4 musl-0.9.15.tar.gz
06ec0e41d9b426acbd47869038ba0588 0001-git-0.9.15-to-3e02ce1b411.patch
a3810683ef61ac27e2f6ec9801280c81 1001-add-basic-dns-record-parsing-functions.patch
ab5e596aae4a55ea3a0c17004c28c991 1002-add-legacy-functions-setkey-and-encrypt.patch
405bd5b61acc9e44c39a8badb82f15bd 1003-use-anonymous-union-to-provide-bsd-and-gnu-variants-.patch
08956121f90f9f16d0c26df767309c0b 1004-add-NO_ADDRESS-to-alias-as-NO_DATA-like-glibc-does.patch
e8b0d4ab4364a8581162d5727383f427 1005-add-TIMEVAL_TO_TIMESPEC-and-TIMESPEC_TO_TIMEVAL.patch
7a09c5cd7b3e9532e6902f54a5e928bb 2001-workaround-gcc-pr58245.patch
61c6c1e84ed1df82abbe6d75e90cf21c getopt_long.c
0df687757221bbb0fc1aa67f1bd646f9 __stack_chk_fail_local.c
ef81489a6258501cf45db58dfc6d5211 getent
33e4fd94e2560e008e2c3b431d0e3419 ldconfig"
sha256sums="4a7baab8f295511196dee48d33b8b82a159a81233facb89433707c792033cbe7 musl-0.9.15.tar.gz
8c03e089985384e2fc2765db3b7c09c91bce1144f5ebf2456ce8ca642104e4b0 0001-git-0.9.15-to-3e02ce1b411.patch
758390768b1bc4159d56908ca332b9640cd0552ed3b4b2b8d4a6d499c54c11a1 1001-add-basic-dns-record-parsing-functions.patch
45ab39525f5902d17913185817769d654611f193d81fa36bc6faed905451bdbb 1002-add-legacy-functions-setkey-and-encrypt.patch
d7e6dc31feb23b07063a62e7ad4f63216dd83ab4bdbde0e5750095c8b18d8c20 1003-use-anonymous-union-to-provide-bsd-and-gnu-variants-.patch
c3bb37b28cb8e5724ec81314a2188e774412e2caa567c1d0f499d0d2f1c74c9d 1004-add-NO_ADDRESS-to-alias-as-NO_DATA-like-glibc-does.patch
b22e83321a8f872a0000e4c63e878d460d8f278759216369d97ed943ba8eef01 1005-add-TIMEVAL_TO_TIMESPEC-and-TIMESPEC_TO_TIMEVAL.patch
45d6efda7450809e4e68f6e951431dcadf6cb7f0260930d50a9f1a8667aca49f 2001-workaround-gcc-pr58245.patch
d9b644ec20bc33e81a7c52b9fcf7973d835923a69faf50f03db45534b811bd96 getopt_long.c
299a7d75a09de3e2e11e7fb4acc3182e4a14e868093d2f30938fce9bfcff13da __stack_chk_fail_local.c
d6996273f5aaaed429058257e4646b243d9e3a4d8609522f802762453f5be4cb getent
306c6ca7407560340797866e077e053627ad409277d1b9da58106fce4cf717cb ldconfig"
sha512sums="2c5f3e742cf29fd76db8079b6012b1b359eda635593995ea8add008abc9744f0ca504e915f7828692aeafc3bddc66e0716492182cd5696e2fa24d9a2289601b8 musl-0.9.15.tar.gz
b721a91b5ff520b5406ecf43f033a82dc71686ccf2d025293b6457d6e77f3a6619fefeb3f3af620d8297b79f820d2bb7c94ca5695b0a284e19305bd4e54c8bed 0001-git-0.9.15-to-3e02ce1b411.patch
dad965258daf69371b844f76bfe5a914b0eca0ca76f3fc340b8fd7acf598b5f87bbe6d68b1f43ed0293ee0ed3bfd85d5173ccc169aa6265646248d5b8a906708 1001-add-basic-dns-record-parsing-functions.patch
1b3c162985fa9b1699004007c811ca1f3ff8e144722c7d3bae7f118b8c46694888f125d00aef66eef4c836cbc2000daa0f5c7a728981eb7746c84d64b1bc3d96 1002-add-legacy-functions-setkey-and-encrypt.patch
33b3d574cd508f557d799f11d8aa884fe9404384093ea869efbe3677e642eeb761ac95ccb9125eaadf0a2b4433e8fd7aa3ea9d52e3919696c2735273e68108c4 1003-use-anonymous-union-to-provide-bsd-and-gnu-variants-.patch
b4eee38bb18883cee2c9317cc06a0fce7b805206afb3846e1dbd86be75f161f70ad5a6b4918dbbfcfdbec9300400ebd2b8e65e233a1b409898e40479d45cbb1d 1004-add-NO_ADDRESS-to-alias-as-NO_DATA-like-glibc-does.patch
3cea9ba259362455526f841b9dac79a4d50016e58581db071ba7c5fb1c176e4f994744286c3491b376ff3b5a0815f2a76d382a37474c5b09bcaa06dcf283e4d4 1005-add-TIMEVAL_TO_TIMESPEC-and-TIMESPEC_TO_TIMEVAL.patch
69ad3fc851b44f33dd7c98b83fd0adbd149b37263d17b989f4d7338ee0703dfe8994f4299744e2509492300227d652de6f21b6cdba9b633fcefd3d9f7ca0cf20 2001-workaround-gcc-pr58245.patch
140f3f20d30bd95ebce8c41b8cc7f616c6cbedf4ea06c729c21014e74f6043796825cc40ebc5180620ea38173afdba23f09ebf6d8b11fa05440b14d23764fca9 getopt_long.c
062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b __stack_chk_fail_local.c