Use pkg-config and have git-based version number

Use pkg-config to find OpenSSL headers and library. Use "git describe"
to determine current version.
This commit is contained in:
Johannes Bauer 2019-10-19 14:47:54 +02:00
parent 52dee3bad0
commit 363fc70f1c
4 changed files with 33 additions and 33 deletions

View File

@ -1,13 +1,15 @@
.PHONY: all clean test testclient derive install
all: luksrku luksrku-config
BUILD_REVISION := $(shell git describe --abbrev=10 --dirty --always)
INSTALL_PREFIX := /usr/local/
CFLAGS := -std=c11 -Wall -Wextra -O2 -pthread -D_POSIX_SOURCE -D_XOPEN_SOURCE=500 -Wmissing-prototypes -Wstrict-prototypes -Wno-unused-parameter
CFLAGS := -Wall -Wextra -Wshadow -Wswitch -Wpointer-arith -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Werror=implicit-function-declaration -Werror=format -Wno-unused-parameter
#CFLAGS := -Wall -Wextra -O2 -Wmissing-prototypes -Wstrict-prototypes
CFLAGS += -std=c11 -pthread -D_POSIX_SOURCE -D_XOPEN_SOURCE=500 -DBUILD_REVISION='"$(BUILD_REVISION)"'
#CFLAGS += -g -DDEBUG
LDFLAGS := -lcrypto -lssl
LDFLAGS += -L/usr/local/lib
#LDFLAGS := -static $(LIBDIR)libssl.a $(LIBDIR)libcrypto.a
#LDFLAGS := -static $(LIBDIR)libssl.a $(LIBDIR)libcrypto.a -ldl
CFLAGS += `pkg-config --cflags openssl`
LDFLAGS := `pkg-config --libs openssl`
OBJS := luksrku.o server.o log.o openssl.o client.o keyfile.o msg.o binkeyfile.o util.o cmdline.o luks.o exec.o blacklist.o
OBJS_CFG := luksrku-config.o keyfile.o binkeyfile.o parse-keyfile.o openssl.o log.o util.o

View File

@ -203,7 +203,7 @@ static bool decrypt_aes256_gcm(unsigned char *ciphertext, unsigned int ciphertex
/* Finalise the decryption. A positive return value indicates success,
* anything else is a failure - the plaintext is not trustworthy. */
int padding_len = 0;
if (EVP_DecryptFinal_ex(ctx, plaintext + plaintext_len, &padding_len) <= 0) {
if (EVP_DecryptFinal_ex(ctx, (uint8_t*)plaintext + plaintext_len, &padding_len) <= 0) {
log_openssl(LLVL_FATAL, "Decryption of tail failed.");
success = false;
break;

View File

@ -67,7 +67,7 @@ void print_syntax(const char *pgmname) {
fprintf(stderr, " manual key entry. This defaults to 5 tries.\n");
fprintf(stderr, " -v, --verbose Increase logging verbosity.\n");
fprintf(stderr, "\n");
fprintf(stderr, "luksrku version: " LUKSRKU_VERSION "\n");
fprintf(stderr, "luksrku version: " BUILD_REVISION "\n");
}
static void set_default_arguments(struct options_t *options) {

View File

@ -30,8 +30,6 @@
#define CLIENT_PSK_IDENTITY "luksrku v1"
#define CLIENT_ANNOUNCE_MAGIC { 0x46, 0xf2, 0xf6, 0xc6, 0x63, 0x12, 0x2e, 0x00, 0xa0, 0x8a, 0xae, 0x42, 0x0c, 0x51, 0xf5, 0x65 }
#define LUKSRKU_VERSION "0.01"
/* Size in bytes of the PSK that is used for TLS */
#define PSK_SIZE_BYTES 32