Check for proper byteorder functions

[andersk@mit.edu: Add byteorder.h to libmoshcrypto_a_SOURCES]
This commit is contained in:
Quentin Smith
2012-02-25 17:11:09 -05:00
committed by Keith Winstein
parent b03d53d421
commit 17d6962af8
7 changed files with 59 additions and 5 deletions
+10
View File
@@ -71,6 +71,16 @@ AC_FUNC_MBRTOWC
AC_FUNC_REALLOC AC_FUNC_REALLOC
AC_CHECK_FUNCS([clock_gettime gettimeofday inet_ntoa iswprint memchr memset nl_langinfo setenv setlocale socket strchr strdup strerror strtol wcwidth]) AC_CHECK_FUNCS([clock_gettime gettimeofday inet_ntoa iswprint memchr memset nl_langinfo setenv setlocale socket strchr strdup strerror strtol wcwidth])
AC_CHECK_DECL([htobe64],
[AC_DEFINE([HAVE_HTOBE64], [1],
[Define if htobe64 and friends exist.])],
[AC_CHECK_DECL([OSSwapHostToBigInt64],
[AC_DEFINE([HAVE_OSX_SWAP], [1],
[Define if OSSwapHostToBigInt64 and friends exist.])],
[AC_MSG_ERROR([Unable to find byte swapping functions])],
[[#include <libkern/OSByteOrder.h>]])],
[[#include <endian.h>]])
# Checks for protobuf # Checks for protobuf
PKG_CHECK_MODULES([protobuf], [protobuf]) PKG_CHECK_MODULES([protobuf], [protobuf])
+10 -1
View File
@@ -2,4 +2,13 @@ AM_CXXFLAGS = $(WARNING_CXXFLAGS) $(PICKY_CXXFLAGS) -fno-default-inline -pipe
noinst_LIBRARIES = libmoshcrypto.a noinst_LIBRARIES = libmoshcrypto.a
libmoshcrypto_a_SOURCES = ae.h base64.cc base64.h crypto.cc crypto.h ocb.cc rijndael-alg-fst.cc rijndael-alg-fst.h libmoshcrypto_a_SOURCES = \
ae.h \
base64.cc \
base64.h \
byteorder.h \
crypto.cc \
crypto.h \
ocb.cc \
rijndael-alg-fst.cc \
rijndael-alg-fst.h
+2 -2
View File
@@ -1,7 +1,5 @@
/* Taken from GNU coreutils */ /* Taken from GNU coreutils */
#define restrict
/* base64.h -- Encode binary data using printable characters. /* base64.h -- Encode binary data using printable characters.
Copyright (C) 2004-2006, 2009-2011 Free Software Foundation, Inc. Copyright (C) 2004-2006, 2009-2011 Free Software Foundation, Inc.
Written by Simon Josefsson. Written by Simon Josefsson.
@@ -23,6 +21,8 @@
#ifndef BASE64_H #ifndef BASE64_H
# define BASE64_H # define BASE64_H
# include "config.h"
/* Get size_t. */ /* Get size_t. */
# include <stddef.h> # include <stddef.h>
+34
View File
@@ -0,0 +1,34 @@
/*
Mosh: the mobile shell
Copyright 2012 Keith Winstein
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef BYTEORDER_HPP
#define BYTEORDER_HPP
#include "config.h"
#ifdef HAVE_HTOBE64
# include <endian.h>
#elif HAVE_OSX_SWAP
# include <libkern/OSByteOrder.h>
# define htobe64 OSSwapHostToBigInt64
# define be64toh OSSwapBigToHostInt64
# define htobe16 OSSwapHostToBigInt16
# define be16toh OSSwapBigToHostInt16
#endif
#endif
+1
View File
@@ -21,6 +21,7 @@
#include <errno.h> #include <errno.h>
#include <stdlib.h> #include <stdlib.h>
#include "byteorder.h"
#include "crypto.h" #include "crypto.h"
#include "base64.h" #include "base64.h"
+1 -1
View File
@@ -21,10 +21,10 @@
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <assert.h> #include <assert.h>
#include <endian.h>
#include <errno.h> #include <errno.h>
#include "dos_assert.h" #include "dos_assert.h"
#include "byteorder.h"
#include "network.h" #include "network.h"
#include "crypto.h" #include "crypto.h"
+1 -1
View File
@@ -16,9 +16,9 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <endian.h>
#include <assert.h> #include <assert.h>
#include "byteorder.h"
#include "transportfragment.h" #include "transportfragment.h"
#include "transportinstruction.pb.h" #include "transportinstruction.pb.h"
#include "compressor.h" #include "compressor.h"