GmSSL / GmSSL-Python

Python binding to the GmSSL library
https://gmssl.github.io/GmSSL-Python/
Apache License 2.0
57 stars 10 forks source link

sm3 pbkdf2 运行报错 #17

Closed bowenerchen closed 1 month ago

bowenerchen commented 1 month ago

Traceback (most recent call last): File "/home/bc/sm3_pbkdf2_demo.py", line 18, in key = sm3_pbkdf2(passwd, salt, iterator, keylen) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/bc/Public/anaconda3/lib/python3.11/site-packages/gmssl.py", line 136, in sm3_pbkdf2 if gmssl.pbkdf2_hmac_sm3_genkey(c_char_p(passwd), c_size_t(len(passwd)), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/bc/Public/anaconda3/lib/python3.11/ctypes/init.py", line 389, in getattr func = self.getitem(name) ^^^^^^^^^^^^^^^^^^^^^^ File "/home/bc/Public/anaconda3/lib/python3.11/ctypes/init.py", line 394, in getitem func = self._FuncPtr((name_or_ordinal, self)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: /usr/local/lib/libgmssl.so.3: undefined symbol: pbkdf2_hmac_sm3_genkey

==========================================================================

系统信息: ❯ python3 --version Python 3.11.5 ❯ uname -a Linux Ubuntu-2404-LTS 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 02:32:42 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux ❯ gcc --version gcc (Ubuntu 13.2.0-23ubuntu4) 13.2.0 ❯ g++ --version g++ (Ubuntu 13.2.0-23ubuntu4) 13.2.0

PS: 在 MAC M2上运行也有这样的问题

image
bowenerchen commented 1 month ago

应该安装 GmSSL-3.1.1版本 wget https://github.com/guanzhi/GmSSL/archive/refs/tags/v3.1.1.zip

image