1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
Commit Graph

15 Commits

Author SHA1 Message Date
Gaëtan Harter
c87fe94ec1
crypto/modes/ccm: update api to const input buffers
Input buffers are not modified, so can be declared const arguments.
2018-11-19 16:44:04 +01:00
Gaëtan Harter
9e6782afb4
crypto/modes/ccm: update internal functions to const input buffers
Input buffers are not modified, so can be declared const arguments.
This will allow using `const` inputs for `modes/ccm`.

Also say `iv` const even if not required for the api update, just because it is
the case.
2018-11-19 16:44:09 +01:00
Gaëtan Harter
9427371849
crypto/modes/ctr: update api to const input buffers
Input buffers are not modified, so can be declared const arguments.
This will allow using `const` inputs for `modes/ccm`.
2018-11-19 16:44:04 +01:00
Wentao Shang
3fd8276c37
crypto/ccm: fix auth_data_len upperbound value
RFC3610 states that len_encoding is only valid for "0x0001 ... 0xFEFF"

   If 0 < l(a) < (2^16 - 2^8), then the length field is encoded as two
   octets which contain the value l(a) in most-significant-byte first
   order.
2018-11-12 16:38:45 +01:00
Gaëtan Harter
f0e785a430
crypto/ccm: check ccm_compute_adata_mac return value
Return value was ignored but function could fail
2018-11-12 16:37:00 +01:00
7d013eb2b6 sys: fix doxygen grouping 2018-06-11 19:12:02 +02:00
Gaëtan Harter
fa33eacd1f
crypto/ccm: fix _fits_in_nbytes function
Function is broken with num_bytes >= 4.

Could happen when storing input_len with len_encoding >= 4.
It can take values from 2 to 8, so make it work for cases it would overflow.
2018-05-07 15:08:00 +02:00
Gaëtan Harter
ee311a331b
crypto/ccm: refactor input_len check in a function
Refactorg checking that length can be stored in a number of bytes to a
subfunction.
2018-05-07 15:08:00 +02:00
Wentao Shang
89023b3499
crypto/ccm: fix input_len check
Maximum input_len depends only on length_encoding and not auth_data_len.
The current length_max value was also wrong.

RFC3610 page 2

   3. The message m, consisting of a string of l(m) octets where 0 <=
      l(m) < 2^(8L).  The length restriction ensures that l(m) can be
      encoded in a field of L octets.
2018-05-07 15:08:00 +02:00
Vincent Dupont
4f6fadbdc7 crypto/cbc: constify input buffers 2017-06-27 18:58:33 +02:00
Martine Lenders
62ca7f9242 crypto: fix cppcheck warnings 2017-04-14 14:36:14 +02:00
Oleg Hahm
b428979a1d debug: add missing line breaks 2016-09-27 23:38:41 +02:00
9082273746 core: header cleanup 2016-02-28 22:46:28 +01:00
René Kijewski
d2afdf5079 crypto: memcpy() in overlapping data in ccm
`memcpy()` must not be used if the input and output ranges overlap,
because it is undefined if the data if copied from front to the end or
vice versa.

Found via valgrind.
2015-09-22 11:01:56 +02:00
Nico von Geyso
4a4235c622 Unified Cipher API and Block cipher operation modes 2015-07-22 19:18:34 +02:00