1 // SPDX-License-Identifier: BSD-2-Clause 2 /* LibTomCrypt, modular cryptographic library -- Tom St Denis 3 * 4 * LibTomCrypt is a library that provides various cryptographic 5 * algorithms in a highly modular and flexible manner. 6 * 7 * The library is free for all purposes without any express 8 * guarantee it works. 9 */ 10 #include "tomcrypt_private.h" 11 12 /** 13 @file rsa_get_size.c 14 Retrieve the size of an RSA key, Steffen Jaeckel. 15 */ 16 17 #ifdef LTC_MRSA 18 19 /** 20 Retrieve the size in bytes of an RSA key. 21 @param key The RSA key 22 @return The size in bytes of the RSA key or INT_MAX on error. 23 */ rsa_get_size(const rsa_key * key)24int rsa_get_size(const rsa_key *key) 25 { 26 int ret = INT_MAX; 27 LTC_ARGCHK(key != NULL); 28 29 if (key) 30 { 31 ret = mp_unsigned_bin_size(key->N); 32 } /* if */ 33 34 return ret; 35 } 36 37 #endif 38 39 /* ref: $Format:%D$ */ 40 /* git commit: $Format:%H$ */ 41 /* commit time: $Format:%ai$ */ 42