| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
X509_CERT_AUX_print().
Commit in -current:
CVSROOT: /cvs
Module name: src
Changes by: schwarze@cvs.openbsd.org 2021/07/10 11:45:16
Modified files:
lib/libcrypto/asn1: t_x509a.c
Log message:
Fix a read buffer overrun in X509_CERT_AUX_print(3),
which by implication also affects X509_print(3).
The ASN1_STRING_get0_data(3) manual explitely cautions the reader
that the data is not necessarily NUL-terminated, and the function
X509_alias_set1(3) does not sanitize the data passed into it in
any way either, so we must assume the alias->data field is merely
a byte array and not necessarily a string in the sense of the C
language.
I found this bug while writing manual pages for these functions.
OK tb@
As an aside, note that the function still produces incomplete and
misleading results when the data contains a NUL byte in the middle
and that error handling is consistently absent throughout, even
though the function provides an "int" return value obviously intended
to be 1 for success and 0 for failure, and even though this function
is called by another function that also wants to return 1 for success
and 0 for failure and even does so in many of its code paths, though
not in others. But let's stay focussed. Many things would be nice
to have in the wide wild world, but a buffer overflow must not be
allowed to remain in our backyard.
This is patches/6.8/common/029_x509.patch.sig
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Comparing two GENERAL_NAME structures containing an EDIPARTYNAME can lead
to a crash. This enables a denial of service attack for an attacker who can
control both sides of the comparison.
Issue reported to OpenSSL on Nov 9 by David Benjamin.
OpenSSL shared the information with us on Dec 1st.
Fix from Matt Caswell (OpenSSL) with a few small tweaks.
ok jsing
this is errata/6.8/008_asn1.patch.sig
|
|
|
|
|
|
|
|
|
|
| |
Instead of using malloc(3) and manually setting part of the structure to
zero, part to something else and leaving the rest uninitialized, we can
benefit from the fact that there's this thing called calloc(3).
Moreover, all variants of free(3) in libcrypto are NULL safe.
ok beck inoguchi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Zap a memset that was redundant since OpenSSL 0.97b was merged by
markus in 2003. Nowadays it's otto's recallocarray(3) that does the
zeroing.
ok beck inoguchi otto
PS: ASN1_BIT_STRING_set_bit(3) was committed on Dec 21 1998 by Ralf S.
Engelschnall and used this bizarre allocation idiom:
if (a->data == NULL)
c=(unsigned char *)Malloc(w+1);
else
c=(unsigned char *)Realloc(a->data,w+1);
People complained about Malloc, Realloc and Free being used elsewhere, so
on Jun 1 2000, Richarde Levitte swept the OpenSSL tree and it became this.
if (a->data == NULL)
c=(unsigned char *)OPENSSL_malloc(w+1);
else
c=(unsigned char *)OPENSSL_realloc(a->data,w+1);
Then it was found that existing data should be cleaned, and on Nov 13 2002
Ben Laurie changed the last line to
c=(unsigned char *)OPENSSL_realloc_clean(a->data,
a->length,
w+1);
|
|
|
|
|
|
|
|
|
|
|
| |
failure rather than silently constructing a broken X509_ATTRIBUTE object
that might cause NULL pointer accesses later on. This matters because
X509_ATTRIBUTE_create() is used by documented API functions like
PKCS7_add_attribute(3) and the NID comes straight from the user.
This fixes a bug found while working on documentation.
OK tb@ and "thanks" bluhm@
|
|
|
|
|
|
|
|
|
| |
bytes in case ASN1_INTEGER_get() failed. This happens more often since
asn1/a_int.c -r1.34. Matches OpenSSL behavior.
Issue in openssl x509 -text output reported by sthen
ok jsing sthen
|
|
|
|
|
|
|
|
|
|
|
|
| |
Check and print out boolean type properly.
Based on OpenSSL commit ad72d9fdf7709ddb97a58d7d45d755e6e0504b96.
Reduced unneeded parentheses from if condition.
Check return value from i2s_ASN1_INTEGER.
Based on OpenSSL commit 5e3553c2de9a365479324b8ba8b998f0cce3e527.
Added if condition expression and return 0 if NULL is returned.
ok tb@
|
|
|
|
| |
ok tb@
|
|
|
|
| |
ok jsing@
|
|
|
|
| |
ok tb@
|
|
|
|
|
|
|
|
| |
These are internal only for now.
Based on OpenSSL 1.1.1d.
ok inoguchi@
|
|
|
|
| |
- Add static_ASN1_* macro. Patch was provided by steils AT gentoo.org
|
|
|
|
|
|
| |
fixes oss-fuzz #14558
ok beck jsing
|
|
|
|
|
|
|
|
| |
(same fix as in a_int.c rev 1.34)
Fixes oss-fuzz issue #13809
ok beck, jsing
|
|
|
|
|
|
| |
Fixes oss-fuzz issue #13804
ok beck, jsing
|
|
|
|
|
|
|
|
| |
minimum value.
Fixes oss-fuzz #14354.
ok beck@ bcook@ tb@
|
|
|
|
|
|
| |
Fixes oss-fuzz issue #13843.
ok tb@
|
|
|
|
|
|
|
|
|
|
|
| |
There are cases where the old_priv_decode() function can fail but consume
bytes. This will result in the pp pointer being advanced, which causes
d2i_PKCS8_PRIV_KEY_INFO() to be called with an advanced pointer and
incorrect length.
Fixes oss-fuzz #13803 and #14142.
ok deraadt@ tb@
|
|
|
|
|
|
|
|
|
|
|
| |
In this code, just because something is cast to a type doesn't mean it is
necessarily that type - in this case we cannot check the length of the
ASN1_STRING here, since it might be another data type and later handled
as an int (for example, in the V_ASN1_BOOLEAN case).
We will revisit this post release.
ok tb@
|
|
|
|
| |
ok beck@, tb@
|
|
|
|
|
|
|
| |
BIO_print() returns -1 on failure, whereas the ASN print functions need to
return 0.
ok beck@, tb@
|
|
|
|
|
|
|
|
|
|
|
|
| |
If an ASN.1 item provides its own ASN1_PRIMITIVE_FUNCS functions, require
all functions to be provided (currently excluding prim_clear). This avoids
situations such as having a custom allocator that returns a specific struct
but then is then printed using the default primative print functions, which
interpret the memory as a different struct.
Found by oss-fuzz, fixes issue #13799.
ok beck@, tb@
|
| |
|
| |
|
|
|
|
| |
From phrocker via github.
|
|
|
|
|
| |
depth of 128 - For oss-fuzz issue 13802
ok jsing@
|
|
|
|
|
|
| |
sizes used remain a positive integer. Should address issue
13799 from oss-fuzz
ok tb@ jsing@
|
|
|
|
|
|
|
|
|
|
|
| |
mechanical M_ASN1 macro expansion. The ASN1_INTEGER_cmp function
takes signs into account while ASN1_STRING_cmp doesn't. The mixups
mostly involve serialNumbers, which, in principle, should be positive.
However, it is unclear whether that is checked or enforced anywhere
in the code, so these are probably bugs.
Patch from Holger Mikolon
ok jsing
|
|
|
|
|
|
| |
This prototype was removed inadvertantly in r1.50.
OK jsing@
|
| |
|
|
|
|
| |
From Ben L <bobsayshilol () live ! co ! uk>
|
|
|
|
|
| |
From Ben L bobsayshilol () live ! co ! uk
Similar fixes in BoringSSL and OpensSSL.
|
|
|
|
|
|
| |
From Ben L bobsayshilol () live ! co ! uk
ok jsing
|
|
|
|
|
|
| |
previous clean up.
Spotted by bcook@
|
| |
|
|
|
|
|
|
| |
libcrypto (the "new" stuff replaced this back around 2000 or so...).
ok tb@
|
|
|
|
|
|
|
| |
compiler warning by Pavel Kraynyukhov. A similar fix was made in
OpenSSL commit 369e93398b68b8a328e6c1d766222b.
ok inoguchi
|
| |
|
|
|
|
|
|
|
|
|
| |
Requires adding a const to the priv_decode() member of
EVP_PKEY_ASN1_METHOD and adjusting all *_priv_decode()
functions. All this is already documented this way.
tested in a bulk build by sthen
ok jsing
|
|
|
|
|
|
|
|
| |
we can add const to PKCS8_pkey_get0(). In order for this to work,
we need to sprinkle a few consts here and there.
tested in a bulk by sthen
ok jsing
|
|
|
|
|
|
|
|
|
|
|
| |
Provide PKCS8_pkey_add1_attr_by_NID() and PKCS8_pkey_get0_attrs().
Remove the whole broken code and simplify pkcs8_priv_key_info_st
accordingly. Based on OpenSSL commit
54dbf42398e23349b59f258a3dd60387bbc5ba13 plus some const that was
added later.
tested in a bulk build by sthen
ok jsing
|
|
|
|
|
|
| |
those that OpenSSL has had for ages.
ok jsing
|
|
|
|
|
| |
Found by Coverity.
Feedback and ok tb@
|
|
|
|
|
|
|
|
| |
to do it a second time by hand, badly. While here, do some style cleanup.
This incomplete list of function pointers appears in EVP_PKEY_asn1_copy()
as well, fix it by adding sig_print to the members copied over.
ok bcook
|
|
|
|
|
| |
tested in a bulk build by sthen
ok jsing
|
|
|
|
|
|
|
| |
X509_NAME_print{,_ex{,_fp}}(3).
tested in a bulk build by sthen
ok jsing
|
|
|
|
|
|
|
| |
Also place all of the OPENSSL_* memory related prototypes under #ifndef
LIBRESSL_INTERNAL.
ok beck@ tb@
|
|
|
|
|
| |
tested in a bulk build by sthen
ok beck (as part of a larger diff)
|
|
|
|
|
|
|
|
|
|
| |
Avoid overloading a variable to store both a value and an error code - we
can simply inline the error calls (as done everywhere else). Remove a bunch
of unnecessary parentheses and tidy a few other things.
With input from tb@.
ok inoguchi@ tb@
|
|
|
|
|
|
|
|
|
| |
This could potentially result in a left shift that exceeded the size of the
storage type.
Issue found by Simon Friedberger, Robert Merget and Juraj Somorovsky.
ok inoguchi@ tb@
|