aboutsummaryrefslogtreecommitdiffstats
path: root/apps/srp.c
Commit message (Collapse)AuthorAgeFilesLines
* update SRP copyright noticeTim Hudson2018-03-131-0/+4
| | | | | | | As per discussion with Peter Sylvester Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5603)
* Update copyright yearMatt Caswell2018-02-131-1/+1
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* apps: Don't include progs.h in apps.hRichard Levitte2018-01-311-0/+1
| | | | | | | | | | | | | Everything in apps includes apps.h, because that one declares apps internal library routines. However, progs.h doesn't declare library routines, but rather the main commands and their options, and there's no reason why the library modules should include it. So, remove the inclusion of progs.h from apps.h and add that inclusion in all command source files. Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5222)
* Remove parentheses of return.KaoruToda2017-10-181-1/+1
| | | | | | | | | Since return is inconsistent, I removed unnecessary parentheses and unified them. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4541)
* Check # of arguments for remaining commands.Rich Salz2017-08-211-12/+9
| | | | | Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/4201)
* Fix some pedantic warnings.Pauli2017-07-171-1/+1
| | | | | | | Introduced by #3862 Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3944)
* Standardize apps use of -rand, etc.Rich Salz2017-07-161-11/+8
| | | | | | | | | | | | | | | | | | | | Standardized the -rand flag and added a new one: -rand file... Always reads the specified files -writerand file Always writes to the file on exit For apps that use a config file, the RANDFILE config parameter reads the file at startup (to seed the RNG) and write to it on exit if the -writerand flag isn't used. Ensured that every app that took -rand also took -writerand, and made sure all of that agreed with all the documentation. Fix error reporting in write_file and -rand Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/3862)
* Clean up a bundle of codingstyle stuff in apps directoryPaul Yang2017-06-121-14/+12
| | | | | | | | | Mostly braces and NULL pointer check and also copyright year bump Signed-off-by: Paul Yang <paulyang.inf@gmail.com> Reviewed-by: Kurt Roeckx <kurt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3657)
* Fix srp app missing NULL termination with password callbackDiego Santa Cruz2017-05-221-18/+24
| | | | | | | | | | | | | | | | | | The password_callback() function does not necessarily NULL terminate the password buffer, the caller must use the returned length but the srp app uses this function as if it was doing NULL termination. This made the -passin and -passout options of "openssl srp" fail inexpicably and randomly or even crash. Fixed by enlarging the buffer by one, so that the maximum password length remains unchanged, and adding NULL termination upon return. [Rearrange code for coding style compliance in process.] Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3475)
* Fix endless loop on srp app when listing usersDiego Santa Cruz2017-05-191-5/+8
| | | | | | | | | | With the -list option the srp app loops on the main while() endlessly, whether users were given on the command line or not. The loop should be stopped when in list mode and there are no more users. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3489)
* Fix some more memory leaks with TXT_DB_insert.Bernd Edlinger2017-02-211-3/+1
| | | | | Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2684)
* If an engine comes up explicitely, it must also come down explicitelyRichard Levitte2016-10-191-1/+3
| | | | | | | | | | | | | In apps/apps.c, one can set up an engine with setup_engine(). However, we freed the structural reference immediately, which means that for engines that don't already have a structural reference somewhere else (because it's a built in engine), we end up returning an invalid reference. Instead, the function release_engine() is added, and called at the end of the routines that call setup_engine(). Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1643)
* Constify command optionsFdaSilvaYY2016-10-141-1/+1
| | | | | | Reviewed-by: Kurt Roeckx <kurt@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1694)
* Code factorisation and simplificationFdaSilvaYY2016-07-201-19/+16
| | | | | | | Fix some code indentation Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1284)
* Free allocated password strings on exitMatt Caswell2016-06-011-0/+2
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* Indent and dead code cleanupFdaSilvaYY2016-05-211-2/+2
| | | | | | | tofree pointer is no more used... Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1103)
* Copyright consolidation 01/10Rich Salz2016-05-171-54/+5
| | | | | Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Kurt Roeckx <kurt@openssl.org>
* Don't load same config file twice.Dr. Stephen Henson2016-05-161-1/+1
| | | | | | RT#4215 Reviewed-by: Richard Levitte <levitte@openssl.org>
* Don't use an uninitialised variable in srp applicationMatt Caswell2016-04-291-2/+1
| | | | | | | | | | | The srp application created an uninitialised DB_ATTR object and then passed it to the load_index function which attempted to read it. A DB_ATTR object only contains a single field called "unique_subject". AFAICT this attribute is unused in the SRP case, and therefore it would be better to pass a NULL DB_ATTR to load_index (which handles that case gracefully). Reviewed-by: Rich Salz <rsalz@openssl.org>
* Deprecate OBJ_cleanup() and make it a no-opMatt Caswell2016-04-131-1/+0
| | | | | | | | OBJ_cleanup() should not be called expicitly - we should leave auto-deinit to clean this up instead. Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
* Use NON_EMPTY_TRANSLATION_UNIT, consistently.Rich Salz2016-02-091-18/+14
| | | | | | This also closes RT 4123 Reviewed-by: Richard Levitte <levitte@openssl.org>
* Fix quoting error in SRP printfAndy Isaacson2016-01-221-1/+1
| | | | | | | | The code is trying to interpolate the value of the BASE_SECTION macro, but due to excess escaping, it instead prints the string "BASE_SECTION". Signed-off-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Kurt Roeckx <kurt@openssl.org>
* Rename some BUF_xxx to OPENSSL_xxxRich Salz2015-12-161-6/+6
| | | | | | | | | Rename BUF_{strdup,strlcat,strlcpy,memdup,strndup,strnlen} to OPENSSL_{strdup,strlcat,strlcpy,memdup,strndup,strnlen} Add #define's for the old names. Add CRYPTO_{memdup,strndup}, called by OPENSSL_{memdup,strndup} macros. Reviewed-by: Tim Hudson <tjh@openssl.org>
* Fix -srpvfile option in srp command lineMatt Caswell2015-09-211-12/+16
| | | | | | | | | The -srpvfile option was broken in the srp command line app. Using it would always result in "-dbfile and -configfile cannot be specified together." The error message is also wrong because the option is "-srpvfile" not "-dbfile", so that has been fixed too. Reviewed-by: Emilia Käsper <emilia@openssl.org>
* Restore module loadingRichard Levitte2015-05-291-0/+2
| | | | | | | The module loading feature got broken a while ago, so restore it, but have it a bit more explicit this time around. Reviewed-by: Stephen Henson <steve@openssl.org>
* RT3876: Only load config when neededRich Salz2015-05-281-39/+8
| | | | | | | | Create app_load_config(), a routine to load config file. Remove the "always load config" from the main app. Change the places that used to load config to call the new common routine. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Fix various OPENSSL_NO_* optionsMatt Caswell2015-05-221-11/+10
| | | | | | | This fixes compilation with various OPENSSL_NO_* options that got broken during the big apps cleanup. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Use #error in openssl/srp.hRich Salz2015-05-151-0/+6
| | | | | | | Follow the same convention the other OPENSSL_NO_xxx header files do, and use #error instead of making the header file be a no-op. Reviewed-by: Matt Caswell <matt@openssl.org>
* Use p==NULL not !p (in if statements, mainly)Rich Salz2015-05-111-11/+16
| | | | Reviewed-by: Tim Hudson <tjh@openssl.org>
* Use "==0" instead of "!strcmp" etcRich Salz2015-05-061-3/+3
| | | | | | | For the various string-compare routines (strcmp, strcasecmp, str.*cmp) use "strcmp()==0" instead of "!strcmp()" Reviewed-by: Tim Hudson <tjh@openssl.org>
* Use safer sizeof variant in mallocRich Salz2015-05-041-1/+1
| | | | | | | | | | | | | For a local variable: TYPE *p; Allocations like this are "risky": p = OPENSSL_malloc(sizeof(TYPE)); if the type of p changes, and the malloc call isn't updated, you could get memory corruption. Instead do this: p = OPENSSL_malloc(sizeof(*p)); Also fixed a few memset() calls that I noticed while doing this. Reviewed-by: Richard Levitte <levitte@openssl.org>
* free NULL cleanup -- codaRich Salz2015-05-011-5/+2
| | | | | | | | After the finale, the "real" final part. :) Do a recursive grep with "-B1 -w [a-zA-Z0-9_]*_free" to see if any of the preceeding lines are an "if NULL" check that can be removed. Reviewed-by: Tim Hudson <tjh@openssl.org>
* free null cleanup finaleRich Salz2015-05-011-25/+12
| | | | | | Don't check for NULL before calling OPENSSL_free Reviewed-by: Richard Levitte <levitte@openssl.org>
* In apps, malloc or dieRich Salz2015-04-301-18/+3
| | | | | | | | No point in proceeding if you're out of memory. So change *all* OPENSSL_malloc calls in apps to use the new routine which prints a message and exits. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Fix bug, "what mode" test was wrong.Rich Salz2015-04-301-1/+2
| | | | Reviewed-by: Matt Caswell <matt@openssl.org>
* Remove needless bio_err argumentRich Salz2015-04-291-27/+27
| | | | | | | Many functions had a BIO* parameter, and it was always called with bio_err. Remove the param and just use bio_err. Reviewed-by: Matt Caswell <matt@openssl.org>
* remove malloc castsRich Salz2015-04-281-2/+1
| | | | | | | Following ANSI C rules, remove the casts from calls to OPENSSL_malloc and OPENSSL_realloc. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Remove EFENCE support.Rich Salz2015-04-251-12/+0
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* fewer NO_ENGINE #ifdef'sRich Salz2015-04-251-5/+2
| | | | | | | | Make setup_engine be a dummy if NO_ENGINE is enabled. The option is not enabled if NO_ENGINE is enabled, so the one "wasted" variable just sits there. Removes some variables and code. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Big apps cleanup (option-parsing, etc)Rich Salz2015-04-241-252/+212
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is merges the old "rsalz-monolith" branch over to master. The biggest change is that option parsing switch from cascasding 'else if strcmp("-foo")' to a utility routine and somethin akin to getopt. Also, an error in the command line no longer prints the full summary; use -help (or --help :) for that. There have been many other changes and code-cleanup, see bullet list below. Special thanks to Matt for the long and detailed code review. TEMPORARY: For now, comment out CRYPTO_mem_leaks() at end of main Tickets closed: RT3515: Use 3DES in pkcs12 if built with no-rc2 RT1766: s_client -reconnect and -starttls broke RT2932: Catch write errors RT2604: port should be 'unsigned short' RT2983: total_bytes undeclared #ifdef RENEG RT1523: Add -nocert to fix output in x509 app RT3508: Remove unused variable introduced by b09eb24 RT3511: doc fix; req default serial is random RT1325,2973: Add more extensions to c_rehash RT2119,3407: Updated to dgst.pod RT2379: Additional typo fix RT2693: Extra include of string.h RT2880: HFS is case-insensitive filenames RT3246: req command prints version number wrong Other changes; incompatibilities marked with *: Add SCSV support Add -misalign to speed command Make dhparam, dsaparam, ecparam, x509 output C in proper style Make some internal ocsp.c functions void Only display cert usages with -help in verify Use global bio_err, remove "BIO*err" parameter from functions For filenames, - always means stdin (or stdout as appropriate) Add aliases for -des/aes "wrap" ciphers. *Remove support for IISSGC (server gated crypto) *The undocumented OCSP -header flag is now "-header name=value" *Documented the OCSP -header flag Reviewed-by: Matt Caswell <matt@openssl.org>
* Code style: space after 'if'Viktor Dukhovni2015-04-161-2/+2
| | | | Reviewed-by: Matt Caswell <matt@openssl.org>
* Unchecked malloc fixesMatt Caswell2015-03-051-0/+8
| | | | | | | Miscellaneous unchecked malloc fixes. Also fixed some mem leaks on error paths as I spotted them along the way. Reviewed-by: Tim Hudson <tjh@openssl.org>
* Run util/openssl-format-source -v -c .Matt Caswell2015-01-221-3/+4
| | | | Reviewed-by: Tim Hudson <tjh@openssl.org>
* apps/srp.c: make it indent-friendly.Andy Polyakov2015-01-221-668/+665
| | | | Reviewed-by: Tim Hudson <tjh@openssl.org>
* misspellings fixes by https://github.com/vlajos/misspell_fixerVeres Lajos2013-09-051-1/+1
|
* Version skew reduction: trivia (I hope).Ben Laurie2012-06-031-72/+67
|
* Fix warnings: signed/unisgned comparison, shadowing (in some cases globalDr. Stephen Henson2011-03-121-5/+5
| | | | functions such as rand() ).
* Add SRP support.Ben Laurie2011-03-121-0/+763