Merge pull request #3177 from Carbenium/build-deps
Cleanup build system of external dependecies
This commit is contained in:
commit
ae3d1eca54
|
@ -833,13 +833,7 @@ configure_file(zmlinkcontent.sh.in "${CMAKE_CURRENT_BINARY_DIR}/zmlinkcontent.sh
|
||||||
include(Pod2Man)
|
include(Pod2Man)
|
||||||
|
|
||||||
# Process subdirectories
|
# Process subdirectories
|
||||||
|
add_subdirectory(dep)
|
||||||
# build a bcrypt static library
|
|
||||||
set(BUILD_SHARED_LIBS_SAVED "${BUILD_SHARED_LIBS}")
|
|
||||||
set(BUILD_SHARED_LIBS OFF)
|
|
||||||
add_subdirectory(src/libbcrypt EXCLUDE_FROM_ALL)
|
|
||||||
set(BUILD_SHARED_LIBS "${BUILD_SHARED_LIBS_SAVED}")
|
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
add_subdirectory(scripts)
|
add_subdirectory(scripts)
|
||||||
add_subdirectory(db)
|
add_subdirectory(db)
|
||||||
|
|
|
@ -16,11 +16,17 @@ else()
|
||||||
cxx_std_11)
|
cxx_std_11)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Interface to set warning levels on targets
|
# Interface to set warning levels on targets.
|
||||||
# It gets populated in the compiler specific script
|
# It gets populated in the compiler specific script.
|
||||||
add_library(zm-warning-interface INTERFACE)
|
add_library(zm-warning-interface INTERFACE)
|
||||||
|
|
||||||
# An interface used by all other interfaces
|
# Interface which disables all warnings on the target.
|
||||||
|
add_library(zm-no-warning-interface INTERFACE)
|
||||||
|
target_compile_options(zm-no-warning-interface
|
||||||
|
INTERFACE
|
||||||
|
-w)
|
||||||
|
|
||||||
|
# An interface used by all other interfaces.
|
||||||
add_library(zm-default-interface INTERFACE)
|
add_library(zm-default-interface INTERFACE)
|
||||||
target_link_libraries(zm-default-interface
|
target_link_libraries(zm-default-interface
|
||||||
INTERFACE
|
INTERFACE
|
||||||
|
@ -34,3 +40,11 @@ target_link_libraries(zm-core-interface
|
||||||
INTERFACE
|
INTERFACE
|
||||||
zm-default-interface
|
zm-default-interface
|
||||||
zm-warning-interface)
|
zm-warning-interface)
|
||||||
|
|
||||||
|
# An interface which provides the flags and definitions
|
||||||
|
# used by the external dependency targets.
|
||||||
|
add_library(zm-dependency-interface INTERFACE)
|
||||||
|
target_link_libraries(zm-dependency-interface
|
||||||
|
INTERFACE
|
||||||
|
zm-default-interface
|
||||||
|
zm-no-warning-interface)
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
add_subdirectory(jwt-cpp)
|
||||||
|
add_subdirectory(libbcrypt)
|
|
@ -0,0 +1,6 @@
|
||||||
|
add_library(jwt-cpp INTERFACE)
|
||||||
|
add_library(jwt-cpp::jwt-cpp ALIAS jwt-cpp)
|
||||||
|
|
||||||
|
target_include_directories(jwt-cpp
|
||||||
|
INTERFACE
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/include/jwt-cpp)
|
|
@ -0,0 +1,25 @@
|
||||||
|
enable_language(ASM)
|
||||||
|
|
||||||
|
set(BCRYPT_SOURCES
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/bcrypt.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/crypt_blowfish.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/crypt_gensalt.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/wrapper.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/x86.S)
|
||||||
|
|
||||||
|
add_library(bcrypt STATIC ${BCRYPT_SOURCES})
|
||||||
|
add_library(libbcrypt::bcrypt ALIAS bcrypt)
|
||||||
|
|
||||||
|
target_include_directories(bcrypt
|
||||||
|
PUBLIC
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/include/bcrypt)
|
||||||
|
|
||||||
|
target_link_libraries(bcrypt
|
||||||
|
PRIVATE
|
||||||
|
zm-dependency-interface)
|
||||||
|
|
||||||
|
if(BSD)
|
||||||
|
target_compile_definitions(bcrypt
|
||||||
|
PRIVATE
|
||||||
|
__SKIP_GNU)
|
||||||
|
endif()
|
|
@ -1,32 +1,32 @@
|
||||||
#ifndef __BCRYPT__
|
#ifndef __BCRYPT__
|
||||||
#define __BCRYPT__
|
#define __BCRYPT__
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "winbcrypt.h"
|
#include "winbcrypt.h"
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#include "bcrypt.h"
|
#include "bcrypt.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
class BCrypt {
|
class BCrypt {
|
||||||
public:
|
public:
|
||||||
static std::string generateHash(const std::string & password, int workload = 12){
|
static std::string generateHash(const std::string & password, int workload = 12){
|
||||||
char salt[BCRYPT_HASHSIZE];
|
char salt[BCRYPT_HASHSIZE];
|
||||||
char hash[BCRYPT_HASHSIZE];
|
char hash[BCRYPT_HASHSIZE];
|
||||||
int ret;
|
int ret;
|
||||||
ret = bcrypt_gensalt(workload, salt);
|
ret = bcrypt_gensalt(workload, salt);
|
||||||
if(ret != 0)throw std::runtime_error{"bcrypt: can not generate salt"};
|
if(ret != 0)throw std::runtime_error{"bcrypt: can not generate salt"};
|
||||||
ret = bcrypt_hashpw(password.c_str(), salt, hash);
|
ret = bcrypt_hashpw(password.c_str(), salt, hash);
|
||||||
if(ret != 0)throw std::runtime_error{"bcrypt: can not generate hash"};
|
if(ret != 0)throw std::runtime_error{"bcrypt: can not generate hash"};
|
||||||
return std::string{hash};
|
return std::string{hash};
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool validatePassword(const std::string & password, const std::string & hash){
|
static bool validatePassword(const std::string & password, const std::string & hash){
|
||||||
return (bcrypt_checkpw(password.c_str(), hash.c_str()) == 0);
|
return (bcrypt_checkpw(password.c_str(), hash.c_str()) == 0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // __BCRYPT__
|
#endif // __BCRYPT__
|
|
@ -1,43 +1,43 @@
|
||||||
/*
|
/*
|
||||||
* Written by Solar Designer <solar at openwall.com> in 2000-2011.
|
* Written by Solar Designer <solar at openwall.com> in 2000-2011.
|
||||||
* No copyright is claimed, and the software is hereby placed in the public
|
* No copyright is claimed, and the software is hereby placed in the public
|
||||||
* domain. In case this attempt to disclaim copyright and place the software
|
* domain. In case this attempt to disclaim copyright and place the software
|
||||||
* in the public domain is deemed null and void, then the software is
|
* in the public domain is deemed null and void, then the software is
|
||||||
* Copyright (c) 2000-2011 Solar Designer and it is hereby released to the
|
* Copyright (c) 2000-2011 Solar Designer and it is hereby released to the
|
||||||
* general public under the following terms:
|
* general public under the following terms:
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted.
|
* modification, are permitted.
|
||||||
*
|
*
|
||||||
* There's ABSOLUTELY NO WARRANTY, express or implied.
|
* There's ABSOLUTELY NO WARRANTY, express or implied.
|
||||||
*
|
*
|
||||||
* See crypt_blowfish.c for more information.
|
* See crypt_blowfish.c for more information.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _OW_CRYPT_H
|
#ifndef _OW_CRYPT_H
|
||||||
#define _OW_CRYPT_H
|
#define _OW_CRYPT_H
|
||||||
|
|
||||||
#ifndef __GNUC__
|
#ifndef __GNUC__
|
||||||
#undef __const
|
#undef __const
|
||||||
#define __const const
|
#define __const const
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __SKIP_GNU
|
#ifndef __SKIP_GNU
|
||||||
extern char *crypt(__const char *key, __const char *setting);
|
extern char *crypt(__const char *key, __const char *setting);
|
||||||
extern char *crypt_r(__const char *key, __const char *setting, void *data);
|
extern char *crypt_r(__const char *key, __const char *setting, void *data);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __SKIP_OW
|
#ifndef __SKIP_OW
|
||||||
extern char *crypt_rn(__const char *key, __const char *setting,
|
extern char *crypt_rn(__const char *key, __const char *setting,
|
||||||
void *data, int size);
|
void *data, int size);
|
||||||
extern char *crypt_ra(__const char *key, __const char *setting,
|
extern char *crypt_ra(__const char *key, __const char *setting,
|
||||||
void **data, int *size);
|
void **data, int *size);
|
||||||
extern char *crypt_gensalt(__const char *prefix, unsigned long count,
|
extern char *crypt_gensalt(__const char *prefix, unsigned long count,
|
||||||
__const char *input, int size);
|
__const char *input, int size);
|
||||||
extern char *crypt_gensalt_rn(__const char *prefix, unsigned long count,
|
extern char *crypt_gensalt_rn(__const char *prefix, unsigned long count,
|
||||||
__const char *input, int size, char *output, int output_size);
|
__const char *input, int size, char *output, int output_size);
|
||||||
extern char *crypt_gensalt_ra(__const char *prefix, unsigned long count,
|
extern char *crypt_gensalt_ra(__const char *prefix, unsigned long count,
|
||||||
__const char *input, int size);
|
__const char *input, int size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -1,27 +1,27 @@
|
||||||
#ifndef __WIN_BCRYPT__H
|
#ifndef __WIN_BCRYPT__H
|
||||||
#define __WIN_BCRYPT__H
|
#define __WIN_BCRYPT__H
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "crypt_blowfish.h"
|
#include "crypt_blowfish.h"
|
||||||
#include "./bcrypt.h"
|
#include "./bcrypt.h"
|
||||||
|
|
||||||
class BCrypt {
|
class BCrypt {
|
||||||
public:
|
public:
|
||||||
static std::string generateHash(const std::string & password, int workload = 12) {
|
static std::string generateHash(const std::string & password, int workload = 12) {
|
||||||
char salt[BCRYPT_HASHSIZE];
|
char salt[BCRYPT_HASHSIZE];
|
||||||
char hash[BCRYPT_HASHSIZE];
|
char hash[BCRYPT_HASHSIZE];
|
||||||
int ret;
|
int ret;
|
||||||
ret = bcrypt_gensalt(workload, salt);
|
ret = bcrypt_gensalt(workload, salt);
|
||||||
if (ret != 0)throw std::runtime_error{ "bcrypt: can not generate salt" };
|
if (ret != 0)throw std::runtime_error{ "bcrypt: can not generate salt" };
|
||||||
ret = bcrypt_hashpw(password.c_str(), salt, hash);
|
ret = bcrypt_hashpw(password.c_str(), salt, hash);
|
||||||
if (ret != 0)throw std::runtime_error{ "bcrypt: can not generate hash" };
|
if (ret != 0)throw std::runtime_error{ "bcrypt: can not generate hash" };
|
||||||
return std::string{ hash };
|
return std::string{ hash };
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool validatePassword(const std::string & password, const std::string & hash) {
|
static bool validatePassword(const std::string & password, const std::string & hash) {
|
||||||
return (bcrypt_checkpw(password.c_str(), hash.c_str()) == 0);
|
return (bcrypt_checkpw(password.c_str(), hash.c_str()) == 0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -1,230 +1,230 @@
|
||||||
/*
|
/*
|
||||||
* bcrypt wrapper library
|
* bcrypt wrapper library
|
||||||
*
|
*
|
||||||
* Written in 2011, 2013, 2014, 2015 by Ricardo Garcia <r@rg3.name>
|
* Written in 2011, 2013, 2014, 2015 by Ricardo Garcia <r@rg3.name>
|
||||||
*
|
*
|
||||||
* To the extent possible under law, the author(s) have dedicated all copyright
|
* To the extent possible under law, the author(s) have dedicated all copyright
|
||||||
* and related and neighboring rights to this software to the public domain
|
* and related and neighboring rights to this software to the public domain
|
||||||
* worldwide. This software is distributed without any warranty.
|
* worldwide. This software is distributed without any warranty.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the CC0 Public Domain Dedication along
|
* You should have received a copy of the CC0 Public Domain Dedication along
|
||||||
* with this software. If not, see
|
* with this software. If not, see
|
||||||
* <http://creativecommons.org/publicdomain/zero/1.0/>.
|
* <http://creativecommons.org/publicdomain/zero/1.0/>.
|
||||||
*/
|
*/
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#elif _WIN64
|
#elif _WIN64
|
||||||
#else
|
#else
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(_WIN64)
|
#if defined(_WIN32) || defined(_WIN64)
|
||||||
// On windows we need to generate random bytes differently.
|
// On windows we need to generate random bytes differently.
|
||||||
typedef __int64 ssize_t;
|
typedef __int64 ssize_t;
|
||||||
#define BCRYPT_HASHSIZE 60
|
#define BCRYPT_HASHSIZE 60
|
||||||
|
|
||||||
#include "../include/bcrypt/bcrypt.h"
|
#include "../include/bcrypt/bcrypt.h"
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <wincrypt.h> /* CryptAcquireContext, CryptGenRandom */
|
#include <wincrypt.h> /* CryptAcquireContext, CryptGenRandom */
|
||||||
#else
|
#else
|
||||||
#include "bcrypt.h"
|
#include "bcrypt.h"
|
||||||
#include "ow-crypt.h"
|
#include "ow-crypt.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define RANDBYTES (16)
|
#define RANDBYTES (16)
|
||||||
|
|
||||||
static int try_close(int fd)
|
static int try_close(int fd)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
ret = close(fd);
|
ret = close(fd);
|
||||||
if (ret == -1 && errno == EINTR)
|
if (ret == -1 && errno == EINTR)
|
||||||
continue;
|
continue;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int try_read(int fd, char *out, size_t count)
|
static int try_read(int fd, char *out, size_t count)
|
||||||
{
|
{
|
||||||
size_t total;
|
size_t total;
|
||||||
ssize_t partial;
|
ssize_t partial;
|
||||||
|
|
||||||
total = 0;
|
total = 0;
|
||||||
while (total < count)
|
while (total < count)
|
||||||
{
|
{
|
||||||
for (;;) {
|
for (;;) {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
partial = read(fd, out + total, count - total);
|
partial = read(fd, out + total, count - total);
|
||||||
if (partial == -1 && errno == EINTR)
|
if (partial == -1 && errno == EINTR)
|
||||||
continue;
|
continue;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (partial < 1)
|
if (partial < 1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
total += partial;
|
total += partial;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is a best effort implementation. Nothing prevents a compiler from
|
* This is a best effort implementation. Nothing prevents a compiler from
|
||||||
* optimizing this function and making it vulnerable to timing attacks, but
|
* optimizing this function and making it vulnerable to timing attacks, but
|
||||||
* this method is commonly used in crypto libraries like NaCl.
|
* this method is commonly used in crypto libraries like NaCl.
|
||||||
*
|
*
|
||||||
* Return value is zero if both strings are equal and nonzero otherwise.
|
* Return value is zero if both strings are equal and nonzero otherwise.
|
||||||
*/
|
*/
|
||||||
static int timing_safe_strcmp(const char *str1, const char *str2)
|
static int timing_safe_strcmp(const char *str1, const char *str2)
|
||||||
{
|
{
|
||||||
const unsigned char *u1;
|
const unsigned char *u1;
|
||||||
const unsigned char *u2;
|
const unsigned char *u2;
|
||||||
int ret;
|
int ret;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
int len1 = strlen(str1);
|
int len1 = strlen(str1);
|
||||||
int len2 = strlen(str2);
|
int len2 = strlen(str2);
|
||||||
|
|
||||||
/* In our context both strings should always have the same length
|
/* In our context both strings should always have the same length
|
||||||
* because they will be hashed passwords. */
|
* because they will be hashed passwords. */
|
||||||
if (len1 != len2)
|
if (len1 != len2)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/* Force unsigned for bitwise operations. */
|
/* Force unsigned for bitwise operations. */
|
||||||
u1 = (const unsigned char *)str1;
|
u1 = (const unsigned char *)str1;
|
||||||
u2 = (const unsigned char *)str2;
|
u2 = (const unsigned char *)str2;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
for (i = 0; i < len1; ++i)
|
for (i = 0; i < len1; ++i)
|
||||||
ret |= (u1[i] ^ u2[i]);
|
ret |= (u1[i] ^ u2[i]);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bcrypt_gensalt(int factor, char salt[BCRYPT_HASHSIZE])
|
int bcrypt_gensalt(int factor, char salt[BCRYPT_HASHSIZE])
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
char input[RANDBYTES];
|
char input[RANDBYTES];
|
||||||
int workf;
|
int workf;
|
||||||
char *aux;
|
char *aux;
|
||||||
|
|
||||||
// Note: Windows does not have /dev/urandom sadly.
|
// Note: Windows does not have /dev/urandom sadly.
|
||||||
#if defined(_WIN32) || defined(_WIN64)
|
#if defined(_WIN32) || defined(_WIN64)
|
||||||
HCRYPTPROV p;
|
HCRYPTPROV p;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
|
||||||
// Acquire a crypt context for generating random bytes.
|
// Acquire a crypt context for generating random bytes.
|
||||||
if (CryptAcquireContext(&p, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT) == FALSE) {
|
if (CryptAcquireContext(&p, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT) == FALSE) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CryptGenRandom(p, RANDBYTES, (BYTE*)input) == FALSE) {
|
if (CryptGenRandom(p, RANDBYTES, (BYTE*)input) == FALSE) {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CryptReleaseContext(p, 0) == FALSE) {
|
if (CryptReleaseContext(p, 0) == FALSE) {
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// Get random bytes on Unix/Linux.
|
// Get random bytes on Unix/Linux.
|
||||||
fd = open("/dev/urandom", O_RDONLY);
|
fd = open("/dev/urandom", O_RDONLY);
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (try_read(fd, input, RANDBYTES) != 0) {
|
if (try_read(fd, input, RANDBYTES) != 0) {
|
||||||
if (try_close(fd) != 0)
|
if (try_close(fd) != 0)
|
||||||
return 4;
|
return 4;
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (try_close(fd) != 0)
|
if (try_close(fd) != 0)
|
||||||
return 3;
|
return 3;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Generate salt. */
|
/* Generate salt. */
|
||||||
workf = (factor < 4 || factor > 31)?12:factor;
|
workf = (factor < 4 || factor > 31)?12:factor;
|
||||||
aux = crypt_gensalt_rn("$2a$", workf, input, RANDBYTES,
|
aux = crypt_gensalt_rn("$2a$", workf, input, RANDBYTES,
|
||||||
salt, BCRYPT_HASHSIZE);
|
salt, BCRYPT_HASHSIZE);
|
||||||
return (aux == NULL)?5:0;
|
return (aux == NULL)?5:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bcrypt_hashpw(const char *passwd, const char salt[BCRYPT_HASHSIZE], char hash[BCRYPT_HASHSIZE])
|
int bcrypt_hashpw(const char *passwd, const char salt[BCRYPT_HASHSIZE], char hash[BCRYPT_HASHSIZE])
|
||||||
{
|
{
|
||||||
char *aux;
|
char *aux;
|
||||||
aux = crypt_rn(passwd, salt, hash, BCRYPT_HASHSIZE);
|
aux = crypt_rn(passwd, salt, hash, BCRYPT_HASHSIZE);
|
||||||
return (aux == NULL)?1:0;
|
return (aux == NULL)?1:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bcrypt_checkpw(const char *passwd, const char hash[BCRYPT_HASHSIZE])
|
int bcrypt_checkpw(const char *passwd, const char hash[BCRYPT_HASHSIZE])
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
char outhash[BCRYPT_HASHSIZE];
|
char outhash[BCRYPT_HASHSIZE];
|
||||||
|
|
||||||
ret = bcrypt_hashpw(passwd, hash, outhash);
|
ret = bcrypt_hashpw(passwd, hash, outhash);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return timing_safe_strcmp(hash, outhash);
|
return timing_safe_strcmp(hash, outhash);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TEST_BCRYPT
|
#ifdef TEST_BCRYPT
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
clock_t before;
|
clock_t before;
|
||||||
clock_t after;
|
clock_t after;
|
||||||
char salt[BCRYPT_HASHSIZE];
|
char salt[BCRYPT_HASHSIZE];
|
||||||
char hash[BCRYPT_HASHSIZE];
|
char hash[BCRYPT_HASHSIZE];
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
const char pass[] = "hi,mom";
|
const char pass[] = "hi,mom";
|
||||||
const char hash1[] = "$2a$10$VEVmGHy4F4XQMJ3eOZJAUeb.MedU0W10pTPCuf53eHdKJPiSE8sMK";
|
const char hash1[] = "$2a$10$VEVmGHy4F4XQMJ3eOZJAUeb.MedU0W10pTPCuf53eHdKJPiSE8sMK";
|
||||||
const char hash2[] = "$2a$10$3F0BVk5t8/aoS.3ddaB3l.fxg5qvafQ9NybxcpXLzMeAt.nVWn.NO";
|
const char hash2[] = "$2a$10$3F0BVk5t8/aoS.3ddaB3l.fxg5qvafQ9NybxcpXLzMeAt.nVWn.NO";
|
||||||
|
|
||||||
ret = bcrypt_gensalt(12, salt);
|
ret = bcrypt_gensalt(12, salt);
|
||||||
assert(ret == 0);
|
assert(ret == 0);
|
||||||
printf("Generated salt: %s\n", salt);
|
printf("Generated salt: %s\n", salt);
|
||||||
before = clock();
|
before = clock();
|
||||||
ret = bcrypt_hashpw("testtesttest", salt, hash);
|
ret = bcrypt_hashpw("testtesttest", salt, hash);
|
||||||
assert(ret == 0);
|
assert(ret == 0);
|
||||||
after = clock();
|
after = clock();
|
||||||
printf("Hashed password: %s\n", hash);
|
printf("Hashed password: %s\n", hash);
|
||||||
printf("Time taken: %f seconds\n",
|
printf("Time taken: %f seconds\n",
|
||||||
(double)(after - before) / CLOCKS_PER_SEC);
|
(double)(after - before) / CLOCKS_PER_SEC);
|
||||||
|
|
||||||
ret = bcrypt_hashpw(pass, hash1, hash);
|
ret = bcrypt_hashpw(pass, hash1, hash);
|
||||||
assert(ret == 0);
|
assert(ret == 0);
|
||||||
printf("First hash check: %s\n", (strcmp(hash1, hash) == 0)?"OK":"FAIL");
|
printf("First hash check: %s\n", (strcmp(hash1, hash) == 0)?"OK":"FAIL");
|
||||||
ret = bcrypt_hashpw(pass, hash2, hash);
|
ret = bcrypt_hashpw(pass, hash2, hash);
|
||||||
assert(ret == 0);
|
assert(ret == 0);
|
||||||
printf("Second hash check: %s\n", (strcmp(hash2, hash) == 0)?"OK":"FAIL");
|
printf("Second hash check: %s\n", (strcmp(hash2, hash) == 0)?"OK":"FAIL");
|
||||||
|
|
||||||
before = clock();
|
before = clock();
|
||||||
ret = (bcrypt_checkpw(pass, hash1) == 0);
|
ret = (bcrypt_checkpw(pass, hash1) == 0);
|
||||||
after = clock();
|
after = clock();
|
||||||
printf("First hash check with bcrypt_checkpw: %s\n", ret?"OK":"FAIL");
|
printf("First hash check with bcrypt_checkpw: %s\n", ret?"OK":"FAIL");
|
||||||
printf("Time taken: %f seconds\n",
|
printf("Time taken: %f seconds\n",
|
||||||
(double)(after - before) / CLOCKS_PER_SEC);
|
(double)(after - before) / CLOCKS_PER_SEC);
|
||||||
|
|
||||||
before = clock();
|
before = clock();
|
||||||
ret = (bcrypt_checkpw(pass, hash2) == 0);
|
ret = (bcrypt_checkpw(pass, hash2) == 0);
|
||||||
after = clock();
|
after = clock();
|
||||||
printf("Second hash check with bcrypt_checkpw: %s\n", ret?"OK":"FAIL");
|
printf("Second hash check with bcrypt_checkpw: %s\n", ret?"OK":"FAIL");
|
||||||
printf("Time taken: %f seconds\n",
|
printf("Time taken: %f seconds\n",
|
||||||
(double)(after - before) / CLOCKS_PER_SEC);
|
(double)(after - before) / CLOCKS_PER_SEC);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -1,128 +1,128 @@
|
||||||
/*
|
/*
|
||||||
* Written by Solar Designer <solar at openwall.com> in 2000-2011.
|
* Written by Solar Designer <solar at openwall.com> in 2000-2011.
|
||||||
* No copyright is claimed, and the software is hereby placed in the public
|
* No copyright is claimed, and the software is hereby placed in the public
|
||||||
* domain. In case this attempt to disclaim copyright and place the software
|
* domain. In case this attempt to disclaim copyright and place the software
|
||||||
* in the public domain is deemed null and void, then the software is
|
* in the public domain is deemed null and void, then the software is
|
||||||
* Copyright (c) 2000-2011 Solar Designer and it is hereby released to the
|
* Copyright (c) 2000-2011 Solar Designer and it is hereby released to the
|
||||||
* general public under the following terms:
|
* general public under the following terms:
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted.
|
* modification, are permitted.
|
||||||
*
|
*
|
||||||
* There's ABSOLUTELY NO WARRANTY, express or implied.
|
* There's ABSOLUTELY NO WARRANTY, express or implied.
|
||||||
*
|
*
|
||||||
* See crypt_blowfish.c for more information.
|
* See crypt_blowfish.c for more information.
|
||||||
*
|
*
|
||||||
* This file contains salt generation functions for the traditional and
|
* This file contains salt generation functions for the traditional and
|
||||||
* other common crypt(3) algorithms, except for bcrypt which is defined
|
* other common crypt(3) algorithms, except for bcrypt which is defined
|
||||||
* entirely in crypt_blowfish.c.
|
* entirely in crypt_blowfish.c.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#ifndef __set_errno
|
#ifndef __set_errno
|
||||||
#define __set_errno(val) errno = (val)
|
#define __set_errno(val) errno = (val)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Just to make sure the prototypes match the actual definitions */
|
/* Just to make sure the prototypes match the actual definitions */
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "../include/bcrypt/crypt_gensalt.h"
|
#include "../include/bcrypt/crypt_gensalt.h"
|
||||||
#else
|
#else
|
||||||
#include "crypt_gensalt.h"
|
#include "crypt_gensalt.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
unsigned char _crypt_itoa64[64 + 1] =
|
unsigned char _crypt_itoa64[64 + 1] =
|
||||||
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||||
|
|
||||||
char *_crypt_gensalt_traditional_rn(const char *prefix, unsigned long count,
|
char *_crypt_gensalt_traditional_rn(const char *prefix, unsigned long count,
|
||||||
const char *input, int size, char *output, int output_size)
|
const char *input, int size, char *output, int output_size)
|
||||||
{
|
{
|
||||||
(void) prefix;
|
(void) prefix;
|
||||||
|
|
||||||
if (size < 2 || output_size < 2 + 1 || (count && count != 25)) {
|
if (size < 2 || output_size < 2 + 1 || (count && count != 25)) {
|
||||||
if (output_size > 0) output[0] = '\0';
|
if (output_size > 0) output[0] = '\0';
|
||||||
__set_errno((output_size < 2 + 1) ? ERANGE : EINVAL);
|
__set_errno((output_size < 2 + 1) ? ERANGE : EINVAL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
output[0] = _crypt_itoa64[(unsigned int)input[0] & 0x3f];
|
output[0] = _crypt_itoa64[(unsigned int)input[0] & 0x3f];
|
||||||
output[1] = _crypt_itoa64[(unsigned int)input[1] & 0x3f];
|
output[1] = _crypt_itoa64[(unsigned int)input[1] & 0x3f];
|
||||||
output[2] = '\0';
|
output[2] = '\0';
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *_crypt_gensalt_extended_rn(const char *prefix, unsigned long count,
|
char *_crypt_gensalt_extended_rn(const char *prefix, unsigned long count,
|
||||||
const char *input, int size, char *output, int output_size)
|
const char *input, int size, char *output, int output_size)
|
||||||
{
|
{
|
||||||
unsigned long value;
|
unsigned long value;
|
||||||
|
|
||||||
(void) prefix;
|
(void) prefix;
|
||||||
|
|
||||||
/* Even iteration counts make it easier to detect weak DES keys from a look
|
/* Even iteration counts make it easier to detect weak DES keys from a look
|
||||||
* at the hash, so they should be avoided */
|
* at the hash, so they should be avoided */
|
||||||
if (size < 3 || output_size < 1 + 4 + 4 + 1 ||
|
if (size < 3 || output_size < 1 + 4 + 4 + 1 ||
|
||||||
(count && (count > 0xffffff || !(count & 1)))) {
|
(count && (count > 0xffffff || !(count & 1)))) {
|
||||||
if (output_size > 0) output[0] = '\0';
|
if (output_size > 0) output[0] = '\0';
|
||||||
__set_errno((output_size < 1 + 4 + 4 + 1) ? ERANGE : EINVAL);
|
__set_errno((output_size < 1 + 4 + 4 + 1) ? ERANGE : EINVAL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!count) count = 725;
|
if (!count) count = 725;
|
||||||
|
|
||||||
output[0] = '_';
|
output[0] = '_';
|
||||||
output[1] = _crypt_itoa64[count & 0x3f];
|
output[1] = _crypt_itoa64[count & 0x3f];
|
||||||
output[2] = _crypt_itoa64[(count >> 6) & 0x3f];
|
output[2] = _crypt_itoa64[(count >> 6) & 0x3f];
|
||||||
output[3] = _crypt_itoa64[(count >> 12) & 0x3f];
|
output[3] = _crypt_itoa64[(count >> 12) & 0x3f];
|
||||||
output[4] = _crypt_itoa64[(count >> 18) & 0x3f];
|
output[4] = _crypt_itoa64[(count >> 18) & 0x3f];
|
||||||
value = (unsigned long)(unsigned char)input[0] |
|
value = (unsigned long)(unsigned char)input[0] |
|
||||||
((unsigned long)(unsigned char)input[1] << 8) |
|
((unsigned long)(unsigned char)input[1] << 8) |
|
||||||
((unsigned long)(unsigned char)input[2] << 16);
|
((unsigned long)(unsigned char)input[2] << 16);
|
||||||
output[5] = _crypt_itoa64[value & 0x3f];
|
output[5] = _crypt_itoa64[value & 0x3f];
|
||||||
output[6] = _crypt_itoa64[(value >> 6) & 0x3f];
|
output[6] = _crypt_itoa64[(value >> 6) & 0x3f];
|
||||||
output[7] = _crypt_itoa64[(value >> 12) & 0x3f];
|
output[7] = _crypt_itoa64[(value >> 12) & 0x3f];
|
||||||
output[8] = _crypt_itoa64[(value >> 18) & 0x3f];
|
output[8] = _crypt_itoa64[(value >> 18) & 0x3f];
|
||||||
output[9] = '\0';
|
output[9] = '\0';
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *_crypt_gensalt_md5_rn(const char *prefix, unsigned long count,
|
char *_crypt_gensalt_md5_rn(const char *prefix, unsigned long count,
|
||||||
const char *input, int size, char *output, int output_size)
|
const char *input, int size, char *output, int output_size)
|
||||||
{
|
{
|
||||||
unsigned long value;
|
unsigned long value;
|
||||||
|
|
||||||
(void) prefix;
|
(void) prefix;
|
||||||
|
|
||||||
if (size < 3 || output_size < 3 + 4 + 1 || (count && count != 1000)) {
|
if (size < 3 || output_size < 3 + 4 + 1 || (count && count != 1000)) {
|
||||||
if (output_size > 0) output[0] = '\0';
|
if (output_size > 0) output[0] = '\0';
|
||||||
__set_errno((output_size < 3 + 4 + 1) ? ERANGE : EINVAL);
|
__set_errno((output_size < 3 + 4 + 1) ? ERANGE : EINVAL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
output[0] = '$';
|
output[0] = '$';
|
||||||
output[1] = '1';
|
output[1] = '1';
|
||||||
output[2] = '$';
|
output[2] = '$';
|
||||||
value = (unsigned long)(unsigned char)input[0] |
|
value = (unsigned long)(unsigned char)input[0] |
|
||||||
((unsigned long)(unsigned char)input[1] << 8) |
|
((unsigned long)(unsigned char)input[1] << 8) |
|
||||||
((unsigned long)(unsigned char)input[2] << 16);
|
((unsigned long)(unsigned char)input[2] << 16);
|
||||||
output[3] = _crypt_itoa64[value & 0x3f];
|
output[3] = _crypt_itoa64[value & 0x3f];
|
||||||
output[4] = _crypt_itoa64[(value >> 6) & 0x3f];
|
output[4] = _crypt_itoa64[(value >> 6) & 0x3f];
|
||||||
output[5] = _crypt_itoa64[(value >> 12) & 0x3f];
|
output[5] = _crypt_itoa64[(value >> 12) & 0x3f];
|
||||||
output[6] = _crypt_itoa64[(value >> 18) & 0x3f];
|
output[6] = _crypt_itoa64[(value >> 18) & 0x3f];
|
||||||
output[7] = '\0';
|
output[7] = '\0';
|
||||||
|
|
||||||
if (size >= 6 && output_size >= 3 + 4 + 4 + 1) {
|
if (size >= 6 && output_size >= 3 + 4 + 4 + 1) {
|
||||||
value = (unsigned long)(unsigned char)input[3] |
|
value = (unsigned long)(unsigned char)input[3] |
|
||||||
((unsigned long)(unsigned char)input[4] << 8) |
|
((unsigned long)(unsigned char)input[4] << 8) |
|
||||||
((unsigned long)(unsigned char)input[5] << 16);
|
((unsigned long)(unsigned char)input[5] << 16);
|
||||||
output[7] = _crypt_itoa64[value & 0x3f];
|
output[7] = _crypt_itoa64[value & 0x3f];
|
||||||
output[8] = _crypt_itoa64[(value >> 6) & 0x3f];
|
output[8] = _crypt_itoa64[(value >> 6) & 0x3f];
|
||||||
output[9] = _crypt_itoa64[(value >> 12) & 0x3f];
|
output[9] = _crypt_itoa64[(value >> 12) & 0x3f];
|
||||||
output[10] = _crypt_itoa64[(value >> 18) & 0x3f];
|
output[10] = _crypt_itoa64[(value >> 18) & 0x3f];
|
||||||
output[11] = '\0';
|
output[11] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,41 +1,41 @@
|
||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 15
|
# Visual Studio 15
|
||||||
VisualStudioVersion = 15.0.28307.136
|
VisualStudioVersion = 15.0.28307.136
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbcrypt", "libbcrypt.vcxproj", "{D6A9A3F3-1312-4494-85B8-7CE7DD4D78F4}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbcrypt", "libbcrypt.vcxproj", "{D6A9A3F3-1312-4494-85B8-7CE7DD4D78F4}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "..\test\test.vcxproj", "{C6B1CF6E-88DF-4109-9EF4-06CBA5BD5B68}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "..\test\test.vcxproj", "{C6B1CF6E-88DF-4109-9EF4-06CBA5BD5B68}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|x64 = Debug|x64
|
Debug|x64 = Debug|x64
|
||||||
Debug|x86 = Debug|x86
|
Debug|x86 = Debug|x86
|
||||||
Release|x64 = Release|x64
|
Release|x64 = Release|x64
|
||||||
Release|x86 = Release|x86
|
Release|x86 = Release|x86
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{D6A9A3F3-1312-4494-85B8-7CE7DD4D78F4}.Debug|x64.ActiveCfg = Debug|x64
|
{D6A9A3F3-1312-4494-85B8-7CE7DD4D78F4}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{D6A9A3F3-1312-4494-85B8-7CE7DD4D78F4}.Debug|x64.Build.0 = Debug|x64
|
{D6A9A3F3-1312-4494-85B8-7CE7DD4D78F4}.Debug|x64.Build.0 = Debug|x64
|
||||||
{D6A9A3F3-1312-4494-85B8-7CE7DD4D78F4}.Debug|x86.ActiveCfg = Debug|Win32
|
{D6A9A3F3-1312-4494-85B8-7CE7DD4D78F4}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
{D6A9A3F3-1312-4494-85B8-7CE7DD4D78F4}.Debug|x86.Build.0 = Debug|Win32
|
{D6A9A3F3-1312-4494-85B8-7CE7DD4D78F4}.Debug|x86.Build.0 = Debug|Win32
|
||||||
{D6A9A3F3-1312-4494-85B8-7CE7DD4D78F4}.Release|x64.ActiveCfg = Release|x64
|
{D6A9A3F3-1312-4494-85B8-7CE7DD4D78F4}.Release|x64.ActiveCfg = Release|x64
|
||||||
{D6A9A3F3-1312-4494-85B8-7CE7DD4D78F4}.Release|x64.Build.0 = Release|x64
|
{D6A9A3F3-1312-4494-85B8-7CE7DD4D78F4}.Release|x64.Build.0 = Release|x64
|
||||||
{D6A9A3F3-1312-4494-85B8-7CE7DD4D78F4}.Release|x86.ActiveCfg = Release|Win32
|
{D6A9A3F3-1312-4494-85B8-7CE7DD4D78F4}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{D6A9A3F3-1312-4494-85B8-7CE7DD4D78F4}.Release|x86.Build.0 = Release|Win32
|
{D6A9A3F3-1312-4494-85B8-7CE7DD4D78F4}.Release|x86.Build.0 = Release|Win32
|
||||||
{C6B1CF6E-88DF-4109-9EF4-06CBA5BD5B68}.Debug|x64.ActiveCfg = Debug|x64
|
{C6B1CF6E-88DF-4109-9EF4-06CBA5BD5B68}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{C6B1CF6E-88DF-4109-9EF4-06CBA5BD5B68}.Debug|x64.Build.0 = Debug|x64
|
{C6B1CF6E-88DF-4109-9EF4-06CBA5BD5B68}.Debug|x64.Build.0 = Debug|x64
|
||||||
{C6B1CF6E-88DF-4109-9EF4-06CBA5BD5B68}.Debug|x86.ActiveCfg = Debug|Win32
|
{C6B1CF6E-88DF-4109-9EF4-06CBA5BD5B68}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
{C6B1CF6E-88DF-4109-9EF4-06CBA5BD5B68}.Debug|x86.Build.0 = Debug|Win32
|
{C6B1CF6E-88DF-4109-9EF4-06CBA5BD5B68}.Debug|x86.Build.0 = Debug|Win32
|
||||||
{C6B1CF6E-88DF-4109-9EF4-06CBA5BD5B68}.Release|x64.ActiveCfg = Release|x64
|
{C6B1CF6E-88DF-4109-9EF4-06CBA5BD5B68}.Release|x64.ActiveCfg = Release|x64
|
||||||
{C6B1CF6E-88DF-4109-9EF4-06CBA5BD5B68}.Release|x64.Build.0 = Release|x64
|
{C6B1CF6E-88DF-4109-9EF4-06CBA5BD5B68}.Release|x64.Build.0 = Release|x64
|
||||||
{C6B1CF6E-88DF-4109-9EF4-06CBA5BD5B68}.Release|x86.ActiveCfg = Release|Win32
|
{C6B1CF6E-88DF-4109-9EF4-06CBA5BD5B68}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{C6B1CF6E-88DF-4109-9EF4-06CBA5BD5B68}.Release|x86.Build.0 = Release|Win32
|
{C6B1CF6E-88DF-4109-9EF4-06CBA5BD5B68}.Release|x86.Build.0 = Release|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {2DB786F9-9679-4A72-A4A0-2544E42B78CB}
|
SolutionGuid = {2DB786F9-9679-4A72-A4A0-2544E42B78CB}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
|
@ -1,135 +1,135 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
<Platform>Win32</Platform>
|
<Platform>Win32</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
<Configuration>Release</Configuration>
|
<Configuration>Release</Configuration>
|
||||||
<Platform>Win32</Platform>
|
<Platform>Win32</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Debug|x64">
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
<Platform>x64</Platform>
|
<Platform>x64</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Release|x64">
|
<ProjectConfiguration Include="Release|x64">
|
||||||
<Configuration>Release</Configuration>
|
<Configuration>Release</Configuration>
|
||||||
<Platform>x64</Platform>
|
<Platform>x64</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<VCProjectVersion>15.0</VCProjectVersion>
|
<VCProjectVersion>15.0</VCProjectVersion>
|
||||||
<ProjectGuid>{D6A9A3F3-1312-4494-85B8-7CE7DD4D78F4}</ProjectGuid>
|
<ProjectGuid>{D6A9A3F3-1312-4494-85B8-7CE7DD4D78F4}</ProjectGuid>
|
||||||
<RootNamespace>libbcrypt</RootNamespace>
|
<RootNamespace>libbcrypt</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="Shared">
|
<ImportGroup Label="Shared">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\src\bcrypt.c" />
|
<ClCompile Include="..\..\src\bcrypt.c" />
|
||||||
<ClCompile Include="..\..\src\crypt_blowfish.c" />
|
<ClCompile Include="..\..\src\crypt_blowfish.c" />
|
||||||
<ClCompile Include="..\..\src\crypt_gensalt.c" />
|
<ClCompile Include="..\..\src\crypt_gensalt.c" />
|
||||||
<ClCompile Include="..\..\src\wrapper.c" />
|
<ClCompile Include="..\..\src\wrapper.c" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\include\bcrypt\bcrypt.h" />
|
<ClInclude Include="..\..\include\bcrypt\bcrypt.h" />
|
||||||
<ClInclude Include="..\..\include\bcrypt\BCrypt.hpp" />
|
<ClInclude Include="..\..\include\bcrypt\BCrypt.hpp" />
|
||||||
<ClInclude Include="..\..\include\bcrypt\crypt.h" />
|
<ClInclude Include="..\..\include\bcrypt\crypt.h" />
|
||||||
<ClInclude Include="..\..\include\bcrypt\crypt_blowfish.h" />
|
<ClInclude Include="..\..\include\bcrypt\crypt_blowfish.h" />
|
||||||
<ClInclude Include="..\..\include\bcrypt\crypt_gensalt.h" />
|
<ClInclude Include="..\..\include\bcrypt\crypt_gensalt.h" />
|
||||||
<ClInclude Include="..\..\include\bcrypt\ow-crypt.h" />
|
<ClInclude Include="..\..\include\bcrypt\ow-crypt.h" />
|
||||||
<ClInclude Include="..\..\include\bcrypt\winbcrypt.h" />
|
<ClInclude Include="..\..\include\bcrypt\winbcrypt.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -1,54 +1,54 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Filter Include="Source Files">
|
<Filter Include="Source Files">
|
||||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Header Files">
|
<Filter Include="Header Files">
|
||||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Resource Files">
|
<Filter Include="Resource Files">
|
||||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
</Filter>
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\src\bcrypt.c">
|
<ClCompile Include="..\..\src\bcrypt.c">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\crypt_blowfish.c">
|
<ClCompile Include="..\..\src\crypt_blowfish.c">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\crypt_gensalt.c">
|
<ClCompile Include="..\..\src\crypt_gensalt.c">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\wrapper.c">
|
<ClCompile Include="..\..\src\wrapper.c">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\include\bcrypt\BCrypt.hpp">
|
<ClInclude Include="..\..\include\bcrypt\BCrypt.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\include\bcrypt\winbcrypt.h">
|
<ClInclude Include="..\..\include\bcrypt\winbcrypt.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\include\bcrypt\bcrypt.h">
|
<ClInclude Include="..\..\include\bcrypt\bcrypt.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\include\bcrypt\crypt.h">
|
<ClInclude Include="..\..\include\bcrypt\crypt.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\include\bcrypt\crypt_blowfish.h">
|
<ClInclude Include="..\..\include\bcrypt\crypt_blowfish.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\include\bcrypt\crypt_gensalt.h">
|
<ClInclude Include="..\..\include\bcrypt\crypt_gensalt.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\include\bcrypt\ow-crypt.h">
|
<ClInclude Include="..\..\include\bcrypt\ow-crypt.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -1,22 +1,22 @@
|
||||||
#include "../../include/bcrypt/BCrypt.hpp"
|
#include "../../include/bcrypt/BCrypt.hpp"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
string right_password = "right_password";
|
string right_password = "right_password";
|
||||||
string wrong_password = "wrong_password";
|
string wrong_password = "wrong_password";
|
||||||
|
|
||||||
cout << "generate hash... " << flush;
|
cout << "generate hash... " << flush;
|
||||||
string hash = BCrypt::generateHash(right_password, 12);
|
string hash = BCrypt::generateHash(right_password, 12);
|
||||||
cout << "done." << endl;
|
cout << "done." << endl;
|
||||||
|
|
||||||
cout << "checking right password: " << flush
|
cout << "checking right password: " << flush
|
||||||
<< BCrypt::validatePassword(right_password, hash) << endl;
|
<< BCrypt::validatePassword(right_password, hash) << endl;
|
||||||
|
|
||||||
cout << "checking wrong password: " << flush
|
cout << "checking wrong password: " << flush
|
||||||
<< BCrypt::validatePassword(wrong_password, hash) << endl;
|
<< BCrypt::validatePassword(wrong_password, hash) << endl;
|
||||||
|
|
||||||
system("pause");
|
system("pause");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
|
@ -1,131 +1,131 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
<Platform>Win32</Platform>
|
<Platform>Win32</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
<Configuration>Release</Configuration>
|
<Configuration>Release</Configuration>
|
||||||
<Platform>Win32</Platform>
|
<Platform>Win32</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Debug|x64">
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
<Platform>x64</Platform>
|
<Platform>x64</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Release|x64">
|
<ProjectConfiguration Include="Release|x64">
|
||||||
<Configuration>Release</Configuration>
|
<Configuration>Release</Configuration>
|
||||||
<Platform>x64</Platform>
|
<Platform>x64</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="main.cpp" />
|
<ClCompile Include="main.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\libbcrypt\libbcrypt.vcxproj">
|
<ProjectReference Include="..\libbcrypt\libbcrypt.vcxproj">
|
||||||
<Project>{d6a9a3f3-1312-4494-85b8-7ce7dd4d78f4}</Project>
|
<Project>{d6a9a3f3-1312-4494-85b8-7ce7dd4d78f4}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<VCProjectVersion>15.0</VCProjectVersion>
|
<VCProjectVersion>15.0</VCProjectVersion>
|
||||||
<ProjectGuid>{C6B1CF6E-88DF-4109-9EF4-06CBA5BD5B68}</ProjectGuid>
|
<ProjectGuid>{C6B1CF6E-88DF-4109-9EF4-06CBA5BD5B68}</ProjectGuid>
|
||||||
<RootNamespace>test</RootNamespace>
|
<RootNamespace>test</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="Shared">
|
<ImportGroup Label="Shared">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<AdditionalDependencies>../libbcrypt/Debug/libbcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>../libbcrypt/Debug/libbcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -1,22 +1,22 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Filter Include="Source Files">
|
<Filter Include="Source Files">
|
||||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Header Files">
|
<Filter Include="Header Files">
|
||||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Resource Files">
|
<Filter Include="Resource Files">
|
||||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
</Filter>
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="main.cpp">
|
<ClCompile Include="main.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -78,19 +78,16 @@ target_include_directories(zm
|
||||||
${CMAKE_CURRENT_SOURCE_DIR})
|
${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
target_link_libraries(zm
|
target_link_libraries(zm
|
||||||
|
PUBLIC
|
||||||
|
libbcrypt::bcrypt
|
||||||
|
jwt-cpp::jwt-cpp
|
||||||
PRIVATE
|
PRIVATE
|
||||||
zm-core-interface)
|
zm-core-interface)
|
||||||
|
|
||||||
link_directories(libbcrypt)
|
|
||||||
|
|
||||||
add_executable(zmc zmc.cpp)
|
add_executable(zmc zmc.cpp)
|
||||||
add_executable(zmu zmu.cpp)
|
add_executable(zmu zmu.cpp)
|
||||||
add_executable(zms zms.cpp)
|
add_executable(zms zms.cpp)
|
||||||
|
|
||||||
# JWT is a header only library.
|
|
||||||
include_directories(libbcrypt/include/bcrypt)
|
|
||||||
include_directories(jwt-cpp/include/jwt-cpp)
|
|
||||||
|
|
||||||
target_link_libraries(zmc
|
target_link_libraries(zmc
|
||||||
PRIVATE
|
PRIVATE
|
||||||
zm-core-interface
|
zm-core-interface
|
||||||
|
@ -105,8 +102,7 @@ target_link_libraries(zmu
|
||||||
zm
|
zm
|
||||||
${ZM_EXTRA_LIBS}
|
${ZM_EXTRA_LIBS}
|
||||||
${ZM_BIN_LIBS}
|
${ZM_BIN_LIBS}
|
||||||
${CMAKE_DL_LIBS}
|
${CMAKE_DL_LIBS})
|
||||||
bcrypt)
|
|
||||||
|
|
||||||
target_link_libraries(zms
|
target_link_libraries(zms
|
||||||
PRIVATE
|
PRIVATE
|
||||||
|
@ -114,8 +110,7 @@ target_link_libraries(zms
|
||||||
zm
|
zm
|
||||||
${ZM_EXTRA_LIBS}
|
${ZM_EXTRA_LIBS}
|
||||||
${ZM_BIN_LIBS}
|
${ZM_BIN_LIBS}
|
||||||
${CMAKE_DL_LIBS}
|
${CMAKE_DL_LIBS})
|
||||||
bcrypt)
|
|
||||||
|
|
||||||
# Generate man files for the binaries destined for the bin folder
|
# Generate man files for the binaries destined for the bin folder
|
||||||
if(BUILD_MAN)
|
if(BUILD_MAN)
|
||||||
|
|
|
@ -1,90 +0,0 @@
|
||||||
###################################################################################
|
|
||||||
#
|
|
||||||
# Copyright (c) 2014, webvariants GmbH, http://www.webvariants.de
|
|
||||||
#
|
|
||||||
# This file is released under the terms of the MIT license. You can find the
|
|
||||||
# complete text in the attached LICENSE file or online at:
|
|
||||||
#
|
|
||||||
# http://www.opensource.org/licenses/mit-license.php
|
|
||||||
#
|
|
||||||
# @author: Tino Rusch (tino.rusch@webvariants.de)
|
|
||||||
#
|
|
||||||
###################################################################################
|
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
|
|
||||||
|
|
||||||
project(bcrypt)
|
|
||||||
|
|
||||||
enable_language(ASM)
|
|
||||||
|
|
||||||
set(MYLIB_VERSION_MAJOR 1)
|
|
||||||
set(MYLIB_VERSION_MINOR 0)
|
|
||||||
set(MYLIB_VERSION_PATCH 0)
|
|
||||||
set(MYLIB_VERSION_STRING ${MYLIB_VERSION_MAJOR}.${MYLIB_VERSION_MINOR}.${MYLIB_VERSION_PATCH})
|
|
||||||
|
|
||||||
# just doing cmake . will build a shared or static lib and honor existing environment setting
|
|
||||||
# to force build static, cmake . -DBUILD_SHARED_LIBS=Off
|
|
||||||
# to force build shared, cmake . -DBUILD_SHARED_LIBS=On
|
|
||||||
|
|
||||||
if (NOT BUILD_SHARED_LIBS)
|
|
||||||
message ("Building a static library")
|
|
||||||
else ()
|
|
||||||
message ("Building a shared library")
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
|
|
||||||
set( CMAKE_COLOR_MAKEFILE ON )
|
|
||||||
|
|
||||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall --std=c++11 -O3" )
|
|
||||||
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O3" )
|
|
||||||
|
|
||||||
set( CMAKE_ASM_FLAGS "${CXXFLAGS} -x assembler-with-cpp")
|
|
||||||
|
|
||||||
set( SRCFILES
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/bcrypt.c
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/crypt_blowfish.c
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/crypt_gensalt.c
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/wrapper.c
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/x86.S
|
|
||||||
)
|
|
||||||
|
|
||||||
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/include/bcrypt)
|
|
||||||
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
||||||
|
|
||||||
add_library(
|
|
||||||
${PROJECT_NAME}
|
|
||||||
${SRCFILES}
|
|
||||||
)
|
|
||||||
|
|
||||||
set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${MYLIB_VERSION_STRING} SOVERSION ${MYLIB_VERSION_MAJOR})
|
|
||||||
|
|
||||||
set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER include/bcrypt/BCrypt.hpp)
|
|
||||||
|
|
||||||
target_include_directories(${PROJECT_NAME} PRIVATE include)
|
|
||||||
target_include_directories(${PROJECT_NAME} PRIVATE src)
|
|
||||||
|
|
||||||
add_executable( ${PROJECT_NAME}_test ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp)
|
|
||||||
|
|
||||||
target_link_libraries( ${PROJECT_NAME}_test ${PROJECT_NAME})
|
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
|
||||||
|
|
||||||
install(TARGETS ${PROJECT_NAME}
|
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
||||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
||||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/bcrypt)
|
|
||||||
|
|
||||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
|
||||||
FILES_MATCHING PATTERN "*.h")
|
|
||||||
|
|
||||||
SET(CPACK_GENERATOR "DEB")
|
|
||||||
SET(CPACK_SET_DESTDIR ON)
|
|
||||||
|
|
||||||
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Manuel Romei")
|
|
||||||
SET(CPACK_PACKAGE_VERSION "1.0.0")
|
|
||||||
SET(CPACK_PACKAGE_VERSION_MAJOR "1")
|
|
||||||
SET(CPACK_PACKAGE_VERSION_MINOR "0")
|
|
||||||
SET(CPACK_PACKAGE_VERSION_PATCH "0")
|
|
||||||
|
|
||||||
INCLUDE(CPack)
|
|
Loading…
Reference in New Issue