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

gen_key example Segmentation fault when called without arguments #8809

Closed
PiotrBzdrega opened this issue Feb 11, 2024 · 0 comments
Closed

gen_key example Segmentation fault when called without arguments #8809

PiotrBzdrega opened this issue Feb 11, 2024 · 0 comments

Comments

@PiotrBzdrega
Copy link
Contributor

Summary

A problem occurs when entropy is going to be free, but the memory was not allocated beforehand.

mbedtls_entropy_free(&entropy);

below expression can be called before recognition of number of arguments to fix it.

mbedtls_entropy_init(&entropy);

System information

Mbed TLS version (number or commit id): development commit: c3d17cd
Operating system and version: Windows10 22H2 (Build 19045.3930) & Ubuntu 22.04.3 LTS

Steps to reproduce

[Linux]
:/home/git/embd/build/programs/pkey$ ./gen_key

 usage: gen_key param=<>...

 acceptable parameters:
    type=rsa|ec           default: rsa
    rsa_keysize=%d        default: 4096
    ec_curve=%s           see below
    filename=%s           default: keyfile.key
    format=pem|der        default: pem
    use_dev_random=0|1    default: 0

 available ec_curve values:
    secp521r1 (default)
    brainpoolP512r1
    secp384r1
    brainpoolP384r1
    secp256r1
    secp256k1
    brainpoolP256r1
    secp224r1
    secp224k1
    secp192r1
    secp192k1
    x25519
    x448
 - ERROR - Generic error
Segmentation fault

Additional information

[Windows]
image

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

No branches or pull requests

1 participant