使用Botan访问违规阅读位置
Access violation reading location using Botan
我已经为 TLS 安全集成了 botan 库。
我收到以下错误:
jsonrpctest.exe 中 0x6DBFD1CE (vcruntime140.dll) 的第一次机会异常:0xC0000005:访问冲突读取位置 0x00962000。
如果有这个异常的处理程序,程序可能会安全地继续
下面是我调用的代码
int main(int argc, char *argv[])
{
// prepare all the parameters
Callbacks callbacks;
Botan::AutoSeeded_RNG rng;
Botan::TLS::Session_Manager_In_Memory session_mgr(rng);
Client_Credentials creds;
Botan::TLS::Strict_Policy policy;
// open the tls connection : Error comes here
Botan::TLS::Client client(callbacks,
session_mgr,
creds,
policy,
rng,
Botan::TLS::Server_Information("10.193.252.14", 43733),
Botan::TLS::Protocol_Version::TLS_V12);
while (!client.is_closed())
{
//cout << client.is_active;
// read data received from the tls server, e.g., using BSD sockets or
boost asio
// ...
// send data to the tls server using client.send_data()
} }
此错误的确切原因未知。我认为可能是某些构建标志是 visual studio。我在我制作的发布版本中遇到了类似的错误,但它在调试版本中工作正常。然后我将它构建为库 (DLL) 而不是应用程序 (.exe),我没有看到任何问题。我认为使用 Botan 的最佳方式是进行合并构建(即不使用 Botan DLL 库,而是将 Botan 代码导入您的应用程序然后使用它)。这是对我有用的构建命令(运行 来自 Botan 源文件夹):
configure.py --cpu=i386 --amalgamation --single-amalgamation-file --minimized-build --enable-modules=tls,x509,seed,rdseed,rdrand,rdrand_rng,auto_rng --disable-shared
在 运行 执行上述命令之前,您需要安装 Python 并位于路径中。
上述命令将在 Botan 源代码目录(即您 运行 上述命令所在的相同路径)中生成以下文件:
botan_all.h、botan_all_internal.h 和 botan_all.cpp
您需要将这些文件包含在您的应用程序代码中,使用并构建它。
关于 Botan 合并构建的更多信息:https://botan.randombit.net/manual/building.html#amalgamation
我已经为 TLS 安全集成了 botan 库。 我收到以下错误:
jsonrpctest.exe 中 0x6DBFD1CE (vcruntime140.dll) 的第一次机会异常:0xC0000005:访问冲突读取位置 0x00962000。 如果有这个异常的处理程序,程序可能会安全地继续
下面是我调用的代码
int main(int argc, char *argv[])
{
// prepare all the parameters
Callbacks callbacks;
Botan::AutoSeeded_RNG rng;
Botan::TLS::Session_Manager_In_Memory session_mgr(rng);
Client_Credentials creds;
Botan::TLS::Strict_Policy policy;
// open the tls connection : Error comes here
Botan::TLS::Client client(callbacks,
session_mgr,
creds,
policy,
rng,
Botan::TLS::Server_Information("10.193.252.14", 43733),
Botan::TLS::Protocol_Version::TLS_V12);
while (!client.is_closed())
{
//cout << client.is_active;
// read data received from the tls server, e.g., using BSD sockets or
boost asio
// ...
// send data to the tls server using client.send_data()
} }
此错误的确切原因未知。我认为可能是某些构建标志是 visual studio。我在我制作的发布版本中遇到了类似的错误,但它在调试版本中工作正常。然后我将它构建为库 (DLL) 而不是应用程序 (.exe),我没有看到任何问题。我认为使用 Botan 的最佳方式是进行合并构建(即不使用 Botan DLL 库,而是将 Botan 代码导入您的应用程序然后使用它)。这是对我有用的构建命令(运行 来自 Botan 源文件夹):
configure.py --cpu=i386 --amalgamation --single-amalgamation-file --minimized-build --enable-modules=tls,x509,seed,rdseed,rdrand,rdrand_rng,auto_rng --disable-shared
在 运行 执行上述命令之前,您需要安装 Python 并位于路径中。 上述命令将在 Botan 源代码目录(即您 运行 上述命令所在的相同路径)中生成以下文件:
botan_all.h、botan_all_internal.h 和 botan_all.cpp
您需要将这些文件包含在您的应用程序代码中,使用并构建它。
关于 Botan 合并构建的更多信息:https://botan.randombit.net/manual/building.html#amalgamation