mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-02-10 16:57:00 +08:00
Added session resumption to TLS server.
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
# the same distribution terms as the rest of that program.
|
||||
#
|
||||
# Generated by gnulib-tool.
|
||||
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --no-conditional-dependencies --no-libtool --macro-prefix=gl gettime memmem
|
||||
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --no-conditional-dependencies --no-libtool --macro-prefix=gl gettime hash-pjw-bare memmem
|
||||
|
||||
AUTOMAKE_OPTIONS = 1.5 gnits
|
||||
|
||||
@@ -64,6 +64,12 @@ EXTRA_libgnu_a_SOURCES += gettimeofday.c
|
||||
|
||||
## end gnulib module gettimeofday
|
||||
|
||||
## begin gnulib module hash-pjw-bare
|
||||
|
||||
libgnu_a_SOURCES += hash-pjw-bare.h hash-pjw-bare.c
|
||||
|
||||
## end gnulib module hash-pjw-bare
|
||||
|
||||
## begin gnulib module memchr
|
||||
|
||||
|
||||
|
||||
42
gl/hash-pjw-bare.c
Normal file
42
gl/hash-pjw-bare.c
Normal file
@@ -0,0 +1,42 @@
|
||||
/* hash-pjw-bare.c -- compute a hash value from a provided buffer.
|
||||
|
||||
Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
||||
|
||||
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/>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "hash-pjw-bare.h"
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#define SIZE_BITS (sizeof (size_t) * CHAR_BIT)
|
||||
|
||||
/* Return a hash of the N bytes of X using the method described by
|
||||
Bruno Haible in http://www.haible.de/bruno/hashfunc.html.
|
||||
Note that while many hash functions reduce their result via modulo
|
||||
to a 0..table_size-1 range, this function does not do that. */
|
||||
|
||||
size_t
|
||||
hash_pjw_bare (const void *x, size_t n)
|
||||
{
|
||||
const unsigned char *s = x;
|
||||
size_t h = 0;
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
h = s[i] + ((h << 9) | (h >> (SIZE_BITS - 9)));
|
||||
|
||||
return h;
|
||||
}
|
||||
24
gl/hash-pjw-bare.h
Normal file
24
gl/hash-pjw-bare.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/* hash-pjw-bare.h -- declaration for a simple hash function
|
||||
Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
||||
|
||||
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/>. */
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
/* Compute a hash code for a buffer starting at X and of size N,
|
||||
and return the hash code. Note that unlike hash_pjw(), it does not
|
||||
return it modulo a table size.
|
||||
The result is platform dependent: it depends on the size of the 'size_t'
|
||||
type and on the signedness of the 'char' type. */
|
||||
extern size_t hash_pjw_bare (const void *x, size_t n) _GL_ATTRIBUTE_PURE;
|
||||
@@ -27,12 +27,13 @@
|
||||
|
||||
|
||||
# Specification in the form of a command-line invocation:
|
||||
# gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --no-conditional-dependencies --no-libtool --macro-prefix=gl gettime memmem
|
||||
# gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --no-conditional-dependencies --no-libtool --macro-prefix=gl gettime hash-pjw-bare memmem
|
||||
|
||||
# Specification in the form of a few gnulib-tool.m4 macro invocations:
|
||||
gl_LOCAL_DIR([])
|
||||
gl_MODULES([
|
||||
gettime
|
||||
hash-pjw-bare
|
||||
memmem
|
||||
])
|
||||
gl_AVOID([])
|
||||
|
||||
@@ -44,6 +44,7 @@ AC_DEFUN([gl_EARLY],
|
||||
# Code from module extern-inline:
|
||||
# Code from module gettime:
|
||||
# Code from module gettimeofday:
|
||||
# Code from module hash-pjw-bare:
|
||||
# Code from module include_next:
|
||||
# Code from module memchr:
|
||||
# Code from module memmem:
|
||||
@@ -253,6 +254,8 @@ AC_DEFUN([gl_FILE_LIST], [
|
||||
build-aux/snippet/warn-on-use.h
|
||||
lib/gettime.c
|
||||
lib/gettimeofday.c
|
||||
lib/hash-pjw-bare.c
|
||||
lib/hash-pjw-bare.h
|
||||
lib/memchr.c
|
||||
lib/memchr.valgrind
|
||||
lib/memmem.c
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
Ideally we should test __BIONIC__ here, but it is only defined after
|
||||
<sys/cdefs.h> has been included; hence test __ANDROID__ instead. */
|
||||
#if defined __ANDROID__ \
|
||||
&& defined _SYS_TYPES_H_ && !defined _SSIZE_T_DEFINED_
|
||||
&& defined _SYS_TYPES_H_ && !defined __need_size_t
|
||||
# @INCLUDE_NEXT@ @NEXT_STDINT_H@
|
||||
#else
|
||||
|
||||
|
||||
196
gl/sys_time.in.h
196
gl/sys_time.in.h
@@ -17,37 +17,34 @@
|
||||
|
||||
/* Written by Paul Eggert. */
|
||||
|
||||
#ifndef _@GUARD_PREFIX@_SYS_TIME_H
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
@PRAGMA_SYSTEM_HEADER@
|
||||
#endif
|
||||
@PRAGMA_COLUMNS@
|
||||
|
||||
#if defined _@GUARD_PREFIX@_SYS_TIME_H
|
||||
/* The include_next requires a split double-inclusion guard. */
|
||||
#if @HAVE_SYS_TIME_H@
|
||||
# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
|
||||
#endif
|
||||
|
||||
/* Simply delegate to the system's header, without adding anything. */
|
||||
# if @HAVE_SYS_TIME_H@
|
||||
# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
|
||||
# endif
|
||||
#ifndef _@GUARD_PREFIX@_SYS_TIME_H
|
||||
#define _@GUARD_PREFIX@_SYS_TIME_H
|
||||
|
||||
#else
|
||||
|
||||
# define _@GUARD_PREFIX@_SYS_TIME_H
|
||||
|
||||
# if @HAVE_SYS_TIME_H@
|
||||
# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
|
||||
# else
|
||||
# include <time.h>
|
||||
# endif
|
||||
#if ! @HAVE_SYS_TIME_H@
|
||||
# include <time.h>
|
||||
#endif
|
||||
|
||||
/* On native Windows with MSVC, get the 'struct timeval' type.
|
||||
Also, on native Windows with a 64-bit time_t, where we are overriding the
|
||||
'struct timeval' type, get all declarations of system functions whose
|
||||
signature contains 'struct timeval'. */
|
||||
# if (defined _MSC_VER || @REPLACE_STRUCT_TIMEVAL@) && @HAVE_WINSOCK2_H@ && !defined _GL_INCLUDING_WINSOCK2_H
|
||||
# define _GL_INCLUDING_WINSOCK2_H
|
||||
# include <winsock2.h>
|
||||
# undef _GL_INCLUDING_WINSOCK2_H
|
||||
# endif
|
||||
#if (defined _MSC_VER || @REPLACE_STRUCT_TIMEVAL@) && @HAVE_WINSOCK2_H@ && !defined _GL_INCLUDING_WINSOCK2_H
|
||||
# define _GL_INCLUDING_WINSOCK2_H
|
||||
# include <winsock2.h>
|
||||
# undef _GL_INCLUDING_WINSOCK2_H
|
||||
#endif
|
||||
|
||||
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
|
||||
|
||||
@@ -55,112 +52,112 @@
|
||||
|
||||
/* The definition of _GL_WARN_ON_USE is copied here. */
|
||||
|
||||
# ifdef __cplusplus
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if !@HAVE_STRUCT_TIMEVAL@ || @REPLACE_STRUCT_TIMEVAL@
|
||||
|
||||
# if @REPLACE_STRUCT_TIMEVAL@
|
||||
# define timeval rpl_timeval
|
||||
# endif
|
||||
|
||||
# if !@HAVE_STRUCT_TIMEVAL@ || @REPLACE_STRUCT_TIMEVAL@
|
||||
|
||||
# if @REPLACE_STRUCT_TIMEVAL@
|
||||
# define timeval rpl_timeval
|
||||
# endif
|
||||
|
||||
# if !GNULIB_defined_struct_timeval
|
||||
# if !GNULIB_defined_struct_timeval
|
||||
struct timeval
|
||||
{
|
||||
time_t tv_sec;
|
||||
long int tv_usec;
|
||||
};
|
||||
# define GNULIB_defined_struct_timeval 1
|
||||
# endif
|
||||
|
||||
# define GNULIB_defined_struct_timeval 1
|
||||
# endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# if @GNULIB_GETTIMEOFDAY@
|
||||
# if @REPLACE_GETTIMEOFDAY@
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef gettimeofday
|
||||
# define gettimeofday rpl_gettimeofday
|
||||
# endif
|
||||
#if @GNULIB_GETTIMEOFDAY@
|
||||
# if @REPLACE_GETTIMEOFDAY@
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef gettimeofday
|
||||
# define gettimeofday rpl_gettimeofday
|
||||
# endif
|
||||
_GL_FUNCDECL_RPL (gettimeofday, int,
|
||||
(struct timeval *restrict, void *restrict)
|
||||
_GL_ARG_NONNULL ((1)));
|
||||
_GL_CXXALIAS_RPL (gettimeofday, int,
|
||||
(struct timeval *restrict, void *restrict));
|
||||
# else
|
||||
# if !@HAVE_GETTIMEOFDAY@
|
||||
# else
|
||||
# if !@HAVE_GETTIMEOFDAY@
|
||||
_GL_FUNCDECL_SYS (gettimeofday, int,
|
||||
(struct timeval *restrict, void *restrict)
|
||||
_GL_ARG_NONNULL ((1)));
|
||||
# endif
|
||||
# endif
|
||||
/* Need to cast, because on glibc systems, by default, the second argument is
|
||||
struct timezone *. */
|
||||
_GL_CXXALIAS_SYS_CAST (gettimeofday, int,
|
||||
(struct timeval *restrict, void *restrict));
|
||||
# endif
|
||||
# endif
|
||||
_GL_CXXALIASWARN (gettimeofday);
|
||||
# elif defined GNULIB_POSIXCHECK
|
||||
# undef gettimeofday
|
||||
# if HAVE_RAW_DECL_GETTIMEOFDAY
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef gettimeofday
|
||||
# if HAVE_RAW_DECL_GETTIMEOFDAY
|
||||
_GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - "
|
||||
"use gnulib module gettimeofday for portability");
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Hide some function declarations from <winsock2.h>. */
|
||||
|
||||
# if defined _MSC_VER && @HAVE_WINSOCK2_H@
|
||||
# if !defined _@GUARD_PREFIX@_UNISTD_H
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef close
|
||||
# define close close_used_without_including_unistd_h
|
||||
# else
|
||||
#if defined _MSC_VER && @HAVE_WINSOCK2_H@
|
||||
# if !defined _@GUARD_PREFIX@_UNISTD_H
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef close
|
||||
# define close close_used_without_including_unistd_h
|
||||
# else
|
||||
_GL_WARN_ON_USE (close,
|
||||
"close() used without including <unistd.h>");
|
||||
# endif
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef gethostname
|
||||
# define gethostname gethostname_used_without_including_unistd_h
|
||||
# else
|
||||
# endif
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef gethostname
|
||||
# define gethostname gethostname_used_without_including_unistd_h
|
||||
# else
|
||||
_GL_WARN_ON_USE (gethostname,
|
||||
"gethostname() used without including <unistd.h>");
|
||||
# endif
|
||||
# endif
|
||||
# if !defined _@GUARD_PREFIX@_SYS_SOCKET_H
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef socket
|
||||
# define socket socket_used_without_including_sys_socket_h
|
||||
# undef connect
|
||||
# define connect connect_used_without_including_sys_socket_h
|
||||
# undef accept
|
||||
# define accept accept_used_without_including_sys_socket_h
|
||||
# undef bind
|
||||
# define bind bind_used_without_including_sys_socket_h
|
||||
# undef getpeername
|
||||
# define getpeername getpeername_used_without_including_sys_socket_h
|
||||
# undef getsockname
|
||||
# define getsockname getsockname_used_without_including_sys_socket_h
|
||||
# undef getsockopt
|
||||
# define getsockopt getsockopt_used_without_including_sys_socket_h
|
||||
# undef listen
|
||||
# define listen listen_used_without_including_sys_socket_h
|
||||
# undef recv
|
||||
# define recv recv_used_without_including_sys_socket_h
|
||||
# undef send
|
||||
# define send send_used_without_including_sys_socket_h
|
||||
# undef recvfrom
|
||||
# define recvfrom recvfrom_used_without_including_sys_socket_h
|
||||
# undef sendto
|
||||
# define sendto sendto_used_without_including_sys_socket_h
|
||||
# undef setsockopt
|
||||
# define setsockopt setsockopt_used_without_including_sys_socket_h
|
||||
# undef shutdown
|
||||
# define shutdown shutdown_used_without_including_sys_socket_h
|
||||
# else
|
||||
# endif
|
||||
# if !defined _@GUARD_PREFIX@_SYS_SOCKET_H
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef socket
|
||||
# define socket socket_used_without_including_sys_socket_h
|
||||
# undef connect
|
||||
# define connect connect_used_without_including_sys_socket_h
|
||||
# undef accept
|
||||
# define accept accept_used_without_including_sys_socket_h
|
||||
# undef bind
|
||||
# define bind bind_used_without_including_sys_socket_h
|
||||
# undef getpeername
|
||||
# define getpeername getpeername_used_without_including_sys_socket_h
|
||||
# undef getsockname
|
||||
# define getsockname getsockname_used_without_including_sys_socket_h
|
||||
# undef getsockopt
|
||||
# define getsockopt getsockopt_used_without_including_sys_socket_h
|
||||
# undef listen
|
||||
# define listen listen_used_without_including_sys_socket_h
|
||||
# undef recv
|
||||
# define recv recv_used_without_including_sys_socket_h
|
||||
# undef send
|
||||
# define send send_used_without_including_sys_socket_h
|
||||
# undef recvfrom
|
||||
# define recvfrom recvfrom_used_without_including_sys_socket_h
|
||||
# undef sendto
|
||||
# define sendto sendto_used_without_including_sys_socket_h
|
||||
# undef setsockopt
|
||||
# define setsockopt setsockopt_used_without_including_sys_socket_h
|
||||
# undef shutdown
|
||||
# define shutdown shutdown_used_without_including_sys_socket_h
|
||||
# else
|
||||
_GL_WARN_ON_USE (socket,
|
||||
"socket() used without including <sys/socket.h>");
|
||||
_GL_WARN_ON_USE (connect,
|
||||
@@ -189,17 +186,18 @@ _GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - "
|
||||
"setsockopt() used without including <sys/socket.h>");
|
||||
_GL_WARN_ON_USE (shutdown,
|
||||
"shutdown() used without including <sys/socket.h>");
|
||||
# endif
|
||||
# endif
|
||||
# if !defined _@GUARD_PREFIX@_SYS_SELECT_H
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef select
|
||||
# define select select_used_without_including_sys_select_h
|
||||
# else
|
||||
_GL_WARN_ON_USE (select,
|
||||
"select() used without including <sys/select.h>");
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# if !defined _@GUARD_PREFIX@_SYS_SELECT_H
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef select
|
||||
# define select select_used_without_including_sys_select_h
|
||||
# else
|
||||
_GL_WARN_ON_USE (select,
|
||||
"select() used without including <sys/select.h>");
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* _@GUARD_PREFIX@_SYS_TIME_H */
|
||||
#endif /* _@GUARD_PREFIX@_SYS_TIME_H */
|
||||
|
||||
Reference in New Issue
Block a user