diff --git a/lib/otp/otp.h b/lib/otp/otp.h index 51847b550..51625a815 100644 --- a/lib/otp/otp.h +++ b/lib/otp/otp.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan + * Copyright (c) 1995 - 2000 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -60,7 +60,7 @@ typedef struct { OtpAlgID id; char *name; int hashsize; - int (*hash)(char *s, size_t len, unsigned char *res); + int (*hash)(const char *s, size_t len, unsigned char *res); int (*init)(OtpKey key, char *pwd, char *seed); int (*next)(OtpKey key); } OtpAlgorithm; @@ -82,13 +82,13 @@ void otp_print_hex (OtpKey key, char *str, size_t sz); void otp_print_stddict_extended (OtpKey key, char *str, size_t sz); void otp_print_hex_extended (OtpKey key, char *str, size_t sz); unsigned otp_checksum (OtpKey key); -int otp_parse_hex (OtpKey key, char *); -int otp_parse_stddict (OtpKey key, char *); -int otp_parse_altdict (OtpKey key, char *, OtpAlgorithm *); -int otp_parse (OtpKey key, char *, OtpAlgorithm *); +int otp_parse_hex (OtpKey key, const char *); +int otp_parse_stddict (OtpKey key, const char *); +int otp_parse_altdict (OtpKey key, const char *, OtpAlgorithm *); +int otp_parse (OtpKey key, const char *, OtpAlgorithm *); int otp_challenge (OtpContext *ctx, char *user, char *str, size_t len); -int otp_verify_user (OtpContext *ctx, char *passwd); -int otp_verify_user_1 (OtpContext *ctx, char *passwd); +int otp_verify_user (OtpContext *ctx, const char *passwd); +int otp_verify_user_1 (OtpContext *ctx, const char *passwd); char *otp_error (OtpContext *ctx); void *otp_db_open (void); diff --git a/lib/otp/otp_parse.c b/lib/otp/otp_parse.c index 9141776b4..6f4af9fd4 100644 --- a/lib/otp/otp_parse.c +++ b/lib/otp/otp_parse.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan + * Copyright (c) 1995 - 2000 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -56,11 +56,11 @@ cmp(const void *a, const void *b) } static int -get_stdword (char *s, void *v) +get_stdword (const char *s, void *v) { struct e e, *r; - e.s = s; + e.s = (char *)s; e.n = -1; r = (struct e *) bsearch (&e, inv_std_dict, sizeof(inv_std_dict)/sizeof(*inv_std_dict), @@ -85,7 +85,7 @@ compress (OtpKey key, unsigned wn[]) } static int -get_altword (char *s, void *a) +get_altword (const char *s, void *a) { OtpAlgorithm *alg = (OtpAlgorithm *)a; int ret; @@ -102,8 +102,8 @@ get_altword (char *s, void *a) static int parse_words(unsigned wn[], - char *str, - int (*convert)(char *, void *), + const char *str, + int (*convert)(const char *, void *), void *arg) { unsigned char *w, *wend, c; @@ -130,8 +130,9 @@ parse_words(unsigned wn[], } static int -otp_parse_internal (OtpKey key, char *str, OtpAlgorithm *alg, - int (*convert)(char *, void *)) +otp_parse_internal (OtpKey key, const char *str, + OtpAlgorithm *alg, + int (*convert)(const char *, void *)) { unsigned wn[6]; @@ -144,19 +145,19 @@ otp_parse_internal (OtpKey key, char *str, OtpAlgorithm *alg, } int -otp_parse_stddict (OtpKey key, char *str) +otp_parse_stddict (OtpKey key, const char *str) { return otp_parse_internal (key, str, NULL, get_stdword); } int -otp_parse_altdict (OtpKey key, char *str, OtpAlgorithm *alg) +otp_parse_altdict (OtpKey key, const char *str, OtpAlgorithm *alg) { return otp_parse_internal (key, str, alg, get_altword); } int -otp_parse_hex (OtpKey key, char *s) +otp_parse_hex (OtpKey key, const char *s) { char buf[17], *b; int is[8]; @@ -183,7 +184,7 @@ otp_parse_hex (OtpKey key, char *s) } int -otp_parse (OtpKey key, char *s, OtpAlgorithm *alg) +otp_parse (OtpKey key, const char *s, OtpAlgorithm *alg) { int ret; int dohex = 1; diff --git a/lib/otp/otp_verify.c b/lib/otp/otp_verify.c index e70488fa7..26f3c1cac 100644 --- a/lib/otp/otp_verify.c +++ b/lib/otp/otp_verify.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan + * Copyright (c) 1995 - 2000 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -39,7 +39,7 @@ RCSID("$Id$"); #include "otp_locl.h" int -otp_verify_user_1 (OtpContext *ctx, char *passwd) +otp_verify_user_1 (OtpContext *ctx, const char *passwd) { OtpKey key1, key2; @@ -58,7 +58,7 @@ otp_verify_user_1 (OtpContext *ctx, char *passwd) } int -otp_verify_user (OtpContext *ctx, char *passwd) +otp_verify_user (OtpContext *ctx, const char *passwd) { void *dbm; int ret;