当前位置: 首页 > news >正文

openssl3.2 - 测试程序的学习 - 准备openssl测试专用工程的模板

文章目录

    • openssl3.2 - 测试程序的学习 - 准备openssl测试专用工程的模板
    • 概述
    • 笔记
    • 工程中需要的openssl的库实现
    • 补充 - 最终的模板工程
    • END

openssl3.2 - 测试程序的学习 - 准备openssl测试专用工程的模板

概述

openssl3.2 - 测试程序的学习
整了几个test.c, 每开一个新的测试工程, 总要改这改那的. 挺麻烦的.
想建立一个专门用于学习openssl测试工程的VS2019模板工程. 等做新实验时, 将openssl的测试程序加入工程, 做少量改动, 就能做实验.
如果每次做一个实验, 都要向工程中加入大量支持文件, 受不了.

观察了一下makefile中的测试工程的生成, 普遍都是一个测试程序的.c + 一个测试库 + openssl的公共库.


// 测试.exe的实现组成
test\afalgtest.exe: test\afalgtest-bin-afalgtest.obj test\libtestutil.lib libcrypto.libIF EXIST test\afalgtest.exe.manifest DEL /F /Q test\afalgtest.exe.manifest$(LD) $(LDFLAGS) $(BIN_LDFLAGS) @<<
test\afalgtest-bin-afalgtest.obj// 测试.c的实现组成
test\afalgtest-bin-afalgtest.obj: test\afalgtest.c$(CC)  $(BIN_CFLAGS) -I"include" -I"apps\include" $(BIN_CPPFLAGS)  -c $(COUTFLAG)$@ "test\afalgtest.c"cmd /C "$(CC) /Zs /showIncludes  $(BIN_CFLAGS) -I"include" -I"apps\include" $(BIN_CPPFLAGS)  "test\afalgtest.c" > test\afalgtest-bin-afalgtest.d 2>&1"// libtestutil.lib的实现组成
test\libtestutil.lib: apps\lib\libtestutil-lib-opt.obj apps\lib\libtestutil-lib-win32_init.obj test\testutil\libtestutil-lib-apps_shims.obj test\testutil\libtestutil-lib-basic_output.obj test\testutil\libtestutil-lib-cb.obj test\testutil\libtestutil-lib-driver.obj test\testutil\libtestutil-lib-fake_random.obj test\testutil\libtestutil-lib-format_output.obj test\testutil\libtestutil-lib-load.obj test\testutil\libtestutil-lib-main.obj test\testutil\libtestutil-lib-options.obj test\testutil\libtestutil-lib-output.obj test\testutil\libtestutil-lib-provider.obj test\testutil\libtestutil-lib-random.obj test\testutil\libtestutil-lib-stanza.obj test\testutil\libtestutil-lib-test_cleanup.obj test\testutil\libtestutil-lib-test_options.obj test\testutil\libtestutil-lib-tests.obj test\testutil\libtestutil-lib-testutil_init.obj$(AR) $(ARFLAGS) $(AROUTFLAG)test\libtestutil.lib @<<
apps\lib\libtestutil-lib-opt.obj
apps\lib\libtestutil-lib-win32_init.obj
test\testutil\libtestutil-lib-apps_shims.obj
test\testutil\libtestutil-lib-basic_output.obj
test\testutil\libtestutil-lib-cb.obj
test\testutil\libtestutil-lib-driver.obj
test\testutil\libtestutil-lib-fake_random.obj
test\testutil\libtestutil-lib-format_output.obj
test\testutil\libtestutil-lib-load.obj
test\testutil\libtestutil-lib-main.obj
test\testutil\libtestutil-lib-options.obj
test\testutil\libtestutil-lib-output.obj
test\testutil\libtestutil-lib-provider.obj
test\testutil\libtestutil-lib-random.obj
test\testutil\libtestutil-lib-stanza.obj
test\testutil\libtestutil-lib-test_cleanup.obj
test\testutil\libtestutil-lib-test_options.obj
test\testutil\libtestutil-lib-tests.obj
test\testutil\libtestutil-lib-testutil_init.obj
<<
apps\lib\libtestutil-lib-opt.obj: apps\lib\opt.c$(CC)  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  -c $(COUTFLAG)$@ "apps\lib\opt.c"cmd /C "$(CC) /Zs /showIncludes  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  "apps\lib\opt.c" > apps\lib\libtestutil-lib-opt.d 2>&1"
apps\lib\libtestutil-lib-win32_init.obj: apps\lib\win32_init.c$(CC)  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  -c $(COUTFLAG)$@ "apps\lib\win32_init.c"cmd /C "$(CC) /Zs /showIncludes  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  "apps\lib\win32_init.c" > apps\lib\libtestutil-lib-win32_init.d 2>&1"
test\testutil\libtestutil-lib-apps_shims.obj: test\testutil\apps_shims.c$(CC)  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  -c $(COUTFLAG)$@ "test\testutil\apps_shims.c"cmd /C "$(CC) /Zs /showIncludes  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  "test\testutil\apps_shims.c" > test\testutil\libtestutil-lib-apps_shims.d 2>&1"
test\testutil\libtestutil-lib-basic_output.obj: test\testutil\basic_output.c$(CC)  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  -c $(COUTFLAG)$@ "test\testutil\basic_output.c"cmd /C "$(CC) /Zs /showIncludes  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  "test\testutil\basic_output.c" > test\testutil\libtestutil-lib-basic_output.d 2>&1"
test\testutil\libtestutil-lib-cb.obj: test\testutil\cb.c$(CC)  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  -c $(COUTFLAG)$@ "test\testutil\cb.c"cmd /C "$(CC) /Zs /showIncludes  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  "test\testutil\cb.c" > test\testutil\libtestutil-lib-cb.d 2>&1"
test\testutil\libtestutil-lib-driver.obj: test\testutil\driver.c$(CC)  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  -c $(COUTFLAG)$@ "test\testutil\driver.c"cmd /C "$(CC) /Zs /showIncludes  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  "test\testutil\driver.c" > test\testutil\libtestutil-lib-driver.d 2>&1"
test\testutil\libtestutil-lib-fake_random.obj: test\testutil\fake_random.c$(CC)  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  -c $(COUTFLAG)$@ "test\testutil\fake_random.c"cmd /C "$(CC) /Zs /showIncludes  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  "test\testutil\fake_random.c" > test\testutil\libtestutil-lib-fake_random.d 2>&1"
test\testutil\libtestutil-lib-format_output.obj: test\testutil\format_output.c$(CC)  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  -c $(COUTFLAG)$@ "test\testutil\format_output.c"cmd /C "$(CC) /Zs /showIncludes  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  "test\testutil\format_output.c" > test\testutil\libtestutil-lib-format_output.d 2>&1"
test\testutil\libtestutil-lib-load.obj: test\testutil\load.c$(CC)  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  -c $(COUTFLAG)$@ "test\testutil\load.c"cmd /C "$(CC) /Zs /showIncludes  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  "test\testutil\load.c" > test\testutil\libtestutil-lib-load.d 2>&1"
test\testutil\libtestutil-lib-main.obj: test\testutil\main.c$(CC)  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  -c $(COUTFLAG)$@ "test\testutil\main.c"cmd /C "$(CC) /Zs /showIncludes  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  "test\testutil\main.c" > test\testutil\libtestutil-lib-main.d 2>&1"
test\testutil\libtestutil-lib-options.obj: test\testutil\options.c$(CC)  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  -c $(COUTFLAG)$@ "test\testutil\options.c"cmd /C "$(CC) /Zs /showIncludes  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  "test\testutil\options.c" > test\testutil\libtestutil-lib-options.d 2>&1"
test\testutil\libtestutil-lib-output.obj: test\testutil\output.c$(CC)  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  -c $(COUTFLAG)$@ "test\testutil\output.c"cmd /C "$(CC) /Zs /showIncludes  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  "test\testutil\output.c" > test\testutil\libtestutil-lib-output.d 2>&1"
test\testutil\libtestutil-lib-provider.obj: test\testutil\provider.c$(CC)  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  -c $(COUTFLAG)$@ "test\testutil\provider.c"cmd /C "$(CC) /Zs /showIncludes  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  "test\testutil\provider.c" > test\testutil\libtestutil-lib-provider.d 2>&1"
test\testutil\libtestutil-lib-random.obj: test\testutil\random.c$(CC)  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  -c $(COUTFLAG)$@ "test\testutil\random.c"cmd /C "$(CC) /Zs /showIncludes  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  "test\testutil\random.c" > test\testutil\libtestutil-lib-random.d 2>&1"
test\testutil\libtestutil-lib-stanza.obj: test\testutil\stanza.c$(CC)  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  -c $(COUTFLAG)$@ "test\testutil\stanza.c"cmd /C "$(CC) /Zs /showIncludes  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  "test\testutil\stanza.c" > test\testutil\libtestutil-lib-stanza.d 2>&1"
test\testutil\libtestutil-lib-test_cleanup.obj: test\testutil\test_cleanup.c$(CC)  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  -c $(COUTFLAG)$@ "test\testutil\test_cleanup.c"cmd /C "$(CC) /Zs /showIncludes  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  "test\testutil\test_cleanup.c" > test\testutil\libtestutil-lib-test_cleanup.d 2>&1"
test\testutil\libtestutil-lib-test_options.obj: test\testutil\test_options.c$(CC)  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  -c $(COUTFLAG)$@ "test\testutil\test_options.c"cmd /C "$(CC) /Zs /showIncludes  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  "test\testutil\test_options.c" > test\testutil\libtestutil-lib-test_options.d 2>&1"
test\testutil\libtestutil-lib-tests.obj: test\testutil\tests.c$(CC)  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  -c $(COUTFLAG)$@ "test\testutil\tests.c"cmd /C "$(CC) /Zs /showIncludes  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  "test\testutil\tests.c" > test\testutil\libtestutil-lib-tests.d 2>&1"
test\testutil\libtestutil-lib-testutil_init.obj: test\testutil\testutil_init.c$(CC)  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  -c $(COUTFLAG)$@ "test\testutil\testutil_init.c"cmd /C "$(CC) /Zs /showIncludes  $(LIB_CFLAGS) -I"include" -I"apps\include" -I"." $(LIB_CPPFLAGS)  "test\testutil\testutil_init.c" > test\testutil\libtestutil-lib-testutil_init.d 2>&1"
engines\capi.dll: engines\capi-dso-e_capi.obj engines\capi.def libcrypto.libIF EXIST engines\capi.dll.manifest DEL /F /Q engines\capi.dll.manifestcmd /C "$(LD) $(LDFLAGS) $(DSO_LDFLAGS) @<< || (DEL /Q $(@B).* engines\capi.* & EXIT 1)"

