2013-05-06 6 views
1

컴파일했습니다 & make install openssl. 그냥 패키지가 올바르게 설치되어 있는지 확인하기 위해 다음 프로그램을 실행하십시오. 그것은 저를 위해 정확하게 달린 &를 집계했다. Means openssl is installed correctly &은 깨진 것이 아닙니다.제거 방법 - openssl 오류

#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]; 
}; 

오류 : - ---

[email protected] ~ $ 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) 

이 오류의 원인을 알려주십시오.

답변

3

OPENSSL_armcap = 0 환경 변수를 설정하여 해당 코드를 비활성화하십시오.

OPENSSL_cpuid_setup의 코드는 SIGILL을 트랩하고 명령을 수행 할 수없는 경우 계속할 수 있다고 가정합니다. gdb에서 계속 진행하면 OPENSSL_cpuid_setup의 처리기가 올바르게 처리되어 올바르게 작동해야합니다.

당신은 일반적으로 (이에 대한) 그런 일이 수 있도록하기 위해 GDB에 다음과 같은 것을 사용합니다 :

핸들이

팀을 통과 SIGILL.

+0

감사합니다 ... SIGILL pass - command & - gdb에서 계속 작업하십시오 - 그러면 프로그램을 단계별로 실행할 수 있습니다 - 환경 변수를 설정하기위한 commad는 무엇입니까? .bashrc 파일? – Katoch

+0

또한 컴파일 할 때이 오류를 비활성화 할 수 있습니다. 즉, MAKE 시간 ..? – Katoch