summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/a_bitstr.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Hide global _it variables in asn1.hbeck2024-07-081-1/+2
| | | | ok tb@
* Avoid out-of-bounds accesses in ASN1_BIT_STRING_{get,set}()tb2023-12-251-14/+26
| | | | | | | | | | | | If a negative n is passed, these functions would underrun the bitstring's data array. So add checks for that and drop spades of unnecessary parens. These functions are quite broken anyway. The setter attempts to zap the unnecessary trailing zero octets, but fails to do so if the bit being cleared isn't already set. Worse is the getter where you can't tell an error (like attempting an out-of-bounds read) from the bit being unset. ok joshua
* Remove more ASN1_BIT_STRING APItb2023-07-281-53/+1
| | | | | | | | | This removes ASN1_BIT_STRING_name_print(), ASN1_BIT_STRING_{num,set}_asc(). Before trust was properly handled using OIDs, there was a period where it used bit strings. The actual interfaces used in openssl x509 were removed, but the functions they wrapped remained unused for the next 24 years. ok jsing
* Remove ASN1_BIT_STRING_checktb2023-07-281-28/+1
| | | | | | | | This was added with the TS code for no discernible reason. I could not find a single consumer. In the unlikely event that you need this, it is easy enough to write a better version of it yourself. ok jsing
* Hide symbols in asn1 and biobeck2023-07-051-1/+12
| | | | ok jsing@
* Prevent 1-byte out-of-bounds read in i2c_ASN1_BIT_STRINGtb2023-01-131-2/+4
| | | | | | | | | | If an ASN.1 BIT STRING a of length > 0 contains only zero bytes in a->data, this old code would end up reading from a->data[-1]. This may or may not crash. Luckily, anton observed two openssl-ruby regress test failures in the last few days, which could eventually be traced back to this (after a lot of painful digging due to coredumps not working properly). ok jsing
* Avoid signed integer overflow in i2c_ASN1_BIT_STRING()tb2022-11-081-5/+9
| | | | | | | | | If the length of the bitstring is INT_MAX, adding 1 to it is undefined behavior, so error out before doing so. Based on BoringSSL eeb3333f by davidben ok beck joshua
* Expose asn1_abs_set_unused_bits() in asn1_locl.htb2022-05-171-2/+2
| | | | | | Should have been part of a previous commit. ok jsing
* Decode via c2i_ASN1_BIT_STRING_cbs() from asn1_ex_c2i().jsing2022-04-261-3/+8
| | | | ok inoguchi@ tb@
* Rewrite c2i_ASN1_BIT_STRING() using CBS.jsing2022-04-231-44/+83
| | | | | | | | | Also switch to freeing and allocating, rather than attempting to recycle. While here, factor out the flags ASN1_STRING_FLAG_BITS_LEFT bit bashing and use the name "unused bits" rather than "bits left", to be more inline with X.690 wording. ok inoguchi@ tb@
* Consolidate code/templates for ASN.1 types.jsing2021-12-251-1/+33
| | | | | | | Where an ASN.1 type has its own file, move the ASN.1 item template and template related functions into the file. Discussed with tb@
* Move ASN1_<type>_* functions to the top, encoding/decoding to the bottom.jsing2021-12-251-122/+122
| | | | No functional change.
* Consolidate various ASN.1 code.jsing2021-12-151-1/+52
| | | | | | | | | Rather than having multiple files per type (with minimal code per file), use one file per type (a_<type>.c). No functional change. Discussed with tb@
* Remove unnecessary zeroing after recallocarray(3)tb2020-09-031-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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);
* Avoid calling memcpy with a length <= 0. Reported due to a GCC 7.3.0tb2018-10-201-5/+6
| | | | | | | compiler warning by Pavel Kraynyukhov. A similar fix was made in OpenSSL commit 369e93398b68b8a328e6c1d766222b. ok inoguchi
* Use recallocarray() instead of OPENSSL_realloc_clean().jsing2018-05-131-5/+2
| | | | | | | Also place all of the OPENSSL_* memory related prototypes under #ifndef LIBRESSL_INTERNAL. ok beck@ tb@
* Cleanup c2i_ASN1_BIT_STRING() code.jsing2018-05-121-20/+23
| | | | | | | | | | 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@
* Add a missing bounds check in c2i_ASN1_BIT_STRING().jsing2018-05-121-1/+6
| | | | | | | | | 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@
* Add const to functions in asn1/asn1.h as they did in OpenSSL.tb2018-04-251-3/+4
| | | | | | | BIO_f_asn1() will be taken care of later. Tested in a bulk by sthen ok bcook jca jsing
* Send the function codes from the error functions to the bit bucket,beck2017-01-291-3/+3
| | | | | | as was done earlier in libssl. Thanks inoguchi@ for noticing libssl had more reacharounds into this. ok jsing@ inoguchi@
* Replace remaining M_ASN1_BIT_STRING_(new|free) macros with calls tojsing2015-09-291-3/+3
| | | | | | ASN1_BIT_STRING_(new|free). ok beck@ doug@
* Expand obsolete M_ASN1.*(cmp|dup|print|set) macros - no change in generatedjsing2015-07-291-2/+2
| | | | | | assembly. ok bcook@
* Drop stupid (int) casts for the arguments of malloc() and friends. This ismiod2015-07-191-2/+2
| | | | | not 16-bit MS-DOS anymore. ok bcook@ tedu@
* Only import cryptlib.h in the four source files that actually need it.jsing2014-07-111-2/+2
| | | | | | | | Remove the openssl public includes from cryptlib.h and add a small number of includes into the source files that actually need them. While here, also sort/group/tidy the includes. ok beck@ miod@
* Stop including standard headers via cryptlib.h - pull in the headers thatjsing2014-07-101-1/+3
| | | | | | are needed in the source files that actually require them. ok beck@ miod@
* delete some casts. ok miodtedu2014-07-101-2/+2
|
* tags as requested by miod and teduderaadt2014-06-121-1/+1
|
* more: no need for null check before freederaadt2014-05-301-2/+1
| | | | ok tedu guenther
* improve realloc/calloc/malloc patterns; ok guentherderaadt2014-04-211-6/+2
|
* More KNF.jsing2014-04-181-2/+2
|
* Initial KNF.jsing2014-04-171-130/+144
|
* Change library to use intrinsic memory allocation functions instead ofbeck2014-04-171-3/+3
| | | | | | | | OPENSSL_foo wrappers. This changes: OPENSSL_malloc->malloc OPENSSL_free->free OPENSSL_relloc->realloc OPENSSL_freeFunc->free
* resolve conflicts, fix local changesdjm2010-10-011-0/+23
|
* resolve conflictsdjm2008-09-061-5/+8
|
* resolve conflictsdjm2005-04-291-2/+6
|
* merge 0.9.7b with local changes; crank majors for libssl/libcryptomarkus2003-05-121-1/+3
|
* merge with openssl-0.9.7-stable-SNAP-20020911,markus2002-09-141-0/+6
| | | | | new minor for libcrypto (_X509_REQ_print_ex) tested by miod@, pb@
* Merge OpenSSL 0.9.7-stable-20020605,beck2002-06-071-2/+4
| | | | correctly autogenerate obj_mac.h
* OpenSSL 0.9.7 stable 2002 05 08 mergebeck2002-05-151-52/+1
|
* openssl-engine-0.9.6 mergebeck2000-12-151-23/+51
|
* OpenSSL 0.9.5 mergebeck2000-03-191-3/+12
| | | | | | *warning* this bumps shared lib minors for libssl and libcrypto from 2.1 to 2.2 if you are using the ssl26 packages for ssh and other things to work you will need to get new ones (see ~beck/libsslsnap/<arch>) on cvs or ~beck/src-patent.tar.gz on cvs
* OpenSSL 0.9.4 mergebeck1999-09-291-30/+48
|
* Import of SSLeay-0.9.0b with RSA and IDEA stubbed + OpenBSD buildryker1998-10-051-0/+204
functionality for shared libs. Note that routines such as sslv2_init and friends that use RSA will not work due to lack of RSA in this library. Needs documentation and help from ports for easy upgrade to full functionality where legally possible.