Skip to content
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

hmac_drbg_free() called too often and too early inside benchmark.c #1095

Closed
TrinityTonic opened this issue Sep 18, 2017 · 3 comments
Closed
Labels

Comments

@TrinityTonic
Copy link

TrinityTonic commented Sep 18, 2017

Description

  • Type: Bug
  • Priority: Minor

There's a bug in the mbedTLS benchmark program. When HMAC_DRBG_C is tested, two configurations, namely with SHA1 and with SHA256 are tested. However for both configurations mbedtls_hmac_drbg_free() is called, which means that the context is freed too early although it is being used later. mbedtls_hmac_drbg_free() should only be called at the end of the
#if defined(MBEDTLS_HMAC_DRBG_C) - code.


Bug

mbed TLS build:
Version: 2.6.0

@RonEld
Copy link
Contributor

RonEld commented Sep 19, 2017

Hi @TrinityTonic Thank you for reporting this
Although I agree that this is confusing that mbedtls_hmac_drbg_free() is called after every operation, it is not a major bug, as the mbedtls_hmac_drbg_free() only clears the context from its internal data.
I agree it might cause a problem when MBEDTLS_THREADING_C is defined, or when there will be an alternative implementation support for HMAC DRBG in the future.

@RonEld RonEld added the bug label Sep 19, 2017
@TrinityTonic
Copy link
Author

@RonEld Yea, I was noticing the problem with MBEDTLS_THREADING_C as my (alternative) Mutex is freed when hmac_drbg_free() is called and later on the the code tried to lock the mutex it had freed before.

@ciarmcom
Copy link

ARM Internal Ref: IOTSSL-1761

RonEld pushed a commit to RonEld/mbedtls that referenced this issue Jun 20, 2018
Remove redunadnat calls to `hmac_drbg_free()` between seeding operations,
which make the mutex invalid. Fixes Mbed-TLS#1095
RonEld pushed a commit to RonEld/mbedtls that referenced this issue Jul 5, 2018
Remove redunadnat calls to `hmac_drbg_free()` between seeding operations,
which make the mutex invalid. Fixes Mbed-TLS#1095
RonEld pushed a commit to RonEld/mbedtls that referenced this issue Jul 30, 2018
Remove redunadnat calls to `hmac_drbg_free()` between seeding operations,
which make the mutex invalid. Fixes Mbed-TLS#1095
RonEld pushed a commit to RonEld/mbedtls that referenced this issue Jul 30, 2018
Remove redunadnat calls to `hmac_drbg_free()` between seeding operations,
which make the mutex invalid. Fixes Mbed-TLS#1095
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants