1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 3 #include "tomcrypt_private.h" 4 5 /** 6 @file rsa_get_size.c 7 Retrieve the size of an RSA key, Steffen Jaeckel. 8 */ 9 10 #ifdef LTC_MRSA 11 12 /** 13 Retrieve the size in bytes of an RSA key. 14 @param key The RSA key 15 @return The size in bytes of the RSA key or INT_MAX on error. 16 */ rsa_get_size(const rsa_key * key)17int rsa_get_size(const rsa_key *key) 18 { 19 int ret = INT_MAX; 20 LTC_ARGCHK(key != NULL); 21 22 if (key) 23 { 24 ret = mp_unsigned_bin_size(key->N); 25 } /* if */ 26 27 return ret; 28 } 29 30 #endif 31