]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix compile on Linux
authorRoy Marples <roy@marples.name>
Mon, 2 Jun 2014 17:10:13 +0000 (17:10 +0000)
committerRoy Marples <roy@marples.name>
Mon, 2 Jun 2014 17:10:13 +0000 (17:10 +0000)
configure
crypt/sha256.c

index aacf606d23efdc72a8ffc765fcf7c25e95157dfb..03e745a973f8c925d3a5a05507a8e4a25c7230d7 100755 (executable)
--- a/configure
+++ b/configure
@@ -844,7 +844,7 @@ int main(void) {
 EOF
                # We only want to link to libmd if it exists in /lib
                set -- $(ls /lib/libmd.so.* 2>/dev/null)
-               if $XCC _sha256.c -o _sha256 3>/dev/null; then
+               if $XCC _sha256.c -o _sha256 2>/dev/null; then
                        SHA2=yes
                        SHA2_RENAMED=yes
                elif [ -e "$1" ] && $XCC _sha256.c -lmd -o _sha256 2>/dev/null
index 24faa38da486b31a8aa16de28adc4e42b8ceacd6..64e0d5dd5b065b6d3de62d2c9be04f2af05dd64d 100755 (executable)
@@ -24,8 +24,7 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/endian.h>
-#include <sys/types.h>
+#include <inttypes.h>
 
 #include <string.h>
 
 
 #else /* BYTE_ORDER != BIG_ENDIAN */
 
+static inline void
+be32enc(uint8_t *buf, uint32_t u)
+{
+
+       buf[0] = (uint8_t)((u >> 24) & 0xff);
+       buf[1] = (uint8_t)((u >> 16) & 0xff);
+       buf[2] = (uint8_t)((u >> 8) & 0xff);
+       buf[3] = (uint8_t)(u & 0xff);
+}
+
+static inline void
+be64enc(uint8_t *buf, uint64_t u)
+{
+
+       be32enc(buf, (uint32_t)(u >> 32));
+       be32enc(buf + sizeof(uint32_t), (uint32_t)(u & 0xffffffffULL));
+}
+
+static inline uint16_t
+be16dec(const uint8_t *buf)
+{
+
+       return (uint16_t)(buf[0] << 8 | buf[1]);
+}
+
+static inline uint32_t
+be32dec(const uint8_t *buf)
+{
+
+       return (uint32_t)(be16dec(buf) << 16 | be16dec(buf + 2));
+}
+
 /*
  * Encode a length len/4 vector of (uint32_t) into a length len vector of
  * (unsigned char) in big-endian form.  Assumes len is a multiple of 4.