1.Use OpenSSL as an optional lib;2.Add SHA1 test
This commit is contained in:
parent
1f5ab069f9
commit
649f6f3925
|
@ -47,7 +47,7 @@ endif()
|
|||
find_package (UUID REQUIRED)
|
||||
include_directories(${UUID_INCLUDE_DIR})
|
||||
|
||||
find_package (OpenSSL REQUIRED)
|
||||
find_package (OpenSSL)
|
||||
if(OpenSSL_FOUND)
|
||||
#add_definitions(-DUSE_OPENSSL)
|
||||
set(DR_DEFS "USE_OPENSSL;${DR_DEFS}")
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
link_libraries(drogon trantor uuid pthread jsoncpp dl z)
|
||||
|
||||
if(OpenSSL_FOUND)
|
||||
link_libraries(ssl crypto)
|
||||
endif()
|
||||
add_executable(cache_map_test CacheMapTest.cc)
|
||||
add_executable(cookies_test CookiesTest.cc)
|
||||
add_executable(class_name_test ClassNameTest.cc)
|
||||
add_executable(sha1_test Sha1Test.cc)
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
#ifdef USE_OPENSSL
|
||||
#include <openssl/sha.h>
|
||||
#else
|
||||
#include "../lib/src/Sha1.h"
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
int main()
|
||||
{
|
||||
unsigned char in[]="1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890";
|
||||
unsigned char out[SHA_DIGEST_LENGTH]={0};
|
||||
SHA1(in,100,out);
|
||||
for(int i=0;i<SHA_DIGEST_LENGTH;i++)
|
||||
printf("%02x",out[i]);
|
||||
putchar('\n');
|
||||
}
|
Loading…
Reference in New Issue