From 0a7fbc8c0986d3d48dec465d045dbf8aaced32c6 Mon Sep 17 00:00:00 2001 From: Toddr Bot Date: Fri, 22 May 2026 02:38:00 +0000 Subject: [PATCH] Remove dead code: unused macros and unreachable break statements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove KEY_KEY, PADDING_KEY, HASH_KEY macros — vestiges of an older design that stored RSA data in a Perl hash instead of the current C struct. No code references them. - Remove unreachable break statements after return in get_digest_length() — each case returns directly, making the subsequent break dead code. PACKAGE_NAME is retained: the XS typemap references it for blessed reference type checking. Co-Authored-By: Claude Opus 4.6 --- RSA.xs | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/RSA.xs b/RSA.xs index 238bebb..4dd5b28 100644 --- a/RSA.xs +++ b/RSA.xs @@ -103,12 +103,6 @@ typedef struct int is_private_key; /* cached once at construction; avoids per-call BIGNUM alloc on 3.x */ } rsaData; -/* Key names for the rsa hash structure */ - -#define KEY_KEY "_Key" -#define PADDING_KEY "_Padding" -#define HASH_KEY "_Hash_Mode" - #define PACKAGE_NAME "Crypt::OpenSSL::RSA" #ifdef LIBRESSL_VERSION_NUMBER @@ -195,35 +189,26 @@ int get_digest_length(int hash_method) { case NID_md5: return MD5_DIGEST_LENGTH; - break; case NID_sha1: return SHA_DIGEST_LENGTH; - break; #ifdef SHA512_DIGEST_LENGTH case NID_sha224: return SHA224_DIGEST_LENGTH; - break; case NID_sha256: return SHA256_DIGEST_LENGTH; - break; case NID_sha384: return SHA384_DIGEST_LENGTH; - break; case NID_sha512: return SHA512_DIGEST_LENGTH; - break; #endif case NID_ripemd160: return RIPEMD160_DIGEST_LENGTH; - break; #ifdef WHIRLPOOL_DIGEST_LENGTH case NID_whirlpool: return WHIRLPOOL_DIGEST_LENGTH; - break; #endif default: croak("Unknown digest hash mode %u", hash_method); - break; } } #if OPENSSL_VERSION_NUMBER >= 0x30000000L