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