mirror of
https://gitlab.kit.edu/kit/scc/sys/mail/exim-encrypt-dlfunc.git
synced 2025-12-06 09:33:56 +01:00
Fixed compiler warnings and rewrote documentation for meson.
This commit is contained in:
19
src/Makefile
19
src/Makefile
@ -1,19 +0,0 @@
|
||||
CC=gcc
|
||||
CFLAGS=-I/usr/include/exim4 -g
|
||||
LDFLAGS=-lsodium
|
||||
LDFLAGS_LIB=-fpic -shared
|
||||
|
||||
.PHONY: clean all
|
||||
|
||||
.DEFAULT_GOAL := all
|
||||
|
||||
libexim-encrypt-dlfunc.so: libexim-encrypt-dlfunc.c
|
||||
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) $(LDFLAGS_LIB)
|
||||
|
||||
genkey: genkey.c
|
||||
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
|
||||
|
||||
clean:
|
||||
rm -f libexim-encrypt-dlfunc.so genkey
|
||||
|
||||
all: libexim-encrypt-dlfunc.so genkey
|
||||
@ -5,7 +5,7 @@
|
||||
bool key_contains_zero(unsigned char *key, unsigned int keylen)
|
||||
{
|
||||
bool has_zero = false;
|
||||
for (int i = 0; i < keylen; i++) {
|
||||
for (unsigned int i = 0; i < keylen; i++) {
|
||||
if (key[i] == 0) {
|
||||
has_zero = true;
|
||||
}
|
||||
@ -18,7 +18,7 @@ dump_key_as_c_code(FILE * f, const char *name, unsigned char *key,
|
||||
unsigned int keylen)
|
||||
{
|
||||
fprintf(f, "const unsigned char %s[] = { ", name);
|
||||
for (int i = 0; i < keylen; i++) {
|
||||
for (unsigned int i = 0; i < keylen; i++) {
|
||||
fprintf(f, "0x%02x", key[i]);
|
||||
if (i < keylen - 1) {
|
||||
fprintf(f, ", ");
|
||||
@ -34,7 +34,7 @@ dump_key_as_exim_config(FILE * f, const char *name, unsigned char *key,
|
||||
{
|
||||
// write a comment with C variable declaration
|
||||
fprintf(f, "# const unsigned char %s[%d] = { ", name, keylen);
|
||||
for (int i = 0; i < keylen; i++) {
|
||||
for (unsigned int i = 0; i < keylen; i++) {
|
||||
fprintf(f, "0x%02x", key[i]);
|
||||
if (i < keylen - 1) {
|
||||
fprintf(f, ", ");
|
||||
@ -132,7 +132,7 @@ void create_secretbox_key(const char *filebase, const char *varname) {
|
||||
write_key_files(key_filename, key_varname, key, crypto_secretbox_KEYBYTES);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int main(void) {
|
||||
if (sodium_init() < 0) {
|
||||
fputs("Unable to initialize libsodium", stderr);
|
||||
exit(128);
|
||||
@ -2,7 +2,7 @@ configure_file(
|
||||
output: 'config.h',
|
||||
configuration: conf_data)
|
||||
|
||||
executable('genkey', 'genkey.c', dependencies : [ sodium_deps ] )
|
||||
executable('generate_encryption_keys', 'generate_encryption_keys.c', dependencies : [ sodium_deps ] )
|
||||
|
||||
shared_library('exim-encrypt-dlfunc', 'libexim-encrypt-dlfunc.c',
|
||||
dependencies : [ sodium_deps ],
|
||||
|
||||
Reference in New Issue
Block a user