那应该建立一个以 libtestutil.lib 实现为主的工程, 补充一些空实现(在自己添加的2个公共实现里面, 用宏来控制空实现的有无), 让这个.exe工程能自编译过.
那么这就是专门做openssl测试程序实验的工程.

等做openssl测试程序新实验时, 如果测试.c有程序里面需要的要求的几个必须实现, 用宏关掉模板公共实现中的空实现即可.
试了一下好使, 做新实验时方便多了.

笔记

工程中需要的openssl的库实现

将编译过的openssl源码目录中的apps, test/testutil 目录直接拷贝到模板工程下, 将垃圾都删掉(只保留.c, .h)
工程设置合适的头文件路径和库路径
按照makefile中, test\libtestutil.lib 的实现要求, 加入对应的.c
加入自己做的2个公共文件, 里面有头文件包含和库包含, 还有宏控制的openssl测试专用的几个空实现.
在这里插入图片描述

/*!
\file my_openSSL_lib.h
*/#ifndef __MY_OPENSSL_LIB_H__
#define __MY_OPENSSL_LIB_H__#ifdef  _WIN32
#include <WinSock2.h>
#pragma comment(lib, "ws2_32.lib") // for select()#include <windows.h>
#endif /* #ifdef  _WIN32 */#pragma comment(lib, "libcrypto.lib")
#pragma comment(lib, "libssl.lib")#ifdef  _WIN32
#define MY_SLEEP(x) Sleep(x)
#else
#define MY_SLEEP(x) sleep(x)
#endif /* #ifdef  _WIN32 */#define USE_MY_SETUP_TEST// #define USE_MY_OPTION_choice#ifdef USE_MY_OPTION_choice#include "testutil.h"// 需要将其他实现中的enum定义拷贝过来
typedef enum OPTION_choice {OPT_ERR = -1,OPT_EOF = 0,OPT_CONFIG_FILE,OPT_TEST_ENUM
} OPTION_CHOICE;#endif // #ifdef USE_MY_OPTION_choice#endif /* #ifndef __MY_OPENSSL_LIB_H__ */
/*!
* \file D:\my_dev\my_local_git_prj\study\openSSL\nmake_test\test_c\prj_005_afalgtest.c\my_openSSL_lib.c
*/#include "my_openSSL_lib.h"#define MY_USE_APPLINK
#ifdef MY_USE_APPLINK
#include <openssl/applink.c> /*! for OPENSSL_Uplink(00007FF8B7EF0FE8,08): no OPENSSL_Applink */
#endif // #ifdef MY_USE_APPLINK#ifdef USE_MY_OPTION_choiceconst OPTIONS* test_get_options(void)
{// 这个函数返回不能为空, 从其他有实现的函数中拷贝一个实现过来, 否则有崩溃报错static const OPTIONS test_options[] = {OPT_TEST_OPTIONS_DEFAULT_USAGE,{ "config", OPT_CONFIG_FILE, '<',"The configuration file to use for the libctx" },{ NULL }};return test_options;
}#endif // #ifdef USE_MY_OPTION_choice#ifdef USE_MY_SETUP_TEST
int setup_tests(void)
{return 0;
}# endif // 

