Lines Matching refs:passwd
20 static int passwd_compare_sha1(const char *passwd, const char *entry) in passwd_compare_sha1() argument
31 if ((p = strchr(passwd + 3, '$'))) { in passwd_compare_sha1()
32 SHA1Update(&d.ctx, (void *)passwd + 3, p - (passwd + 3)); in passwd_compare_sha1()
35 p = passwd + 3; /* Assume no salt */ in passwd_compare_sha1()
50 static int passwd_compare_md5(const char *passwd, const char *entry) in passwd_compare_md5() argument
52 const char *crypted = crypt_md5(entry, passwd + 3); in passwd_compare_md5()
55 return !strncmp(crypted, passwd, len) && in passwd_compare_md5()
56 (passwd[len] == '\0' || passwd[len] == '$'); in passwd_compare_md5()
59 static int passwd_compare_sha256(const char *passwd, const char *entry) in passwd_compare_sha256() argument
61 const char *crypted = sha256_crypt(entry, passwd + 3); in passwd_compare_sha256()
64 return !strncmp(crypted, passwd, len) && in passwd_compare_sha256()
65 (passwd[len] == '\0' || passwd[len] == '$'); in passwd_compare_sha256()
68 static int passwd_compare_sha512(const char *passwd, const char *entry) in passwd_compare_sha512() argument
70 const char *crypted = sha512_crypt(entry, passwd + 3); in passwd_compare_sha512()
73 return !strncmp(crypted, passwd, len) && in passwd_compare_sha512()
74 (passwd[len] == '\0' || passwd[len] == '$'); in passwd_compare_sha512()
77 int passwd_compare(const char *passwd, const char *entry) in passwd_compare() argument
79 if (passwd[0] != '$' || !passwd[1] || passwd[2] != '$') { in passwd_compare()
81 return !strcmp(entry, passwd); in passwd_compare()
83 switch (passwd[1]) { in passwd_compare()
85 return passwd_compare_md5(passwd, entry); in passwd_compare()
87 return passwd_compare_sha1(passwd, entry); in passwd_compare()
89 return passwd_compare_sha256(passwd, entry); in passwd_compare()
91 return passwd_compare_sha512(passwd, entry); in passwd_compare()