]> granicus.if.org Git - pdns/commitdiff
cleanup polar update
authorKees Monshouwer <mind04@monshouwer.org>
Mon, 13 Oct 2014 14:24:34 +0000 (16:24 +0200)
committermind04 <mind04@monshouwer.org>
Mon, 22 Dec 2014 19:33:54 +0000 (20:33 +0100)
pdns/ext/polarssl/.gitignore
pdns/ext/polarssl/library/CMakeLists.txt
pdns/ext/polarssl/library/Makefile.am
pdns/ext/polarssl/library/memory.c [deleted file]

index b4e00663241b7fc71b0ea24061315469677f499b..88cd94a370a4aa3d94ab16a68beac1e20bc2a31c 100644 (file)
@@ -3,5 +3,9 @@ CMakeFiles
 CTestTestfile.cmake
 cmake_install.cmake
 Testing
+Coverage
+*.gcno
+*.gcda
+library/polarssl.info
 Makefile
 Makefile.in
index baaf822b4c220c204254c1b3940b24e31e414259..bc986eee44abd0b69570a047f90f741bb22a2f89 100644 (file)
@@ -1,7 +1,10 @@
-option(USE_SHARED_POLARSSL_LIBRARY "Build PolarSSL as a shared library." OFF)
+option(USE_STATIC_POLARSSL_LIBRARY "Build PolarSSL static library." ON)
+option(USE_SHARED_POLARSSL_LIBRARY "Build PolarSSL shared library." OFF)
+option(LINK_WITH_PTHREAD "Explicitly link PolarSSL library to pthread." OFF)
 
 set(src
      aes.c
+     aesni.c
      arc4.c
      asn1parse.c
      asn1write.c
@@ -9,6 +12,7 @@ set(src
      bignum.c
      blowfish.c
      camellia.c
+     ccm.c
      certs.c
      cipher.c
      cipher_wrap.c
@@ -17,6 +21,7 @@ set(src
      des.c
      dhm.c
      ecp.c
+     ecp_curves.c
      ecdh.c
      ecdsa.c
      entropy.c
@@ -24,12 +29,12 @@ set(src
      error.c
      gcm.c
      havege.c
+     hmac_drbg.c
      md.c
      md_wrap.c
      md2.c
      md4.c
      md5.c
-     memory.c
      memory_buffer_alloc.c
      net.c
      oid.c
@@ -43,6 +48,8 @@ set(src
      pk_wrap.c
      pkparse.c
      pkwrite.c
+     platform.c
+     ripemd160.c
      rsa.c
      sha1.c
      sha256.c
@@ -55,6 +62,7 @@ set(src
      threading.c
      timing.c
      version.c
+     version_features.c
      x509.c
      x509_crt.c
      x509_crl.c
@@ -69,19 +77,60 @@ if(WIN32)
 set(libs ws2_32)
 endif(WIN32)
 
-if(NOT USE_SHARED_POLARSSL_LIBRARY)
+if(CMAKE_COMPILER_IS_GNUCC)
+  set(CMAKE_C_FLAGS_CHECK "${CMAKE_C_FLAGS_CHECK} -Wmissing-declarations -Wmissing-prototypes")
+  set(CMAKE_C_FLAGS_CHECKFULL "${CMAKE_C_FLAGS_CHECK} -Wcast-qual")
+endif(CMAKE_COMPILER_IS_GNUCC)
 
-add_library(polarssl STATIC ${src})
+if(CMAKE_COMPILER_IS_CLANG)
+  set(CMAKE_C_FLAGS_CHECK "${CMAKE_C_FLAGS_CHECK} -Wmissing-declarations -Wmissing-prototypes")
+endif(CMAKE_COMPILER_IS_CLANG)
 
-else(NOT USE_SHARED_POLARSSL_LIBRARY)
+if (NOT USE_STATIC_POLARSSL_LIBRARY AND NOT USE_SHARED_POLARSSL_LIBRARY)
+       message(FATAL_ERROR "Need to choose static or shared polarssl build!")
+endif(NOT USE_STATIC_POLARSSL_LIBRARY AND NOT USE_SHARED_POLARSSL_LIBRARY)
 
-add_library(polarssl SHARED ${src})
-set_target_properties(polarssl PROPERTIES VERSION 1.3.2 SOVERSION 5)
+if(USE_STATIC_POLARSSL_LIBRARY AND USE_SHARED_POLARSSL_LIBRARY)
+       # if we build both static an shared, then let
+       # tests and programs link to the shared lib target
+       set(polarssl_static_target "polarssl_static")
+elseif(USE_STATIC_POLARSSL_LIBRARY)
+       set(polarssl_static_target "polarssl")
+endif()
 
-endif(NOT USE_SHARED_POLARSSL_LIBRARY)
+if(USE_STATIC_POLARSSL_LIBRARY)
+       add_library(${polarssl_static_target} STATIC ${src})
+       set_target_properties(${polarssl_static_target} PROPERTIES OUTPUT_NAME polarssl)
+       target_link_libraries(${polarssl_static_target} ${libs})
 
-target_link_libraries(polarssl ${libs})
+       if(ZLIB_FOUND)
+               target_link_libraries(${polarssl_static_target} ${ZLIB_LIBRARIES})
+       endif(ZLIB_FOUND)
 
-install(TARGETS polarssl
-        DESTINATION ${LIB_INSTALL_DIR}
-        PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
+       if(LINK_WITH_PTHREAD)
+        target_link_libraries(${polarssl_static_target} pthread)
+       endif()
+
+       install(TARGETS ${polarssl_static_target}
+                       DESTINATION ${LIB_INSTALL_DIR}
+                       PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
+endif()
+
+if(USE_SHARED_POLARSSL_LIBRARY)
+       add_library(polarssl SHARED ${src})
+       set_target_properties(polarssl PROPERTIES VERSION 1.3.8 SOVERSION 7)
+
+       target_link_libraries(polarssl ${libs})
+
+       if(ZLIB_FOUND)
+               target_link_libraries(polarssl ${ZLIB_LIBRARIES})
+       endif(ZLIB_FOUND)
+
+       if(LINK_WITH_PTHREAD)
+        target_link_libraries(polarssl pthread)
+       endif()
+
+       install(TARGETS polarssl
+                       DESTINATION ${LIB_INSTALL_DIR}
+                       PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
+endif(USE_SHARED_POLARSSL_LIBRARY)
index 74968dedf40feb0dc562d46553367bd17056e547..22335dc4f81efaf32f8d21e3fa381a00a4f4a56f 100644 (file)
@@ -1,4 +1,73 @@
 noinst_LTLIBRARIES=libpolarssl.la
-libpolarssl_la_SOURCES=aes.c aesni.c arc4.c asn1parse.c asn1write.c base64.c bignum.c blowfish.c camellia.c ccm.c certs.c cipher.c cipher_wrap.c ctr_drbg.c debug.c des.c dhm.c ecdh.c ecdsa.c ecp.c ecp_curves.c entropy.c entropy_poll.c error.c gcm.c havege.c hmac_drbg.c md2.c md4.c md5.c md.c md_wrap.c memory_buffer_alloc.c memory.c net.c oid.c padlock.c pbkdf2.c pem.c pk.c pkcs11.c pkcs12.c pkcs5.c pkparse.c pk_wrap.c pkwrite.c platform.c ripemd160.c rsa.c sha1.c sha256.c sha512.c ssl_cache.c ssl_ciphersuites.c ssl_cli.c ssl_srv.c ssl_tls.c threading.c timing.c version.c version_features.c x509.c x509_create.c x509_crl.c x509_crt.c x509_csr.c x509write_crt.c x509write_csr.c xtea.c
+
+libpolarssl_la_SOURCES= \
+  aes.c \
+  aesni.c \
+  arc4.c \
+  asn1parse.c \
+  asn1write.c \
+  base64.c \
+  bignum.c \
+  blowfish.c \
+  camellia.c \
+  ccm.c \
+  certs.c \
+  cipher.c \
+  cipher_wrap.c \
+  ctr_drbg.c \
+  debug.c \
+  des.c \
+  dhm.c \
+  ecp.c \
+  ecp_curves.c \
+  ecdh.c \
+  ecdsa.c \
+  entropy.c \
+  entropy_poll.c \
+  error.c \
+  gcm.c \
+  havege.c \
+  hmac_drbg.c \
+  md.c \
+  md_wrap.c \
+  md2.c \
+  md4.c \
+  md5.c \
+  memory_buffer_alloc.c \
+  net.c \
+  oid.c \
+  padlock.c \
+  pbkdf2.c \
+  pem.c \
+  pkcs5.c \
+  pkcs11.c \
+  pkcs12.c \
+  pk.c \
+  pk_wrap.c \
+  pkparse.c \
+  pkwrite.c \
+  platform.c \
+  ripemd160.c \
+  rsa.c \
+  sha1.c \
+  sha256.c \
+  sha512.c \
+  ssl_cache.c \
+  ssl_ciphersuites.c \
+  ssl_cli.c \
+  ssl_srv.c \
+  ssl_tls.c \
+  threading.c \
+  timing.c \
+  version.c \
+  version_features.c \
+  x509.c \
+  x509_crt.c \
+  x509_crl.c \
+  x509_csr.c \
+  x509_create.c \
+  x509write_crt.c \
+  x509write_csr.c \
+  xtea.c
 
 libpolarssl_la_CPPFLAGS=-I$(srcdir)/../include -D_FILE_OFFSET_BITS=64 -Wall -W -Wdeclaration-after-statement
diff --git a/pdns/ext/polarssl/library/memory.c b/pdns/ext/polarssl/library/memory.c
deleted file mode 100644 (file)
index 93ca379..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *  Memory allocation layer
- *
- *  Copyright (C) 2006-2013, Brainspark B.V.
- *
- *  This file is part of PolarSSL (http://www.polarssl.org)
- *  Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
- *
- *  All rights reserved.
- *
- *  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 2 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, write to the Free Software Foundation, Inc.,
- *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "polarssl/config.h"
-
-#if defined(POLARSSL_MEMORY_C)
-
-#include "polarssl/memory.h"
-
-#if !defined(POLARSSL_MEMORY_STDMALLOC)
-static void *memory_malloc_uninit( size_t len )
-{
-    ((void) len);
-    return( NULL );
-}
-
-#define POLARSSL_MEMORY_STDMALLOC   memory_malloc_uninit
-#endif /* !POLARSSL_MEMORY_STDMALLOC */
-
-#if !defined(POLARSSL_MEMORY_STDFREE)
-static void memory_free_uninit( void *ptr )
-{
-    ((void) ptr);
-}
-
-#define POLARSSL_MEMORY_STDFREE     memory_free_uninit
-#endif /* !POLARSSL_MEMORY_STDFREE */
-
-void * (*polarssl_malloc)( size_t ) = POLARSSL_MEMORY_STDMALLOC;
-void (*polarssl_free)( void * )     = POLARSSL_MEMORY_STDFREE;
-
-int memory_set_own( void * (*malloc_func)( size_t ),
-                    void (*free_func)( void * ) )
-{
-    polarssl_malloc = malloc_func;
-    polarssl_free = free_func;
-
-    return( 0 );
-}
-
-#endif /* POLARSSL_MEMORY_C */