diff options
author | Timo Teras <timo.teras@iki.fi> | 2009-07-08 16:19:06 +0300 |
---|---|---|
committer | Timo Teras <timo.teras@iki.fi> | 2009-07-08 16:19:06 +0300 |
commit | a3d19b5c0dccab79d25dc9aca3f6ce731b1ac62c (patch) | |
tree | 77027453989d62d506ddfbb62168d34226f904ed /src/apk.c | |
parent | b54ff5dd1ebc230aa50570ecfebc8fd31739ebb4 (diff) | |
download | apk-tools-a3d19b5c0dccab79d25dc9aca3f6ce731b1ac62c.tar.gz apk-tools-a3d19b5c0dccab79d25dc9aca3f6ce731b1ac62c.tar.bz2 apk-tools-a3d19b5c0dccab79d25dc9aca3f6ce731b1ac62c.tar.xz apk-tools-a3d19b5c0dccab79d25dc9aca3f6ce731b1ac62c.zip |
apk: initialize openssl
add all ciphers and built-in engines so we get e.g. hw acceleration
of sha1 when available.
Diffstat (limited to 'src/apk.c')
-rw-r--r-- | src/apk.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -18,6 +18,8 @@ #include <getopt.h> #include <sys/stat.h> +#include <openssl/engine.h> + #include "apk_defines.h" #include "apk_applet.h" #include "apk_blob.h" @@ -237,6 +239,24 @@ static void merge_options(struct option *opts, struct apk_option *ao, int num) opts->name = NULL; } +static void fini_openssl(void) +{ + EVP_cleanup(); +#ifndef OPENSSL_NO_ENGINE + ENGINE_cleanup(); +#endif + CRYPTO_cleanup_all_ex_data(); +} + +static void init_openssl(void) +{ + atexit(fini_openssl); + OpenSSL_add_all_algorithms(); +#ifndef OPENSSL_NO_ENGINE + ENGINE_load_builtin_engines(); +#endif +} + int main(int argc, char **argv) { struct apk_applet *applet; @@ -274,6 +294,8 @@ int main(int argc, char **argv) } } + init_openssl(); + optindex = 0; while ((r = getopt_long(argc, argv, short_options, all_options, &optindex)) != -1) { |