Commit graph

42559 commits

Author SHA1 Message Date
Daniel Leung
a4212108f7 serial: remove unused CONFIG_EXTRA_SERIAL_PORT
Change-Id: Ibb8ffcd377d9b7c34370c522fb06ce797f4feaed
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:25 -05:00
Daniel Leung
1ad2a56ee3 serial: rework functions to use struct device...
... instead of an array index to a global array. This is
an intermediate step to make the drivers conform to
the new driver model.

This only changes from using a direct array index to using
device structs. The UARTs are still staticlly defined.
Later patches will make the drivers utilize the driver
initialization procedure specified by the driver model.

Change-Id: I18041bbb4b0efdf8ae87088fd000b391d0827e9b
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:25 -05:00
Benjamin Walsh
179f805322 doc: correct 'interrupts' section of fsl_frdm_k64f
Change-Id: I0c0aad54c3e9a386428443b1cbf2c7c447576743
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:15:25 -05:00
Benjamin Walsh
d3084b41e6 test_task: improve task_sleep test reliability on QEMU
The test was doing some weird dance for computing the time the main task
had slept, context switching between the main task and a helper task.
The tick timestamp that marks the start of the sleep duration, which
should be taken before the main task goes to sleep actually was taken
after it went to sleep, by the helper task. This lead to weird results
sometimes on QEMU, where the main task would report that it had slept
for less time than requested.

Now instead, the main task takes its own tick timestamps, just before it
goes to sleep and right when it awakens.

The helper task takes a timestamp as well, to verify that it did do busy
work while the main task was sleeping. However, some error is allowed
there to compensate for some QEMU weirdness.

Change-Id: I4b642b49de8346be404000698eaa4ded070d4097
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:15:25 -05:00
Benjamin Walsh
7710d0e083 ffs: change find_[lsb|msb]_set parameter type to uint32_t
Highlight the fact that find_[lsb|msb]_set operate on a 32-bit word.

Change-Id: I24cee7709ea6497508dbc7f96a7b4d74fa4bc257
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:15:25 -05:00
Benjamin Walsh
1bab46dca1 ffs: rename find_[first|last]_set to find_[lsb|msb]_set
The new names reflect better what the functions do: they find the first
bit set starting from the least or most significant bit, i.e. they find
the least or most significant bit set, in a 32-bit word.

Change-Id: I6f0ee4b543f6f37c2f08f7067e14e039c92a6f6a
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:15:25 -05:00
Benjamin Walsh
910970ed0f ffs: remove non-inline find_[first|last]_set()
The inline versions are renamed to remove the _inline suffix, and the
non-inline versions are removed from the code base.

Change-Id: Iee2e6adcfb5da1fe0a978a05aa854e10ae82a8b8
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:15:25 -05:00
Benjamin Walsh
c4ad73d3b6 ffs: do not use _inline versions of find_[first|last]_set
Standardize on using the find_[first|last]_set (non-inline) symbols
everywhere.

The non-inline versions provide absolutely no benefits, so they will be
removed in a subsequent commit, and the inline versions will have their
_inline suffix removed.

Change-Id: I5b3dee33ffe3878a05e1bb3c6400a8d8c1640ad4
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:15:25 -05:00
Andrew Boie
b9a6f3b9d1 testcases: use SOURCE_DIR instead of relative #include
The build system is actually using the output directory
as the working dir for the Make session, using a symlink
to the source directory. Relative paths don't work correctly,
it only works now due to other issues in the build system
where absolute paths are being used instead for app source
files (causing other problems).

Change-Id: I2bcd82314692902f12da51c96fe912efb68bdc5e
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:15:25 -05:00
Andrew Boie
7f85fb1a10 HACK: include fifo_timeout.c a different way
Instead of using a relative path in an #include, use a real -I path
in CFLAGS. This is still a hack, what we really need is support in
the build system for generating static libraries.

