summaryrefslogtreecommitdiff
path: root/lib/libkeynote
diff options
context:
space:
mode:
authormmcc <mmcc@cvs.openbsd.org>2015-11-19 02:35:25 +0000
committermmcc <mmcc@cvs.openbsd.org>2015-11-19 02:35:25 +0000
commitd739e5c08602038fdef3b1c4382aa07ee1130e01 (patch)
tree857b0c3f870639ab9ae6310bb2b449996c9ec6d6 /lib/libkeynote
parent9b25d6e907d636cccb07c2cf1687fe40a0cc82b1 (diff)
Remove a ton of ugly, needless casts for NULL, calloc(), and strdup().
No binary change.
Diffstat (limited to 'lib/libkeynote')
-rw-r--r--lib/libkeynote/auxil.c78
-rw-r--r--lib/libkeynote/keynote-keygen.c38
-rw-r--r--lib/libkeynote/keynote-sign.c16
-rw-r--r--lib/libkeynote/keynote-sigver.c6
-rw-r--r--lib/libkeynote/keynote-verify.c34
-rw-r--r--lib/libkeynote/keynote.l76
-rw-r--r--lib/libkeynote/keynote.y56
-rw-r--r--lib/libkeynote/parse_assertion.c86
8 files changed, 195 insertions, 195 deletions
diff --git a/lib/libkeynote/auxil.c b/lib/libkeynote/auxil.c
index 4511fef2376..1bc550e7faa 100644
--- a/lib/libkeynote/auxil.c
+++ b/lib/libkeynote/auxil.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auxil.c,v 1.9 2004/06/29 11:35:56 msf Exp $ */
+/* $OpenBSD: auxil.c,v 1.10 2015/11/19 02:35:24 mmcc Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -46,7 +46,7 @@ keynote_keyhash(void *key, int alg)
DSA *dsa;
RSA *rsa;
- if (key == (void *) NULL)
+ if (key == NULL)
return 0;
switch (alg)
@@ -99,7 +99,7 @@ keynote_in_action_authorizers(void *key, int algorithm)
if (algorithm == KEYNOTE_ALGORITHM_UNSPEC)
{
kl2 = keynote_keylist_find(keynote_current_assertion->as_keylist, key);
- if (kl2 == (struct keylist *) NULL)
+ if (kl2 == NULL)
return RESULT_FALSE; /* Shouldn't ever happen */
s = kl2->key_key;
@@ -112,7 +112,7 @@ keynote_in_action_authorizers(void *key, int algorithm)
}
for (kl = keynote_current_session->ks_action_authorizers;
- kl != (struct keylist *) NULL;
+ kl != NULL;
kl = kl->key_next)
if ((kl->key_alg == alg) ||
((kl->key_alg == KEYNOTE_ALGORITHM_RSA) &&
@@ -136,14 +136,14 @@ keynote_keylist_add(struct keylist **keylist, char *key)
struct keynote_deckey dc;
struct keylist *kl;
- if (keylist == (struct keylist **) NULL)
+ if (keylist == NULL)
{
keynote_errno = ERROR_MEMORY;
return -1;
}
- kl = (struct keylist *) calloc(1, sizeof(struct keylist));
- if (kl == (struct keylist *) NULL)
+ kl = calloc(1, sizeof(struct keylist));
+ if (kl == NULL)
{
keynote_errno = ERROR_MEMORY;
return -1;
@@ -173,11 +173,11 @@ kn_remove_authorizer(int sessid, char *key)
struct keylist *kl, *kl2;
keynote_errno = 0;
- if ((keynote_current_session == (struct keynote_session *) NULL) ||
+ if ((keynote_current_session == NULL) ||
(keynote_current_session->ks_id != sessid))
{
keynote_current_session = keynote_find_session(sessid);
- if (keynote_current_session == (struct keynote_session *) NULL)
+ if (keynote_current_session == NULL)
{
keynote_errno = ERROR_NOTFOUND;
return -1;
@@ -187,7 +187,7 @@ kn_remove_authorizer(int sessid, char *key)
ks = keynote_current_session;
/* If no action authorizers present */
- if ((kl = ks->ks_action_authorizers) == (struct keylist *) NULL)
+ if ((kl = ks->ks_action_authorizers) == NULL)
{
keynote_errno = ERROR_NOTFOUND;
return -1;
@@ -197,17 +197,17 @@ kn_remove_authorizer(int sessid, char *key)
if (!strcmp(kl->key_stringkey, key))
{
ks->ks_action_authorizers = kl->key_next;
- kl->key_next = (struct keylist *) NULL;
+ kl->key_next = NULL;
keynote_keylist_free(kl);
return 0;
}
- for (; kl->key_next != (struct keylist *) NULL; kl = kl->key_next)
+ for (; kl->key_next != NULL; kl = kl->key_next)
if (!strcmp(kl->key_next->key_stringkey, key))
{
kl2 = kl->key_next;
kl->key_next = kl2->key_next;
- kl2->key_next = (struct keylist *) NULL;
+ kl2->key_next = NULL;
keynote_keylist_free(kl2);
return 0;
}
@@ -225,19 +225,19 @@ kn_add_authorizer(int sessid, char *key)
char *stringkey;
keynote_errno = 0;
- if ((keynote_current_session == (struct keynote_session *) NULL) ||
+ if ((keynote_current_session == NULL) ||
(keynote_current_session->ks_id != sessid))
{
keynote_current_session = keynote_find_session(sessid);
- if (keynote_current_session == (struct keynote_session *) NULL)
+ if (keynote_current_session == NULL)
{
keynote_errno = ERROR_NOTFOUND;
return -1;
}
}
- stringkey = strdup((char *) key);
- if (stringkey == (char *) NULL)
+ stringkey = strdup(key);
+ if (stringkey == NULL)
{
keynote_errno = ERROR_MEMORY;
return -1;
@@ -259,7 +259,7 @@ kn_add_authorizer(int sessid, char *key)
struct keylist *
keynote_keylist_find(struct keylist *kl, char *s)
{
- for (; kl != (struct keylist *) NULL; kl = kl->key_next)
+ for (; kl != NULL; kl = kl->key_next)
if (!strcmp(kl->key_stringkey, s))
return kl;
@@ -274,7 +274,7 @@ keynote_keylist_free(struct keylist *kl)
{
struct keylist *kl2;
- while (kl != (struct keylist *) NULL)
+ while (kl != NULL)
{
kl2 = kl->key_next;
free(kl->key_stringkey);
@@ -303,14 +303,14 @@ keynote_find_assertion(void *authorizer, int num, int algorithm)
struct assertion *as;
unsigned int h;
- if (authorizer == (char *) NULL)
- return (struct assertion *) NULL;
+ if (authorizer == NULL)
+ return NULL;
h = keynote_keyhash(authorizer, algorithm);
for (as = keynote_current_session->ks_assertion_table[h];
- as != (struct assertion *) NULL;
+ as != NULL;
as = as->as_next)
- if ((as->as_authorizer != (void *) NULL) &&
+ if ((as->as_authorizer != NULL) &&
((as->as_signeralgorithm == algorithm) ||
((as->as_signeralgorithm == KEYNOTE_ALGORITHM_RSA) &&
(algorithm == KEYNOTE_ALGORITHM_X509)) ||
@@ -321,7 +321,7 @@ keynote_find_assertion(void *authorizer, int num, int algorithm)
if (num-- == 0)
return as;
- return (struct assertion *) NULL;
+ return NULL;
}
/*
@@ -335,7 +335,7 @@ keynote_add_htable(struct assertion *as, int which)
char *hashname;
unsigned int i;
- if (as == (struct assertion *) NULL)
+ if (as == NULL)
{
keynote_errno = ERROR_MEMORY;
return -1;
@@ -346,7 +346,7 @@ keynote_add_htable(struct assertion *as, int which)
else
hashname = as->as_authorizer;
- if (hashname == (char *) NULL)
+ if (hashname == NULL)
{
keynote_errno = ERROR_SYNTAX;
return -1;
@@ -369,11 +369,11 @@ kn_add_assertion(int sessid, char *asrt, int len, int assertion_flags)
struct assertion *as;
keynote_errno = 0;
- if ((keynote_current_session == (struct keynote_session *) NULL) ||
+ if ((keynote_current_session == NULL) ||
(keynote_current_session->ks_id != sessid))
{
keynote_current_session = keynote_find_session(sessid);
- if (keynote_current_session == (struct keynote_session *) NULL)
+ if (keynote_current_session == NULL)
{
keynote_errno = ERROR_NOTFOUND;
return -1;
@@ -381,7 +381,7 @@ kn_add_assertion(int sessid, char *asrt, int len, int assertion_flags)
}
as = keynote_parse_assertion(asrt, len, assertion_flags);
- if ((as == (struct assertion *) NULL) || (keynote_errno != 0))
+ if ((as == NULL) || (keynote_errno != 0))
{
if (keynote_errno == 0)
keynote_errno = ERROR_SYNTAX;
@@ -418,11 +418,11 @@ keynote_remove_assertion(int sessid, int assertid, int deleteflag)
struct assertion *ht, *ht2;
int i;
- if ((keynote_current_session == (struct keynote_session *) NULL) ||
+ if ((keynote_current_session == NULL) ||
(keynote_current_session->ks_id != sessid))
{
keynote_current_session = keynote_find_session(sessid);
- if (keynote_current_session == (struct keynote_session *) NULL)
+ if (keynote_current_session == NULL)
{
keynote_errno = ERROR_NOTFOUND;
return -1;
@@ -432,7 +432,7 @@ keynote_remove_assertion(int sessid, int assertid, int deleteflag)
for (i = 0; i < HASHTABLESIZE; i++)
{
ht = keynote_current_session->ks_assertion_table[i];
- if (ht == (struct assertion *) NULL)
+ if (ht == NULL)
continue;
/* If first entry in bucket */
@@ -444,7 +444,7 @@ keynote_remove_assertion(int sessid, int assertid, int deleteflag)
return 0;
}
- for (; ht->as_next != (struct assertion *) NULL; ht = ht->as_next)
+ for (; ht->as_next != NULL; ht = ht->as_next)
if (ht->as_next->as_id == assertid) /* Got it */
{
ht2 = ht->as_next;
@@ -484,22 +484,22 @@ keynote_sremove_assertion(int sessid, int assertid)
void
keynote_free_assertion(struct assertion *as)
{
- if (as == (struct assertion *) NULL)
+ if (as == NULL)
return;
- if (as->as_buf != (char *) NULL)
+ if (as->as_buf != NULL)
free(as->as_buf);
- if (as->as_signature != (char *) NULL)
+ if (as->as_signature != NULL)
free(as->as_signature);
- if (as->as_env != (struct environment *) NULL)
+ if (as->as_env != NULL)
keynote_env_cleanup(&(as->as_env), 1);
- if (as->as_keylist != (struct keylist *) NULL)
+ if (as->as_keylist != NULL)
keynote_keylist_free(as->as_keylist);
- if (as->as_authorizer != (void *) NULL)
+ if (as->as_authorizer != NULL)
keynote_free_key(as->as_authorizer, as->as_signeralgorithm);
free(as);
diff --git a/lib/libkeynote/keynote-keygen.c b/lib/libkeynote/keynote-keygen.c
index 1d343118772..9b1d840303a 100644
--- a/lib/libkeynote/keynote-keygen.c
+++ b/lib/libkeynote/keynote-keygen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: keynote-keygen.c,v 1.21 2004/06/29 11:35:56 msf Exp $ */
+/* $OpenBSD: keynote-keygen.c,v 1.22 2015/11/19 02:35:24 mmcc Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -120,8 +120,8 @@ keynote_keygen(int argc, char *argv[])
fprintf(stderr, "Algorithm name [%s] should be terminated with a "
"colon, fixing.\n", argv[1]);
- algname = (char *) calloc(len, sizeof(char));
- if (algname == (char *) NULL)
+ algname = calloc(len, sizeof(char));
+ if (algname == NULL)
{
perror("calloc()");
exit(1);
@@ -176,10 +176,10 @@ keynote_keygen(int argc, char *argv[])
{
RAND_bytes(seed, SEED_LEN);
- dsa = DSA_generate_parameters(len, seed, SEED_LEN, &counter, &h, NULL
- , NULL);
+ dsa = DSA_generate_parameters(len, seed, SEED_LEN,
+ &counter, &h, NULL, NULL);
- if (dsa == (DSA *) NULL)
+ if (dsa == NULL)
{
ERR_print_errors_fp(stderr);
exit(1);
@@ -195,7 +195,7 @@ keynote_keygen(int argc, char *argv[])
dc.dec_key = (void *) dsa;
foo = kn_encode_key(&dc, ienc, enc, KEYNOTE_PUBLIC_KEY);
- if (foo == (char *) NULL)
+ if (foo == NULL)
{
fprintf(stderr, "Error encoding key (errno %d)\n", keynote_errno);
exit(1);
@@ -206,7 +206,7 @@ keynote_keygen(int argc, char *argv[])
else
{
fp = fopen(argv[3], "w");
- if (fp == (FILE *) NULL)
+ if (fp == NULL)
{
perror(argv[3]);
exit(1);
@@ -220,7 +220,7 @@ keynote_keygen(int argc, char *argv[])
fclose(fp);
foo = kn_encode_key(&dc, ienc, enc, KEYNOTE_PRIVATE_KEY);
- if (foo == (char *) NULL)
+ if (foo == NULL)
{
fprintf(stderr, "Error encoding key (errno %d)\n", keynote_errno);
exit(1);
@@ -235,7 +235,7 @@ keynote_keygen(int argc, char *argv[])
else
{
fp = fopen(argv[4], "w");
- if (fp == (FILE *) NULL)
+ if (fp == NULL)
{
perror(argv[4]);
exit(1);
@@ -243,8 +243,8 @@ keynote_keygen(int argc, char *argv[])
}
len = strlen(KEYNOTE_PRIVATE_KEY_PREFIX) + strlen(foo) + 1;
- privalgname = (char *) calloc(len, sizeof(char));
- if (privalgname == (char *) NULL)
+ privalgname = calloc(len, sizeof(char));
+ if (privalgname == NULL)
{
perror("calloc()");
exit(1);
@@ -266,7 +266,7 @@ keynote_keygen(int argc, char *argv[])
{
rsa = RSA_generate_key(len, DEFAULT_PUBLIC, NULL, NULL);
- if (rsa == (RSA *) NULL)
+ if (rsa == NULL)
{
ERR_print_errors_fp(stderr);
exit(1);
@@ -276,7 +276,7 @@ keynote_keygen(int argc, char *argv[])
dc.dec_key = (void *) rsa;
foo = kn_encode_key(&dc, ienc, enc, KEYNOTE_PUBLIC_KEY);
- if (foo == (char *) NULL)
+ if (foo == NULL)
{
fprintf(stderr, "Error encoding key (errno %d)\n", keynote_errno);
exit(1);
@@ -287,7 +287,7 @@ keynote_keygen(int argc, char *argv[])
else
{
fp = fopen(argv[3], "w");
- if (fp == (FILE *) NULL)
+ if (fp == NULL)
{
perror(argv[3]);
exit(1);
@@ -301,7 +301,7 @@ keynote_keygen(int argc, char *argv[])
fclose(fp);
foo = kn_encode_key(&dc, ienc, enc, KEYNOTE_PRIVATE_KEY);
- if (foo == (char *) NULL)
+ if (foo == NULL)
{
fprintf(stderr, "Error encoding key (errno %d)\n", keynote_errno);
exit(1);
@@ -316,7 +316,7 @@ keynote_keygen(int argc, char *argv[])
else
{
fp = fopen(argv[4], "w");
- if (fp == (FILE *) NULL)
+ if (fp == NULL)
{
perror(argv[4]);
exit(1);
@@ -324,8 +324,8 @@ keynote_keygen(int argc, char *argv[])
}
len = strlen(KEYNOTE_PRIVATE_KEY_PREFIX) + strlen(foo) + 1;
- privalgname = (char *) calloc(len, sizeof(char));
- if (privalgname == (char *) NULL)
+ privalgname = calloc(len, sizeof(char));
+ if (privalgname == NULL)
{
perror("calloc()");
exit(1);
diff --git a/lib/libkeynote/keynote-sign.c b/lib/libkeynote/keynote-sign.c
index 4edf131ad17..59d58230a4a 100644
--- a/lib/libkeynote/keynote-sign.c
+++ b/lib/libkeynote/keynote-sign.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: keynote-sign.c,v 1.16 2004/06/29 11:35:56 msf Exp $ */
+/* $OpenBSD: keynote-sign.c,v 1.17 2015/11/19 02:35:24 mmcc Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -89,8 +89,8 @@ keynote_sign(int argc, char *argv[])
int len = strlen(argv[1 + flg]) + 2;
fprintf(stderr, "Algorithm name [%s] should be terminated with a "
"colon, fixing.\n", argv[1 + flg]);
- algname = (char *) calloc(len, sizeof(char));
- if (algname == (char *) NULL)
+ algname = alloc(len, sizeof(char));
+ if (algname == NULL)
{
perror("calloc()");
exit(1);
@@ -123,8 +123,8 @@ keynote_sign(int argc, char *argv[])
}
buflen = sb.st_size + 1;
- buf = (char *) calloc(buflen, sizeof(char));
- if (buf == (char *) NULL)
+ buf = calloc(buflen, sizeof(char));
+ if (buf == NULL)
{
perror("calloc()");
exit(1);
@@ -158,8 +158,8 @@ keynote_sign(int argc, char *argv[])
exit(1);
}
- buf2 = (char *) calloc(sb.st_size + 1, sizeof(char));
- if (buf2 == (char *) NULL)
+ buf2 = calloc(sb.st_size + 1, sizeof(char));
+ if (buf2 == NULL)
{
perror("calloc()");
exit(1);
@@ -179,7 +179,7 @@ keynote_sign(int argc, char *argv[])
free(buf);
free(buf2);
- if (sig == (char *) NULL)
+ if (sig == NULL)
{
switch (keynote_errno)
{
diff --git a/lib/libkeynote/keynote-sigver.c b/lib/libkeynote/keynote-sigver.c
index f5ac915b330..61ebe036ed1 100644
--- a/lib/libkeynote/keynote-sigver.c
+++ b/lib/libkeynote/keynote-sigver.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: keynote-sigver.c,v 1.15 2004/06/29 11:35:56 msf Exp $ */
+/* $OpenBSD: keynote-sigver.c,v 1.16 2015/11/19 02:35:24 mmcc Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -75,8 +75,8 @@ keynote_sigver(int argc, char *argv[])
exit(1);
}
- buf = (char *) calloc(sb.st_size + 1, sizeof(char));
- if (buf == (char *) NULL)
+ buf = calloc(sb.st_size + 1, sizeof(char));
+ if (buf == NULL)
{
perror("calloc()");
exit(1);
diff --git a/lib/libkeynote/keynote-verify.c b/lib/libkeynote/keynote-verify.c
index 8adc6397698..3cee610a1ea 100644
--- a/lib/libkeynote/keynote-verify.c
+++ b/lib/libkeynote/keynote-verify.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: keynote-verify.c,v 1.15 2015/11/18 16:08:39 mmcc Exp $ */
+/* $OpenBSD: keynote-verify.c,v 1.16 2015/11/19 02:35:24 mmcc Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -67,7 +67,7 @@ keynote_verify(int argc, char *argv[])
exit(1);
}
- if ((buf = (char *) calloc(cl, sizeof(char))) == (char *) NULL)
+ if ((buf = calloc(cl, sizeof(char))) == NULL)
{
perror("calloc()");
exit(1);
@@ -77,7 +77,7 @@ keynote_verify(int argc, char *argv[])
while(loopvar--) {
#endif /* LoopTesting */
- if ((retv = (char **) calloc(numretv, sizeof(char *))) == (char **) NULL)
+ if ((retv = calloc(numretv, sizeof(char *))) == NULL)
{
perror("calloc()");
exit(1);
@@ -125,8 +125,8 @@ keynote_verify(int argc, char *argv[])
{
free(buf);
cl = sb.st_size + 1;
- buf = (char *) calloc(cl, sizeof(char));
- if (buf == (char *) NULL)
+ buf = calloc(cl, sizeof(char));
+ if (buf == NULL)
{
perror("calloc()");
exit(1);
@@ -179,15 +179,15 @@ keynote_verify(int argc, char *argv[])
sn = 1;
for (numret = 0;
- (ptr = strchr(optarg, ',')) != (char *) NULL;
+ (ptr = strchr(optarg, ',')) != NULL;
numret++)
{
/* Running out of memory */
if (numret > numretv - 3)
{
numretv *= 2;
- foov = (char **) calloc(numretv, sizeof(char **));
- if (foov == (char **) NULL)
+ foov = calloc(numretv, sizeof(char **));
+ if (foov == NULL)
{
/*
* If this were a real program, we 'd be freeing
@@ -203,9 +203,9 @@ keynote_verify(int argc, char *argv[])
retv = foov;
}
- retv[numret] = (char *) calloc((ptr - optarg) + 1,
+ retv[numret] = calloc((ptr - optarg) + 1,
sizeof(char));
- if (retv[numret] == (char *) NULL)
+ if (retv[numret] == NULL)
{
/* Comment from above applies here as well */
perror("calloc()");
@@ -218,8 +218,8 @@ keynote_verify(int argc, char *argv[])
}
/* Last component */
- retv[numret] = (char *) strdup(optarg);
- if (retv[numret] == (char *) NULL)
+ retv[numret] = strdup(optarg);
+ if (retv[numret] == NULL)
{
perror("calloc()");
exit(1);
@@ -245,8 +245,8 @@ keynote_verify(int argc, char *argv[])
{
free(buf);
cl = sb.st_size + 1;
- buf = (char *) calloc(cl, sizeof(char));
- if (buf == (char *) NULL)
+ buf = calloc(cl, sizeof(char));
+ if (buf == NULL)
{
perror("calloc()");
exit(1);
@@ -333,8 +333,8 @@ keynote_verify(int argc, char *argv[])
{
free(buf);
cl = sb.st_size + 1;
- buf = (char *) calloc(cl, sizeof(char));
- if (buf == (char *) NULL)
+ buf = calloc(cl, sizeof(char));
+ if (buf == NULL)
{
perror("calloc()");
exit(1);
@@ -428,7 +428,7 @@ keynote_verify(int argc, char *argv[])
for (sn = 0; sn < numret; sn++)
free(retv[sn]);
free(retv);
- retv = (char **) NULL;
+ retv = NULL;
exit(0);
}
diff --git a/lib/libkeynote/keynote.l b/lib/libkeynote/keynote.l
index 02d10b039f5..a3586ff3945 100644
--- a/lib/libkeynote/keynote.l
+++ b/lib/libkeynote/keynote.l
@@ -1,5 +1,5 @@
%{
-/* $OpenBSD: keynote.l,v 1.21 2015/02/04 20:35:51 bluhm Exp $ */
+/* $OpenBSD: keynote.l,v 1.22 2015/11/19 02:35:24 mmcc Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -41,7 +41,7 @@ struct lex_list
void *lex_s;
};
-static struct lex_list *keynote_lex_list = (struct lex_list *) NULL;
+static struct lex_list *keynote_lex_list = NULL;
static int keynote_max_lex_list = 32;
static int keynote_lex_counter = 0;
static int first_tok = 0;
@@ -111,13 +111,13 @@ comment "#"[^\n]*
if (keynote_exceptionflag ||
keynote_donteval)
{
- knlval.string = (char *) NULL;
+ knlval.string = NULL;
return VARIABLE;
}
len = strlen(kntext) + 1;
knlval.string = calloc(len, sizeof(char));
- if (knlval.string == (char *) NULL)
+ if (knlval.string == NULL)
{
keynote_errno = ERROR_MEMORY;
return -1;
@@ -142,13 +142,13 @@ comment "#"[^\n]*
if (keynote_exceptionflag ||
keynote_donteval)
{
- knlval.string = (char *) NULL;
+ knlval.string = NULL;
return STRING;
}
len = strlen(kntext) + 1;
knlval.string = calloc(len, sizeof(char));
- if (knlval.string == (char *) NULL)
+ if (knlval.string == NULL)
{
keynote_errno = ERROR_MEMORY;
return -1;
@@ -167,13 +167,13 @@ comment "#"[^\n]*
if (keynote_exceptionflag ||
keynote_donteval)
{
- knlval.string = (char *) NULL;
+ knlval.string = NULL;
return STRING;
}
knlval.string = calloc(strlen(kntext) - 1,
sizeof(char));
- if (knlval.string == (char *) NULL)
+ if (knlval.string == NULL)
{
keynote_errno = ERROR_MEMORY;
return -1;
@@ -206,7 +206,7 @@ keynote_lex_zap(void)
return;
for (i = 0; i < keynote_max_lex_list; i++)
- if (keynote_lex_list[i].lex_s != (void *) NULL)
+ if (keynote_lex_list[i].lex_s != NULL)
{
switch (keynote_lex_list[i].lex_type)
{
@@ -216,7 +216,7 @@ keynote_lex_zap(void)
}
keynote_lex_counter--;
- keynote_lex_list[i].lex_s = (void *) NULL;
+ keynote_lex_list[i].lex_s = NULL;
keynote_lex_list[i].lex_type = 0;
}
}
@@ -227,14 +227,14 @@ keynote_lex_zap(void)
static int
keynote_lex_init(void)
{
- if (keynote_lex_list != (struct lex_list *) NULL)
+ if (keynote_lex_list != NULL)
memset(keynote_lex_list, 0,
keynote_max_lex_list * sizeof(struct lex_list));
else
{
- keynote_lex_list = (struct lex_list *) calloc(keynote_max_lex_list,
+ keynote_lex_list = calloc(keynote_max_lex_list,
sizeof(struct lex_list));
- if (keynote_lex_list == (struct lex_list *) NULL)
+ if (keynote_lex_list == NULL)
{
keynote_errno = ERROR_MEMORY;
return -1;
@@ -254,11 +254,11 @@ keynote_lex_add(void *s, int type)
struct lex_list *p;
int i;
- if (s == (void *) NULL)
+ if (s == NULL)
return RESULT_TRUE;
for (i = 0; i < keynote_max_lex_list; i++)
- if (keynote_lex_list[i].lex_s == (void *) NULL)
+ if (keynote_lex_list[i].lex_s == NULL)
{
keynote_lex_list[i].lex_s = (void *) s;
keynote_lex_list[i].lex_type = type;
@@ -272,7 +272,7 @@ keynote_lex_add(void *s, int type)
p = (struct lex_list *) reallocarray(keynote_lex_list,
keynote_max_lex_list,
sizeof(struct lex_list));
- if (p == (struct lex_list *) NULL)
+ if (p == NULL)
{
switch (type)
{
@@ -455,7 +455,7 @@ keynote_evaluate_assertion(struct assertion *as)
YY_BUFFER_STATE keynote_bs;
/* Non-existent Conditions field means highest return value */
- if (as->as_conditions_s == (char *) NULL)
+ if (as->as_conditions_s == NULL)
{
as->as_result = keynote_current_session->ks_values_num - 1;
return RESULT_TRUE;
@@ -493,8 +493,8 @@ keynote_evaluate_assertion(struct assertion *as)
keynote_used_variable = 0;
keynote_returnvalue = 0;
- keynote_temp_list = (struct environment *) NULL;
- keynote_init_list = (struct environment *) NULL;
+ keynote_temp_list = NULL;
+ keynote_init_list = NULL;
if (keynote_errno != 0)
return -1;
@@ -513,7 +513,7 @@ keynote_parse_keypred(struct assertion *as, int record)
YY_BUFFER_STATE keypred_state;
int p = 0, err;
- if (as->as_keypred_s == (char *) NULL)
+ if (as->as_keypred_s == NULL)
return keynote_current_session->ks_values_num - 1;
if (keynote_lex_init() != RESULT_TRUE)
@@ -538,7 +538,7 @@ keynote_parse_keypred(struct assertion *as, int record)
keynote_lex_zap();
keynote_cleanup_kth();
- keynote_init_list = (struct environment *) NULL;
+ keynote_init_list = NULL;
keynote_justrecord = 0;
p = keynote_returnvalue;
keynote_returnvalue = 0;
@@ -548,7 +548,7 @@ keynote_parse_keypred(struct assertion *as, int record)
if (keynote_errno != 0)
{
keynote_keylist_free(keynote_keypred_keylist);
- keynote_keypred_keylist = (struct keylist *) NULL;
+ keynote_keypred_keylist = NULL;
return -1;
}
else
@@ -563,7 +563,7 @@ keynote_parse_keypred(struct assertion *as, int record)
if (as->as_keylist)
keynote_keylist_free(as->as_keylist);
as->as_keylist = keynote_keypred_keylist;
- keynote_keypred_keylist = (struct keylist *) NULL;
+ keynote_keypred_keylist = NULL;
return RESULT_TRUE;
}
}
@@ -588,10 +588,10 @@ keynote_evaluate_authorizer(struct assertion *as, int flag)
keynote_justrecord = 1;
keynote_used_variable = 0;
- if ((flag) && (as->as_authorizer != (void *) NULL))
+ if ((flag) && (as->as_authorizer != NULL))
{
keynote_free_key(as->as_authorizer, as->as_signeralgorithm);
- as->as_authorizer = (void *) NULL;
+ as->as_authorizer = NULL;
}
if (flag)
@@ -617,10 +617,10 @@ keynote_evaluate_authorizer(struct assertion *as, int flag)
keynote_lex_zap();
keynote_justrecord = 0;
- keynote_init_list = (struct environment *) NULL;
+ keynote_init_list = NULL;
keynote_returnvalue = 0;
- if (keynote_keypred_keylist != (struct keylist *) NULL)
+ if (keynote_keypred_keylist != NULL)
{
if (flag)
{
@@ -638,9 +638,9 @@ keynote_evaluate_authorizer(struct assertion *as, int flag)
as->as_signature = keynote_keypred_keylist->key_key;
}
- keynote_keypred_keylist->key_key = (char *) NULL;
+ keynote_keypred_keylist->key_key = NULL;
keynote_keylist_free(keynote_keypred_keylist);
- keynote_keypred_keylist = (struct keylist *) NULL;
+ keynote_keypred_keylist = NULL;
}
keynote_used_variable = 0;
@@ -671,9 +671,9 @@ keynote_get_private_key(char *buf)
int err;
if (keynote_lex_init() != RESULT_TRUE)
- return (char *) NULL;
+ return NULL;
- keynote_privkey = (char *) NULL;
+ keynote_privkey = NULL;
pkey = kn_scan_bytes(buf, strlen(buf));
first_tok = PRIVATEKEY;
err = knparse();
@@ -682,20 +682,20 @@ keynote_get_private_key(char *buf)
if (err != 0)
{
- if (keynote_privkey != (char *) NULL)
+ if (keynote_privkey != NULL)
{
free(keynote_privkey);
- keynote_privkey = (char *) NULL;
+ keynote_privkey = NULL;
}
if (keynote_errno == 0)
keynote_errno = ERROR_SYNTAX;
- return (char *) NULL;
+ return NULL;
}
s = keynote_privkey;
- keynote_privkey = (char *) NULL;
+ keynote_privkey = NULL;
return s;
}
@@ -705,12 +705,12 @@ keynote_get_private_key(char *buf)
struct environment *
keynote_get_envlist(char *buf, char *bufend, int whichfield)
{
- struct environment *en = (struct environment *) NULL;
+ struct environment *en = NULL;
YY_BUFFER_STATE localinit_state;
int err;
if (keynote_lex_init() != RESULT_TRUE)
- return (struct environment *) NULL;
+ return NULL;
localinit_state = kn_scan_bytes(buf, bufend - buf);
if (whichfield == 0)
@@ -739,7 +739,7 @@ keynote_get_envlist(char *buf, char *bufend, int whichfield)
else
en = keynote_init_list;
- keynote_init_list = (struct environment *) NULL;
+ keynote_init_list = NULL;
}
/* Avoid compiler (-Wall) warnings. Never reached. */
diff --git a/lib/libkeynote/keynote.y b/lib/libkeynote/keynote.y
index d46c9efcef5..a3fcccd60b3 100644
--- a/lib/libkeynote/keynote.y
+++ b/lib/libkeynote/keynote.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: keynote.y,v 1.16 2013/11/29 19:00:51 deraadt Exp $ */
+/* $OpenBSD: keynote.y,v 1.17 2015/11/19 02:35:24 mmcc Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -55,7 +55,7 @@
#include "keynote.h"
#include "assertion.h"
-static int *keynote_kth_array = (int *) NULL;
+static int *keynote_kth_array = NULL;
static int keylistcount = 0;
static int resolve_assertion(char *);
@@ -211,7 +211,7 @@ localconstants: VARIABLE EQQ STRING
}
/* If the identifier already exists, report error. */
- if (keynote_env_lookup($1, &keynote_init_list, 1) != (char *) NULL)
+ if (keynote_env_lookup($1, &keynote_init_list, 1) != NULL)
{
free($1);
free($3);
@@ -245,7 +245,7 @@ localconstants: VARIABLE EQQ STRING
}
/* If the identifier already exists, report error. */
- if (keynote_env_lookup($1, &keynote_init_list, 1) != (char *) NULL)
+ if (keynote_env_lookup($1, &keynote_init_list, 1) != NULL)
{
free($1);
free($3);
@@ -533,7 +533,7 @@ stringexp: str EQ str {
{
gr = calloc(pmatch[i].rm_eo - pmatch[i].rm_so +
1, sizeof(char));
- if (gr == (char *) NULL)
+ if (gr == NULL)
{
free($1);
regfree(&preg);
@@ -565,14 +565,14 @@ stringexp: str EQ str {
}
str: str DOTT str { if (keynote_exceptionflag || keynote_donteval)
- $$ = (char *) NULL;
+ $$ = NULL;
else
{
int len = strlen($1) + strlen($3) + 1;
$$ = calloc(len, sizeof(char));
keynote_lex_remove($1);
keynote_lex_remove($3);
- if ($$ == (char *) NULL)
+ if ($$ == NULL)
{
free($1);
free($3);
@@ -591,13 +591,13 @@ str: str DOTT str { if (keynote_exceptionflag || keynote_donteval)
strnotconcat: STRING { $$ = $1; }
| OPENPAREN str CLOSEPAREN { $$ = $2; }
| VARIABLE { if (keynote_exceptionflag || keynote_donteval)
- $$ = (char *) NULL;
+ $$ = NULL;
else
{
$$ = my_lookup($1);
keynote_lex_remove($1);
free($1);
- if ($$ == (char *) NULL)
+ if ($$ == NULL)
{
if (keynote_errno)
return -1;
@@ -606,7 +606,7 @@ strnotconcat: STRING { $$ = $1; }
else
$$ = strdup($$);
- if ($$ == (char *) NULL)
+ if ($$ == NULL)
{
keynote_errno = ERROR_MEMORY;
return -1;
@@ -617,13 +617,13 @@ strnotconcat: STRING { $$ = $1; }
}
}
| DEREF str { if (keynote_exceptionflag || keynote_donteval)
- $$ = (char *) NULL;
+ $$ = NULL;
else
{
$$ = my_lookup($2);
keynote_lex_remove($2);
free($2);
- if ($$ == (char *) NULL)
+ if ($$ == NULL)
{
if (keynote_errno)
return -1;
@@ -632,7 +632,7 @@ strnotconcat: STRING { $$ = $1; }
else
$$ = strdup($$);
- if ($$ == (char *) NULL)
+ if ($$ == NULL)
{
keynote_errno = ERROR_MEMORY;
return -1;
@@ -657,7 +657,7 @@ resolve_assertion(char *s)
struct keylist *kl;
kl = keynote_keylist_find(keynote_current_assertion->as_keylist, s);
- if (kl != (struct keylist *) NULL)
+ if (kl != NULL)
{
alg = kl->key_alg;
key = kl->key_key;
@@ -666,7 +666,7 @@ resolve_assertion(char *s)
for (i = 0;; i++)
{
as = keynote_find_assertion(key, i, alg);
- if (as == (struct assertion *) NULL) /* Gone through all of them */
+ if (as == NULL) /* Gone through all of them */
return p;
if (as->as_kresult == KRESULT_DONE)
@@ -726,52 +726,52 @@ my_lookup(char *s)
if (keynote_temp_list != NULL)
{
ret = keynote_env_lookup(s, &keynote_temp_list, 1);
- if (ret != (char *) NULL)
+ if (ret != NULL)
return ret;
else
if (keynote_errno != 0)
- return (char *) NULL;
+ return NULL;
}
/* Local-Constants */
if (keynote_init_list != NULL)
{
ret = keynote_env_lookup(s, &keynote_init_list, 1);
- if (ret != (char *) NULL)
+ if (ret != NULL)
return ret;
else
if (keynote_errno != 0)
- return (char *) NULL;
+ return NULL;
}
if ((ks != NULL) && (ks->ks_env_table != NULL))
{
/* Action environment */
ret = keynote_env_lookup(s, ks->ks_env_table, HASHTABLESIZE);
- if (ret != (char *) NULL)
+ if (ret != NULL)
{
keynote_used_variable = 1;
return ret;
}
else
if (keynote_errno != 0)
- return (char *) NULL;
+ return NULL;
}
/* Regex table */
if ((ks != NULL) && (ks->ks_env_regex != NULL))
{
ret = keynote_env_lookup(s, &(ks->ks_env_regex), 1);
- if (ret != (char *) NULL)
+ if (ret != NULL)
{
keynote_used_variable = 1;
return ret;
}
- return (char *) NULL;
+ return NULL;
}
- return (char *) NULL;
+ return NULL;
}
/*
@@ -854,8 +854,8 @@ keynote_init_kth(void)
if (i == -1)
return -1;
- keynote_kth_array = (int *) calloc(i, sizeof(int));
- if (keynote_kth_array == (int *) NULL)
+ keynote_kth_array = calloc(i, sizeof(int));
+ if (keynote_kth_array == NULL)
{
keynote_errno = ERROR_MEMORY;
return -1;
@@ -889,10 +889,10 @@ get_kth(int k)
void
keynote_cleanup_kth(void)
{
- if (keynote_kth_array != (int *) NULL)
+ if (keynote_kth_array != NULL)
{
free(keynote_kth_array);
- keynote_kth_array = (int *) NULL;
+ keynote_kth_array = NULL;
}
}
diff --git a/lib/libkeynote/parse_assertion.c b/lib/libkeynote/parse_assertion.c
index 299a9bafb21..9146197308b 100644
--- a/lib/libkeynote/parse_assertion.c
+++ b/lib/libkeynote/parse_assertion.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse_assertion.c,v 1.14 2013/11/29 19:00:51 deraadt Exp $ */
+/* $OpenBSD: parse_assertion.c,v 1.15 2015/11/19 02:35:24 mmcc Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -70,7 +70,7 @@ rec_evaluate_query(struct assertion *as)
}
for (kl = as->as_keylist;
- kl != (struct keylist *) NULL;
+ kl != NULL;
kl = kl->key_next)
{
switch (keynote_in_action_authorizers(kl->key_key, kl->key_alg))
@@ -92,14 +92,14 @@ rec_evaluate_query(struct assertion *as)
break;
case RESULT_TRUE: /* Ok, don't bother with assertions */
- keynote_current_assertion = (struct assertion *) NULL;
+ keynote_current_assertion = NULL;
continue;
}
for (i = 0;; i++)
{
ast = keynote_find_assertion(kl->key_key, i, kl->key_alg);
- if (ast == (struct assertion *) NULL)
+ if (ast == NULL)
break;
if (ast->as_kresult == KRESULT_IN_PROGRESS) /* Cycle detected */
@@ -122,7 +122,7 @@ rec_evaluate_query(struct assertion *as)
keynote_current_assertion = as;
s = keynote_parse_keypred(as, 0);
- keynote_current_assertion = (struct assertion *) NULL;
+ keynote_current_assertion = NULL;
if (keynote_errno == ERROR_MEMORY)
{
@@ -179,14 +179,14 @@ keynote_fix_fields(struct assertion *ast, int sigfield)
int i;
/* Signature generation/verification handling, no need to eval Licensees */
- if (ast != (struct assertion *) NULL)
+ if (ast != NULL)
{
/* Authorizer */
if (keynote_evaluate_authorizer(ast, 1) != RESULT_TRUE)
return -1;
/* Signature */
- if ((sigfield) && (ast->as_signature_string_s != (char *) NULL))
+ if ((sigfield) && (ast->as_signature_string_s != NULL))
if (keynote_evaluate_authorizer(ast, 0) != RESULT_TRUE)
return -1;
@@ -195,7 +195,7 @@ keynote_fix_fields(struct assertion *ast, int sigfield)
for (i = 0; i < HASHTABLESIZE; i++)
for (as = keynote_current_session->ks_assertion_table[i];
- as != (struct assertion *) NULL;
+ as != NULL;
as = as->as_next)
{
if (!(as->as_internalflags & ASSERT_IFLAG_NEEDPROC) &&
@@ -207,7 +207,7 @@ keynote_fix_fields(struct assertion *ast, int sigfield)
/* Parse the Signature field */
if (((as->as_internalflags & ASSERT_IFLAG_WEIRDSIG) ||
(as->as_internalflags & ASSERT_IFLAG_NEEDPROC)) &&
- (as->as_signature_string_s != (char *) NULL))
+ (as->as_signature_string_s != NULL))
if (keynote_evaluate_authorizer(as, 0) == -1)
{
if (keynote_errno)
@@ -248,7 +248,7 @@ keynote_fix_fields(struct assertion *ast, int sigfield)
/* Reposition if necessary */
for (i = 0; i < HASHTABLESIZE; i++)
for (as = keynote_current_session->ks_assertion_table[i];
- as != (struct assertion *) NULL;
+ as != NULL;
as = as->as_next)
if (((as->as_internalflags & ASSERT_IFLAG_WEIRDAUTH) &&
!(as->as_internalflags & ASSERT_IFLAG_PROCESSED)) ||
@@ -282,15 +282,15 @@ keynote_evaluate_query(void)
int i;
/* Fix the authorizer/licensees/signature fields */
- if (keynote_fix_fields((struct assertion *) NULL, 0) != RESULT_TRUE)
+ if (keynote_fix_fields(NULL, 0) != RESULT_TRUE)
return -1;
/* Find POLICY assertions and try to evaluate the query. */
for (i = 0, prev = 0; i < HASHTABLESIZE; i++)
for (as = keynote_current_session->ks_assertion_table[i];
- as != (struct assertion *) NULL;
+ as != NULL;
as = as->as_next)
- if ((as->as_authorizer != (void *) NULL) && /* Paranoid */
+ if ((as->as_authorizer != NULL) && /* Paranoid */
(as->as_signeralgorithm == KEYNOTE_ALGORITHM_NONE))
if ((!strcmp("POLICY", as->as_authorizer)) &&
(as->as_flags & ASSERT_FLAG_LOCAL))
@@ -368,24 +368,24 @@ struct assertion *
keynote_parse_assertion(char *buf, int len, int assertion_flags)
{
int k, i, j, seen_field = 0, ver = 0, end_of_assertion = 0;
- char *ks, *ke, *ts, *te = (char *) NULL;
+ char *ks, *ke, *ts, *te = NULL;
struct assertion *as;
/* Allocate memory for assertion */
- as = (struct assertion *) calloc(1, sizeof(struct assertion));
- if (as == (struct assertion *) NULL)
+ as = calloc(1, sizeof(struct assertion));
+ if (as == NULL)
{
keynote_errno = ERROR_MEMORY;
- return (struct assertion *) NULL;
+ return NULL;
}
/* Keep a copy of the assertion around */
as->as_buf = strdup(buf);
- if (as->as_buf == (char *) NULL)
+ if (as->as_buf == NULL)
{
keynote_errno = ERROR_MEMORY;
keynote_free_assertion(as);
- return (struct assertion *) NULL;
+ return NULL;
}
as->as_flags = assertion_flags & ~(ASSERT_FLAG_SIGGEN |
@@ -400,7 +400,7 @@ keynote_parse_assertion(char *buf, int len, int assertion_flags)
{
keynote_free_assertion(as);
keynote_errno = ERROR_SYNTAX;
- return (struct assertion *) NULL;
+ return NULL;
}
while (i < j) /* Decomposition loop */
@@ -408,7 +408,7 @@ keynote_parse_assertion(char *buf, int len, int assertion_flags)
ks = as->as_buf + i;
/* Mark begining of assertion for signature purposes */
- if (as->as_startofsignature == (char *) NULL)
+ if (as->as_startofsignature == NULL)
as->as_startofsignature = ks;
/* This catches comments at the begining of an assertion only */
@@ -432,7 +432,7 @@ keynote_parse_assertion(char *buf, int len, int assertion_flags)
{
keynote_free_assertion(as);
keynote_errno = ERROR_SYNTAX;
- return (struct assertion *) NULL;
+ return NULL;
}
/* ks points at begining of keyword, ke points at end */
@@ -488,14 +488,14 @@ keynote_parse_assertion(char *buf, int len, int assertion_flags)
{
case -1:
keynote_free_assertion(as);
- return (struct assertion *) NULL;
+ return NULL;
case KEYWORD_VERSION:
if ((ver == 1) || (seen_field == 1))
{
keynote_free_assertion(as);
keynote_errno = ERROR_SYNTAX;
- return (struct assertion *) NULL;
+ return NULL;
}
/* Test for version correctness */
@@ -503,34 +503,34 @@ keynote_parse_assertion(char *buf, int len, int assertion_flags)
if (keynote_errno != 0)
{
keynote_free_assertion(as);
- return (struct assertion *) NULL;
+ return NULL;
}
ver = 1;
break;
case KEYWORD_LOCALINIT:
- if (as->as_env != (struct environment *) NULL)
+ if (as->as_env != NULL)
{
keynote_free_assertion(as);
keynote_errno = ERROR_SYNTAX;
- return (struct assertion *) NULL;
+ return NULL;
}
as->as_env = keynote_get_envlist(ts, te, 0);
if (keynote_errno != 0)
{
keynote_free_assertion(as);
- return (struct assertion *) NULL;
+ return NULL;
}
break;
case KEYWORD_AUTHORIZER:
- if (as->as_authorizer_string_s != (void *) NULL)
+ if (as->as_authorizer_string_s != NULL)
{
keynote_free_assertion(as);
keynote_errno = ERROR_SYNTAX;
- return (struct assertion *) NULL;
+ return NULL;
}
as->as_authorizer_string_s = ts;
@@ -538,11 +538,11 @@ keynote_parse_assertion(char *buf, int len, int assertion_flags)
break;
case KEYWORD_LICENSEES:
- if (as->as_keypred_s != (char *) NULL)
+ if (as->as_keypred_s != NULL)
{
keynote_free_assertion(as);
keynote_errno = ERROR_SYNTAX;
- return (struct assertion *) NULL;
+ return NULL;
}
as->as_keypred_s = ts;
@@ -550,11 +550,11 @@ keynote_parse_assertion(char *buf, int len, int assertion_flags)
break;
case KEYWORD_CONDITIONS:
- if (as->as_conditions_s != (char *) NULL)
+ if (as->as_conditions_s != NULL)
{
keynote_free_assertion(as);
keynote_errno = ERROR_SYNTAX;
- return (struct assertion *) NULL;
+ return NULL;
}
as->as_conditions_s = ts;
@@ -562,11 +562,11 @@ keynote_parse_assertion(char *buf, int len, int assertion_flags)
break;
case KEYWORD_SIGNATURE:
- if (as->as_signature_string_s != (char *) NULL)
+ if (as->as_signature_string_s != NULL)
{
keynote_free_assertion(as);
keynote_errno = ERROR_SYNTAX;
- return (struct assertion *) NULL;
+ return NULL;
}
end_of_assertion = 1;
@@ -576,11 +576,11 @@ keynote_parse_assertion(char *buf, int len, int assertion_flags)
break;
case KEYWORD_COMMENT:
- if (as->as_comment_s != (char *) NULL)
+ if (as->as_comment_s != NULL)
{
keynote_free_assertion(as);
keynote_errno = ERROR_SYNTAX;
- return (struct assertion *) NULL;
+ return NULL;
}
as->as_comment_s = ts;
@@ -602,7 +602,7 @@ keynote_parse_assertion(char *buf, int len, int assertion_flags)
{
keynote_free_assertion(as);
keynote_errno = ERROR_SYNTAX;
- return (struct assertion *) NULL;
+ return NULL;
}
break; /* Assertion is "properly" terminated */
@@ -610,11 +610,11 @@ keynote_parse_assertion(char *buf, int len, int assertion_flags)
}
/* Check that the basic fields are there */
- if (as->as_authorizer_string_s == (char *) NULL)
+ if (as->as_authorizer_string_s == NULL)
{
keynote_free_assertion(as);
keynote_errno = ERROR_SYNTAX;
- return (struct assertion *) NULL;
+ return NULL;
}
/* Signature generation/verification handling */
@@ -623,7 +623,7 @@ keynote_parse_assertion(char *buf, int len, int assertion_flags)
if (keynote_fix_fields(as, 0) != RESULT_TRUE)
{
keynote_free_assertion(as);
- return (struct assertion *) NULL;
+ return NULL;
}
}
else
@@ -631,7 +631,7 @@ keynote_parse_assertion(char *buf, int len, int assertion_flags)
if (keynote_fix_fields(as, 1) != RESULT_TRUE)
{
keynote_free_assertion(as);
- return (struct assertion *) NULL;
+ return NULL;
}
return as;