| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
Rather than recycling an existing ASN1_STRING and changing its type, free
it and allocate a replacement. This simplifies the code and potentially
avoids bugs resulting from reuse.
ok tb@
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
Per X.690, some ASN.1 types must be primitive encoded, some must be
constructed and some may be either. Add this data to our types table
and check the encoding against this information when decoding.
ok tb@
|
|
|
|
|
|
|
| |
This avoids asn1_c2i_primitive() from needing knowledge about the internals
of ASN1_INTEGER and ASN1_ENUMERATED.
ok tb@
|
|
|
|
|
|
|
|
|
|
| |
OPENSSL_cleanup() cleans up and deallocates memory in use by the library.
There are a couple of use cases for this, primarily related to memory
leak testing. This will not be called automatically in LibreSSL, which
means that OpenSSL's OPENSSL_NO_INIT_ATEXIT is implied. If code wants to
clean up then they need to explicitly call this themselves.
ok tb@
|
|
|
|
| |
From Joshua Sing
|
|
|
|
|
|
|
|
|
| |
CBIGNUM_it is supposed to be the "clear bignum" or "secure" bignum - that
is one which zeros its memory after use and ensures that the constant time
flags are set... in LibreSSL we always do both of these things for BIGNUMs,
so just use BIGNUM_it instead.
ok tb@
|
|
|
|
| |
From Joshua Sing
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
These exercise MD4 and MD5 with the test vectors from RFCs 1320 and 1321.
From Joshua Sing <joshua () hypera ! dev>
|
| |
|
| |
|
|
|
|
| |
for output, use 'err' as a label and avoid some silly repetitions.
|
|
|
|
|
|
| |
The old tests were incomplete, some of them had no license and the code
quality was questionable. The new tests by Joshua Sing cover what they
did (and additionally SHA-224 and SHA-384). Many thanks!
|
| |
|
|
|
|
| |
From Joshua Sing
|
|
|
|
|
|
| |
CID 24797
ok jsing
|
| |
|
|
|
|
|
|
|
| |
This tests covers the NIST vectors for SHA-{1,224,256,384,256} and will
soon be able to replace the old SHA tests entirely.
From Joshua Sing <joshua () hypera ! dev>
|
| |
|
|
|
|
|
|
|
|
| |
EVP_PKEY_copy_parameters() will unconditionally fail if the pkey's ameth
has no copy_params(). Obviously this is indistinguishable from actual
failure...
ok jsing
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
DSA_size() and ECDSA_size() have a very special hack. They fudge up an
ASN1_INTEGER with a size which is typically > 100 bytes, backed by a
buffer of size 4. This was "fine", however, since they set buf[0] = 0xff,
where the craziness that was i2c_ASN1_INTEGER() only looks at the first
octet (one may then ask why a buffer of size 4 was necessary...).
This changed with the rewrite of i2c_ASN1_INTEGER(), which doesn't
respect this particular hack and rightly assumes that it is fed an
actual ASN1_INTEGER...
Instead, create an appropriate signature and use i2d to determine its
size.
Fixes an out-of-bounds read flagged by ASAN and oss-fuzz.
ok jsing
|
|
|
|
| |
CID 184043
|
| |
|
|
|
|
|
|
| |
The ASN.1 encoding of the modified ECDSA signature can grow in size due to
padding of the ASN.1 integers. Instead of reusing the same signature buffer
freshly allocate it. Avoids some buffer overflows caught by ASAN.
|
| |
|
|
|
|
|
|
| |
The ASN.1 encoding of the modified ECDSA signature can grow in size due to
padding of the ASN.1 integers. Instead of reusing the same signature buffer
freshly allocate it. Avoids some buffer overflows caught by ASAN.
|
|
|
|
|
|
|
|
|
| |
sk_num() can return a negative value, in which case the upper bound is
SIZE_MAX, which results in a very long for loop.
CID 153997
ok jsing
|
|
|
|
|
|
|
|
|
|
| |
Use EVP_PKEY_get0_EC_KEY() instead of the get1 version to avoid an
EVP_PKEY_free(). Check return values: if either EVP_PKEY_get0_EC_KEY()
or EC_KEY_get0_group() fail, a NULL dereference occurs.
CID 43289
ok jsing
|
|
|
|
|
|
|
|
|
|
|
| |
Switch from X509_get_pubkey() to X509_get0_pubkey() to avoid an unnecessary
EVP_PKEY_free(). Check the return values of X509_get0_pubkey() and
EVP_PKEY_copy_parameters(). If the former returns NULL, the latter will
dereference NULL.
CID 25020
ok jsing
|
|
|
|
| |
CID 25421
|
| |
|
|
|
|
|
|
| |
Otherwise EVP_CIPHER_CTX_cleanup() leaks, as spotted by the ASAN CI.
ok jsing
|
|
|
|
|
|
|
| |
If rbio and wbio are the same, SSL_free() only frees one BIO, so the
BIO_up_ref() before SSL_set_bio() leads to a leak.
ok jsing
|
|
|
|
|
|
| |
CID 356353
ok jsing
|
| |
|
|
|
|
|
|
| |
Needed for an upcoming change.
ok tb@
|
|
|
|
|
|
| |
Needed for an upcoming change.
ok tb@
|
|
|
|
|
|
|
|
|
| |
c99 6.11.5:
"The placement of a storage-class specifier other than at the beginning
of the declaration specifiers in a declaration is an obsolescent
feature."
ok miod@ tb@
|
|
|
|
|
|
| |
ASN1_INTEGER_set() fails.
ok jsing
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
When an ASN1_INTEGER is created it has NULL data until a value is set -
previously, an ASN1_INTEGER in this state encoded to an ASN.1 INTEGER with
a value of 0, rather than being treated as an error. While code should
really set values, the historical behaviour has not required this.
Found the hard way by sthen@ with acme-client.
ok tb@
|
|
|
|
| |
inline use was removed in 1998
|
| |
|