Change-Id: I7bc9aba3bcb7ec65f6a6119c3b2c6efc1de67e58
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:15:24 -05:00
Andrew Boie
bbd670c9fc sanitycheck: add -z option for 'truesize' functionality
The sizing code was merged with the sanitycheck script. A new
-z option has been added to simply measure and report sizes
to stdout instead of running any tests.

Change-Id: I1450e3b08e3bd0030d2df00190da884621962d01
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:15:24 -05:00
Andrew Boie
ea7928f642 sanitycheck: add --all-deltas option
This shows all changes in size, good or bad. Useful for testing
size optimizations.

Change-Id: I47124b64f7d751120af666a4b7c7efd4bbed4ac8
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:15:24 -05:00
Andrei Emeltchenko
0c6b6902fe Bluetooth: Refactor signed write command
Include all headers to signature verification process.

Change-Id: I14e152e8529bca380faeb8e9a1be00e4e8d84f9a
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:15:24 -05:00
Andrei Emeltchenko
355ff64175 Bluetooth: Add debug statement
Change-Id: I8308c31dc0916b8f2e7858f48e7fd2346164f333
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:15:24 -05:00
Andrei Emeltchenko
8e48fa3fa4 Bluetooth: Verify Signed Write GATT command
Verify that message is signed correctly using early distributed CSRK
key.

Change-Id: I30b24e90f3503907449c310dd4f59f32e6acca6f
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:15:24 -05:00
Andrei Emeltchenko
30c28925fa Bluetooth: Add new attribute with signed write permission
Change-Id: I731b4d3f3a31cff9c4be89dd1f911f4365b5e783
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:15:24 -05:00
Andrei Emeltchenko
2ccf1f11c0 Bluetooth: Add GATT Signed Write to shell
Bluetooth shell now supports Signed Write if CSRK key is present.

Change-Id: I035a0d314da4997105c64da58cf85bd95fdbaa5b
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:15:24 -05:00
Andrei Emeltchenko
f9cd4105da Bluetooth: Add GATT Signed Write command
Add support for signed write with sign parameter for write without
response.

Change-Id: I79008532d88b10d34db1f68898ad4258dd3e761b
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:15:24 -05:00
Andrei Emeltchenko
2de40248ff Bluetooth: Print sign count in correct byte order
cnt is in le byte order so print keys->remote_csrk.cnt instead.

Change-Id: I2c2970f0bdf91960d978fea248bc0dbc23fdfd53
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:15:24 -05:00
Andrei Emeltchenko
15bad51bfb Bluetooth: Increment sign count after signing
Change-Id: I09b21e68f716a7f0952b81b8bd217503d4e5b7e5
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:15:24 -05:00
Andrei Emeltchenko
5c8fda8e67 Bluetooth: Add data signing function
bt_smp_sign_packet() signs data packet adding signature and count at
the end of data.

Change-Id: I6cca931cf33d74a765f4b4aa126aae10bee7ef4c
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:15:24 -05:00
Jukka Rissanen
6fa1c89b38 net: tinydtls: Include file was missing
The tinydtls.h include file was missing from earlier tinydtls
commits.

Change-Id: I8b8398313c7f598daf81f4fb8c07fd138e22e22d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:24 -05:00
Szymon Janc
947f7100c5 Bluetooth: Validate callbacks in bt_auth_cb_register
This adds validation for passed callbacks. Previously registered
callbacks need to be explicitly unregistered by passing NULL.
It is no longer possible to implicitly overwrite callback
structure.

Input Output Capabilities generation is factored out to separate
function. This is in preparation for adding more callbacks.

Change-Id: Ie809ea2daa80f9c54585efb459b49af1107007d3
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:15:24 -05:00
Arkadiusz Lichwa
530d2f9175 Bluetooth: Enable LE Remote Features event handler
Adds LE Exchange Remote Features HCI event handler.

