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

Memory leak if ecdsa_sign/ecdsa_verify fail with an error #19

Closed
DualTachyon opened this issue Jun 2, 2013 · 4 comments
Closed

Memory leak if ecdsa_sign/ecdsa_verify fail with an error #19

DualTachyon opened this issue Jun 2, 2013 · 4 comments
Labels

Comments

@DualTachyon
Copy link

The sign&verify functions will not free up some mpi's if they fail.
I used the alpha 1.3.1 that was released a couple of months ago.

@pjbakker
Copy link
Contributor

pjbakker commented Jun 3, 2013

We will check this out and fix accordingly. Thanks for noticing.

@pjbakker
Copy link
Contributor

Can you elaborate? All MPIs initialized in the sign and verify functions are cleared as well.

Are you referring to the MPIs in the group? You should free the group yourself outside of the sign and verify functions.

@DualTachyon
Copy link
Author

For example, ecdsa_verify declares (from https://github.com/polarssl/polarssl/blob/polarssl-1.3/library/ecdsa.c)

Line 118: mpi e, s_inv, u1, u2;
Line 119: ecp_point R, P;

These variables are freed at line 171,172 in the success case, but not if R is zero @ line 161 or if the signature fails @ line 167.

@pjbakker
Copy link
Contributor

Correct.. Fixed in cca998a

hanno-becker pushed a commit to hanno-becker/mbedtls that referenced this issue Jan 25, 2019
hanno-becker pushed a commit to hanno-becker/mbedtls that referenced this issue Jan 25, 2019
…_allocate_key

Don't require a type and size when creating a key slot
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

2 participants