编译通过

1>  正在创建库 D:\my_dev\my_local_git_prj\study\openSSL\nmake_test\test_c\prj_openssl_test_template\x64\Debug\prj_template.lib 和对象 D:\my_dev\my_local_git_prj\study\openSSL\nmake_test\test_c\prj_openssl_test_template\x64\Debug\prj_template.exp
1>prj_template.vcxproj -> D:\my_dev\my_local_git_prj\study\openSSL\nmake_test\test_c\prj_openssl_test_template\x64\Debug\prj_template.exe
========== 全部重新生成: 成功 1 个,失败 0 个,跳过 0==========

就将这个工程作为openssl测试(test/*.c)专用的工程模板

补充 - 最终的模板工程

用工程模板, 过了100+的官方测试工程,都好使.
记录一下最终版本.
工程中有些实现要删除掉, 因为和测试工程中的函数定义重复. 最终模板工程的文件列表如下

文件夹 PATH 列表
卷序列号为 36AD-51CE
D:.
|   my_openSSL_lib.c
|   my_openSSL_lib.h
|   prj_template.sln
|   prj_template.vcxproj
|   prj_template.vcxproj.filters
|   prj_template.vcxproj.user
|   testutil.h
|   tree_all_file.txt
|   
+---apps
|   |   asn1parse.c
|   |   ca.c
|   |   ciphers.c
|   |   cmp.c
|   |   cms.c
|   |   crl.c
|   |   crl2pkcs7.c
|   |   dgst.c
|   |   dhparam.c
|   |   dsa.c
|   |   dsaparam.c
|   |   ec.c
|   |   ecparam.c
|   |   enc.c
|   |   engine.c
|   |   errstr.c
|   |   fipsinstall.c
|   |   gendsa.c
|   |   genpkey.c
|   |   genrsa.c
|   |   info.c
|   |   kdf.c
|   |   list.c
|   |   mac.c
|   |   nseq.c
|   |   ocsp.c
|   |   openssl.c
|   |   passwd.c
|   |   pkcs12.c
|   |   pkcs7.c
|   |   pkcs8.c
|   |   pkey.c
|   |   pkeyparam.c
|   |   pkeyutl.c
|   |   prime.c
|   |   progs.c
|   |   progs.h
|   |   rand.c
|   |   rehash.c
|   |   req.c
|   |   rsa.c
|   |   rsautl.c
|   |   sess_id.c
|   |   smime.c
|   |   speed.c
|   |   spkac.c
|   |   srp.c
|   |   storeutl.c
|   |   s_client.c
|   |   s_server.c
|   |   s_time.c
|   |   testdsa.h
|   |   testrsa.h
|   |   timeouts.h
|   |   ts.c
|   |   verify.c
|   |   version.c
|   |   vms_decc_init.c
|   |   x509.c
|   |   
|   +---include
|   |       apps.h
|   |       apps_ui.h
|   |       app_libctx.h
|   |       app_params.h
|   |       cmp_mock_srv.h
|   |       ec_common.h
|   |       engine_loader.h
|   |       fmt.h
|   |       function.h
|   |       http_server.h
|   |       log.h
|   |       names.h
|   |       opt.h
|   |       platform.h
|   |       s_apps.h
|   |       vms_term_sock.h
|   |       __DECC_INCLUDE_EPILOGUE.H
|   |       __DECC_INCLUDE_PROLOGUE.H
|   |       
|   \---lib
|           apps.c
|           apps_opt_printf.c
|           apps_ui.c
|           app_libctx.c
|           app_params.c
|           app_provider.c
|           app_rand.c
|           app_x509.c
|           build.info
|           cmp_mock_srv.c
|           columns.c
|           engine.c
|           engine_loader.c
|           fmt.c
|           http_server.c
|           log.c
|           names.c
|           opt.c
|           s_cb.c
|           s_socket.c
|           tlssrp_depr.c
|           vms_decc_argv.c
|           vms_term_sock.c
|           win32_init.c
|           
+---include
|   |   bn_prime.h
|   |   bn_rand_range.h
|   |   evp_local.h
|   |   
|   +---crypto
|   |       aes_platform.h
|   |       aria.h
|   |       asn1.h
|   |       asn1err.h
|   |       asn1_dsa.h
|   |       async.h
|   |       asyncerr.h
|   |       bioerr.h
|   |       bn.h
|   |       bnerr.h
|   |       bn_conf.h
|   |       bn_dh.h
|   |       bn_srp.h
|   |       buffererr.h
|   |       chacha.h
|   |       cmll_platform.h
|   |       cmperr.h
|   |       cmserr.h
|   |       comperr.h
|   |       conferr.h
|   |       context.h
|   |       crmferr.h
|   |       cryptlib.h
|   |       cryptoerr.h
|   |       cterr.h
|   |       ctype.h
|   |       decoder.h
|   |       decodererr.h
|   |       des_platform.h
|   |       dh.h
|   |       dherr.h
|   |       dsa.h
|   |       dsaerr.h
|   |       dso_conf.h
|   |       ec.h
|   |       ecerr.h
|   |       ecx.h
|   |       encoder.h
|   |       encodererr.h
|   |       engine.h
|   |       engineerr.h
|   |       err.h
|   |       ess.h
|   |       esserr.h
|   |       evp.h
|   |       evperr.h
|   |       httperr.h
|   |       lhash.h
|   |       md32_common.h
|   |       modes.h
|   |       objects.h
|   |       objectserr.h
|   |       ocsperr.h
|   |       pem.h
|   |       pemerr.h
|   |       pkcs12err.h
|   |       pkcs7.h
|   |       pkcs7err.h
|   |       poly1305.h
|   |       ppc_arch.h
|   |       punycode.h
|   |       rand.h
|   |       randerr.h
|   |       rand_pool.h
|   |       riscv_arch.h
|   |       rsa.h
|   |       rsaerr.h
|   |       security_bits.h
|   |       sha.h
|   |       siphash.h
|   |       siv.h
|   |       sm2.h
|   |       sm2err.h
|   |       sm4.h
|   |       sm4_platform.h
|   |       sparc_arch.h
|   |       sparse_array.h
|   |       store.h
|   |       storeerr.h
|   |       tserr.h
|   |       types.h
|   |       uierr.h
|   |       x509.h
|   |       x509err.h
|   |       x509v3err.h
|   |       __DECC_INCLUDE_EPILOGUE.H
|   |       __DECC_INCLUDE_PROLOGUE.H
|   |       
|   \---internal
|           asn1.h
|           bio.h
|           bio_addr.h
|           bio_tfo.h
|           common.h
|           comp.h
|           conf.h
|           constant_time.h
|           core.h
|           cryptlib.h
|           dane.h
|           deprecated.h
|           der.h
|           deterministic_nonce.h
|           dso.h
|           dsoerr.h
|           endian.h
|           err.h
|           event_queue.h
|           e_os.h
|           ffc.h
|           hpke_util.h
|           ktls.h
|           list.h
|           namemap.h
|           nelem.h
|           numbers.h
|           o_dir.h
|           packet.h
|           packet_quic.h
|           params.h
|           param_build_set.h
|           param_names.h
|           passphrase.h
|           priority_queue.h
|           property.h
|           propertyerr.h
|           provider.h
|           quic_ackm.h
|           quic_cc.h
|           quic_cfq.h
|           quic_channel.h
|           quic_demux.h
|           quic_error.h
|           quic_fc.h
|           quic_fifd.h
|           quic_reactor.h
|           quic_record_rx.h
|           quic_record_tx.h
|           quic_record_util.h
|           quic_rx_depack.h
|           quic_sf_list.h
|           quic_ssl.h
|           quic_statm.h
|           quic_stream.h
|           quic_stream_map.h
|           quic_thread_assist.h
|           quic_tls.h
|           quic_tserver.h
|           quic_txp.h
|           quic_txpim.h
|           quic_types.h
|           quic_vlint.h
|           quic_wire.h
|           quic_wire_pkt.h
|           recordmethod.h
|           refcount.h
|           ring_buf.h
|           safe_math.h
|           sha3.h
|           sizes.h
|           sm3.h
|           sockets.h
|           ssl.h
|           ssl3_cbc.h
|           sslconf.h
|           statem.h
|           symhacks.h
|           thread.h
|           thread_arch.h
|           thread_once.h
|           time.h
|           tlsgroups.h
|           tsan_assist.h
|           uint_set.h
|           unicode.h
|           __DECC_INCLUDE_EPILOGUE.H
|           __DECC_INCLUDE_PROLOGUE.H
|           
\---testutilapps_shims.cbasic_output.ccb.cdriver.cfake_random.cformat_output.cload.cmain.coptions.coutput.coutput.hprovider.crandom.cstanza.ctests.ctu_local.h

VS2019工程中看到的工程文件(不包含头文件, 都是根据头文件路径设置自动引用)
在这里插入图片描述
在openssl安装好的目录, 不需要添加任何openssl源码目录的文件, 保持原样.
自己在工程中添加的2个文件(my_openSSL_lib.*), 这块是是否能方便添加任何官方测试实现, 并能快速编译通过的点.

/*!
\file my_openSSL_lib.h
*/#ifndef __MY_OPENSSL_LIB_H__
#define __MY_OPENSSL_LIB_H__#ifdef  _WIN32
#include <WinSock2.h>
#pragma comment(lib, "ws2_32.lib") // for select()#include <windows.h>
#endif /* #ifdef  _WIN32 */#pragma comment(lib, "libcrypto.lib")
#pragma comment(lib, "libssl.lib")// --------------------------------------------------------------------------------
// 开关宏 - begin
// 5个开关宏默认是打开的, 在没有加入openssl官方的测试实现(.c)时, 本工程模板也能正常编译过, 只是不干活
// 加入openssl官方的测试实现(.c)后, 如果工程提供了开关宏同名的函数实现, 只需要将对应开关宏关掉, 就可以将官方测试实现编译过.
// --------------------------------------------------------------------------------// 提供默认的 global_init()
#define MY_GLOBAL_INIT // 提供默认的 test_get_options()
#define USE_MY_OPTION_choice// 提供默认的setup_tests()
#define USE_MY_SETUP_TEST// 提供默认的 cleanup_tests()
#define USE_MY_CLEANUP_TEST// 提供默认的 opt_printf_stderr()
#define USE_MY_OPT_PRINT_ERR// --------------------------------------------------------------------------------
// 开关宏 - END
// --------------------------------------------------------------------------------#ifdef  _WIN32
#define MY_SLEEP(x) Sleep(x)
#else
#define MY_SLEEP(x) sleep(x)
#endif /* #ifdef  _WIN32 */#ifdef USE_MY_OPTION_choice#include "testutil.h"// 需要将其他实现中的enum定义拷贝过来
typedef enum OPTION_choice {OPT_CONFIG_FILE = 1,
} OPTION_CHOICE;#endif // #ifdef USE_MY_OPTION_choice#endif /* #ifndef __MY_OPENSSL_LIB_H__ */
/*!
* \file D:\my_dev\my_local_git_prj\study\openSSL\nmake_test\test_c\prj_005_afalgtest.c\my_openSSL_lib.c
*/#include "my_openSSL_lib.h"
#include "opt.h"
#include "testutil.h"
#include "tu_local.h" // for OPT_TEST_OPTIONS_DEFAULT_USAGE
#include "output.h" // for test_vprintf_stderr()#define MY_USE_APPLINK
#ifdef MY_USE_APPLINK
#include <openssl/applink.c> /*! for OPENSSL_Uplink(00007FF8B7EF0FE8,08): no OPENSSL_Applink */
#endif // #ifdef MY_USE_APPLINK#ifdef USE_MY_OPTION_choice
const OPTIONS* test_get_options(void)
{// 这个函数返回不能为空, 从其他有实现的函数中拷贝一个实现过来, 否则有崩溃报错static const OPTIONS test_options[] = {OPT_TEST_OPTIONS_DEFAULT_USAGE,{ "config", OPT_CONFIG_FILE, '<',"The configuration file to use for the libctx" },{ NULL }};return test_options;
}#endif // #ifdef USE_MY_OPTION_choice#ifdef USE_MY_SETUP_TEST
int setup_tests(void)
{return 0;
}# endif // #ifdef USE_MY_CLEANUP_TEST
void cleanup_tests(void)
{
}
#endif // #ifdef USE_MY_CLEANUP_TEST#ifdef USE_MY_OPT_PRINT_ERR
int opt_printf_stderr(const char* fmt, ...)
{va_list ap;int ret;va_start(ap, fmt);ret = test_vprintf_stderr(fmt, ap);va_end(ap);return ret;
}#endif // #ifdef USE_MY_OPT_PRINT_ERR#ifdef MY_GLOBAL_INITint global_init(void)
{
#ifndef OPENSSL_NO_TRACEsetup_trace(getenv("OPENSSL_TRACE"));
#endifreturn 1;
}#endif // #ifdef MY_GLOBAL_INIT

这个工程模板只适合官方测试工程中, 用于测试对外提供的那些API.
如果是官方内部测试的实现, 是编译不过的.
不过, openssl的用户, 基本也就关心外部API怎么用. 从openssl用户的立场出发, 这个工程模板就挺好的.

END

相关文章:

openssl3.2 - 测试程序的学习 - 准备openssl测试专用工程的模板

文章目录 openssl3.2 - 测试程序的学习 - 准备openssl测试专用工程的模板概述笔记工程中需要的openssl的库实现补充 - 最终的模板工程END openssl3.2 - 测试程序的学习 - 准备openssl测试专用工程的模板 概述 openssl3.2 - 测试程序的学习 整了几个test.c, 每开一个新的测试工…...

Delphi.cz采访​Embarcadero​捷克共和国办事处经理:理查德·库巴特 - 第一部分

Embarcadero捷克办事处主任理查德库巴特&#xff08;Richard Kubt&#xff0c;55 岁&#xff09;接受了我的采访。 Radek Červinka (RČ)&#xff1a;库巴特先生您好&#xff0c;感谢您抽出时间访问 delphi.cz。 一开始&#xff1a;我在某处听说您是一名程序员&#xff0c;从…...

AI投资或成科技裁员罪魁祸首

最近的科技裁员让许多人对这个行业的稳定性产生了疑问。然而&#xff0c;仔细观察发现&#xff0c;这些裁员并不是经济困境的迹象&#xff0c;而是科技公司为了重新调整优先事项并投资未来而进行的战略举措。科技行业正投入数十亿美元用于人工智能&#xff08;AI&#xff09;&a…...

解读BEVFormer,新一代自动驾驶视觉工作的基石

文章出处 BEVFormer这篇文章很有划时代的意义&#xff0c;改变了许多视觉领域工作的pipeline[2203.17270] BEVFormer: Learning Birds-Eye-View Representation from Multi-Camera Images via Spatiotemporal Transformers (arxiv.org)https://arxiv.org/abs/2203.17270 BEV …...

【React教程】(1) React简介、React核心概念、React初始化

目录 ReactReact 介绍React 特点React 的发展历史React 与 Vue 的对比技术层面开发团队社区Native APP 开发 相关资源链接 EcmaScript 6 补充React 核心概念组件化虚拟 DOM 起步初始化及安装依赖Hello World React React 介绍 React 是一个用于构建用户界面的渐进式 JavaScrip…...

云计算中的弹性是什么?

云弹性是指当客户需求增加或减少时&#xff0c;自动从数据中心配置和取消配置资源。这使得云资源(包括计算、存储和内存资源)能够根据需求变化快速重新分配。CPU/处理、内存、输入/输出带宽和存储容量等计算资源可以根据需要增加或减少&#xff0c;而不会影响系统性能。 它旨在…...

Vue3基础:pnpm是什么?npm和pnpm的区别?如何使用pnpm?

pnpm 是一个流行的 JavaScript 包管理器&#xff0c;类似于 npm 和 yarn。它是 performant npm 的缩写&#xff0c;意在表明它是一个更高效的 npm 替代品。pnpm 的主要特点和优势包括&#xff1a; 高效的存储空间使用 pnpm 使用称为“内容寻址存储”的机制来存储 npm 包。这意…...

vue中父组件直接调用子组件方法(通过ref)

目录 1、vue2 中&#xff0c;父组件调用子组件的方法 2、vue3 中&#xff0c;父组件调用子组件的方法 1、vue2 中&#xff0c;父组件调用子组件的方法 在Vue 2中&#xff0c;父组件可以通过使用ref属性来引用子组件的实例&#xff0c;然后通过该实例调用子组件的方法。 首先…...

Gunicorn性能优化:提升Python Web应用的服务效率

在Python Web开发中&#xff0c;Gunicorn作为WSGI HTTP服务器&#xff0c;常常作为Web应用&#xff08;如Django或Flask&#xff09;与反向代理或负载均衡器之间的桥梁。为了充分发挥其性能&#xff0c;本文将提供一些实用的Gunicorn配置建议。 Gunicorn架构 Gunicorn采用了预…...

如何使用ssh key免密码登录服务器?

以下是使用密钥对免密码登录服务器的具体指令操作步骤&#xff1a; 步骤一&#xff1a;生成密钥对 在本地电脑上打开终端或命令提示符&#xff0c;运行以下命令生成密钥对&#xff1a; ssh-keygen -t rsa -C "your_emailexample.com" 该命令会提示您选择保存密钥…...

macos Android平台签名证书(.keystore)

一、申请appid的使用说明&#xff08;有appid的请忽略申请appid&#xff09; 创建应用 申请的appid在源码视图填写后会自动生成一个对应的包名 ⚠️注意&#xff1a;申请appid的时候应用名称和项目名称保持一致。 二、 Android如何使用自用证书进行打包 1.找到安装jdk的路径…...

Kotlin快速入门系列2

Kotlin的基本数据类型 Kotlin 的基本数值类型包括 Byte、Short、Int、Long、Float、Double 等。不同于 Java 的是&#xff0c;字符不属于数值类型&#xff0c;是一个独立的数据类型。 Java和kotlin数据类型对照如下&#xff1a; Java基本数据类型 Kotlin对象数据类型 数据类…...

单片机之keil软件环境搭建

简介 Keil提供了包括C编译器、宏汇编、链接器、库管理和一个功能强大的仿真调试器等在内的完整开发方案&#xff0c;通过一个集成开发环境&#xff08;μVision&#xff09;将这些部分组合在一起。     目前软件对中文的支持不友好&#xff0c;不建议安装网上的一些汉化包…...

数学公式OCR识别php 对接mathpix api 使用公式编译器

数学公式OCR识别php 对接mathpix api 一、注册账号官网网址&#xff1a;https://mathpix.com 二、该产品支持多端使用注意说明&#xff08;每月10次&#xff09; 三、api 对接第一步创建create keyphp对接api这里先封装两个请求函数&#xff0c;get 和post &#xff0c;通过官方…...

MySQL原理(二)存储引擎(1)概述

一、存储引擎介绍 1、概念&#xff1a; &#xff08;1&#xff09;MySQL中的数据用各种不下同的技术存储在文件中&#xff0c;每一种技术都使用不同的存储机制、索引技巧、锁定水平并最终提供不同的功能和能力&#xff0c;这些不同的技术以及配套的功能在MySQL中称为存储引擎…...

微信小程序canvas画布如何解决在for循环绘制图像显示不全的问题

如下所示&#xff0c;在for循环中绘制图像&#xff0c;由于onload函数加载图像是异步执行&#xff0c;会导致显示不全所有图片的问题。 for(var a0;a<2;a){ var img canvas.createImage()img.src product_image[items[a]]img.onload ()>{ctx.drawImage(el,0,h,i…...

Python计算机二级/Python期末考试 刷题(一)

收集了一些经典Python计算机二级和Python期末考试题库 整理不易&#xff0c;大家点赞收藏支持一下 祝大家计算机二级和期末考试都高分过 目录 一、填空 二、选择 三、程序设计 一、填空 1.序列元素的编号称为索引&#xff0c;索引值从【1】开始&#xff0c;访问序列元素时将…...

最新GPT4.0使用教程,AI绘画-Midjourney绘画,GPT语音对话使用,DALL-E3文生图+思维导图一站式解决

一、前言 ChatGPT3.5、GPT4.0、GPT语音对话、Midjourney绘画&#xff0c;文档对话总结DALL-E3文生图&#xff0c;相信对大家应该不感到陌生吧&#xff1f;简单来说&#xff0c;GPT-4技术比之前的GPT-3.5相对来说更加智能&#xff0c;会根据用户的要求生成多种内容甚至也可以和…...

【JavaScript】两种方法实现继承

JS继承-ES6-基于 class 实现继承 mdn 类 阮一峰 ES6-class mdn-super ES6中推出了class类,是用来创建对象的模板。 class可以看作是一个语法糖,它的绝大部分功能&#xff0c;ES5 都可以做到&#xff0c;新的class写法只是让对象原型的写法更加清晰、更像面向对象编程的语法而已…...

张维迎《博弈与社会》笔记(3)导论:一些经济学的基础知识

这篇的主要内容介绍了经济学的基础知识吧。 经济学、社会学、心理学的区别 经济学与社会学的区别与共同点 经济学一般是从个人的行为出发解释社会现象&#xff08;from micro to macro&#xff09;。社会学的传统方法则是从社会的角度来解释个人的行为&#xff08;from macro…...

【网络】每天掌握一个Linux命令 - iftop

在Linux系统中&#xff0c;iftop是网络管理的得力助手&#xff0c;能实时监控网络流量、连接情况等&#xff0c;帮助排查网络异常。接下来从多方面详细介绍它。 目录 【网络】每天掌握一个Linux命令 - iftop工具概述安装方式核心功能基础用法进阶操作实战案例面试题场景生产场景…...

cf2117E

原题链接&#xff1a;https://codeforces.com/contest/2117/problem/E 题目背景&#xff1a; 给定两个数组a,b&#xff0c;可以执行多次以下操作&#xff1a;选择 i (1 < i < n - 1)&#xff0c;并设置 或&#xff0c;也可以在执行上述操作前执行一次删除任意 和 。求…...

C++ 基础特性深度解析

目录 引言 一、命名空间&#xff08;namespace&#xff09; C 中的命名空间​ 与 C 语言的对比​ 二、缺省参数​ C 中的缺省参数​ 与 C 语言的对比​ 三、引用&#xff08;reference&#xff09;​ C 中的引用​ 与 C 语言的对比​ 四、inline&#xff08;内联函数…...

JVM暂停(Stop-The-World,STW)的原因分类及对应排查方案

JVM暂停(Stop-The-World,STW)的完整原因分类及对应排查方案,结合JVM运行机制和常见故障场景整理而成: 一、GC相关暂停​​ 1. ​​安全点(Safepoint)阻塞​​ ​​现象​​:JVM暂停但无GC日志,日志显示No GCs detected。​​原因​​:JVM等待所有线程进入安全点(如…...

MySQL账号权限管理指南:安全创建账户与精细授权技巧

在MySQL数据库管理中&#xff0c;合理创建用户账号并分配精确权限是保障数据安全的核心环节。直接使用root账号进行所有操作不仅危险且难以审计操作行为。今天我们来全面解析MySQL账号创建与权限分配的专业方法。 一、为何需要创建独立账号&#xff1f; 最小权限原则&#xf…...

服务器--宝塔命令

一、宝塔面板安装命令 ⚠️ 必须使用 root 用户 或 sudo 权限执行&#xff01; sudo su - 1. CentOS 系统&#xff1a; yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh2. Ubuntu / Debian 系统…...

Fabric V2.5 通用溯源系统——增加图片上传与下载功能

fabric-trace项目在发布一年后,部署量已突破1000次,为支持更多场景,现新增支持图片信息上链,本文对图片上传、下载功能代码进行梳理,包含智能合约、后端、前端部分。 一、智能合约修改 为了增加图片信息上链溯源,需要对底层数据结构进行修改,在此对智能合约中的农产品数…...

基于 TAPD 进行项目管理

起因 自己写了个小工具&#xff0c;仓库用的Github。之前在用markdown进行需求管理&#xff0c;现在随着功能的增加&#xff0c;感觉有点难以管理了&#xff0c;所以用TAPD这个工具进行需求、Bug管理。 操作流程 注册 TAPD&#xff0c;需要提供一个企业名新建一个项目&#…...

20个超级好用的 CSS 动画库

分享 20 个最佳 CSS 动画库。 它们中的大多数将生成纯 CSS 代码&#xff0c;而不需要任何外部库。 1.Animate.css 一个开箱即用型的跨浏览器动画库&#xff0c;可供你在项目中使用。 2.Magic Animations CSS3 一组简单的动画&#xff0c;可以包含在你的网页或应用项目中。 3.An…...

【C++进阶篇】智能指针

C内存管理终极指南&#xff1a;智能指针从入门到源码剖析 一. 智能指针1.1 auto_ptr1.2 unique_ptr1.3 shared_ptr1.4 make_shared 二. 原理三. shared_ptr循环引用问题三. 线程安全问题四. 内存泄漏4.1 什么是内存泄漏4.2 危害4.3 避免内存泄漏 五. 最后 一. 智能指针 智能指…...