Change-Id: I5ab9fb3e5284222269c95961054a176dd3067018
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:15:24 -05:00
Szymon Janc
669454f1e1 Bluetooth: Allow to enable authentication in btshell application
This allows to register pairing callbacks that will display passkey
in case of authenticated pairing.

Change-Id: I18422193785fdcd8a2e567adeb65199bfadcdd1f
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:15:24 -05:00
Szymon Janc
8423871b90 Bluetooth: Add initial support for authenticated pairing
This allows to register agent with display capability resulting
in DisplayOnly InputOuput Capability being used.

Change-Id: I98931af35c51a71882b60303c0f5d4da19eefbc4
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:15:24 -05:00
Szymon Janc
9de0ef392f Bluetooth: Add connection security level tracking
Change-Id: Ib2a84f964e5b189969127774ae982539ba38ad87
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:15:24 -05:00
Szymon Janc
faec70c367 Bluetooth: Move security levels to conn.h
For now this is used only in conn.h. Allows to reduce includes
dependencies.

Change-Id: I60dbe588e711fa0332049cbea43ffb6838a58823
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:15:24 -05:00
Jukka Rissanen
29faed4aa8 net: apps: Add dtls-server test application
The DTLS server is running in Zephyr and is listening on port 4242
and when it receives DTLS UDP packet, it will reverse the data and
send it back to the caller.

Use the dtls-client application running in host to connect to
the dtls-server.

Change-Id: I3306cb242498019ffc9e0519b06061c36db96f78
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:24 -05:00
Jukka Rissanen
89570caab9 net: tools: Add dtls-client test application
This dtls-client app is run in the host side. It will
connect to Zephyr via UART using SLIP. The app will
send data to server using the established DTLS connection.
The dtls-server will echo the data back and dtls-client
will verify that it got back same bytes that it sent
to server.

Change-Id: Ia18d75e887b38e08bc06b660c60dac4043f7d605
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:24 -05:00
Jukka Rissanen
a6c6245d87 net: Do not check the net_buf validity in rx fiber
This will print incorrect warning if we have tinyDTLS
server functionality in use.

Change-Id: I21689b69190621329ee7ae2c7ebe6577937c561a
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:24 -05:00
Jukka Rissanen
249a6d6b18 net: Add minor comment when micro or nano kernel is used
Change-Id: Ie226648f9ac45f326f788cfc5837e1ee602c6eae
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:24 -05:00
Jukka Rissanen
abd124c4dc net: Return NULL if we cannot receive a network packet.
This is not a likely scenario but make sure that we
return NULL if there are problems when user is trying
to receive network packets.

Change-Id: I637306d127d20a95c4a2f420b9a3061b707311c2
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:24 -05:00
Jukka Rissanen
1c26158c81 net: Additional check making sure IP stack is not corrupted
Print error if IP stack is corrupted, best option would
be to reboot the device.

Change-Id: Ie92782de2fe0f323c9461fa21e90e545ccd23449
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:24 -05:00
Jukka Rissanen
0768ed81c6 net: Use the net_buf_datalen() to initialize uIP pointers
Use the data length in net_buf as a master value when
replying the data.

Change-Id: I2184890b0ed8d26b700ee75b9e4b6d5a466e649c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:24 -05:00
Jukka Rissanen
9c1a76351a net: contiki: Define network buffer size using default in uipopt.h
Make sure that the default link MTU for IPv6 networks
is used (1280 bytes). If this is left out the default would
be 128 bytes. This setting is only needed because the values
are used in tinyDTLS project.

Change-Id: I6873b8383be6355d616910aa58a03317e92dc8f8
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:24 -05:00
Jukka Rissanen
664df6db68 net: tinydtls: Allow bigger IPv6 packet to be sent
Use net_buf when sending data in order to allow bigger
messages to be sent. Earlier the max. msg length was
200 bytes, now it is 1280 bytes.

