mbedtls/include/mbedtls
Jaeden Amero 3725bb2d6d rsa: pss: Enable use of big hashes with small keys
It should be valid to RSASSA-PSS sign a SHA-512 hash with a 1024-bit or
1032-bit RSA key, but with the salt size being always equal to the hash
size, this isn't possible: the key is too small.

To enable use of hashes that are relatively large compared to the key
size, allow reducing the salt size to no less than the hash size minus 2
bytes. We don't allow salt sizes smaller than the hash size minus 2
bytes because that too significantly changes the security guarantees the
library provides compared to the previous implementation which always
used a salt size equal to the hash size. The new calculated salt size
remains compliant with FIPS 186-4.

We also need to update the "hash too large" test, since we now reduce
the salt size when certain key sizes are used. We used to not support
1024-bit keys with SHA-512, but now we support this by reducing the salt
size to 62. Update the "hash too large" test to use a 1016-bit RSA key
with SHA-512, which still has too large of a hash because we will not
reduce the salt size further than 2 bytes shorter than the hash size.

The RSA private key used for the test was generated using "openssl
genrsa 1016" using OpenSSL 1.1.1-pre8.

    $ openssl genrsa 1016
    Generating RSA private key, 1016 bit long modulus (2 primes)
    ..............++++++
    ....++++++
    e is 65537 (0x010001)
    -----BEGIN RSA PRIVATE KEY-----
    MIICVwIBAAKBgACu54dKTbLxUQBEQF2ynxTfDze7z2H8vMmUo9McqvhYp0zI8qQK
    yanOeqmgaA9iz52NS4JxFFM/2/hvFvyd/ly/hX2GE1UZpGEf/FnLdHOGFhmnjj7D
    FHFegEz/gtbzLp9X3fOQVjYpiDvTT0Do20EyCbFRzul9gXpdZcfaVHNLAgMBAAEC
    gYAAiWht2ksmnP01B2nF8tGV1RQghhUL90Hd4D/AWFJdX1C4O1qc07jRBd1KLDH0
    fH19WocLCImeSZooGCZn+jveTuaEH14w6I0EfnpKDcpWVAoIP6I8eSdAttrnTyTn
    Y7VgPrcobyq4WkCVCD/jLUbn97CneF7EHNspXGMTvorMeQJADjy2hF5SginhnPsk
    YR5oWawc6n01mStuLnloI8Uq/6A0AOQoMPkGl/CESZw+NYfe/BnnSeckM917cMKL
    DIKAtwJADEj55Frjj9tKUUO+N9eaEM1PH5eC7yakhIpESccs/XEsaDUIGHNjhctK
    mrbbWu+OlsVRA5z8yJFYIa7gae1mDQJABjtQ8JOQreTDGkFbZR84MbgCWClCIq89
    5R3DFZUiAw4OdS1o4ja+Shc+8DFxkWDNm6+C63g/Amy5sVuWHX2p9QI/a69Cxmns
    TxHoXm1w9Azublk7N7DgB26yqxlTfWJo+ysOFmLEk47g0ekoCwLPxkwXlYIEoad2
    JqPh418DwYExAkACcqrd9+rfxtrbCbTXHEizW7aHR+fVOr9lpXXDEZTlDJ57sRkS
    SpjXbAmylqQuKLqH8h/72RbiP36kEm5ptmw2
    -----END RSA PRIVATE KEY-----
