我已经编译了& make install openssl。只是为了检查是否正确安装了包,我运行以下程序。它汇编了&为我正确运行。 Means openssl is installed correctly
&没有坏。
#include <openssl/engine.h>
#include <openssl/evp.h>
#include <openssl/err.h>
int main(int c, char **v)
{
ERR_load_crypto_strings();
OpenSSL_add_all_algorithms();
ENGINE_load_builtin_engines();
ENGINE_register_all_complete();
puts("Stuff seems okay.");
return 0;
}
(It build okay with "gcc -Wall -lcrypto test.c -o test"
Also run fines )
现在我有程序,它使用openssl库。我在这里得到这个错误。如果正确安装了软件包,那么为什么在运行时会出现错误。我使用的openssl函数是否有一些我错过的依赖:---
openssl需要TOR吗?此链接表示类似的错误: -
https://lists.torproject.org/pipermail/tor-talk/2013-February/027252.html
https://trac.torproject.org/projects/tor/ticket/7215
md5.cpp:---
#include <stdio.h>
#include <openssl/evp.h>
#include "md5.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
Cmd5::Cmd5( void )
{
*m_szDigest = 0;
}
Cmd5::Cmd5( unsigned char *pstr )
{
digest( pstr );
}
Cmd5::~Cmd5()
{
}
///////////////////////////////////////////////////////////////////////////////
// digest
//
char *Cmd5::digest( unsigned char *pstr )
{
EVP_MD_CTX mdctx;
const EVP_MD *md;
unsigned char md_value[EVP_MAX_MD_SIZE];
unsigned int md_len;
OpenSSL_add_all_digests();
md = EVP_get_digestbyname("md5");
EVP_MD_CTX_init( &mdctx );
EVP_DigestInit_ex( &mdctx, md, NULL );
EVP_DigestUpdate( &mdctx, pstr, strlen( (const char *)pstr ) );
EVP_DigestFinal_ex( &mdctx, md_value, &md_len );
EVP_MD_CTX_cleanup( &mdctx );
sprintf( m_szDigest,
"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\0",
md_value[0],md_value[1],md_value[2],md_value[3],md_value[4],md_value[5],md_value[6],md_value[7],
md_value[8],md_value[9],md_value[10],md_value[11],md_value[12],md_value[13],md_value[14],md_value[15] );
return m_szDigest;
}
md5.h:---
#include <openssl/md5.h>
class Cmd5
{
public:
/*!
Default constructor
*/
Cmd5( void );
/*!
Constructor
@param pstr string to encrypt.
*/
Cmd5( unsigned char *pstr );
/*!
Destructor
*/
virtual ~Cmd5();
/*!
Perform MD5
@param pstr string to encrypt.
@return Encrypted data.
*/
char *digest( unsigned char *pstr );
/*!
Perform MD5
@return Encrypted data.
*/
char *getDigest( void ) { return m_szDigest; };
private:
/*!
MD5 data
*/
char m_szDigest[128];
};
错误:----
pi@raspberrypi ~ $ gdb vscpd
gdb: /usr/local/lib/libcrypto.so.1.0.0: no version information available (required by /usr/lib/libpython2.7.so.1.0)
gdb: /usr/local/lib/libssl.so.1.0.0: no version information available (required by /usr/lib/libpython2.7.so.1.0)
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/pi/vscpd...done.
(gdb) break main
Breakpoint 1 at 0xdd30: file vscpd.cpp, line 99.
(gdb) run
Starting program: /home/pi/vscpd
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
Program received signal SIGILL, Illegal instruction.
0x4025f7a0 in _armv7_neon_probe () from /usr/local/lib/libcrypto.so.1.0.0
(gdb) bt
#0 0x4025f7a0 in _armv7_neon_probe () from /usr/local/lib/libcrypto.so.1.0.0
#1 0x4025bdc4 in OPENSSL_cpuid_setup () from /usr/local/lib/libcrypto.so.1.0.0
#2 0x4000f250 in ?? () from /lib/ld-linux-armhf.so.3
#3 0xbefff858 in ?? ()
#4 0xbefff858 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) debug2: client_check_window_change: changed
debug2: channel 0: request window-change confirm 0
(gdb)
请说明导致此错误的原因是什么?
答案 0 :(得分:3)
尝试设置环境变量OPENSSL_armcap = 0以禁用该代码。
OPENSSL_cpuid_setup中的代码假定它可以捕获SIGILL并在无法执行指令时继续。 您可以继续使用gdb,OPENSSL_cpuid_setup中的处理程序应该让它通过 - 这应该可以正常运行。
你通常会(为此)在gdb中使用类似下面的内容来实现这一点:
处理SIGILL传递
添