Change-Id: Id5550de45b61c6fa6410258776cd8240efb1570e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:24 -05:00
Jukka Rissanen
fd6cca42a3 net: contiki: Use appdata pointer in udp callback
Using appdata pointer is more logical here. There was no
error in earlier code either.

Change-Id: Ic1557f01b2b016484d75fdff00f3fc02c9debac5
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:24 -05:00
Jukka Rissanen
766eed3461 net: Document udp connection retrieval function as it is needed
Documenting the function that returns the used UDP connection
pointer. This function is needed for example in tinyDTLS
server implementation.

Change-Id: I08aae798dab0749912694d6338de91dcbd13df84
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:24 -05:00
Jukka Rissanen
0378a84fef net: Add macros to return IP and UDP info from net_buf
Add NET_BUF_IP() and NET_BUF_UDP() macros that return
correct struct containing either IP or UDP data.

Change-Id: I43b828ef78c1f13ccee41e6a60daa36145a35eba
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:23 -05:00
Jukka Rissanen
b41ec6590c net: contiki: Set the DTLS session IP address and port correctly
Instead of having IP address and UDP port as separate fields
in session struct, place them inside an address struct.
This way the session size field will have a proper size
and we can use the dtls_session_init() function when initializing
the session.

Change-Id: I0560750bdd7189e24bf720a3bad240df2a3fc7fe
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:23 -05:00
Jukka Rissanen
f6ef316c5b net: contiki: Process context was using wrong variable
The PROCESS_CONTEXT_END() macro used wrong variable. This is
only cosmetic as the variable is not used in macro but for
consistency use the proper variable name.

Change-Id: Ia9537f4c78e6573b955fd91482e033d96cdaf66b
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:23 -05:00
Jukka Rissanen
3257916346 net: contiki: Set the clock ticks according to system config
Use sys_clock_ticks_per_sec that is defined from Kconfig,
to set the Contiki clock.

Change-Id: I1d0198fb39e83a59258b7c067107c25b63db50ed
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:23 -05:00
Jukka Rissanen
a895e38ad2 net: Add tinyDTLS support activation
User is able to enable tinyDTLS support via Makefile.

Change-Id: I383bf69756fe3540b63bcd5793e2a1a31231d6b1
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:23 -05:00
Jukka Rissanen
0d33901b1a net: tinydtls: The library compiles correctly
No functionality testing done yet.

Change-Id: Iab98ec4c6ba14187a70ef5bd4f9b1e8ab7baa640
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:23 -05:00
Jukka Rissanen
76a42daaa9 net: tinydtls: Initial commit
This is originally from git@github.com:YanziNetworks/tinyDTLS.git
commit d7ca5120e7e853f76e9743db2a0236a26ba71363

Change-Id: I6e6c2da76e11b473ead1b0ddac929f8bd670d7e3
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:15:23 -05:00
Andrei Emeltchenko
b029073dee Bluetooth: Add signature verification function
bt_smp_sign_verify() checks signature if csrk is present.

Change-Id: I90be8be769539860a245b141bf27549a3506a111
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:15:23 -05:00
Andrei Emeltchenko
c0824c73fa Bluetooth: Add data signing API and test
Sign data using AES-CMAC algorithm and add test to self-tests executed
at init.

Change-Id: If01ec38a9897f74c26d1ba5c32304114d208549a
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:15:23 -05:00
Andrei Emeltchenko
8f2a5e6b56 Bluetooth: Make self-test option relevant to SMP debug
Make menuconfig screen more logical placing self-tests option inside
Bluetooth block. Currently self-tests looks not belonging to
Bluetooth.

Change-Id: I1ad2826b1dd09fb7c9b67aace1ad5f280543104d
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:15:23 -05:00
Andrei Emeltchenko
1fbaf56bc2 Bluetooth: Increase stack size to default value
Make stack size the same size as in hello app. Current stack cannot
handle correctly security tests.

Change-Id: I5946c6bbcbc5079cefefddbb229b3205364b24d0
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:15:23 -05:00