2018-09-27 18:23:08 +01:00
..
aes.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
aesni.h Update Doxygen file blocks to remove copyright and license information 2018-01-23 15:44:39 +00:00
arc4.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
aria.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
asn1.h Merge remote-tracking branch 'upstream-restricted/pr/398' into development-restricted-proposed 2018-03-13 17:18:06 +01:00
asn1write.h Update Doxygen file blocks to remove copyright and license information 2018-01-23 15:44:39 +00:00
base64.h Update Doxygen file blocks to remove copyright and license information 2018-01-23 15:44:39 +00:00
bignum.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
blowfish.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
bn_mul.h Correct logic to exclude i386 inline assenbly when -O0 2018-07-23 13:31:32 +01:00
camellia.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
ccm.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
certs.h Update Doxygen file blocks to remove copyright and license information 2018-01-23 15:44:39 +00:00
chacha20.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
chachapoly.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
check_config.h Key wrapping API definition 2018-07-24 16:43:20 +01:00
cipher.h Merge remote-tracking branch 'upstream-public/pr/1861' into development 2018-08-10 11:17:14 +01:00
cipher_internal.h Move definition to cipher.h 2018-07-01 10:22:53 +03:00
cmac.h Remove unneeded namesapcing in header files 2018-06-24 16:56:47 +03:00
compat-1.3.h Let MBEDTLS_SSL_MAX_CONTENT_LEN to be split into outward & inward sizes 2018-06-18 20:51:51 +10:00
config.h Correct typo in documentation of MBEDTLS_SSL_DTLS_MAX_BUFFERING 2018-08-28 14:42:15 +01:00
ctr_drbg.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
debug.h Update Doxygen file blocks to remove copyright and license information 2018-01-23 15:44:39 +00:00
des.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
dhm.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
ecdh.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
ecdsa.h Update ecdsa.h 2018-04-23 06:16:40 +01:00
ecjpake.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
ecp.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
ecp_internal.h Fix minor code style issues 2018-05-15 09:21:57 +01:00
entropy.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
entropy_poll.h Update Doxygen file blocks to remove copyright and license information 2018-01-23 15:44:39 +00:00
error.h Merge branch 'development' into iotssl-2257-chacha-poly-primitives 2018-06-19 11:13:50 +02:00
gcm.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
havege.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
hkdf.h HKDF: Add warning to partial functions 2018-08-14 16:08:38 +01:00
hmac_drbg.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
md.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
md2.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
md4.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
md5.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
md_internal.h Merge remote-tracking branch 'upstream-public/pr/1294' into development 2018-01-25 14:47:39 +00:00
memory_buffer_alloc.h Update Doxygen file blocks to remove copyright and license information 2018-01-23 15:44:39 +00:00
net.h Remove unneeded namesapcing in header files 2018-06-24 16:56:47 +03:00
net_sockets.h Merge remote-tracking branch 'upstream-public/pr/1861' into development 2018-08-10 11:17:14 +01:00
nist_kw.h Key wrapping API definition 2018-07-24 16:43:20 +01:00
oid.h Merge remote-tracking branch 'upstream-public/pr/1861' into development 2018-08-10 11:17:14 +01:00
padlock.h Update Doxygen file blocks to remove copyright and license information 2018-01-23 15:44:39 +00:00
pem.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
pk.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
pk_internal.h Update Doxygen file blocks to remove copyright and license information 2018-01-23 15:44:39 +00:00
pkcs5.h Update Doxygen file blocks to remove copyright and license information 2018-01-23 15:44:39 +00:00
pkcs11.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
pkcs12.h Update Doxygen file blocks to remove copyright and license information 2018-01-23 15:44:39 +00:00
platform.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
platform_time.h Update Doxygen file blocks to remove copyright and license information 2018-01-23 15:44:39 +00:00
platform_util.h Improve mbedtls_platform_zeroize() docs 2018-04-24 08:37:52 -05:00
poly1305.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
ripemd160.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
rsa.h rsa: pss: Enable use of big hashes with small keys 2018-09-27 18:23:08 +01:00
rsa_internal.h Merge remote-tracking branch 'upstream-public/pr/1457' into development-proposed 2018-04-04 09:19:27 +02:00
sha1.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
sha256.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
sha512.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
ssl.h Style: Spell out PMTU in ssl.h 2018-08-28 10:29:17 +01:00
ssl_cache.h Update Doxygen file blocks to remove copyright and license information 2018-01-23 15:44:39 +00:00
ssl_ciphersuites.h Declare ChaCha-Poly ciphersuites 2018-06-19 12:11:38 +02:00
ssl_cookie.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
ssl_internal.h Don't use uint8_t for bitfields 2018-08-22 13:32:50 +01:00
ssl_ticket.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
threading.h Merge remote-tracking branch 'upstream-public/pr/1861' into development 2018-08-10 11:17:14 +01:00
timing.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
version.h Update version to 2.12.0 2018-07-25 15:42:26 +01:00
x509.h Update Doxygen file blocks to remove copyright and license information 2018-01-23 15:44:39 +00:00
x509_crl.h Update Doxygen file blocks to remove copyright and license information 2018-01-23 15:44:39 +00:00
x509_crt.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00
x509_csr.h Update Doxygen file blocks to remove copyright and license information 2018-01-23 15:44:39 +00:00
xtea.h Allow to forward declare of public structs #1215 2018-07-24 10:02:47 +02:00