Gilles Peskine
b168c0d2e6
More robust code to set the IV
...
Check that the source address and the frame counter have the expected
length. Otherwise, if the test data was invalid, the test code could
build nonsensical inputs, potentially overflowing the iv buffer.
The primary benefit of this change is that it also silences a warning
from compiling with `gcc-10 -O3` (observed with GCC 10.2.0 on
Linux/amd64). GCC unrolled the loops and complained about a buffer
overflow with warnings like:
```
suites/test_suite_ccm.function: In function 'test_mbedtls_ccm_star_auth_decrypt':
suites/test_suite_ccm.function:271:15: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
271 | iv[i] = source_address->x[i];
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~
suites/test_suite_ccm.function:254:19: note: at offset [13, 14] to object 'iv' with size 13 declared here
254 | unsigned char iv[13];
```
Just using memcpy instead of loops bypasses this warnings. The added
checks are a bonus.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-02-09 12:00:13 +01:00
..
2021-01-20 15:56:42 +00:00
2021-02-03 12:07:01 +00:00
2021-01-20 15:56:42 +00:00
2021-02-03 12:07:01 +00:00
2019-08-15 15:44:50 +01:00
2019-08-15 15:44:50 +01:00
2019-08-15 15:44:50 +01:00
2020-07-02 09:39:30 +02:00
2019-08-15 15:44:50 +01:00
2019-08-15 15:44:50 +01:00
2019-08-15 15:44:50 +01:00
2019-08-15 15:44:50 +01:00
2020-07-01 17:10:15 +02:00
2019-09-20 15:58:27 +02:00
2020-07-30 14:18:02 +02:00
2020-02-05 15:40:22 +00:00
2021-02-03 12:07:01 +00:00
2019-10-31 19:17:36 +02:00
2021-01-20 15:56:42 +00:00
2019-08-15 15:44:50 +01:00
2020-06-12 14:33:08 +02:00
2019-09-20 15:59:31 +02:00
2020-07-01 17:10:15 +02:00
2019-09-20 15:59:31 +02:00
2020-07-01 17:10:15 +02:00
2020-10-21 22:31:48 +02:00
2021-02-09 12:00:13 +01:00
2019-08-15 15:44:50 +01:00
2020-07-30 14:18:02 +02:00
2019-08-15 15:44:50 +01:00
2020-06-26 10:45:16 +02:00
2020-03-24 13:18:58 -04:00
2019-09-20 15:59:31 +02:00
2019-07-29 17:46:29 +02:00
2019-09-20 15:59:31 +02:00
2020-03-24 13:18:58 -04:00
2019-08-15 15:44:50 +01:00
2019-08-15 15:44:50 +01:00
2019-08-15 15:44:50 +01:00
2019-09-20 15:59:31 +02:00
2021-01-06 18:21:18 +01:00
2020-06-26 22:40:58 +02:00
2019-08-15 15:44:50 +01:00
2019-09-20 16:01:59 +02:00
2019-09-20 15:59:31 +02:00
2019-08-15 15:44:50 +01:00
2019-08-15 15:44:50 +01:00
2019-08-15 15:44:50 +01:00
2019-11-21 13:49:20 +01:00
2020-11-25 14:25:56 -08:00
2020-03-19 14:17:54 +01:00
2020-03-19 14:17:54 +01:00
2019-08-15 15:44:50 +01:00
2020-07-01 17:10:15 +02:00
2020-12-02 15:25:27 +00:00
2020-12-02 15:25:27 +00:00
2019-08-15 15:44:50 +01:00
2020-06-26 10:45:16 +02:00
2020-01-06 11:40:23 +01:00
2020-06-26 10:45:16 +02:00
2019-08-15 15:44:50 +01:00
2020-06-12 14:33:08 +02:00
2020-07-13 11:48:21 +02:00
2020-07-13 11:48:21 +02:00
2019-10-08 15:01:34 +02:00
2020-04-14 21:32:53 +02:00
2015-04-08 13:25:31 +02:00
2018-08-06 11:40:57 +01:00
2019-09-20 15:59:31 +02:00
2019-09-20 15:59:31 +02:00
2019-09-20 15:59:31 +02:00
2019-09-20 15:59:31 +02:00
2019-09-20 15:59:31 +02:00
2019-09-20 15:59:31 +02:00
2019-08-15 15:44:50 +01:00
2020-07-01 17:10:15 +02:00
2019-08-15 15:44:50 +01:00
2019-08-15 15:44:50 +01:00
2020-07-30 14:18:02 +02:00
2020-11-25 14:25:56 -08:00
2020-01-06 11:40:23 +01:00
2020-01-06 11:40:23 +01:00
2020-01-06 11:40:23 +01:00
2020-01-06 11:40:23 +01:00
2020-01-06 11:40:23 +01:00
2020-07-01 17:10:15 +02:00
2019-08-15 15:44:50 +01:00
2020-07-01 17:10:15 +02:00
2019-10-31 15:07:35 +01:00
2019-10-31 15:07:45 +01:00
2021-02-01 17:28:03 +01:00
2020-12-08 20:59:45 +00:00
2019-09-20 15:59:31 +02:00
2020-06-26 10:45:16 +02:00
2019-08-15 15:44:50 +01:00
2019-08-15 15:44:50 +01:00
2019-08-15 15:44:50 +01:00
2019-08-15 15:44:50 +01:00
2020-07-02 16:59:30 +01:00
2021-01-06 18:21:18 +01:00
2019-08-15 15:44:50 +01:00
2020-07-01 17:10:15 +02:00
2019-09-20 15:58:54 +02:00
2020-07-01 17:10:15 +02:00
2020-01-06 11:40:23 +01:00
2020-06-12 14:33:08 +02:00
2020-02-18 10:31:29 +01:00
2020-02-18 10:18:43 +01:00
2019-11-05 15:32:53 +01:00
2020-12-07 17:29:42 +00:00
2019-08-15 15:44:50 +01:00
2020-07-30 14:18:02 +02:00
2021-02-02 11:29:08 +01:00
2021-01-29 09:31:59 +01:00
2021-02-01 13:21:40 +01:00
2021-01-06 20:16:26 +01:00
2021-02-01 13:21:40 +01:00
2021-01-06 18:21:18 +01:00
2019-10-23 19:47:05 +02:00
2021-01-06 18:21:18 +01:00
2021-02-01 13:21:40 +01:00
2021-01-21 13:17:25 +01:00
2021-02-03 20:54:46 +01:00
2021-01-06 18:21:18 +01:00
2020-05-11 11:15:26 +02:00
2021-01-06 18:21:18 +01:00
2020-11-10 18:19:59 +01:00
2021-02-03 19:01:54 +01:00
2021-02-01 13:21:40 +01:00
2021-02-02 11:49:08 +01:00
2021-02-03 15:21:04 +01:00
2021-02-03 19:01:54 +01:00
2020-11-26 15:54:35 +01:00
2020-11-26 15:54:35 +01:00
2020-01-07 10:24:17 +01:00
2020-07-01 17:10:15 +02:00
2020-01-06 11:40:23 +01:00
2020-07-01 17:10:15 +02:00
2020-09-09 13:52:40 +01:00
2021-01-20 15:56:42 +00:00
2019-08-15 15:44:50 +01:00
2019-08-15 15:44:50 +01:00
2020-12-09 15:05:22 +00:00
2020-04-22 16:01:48 +02:00
2020-12-03 12:19:39 +01:00
2020-07-01 17:10:15 +02:00
2020-09-21 18:25:35 -07:00
2021-01-17 18:06:18 +00:00
2019-08-15 15:44:50 +01:00
2020-07-01 17:10:15 +02:00