1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-24 12:36:01 -07:00

Add sodium_init(), sodium_reinit() and sodium_shutdown()

This commit is contained in:
Frank Denis 2013-04-18 14:27:20 +02:00
parent 232702ca83
commit 02cea61336
3 changed files with 17 additions and 2 deletions

View File

@ -73,6 +73,19 @@ A convenience header includes everything you need to use the library:
#include <sodium.h> #include <sodium.h>
Before doing anything else with the library, call:
sodium_init(NULL);
And if you need to release memory and other resources possibly
allocated by the library, call:
sodium_shutdown();
After fork()ing, call:
sodium_reinit();
Sodium also provides helper functions to generate random numbers, 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

View File

@ -1,6 +1,7 @@
SODIUM_EXPORT = \ SODIUM_EXPORT = \
sodium.h \ sodium.h \
sodium/core.h \
sodium/crypto_auth.h \ sodium/crypto_auth.h \
sodium/crypto_auth_hmacsha256.h \ sodium/crypto_auth_hmacsha256.h \
sodium/crypto_auth_hmacsha512256.h \ sodium/crypto_auth_hmacsha512256.h \

View File

@ -1,7 +1,8 @@
#ifndef sodium_H #ifndef __SODIUM_H__
#define sodium_H #define __SODIUM_H__
#include <sodium/core.h>
#include <sodium/crypto_auth.h> #include <sodium/crypto_auth.h>
#include <sodium/crypto_auth_hmacsha256.h> #include <sodium/crypto_auth_hmacsha256.h>
#include <sodium/crypto_auth_hmacsha512256.h> #include <sodium/crypto_auth_hmacsha512256.h>