Skip to content

Why need to limit the add length? #1996

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
edison-ai opened this issue Aug 30, 2018 · 4 comments
Closed

Why need to limit the add length? #1996

edison-ai opened this issue Aug 30, 2018 · 4 comments
Labels
bug component-crypto Crypto primitives and low-level interfaces

Comments

@edison-ai
Copy link

Description

  • Type: Question
  • Priority: Major

Question

In CCM, why need to limit the add length as below?
https://github.com/ARMmbed/mbedtls/blob/9ce5160feaf889d5e4c337458edc1068bb76920a/library/ccm.c#L165-L166

Is there any SPEC to limit it? Could we remove that?

Thanks,
Edison

@edison-ai
Copy link
Author

No needed. Thanks.

@RonEld
Copy link
Contributor

RonEld commented Nov 22, 2018

According to RFC 3610:

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.
If (2^16 - 2^8) <= l(a) < 2^32, then the length field is encoded as
six octets consisting of the octets 0xff, 0xfe, and four octets
encoding l(a) in most-significant-byte-first order.
If 2^32 <= l(a) < 2^64, then the length field is encoded as ten
octets consisting of the octets 0xff, 0xff, and eight octets encoding
l(a) in most-significant-byte-first order.

Mbed TLS has a limitation for the first case, but the tests should check this limitation only when MBEDTLS_CCM_ALT is not defined

@ciarmcom
Copy link

ARM Internal Ref: IOTSSL-2640

RonEld pushed a commit to RonEld/mbedtls that referenced this issue Nov 25, 2018
Since the AD too long is a limitation on Mbed TLS,
HW accelerators may support this. Run the test for AD too long,
only if `MBEDTLS_CCM_ALT` is not defined.
Addresses comment in Mbed-TLS#1996.
RonEld pushed a commit to RonEld/mbedtls that referenced this issue Dec 19, 2018
Since the AD too long is a limitation on Mbed TLS,
HW accelerators may support this. Run the test for AD too long,
only if `MBEDTLS_CCM_ALT` is not defined.
Addresses comment in Mbed-TLS#1996.
@simonbutcher
Copy link
Contributor

PR #2228 has been merged. This issue can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug component-crypto Crypto primitives and low-level interfaces
Projects
None yet
Development

No branches or pull requests

4 participants