Skip to content

Commit

Permalink
Add chacha aliases for OpenSSL compatibility
Browse files Browse the repository at this point in the history
OpenSSL has the 20 in the long and short names, so add aliases to the
existing names to make things work. In particular, EVP_get_cipherbyname()
will now return EVP_chacha20() for both 'ChaCha20' and 'chacha20'.

Found by Facundo Tuesca when trying to add LibreSSL support for ChaCha20 in
pyca/cryptography#9209

ok jsing
  • Loading branch information
botovq committed Oct 24, 2023
1 parent 69014b5 commit 5892e0f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/libcrypto/evp/c_all.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $OpenBSD: c_all.c,v 1.32 2023/07/24 10:24:58 jsing Exp $ */
/* $OpenBSD: c_all.c,v 1.33 2023/10/24 13:09:54 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
Expand Down Expand Up @@ -223,6 +223,8 @@ OpenSSL_add_all_ciphers_internal(void)

#ifndef OPENSSL_NO_CHACHA
EVP_add_cipher(EVP_chacha20());
EVP_add_cipher_alias(SN_chacha20, "ChaCha20");
EVP_add_cipher_alias(LN_chacha20, "chacha20");
#endif
#if !defined(OPENSSL_NO_CHACHA) && !defined(OPENSSL_NO_POLY1305)
EVP_add_cipher(EVP_chacha20_poly1305());
Expand Down

0 comments on commit 5892e0f

Please sign in to comment.