jedisct1 / libsodium

A modern, portable, easy to use crypto library.
https://libsodium.org
Other
12.23k stars 1.74k forks source link

crypto_sign_ed25519: Isn't this undefined behavior? #381

Closed metadings closed 8 years ago

metadings commented 8 years ago

We have there in crypto_sign_ed25519

unsigned char nonce[64];

and some lines later

crypto_hash_sha512_final(&hs, nonce);

Now I'm not that hard in C, but isn't this undefined behavior, to declare a variable, not initializing it (or initializing it to NULs), and then going to use it?

metadings commented 8 years ago

Oh I see there is unsigned char *out in crypto_hash_sha512_final.

jedisct1 commented 8 years ago

Hi,

You are correct, crypto_hash_sha512_final() puts the hash into the second function parameter.