Commit a6cf2088 authored by jfigus's avatar jfigus

Remove support for --enable-kernel-linux option.

parent d196e022
......@@ -141,12 +141,6 @@
/* Define to use OpenSSL crypto. */
#undef OPENSSL
/* Define to compile for kernel contexts. */
#undef SRTP_KERNEL
/* Define to compile for Linux kernel context. */
#undef SRTP_KERNEL_LINUX
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
......
......@@ -694,7 +694,6 @@ SHELL'
ac_subst_files=''
ac_user_opts='
enable_option_checking
enable_kernel_linux
enable_debug
enable_generic_aesicm
enable_openssl
......@@ -1323,7 +1322,6 @@ Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-kernel-linux build library to run in Linux kernel context
--disable-debug do not compile in dynamic debugging system
--enable-generic-aesicm compile in changes for ISMAcryp
--enable-openssl compile in OpenSSL crypto engine
......@@ -4096,27 +4094,6 @@ case $host_os in
esac
# define executable suffix; this is needed for `make clean'
# Check whether --enable-kernel-linux was given.
if test "${enable_kernel_linux+set}" = set; then :
enableval=$enable_kernel_linux;
else
enable_kernel_linux=no
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build for Linux kernel context" >&5
$as_echo_n "checking whether to build for Linux kernel context... " >&6; }
if test "$enable_kernel_linux" = "yes"; then
$as_echo "#define SRTP_KERNEL 1" >>confdefs.h
$as_echo "#define SRTP_KERNEL_LINUX 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_kernel_linux" >&5
$as_echo "$enable_kernel_linux" >&6; }
if test "$cross_compiling" != yes -a "$HOST_IS_WINDOWS" != yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for /dev/urandom" >&5
$as_echo_n "checking for /dev/urandom... " >&6; }
......@@ -4987,24 +4964,18 @@ else
AES_ICM_OBJS="crypto/cipher/aes_icm.o crypto/cipher/aes.o"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking which random device to use" >&5
$as_echo_n "checking which random device to use... " >&6; }
if test "$enable_kernel_linux" = "yes"; then
RNG_OBJS=rand_linux_kernel.o
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Linux kernel builtin" >&5
$as_echo "Linux kernel builtin" >&6; }
else
RNG_OBJS=rand_source.o
if test -n "$DEV_URANDOM"; then
RNG_OBJS=rand_source.o
if test -n "$DEV_URANDOM"; then
cat >>confdefs.h <<_ACEOF
#define DEV_URANDOM "$DEV_URANDOM"
_ACEOF
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $DEV_URANDOM" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $DEV_URANDOM" >&5
$as_echo "$DEV_URANDOM" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: standard rand() function..." >&5
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: standard rand() function..." >&5
$as_echo "standard rand() function..." >&6; }
fi
fi
HMAC_OBJS="crypto/hash/hmac.o crypto/hash/sha1.o"
fi
......
......@@ -47,20 +47,6 @@ case $host_os in
esac
AC_SUBST(EXE) # define executable suffix; this is needed for `make clean'
AC_ARG_ENABLE(kernel-linux,
[AS_HELP_STRING([--enable-kernel-linux],
[build library to run in Linux kernel context])],
[], enable_kernel_linux=no)
AC_MSG_CHECKING(whether to build for Linux kernel context)
if test "$enable_kernel_linux" = "yes"; then
AC_DEFINE(SRTP_KERNEL, 1,
[Define to compile for kernel contexts.])
AC_DEFINE(SRTP_KERNEL_LINUX, 1,
[Define to compile for Linux kernel context.])
fi
AC_MSG_RESULT($enable_kernel_linux)
if test "$cross_compiling" != yes -a "$HOST_IS_WINDOWS" != yes; then
dnl Check for /dev/urandom
AC_CHECK_FILE(/dev/urandom, DEV_URANDOM=/dev/urandom,
......@@ -160,17 +146,12 @@ if test "$enable_openssl" = "yes"; then
else
AES_ICM_OBJS="crypto/cipher/aes_icm.o crypto/cipher/aes.o"
AC_MSG_CHECKING(which random device to use)
if test "$enable_kernel_linux" = "yes"; then
RNG_OBJS=rand_linux_kernel.o
AC_MSG_RESULT([Linux kernel builtin])
RNG_OBJS=rand_source.o
if test -n "$DEV_URANDOM"; then
AC_DEFINE_UNQUOTED(DEV_URANDOM, "$DEV_URANDOM",[Path to random device])
AC_MSG_RESULT([$DEV_URANDOM])
else
RNG_OBJS=rand_source.o
if test -n "$DEV_URANDOM"; then
AC_DEFINE_UNQUOTED(DEV_URANDOM, "$DEV_URANDOM",[Path to random device])
AC_MSG_RESULT([$DEV_URANDOM])
else
AC_MSG_RESULT([standard rand() function...])
fi
AC_MSG_RESULT([standard rand() function...])
fi
HMAC_OBJS="crypto/hash/hmac.o crypto/hash/sha1.o"
fi
......
......@@ -52,15 +52,13 @@
#include <stdarg.h>
#ifndef SRTP_KERNEL
# include <stdio.h>
# include <string.h>
# include <time.h>
# ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
# elif defined HAVE_WINSOCK2_H
# include <winsock2.h>
# endif
#include <stdio.h>
#include <string.h>
#include <time.h>
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#elif defined HAVE_WINSOCK2_H
# include <winsock2.h>
#endif
......@@ -352,7 +350,7 @@ void
octet_string_set_to_zero(uint8_t *s, int len);
#if !defined(SRTP_KERNEL_LINUX) && defined(HAVE_CONFIG_H)
#if defined(HAVE_CONFIG_H)
/*
* Convert big endian integers to CPU byte order.
......@@ -395,7 +393,7 @@ static inline uint64_t be64_to_cpu(uint64_t v) {
return v;
}
#endif /* ! SRTP_KERNEL_LINUX */
#endif
#endif /* WORDS_BIGENDIAN */
......
......@@ -85,10 +85,6 @@ typedef enum {
srtp_err_status_t err_reporting_init(const char *ident);
#ifdef SRTP_KERNEL_LINUX
extern err_reporting_level_t err_level;
#else
/*
* keydaemon_report_error reports a 'printf' formatted error
* string, followed by a an arg list. The priority argument
......@@ -101,7 +97,6 @@ extern err_reporting_level_t err_level;
void
err_report(int priority, const char *format, ...);
#endif /* ! SRTP_KERNEL_LINUX */
/*
......
......@@ -48,12 +48,6 @@
#define INTEGERS_H
#ifdef SRTP_KERNEL
#include "kernel_compat.h"
#else /* SRTP_KERNEL */
/* use standard integer definitions, if they're available */
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
......@@ -106,7 +100,6 @@ extern uint32_t high32(uint64_t value);
extern uint32_t low32(uint64_t value);
#endif
#endif /* SRTP_KERNEL */
/* These macros are to load and store 32-bit values from un-aligned
addresses. This is required for processors that do not allow unaligned
......
/*
* kernel_compat.h
*
* Compatibility stuff for building in kernel context where standard
* C headers and library are not available.
*
* Marcus Sundberg
* Ingate Systems AB
*/
/*
*
* Copyright(c) 2005 Ingate Systems AB
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* Neither the name of the author(s) nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef KERNEL_COMPAT_H
#define KERNEL_COMPAT_H
#ifdef SRTP_KERNEL_LINUX
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/random.h>
#include <linux/byteorder/generic.h>
#define err_report(priority, ...) \
do {\
if (priority <= err_level) {\
printk(__VA_ARGS__);\
}\
}while(0)
#define clock() (jiffies)
#define time(x) (jiffies)
/* rand() implementation. */
#define RAND_MAX 32767
static inline int rand(void)
{
uint32_t temp;
get_random_bytes(&temp, sizeof(temp));
return temp % (RAND_MAX+1);
}
/* stdio/stdlib implementation. */
#define printf(...) printk(__VA_ARGS__)
#define exit(n) panic("%s:%d: exit(%d)\n", __FILE__, __LINE__, (n))
#endif /* SRTP_KERNEL_LINUX */
#endif /* KERNEL_COMPAT_H */
......@@ -65,33 +65,7 @@ debug_module_t mod_alloc = {
* address.
*/
#ifdef SRTP_KERNEL_LINUX
#include <linux/interrupt.h>
void * srtp_crypto_alloc(size_t size) {
void *ptr;
ptr = kmalloc(size, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
if (ptr) {
debug_print(mod_alloc, "(location: %p) allocated", ptr);
} else {
debug_print(mod_alloc, "allocation failed (asked for %d bytes)\n", size);
}
return ptr;
}
void srtp_crypto_free(void *ptr) {
debug_print(mod_alloc, "(location: %p) freed", ptr);
kfree(ptr);
}
#elif defined(HAVE_STDLIB_H)
#if defined(HAVE_STDLIB_H)
void * srtp_crypto_alloc(size_t size) {
void *ptr;
......
......@@ -53,15 +53,6 @@
err_reporting_level_t err_level = err_level_none;
#ifdef SRTP_KERNEL_LINUX
srtp_err_status_t
err_reporting_init(const char *ident) {
return srtp_err_status_ok;
}
#else /* SRTP_KERNEL_LINUX */
/* err_file is the FILE to which errors are reported */
static FILE *err_file = NULL;
......@@ -100,7 +91,6 @@ err_report(int priority, const char *format, ...) {
va_end(args);
}
}
#endif /* SRTP_KERNEL_LINUX */
void
err_reporting_set_level(err_reporting_level_t lvl) {
......
/*
* rand_linux_kernel.c
*
* implements a random source using Linux kernel functions
*
* Marcus Sundberg
* Ingate Systems AB
*/
/*
*
* Copyright(c) 2005 Ingate Systems AB
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* Neither the name of the author(s) nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "config.h"
#include "rand_source.h"
err_status_t
rand_source_init(void) {
return err_status_ok;
}
err_status_t
rand_source_get_octet_string(void *dest, uint32_t len) {
get_random_bytes(dest, len);
return err_status_ok;
}
err_status_t
rand_source_deinit(void) {
return err_status_ok;
}
......@@ -52,14 +52,12 @@
#include "aes_gcm_ossl.h" /* for AES GCM mode */
#endif
#ifndef SRTP_KERNEL
# include <limits.h>
# ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
# elif defined(HAVE_WINSOCK2_H)
# include <winsock2.h>
# endif
#endif /* ! SRTP_KERNEL */
#include <limits.h>
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#elif defined(HAVE_WINSOCK2_H)
# include <winsock2.h>
#endif
/* the debug module for srtp */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment