summaryrefslogtreecommitdiffstats
path: root/lib/libcrypto/ui
AgeCommit message (Collapse)AuthorFilesLines
2020-09-25KNF for a few comments and indent a labeltb1-8/+12
2020-09-25Remove some dangling elses for consistency with the rest of the filetb1-25/+19
2020-09-25Simplify UI_new_method()tb1-10/+4
Use calloc() instead of malloc() and setting all members manually to 0. Avoid unnecessary else branch.
2020-09-25Move variable declaration to the top of UI_set_result and ditchtb1-19/+16
a pointless local scope. suggested by jsing
2020-09-25The default branch of a switch somehow got moved inside of a pointlesstb1-3/+3
local scope of a case branch. Move it into the proper location. No binary change on amd64. "sure" jsing
2020-09-25Simplify call to ERR_print_errors_cb()tb1-5/+4
There is no reason for print_error()'s third argument to be a UI *. It may just as well be a void * to match what ERR_print_errors_cb() expects. This avoids casting the function pointer. Also, there's no need for a (void *) cast. ok jsing
2020-09-24Error out if ok_chars and cancel_chars overlaptb1-2/+4
It is a bit silly to push an error on the stack without erroring out, so error out if the ok_chars and cancel_chars overlap. ok jsing
2020-09-24Fix a number of leaks in the UI_dup_* functionstb1-142/+98
If any of general_allocate_{prompt,string,boolean}() fail, the UI_dup_* functions may leak the strings they strduped beforehand. Instead, use strdup inside these functions, so we can free as necessary. This makes the UI_add_* and UI_dup_* simple wrappers around general_allocate_{string,boolean}() that differ only in passing a Boolean that indicates whether or not to use strdup. Make a general cleanup pass over these functions, simplify the logic and make it overall a bit easier to follow. While there, use strcspn() instead of a handrolled variant. The only changes in behavior are that ERR_R_MALLOC_FAILURE is now pushed onto the stack a bit more often and that UI_dup_input_string() now returns -1 on failure to dup prompt like all the other UI_dup_* functions. This is not a problem since the manual already documents that errors are signaled with <= 0. The only consumer of this function according to Debian's codesearch is libp11, I sent them a PR to fix their (already broken) error handling. Addresses about 10 errors thrown by the LLVM static analyzer in ui/. ok jsing
2020-09-24Push ERR_R_MALLOC_FAILURE onto the error stacktb1-3/+3
If sk_UI_STRING_new_null() fails, this must be due to a memory error, so signal this to the user. ok jsing
2020-09-24Make free_strings() NULL safetb1-1/+3
ok jsing
2020-09-24KNF and grammar tweaks for comments; wrap a few overlong prototypes.tb1-161/+186
2018-06-02Add a const qualifier to the argument of UI_method_get_closer(),tb2-14/+14
UI_method_get_flusher(), UI_method_get_opener(), UI_method_get_prompt_constructor(), UI_method_get_reader(), and UI_method_get_writer(). tested in a bulk build by sthen ok jsing
2018-05-19UI_METHOD *UI_create_method(const char *name).tb2-4/+4
^^^^^ tested in a bulk build by sthen ok jsing
2017-01-29Send the function codes from the error functions to the bit bucket,beck2-42/+25
as was done earlier in libssl. Thanks inoguchi@ for noticing libssl had more reacharounds into this. ok jsing@ inoguchi@
2016-12-21Explicitly export a list of symbols from libcrypto.jsing1-1/+5
Move the "internal" BN functions from bn.h to bn_lcl.h and stop exporting the bn_* symbols. These are documented as only being intended for internal use, so why they were placed in a public header is beyond me... This hides 363 previously exported symbols, most of which exist in headers that are not installed and were never intended to be public. This also removes a few crusty old things that should have died long ago (like _ossl_old_des_read_pw). But don't worry... there are still 3451 symbols exported from the library. With input and testing from inoguchi@. ok beck@ inoguchi@
2016-04-28don't go into an unbreakable infinite loop during operations suchtedu1-1/+2
as reading passwords. allow ^C to break. the pain was mine, the fix is miod's.
2015-09-10Correct spelling of OPENSSL_cleanse.jsing2-4/+4
ok miod@
2015-07-16After reading a password with terminal echo off, restore the terminal toguenther1-6/+5
its original state instead of blindly turning echo on. problem reported on the openssl-dev list by William Freeman ok miod@ beck@
2015-02-10Remove more IMPLEMENT_STACK_OF noops that have been hiding for the lastjsing1-2/+2
15 years.
2014-10-03Use string literals in printf style calls so gcc's -Wformat works.doug1-6/+10
ok tedu@, miod@
2014-07-22Kill a bunch more BUF_strdup's - these are converted to have a check forbeck1-3/+3
NULL before an intrinsic strdup. ok miod@
2014-07-13The bell tolls for BUF_strdup - Start the migration to usingbeck1-9/+9
intrinsics. This is the easy ones, a few left to check one at a time. ok miod@ deraadt@
2014-07-13remove silly castderaadt1-2/+2
2014-07-11adapt addapt spelling to adapt; request from miodderaadt1-3/+3
2014-07-11Only import cryptlib.h in the four source files that actually need it.jsing2-12/+8
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@
2014-07-10Explicitly include <openssl/opensslconf.h> in every file that referencesjsing2-2/+7
an OPENSSL_NO_* define. This avoids relying on something else pulling it in for us, plus it fixes several cases where the #ifndef OPENSSL_NO_XYZ is never going to do anything, since OPENSSL_NO_XYZ will never defined, due to the fact that opensslconf.h has not been included. This also includes some miscellaneous sorting/tidying of headers.
2014-06-12tags as requested by miod and teduderaadt7-7/+8
2014-06-11c-file-style hints, begone; ok beckderaadt6-6/+6
2014-06-07malloc() result does not need a cast.deraadt1-2/+2
ok miod
2014-05-25calloc instead of malloc/memset. from Benjamin Baiertedu1-4/+3
2014-05-24Almost nothing actually needs to include <openssl/e_os2.h>, however byjsing2-2/+5
including it they get <openssl/opensslconf.h>. So instead of pulling in <openssl/e_os2.h>, just pull in <openssl/opensslconf.h>. "go ahead" miod@
2014-05-22if (x) free(x) -> free(x); semantic patch generated with coccinelle, carefullymiod1-8/+4
eyeballed before applying. Contributed by Cyril Roelandt on tech@
2014-04-27Use C99 initializers for the various FOO_METHOD structs. More readable, andmiod1-7/+5
avoid unreadable/unmaintainable constructs like that: const EVP_PKEY_ASN1_METHOD cmac_asn1_meth = { EVP_PKEY_CMAC, EVP_PKEY_CMAC, 0, "CMAC", "OpenSSL CMAC method", 0,0,0,0, 0,0,0, cmac_size, 0, 0,0,0,0,0,0,0, cmac_key_free, 0, 0,0 }; ok matthew@ deraadt@
2014-04-27We do not need a separate file for two compatibility wrapper functions.jsing2-69/+18
ok miod@
2014-04-26Replace all use of ERR_add_error_data with ERR_asprintf_error_data.beck1-24/+19
This avoids a lot of ugly gymnastics to do snprintfs before sending the bag of strings to ERR, and eliminates at least one place in dso_dlfctn.c where it was being called with the incorrect number of arguments and using random things off the stack as addresses of strings. ok krw@, jsing@
2014-04-25Clean up the remaining TTY related remnants.jsing1-41/+8
ok miod@
2014-04-25Use const char *.jsing1-1/+1
Suggested by miod@
2014-04-24Remove some malloc/strlcpy/strlcat horror. Just use asprintf and avoid anjsing1-23/+10
unchecked malloc at the same time. ok beck@
2014-04-24You want signals?!? I'll give you signals!!! Oh, and we have termios asjsing1-36/+0
well... ok beck@
2014-04-24More KNF.jsing2-37/+37
2014-04-20Restore beck's rev 1.8: snprintf() was reviewed.guenther1-2/+2
2014-04-19We'll interpret a (void) cast on snprintf() to mean it's been verified thatguenther1-2/+2
truncation is either desirable, not an issue, or is detected and handled later ok deraadt@
2014-04-19use intrinsic strlcpy and strlcat everywhere so we only have one set ofbeck1-6/+6
funcitons to check for incorrect use. keep BUF_strlcpy and BUF_strlcat for API comptibility only. ok tedu@
2014-04-18More KNF.jsing8-203/+195
2014-04-17stab at indentationtedu5-721/+709
2014-04-17Change library to use intrinsic memory allocation functions instead ofbeck3-18/+18
OPENSSL_foo wrappers. This changes: OPENSSL_malloc->malloc OPENSSL_free->free OPENSSL_relloc->realloc OPENSSL_freeFunc->free
2014-04-16whack the ifdef pinata:tedu1-260/+5
OPENSSL_SYSNAME_VXWORKS OPENSSL_SYS_VMS OPENSSL_SYS_MSDOS OPENSSL_UNISTD OPENSSL_SYS_WIN16 WIN_CONSOLE_BUG OPENSSL_SYS_WINCE SGTTY OPENSSL_SYS_MACINTOSH_CLASSIC MAC_OS_GUSI_SOURCE OPENSSL_SYS_NETWARE OPENSSL_SYS_SUNOS __DJGPP__ OPENSSL_SYS_BEOS OPENSSL_SYS_WIN32
2014-04-15we don't use these files for buildingtedu1-79/+0
2014-04-15Part 1 of eliminating BIO_snprintf(). This fixes mechanical conversionsbeck1-2/+2
where the return value is ignored changing to (void) snprintf. ok deraadt@
2014-04-14remove auto-generated dependencies from the old unused build system, soderaadt1-32/+0
that it is easier to find code pieces. They are getting in the way. ok miod