要求:
- 推荐在openEuler中实现 ,参考https://www.cnblogs.com/rocedu/p/6012545.html第三节
- 提交相关代码码云(或github)链接(我使用博客园)
- 提交不少于6张编译测试过程截图
- 至少包含SM4,SM3的测试
1.检查版本
2.检查sm2 sm3
$ ./apps/openssl ecparam -list_curves | grep SM2
$ echo -n "abc" | ./apps/openssl dgst -SM3
3.检查函数
./apps/openssl enc -ciphers
4.测试SM4
代码:
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "openssl/err.h"
#include "openssl/evp.h"
/* Before OpenSSL 1.1.1-pre1, we did not have EVP_sm4_ecb() */
#if defined(OPENSSL_VERSION_NUMBER)
&& OPENSSL_VERSION_NUMBER < 0x10101001L
static const EVP_CIPHER *(*EVP_sm4_ecb)()=EVP_aes_128_ecb;
#endif
typedef struct {
const