Total Pageviews

Friday 25 February 2022

关于libsodium


The original Sodium project can be located here, the about Sodium is obtained from the readme in the source repository.

Sodium is a new, easy-to-use software library for encryption, decryption, signatures, password hashing and more.

It is a portable, cross-compilable, installable, packageable fork of NaCl, with a compatible API, and an extended API to improve usability even further.

Its goal is to provide all of the core operations needed to build higher-level cryptographic tools.

Sodium supports a variety of compilers and operating systems, including Windows (with MingW or Visual Studio, x86 and x64), iOS and Android.

-------------------------


Installation

Compilation on Unix-like systems

Sodium is a shared library with a machine-independent set of headers, so it can easily be used by 3rd party projects.
The library is built using Autotools, making it easy to package.
Installation is trivial, and both compilation and testing can take advantage of multiple CPU cores.
Download a tarball of libsodium, preferably the latest stable version, then follow the ritual:
1
./configure
2
make && make check
3
sudo make install
Copied!
(wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz

tar zxvf libsodium-1.0.18.tar.gz
cd libsodium-1.0.18
./configure
make
make install
ldconfig )

Since different files are compiled for different CPU classes, and to prevent unwanted optimizations, link-time optimization (LTO) should not be used.
Also, do not enable sanitizers (such as -fsanitize=signed-integer-overflow). These can introduce side channels.
On Linux, if the process hangs at the make check step, your system PRG may not have been properly seeded. Please refer to the notes in the "Usage" section for ways to address this.
Also, on Linux, like any manually installed library, running the ldconfig command is required to make the dynamic linker aware of the new library.

Compilation on Windows

Compilation on Windows is usually not required, as pre-built libraries for MinGW and Visual Studio are available (see below).
However, if you want to compile it yourself, start by cloning the stable branch from the Git repository.
Visual Studio solutions can be then found in the builds/msvc directory.
In order to compile with MinGW, run either ./dist-build/msys2-win32.sh or ./dist-build/msys2-win64.sh for Win32 or x64 targets.
Alternatively, you can build and install libsodium using vcpkg dependency manager:
1
git clone https://github.com/Microsoft/vcpkg.git
2
cd vcpkg
3
./bootstrap-vcpkg.bat
4
./vcpkg integrate install
5
./vcpkg install libsodium
Copied!
The libsodium port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please create an issue or pull request.

from https://doc.libsodium.org/installation#integrity-checking
-----

https://github.com/jedisct1/libsodium
https://github.com/jedisct1/libsodium-doc

No comments:

Post a Comment