summaryrefslogtreecommitdiffstats
path: root/ax25
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2017-01-30 11:28:16 +0100
committerRalf Baechle <ralf@linux-mips.org>2017-02-06 23:43:46 +0100
commit57587c97254b324d05b6efcbcaabde77b5955bec (patch)
tree8ee841ef736368508e2648dbf7ad4cde60068387 /ax25
parent2d725b728cd82c0b203fe996c08d23ea6dafe9d1 (diff)
axspawn: Move calc_md5_pw to eleminate need for declaration and make static.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'ax25')
-rw-r--r--ax25/access.c59
1 files changed, 29 insertions, 30 deletions
diff --git a/ax25/access.c b/ax25/access.c
index 7f3d0c3..2ce2c94 100644
--- a/ax25/access.c
+++ b/ax25/access.c
@@ -20,8 +20,6 @@
static long seed = 1L;
-void calc_md5_pw (const char *MD5prompt, const char *MD5pw, char *MD5result);
-
/*--------------------------------------------------------------------------*/
static int conv_rand(void)
@@ -98,6 +96,35 @@ static char *generate_rand_pw(int len)
/*--------------------------------------------------------------------------*/
+static void calc_md5_pw (const char *MD5prompt, const char *MD5pw,
+ char *MD5result)
+{
+ MD5_CTX context;
+ short i, n, len;
+ char buffer[1024];
+
+ strncpy(buffer, MD5prompt, 10);
+ buffer[10] = 0;
+ strcat(buffer, MD5pw);
+
+ MD5Init(&context);
+
+ len = strlen(buffer);
+ for (i= 0; i < len; i += 16) {
+ n = (len - i) > 16 ? 16 : (len - i);
+ MD5Update(&context, (unsigned char *) buffer+i, n);
+ }
+
+ MD5Final(&context);
+
+ MD5result[0] = '\0';
+ for (i = 0; i < 16; i++) {
+ MD5result[i] = context.digest[i];
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
void ask_pw_sys(char *prompt, char *pass_want, char *pw)
{
char buffer[2048];
@@ -171,34 +198,6 @@ void ask_pw_md5(char *prompt, char *pass_want, char *pw)
/*--------------------------------------------------------------------------*/
-void calc_md5_pw (const char *MD5prompt, const char *MD5pw, char *MD5result)
-{
- MD5_CTX context;
- short i, n, len;
- char buffer[1024];
-
- strncpy(buffer, MD5prompt, 10);
- buffer[10] = 0;
- strcat(buffer, MD5pw);
-
- MD5Init(&context);
-
- len = strlen(buffer);
- for (i= 0; i < len; i += 16) {
- n = (len - i) > 16 ? 16 : (len - i);
- MD5Update(&context, (unsigned char *) buffer+i, n);
- }
-
- MD5Final(&context);
-
- MD5result[0] = '\0';
- for (i = 0; i < 16; i++) {
- MD5result[i] = context.digest[i];
- }
-}
-
-/*--------------------------------------------------------------------------*/
-
static void write_example_passwd(char *pwfile, char pwlocation,
struct passwd *pw)
{