if (r->protocol != 3 || r->algorithm != 1 || r->reconf_type != 2)
continue;
- md5_state_t md5;
+ md5_ctx_t md5;
uint8_t serverhash[16], secretbytes[16], hash[16];
memcpy(serverhash, r->key, sizeof(serverhash));
memset(r->key, 0, sizeof(r->key));
for (size_t i = 0; i < sizeof(secretbytes); ++i)
secretbytes[i] ^= 0x36;
- md5_init(&md5);
- md5_append(&md5, secretbytes, sizeof(secretbytes));
- md5_append(&md5, buf, len);
- md5_finish(&md5, hash);
+ md5_begin(&md5);
+ md5_hash(secretbytes, sizeof(secretbytes), &md5);
+ md5_hash(buf, len, &md5);
+ md5_end(hash, &md5);
for (size_t i = 0; i < sizeof(secretbytes); ++i) {
secretbytes[i] ^= 0x36;
secretbytes[i] ^= 0x5c;
}
- md5_init(&md5);
- md5_append(&md5, secretbytes, sizeof(secretbytes));
- md5_append(&md5, hash, 16);
- md5_finish(&md5, hash);
+ md5_begin(&md5);
+ md5_hash(secretbytes, sizeof(secretbytes), &md5);
+ md5_hash(hash, 16, &md5);
+ md5_end(hash, &md5);
rcauth_ok = !memcmp(hash, serverhash, sizeof(hash));
} else if (otype == DHCPV6_OPT_RECONF_MESSAGE && olen == 1) {
t1 = l_t1;
t2 = l_t2;
t3 = l_t3;
+ } else {
+ t1 = 600;
}
return (int)(ia_pd_entries + ia_na_entries);
size_t cand_len;
struct dhcpv6_server_cand *cand = odhcp6c_get_state(STATE_SERVER_CAND, &cand_len);
uint16_t hdr[2];
- int ret = DHCPV6_STATELESS;
+ int ret = (na_mode == IA_MODE_NONE && pd_mode == IA_MODE_NONE) ?
+ DHCPV6_STATELESS : DHCPV6_STATEFUL;
// Clear lingering candidate state info
odhcp6c_clear_state(STATE_SERVER_ID);