Olaf Bergmann
67291e397b
tests: revert commit a3da53d to re-enable IPv6 in unit tests
2018-02-15 20:05:01 +01:00
Olaf Bergmann
e40c6ea799
.travis.yml: enable IPv6 on travis docker
...
This workaround has been suggested [1] to fix the recent IPv6 issue
in travis docker containers.
[1] https://github.com/travis-ci/travis-ci/issues/8711
2018-02-15 20:03:40 +01:00
John Carter
c7936acf71
coap_io.c: fix apparently uninitialized buffer in syscall param
...
Valgrind reports Syscall param sendmsg(msg.msg_control) points to
uninitialised byte(s) due alignment padding in the CMSG macros
leaving uninitialized gaps in struct sent to the sendmsg system call.
This issue was reported including this patch on the libcoap-developers
mailing list [1].
[1] https://sourceforge.net/p/libcoap/mailman/message/36141279/
Signed-off-by: Olaf Bergmann <bergmann@tzi.org >
2018-02-15 19:38:42 +01:00
Olaf Bergmann
c46de196e5
.travis.yml: added tinydtls build to POSIX test matrix
2018-02-15 12:14:16 +01:00
obgm
1b97885ec8
Merge pull request #138 from mrdeep1/pki-support
...
Addition of PKI support
2018-02-15 12:03:50 +01:00
Jon Shallow
137789fbc7
coap_openssl.c: Fix dtls typo should be tls in coap_dtls_new_context()
...
Correct parameter typo to SSL_CTX_set_cipher_list() from original TLS merge
2018-02-14 23:07:08 +00:00
Jon Shallow
675edad34c
coap_notls.c, coap_tinydtls.c: Fix stub functions coap_dtls_context_set_pki()
2018-02-14 21:59:21 +00:00
Jon Shallow
0704792698
net.c: Update coap_context_set_pki() parameters
...
Remove setup_callback parameter
2018-02-14 21:04:47 +00:00
Jon Shallow
2a99d04648
coap_session.c: Update coap_new_client_session_pki() parameters
...
Remove setup_callback parameter
2018-02-14 21:03:37 +00:00
Jon Shallow
969cdcb457
coap_openssl.c: Update with coap_dtls_pki_t changes and asn1 private key types
...
Move coap_dtls_security_setup_t into coap_dtls_pki_t
Map COAP_ASN1_PKEY_* into EVP_PKEY_* for call SSL_CTX_use_PrivateKey_ASN1()
2018-02-14 21:00:20 +00:00
Jon Shallow
b8b1c18ffd
net.h: Update coap_context_set_pki() definition
2018-02-14 20:58:15 +00:00
Jon Shallow
f820857315
coap_session.h: Move coap_new_client_session_pki() def from coap_dtls.h
...
Moving coap_dtls_security_setup_t into coap_dtls_pki_t helped with the previous
into its logical place.
2018-02-14 20:54:21 +00:00
Jon Shallow
fa6f292997
coap_dtls.h: Move coap_dtls_security_setup_t into coap_dtls_pki_t
...
Update functions appropriately.
Move coap_new_client_session_pki() back into coap_session.h (its correct place)
Add in enum coap_asn1_privatekey_type_t
2018-02-14 20:50:43 +00:00
Jon Shallow
047c9fb082
Fix coap_notls.c, coap_tinydtls.c: after update merge from obgm/develop
...
Conficts created by Pull request #134
2018-02-14 19:24:58 +00:00
Olaf Bergmann
0d2922a45b
.travis.yml: enable unit tests for openssl builds
...
This change sets TESTS=yes for the TLS=openssl build
2018-02-14 17:43:33 +01:00
Olaf Bergmann
c74e1da5a9
tests: add unit test boilerplate for (D)TLS
...
A simple structure for (D)TLS-specific unit tests has been added.
Currently, only general support and the version number as reported
by coap_get_tls_library_version() are checked.
2018-02-14 17:28:37 +01:00
Olaf Bergmann
b1943714ad
Merge branch 'mrdeep1-tls-supported' into develop
...
Close PR #134 [1]
[1] https://github.com/obgm/libcoap/pull/134
2018-02-14 17:25:53 +01:00
Olaf Bergmann
16685d7736
Merge branch 'tls-supported' of https://github.com/mrdeep1/libcoap into mrdeep1-tls-supported
2018-02-14 16:21:27 +01:00
Olaf Bergmann
a3da53d5e3
tests: use IPv4 in unit tests for robustness
...
As unit tests with IPv6 addresses keep failing on docker-based
travis CI, this changes reverts to IPv4 usage in following files:
test_wellknown.c
test_sendqueue.c
2018-02-14 16:06:52 +01:00
Jon Shallow
c4729fa801
libcoap-1.map, libcoap-1.sym: Expose coap_get_tls_library_version()
2018-02-14 09:55:53 +00:00
Jon Shallow
85e7f1fc54
libcoap-1.map, libcoap-1.sym: Add in new PSK and PKI functions
...
coap_context_set_pki
coap_dtls_context_check_keys_enabled
coap_dtls_context_set_pki
coap_dtls_context_set_psk
coap_new_client_session_pki
2018-02-12 10:21:01 +00:00
Jon Shallow
740680c365
net.c: Add in PKI support
...
Update coap_context_set_psk() to return on failure. Add in call to
coap_dtls_context_set_psk() function
Add in new function coap_context_set_pki()
Update #includes for compilation
2018-02-12 10:19:56 +00:00
Jon Shallow
7ae49c3b41
coap_session.c: Support PSK new function and PKI
...
Update coap_new_client_session_psk() to clean up and return on error. Add in
call to coap_dtls_context_set_psk()
Add in new function coap_new_client_session_pki()
Additional check for a call of coap_new_client_session_*() in
coap_new_endpoint()
2018-02-12 10:15:22 +00:00
Jon Shallow
c4840b7ce1
coap_openssl.c: Fix coding error in coap_dtls_context_set_pki()
2018-02-12 10:14:01 +00:00
Jon Shallow
752da7179b
coap_openssl.c: Seperate out PSK specifics and add in PKI support
...
Remove PSK specifics from coap_dtls_new_context() and put into new
coap_dtls_context_set_psk().
Create a new coap_dtls_context_set_pki() for PKI.
Include checks that either of coap_dtls_context_set_psk() or
coap_dtls_context_set_pki() have been called before setting up a (D)TLS
session
Update #includes for compilation
2018-02-12 09:52:31 +00:00
Jon Shallow
aaa43301b7
coap_tinydtls.c: Add in PKI stub functions
...
Update #includes and add in stub functions
coap_dtls_context_set_pki
coap_dtls_context_set_psk
coap_dtls_context_check_keys_enabled
2018-02-12 09:50:32 +00:00
Jon Shallow
6d479ee6cb
coap_notls.c: Add in PKI stub functions
...
Update #includes and add in stub functions
coap_dtls_context_set_pki
coap_dtls_context_set_psk
coap_dtls_context_check_keys_enabled
2018-02-12 09:48:42 +00:00
Jon Shallow
3e4de1273d
coap_io.c: Update #include to allow compilation
...
Replace #include "coap_dtls.h" with #include "net.h"
2018-02-12 09:47:00 +00:00
Jon Shallow
0b88e51a88
net.h: Add in new function
...
New function coap_context_set_pki()
Update function coap_context_set_psk ()to return failure value
2018-02-11 20:04:04 +00:00
Jon Shallow
5b340adfb8
coap_dtls.h: Add support for setting up PKI
...
Define
coap_dtls_pki_t
coap_dtls_security_setup_t
Functions
coap_new_client_session_pki
coap_dtls_context_set_psk
coap_dtls_context_set_pki
coap_dtls_context_check_keys_enabled
2018-02-11 19:32:15 +00:00
Jon Shallow
47205bd56c
coap_openssl.c: Add in coap_get_tls_library_version() function
...
Add in coap_get_tls_library_version() for determining TLS build base + version
Do not allow a dynamic openssl library to be loaded and used at application
runtime that is less than OpenSSL version 1.1.0.
2018-02-10 19:39:27 +00:00
Jon Shallow
30794440af
coap_tinydtls.c: Add in coap_get_tls_library_version() function
...
Add in coap_get_tls_library_version() for determining TLS build base + version
2018-02-10 19:38:08 +00:00
Jon Shallow
7d14b745c9
coap_notls.c: Add in coap_get_tls_library_version() function
...
Add in coap_get_tls_library_version() for determining TLS build base + version
2018-02-10 19:35:28 +00:00
Jon Shallow
e1fa280d88
coap_dtls.h: Add in TLS library determination support
...
A new function coap_get_tls_library_version() that returns a pointer to a
coap_tls_version_t structure that contains both the TLS library type libcoap
was compiled against as well as the current TLS library version.
2018-02-10 18:34:42 +00:00
Olaf Bergmann
82c9ccc75b
build.sh: bugfix for tinydtls build
...
When TLS=tinydtls is set, configure must be called with --disable-shared.
Thanks to Michael Zimmer for pointing this out.
2018-01-18 15:30:26 +01:00
Olaf Bergmann
660c4168bc
coap_session.c: send COAP_DEFAULT_MTU in CSM
...
This change replaces the hard-coded 1152 bytes by the configurable
COAP_DEFAULT_MTU.
2017-12-22 14:31:56 +01:00
Olaf Bergmann
6607f942ed
updated symbol maps
2017-12-22 14:31:08 +01:00
Olaf Bergmann
8e011ec500
net.c: dynamically grow PDU size for TCP
...
This change was provided by Jean-Claude Michelou to fix issue #123 [1].
It dynamically grows a partial TCP PDU during read.
[1] https://github.com/obgm/libcoap/issues/123
2017-12-22 13:56:48 +01:00
Olaf Bergmann
d3b5535960
pdu.[hc]: Export coap_pdu_resize()
2017-12-22 13:55:37 +01:00
Olaf Bergmann
8ee4bb2586
pdu.c: fix len returned by coap_get_data() for empty payload
...
John Carter has provided this (slightly edited) patch to set len to 0
for PDUs that do not contain a payload. This makes this function more
robust for callers that do not care about the function result.
This change fixes issue 120 [1].
[1] https://github.com/obgm/libcoap/issues/120
2017-11-16 14:18:20 +01:00
Olaf Bergmann
0c837cdc77
pdu.h: increase Max-Message-Size by 256 B
...
To allow for 8 MiB payloads, the maximum message size value for
TCP has been increased by 256 B option space.
2017-11-11 10:06:16 +01:00
obgm
614b096319
Merge pull request #116 from spinetix/spx-leak
...
Fix memory leaks in sessions and openssl context.
2017-11-06 12:16:36 +01:00
jcmichelou
c93f535d4a
openssl, session: Fix memory leaks.
2017-11-04 23:38:02 +01:00
Olaf Bergmann
e5064a47e7
client.c: removed dead code in message_handler()
...
Coverity scan has detected dead code that has been removed in this
change. (CID 1382575)
2017-11-03 15:15:06 +01:00
Olaf Bergmann
9bf7032232
coap_session.c: additional NULL pointer check
...
Coverity scan CID 1458386 has detected a potential NULL pointer
being dereferenced in coap_session_free().
2017-11-03 15:05:48 +01:00
Olaf Bergmann
6fb2e671d1
async.c: added missing check for NULL in coap_free_async()
...
Coverity scan has detected a possible NULL pointer being dereferenced
before it is checked, see CID 1458391.
2017-11-03 14:55:33 +01:00
Olaf Bergmann
1f51ba7636
coap_openssl.c: removed dead code from coap_dgram_ctrl()
...
The dead code detected by Coverity scan in CID 1458395 has been
replaced with explicitly setting the return value to 1 (the default
that has previously been used).
2017-11-03 14:42:05 +01:00
Olaf Bergmann
a569e16584
coap_time.h: cast COAP_TICKS_PER_SECOND to coap_tick_t for type safety
...
CID 1458396 detected by Coverity scan points out that integer
arithmetics may lead to an overflow without the typecast to
coap_tick_t.
2017-11-03 14:29:49 +01:00
Olaf Bergmann
4b52182b8d
net.c: fix possible NULL pointer dereference
...
Fixes CID 1458397 detected by Coverity scan.
2017-11-03 14:22:32 +01:00
Olaf Bergmann
edca08249b
coap-server.c: fixed memory leak in get_context()
...
When getaddrinfo() failed, the context object was not released before
returning NULL. Coverity scan has detected this with CID 1458398.
2017-11-03 14:18:19 +01:00