const-ify

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@8499 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
2000-07-01 13:58:38 +00:00
parent f8efd855b5
commit 4285c10716
3 changed files with 24 additions and 23 deletions

View File

@@ -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). * (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved. * All rights reserved.
* *
@@ -60,7 +60,7 @@ typedef struct {
OtpAlgID id; OtpAlgID id;
char *name; char *name;
int hashsize; 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 (*init)(OtpKey key, char *pwd, char *seed);
int (*next)(OtpKey key); int (*next)(OtpKey key);
} OtpAlgorithm; } 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_stddict_extended (OtpKey key, char *str, size_t sz);
void otp_print_hex_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); unsigned otp_checksum (OtpKey key);
int otp_parse_hex (OtpKey key, char *); int otp_parse_hex (OtpKey key, const char *);
int otp_parse_stddict (OtpKey key, char *); int otp_parse_stddict (OtpKey key, const char *);
int otp_parse_altdict (OtpKey key, char *, OtpAlgorithm *); int otp_parse_altdict (OtpKey key, const char *, OtpAlgorithm *);
int otp_parse (OtpKey key, char *, OtpAlgorithm *); int otp_parse (OtpKey key, const char *, OtpAlgorithm *);
int otp_challenge (OtpContext *ctx, char *user, char *str, size_t len); int otp_challenge (OtpContext *ctx, char *user, char *str, size_t len);
int otp_verify_user (OtpContext *ctx, char *passwd); int otp_verify_user (OtpContext *ctx, const char *passwd);
int otp_verify_user_1 (OtpContext *ctx, char *passwd); int otp_verify_user_1 (OtpContext *ctx, const char *passwd);
char *otp_error (OtpContext *ctx); char *otp_error (OtpContext *ctx);
void *otp_db_open (void); void *otp_db_open (void);

View File

@@ -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). * (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved. * All rights reserved.
* *
@@ -56,11 +56,11 @@ cmp(const void *a, const void *b)
} }
static int static int
get_stdword (char *s, void *v) get_stdword (const char *s, void *v)
{ {
struct e e, *r; struct e e, *r;
e.s = s; e.s = (char *)s;
e.n = -1; e.n = -1;
r = (struct e *) bsearch (&e, inv_std_dict, r = (struct e *) bsearch (&e, inv_std_dict,
sizeof(inv_std_dict)/sizeof(*inv_std_dict), sizeof(inv_std_dict)/sizeof(*inv_std_dict),
@@ -85,7 +85,7 @@ compress (OtpKey key, unsigned wn[])
} }
static int static int
get_altword (char *s, void *a) get_altword (const char *s, void *a)
{ {
OtpAlgorithm *alg = (OtpAlgorithm *)a; OtpAlgorithm *alg = (OtpAlgorithm *)a;
int ret; int ret;
@@ -102,8 +102,8 @@ get_altword (char *s, void *a)
static int static int
parse_words(unsigned wn[], parse_words(unsigned wn[],
char *str, const char *str,
int (*convert)(char *, void *), int (*convert)(const char *, void *),
void *arg) void *arg)
{ {
unsigned char *w, *wend, c; unsigned char *w, *wend, c;
@@ -130,8 +130,9 @@ parse_words(unsigned wn[],
} }
static int static int
otp_parse_internal (OtpKey key, char *str, OtpAlgorithm *alg, otp_parse_internal (OtpKey key, const char *str,
int (*convert)(char *, void *)) OtpAlgorithm *alg,
int (*convert)(const char *, void *))
{ {
unsigned wn[6]; unsigned wn[6];
@@ -144,19 +145,19 @@ otp_parse_internal (OtpKey key, char *str, OtpAlgorithm *alg,
} }
int 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); 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, const char *str, OtpAlgorithm *alg)
{ {
return otp_parse_internal (key, str, alg, get_altword); return otp_parse_internal (key, str, alg, get_altword);
} }
int int
otp_parse_hex (OtpKey key, char *s) otp_parse_hex (OtpKey key, const char *s)
{ {
char buf[17], *b; char buf[17], *b;
int is[8]; int is[8];
@@ -183,7 +184,7 @@ otp_parse_hex (OtpKey key, char *s)
} }
int int
otp_parse (OtpKey key, char *s, OtpAlgorithm *alg) otp_parse (OtpKey key, const char *s, OtpAlgorithm *alg)
{ {
int ret; int ret;
int dohex = 1; int dohex = 1;

View File

@@ -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). * (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved. * All rights reserved.
* *
@@ -39,7 +39,7 @@ RCSID("$Id$");
#include "otp_locl.h" #include "otp_locl.h"
int int
otp_verify_user_1 (OtpContext *ctx, char *passwd) otp_verify_user_1 (OtpContext *ctx, const char *passwd)
{ {
OtpKey key1, key2; OtpKey key1, key2;
@@ -58,7 +58,7 @@ otp_verify_user_1 (OtpContext *ctx, char *passwd)
} }
int int
otp_verify_user (OtpContext *ctx, char *passwd) otp_verify_user (OtpContext *ctx, const char *passwd)
{ {
void *dbm; void *dbm;
int ret; int ret;