C++ compat
This commit is contained in:
parent
4c2cf071f8
commit
99e6c94739
@ -242,8 +242,8 @@ tv_secretbox_xchacha20poly1305(void)
|
|||||||
|
|
||||||
m_len = randombytes_uniform(1000);
|
m_len = randombytes_uniform(1000);
|
||||||
box_len = crypto_secretbox_xchacha20poly1305_ZEROBYTES + m_len;
|
box_len = crypto_secretbox_xchacha20poly1305_ZEROBYTES + m_len;
|
||||||
m = sodium_malloc(box_len);
|
m = (unsigned char *) sodium_malloc(box_len);
|
||||||
out = sodium_malloc(box_len);
|
out = (unsigned char *) sodium_malloc(box_len);
|
||||||
randombytes_buf(m + crypto_secretbox_xchacha20poly1305_ZEROBYTES, m_len);
|
randombytes_buf(m + crypto_secretbox_xchacha20poly1305_ZEROBYTES, m_len);
|
||||||
memset(m, 0, crypto_secretbox_xchacha20poly1305_ZEROBYTES);
|
memset(m, 0, crypto_secretbox_xchacha20poly1305_ZEROBYTES);
|
||||||
crypto_secretbox_xchacha20poly1305(out, m, box_len, nonce, key);
|
crypto_secretbox_xchacha20poly1305(out, m, box_len, nonce, key);
|
||||||
|
Loading…
Reference in New Issue
Block a user