安装 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

相关推荐:
装了个Linux,不幸地是开机时遇到了错误的提示“Could not apply the stored configuration for monitors”。简单地从英文上理解就是说当前的显示配置运用时有问题,换句话说这是显示器的配置文件出了异常。 …
安装示例前提 php安装目录:/usr/local/php5 php.ini配置文件路径:/usr/local/php5/etc/php.ini Nginx安装目录:/usr/local/nginx Nginx网站根目录:/usr/local/nginx/html 1、安装编译工具 #shell#yum in …
将本机80端口的请求转发到8080端口 #shell#iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080 如果需要本机也可以访问,则需要配置OUTPUT链 #shell#iptables -t nat -A OUTPUT …
这个问题产生的原因就是编码不同导致的,或是默认配置下不识别除utf-8之外的编码,既然是不支持,我们添加上不就行了。 编辑vimrc文件,mac os中vimrc位置:/usr/shared/vim/vimrc,当然我们更建议使用用户 …
一般我们在更换DNS源或配置了HOSTS后,刷新DNS缓存让你可以得到新的域名解析。当你无法正确访问一个新注册的域名时就可以刷新dns缓存试试,但是不同的系统如Windows、Mac OS和Linux上的方法是不一样的。 如 …
拿起手机扫一扫即可带走我!