Add more information about thread safety until we provide a thread-safe API.
This commit is contained in:
parent
1b87626e9f
commit
edc5faffd6
@ -94,7 +94,7 @@ Sodium also provides helper functions to generate random numbers,
|
|||||||
leveraging `/dev/urandom` or `/dev/random` on *nix and the cryptographic
|
leveraging `/dev/urandom` or `/dev/random` on *nix and the cryptographic
|
||||||
service provider on Windows. The interface is similar to
|
service provider on Windows. The interface is similar to
|
||||||
`arc4random(3)`. It is `fork(2)`-safe but not thread-safe. This holds
|
`arc4random(3)`. It is `fork(2)`-safe but not thread-safe. This holds
|
||||||
true for `crypto_sign_keypair()` as well.
|
true for `crypto_sign_keypair()` and `crypto_box_keypair()` as well.
|
||||||
|
|
||||||
uint32_t randombytes_random(void);
|
uint32_t randombytes_random(void);
|
||||||
|
|
||||||
|
@ -1,6 +1,13 @@
|
|||||||
#ifndef crypto_box_H
|
#ifndef crypto_box_H
|
||||||
#define crypto_box_H
|
#define crypto_box_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* THREAD SAFETY: crypto_box_keypair() is thread-safe,
|
||||||
|
* provided that you called sodium_init() once before using any
|
||||||
|
* other libsodium function.
|
||||||
|
* Other functions are always thread-safe.
|
||||||
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "crypto_box_curve25519xsalsa20poly1305.h"
|
#include "crypto_box_curve25519xsalsa20poly1305.h"
|
||||||
|
@ -1,6 +1,13 @@
|
|||||||
#ifndef crypto_sign_H
|
#ifndef crypto_sign_H
|
||||||
#define crypto_sign_H
|
#define crypto_sign_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* THREAD SAFETY: crypto_sign_keypair() is thread-safe,
|
||||||
|
* provided that you called sodium_init() once before using any
|
||||||
|
* other libsodium function.
|
||||||
|
* Other functions, including crypto_sign_seed_keypair() are always thread-safe.
|
||||||
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "crypto_sign_ed25519.h"
|
#include "crypto_sign_ed25519.h"
|
||||||
|
@ -2,6 +2,12 @@
|
|||||||
#ifndef randombytes_salsa20_random_H
|
#ifndef randombytes_salsa20_random_H
|
||||||
#define randombytes_salsa20_random_H
|
#define randombytes_salsa20_random_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* THREAD SAFETY: randombytes_salsa20_random*() functions are
|
||||||
|
* fork()-safe but not thread-safe.
|
||||||
|
* Always wrap them in a mutex if you need thread safety.
|
||||||
|
*/
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
@ -2,6 +2,12 @@
|
|||||||
#ifndef randombytes_sysrandom_H
|
#ifndef randombytes_sysrandom_H
|
||||||
#define randombytes_sysrandom_H
|
#define randombytes_sysrandom_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* THREAD SAFETY: randombytes_sysrandom() functions are thread-safe,
|
||||||
|
* provided that you called sodium_init() once before using any
|
||||||
|
* other libsodium function.
|
||||||
|
*/
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user