Skip to content

Commit

Permalink
build: add apisupport low_level_rsa
Browse files Browse the repository at this point in the history
OpenSSL 3.0 marked many RSA functions as "deprecated"; tarsnap uses some
of them[1] in:
    lib/crypto/crypto_compat.c
    lib/crypto/crypto_keys.c
    lib/crypto/crypto_keys_subr.c
    lib/crypto/crypto_rsa.c

Those files are now being compiled into a new libtarsnap_rsa.a, which
uses the appropriate compiler flags.

[1] List of relevant deprecated OpenSSL 3.0 RSA functions:
    RSAPublicKey_dup
    RSA_bits
    RSA_free
    RSA_generate_key_ex
    RSA_get0_crt_params
    RSA_get0_factors
    RSA_get0_key
    RSA_new
    RSA_private_decrypt
    RSA_private_encrypt
    RSA_public_decrypt
    RSA_public_encrypt
    RSA_set0_crt_params
    RSA_set0_factors
    RSA_set0_key
    RSA_size
  • Loading branch information
gperciva authored and cperciva committed Feb 16, 2025
1 parent 74d07ea commit 8ce2a7a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
14 changes: 10 additions & 4 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ noinst_LIBRARIES= \
lib/libcperciva_rdrand.a \
lib/libcperciva_shani.a \
lib/libtarsnap.a \
lib/libtarsnap_rsa.a \
lib/libtarsnap_sse2.a \
libarchive/libarchive.a
bin_PROGRAMS= \
Expand Down Expand Up @@ -124,17 +125,13 @@ lib_libtarsnap_a_SOURCES= \
lib-platform/util/ts_getfstype.c \
lib-platform/util/ts_getfstype.h \
lib/crypto/crypto.h \
lib/crypto/crypto_compat.c \
lib/crypto/crypto_compat.h \
lib/crypto/crypto_file.c \
lib/crypto/crypto_hash.c \
lib/crypto/crypto_internal.h \
lib/crypto/crypto_keys.c \
lib/crypto/crypto_keys_init.c \
lib/crypto/crypto_keys_server.c \
lib/crypto/crypto_keys_subr.c \
lib/crypto/crypto_passwd_to_dh.c \
lib/crypto/crypto_rsa.c \
lib/crypto/crypto_scrypt_smix.c \
lib/crypto/crypto_scrypt_smix.h \
lib/crypto/crypto_scrypt_smix_sse2.h \
Expand Down Expand Up @@ -422,6 +419,15 @@ nodist_lib_libcperciva_cpusupport_detect_a_SOURCES= \
lib_libcperciva_cpusupport_detect_a_CPPFLAGS=$(lib_libtarsnap_a_CPPFLAGS)
LIBTARSNAP_A+= lib/libcperciva_cpusupport_detect.a

lib_libtarsnap_rsa_a_SOURCES= \
lib/crypto/crypto_compat.c \
lib/crypto/crypto_keys.c \
lib/crypto/crypto_keys_subr.c \
lib/crypto/crypto_rsa.c
lib_libtarsnap_rsa_a_CPPFLAGS=$(lib_libtarsnap_a_CPPFLAGS)
lib_libtarsnap_rsa_a_CFLAGS=`. ./apisupport-config.h; echo $${CFLAGS_LIBCRYPTO_LOW_LEVEL_RSA}`
LIBTARSNAP_A+= lib/libtarsnap_rsa.a


#
#
Expand Down
14 changes: 14 additions & 0 deletions libcperciva/apisupport/Build/apisupport-LIBCRYPTO-LOW_LEVEL_RSA.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include <openssl/rsa.h>

int
main(void)
{
RSA * rsa;

/* Allocate and free a RSA key. */
rsa = RSA_new();
RSA_free(rsa);

/* Success! */
return (0);
}
2 changes: 2 additions & 0 deletions libcperciva/apisupport/Build/apisupport.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,5 @@ feature LIBSSL HOST_NAME "-lssl" "" \
"-Wno-cast-qual"
feature LIBCRYPTO LOW_LEVEL_AES "-lcrypto" "" \
"-Wno-deprecated-declarations"
feature LIBCRYPTO LOW_LEVEL_RSA "-lcrypto" "" \
"-Wno-deprecated-declarations"

0 comments on commit 8ce2a7a

Please sign in to comment.