summaryrefslogtreecommitdiffstats
path: root/common/password.c
Commit message (Collapse)AuthorAgeFilesLines
* Revert "globalvar: make globalvar functions more consistent"Sascha Hauer2017-06-131-1/+1
| | | | This reverts commit 1b4a05c9263ae26083526acfabdea1ef96531a1d.
* globalvar: make globalvar functions more consistentSascha Hauer2017-04-111-1/+1
| | | | | | | | | Similar to the device parameter functions also make the globalvar functions more consistent. This also adds support for readonly globalvars and changes several existing globalvars which should really be readonly to readonly. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common: password: make use of get_crypto_bytesOleksij Rempel2017-03-301-1/+5
| | | | | | | | get_random_bytes is providing prng, if we have HWRNG we should be able to use it over get_crypto_bytes Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* stdio: rename getc to getcharSascha Hauer2016-04-151-1/+1
| | | | | | | The function we have implemented as getc has the semantics of the standard function getchar, so rename it accorgingly. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* include: move run_command prototype to command.hSascha Hauer2016-04-151-0/+1
| | | | | | run_command fits much better into command.h, move it there. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* login: make some locally used functions staticSergey Koshechkin2015-11-021-6/+3
| | | | | | | | | | | | | This patch continues cleanup password code from commit 40596b856f61c281fb34f804bf42550c099f26c3 Author: Sascha Hauer <s.hauer@pengutronix.de> Date: Thu Aug 27 15:58:50 2015 +0200 login: cleanup password code Signed-off-by: Sergey Koshechkin <tritel59@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* passwd: avoid NULL ptr usageLucas Stach2015-09-141-1/+2
| | | | | | | | | | | | Fixes common/password.c: In function 'check_passwd': common/password.c:292:4: warning: reading through null pointer (argument 3) pr_err("No such digest: %s\n", PASSWD_SUM); if no algo is enabled in which case PASSWD_SUM is defined to NULL. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* login: check return value of digest_allocSascha Hauer2015-08-281-0/+4
| | | | | | digest_alloc can fail, check the return value. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* login: cleanup password codeSascha Hauer2015-08-281-39/+9
| | | | | | | | - make some locally used functions static - remove read_passwd which is unused - some refactoring to make code pathes clearer Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* login: rework login mechanismSascha Hauer2015-08-281-2/+73
| | | | | | | | | | | | | | We used to have the login functionality in the /env/bin/init script. This is hard to review and it's too easy to break the login functionality with changes to this script. Move the places to ask for a password to C code where we have only a few places where we have to ask for a password. Mainly these are run_shell() and the menutree command. This patch introduces a login() function which will only return if the correct password has been entered. Following calls will return immediately without asking for a password again. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* password: add pbkdf2 supportJean-Christophe PLAGNIOL-VILLARD2015-03-201-30/+66
| | | | | | | | We will use random 32 bytes salt and 10000 round to generate a 32 bytes key. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* password: add support for sha512Jean-Christophe PLAGNIOL-VILLARD2015-03-121-0/+2
| | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* digest: make it multi-instanceJean-Christophe PLAGNIOL-VILLARD2015-03-121-2/+3
| | | | | | | | | | Now you need to call digest_alloc and when you finish to use it digest_free. We need this for upcomming aes encryption support and secure boot as we will need multiple instance of the same digest. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* digest: introduce digest_{init/update/final/length}Jean-Christophe PLAGNIOL-VILLARD2015-03-121-13/+13
| | | | | | | | This will allow to move from a one at a time digest to a multi-instance with too much impact on the code using it Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* input: Add BB_ prefix to KEY_ definesSascha Hauer2014-02-171-2/+2
| | | | | | | Our KEY_ defines conflict with the standard Linux KEY_ defines, so add a BB_ prefix to them. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* login/passwd: add default password supportJean-Christophe PLAGNIOL-VILLARD2013-09-191-13/+81
| | | | | | | even if the env is broken you will have a password Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* password: fixed underflow on <backspace>Enrico Scholz2012-12-051-5/+8
| | | | | | | | due to missing/misplaced boundary check, deleting characters could underflow the password buffer. Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Treewide: remove address of the Free Software FoundationSascha Hauer2012-09-171-3/+0
| | | | | | | The FSF address has changed in the past. Instead of updating it each time the address changes, just drop it completely treewide. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* password: remove not used variable 'second'Jean-Christophe PLAGNIOL-VILLARD2011-11-221-2/+1
| | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* login: add timeout supportJean-Christophe PLAGNIOL-VILLARD2011-08-111-39/+48
| | | | | | | | If a timeout is specified and expired the command will be executed by default boot Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* password: fix command support as moduleJean-Christophe PLAGNIOL-VILLARD2011-07-051-0/+7
| | | | | | | add missing EXPORT_SYMBOL for nan static function Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* add password frameworkJean-Christophe PLAGNIOL-VILLARD2010-09-201-0/+286
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>