comparison sencrypt.c @ 16:d9c4bdc004d2

Add support for OpenSSL 1.1
author Guido Berhoerster <guido+sencrypt@berhoerster.name>
date Sat, 07 Jul 2018 14:57:57 +0200
parents 00ca3ee8e310
children 07f525330bc7
comparison
equal deleted inserted replaced
15:00ca3ee8e310 16:d9c4bdc004d2
523 mode_t old_mode; 523 mode_t old_mode;
524 char pwdata[MAX(MAX_PASSWORD_LEN, EVP_MAX_KEY_LENGTH)]; 524 char pwdata[MAX(MAX_PASSWORD_LEN, EVP_MAX_KEY_LENGTH)];
525 size_t pwdata_len = 0; 525 size_t pwdata_len = 0;
526 int status = EXIT_SUCCESS; 526 int status = EXIT_SUCCESS;
527 527
528 #if OPENSSL_VERSION_NUMBER < 0x10100000L
528 /* initialize OpenSSL */ 529 /* initialize OpenSSL */
529 OpenSSL_add_all_algorithms(); 530 OpenSSL_add_all_algorithms();
530 ERR_load_crypto_strings(); 531 ERR_load_crypto_strings();
531 OPENSSL_config(NULL); 532 OPENSSL_config(NULL);
533 #endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */
532 534
533 progname = strrchr(argv[0], '/'); 535 progname = strrchr(argv[0], '/');
534 progname = (progname != NULL) ? progname + 1 : argv[0]; 536 progname = (progname != NULL) ? progname + 1 : argv[0];
535 if ((strcmp(progname, "sencrypt") == 0) || 537 if ((strcmp(progname, "sencrypt") == 0) ||
536 (strcmp(progname, "encrypt") == 0)) { 538 (strcmp(progname, "encrypt") == 0)) {
807 } 809 }
808 810
809 free(out_filename_tmp); 811 free(out_filename_tmp);
810 free(tmp_filename); 812 free(tmp_filename);
811 813
814 #if OPENSSL_VERSION_NUMBER < 0x10100000L
812 EVP_cleanup(); 815 EVP_cleanup();
813 ERR_free_strings(); 816 ERR_free_strings();
814 CONF_modules_free(); 817 CONF_modules_free();
818 #endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */
815 819
816 exit(status); 820 exit(status);
817 } 821 }