We don't need libscrypt when linking against sodium.
This commit is contained in:
parent
4058d33202
commit
385f347b33
@ -29,7 +29,7 @@
|
|||||||
#if HAS_CPERCIVA
|
#if HAS_CPERCIVA
|
||||||
#include <scrypt/crypto_scrypt.h>
|
#include <scrypt/crypto_scrypt.h>
|
||||||
#include <scrypt/sha256.h>
|
#include <scrypt/sha256.h>
|
||||||
#elif HAS_SCRYPT_SODIUM
|
#elif HAS_SODIUM
|
||||||
#include <libscrypt.h>
|
#include <libscrypt.h>
|
||||||
#include <sodium.h>
|
#include <sodium.h>
|
||||||
#endif
|
#endif
|
||||||
@ -99,7 +99,7 @@ uint8_t const *mpw_scrypt(const size_t keySize, const char *secret, const uint8_
|
|||||||
mpw_free( key, keySize );
|
mpw_free( key, keySize );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#elif HAS_SCRYPT_SODIUM
|
#elif HAS_SODIUM
|
||||||
if (crypto_pwhash_scryptsalsa208sha256_ll( (const uint8_t *)secret, strlen( secret ), salt, saltSize, N, r, p, key, keySize) != 0 ) {
|
if (crypto_pwhash_scryptsalsa208sha256_ll( (const uint8_t *)secret, strlen( secret ), salt, saltSize, N, r, p, key, keySize) != 0 ) {
|
||||||
mpw_free( key, keySize );
|
mpw_free( key, keySize );
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -118,7 +118,7 @@ uint8_t const *mpw_hmac_sha256(const uint8_t *key, const size_t keySize, const u
|
|||||||
|
|
||||||
HMAC_SHA256_Buf( key, keySize, salt, saltSize, buffer );
|
HMAC_SHA256_Buf( key, keySize, salt, saltSize, buffer );
|
||||||
return buffer;
|
return buffer;
|
||||||
#elif HAS_SCRYPT_SODIUM
|
#elif HAS_SODIUM
|
||||||
uint8_t *const buffer = malloc( crypto_auth_hmacsha256_BYTES );
|
uint8_t *const buffer = malloc( crypto_auth_hmacsha256_BYTES );
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -144,7 +144,7 @@ const char *mpw_id_buf(const void *buf, size_t length) {
|
|||||||
SHA256_Buf( buf, length, hash );
|
SHA256_Buf( buf, length, hash );
|
||||||
|
|
||||||
return mpw_hex( hash, 32 );
|
return mpw_hex( hash, 32 );
|
||||||
#elif HAS_SCRYPT_SODIUM
|
#elif HAS_SODIUM
|
||||||
uint8_t hash[crypto_hash_sha256_BYTES];
|
uint8_t hash[crypto_hash_sha256_BYTES];
|
||||||
crypto_hash_sha256( hash, buf, length );
|
crypto_hash_sha256( hash, buf, length );
|
||||||
|
|
||||||
|
12
platform-independent/cli-c/CMakeLists.txt
Normal file
12
platform-independent/cli-c/CMakeLists.txt
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
project(mpw)
|
||||||
|
cmake_minimum_required(VERSION 3.0.2)
|
||||||
|
|
||||||
|
set(CMAKE_BUILD_TYPE Release)
|
||||||
|
set(CMAKE_C_FLAGS "-O3 -DHAS_SODIUM=1")
|
||||||
|
|
||||||
|
include_directories(core cli)
|
||||||
|
file(GLOB SOURCES "core/*.c" "cli/mpw-cli.c")
|
||||||
|
add_executable(mpw ${SOURCES})
|
||||||
|
|
||||||
|
find_library(libsodium REQUIRED)
|
||||||
|
target_link_libraries(mpw sodium)
|
@ -45,7 +45,13 @@ mpw_color=${mpw_color:-1} # Colorized Identicon, requires libncurses-dev
|
|||||||
export CFLAGS="-O3 $CFLAGS"
|
export CFLAGS="-O3 $CFLAGS"
|
||||||
export LDFLAGS="$LDFLAGS"
|
export LDFLAGS="$LDFLAGS"
|
||||||
|
|
||||||
|
# Distribution specific configuration.
|
||||||
|
# Homebrew - openssl for scrypt
|
||||||
|
if hash brew 2>/dev/null; then
|
||||||
|
opensslPath=$(brew --prefix openssl)
|
||||||
|
CFLAGS+=" -I$opensslPath/include"
|
||||||
|
LDFLAGS+=" -L$opensslPath/lib"
|
||||||
|
fi
|
||||||
|
|
||||||
### DEPENDENCIES
|
### DEPENDENCIES
|
||||||
|
|
||||||
@ -207,9 +213,9 @@ depend() {
|
|||||||
popd
|
popd
|
||||||
}
|
}
|
||||||
depend_scrypt() {
|
depend_scrypt() {
|
||||||
if haslib scrypt && haslib sodium; then
|
if haslib sodium; then
|
||||||
CFLAGS+=" -DHAS_SCRYPT_SODIUM=1"
|
CFLAGS+=" -DHAS_SODIUM=1"
|
||||||
LDFLAGS+=" -lscrypt -lsodium"
|
LDFLAGS+=" -lsodium"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user