安装 libsodium 使用 salsa20 或 chacha20 或 chacha20-ietf 算法

谷歌发布了针对ARM优化的新算法,但是如果要使用 salsa20 或 chacha20 或 chacha20-ietf 算法,还是需要先安装 libsodium 。

CentOS下:

yum install epel-release -y
yum install libsodium -y

如果想自己编译,那么可以用以下的命令:

#CentOS

yum -y groupinstall "Development Tools"
wget https://github.com/jedisct1/libsodium/releases/download/1.0.12/libsodium-1.0.12.tar.gz
tar xf libsodium-1.0.12.tar.gz && cd libsodium-1.0.12
./configure && make -j2 && make install
echo /usr/local/lib > /etc/ld.so.conf.d/usr_local_lib.conf
ldconfig

#Ubuntu/Debian:

apt-get install build-essential -y
wget https://github.com/jedisct1/libsodium/releases/download/1.0.12/libsodium-1.0.12.tar.gz
tar xf libsodium-1.0.12.tar.gz && cd libsodium-1.0.12
./configure && make -j2 && make install
ldconfig

如果曾经安装过旧版本,亦可重复用以上步骤更新到最新版,仅1.0.4或以上版本支持chacha20-ietf。

假如我们遇到以下的错误时:

xxx: In function `crypto_derive_key':undefined reference to `crypto_pwhash'
xxx: In function `cipher_aead_decrypt':undefined reference to `crypto_aead_xchacha20poly1305_ietf_decrypt'
xxx: In function `cipher_aead_encrypt':undefined reference to `crypto_aead_xchacha20poly1305_ietf_encrypt'
collect2: error: ld returned 1 exit status
make[2]: *** [xxx] Error 1
make[2]: Leaving directory `xxx'
make[1]: *** [xxx] Error 1
make[1]: Leaving directory `xxx'
make: *** [all] Error 2

其实这原因有二:

1.系统存在旧libsodium的缘故,试试apt-get purge libsodium-dev再试试编译

2.尝试在编译时添加路径: ./configure --with-sodium=xxx

相关推荐:
这个问题产生的原因就是编码不同导致的,或是默认配置下不识别除utf-8之外的编码,既然是不支持,我们添加上不就行了。 编辑vimrc文件,mac os中vimrc位置:/usr/shared/vim/vimrc,当然我们更建议使用用户 …
SSH登录服务器时总是要停顿等待一下才能连接上,原因在于:OpenSSH服务器有一个DNS查找选项UseDNS默认是打开的。 在UseDNS选项打开状态下,当客户端试图登录OpenSSH服务器时,服务器端先根据客户端的IP地址 …
根据报错信息“configure: error: off_t undefined; check your library configuration”分析,未定义的类型 off_t。 off_t 类型是在头文件 unistd.h中定义的,在32位系统 编程成 long int ,64位系统则编译 …
配置时区的命令是: $sudo dpkg-reconfigure tzdata(root下无须sudo) 它会改这两个文件: 1. /etc/timezone 2. /etc/localtime 第一个文件写的是系统的时区,国内默认为 Asia/Shanghai 第二个文件还可以 …
首先我们来大致评估下问题的根源,从报错的信息来看肯定是出在环境变量的配置上。 有两种情况导致环境变量出现异常: 1.增加了自定义的环境变量到文件中,结果没留意,“=”两旁出现了空格,如: export TEST …
拿起手机扫一扫即可带走我!