rcpgenerator.hh lock.hh dnswriter.hh dnsrecords.hh dnsparser.hh utility.hh \
recursor_cache.hh rec_channel.hh qtype.hh misc.hh dns.hh syncres.hh \
sstuff.hh mtasker.hh mtasker.cc lwres.hh logger.hh pdnsexception.hh \
-mplexer.hh pubsuffix.hh \
+mplexer.hh pubsuffix.hh mbedtlscompat.hh \
dns_random.hh lua-pdns.hh lua-recursor.hh namespaces.hh \
recpacketcache.hh base32.hh cachecleaner.hh json.hh version.hh \
ws-recursor.hh ws-api.hh secpoll-recursor.hh \
lua-auth.cc lua-auth.hh \
lua-pdns.cc lua-iputils.cc \
mastercommunicator.cc \
+ mbedtlscompat.hh \
md5.hh \
misc.cc misc.hh \
nameserver.cc nameserver.hh \
gss_context.cc gss_context.hh \
json.cc \
logger.cc \
+ mbedtlscompat.hh \
misc.cc misc.hh \
nsecrecords.cc \
packetcache.cc \
dnsrecords.cc \
dnswriter.cc dnswriter.hh \
logger.cc \
+ mbedtlscompat.hh \
misc.cc misc.hh \
nsecrecords.cc \
qtype.cc \
dnswriter.cc dnswriter.hh \
iputils.cc \
logger.cc \
+ mbedtlscompat.hh \
misc.cc misc.hh \
nsecrecords.cc \
qtype.cc \
dnswriter.cc dnswriter.hh \
gss_context.cc gss_context.hh \
logger.cc \
+ mbedtlscompat.hh \
misc.cc misc.hh \
nsecrecords.cc \
qtype.cc \
dnstcpbench.cc \
dnswriter.cc dnswriter.hh \
logger.cc \
+ mbedtlscompat.hh \
misc.cc misc.hh \
nsecrecords.cc \
qtype.cc \
dolog.hh \
iputils.cc \
htmlfiles.h \
+ mbedtlscompat.hh \
misc.cc misc.hh \
qtype.cc \
sholder.hh \
dnsrecords.cc \
dnssecinfra.cc \
dnswriter.cc dnswriter.hh \
- gss_context.cc gss_context.hh \
+ gss_context.cc gss_context.hh \
logger.cc \
+ mbedtlscompat.hh \
misc.cc misc.hh \
nsec3dig.cc \
nsecrecords.cc \
dnswriter.cc dnswriter.hh \
ednssubnet.cc ednssubnet.hh \
logger.cc \
+ mbedtlscompat.hh \
misc.cc misc.hh \
nsecrecords.cc \
qtype.cc \
dnswriter.cc dnswriter.hh \
gss_context.cc gss_context.hh \
logger.cc \
+ mbedtlscompat.hh \
misc.cc misc.hh \
nsecrecords.cc \
qtype.cc \
dnsrecords.cc \
dnswriter.cc dnswriter.hh \
logger.cc \
+ mbedtlscompat.hh \
misc.cc misc.hh \
nsecrecords.cc \
qtype.cc \
dnsscan.cc \
dnswriter.cc dnswriter.hh \
logger.cc \
+ mbedtlscompat.hh \
misc.cc \
nsecrecords.cc \
qtype.cc \
dnsreplay.cc \
dnswriter.cc dnswriter.hh \
logger.cc \
+ mbedtlscompat.hh \
misc.cc \
nsecrecords.cc \
qtype.cc \
dnsrecords.cc \
dnswriter.cc dnswriter.hh \
logger.cc \
+ mbedtlscompat.hh \
misc.cc \
mplexer.hh \
nproxy.cc \
dnsrecords.cc \
dnswriter.cc dnswriter.hh \
logger.cc \
+ mbedtlscompat.hh \
misc.cc \
notify.cc \
nsecrecords.cc \
dnsscope.cc \
dnswriter.cc dnswriter.hh \
logger.cc \
+ mbedtlscompat.hh \
misc.cc \
nsecrecords.cc \
qtype.cc \
dnsrecords.cc \
dnswriter.cc dnswriter.hh \
logger.cc \
+ mbedtlscompat.hh \
misc.cc \
nsecrecords.cc \
qtype.cc \
dnsrecords.cc \
dnswriter.cc dnswriter.hh \
logger.cc \
+ mbedtlscompat.hh \
misc.cc \
nsecrecords.cc \
qtype.cc \
lua-pdns.cc lua-pdns.hh lua-iputils.cc \
lua-recursor.cc lua-recursor.hh \
lwres.cc lwres.hh \
+ mbedtlscompat.hh \
misc.cc \
mtasker.hh \
nsecrecords.cc \
#endif
#include "base64.hh"
#include <boost/scoped_array.hpp>
+#ifdef HAVE_MBEDTLS2
#include <mbedtls/base64.h>
+#else
+#include <polarssl/base64.h>
+#include "mbedtlscompat.hh"
+#endif
int B64Decode(const std::string& src, std::string& dst)
{
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
+#ifdef HAVE_MBEDTLS2
#include <mbedtls/aes.h>
+#else
+#include <polarssl/aes.h>
+#include "mbedtlscompat.hh"
+#endif
#include <iostream>
#include <cstdlib>
#include <cstring>
dnswriter.cc dnswriter.hh \
dolog.hh \
iputils.cc iputils.hh \
+ mbedtlscompat.hh \
misc.cc misc.hh \
htmlfiles.h \
namespaces.hh \
#include <boost/algorithm/string.hpp>
#include "dnssecinfra.hh"
#include "dnsseckeeper.hh"
-#include <mbedtls/md5.h>
-#include <mbedtls/sha1.h>
+#ifdef HAVE_MBEDTLS2
#include <mbedtls/md_internal.h>
#include <mbedtls/md.h>
+#else
+#include <polarssl/md5.h>
+#include <polarssl/sha1.h>
+#include <polarssl/md.h>
+#include "mbedtlscompat.hh"
+#endif
#include <boost/assign/std/vector.hpp> // for 'operator+=()'
#include <boost/assign/list_inserter.hpp>
#include "base64.hh"
--- /dev/null
+#define MBEDTLS_VERSION_STRING POLARSSL_VERSION_STRING
+
+#define MBEDTLS_MD_MAX_SIZE POLARSSL_MD_MAX_SIZE
+#define MBEDTLS_MD_MD5 POLARSSL_MD_MD5
+#define MBEDTLS_MD_SHA1 POLARSSL_MD_SHA1
+#define MBEDTLS_MD_SHA224 POLARSSL_MD_SHA224
+#define MBEDTLS_MD_SHA256 POLARSSL_MD_SHA256
+#define MBEDTLS_MD_SHA384 POLARSSL_MD_SHA384
+#define MBEDTLS_MD_SHA512 POLARSSL_MD_SHA512
+
+#define MBEDTLS_RSA_PKCS_V15 RSA_PKCS_V15
+#define MBEDTLS_RSA_PRIVATE RSA_PRIVATE
+#define MBEDTLS_RSA_PUBLIC RSA_PUBLIC
+
+
+// Types
+#define mbedtls_aes_context aes_context
+
+#define mbedtls_sha1_context sha1_context
+#define mbedtls_sha256_context sha256_context
+#define mbedtls_sha512_context sha512_context
+
+#ifdef POLARSSL_MD_H
+typedef md_info_t mbedtls_md_info_t;
+typedef md_type_t mbedtls_md_type_t;
+#endif
+
+#define mbedtls_entropy_context entropy_context
+
+#define mbedtls_ctr_drbg_context ctr_drbg_context
+
+#define mbedtls_rsa_context rsa_context
+
+#define mbedtls_mpi mpi
+
+
+// Functions macro
+#define mbedtls_aes_crypt_ctr aes_crypt_ctr
+#define mbedtls_aes_setkey_enc aes_setkey_enc
+
+#define mbedtls_sha1 sha1
+#define mbedtls_sha1_starts sha1_starts
+#define mbedtls_sha1_update sha1_update
+#define mbedtls_sha1_finish sha1_finish
+
+#define mbedtls_sha256 sha256
+#define mbedtls_sha256_starts sha256_starts
+#define mbedtls_sha256_update sha256_update
+#define mbedtls_sha256_finish sha256_finish
+
+#define mbedtls_sha512 sha512
+#define mbedtls_sha512_starts sha512_starts
+#define mbedtls_sha512_update sha512_update
+#define mbedtls_sha512_finish sha512_finish
+
+#define mbedtls_md_hmac md_hmac
+#define mbedtls_md_get_size md_get_size
+#define mbedtls_md_info_from_type md_info_from_type
+
+#define mbedtls_md5 md5
+
+#define mbedtls_mpi_init mpi_init
+#define mbedtls_mpi_size mpi_size
+#define mbedtls_mpi_free mpi_free
+
+#define mbedtls_entropy_init entropy_init
+#define mbedtls_entropy_func entropy_func
+
+#define mbedtls_ctr_drbg_init
+#define mbedtls_ctr_drbg_seed ctr_drbg_init
+#define mbedtls_ctr_drbg_random ctr_drbg_random
+
+#define mbedtls_rsa_init rsa_init
+#define mbedtls_rsa_gen_key rsa_gen_key
+#define mbedtls_rsa_pkcs1_sign rsa_pkcs1_sign
+#define mbedtls_rsa_pkcs1_verify rsa_pkcs1_verify
+
+#define mbedtls_mpi_copy mpi_copy
+#define mbedtls_mpi_cmp_mpi mpi_cmp_mpi
+#define mbedtls_mpi_bitlen mpi_msb
+#define mbedtls_mpi_write_binary mpi_write_binary
+#define mbedtls_mpi_read_binary mpi_read_binary
+
+
+// Functions
+#ifdef POLARSSL_BASE64_H
+#ifndef COMPAT_BASE64
+#define COMPAT_BASE64
+
+inline int mbedtls_base64_decode( unsigned char *dst, size_t dlen, size_t *olen, const unsigned char *src, size_t slen ) {
+ int ret = base64_decode( dst, &dlen, src, slen );
+ *olen = dlen;
+ return ret;
+}
+
+inline int mbedtls_base64_encode( unsigned char *dst, size_t dlen, size_t *olen, const unsigned char *src, size_t slen ) {
+ int ret = base64_encode( dst, &dlen, src, slen );
+ *olen = dlen;
+ return ret;
+}
+
+#endif
+#endif
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include <mbedtls/rsa.h>
-#include <mbedtls/base64.h>
-#include <sha.hh>
+#ifdef HAVE_MBEDTLS2
#include <mbedtls/entropy.h>
#include <mbedtls/ctr_drbg.h>
+#include <mbedtls/rsa.h>
+#include <mbedtls/base64.h>
+#else
+#include <polarssl/entropy.h>
+#include <polarssl/ctr_drbg.h>
+#include <polarssl/rsa.h>
+#include <polarssl/base64.h>
+#include "mbedtlscompat.hh"
+#endif
#include <boost/assign/std/vector.hpp> // for 'operator+=()'
#include <boost/foreach.hpp>
+#include "sha.hh"
#include "dnssecinfra.hh"
using namespace boost::assign;
#include <string>
#include <stdint.h>
+#ifdef HAVE_MBEDTLS2
#include <mbedtls/md5.h>
+#else
+#include <polarssl/md5.h>
+#include "mbedtlscompat.hh"
+#endif
inline std::string pdns_md5sum(const std::string& input)
{
#include <string>
#include <stdint.h>
+#ifdef HAVE_MBEDTLS2
#include <mbedtls/sha1.h>
#include <mbedtls/sha256.h>
#include <mbedtls/sha512.h>
+#else
+#include <polarssl/sha1.h>
+#include <polarssl/sha256.h>
+#include <polarssl/sha512.h>
+#include "mbedtlscompat.hh"
+#endif
class SHA1Summer
{
#endif
#include "logger.hh"
#include "version.hh"
+#ifdef HAVE_MBEDTLS2
#include <mbedtls/version.h>
+#else
+#include <polarssl/version.h>
+#include "mbedtlscompat.hh"
+#endif
static ProductType productType;
theL()<<Logger::Warning<<"Built-in modules: "<<PDNS_MODULES<<endl;
#endif
#ifndef MBEDTLS_SYSTEM
- theL()<<Logger::Warning<<"Built-in mbed TLS: "<<POLARSSL_VERSION_STRING<<endl;
+ theL()<<Logger::Warning<<"Built-in mbed TLS: "<<MBEDTLS_VERSION_STRING<<endl;
#endif
#ifdef PDNS_CONFIG_ARGS
#define double_escape(s) #s