Skip to content

libckteec: add and use {ADD|SUB|MUL}_OVERFLOW() macros#421

Open
etienne-lms wants to merge 2 commits into
OP-TEE:masterfrom
etienne-lms:libckteec-overflow
Open

libckteec: add and use {ADD|SUB|MUL}_OVERFLOW() macros#421
etienne-lms wants to merge 2 commits into
OP-TEE:masterfrom
etienne-lms:libckteec-overflow

Conversation

@etienne-lms

Copy link
Copy Markdown
Contributor

Add ADD_OVERFLOW(), SUB_OVERFLOW() and MUL_OVERFLOW() helper macros dumped from optee_os util.h [1] and compiler.h [2] and use them to guard against index/buffer overflows.

[1] https://github.com/OP-TEE/optee_os/blob/4.10.0/lib/libutils/ext/include/util.h
[2] https://github.com/OP-TEE/optee_os/blob/4.10.0/lib/libutils/ext/include/compiler.h

Add ADD_OVERFLOW(), SUB_OVERFLOW() and MUL_OVERFLOW() helper macros
dumped from optee_os util.h [1] and compiler.h [3] where released under
the same BSD-2-Clause license terms used in libckteec implementation.

Link: https://github.com/OP-TEE/optee_os/blob/4.10.0/lib/libutils/ext/include/util.h [1]
Link: https://github.com/OP-TEE/optee_os/blob/4.10.0/lib/libutils/ext/include/compiler.h [2]
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Guard against overflow in buffer size before they are allocated.
Guard against overflow in when serializing data send to the TA.
Use *_OVERFLOW() macros where applicable instead of less intuitive
implementation.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant