aboutsummaryrefslogtreecommitdiff
path: root/apps/srp.c
AgeCommit message (Collapse)AuthorFilesLines
2018-03-13update SRP copyright noticeTim Hudson1-0/+4
As per discussion with Peter Sylvester Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5603)
2018-02-13Update copyright yearMatt Caswell1-1/+1
Reviewed-by: Richard Levitte <levitte@openssl.org>
2018-01-31apps: Don't include progs.h in apps.hRichard Levitte1-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)
2017-10-18Remove parentheses of return.KaoruToda1-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)
2017-08-21Check # of arguments for remaining commands.Rich Salz1-12/+9
Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/4201)
2017-07-17Fix some pedantic warnings.Pauli1-1/+1
Introduced by #3862 Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3944)
2017-07-16Standardize apps use of -rand, etc.Rich Salz1-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)
2017-06-12Clean up a bundle of codingstyle stuff in apps directoryPaul Yang1-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)
2017-05-22Fix srp app missing NULL termination with password callbackDiego Santa Cruz1-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)
2017-05-19Fix endless loop on srp app when listing usersDiego Santa Cruz1-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)
2017-02-21Fix some more memory leaks with TXT_DB_insert.Bernd Edlinger1-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)
2016-10-19If an engine comes up explicitely, it must also come down explicitelyRichard Levitte1-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)
2016-10-14Constify command optionsFdaSilvaYY1-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)
2016-07-20Code factorisation and simplificationFdaSilvaYY1-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)
2016-06-01Free allocated password strings on exitMatt Caswell1-0/+2
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-05-21Indent and dead code cleanupFdaSilvaYY1-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)
2016-05-17Copyright consolidation 01/10Rich Salz1-54/+5
Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Kurt Roeckx <kurt@openssl.org>
2016-05-16Don't load same config file twice.Dr. Stephen Henson1-1/+1
RT#4215 Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-29Don't use an uninitialised variable in srp applicationMatt Caswell1-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>
2016-04-13Deprecate OBJ_cleanup() and make it a no-opMatt Caswell1-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>
2016-02-09Use NON_EMPTY_TRANSLATION_UNIT, consistently.Rich Salz1-18/+14
This also closes RT 4123 Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-01-22Fix quoting error in SRP printfAndy Isaacson1-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>
2015-12-16Rename some BUF_xxx to OPENSSL_xxxRich Salz1-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>
2015-09-21Fix -srpvfile option in srp command lineMatt Caswell1-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>
2015-05-29Restore module loadingRichard Levitte1-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>
2015-05-28RT3876: Only load config when neededRich Salz1-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>
2015-05-22Fix various OPENSSL_NO_* optionsMatt Caswell1-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>
2015-05-15Use #error in openssl/srp.hRich Salz1-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>
2015-05-11Use p==NULL not !p (in if statements, mainly)Rich Salz1-11/+16
Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-05-06Use "==0" instead of "!strcmp" etcRich Salz1-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>
2015-05-04Use safer sizeof variant in mallocRich Salz1-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>
2015-05-01free NULL cleanup -- codaRich Salz1-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>
2015-05-01free null cleanup finaleRich Salz1-25/+12
Don't check for NULL before calling OPENSSL_free Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-04-30In apps, malloc or dieRich Salz1-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>
2015-04-30Fix bug, "what mode" test was wrong.Rich Salz1-1/+2
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-04-29Remove needless bio_err argumentRich Salz1-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>
2015-04-28remove malloc castsRich Salz1-2/+1
Following ANSI C rules, remove the casts from calls to OPENSSL_malloc and OPENSSL_realloc. Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-04-25Remove EFENCE support.Rich Salz1-12/+0
Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-04-25fewer NO_ENGINE #ifdef'sRich Salz1-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>
2015-04-24Big apps cleanup (option-parsing, etc)Rich Salz1-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>
2015-04-16Code style: space after 'if'Viktor Dukhovni1-2/+2
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-03-05Unchecked malloc fixesMatt Caswell1-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>
2015-01-22Run util/openssl-format-source -v -c .Matt Caswell1-3/+4
Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-01-22apps/srp.c: make it indent-friendly.Andy Polyakov1-668/+665
Reviewed-by: Tim Hudson <tjh@openssl.org>
2013-09-05misspellings fixes by https://github.com/vlajos/misspell_fixerVeres Lajos1-1/+1
2012-06-03Version skew reduction: trivia (I hope).Ben Laurie1-72/+67
2011-03-12Fix warnings: signed/unisgned comparison, shadowing (in some cases globalDr. Stephen Henson1-5/+5
functions such as rand() ).
2011-03-12Add SRP support.Ben Laurie1-0/+763