more shared code
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1552 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -2183,12 +2183,13 @@ parse_words(unsigned wn[],
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static
|
||||||
otp_parse_stddict (OtpKey key, char *str)
|
otp_parse_internal (OtpKey key, char *str, OtpAlgorithm *alg,
|
||||||
|
int (*convert)(char *, void *))
|
||||||
{
|
{
|
||||||
unsigned wn[6];
|
unsigned wn[6];
|
||||||
|
|
||||||
if (parse_words (wn, str, get_stdword, NULL))
|
if (parse_words (wn, str, convert, alg))
|
||||||
return -1;
|
return -1;
|
||||||
compress (key, wn);
|
compress (key, wn);
|
||||||
if (otp_checksum (key) != (wn[5] & 0x03))
|
if (otp_checksum (key) != (wn[5] & 0x03))
|
||||||
@@ -2196,17 +2197,16 @@ otp_parse_stddict (OtpKey key, char *str)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
otp_parse_stddict (OtpKey key, char *str)
|
||||||
|
{
|
||||||
|
return otp_parse_internal (key, str, NULL, get_stdword);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
otp_parse_altdict (OtpKey key, char *str, OtpAlgorithm *alg)
|
otp_parse_altdict (OtpKey key, char *str, OtpAlgorithm *alg)
|
||||||
{
|
{
|
||||||
unsigned wn[6];
|
return otp_parse_internal (key, str, alg, get_altword);
|
||||||
|
|
||||||
if (parse_words (wn, str, get_altword, alg))
|
|
||||||
return -1;
|
|
||||||
compress (key, wn);
|
|
||||||
if (otp_checksum (key) != (wn[5] & 0x03))
|
|
||||||
return -1;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Reference in New Issue
Block a user