Skip to content

Commit

Permalink
dhcp6c: fix cast warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
fichtner committed May 10, 2023
1 parent 9bfcb76 commit ee9c238
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ dhcp6_validate_key(struct keyinfo *key)
}

int
dhcp6_calc_mac(char *buf, size_t len, int proto __attribute__((__unused__)), int alg,
dhcp6_calc_mac(unsigned char *buf, size_t len, int proto __attribute__((__unused__)), int alg,
size_t off, struct keyinfo *key)
{
hmacmd5_t ctx;
Expand Down Expand Up @@ -148,7 +148,7 @@ dhcp6_calc_mac(char *buf, size_t len, int proto __attribute__((__unused__)), int
}

int
dhcp6_verify_mac(char *buf, ssize_t len, int proto __attribute__((__unused__)),
dhcp6_verify_mac(unsigned char *buf, ssize_t len, int proto __attribute__((__unused__)),
int alg, size_t off, struct keyinfo *key)
{
hmacmd5_t ctx;
Expand Down
6 changes: 3 additions & 3 deletions auth.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ struct keyinfo {
char *realm; /* DHCP realm */
size_t realmlen; /* length of realm */
u_int32_t keyid; /* key ID */
char *secret; /* binary key */
unsigned char *secret; /* binary key */
size_t secretlen; /* length of the key */
time_t expire; /* expiration time (0 means forever) */
};

int dhcp6_validate_key(struct keyinfo *);
int dhcp6_calc_mac(char *, size_t, int, int, size_t,
int dhcp6_calc_mac(unsigned char *, size_t, int, int, size_t,
struct keyinfo *);
int dhcp6_verify_mac(char *, ssize_t, int, int, size_t,
int dhcp6_verify_mac(unsigned char *, ssize_t, int, int, size_t,
struct keyinfo *);

#endif
2 changes: 1 addition & 1 deletion config.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ void list_cfl (char *tag,struct cf_namelist *head)
}
break;
case DECL_SCRIPT:
printf("script %s\n", cfl->ptr);
printf("script %s\n", (char *)cfl->ptr);
break;
default:
printf("Unknown option type %i\n", cfl->type);
Expand Down
4 changes: 2 additions & 2 deletions dhcp6c.c
Original file line number Diff line number Diff line change
Expand Up @@ -1141,7 +1141,7 @@ client6_send(struct dhcp6_event *ev)
if (ev->authparam->key == NULL)
break;

if (dhcp6_calc_mac((char *)dh6, len,
if (dhcp6_calc_mac((unsigned char *)dh6, len,
optinfo.authproto, optinfo.authalgorithm,
optinfo.delayedauth_offset + sizeof(*dh6),
ev->authparam->key)) {
Expand Down Expand Up @@ -1873,7 +1873,7 @@ process_auth(struct authparam *authparam, struct dhcp6 *dh6,
}

/* validate MAC */
if (dhcp6_verify_mac((char *)dh6, len, optinfo->authproto,
if (dhcp6_verify_mac((unsigned char *)dh6, len, optinfo->authproto,
optinfo->authalgorithm,
optinfo->delayedauth_offset + sizeof(*dh6), key) == 0) {
d_printf(LOG_DEBUG, FNAME, "message authentication "
Expand Down

0 comments on commit ee9c238

Please sign in to comment.