Commit Graph
2735 Commits
Author SHA1 Message Date
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 1615d4e3b7 net.c: Include ping request / pong response handler support
If the application needs to see CoAP ping requests or CoAP TCP pong responses
then this update provides calling the configured handlers at the appropriate
points.
2018-02-10 20:57:27 +00:00
Jon Shallow fbe814d905 net.h: Add function definitions for ping and TCP pong handlers
If the application needs to see CoAP ping requests or CoAP TCP pong responses
then there needs to be a handler that can be set up that is called
appropriately.
2018-02-10 20:54:17 +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
Jon Shallow 50b97074e8 coap_openssl.c: client assert error if DTLS error closed socket
For a client, if a DTLS session is closed with ICMP unavailable packet, when
the TLS session is closed in the application with SSL_shutdown(), the OpenSSL
underlying library triggers a BIO_write() which calls coap_dgram_write() which
then 'assert's in coap_session_send().
(sock->flags == COAP_SOCKET_EMPTY && session->endpoint == NULL).

Fix is not to call coap_session_send() from coap_dgram_write() if socket is
closed and this is not an endpoint (not a server).
2018-02-10 03:36:43 +06: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
Olaf Bergmann 29692faa86 coap-server.c: fix use after free in check_async()
As coap_send() automatically releases the specified pdu, it must
not be accessed after coap_send() has returned.

This change fixes CID 1458399 reported by Coverity scan.
2017-11-03 14:12:22 +01:00
Olaf Bergmann 67a9210dbd net.c: fixed memory leak in coap_send()
coap_send() always takes the ownership of the pdu that is passed
as argument to send, i.e., the memory will be released automatically
when the pdu is not needed anymore.
2017-11-03 14:07:16 +01:00
Olaf Bergmann 027d9601eb net.c: always initialize bytes_read
In CID 1459612, Coverity scan has complained about uninitialized use
of the variable bytes_read. Although this is a false positive here,
it seems to be more safe to always initialize bytes_read.
2017-11-03 13:54:07 +01:00
Olaf Bergmann 313a655a9a pdu.c: fix explicit NULL pointer dereference
Fixes CID 1459615 found by Coverity scan.
2017-11-03 13:37:56 +01:00
Olaf Bergmann 5cc5273867 Doxyfile.in: decrease verbosity of doxygen output
To avoid cluttering the build output with lots of doxygen messages
the QUIET parameter now has been set to YES.
2017-11-03 13:36:24 +01:00
Olaf Bergmann 6a3abd257e coap_session.c: fixed default port selection for client TCP session
In coap_session_create_client(), the default port for TCP did not
correctly distinguish between TCP and TLS as pointed out in [1] by
Joan Shallow. This change applies the suggested fix.

[1] https://sourceforge.net/p/libcoap/mailman/message/36092184/
2017-11-03 10:41:05 +01:00
obgm a5dd017ec1 Merge pull request #114 from spinetix/spx-observe
Fix issues #90, #91 and #92
2017-10-30 09:31:18 +01:00
jcmichelou 3f77c117ea resource: Fix issues #90, #91 and #92
The value of the observe option is kept for each resource rather than being global to the context.
The value of the observe option must wrap to be stay below 2^24.
The value of the observe option must be different from the initial value when a notification is sent.
2017-10-25 20:22:01 +02:00
obgm 3630436499 Merge pull request #113 from spinetix/tcp-tls
Add support for TCP and TLS transports
2017-10-24 09:47:52 +02:00
jcmichelou e125888ded openssl: Handshake can also complete in SSL_accept and SSL_connect. 2017-10-21 19:16:23 +02:00
jcmichelou 1c4d6913af net.c, symbols: fix gcc warning and regenerate symbol files 2017-10-21 18:26:40 +02:00
jcmichelou 3340f10541 net.c: Correct payload size for wellknown response. 2017-10-21 17:35:43 +02:00
jcmichelou 68a9ea045d pdu: Use defines for TCP variable header message size constants. 2017-10-21 17:24:56 +02:00
jcmichelou d89c99f5f8 uri: Add coap+tcp:// and coaps+tcp:// schemes. 2017-10-21 16:52:02 +02:00
jcmichelou 8923d4de50 openssl: TLS session can be connected both on read and write. 2017-10-21 16:34:18 +02:00
jcmichelou 75d89ab295 openssl, io: Fix linux compatibility 2017-10-21 16:11:16 +02:00
jcmichelou e901714c74 net.c: Call nack handler for all transports. 2017-10-21 16:11:16 +02:00
jcmichelou fa52273f59 coap_session.c: Remove observers and delete TLS object on disconnect. 2017-10-21 16:11:15 +02:00
jcmichelou cd804ba3bf client.c: Make observation timeout work with TCP. 2017-10-21 16:11:15 +02:00
jcmichelou e713e77f54 notls, tinydtls: Add stubs for unused TLS functions. 2017-10-21 16:11:15 +02:00
jcmichelou 854cc3147f openssl, session: Add TLS encryption. 2017-10-21 16:11:14 +02:00
jcmichelou 9bb8396b23 coap_session, net.c: Add debug messages on TCP RX/TX. 2017-10-21 16:11:14 +02:00