From dac82f4c6454351b218268505609eb3baaa10348 Mon Sep 17 00:00:00 2001 From: Jack Frain Date: Tue, 30 Sep 2025 16:44:02 -0400 Subject: [PATCH] fix: make rsa_pss int_to_bit_size more efficient --- src/rsa_pss.erl | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/rsa_pss.erl b/src/rsa_pss.erl index 7b4cc9964..29d7fc8ec 100644 --- a/src/rsa_pss.erl +++ b/src/rsa_pss.erl @@ -185,16 +185,9 @@ ep(B, #'RSAPublicKey'{modulus=N, publicExponent=E}) -> crypto:mod_pow(B, E, N). %% @private -int_to_bit_size(I) -> - int_to_bit_size(I, 0). +int_to_bit_size(I) -> + bit_size(binary:encode_unsigned(I)). -%% @private -int_to_bit_size(0, B) -> - B; -int_to_bit_size(I, B) -> - int_to_bit_size(I bsr 1, B + 1). - -%% @private int_to_byte_size(I) -> int_to_byte_size(I, 0).