--- /dev/null
+From b44aa20e0ff2763468bf82ff4e996dec03e872bd Mon Sep 17 00:00:00 2001
+From: Sachin Agrawal <sachin.agrawal@intel.com>
+Date: Thu, 2 Apr 2015 15:21:40 -0700
+Subject: [PATCH 1/1] Adding autoconf generated files in tinydtls repo
+
+tinydtls build system uses autotools while Iotivity uses
+scons build system. Since tinydtls contains few source files
+and header files, it seems convenient for Iotivity to use
+scons to build tinydtls library.
+This patch is to add autoconf generated files so that tinydtls
+can be build using scons script.
+
+Note: Since this change is a custom change and specifically
+for Iotivity, I do not intend to submit this patch for
+upstreaming.
+
+Change-Id: I4da593a8abccd731466a88d365dca536f608c94a
+Signed-off-by: Sachin Agrawal <sachin.agrawal@intel.com>
+---
+ extlibs/tinydtls/dtls_config.h | 171 ++++++++++++++++++++++++++++++++++++++++
+ extlibs/tinydtls/tinydtls.h | 45 +++++++++++
+ 2 files changed, 216 insertions(+)
+ create mode 100644 extlibs/tinydtls/dtls_config.h
+ create mode 100644 extlibs/tinydtls/tinydtls.h
+
+diff --git a/extlibs/tinydtls/dtls_config.h b/extlibs/tinydtls/dtls_config.h
+new file mode 100644
+index 0000000..39df8c9
+--- /dev/null
++++ b/extlibs/tinydtls/dtls_config.h
+@@ -0,0 +1,171 @@
++/* dtls_config.h. Generated from dtls_config.h.in by configure. */
++/* tinydtls -- a very basic DTLS implementation
++ *
++ * Copyright (C) 2011--2014 Olaf Bergmann <bergmann@tzi.org>
++ * Copyright (C) 2013 Hauke Mehrtens <hauke@hauke-m.de>
++ *
++ * Permission is hereby granted, free of charge, to any person
++ * obtaining a copy of this software and associated documentation
++ * files (the "Software"), to deal in the Software without
++ * restriction, including without limitation the rights to use, copy,
++ * modify, merge, publish, distribute, sublicense, and/or sell copies
++ * of the Software, and to permit persons to whom the Software is
++ * furnished to do so, subject to the following conditions:
++ *
++ * The above copyright notice and this permission notice shall be
++ * included in all copies or substantial portions of the Software.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
++ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
++ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
++ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
++ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
++ * SOFTWARE.
++ */
++
++/**
++ * @file dtls_config.h
++ * @brief internal configuration for tinydtls library
++ *
++ * This file has been generated by configure from dtls_config.h.in.
++ */
++
++/* dummy definitions for PACKAGE_NAME and PACKAGE_VERSION */
++#define PACKAGE_NAME "tinydtls"
++#define PACKAGE_STRING "tinydtls 0.8.1"
++#define PACKAGE_VERSION "0.8.1"
++
++#ifdef CONTIKI
++#include "contiki.h"
++#include "contiki-lib.h"
++#include "contiki-net.h"
++
++#include "contiki-conf.h"
++
++/* global constants for constrained devices running Contiki */
++#ifndef DTLS_PEER_MAX
++/** The maximum number DTLS peers (i.e. sessions). */
++# define DTLS_PEER_MAX 1
++#endif
++
++#ifndef DTLS_HANDSHAKE_MAX
++/** The maximum number of concurrent DTLS handshakes. */
++# define DTLS_HANDSHAKE_MAX 1
++#endif
++
++#ifndef DTLS_SECURITY_MAX
++/** The maximum number of concurrently used cipher keys */
++# define DTLS_SECURITY_MAX (DTLS_PEER_MAX + DTLS_HANDSHAKE_MAX)
++#endif
++
++#ifndef DTLS_HASH_MAX
++/** The maximum number of hash functions that can be used in parallel. */
++# define DTLS_HASH_MAX (3 * DTLS_PEER_MAX)
++#endif
++#endif /* CONTIKI */
++
++/* Define to 1 if you have the <assert.h> header file. */
++#define HAVE_ASSERT_H 1
++
++/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
++ to 0 otherwise. */
++#define HAVE_MALLOC 1
++
++/* Define to 1 if you have the <memory.h> header file. */
++#define HAVE_MEMORY_H 1
++
++/* Define to 1 if you have the `memset' function. */
++#define HAVE_MEMSET 1
++
++/* Define to 1 if you have the <stddef.h> header file. */
++#define HAVE_STDDEF_H 1
++
++/* Define to 1 if you have the <stdint.h> header file. */
++#define HAVE_STDINT_H 1
++
++/* Define to 1 if you have the <stdlib.h> header file. */
++#define HAVE_STDLIB_H 1
++
++/* Define to 1 if you have the `strdup' function. */
++#define HAVE_STRDUP 1
++
++/* Define to 1 if you have the `strerror' function. */
++#define HAVE_STRERROR 1
++
++/* Define to 1 if you have the <strings.h> header file. */
++#define HAVE_STRINGS_H 1
++
++/* Define to 1 if you have the <string.h> header file. */
++#define HAVE_STRING_H 1
++
++/* Define to 1 if you have the `strnlen' function. */
++#define HAVE_STRNLEN 1
++
++/* Define to 1 if you have the <time.h> header file. */
++#define HAVE_TIME_H 1
++
++/* Define to 1 if you have the `vprintf' function. */
++#define HAVE_VPRINTF 1
++
++/* Define to the address where bug reports for this package should be sent. */
++#define PACKAGE_BUGREPORT ""
++
++/* Define to the full name of this package. */
++#define PACKAGE_NAME "tinydtls"
++
++/* Define to the full name and version of this package. */
++#define PACKAGE_STRING "tinydtls 0.8.1"
++
++/* Define to the one symbol short name of this package. */
++#define PACKAGE_TARNAME "tinydtls"
++
++/* Define to the home page for this package. */
++#define PACKAGE_URL ""
++
++/* Define to the version of this package. */
++#define PACKAGE_VERSION "0.8.1"
++
++/* Define to 1 if you have the ANSI C header files. */
++#define STDC_HEADERS 1
++
++/* Define to `__inline__' or `__inline' if that's what the C compiler
++ calls it, or to nothing if 'inline' is not supported under any name. */
++#ifndef __cplusplus
++/* #undef inline */
++#endif
++
++/* Define to rpl_malloc if the replacement function should be used. */
++/* #undef malloc */
++/* Define to `unsigned int' if <sys/types.h> does not define. */
++
++/* #undef size_t */
++
++/************************************************************************/
++/* Specific Contiki platforms */
++/************************************************************************/
++
++#ifdef CONTIKI
++
++#if CONTIKI_TARGET_ECONOTAG
++# include "platform-specific/config-econotag.h"
++#endif /* CONTIKI_TARGET_ECONOTAG */
++
++#ifdef CONTIKI_TARGET_CC2538DK
++# include "platform-specific/config-cc2538dk.h"
++#endif /* CONTIKI_TARGET_CC2538DK */
++
++#ifdef CONTIKI_TARGET_WISMOTE
++# include "platform-specific/config-wismote.h"
++#endif /* CONTIKI_TARGET_WISMOTE */
++
++#ifdef CONTIKI_TARGET_SKY
++# include "platform-specific/config-sky.h"
++#endif /* CONTIKI_TARGET_SKY */
++
++#ifdef CONTIKI_TARGET_MINIMAL_NET
++# include "platform-specific/config-minimal-net.h"
++#endif /* CONTIKI_TARGET_MINIMAL_NET */
++
++#endif /* CONTIKI */
+diff --git a/extlibs/tinydtls/tinydtls.h b/extlibs/tinydtls/tinydtls.h
+new file mode 100644
+index 0000000..3fa228a
+--- /dev/null
++++ b/extlibs/tinydtls/tinydtls.h
+@@ -0,0 +1,45 @@
++/* tinydtls.h. Generated from tinydtls.h.in by configure. */
++/* tinydtls -- a very basic DTLS implementation
++ *
++ * Copyright (C) 2011--2014 Olaf Bergmann <bergmann@tzi.org>
++ * Copyright (C) 2013 Hauke Mehrtens <hauke@hauke-m.de>
++ *
++ * Permission is hereby granted, free of charge, to any person
++ * obtaining a copy of this software and associated documentation
++ * files (the "Software"), to deal in the Software without
++ * restriction, including without limitation the rights to use, copy,
++ * modify, merge, publish, distribute, sublicense, and/or sell copies
++ * of the Software, and to permit persons to whom the Software is
++ * furnished to do so, subject to the following conditions:
++ *
++ * The above copyright notice and this permission notice shall be
++ * included in all copies or substantial portions of the Software.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
++ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
++ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
++ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
++ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
++ * SOFTWARE.
++ */
++
++/**
++ * @file tinydtls.h
++ * @brief public tinydtls API
++ */
++
++#ifndef _DTLS_TINYDTLS_H_
++#define _DTLS_TINYDTLS_H_
++
++/** Defined to 1 if tinydtls is built with support for ECC */
++/* #undef DTLS_ECC */
++
++/** Defined to 1 if tinydtls is built with support for PSK */
++#define DTLS_PSK 1
++
++/** Defined to 1 if tinydtls is built for Contiki OS */
++/* #undef WITH_CONTIKI */
++
++#endif /* _DTLS_TINYDTLS_H_ */
+--
+1.7.9.5
+
--- /dev/null
+/* dtls_config.h. Generated from dtls_config.h.in by configure. */
+/* tinydtls -- a very basic DTLS implementation
+ *
+ * Copyright (C) 2011--2014 Olaf Bergmann <bergmann@tzi.org>
+ * Copyright (C) 2013 Hauke Mehrtens <hauke@hauke-m.de>
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/**
+ * @file dtls_config.h
+ * @brief internal configuration for tinydtls library
+ *
+ * This file has been generated by configure from dtls_config.h.in.
+ */
+
+/* dummy definitions for PACKAGE_NAME and PACKAGE_VERSION */
+#define PACKAGE_NAME "tinydtls"
+#define PACKAGE_STRING "tinydtls 0.8.1"
+#define PACKAGE_VERSION "0.8.1"
+
+#ifdef CONTIKI
+#include "contiki.h"
+#include "contiki-lib.h"
+#include "contiki-net.h"
+
+#include "contiki-conf.h"
+
+/* global constants for constrained devices running Contiki */
+#ifndef DTLS_PEER_MAX
+/** The maximum number DTLS peers (i.e. sessions). */
+# define DTLS_PEER_MAX 1
+#endif
+
+#ifndef DTLS_HANDSHAKE_MAX
+/** The maximum number of concurrent DTLS handshakes. */
+# define DTLS_HANDSHAKE_MAX 1
+#endif
+
+#ifndef DTLS_SECURITY_MAX
+/** The maximum number of concurrently used cipher keys */
+# define DTLS_SECURITY_MAX (DTLS_PEER_MAX + DTLS_HANDSHAKE_MAX)
+#endif
+
+#ifndef DTLS_HASH_MAX
+/** The maximum number of hash functions that can be used in parallel. */
+# define DTLS_HASH_MAX (3 * DTLS_PEER_MAX)
+#endif
+#endif /* CONTIKI */
+
+/* Define to 1 if you have the <assert.h> header file. */
+#define HAVE_ASSERT_H 1
+
+/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
+ to 0 otherwise. */
+#define HAVE_MALLOC 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `memset' function. */
+#define HAVE_MEMSET 1
+
+/* Define to 1 if you have the <stddef.h> header file. */
+#define HAVE_STDDEF_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the `strdup' function. */
+#define HAVE_STRDUP 1
+
+/* Define to 1 if you have the `strerror' function. */
+#define HAVE_STRERROR 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strnlen' function. */
+#define HAVE_STRNLEN 1
+
+/* Define to 1 if you have the <time.h> header file. */
+#define HAVE_TIME_H 1
+
+/* Define to 1 if you have the `vprintf' function. */
+#define HAVE_VPRINTF 1
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "tinydtls"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "tinydtls 0.8.1"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "tinydtls"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "0.8.1"
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+
+/* Define to rpl_malloc if the replacement function should be used. */
+/* #undef malloc */
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+
+/* #undef size_t */
+
+/************************************************************************/
+/* Specific Contiki platforms */
+/************************************************************************/
+
+#ifdef CONTIKI
+
+#if CONTIKI_TARGET_ECONOTAG
+# include "platform-specific/config-econotag.h"
+#endif /* CONTIKI_TARGET_ECONOTAG */
+
+#ifdef CONTIKI_TARGET_CC2538DK
+# include "platform-specific/config-cc2538dk.h"
+#endif /* CONTIKI_TARGET_CC2538DK */
+
+#ifdef CONTIKI_TARGET_WISMOTE
+# include "platform-specific/config-wismote.h"
+#endif /* CONTIKI_TARGET_WISMOTE */
+
+#ifdef CONTIKI_TARGET_SKY
+# include "platform-specific/config-sky.h"
+#endif /* CONTIKI_TARGET_SKY */
+
+#ifdef CONTIKI_TARGET_MINIMAL_NET
+# include "platform-specific/config-minimal-net.h"
+#endif /* CONTIKI_TARGET_MINIMAL_NET */
+
+#endif /* CONTIKI */
--- /dev/null
+/* tinydtls.h. Generated from tinydtls.h.in by configure. */
+/* tinydtls -- a very basic DTLS implementation
+ *
+ * Copyright (C) 2011--2014 Olaf Bergmann <bergmann@tzi.org>
+ * Copyright (C) 2013 Hauke Mehrtens <hauke@hauke-m.de>
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/**
+ * @file tinydtls.h
+ * @brief public tinydtls API
+ */
+
+#ifndef _DTLS_TINYDTLS_H_
+#define _DTLS_TINYDTLS_H_
+
+/** Defined to 1 if tinydtls is built with support for ECC */
+/* #undef DTLS_ECC */
+
+/** Defined to 1 if tinydtls is built with support for PSK */
+#define DTLS_PSK 1
+
+/** Defined to 1 if tinydtls is built for Contiki OS */
+/* #undef WITH_CONTIKI */
+
+#endif /* _DTLS_TINYDTLS_H_ */
Currently Sconscript alone has been added for tinydtls compilation.
-Before compiling the code, Please add tinydtls source code in this folder.
+Before compiling the code, Please copy the source code from
+<iotivity>/extlibs/tinydtls to this directory
-Source Code will be available in following link:
-http://sourceforge.net/projects/tinydtls/files/latest/download?source=files
\ No newline at end of file
env.AppendUnique(CPPPATH = [root_dir+'ecc/'])
env.AppendUnique(CPPPATH = [root_dir+'sha2/'])
+if target_os not in ['arduino', 'windows', 'winrt']:
+ env.AppendUnique(CPPDEFINES = ['HAVE_SYS_TIME_H'])
+
######################################################################
# Source files and Target(s)
######################################################################
else:
env.AppendUnique(CPPDEFINES = ['NDEBUG'])
-env.AppendUnique(CPPDEFINES = ['WITH_OICSTACK', 'DTLSV12', 'WITH_SHA256', 'DTLS_CHECK_CONTENTTYPE'])
+env.AppendUnique(CPPDEFINES = ['DTLSV12', 'WITH_SHA256', 'DTLS_CHECK_CONTENTTYPE'])
libtinydtls = env.StaticLibrary('libtinydtls', env.get('TINYDTLS_SRC'), OBJPREFIX='libtinydtls_')
+######################################################################
+# Generate tinydtls samples
+#
+# Note:
+# Currently there is a bug in debug.h/debug.c which fails compilation
+# of tinydtls samples in release mode. This bug is being tracked in
+# IOT-395
+######################################################################
+if not env.get('RELEASE'):
+ samples_env = env.Clone()
+
+ if target_os not in ['arduino', 'windows', 'winrt']:
+ samples_env.AppendUnique(CPPDEFINES = ['_GNU_SOURCE'])
+
+ dtlsserver = samples_env.Program('dtls-server', ['tests/dtls-server.c'])
+ dtlsclient = samples_env.Program('dtls-client', ['tests/dtls-client.c'])
+
+ samples_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
+ samples_env.PrependUnique(LIBS = ['tinydtls'])
+
+ Alias("samples", [dtlsserver, dtlsclient])
+ samples_env.AppendTarget('samples')
+
env.InstallTarget(libtinydtls, 'libtinydtls');