Implement a blacklist for problem OpenSSL ciphers. Since OpenSSL v1.0.0 was released, a number of ciphers have caused problems for SXEmacs' ossl, up to and including data corruption. This changeset prevents these ciphers from being used. See: `ossl-cipher-blacklist' The blacklisted ciphers can still be used if they are first removed from `ossl-cipher-blacklist', but obviously this is not recommended. * src/openssl.c (ossl_check_cipher): New. Returns 0 if cipher is NOT on our blacklist. (Fossl_available_ciphers): Check cipher with ossl_check_cipher(). (ossl_cipher_fun): Ditto. (Fossl_bytes_to_key): Ditto. (Fossl_encrypt): Ditto. (Fossl_encrypt_file): Ditto. (Fossl_decrypt): Ditto. (Fossl_decrypt_file): Ditto. (Fossl_seal): Ditto. (Fossl_open): Ditto. (Fossl_pem_write_key): Ditto. (Fossl_pem_key): Ditto. (Fossl_digest_size): Typo fix "cipher" -> "digest". (vars_of_openssl): New var, Vossl_cipher_blacklist. A list of ciphers we don't want to use. (syms_of_openssl): Define all of the blacklisted cipher names. * tests/automated/openssl-tests.el: Run tests on all available ciphers and digests. Make sure use of blacklisted ciphers results in an error. Signed-off-by: Steve Youngs <steve@sxemacs.org>
More eliminate silly warnings * src/search.c (fast_string_match): Use a temporary to avoid warning about constness. * src/openssl.c (Fossl_digest_file): Mark set unused but unused variable. (Fossl_pem_write_public_key): Ditto. (Fossl_pem_write_key): Ditto. (Fossl_ssl_read): Ditto. (Fossl_ssl_write): Ditto. (ossl_ssl_prepare_cmeth): Ignore drop of const qualifier. The alternative of using const for SSL methods everywhere is not workable if we are to support older OpenSSL versions. (ossl_ssl_prepare_smeth): Ditto. * src/alloc.c (make_string_nocopy): Remove unnecessary cast. Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Whitespace cleanup in src [m-z] Signed-off-by: Steve Youngs <steve@sxemacs.org>
Coverity: UNREACHABLE: CID 426, 425, 424, 423, 422, 421 * src/openssl.c (ossl_digest_fun): Just appease Coverity and add do the while(0)... * src/openssl.c (ossl_cipher_fun): Ditto. * src/openssl.c (OSSL_CHECK_PROCESS): Ditto. Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Prevent inexistence of openssl ssl_verify_cert_chain from breaking the build Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Prevent inexistence of openssl server/client methods from breaking the build Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Security fixes * src/alloc.c (garbage-collect): check return of snprintf * src/doprnt.c (emacs_doprnt_smZ): ditto * src/dumper.c (pdump_file_try): ditto * src/dumper.c (pdump_load): ditto * src/editfns.c (Fencode_time): ditto * src/editfns.c (Fencode_btime): ditto * src/editfns.c (current_time_zone): ditto * src/ent/ent-float.c (vars_of_ent_float): ditto * src/filelock.c (lock_file_1): ditto * src/media/sound-arts.c (sound_arts_play): ditto * src/mule/mule-ccl.c (ccl_driver): ditto * src/opaque.c (print_opaque_ptr): ditto * src/strftime.c (add_num_time_t): ditto * src/casetab.c (print_case_table): use write_fmt_str instead of sprintf * src/elhash.c (print_hash_table): ditto * src/events/event-stream.c (print_timeout): ditto * src/events/events.c (print_event): ditto * src/media/sound-nas.c (sound_nas_print): ditto * src/media/sound.c (print_audio_job): ditto * src/opaque.c (print_opaque): ditto * src/openssl.c (print_evp_pkey): ditto * src/symbols.c (print_symbol_value_magic): ditto * src/filelock.c (lock_file): Use snprintf instead of sprintf * src/libsst.c (sst_set_ger): ditto * src/libsst.c (sst_set_gr): ditto * src/libsst.c (sst_set_gx): ditto * src/libsst.c (sst_tones): ditto * src/libsst.c (sst_dmtf): ditto * src/print.c (float_to_string): ditto * src/process-unix.c (allocate_pty_the_old_fashioned_way): ditto * src/process-unix.c (unix_open_network_stream): ditto * src/s/hpux.h (PTY_TTY_NAME_SPRINTF): ditto * src/s/rtu.h (PTY_TTY_NAME_SPRINTF): ditto * src/s/sco4.h (PTY_TTY_NAME_SPRINTF): ditto * src/s/sco5.h (PTY_TTY_NAME_SPRINTF): ditto * src/data.c (Fnumber_to_string): correct arguments to new buffer size aware float_to_string and long_to_string * src/doprnt.c (emacs_doprnt_number): correct arguments to new buffer size aware long_to_string * src/print.c (print_internal): ditto * src/ui/redisplay.c (window_line_number): ditto * src/ui/redisplay.c (decode_mode_spec): ditto * src/ent/ent-float.c (print_float): correct arguments to new buffer size aware float_to_string * src/ent/ent-float.h: define new argument for float_to_string * src/lisp.h: define new argument for long_to_string * src/emacs.c (assert_failed): flush stderr to make sure assertion is written. * src/print.c (float_to_string): rewrite so that it knows size and does not overflow buf. Also uses snprintf instead of sprintf * src/print.c (long_to_string): ditto. Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Make sure to fclose the file on error CID:195 Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Remove unused value of eckey CID:435 Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Fix several FILE* leaks in ssl CID:193,194,195,196,197,198 Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Use ssize_t for string length and return from read calls CID:130,131,132,133 Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
Fix a few more compiler warnings. * src/skiplist.h: #if 0 out some as yet unused function declarations. Prevents compiler warnings. * src/openssl.c (Fossl_ssl_cipher_description): SSL_get_current_cipher returns a const, so needs to be stored in a const. Prevents compiler warning. * src/openssl.c (Fossl_ssl_cipher_version): Ditto. * src/openssl.c (Fossl_ssl_cipher_name): Ditto. * src/openssl.c (Fossl_ssl_cipher_bits): Ditto. Signed-off-by: Steve Youngs <steve@sxemacs.org>
Initial git import