Mercurial > dropbear
comparison libtomcrypt/src/pk/rsa/rsa_sign_saltlen_get.c @ 1471:6dba84798cd5
Update to libtomcrypt 1.18.1, merged with Dropbear changes
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 09 Feb 2018 21:44:05 +0800 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1470:8bba51a55704 | 1471:6dba84798cd5 |
---|---|
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_sign_saltlen_get.c | |
13 Retrieve the maximum size of the salt, Steffen Jaeckel. | |
14 */ | |
15 | |
16 #ifdef LTC_MRSA | |
17 | |
18 /** | |
19 Retrieve the maximum possible size of the salt when creating a PKCS#1 PSS signature. | |
20 @param padding Type of padding (LTC_PKCS_1_PSS only) | |
21 @param hash_idx The index of the desired hash | |
22 @param key The RSA key | |
23 @return The maximum salt length in bytes or INT_MAX on error. | |
24 */ | |
25 int rsa_sign_saltlen_get_max_ex(int padding, int hash_idx, rsa_key *key) | |
26 { | |
27 int ret = INT_MAX; | |
28 LTC_ARGCHK(key != NULL); | |
29 | |
30 if ((hash_is_valid(hash_idx) == CRYPT_OK) && | |
31 (padding == LTC_PKCS_1_PSS)) | |
32 { | |
33 ret = rsa_get_size(key); | |
34 if (ret < INT_MAX) | |
35 { | |
36 ret -= (hash_descriptor[hash_idx].hashsize + 2); | |
37 } /* if */ | |
38 } /* if */ | |
39 | |
40 return ret; | |
41 } | |
42 | |
43 #endif | |
44 | |
45 /* ref: $Format:%D$ */ | |
46 /* git commit: $Format:%H$ */ | |
47 /* commit time: $Format:%ai$ */ |