summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/a_string.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Garbage collect the unused asn1_add_error()tb2022-11-281-7/+1
| | | | ok jsing
* Make internal header file names consistenttb2022-11-261-2/+2
| | | | | | | | | | | | | | | | Libcrypto currently has a mess of *_lcl.h, *_locl.h, and *_local.h names used for internal headers. Move all these headers we inherited from OpenSSL to *_local.h, reserving the name *_internal.h for our own code. Similarly, move dtls_locl.h and ssl_locl.h to dtls_local and ssl_local.h. constant_time_locl.h is moved to constant_time.h since it's special. Adjust all .c files in libcrypto, libssl and regress. The diff is mechanical with the exception of tls13_quic.c, where #include <ssl_locl.h> was fixed manually. discussed with jsing, no objection bcook
* Drop *out == NULL check in ASN1_STRING_to_UTF8()tb2022-05-201-2/+6
| | | | | | | | | Unfortunately, several things in the ecosystem depend on the existing API behavior of being able to pass in an uninitialized pointer on the stack: haproxy, grpc, mongo-tools and others show up on the first two pages of Debian codesearch. ok jsing
* Clean up and fix ASN1_STRING_to_UTF8()tb2022-05-161-12/+23
| | | | | | | | | Instead of using a temporary variable on the stack, we can use the usual Henson mechanism for allocating the struct. Make the function single exit and throw an error instead of crashing or leaking if out is NULL or *out is non-NULL. tweaks/ok jsing
* Remove a stray spacetb2022-05-161-2/+2
|
* Avoid use of uninitialized in ASN1_STRING_to_UTF8()tb2022-05-161-4/+3
| | | | | | | | | | | | A long standing failure to initialize a struct on the stack fully was exposed by a recent refactoring. Fortunately, the uninitialized 'flag' member is only used to decide whether or not to call freezero(NULL, 0), so it is completely harmless. This is a first trivial fix, a better version will be landed separately with regress. Reported by Steffen Jaeckel, GH #760 ok beck
* Rework ASN1_STRING_set()jsing2022-03-171-14/+21
| | | | | | | | | | | Rework ASN1_STRING_set() so that we always clear and free an existing allocation, prior to storing the new data. This fixes a number of issues, including a failure to zero data if the existing allocation was too small. This also fixes other bugs such as leaving the allocation uninitialised if NULL is passed for data. Require -1 where strlen() is expected and improve length and overflow checks. ok inoguchi@ tb@
* Factor out ASN1_STRING clearing code.jsing2022-03-141-4/+15
| | | | | | | This fixes a bug in ASN1_STRING_set0() where it does not respect the ASN1_STRING_FLAG_NDEF flag and potentially frees memory that we do not own. ok inguchi@ tb@
* First pass clean up of ASN1_STRING code.jsing2022-03-141-74/+87
| | | | | | | Use consistent variable names (astr/src) rather than 'a', 'bs', 'str', 'v' or 'x', add some whitespace and remove some unneeded parentheses. ok inoguchi@ tb@
* Indent goto labels for diffability.jsing2021-12-251-4/+4
| | | | Whitespace change only.
* Move more ASN1_STRING_* functions to a_string.c.jsing2021-12-251-1/+60
| | | | No functional change.
* Reorder some functions.jsing2021-12-241-46/+46
| | | | No functional change.
* Consolidate various ASN.1 code.jsing2021-12-151-0/+333
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@