mirror of
https://gitlab.kit.edu/kit/scc/sys/mail/exim-encrypt-dlfunc.git
synced 2025-12-06 08:33:56 +01:00
Removed debug symbols from final library.
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
CC=gcc
|
CC=gcc
|
||||||
CFLAGS=-Wall -g
|
CFLAGS=-Wall
|
||||||
LDFLAGS=-lsodium
|
LDFLAGS=-lsodium
|
||||||
LDFLAGS_LIB=-I/usr/include/exim4 -fpic -shared -export-dynamic
|
LDFLAGS_LIB=-I/usr/include/exim4 -fpic -shared -export-dynamic
|
||||||
|
|
||||||
|
|||||||
19
src/genkey.c
19
src/genkey.c
@ -41,6 +41,7 @@ dump_key_as_exim_config(FILE * f, const char *name, unsigned char *key,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
fprintf(f, " }; const unsigned int %s_length = %d;\n", name, keylen);
|
fprintf(f, " }; const unsigned int %s_length = %d;\n", name, keylen);
|
||||||
|
|
||||||
// encode with base64
|
// encode with base64
|
||||||
unsigned int b64len = sodium_base64_ENCODED_LEN(keylen, sodium_base64_VARIANT_ORIGINAL);
|
unsigned int b64len = sodium_base64_ENCODED_LEN(keylen, sodium_base64_VARIANT_ORIGINAL);
|
||||||
unsigned char *b64string = malloc(b64len);
|
unsigned char *b64string = malloc(b64len);
|
||||||
@ -50,24 +51,6 @@ dump_key_as_exim_config(FILE * f, const char *name, unsigned char *key,
|
|||||||
fprintf(f, "%s = \"%s\"\n", name, b64string);
|
fprintf(f, "%s = \"%s\"\n", name, b64string);
|
||||||
|
|
||||||
free(b64string);
|
free(b64string);
|
||||||
// write a comment with C variable declaration
|
|
||||||
fprintf(f, "# const unsigned char %s[%d] = { ", name, keylen);
|
|
||||||
for (int i = 0; i < keylen; i++) {
|
|
||||||
fprintf(f, "0x%02x", key[i]);
|
|
||||||
if (i < keylen - 1) {
|
|
||||||
fprintf(f, ", ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fprintf(f, " }; const unsigned int %s_length = %d;\n", name, keylen);
|
|
||||||
// encode with base64
|
|
||||||
unsigned int b64len = sodium_base64_ENCODED_LEN(keylen, sodium_base64_VARIANT_ORIGINAL);
|
|
||||||
unsigned char *b64string = malloc(b64len);
|
|
||||||
sodium_bin2base64((char *const) b64string, b64len,
|
|
||||||
key, keylen,
|
|
||||||
sodium_base64_VARIANT_ORIGINAL);
|
|
||||||
fprintf(f, "%s = \"%s\"\n", name, b64string);
|
|
||||||
|
|
||||||
free(b64string);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user