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

相关推荐:
这是源码安装软件时配置环境用的,根据你的配置选项和你的系统情况生成makefile文件,为make 做准备。 最常用的参数就是: ./configure --prefix=xxx 若不指定prefix,则可执行文件默认放在/usr/local/bin …
这个问题产生的原因就是编码不同导致的,或是默认配置下不识别除utf-8之外的编码,既然是不支持,我们添加上不就行了。 编辑vimrc文件,mac os中vimrc位置:/usr/shared/vim/vimrc,当然我们更建议使用用户 …
Linux下我们会遇到一个常见的问题,那就是如何修复 /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory 问题,这个问题发生的根源不是安装报出问题,而是平台兼容性问题。 怎么理解,就 …
源码安装软件时一直make不了,后来重新./configure了下,发现后面出现错误:error: mbed TLS libraries not found。 这样的问题其实是出在缺少「mbed TLS」库,那么我们开始缺啥补啥。需要先安装mbed库,从 …
在linux上,我们使用df命令只能看到磁盘的总体占用情况,无法看到具体的内容或目录占用情况,有些时候为了统计或者排查磁盘的具体占用时,我们需要细到每一个目录或文件,此时有一个命令可以帮到我们。 [ro …
拿起手机扫一扫即可带走我!