openssl 관련 소스 실행이 안됩니다. 도움 꼭 부탁드립니다.
글쓴이: hopeful1213 / 작성시간: 화, 2005/11/15 - 6:18오후
여기저기 도움을 얻어서 아래와 같은 openssl 소스까지 갔습니다.
그런데 계속 런타임 에러만 나네요. (리눅스 소스를 윈도우로 바꿔
서 실행중입니다. 마땅히 질문드릴때가 없어서.. 죄송합니다.)
디버깅 해본 결과는.
// meth = SSLv3_method();
meth = TLSv1_method();
이부분에서 계속 meth 값이 NULL이 나옵니다.
meth = SSLv23_client_method(); 등 여러가지를 써보았는데
도 계속 실행이 안되네여..
컴파일, 링크까지는 진행되었지만 런타임때 에러가 나서 정말 답답합니다.
고수님들 꼭 도움 부탁드립니다.
#include <openssl/rsa.h> /* SSLeay stuff */ #include <openssl/crypto.h> #include <openssl/x509.h> #include <openssl/pem.h> #include <openssl/ssl.h> #include <openssl/err.h> #include <openssl/rand.h> #include <stdio.h> #include <string.h> // OpenSSL library를 사용하기 위해 필요한 초기화 작업을 한다. #define SETUP_OPENSSL { \ OpenSSL_add_all_algorithms(); \ OpenSSL_add_all_ciphers(); \ ERR_load_crypto_strings(); \ static const char rnd_seed[] = "string to make the random number generator think it has entropy"; \ RAND_seed(rnd_seed, sizeof(rnd_seed)); \ } int main() { SETUP_OPENSSL; BIO * bio; SSL * ssl; SSL_CTX * ctx; SSL_METHOD *meth; int p; char * request = "GET / HTTP/1.1\x0D\x0AHost: www.verisign.com\x0D\x0A\x43onnection: Close\x0D\x0A\x0D\x0A"; char r[1024]; char *pathcert = "c:\\OpenSSL\\bin\\cert"; /* Set up the library */ // meth = SSLv3_method(); meth = TLSv1_method(); // create a new SSL_CTX object as framework for TLS/SSL enabled functions ctx = SSL_CTX_new (meth); if (!ctx) { printf("error!!!!\n"); ERR_print_errors_fp(stderr); exit(2); } /* Load the trust store */ if(!SSL_CTX_load_verify_locations(ctx, "c:\\OpenSSL\\bin\\PEM\\ca-cert.pem",NULL)) { printf("error!!!\n"); //fprintf(stderr, "Error loading trust store\n"); //ERR_print_errors_fp(stderr); //SSL_CTX_free(ctx); return 0; }
Forums:
저도 잘은 모르지만 SSL_library_init 도 부르셔야 되지않나여
저도 잘은 모르지만 SSL_library_init 도 부르셔야 되지않나여?
이 함수랑 SSL_load_error_strings 이것도..
그리고 초기화 함수들 에러 체크도 해봐야 할거 같은데여..
권위를 의심할 것,어긋남을 존경할 것,자리잡기를 거부할 것,항상 자신을 재창조할 것 - MIT 미디어랩 -
...
spacelee 님 조언 처럼
SSL_library_init ,SSL_load_error_strings 를 해보았는데도 마찬가지네요.
혹시 프로그램 설정하는 쪽에서 뭔가 있는 건 아닌지요?
Re: ...
ssl 라이브러리에 링크하는 것 말고는 없었던것 같은데..
www.openssl.org에서 가끔 최신 버젼 라이브러리가
에러가 나서 몇몇 이전 버젼을 받아서 설치하고
해보니 됐던 적은 있습니다.
아니면 ssl 라이브러리 콜하는 순서나 에러처리나
그런 문제 인거 같기도 한데..
오라일리 openssl 책을 권장해드리고 싶네요..
권위를 의심할 것,어긋남을 존경할 것,자리잡기를 거부할 것,항상 자신을 재창조할 것 - MIT 미디어랩 -
google신에게 질문하세요. 예제 많이 나옵니다.
google신에게 질문하세요. 예제 많이 나옵니다.
OpenSSL_add_all_algorithms()
OpenSSL_add_all_algorithms()를 SSLeay_add_ssl_algorithm()로 바꿔보세요.
댓글 달기