C:\Windows\System32>usbipd list
Connected:
BUSID VID:PID DEVICE STATE
2-2 046d:c09d G102 LIGHTSYNC, USB 输入设备, 虚拟 HID 框架(VHF) HID 设备 Shared
2-6 0c45:671b Integrated Webcam Not shared
2-10 0cf3:e007 Qualcomm QCA61x4A Bluetooth Not shared
Persisted:
GUID DEVICE
05ba9fe6-149f-4349-ab6c-26dc4f6e706e USB 大容量存储设备
d65a77a0-9354-40eb-b6aa-24f26f2ad249 USB 大容量存储设备
C:\Windows\System32>usbipd bind --busid 2-1
usbipd: info: Device with busid '2-1' was already shared.
C:\Windows\System32>usbipd attach --wsl --busid 2-1
usbipd: info: Using WSL distribution 'Ubuntu-24.04' to attach; the device will be available in all WSL 2 distributions.
usbipd: info: Using IP address 172.31.48.1 to reach the host.
ubuntu命令行
root@DESKTOP-69L72QA:/home/ld/bestidiocs2024/ch06/HS/so# cp ./x86_64/libhs_guomi_vpn.so ./example/
root@DESKTOP-69L72QA:/home/ld/bestidiocs2024/ch06/HS/so# cd example/
root@DESKTOP-69L72QA:/home/ld/bestidiocs2024/ch06/HS/so/example# make
gcc -o test test.c -I./ ./libhs_guomi_vpn.so -lpthread
root@DESKTOP-69L72QA:/home/ld/bestidiocs2024/ch06/HS/so/example# ls
Makefile libhs_guomi_vpn.so sdf.h test test.c
root@DESKTOP-69L72QA:/home/ld/bestidiocs2024/ch06/HS/so/example# ./test
iterator -------- erorr
open devces fail
root@DESKTOP-69L72QA:/home/ld/bestidiocs2024/ch06/HS/so/example# ./test
open device success!
open session success!
pOutRand:
80bcf690 bf17f5b3 ec809721 20d01d4f
SDF_GenerateRandom success!
SDF_ImportRootKeyAndDeviceSN success
SN:hs_00000000000014208
CosVer: 4.2.08
ImportKeyPair success
EccBackUpKeyPair success
ExportKeyPair success
SGD_SM3Hash success
SM2EncDec success
SM2SignVer success
SGD_SM1_ECB Encrypt datasize: 4000000 Bytes used time: 1790205 us
SGD_SM1_ECB Encrypt average speed: 17875047 bps
SGD_SM1_ECB Decrypt datasize: 4000000 Bytes used time: 1674376 us
SGD_SM1_ECB Decrypt average speed: 19111597 bps
SM1_ENC_DEC_ECB success.
SGD_SM1_CBC Encrypt datasize: 4000000 Bytes used time: 2363541 us
SGD_SM1_CBC Encrypt average speed: 13539007 bps
SGD_SM1_CBC Decrypt datasize: 4000000 Bytes used time: 1694099 us
SGD_SM1_CBC Decrypt average speed: 18889096 bps
SM1_ENC_DEC_CBC success.
SGD_SM1_OFB Encrypt datasize: 4000000 Bytes used time: 1476893 us
SGD_SM1_OFB Encrypt average speed: 21667107 bps
SGD_SM1_OFB Decrypt datasize: 4000000 Bytes used time: 1422318 us
SGD_SM1_OFB Decrypt average speed: 22498484 bps
SM1_ENC_DEC_OFB success.
SGD_SM4_ECB Encrypt datasize: 4000000 Bytes used time: 1781663 us
SGD_SM4_ECB Encrypt average speed: 17960747 bps
SGD_SM4_ECB Decrypt datasize: 4000000 Bytes used time: 1785711 us
SGD_SM4_ECB Decrypt average speed: 17920032 bps
SM4_ENC_DEC_ECB success.
SGD_SM4_CBC Encrypt datasize: 4000000 Bytes used time: 1810192 us
SGD_SM4_CBC Encrypt average speed: 17677682 bps
SGD_SM4_CBC Decrypt datasize: 4000000 Bytes used time: 1837828 us
SGD_SM4_CBC Decrypt average speed: 17411857 bps
SM4_ENC_DEC_CBC success.
SGD_SM4_OFB Encrypt datasize: 4000000 Bytes used time: 1497640 us
SGD_SM4_OFB Encrypt average speed: 21366950 bps
SGD_SM4_OFB Decrypt datasize: 4000000 Bytes used time: 1490601 us
SGD_SM4_OFB Decrypt average speed: 21467850 bps
SM4_ENC_DEC_OFB success.
SGD_IPSEC_SM1 Encrypt datasize: 4024000 Bytes used time: 2075518 us
SGD_IPSEC_SM1 Encrypt average speed: 15510344 bps
SGD_IPSEC_SM1 Decrypt datasize: 4024000 Bytes used time: 1979668 us
SGD_IPSEC_SM1 Decrypt average speed: 16261312 bps
SM1_ENC_DEC_IPSEC success.
SGD_IPSEC_SM4 Encrypt datasize: 4024 Bytes used time: 2454 us
SGD_IPSEC_SM4 Encrypt average speed: 13118174 bps
SGD_IPSEC_SM4 Decrypt datasize: 4024 Bytes used time: 2441 us
SGD_IPSEC_SM4 Decrypt average speed: 13188037 bps
SM4_ENC_DEC_IPSEC success.
龙脉 ukey
FingerMgrDemo
root@DESKTOP-69L72QA:/home/ld/bestidiocs2024/ch06/longmaiskf0016-stu/samples/skf/linux_mac# cd FingerMgrDemo
root@DESKTOP-69L72QA:/home/ld/bestidiocs2024/ch06/longmaiskf0016-stu/samples/skf/linux_mac/FingerMgrDemo# ls
90-mtoken.rules main.cpp makefile skfapi.h skfapi_finger.h
root@DESKTOP-69L72QA:/home/ld/bestidiocs2024/ch06/longmaiskf0016-stu/samples/skf/linux_mac/FingerMgrDemo# make
g++ -c -o main.o main.cpp
main.cpp: In function ‘long int VerifyPIN(HAPPLICATION)’:
main.cpp:89:25: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
89 | char *userPin = "12345678";
| ^~~~~~~~~~
main.cpp: In function ‘long int VerifyPINForFinger(HAPPLICATION)’:
main.cpp:348:25: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
348 | char *userPin = "";//密码为空时验证指纹
| ^~
main.cpp: In function ‘long int GetFingerCount(HAPPLICATION)’:
main.cpp:404:68: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘long int’ [-Wformat=]
404 | printf("Failed to SKF_GetFingerCount ,ErrorCode= %0x. \n", nRet);
| ~~^ ~~~~
| | |
| | long int
| unsigned int
| %0lx
main.cpp: In function ‘long int GetDevInfo(HANDLE)’:
main.cpp:386:1: warning: control reaches end of non-void function [-Wreturn-type]
386 | }
| ^
rm -f fingerMgrDemo
g++ -o fingerMgrDemo main.o libgm3000.1.0.so
/usr/bin/ld: cannot find libgm3000.1.0.so: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [makefile:32: fingerMgrDemo] Error 1
root@DESKTOP-69L72QA:/home/ld/bestidiocs2024/ch06/longmaiskf0016-stu/samples/skf/linux_mac/FingerMgrDemo# vim makefile
root@DESKTOP-69L72QA:/home/ld/bestidiocs2024/ch06/longmaiskf0016-stu/samples/skf/linux_mac/FingerMgrDemo# make
rm -f fingerMgrDemo
g++ -o fingerMgrDemo main.o ../lib/x64/libgm3000.1.0.so
root@DESKTOP-69L72QA:/home/ld/bestidiocs2024/ch06/longmaiskf0016-stu/samples/skf/linux_mac/FingerMgrDemo# ls
90-mtoken.rules fingerMgrDemo main.cpp main.o makefile skfapi.h skfapi_finger.h
root@DESKTOP-69L72QA:/home/ld/bestidiocs2024/ch06/longmaiskf0016-stu/samples/skf/linux_mac/FingerMgrDemo# ./fingerMgrDemo
*******************************************************************
Finger 示例
*******************************************************************
1. PIN码登录[SKF_VerifyPIN]
2. 指纹录入[SKF_EnrollFingerInit,SKF_EnrollFinger]
3. 指纹验证[SKF_VerifyFinger带UI]
4. 删除指纹[SKF_DeleteFinger]
5. 指纹测试[SKF_TestFinger]
6. 解锁指纹[SKF_UnblockFinger]
7. 获取指纹信息[SKF_GetFingerInfo]
8. 指纹验证[SKF_VerifyPIN,UserPIN=]
9. 获取设备类型[SKF_GetDevInfo]
10. 获指纹取录入个数[SKF_HasFinger,SKF_GetFingerCount]
0. EXIT
Select -->1
Failed to Verify PIN .
*******************************************************************
Finger 示例
*******************************************************************
1. PIN码登录[SKF_VerifyPIN]
2. 指纹录入[SKF_EnrollFingerInit,SKF_EnrollFinger]
3. 指纹验证[SKF_VerifyFinger带UI]
4. 删除指纹[SKF_DeleteFinger]
5. 指纹测试[SKF_TestFinger]
6. 解锁指纹[SKF_UnblockFinger]
7. 获取指纹信息[SKF_GetFingerInfo]
8. 指纹验证[SKF_VerifyPIN,UserPIN=]
9. 获取设备类型[SKF_GetDevInfo]
10. 获指纹取录入个数[SKF_HasFinger,SKF_GetFingerCount]
0. EXIT
Select -->5
Prepare for fingerprint learning .
Failed to Verify Finger Init .
*******************************************************************
Finger 示例
*******************************************************************
1. PIN码登录[SKF_VerifyPIN]
2. 指纹录入[SKF_EnrollFingerInit,SKF_EnrollFinger]
3. 指纹验证[SKF_VerifyFinger带UI]
4. 删除指纹[SKF_DeleteFinger]
5. 指纹测试[SKF_TestFinger]
6. 解锁指纹[SKF_UnblockFinger]
7. 获取指纹信息[SKF_GetFingerInfo]
8. 指纹验证[SKF_VerifyPIN,UserPIN=]
9. 获取设备类型[SKF_GetDevInfo]
10. 获指纹取录入个数[SKF_HasFinger,SKF_GetFingerCount]
0. EXIT
Select -->9
SKF_GetDevInfo Successfully.
This is a common device.
非法指令 (核心已转储)
encrypt
root@DESKTOP-69L72QA:/home/ld/bestidiocs2024/ch06/longmaiskf0016-stu/samples/skf/linux_mac# cd encrypt
root@DESKTOP-69L72QA:/home/ld/bestidiocs2024/ch06/longmaiskf0016-stu/samples/skf/linux_mac/encrypt# ls
main.cpp makefile_linux makefile_mac
root@DESKTOP-69L72QA:/home/ld/bestidiocs2024/ch06/longmaiskf0016-stu/samples/skf/linux_mac/encrypt# mv makefile_linux makefile
root@DESKTOP-69L72QA:/home/ld/bestidiocs2024/ch06/longmaiskf0016-stu/samples/skf/linux_mac/encrypt# ls
main.cpp makefile makefile_mac
root@DESKTOP-69L72QA:/home/ld/bestidiocs2024/ch06/longmaiskf0016-stu/samples/skf/linux_mac/encrypt# vim makefile
root@DESKTOP-69L72QA:/home/ld/bestidiocs2024/ch06/longmaiskf0016-stu/samples/skf/linux_mac/encrypt# make
g++ -c -o main.o main.cpp
main.cpp: In function ‘int main()’:
main.cpp:24:29: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
24 | char *pUserPin = "123456";
| ^~~~~~~~
main.cpp:30:26: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
30 | char *pData = "1234567812345678";
| ^~~~~~~~~~~~~~~~~~
rm -f encryptTest
g++ -o encryptTest main.o ../lib/x64/libgm3000.1.0.so
root@DESKTOP-69L72QA:/home/ld/bestidiocs2024/ch06/longmaiskf0016-stu/samples/skf/linux_mac/encrypt# ls
encryptTest main.cpp main.o makefile makefile_mac
root@DESKTOP-69L72QA:/home/ld/bestidiocs2024/ch06/longmaiskf0016-stu/samples/skf/linux_mac/encrypt# ./encryptTest
encrypt data ok!