openssl/providers/implementations
Matt Caswell 36cf45ef3b Correctly calculate the length of SM2 plaintext given the ciphertext
Previously the length of the SM2 plaintext could be incorrectly calculated.
The plaintext length was calculated by taking the ciphertext length and
taking off an "overhead" value.

The overhead value was assumed to have a "fixed" element of 10 bytes.
This is incorrect since in some circumstances it can be more than 10 bytes.
Additionally the overhead included the length of two integers C1x and C1y,
which were assumed to be the same length as the field size (32 bytes for
the SM2 curve). However in some cases these integers can have an additional
padding byte when the msb is set, to disambiguate them from negative
integers. Additionally the integers can also be less than 32 bytes in
length in some cases.

If the calculated overhead is incorrect and larger than the actual value
this can result in the calculated plaintext length being too small.
Applications are likely to allocate buffer sizes based on this and therefore
a buffer overrun can occur.

CVE-2021-3711

Issue reported by John Ouyang.

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
2021-08-24 14:22:07 +01:00
..
asymciphers Correctly calculate the length of SM2 plaintext given the ciphertext 2021-08-24 14:22:07 +01:00
ciphers Fix CTS cipher decrypt so that the updated IV is returned correctly. 2021-08-18 08:38:40 +10:00
digests
encode_decode Fix VS2019 compile error C4703: potentially uninitialized local pointer variable used. 2021-08-06 09:24:23 +10:00
exchange Rename all getters to use get/get0 in name 2021-06-01 12:40:00 +02:00
include/prov Add support for camellia cbc cts mode 2021-08-18 08:38:40 +10:00
kdfs pkcs12: check for zero length digest to avoid division by zero 2021-08-18 16:14:42 +10:00
kem prov: add zero strenght arguments to BN and RAND RNG calls 2021-05-29 17:17:12 +10:00
keymgmt fips module header inclusion fine-tunning 2021-07-06 10:52:27 +10:00
macs fips module header inclusion fine-tunning 2021-07-06 10:52:27 +10:00
rands MacOS: Add an include of <CommonCrypto/CommonCryptoError.h> 2021-08-11 09:29:39 +02:00
signature Allow RSA signature operations with RSA_NO_PADDING 2021-07-16 11:29:26 +02:00
storemgmt Update copyright year 2021-07-29 15:41:35 +01:00
build.info