struct hash_if *hash;
uint32_t index; /* Index of this site */
+ uint32_t early_capabilities;
uint32_t local_capabilities;
int32_t setup_retries; /* How many times to send setup packets */
int32_t setup_retry_interval; /* Initial timeout for setup packets */
_Bool ok;
/* Make room for the shared key */
- st->sharedsecretlen=st->chosen_transform->keylen?:st->dh->ceil_len;
+ st->sharedsecretlen=st->chosen_transform->keylen?:st->dh->shared_len;
assert(st->sharedsecretlen);
if (st->sharedsecretlen > st->sharedsecretallocd) {
st->sharedsecretallocd=st->sharedsecretlen;
}
/* Generate the shared key */
- st->dh->makeshared(st->dh->st,st->dhsecret,st->dh->len,pk,
- st->sharedsecret,st->sharedsecretlen);
+ if (!st->dh->makeshared(st->dh->st,st->dhsecret,st->dh->secret_len,
+ pk, st->sharedsecret,st->sharedsecretlen))
+ return False;
/* Set up the transform */
struct transform_if *generator=st->chosen_transform;
struct xinfoadd xia;
append_string_xinfo_start(&st->buffer,&xia,st->localname);
- if ((st->local_capabilities & CAPAB_EARLY) || (type != LABEL_MSG1)) {
+ if ((st->local_capabilities & st->early_capabilities) ||
+ (type != LABEL_MSG1)) {
buf_append_uint32(&st->buffer,st->local_capabilities);
}
if (type_is_msg34(type)) {
if (type==LABEL_MSG3BIS)
buf_append_uint8(&st->buffer,st->chosen_transform->capab_bit);
- dhpub=st->dh->makepublic(st->dh->st,st->dhsecret,st->dh->len);
+ dhpub=st->dh->makepublic(st->dh->st,st->dhsecret,st->dh->secret_len);
buf_append_string(&st->buffer,dhpub);
free(dhpub);
hash=safe_malloc(st->hash->len, "generate_msg");
{
/* Now we have our nonce and their nonce. Think of a secret key,
and create message number 3. */
- st->random->generate(st->random->st,st->dh->len,st->dhsecret);
+ st->random->generate(st->random->st,st->dh->secret_len,st->dhsecret);
return generate_msg(st,
(st->remote_capabilities & CAPAB_TRANSFORM_MASK
? LABEL_MSG3BIS : LABEL_MSG3),
return False;
}
uint32_t capab_adv_late = m.remote_capabilities
- & ~st->remote_capabilities & CAPAB_EARLY;
+ & ~st->remote_capabilities & st->early_capabilities;
if (capab_adv_late) {
slog(st,LOG_SEC,"msg3 impermissibly adds early capability flag(s)"
" %#"PRIx32" (was %#"PRIx32", now %#"PRIx32")",
/* Terminate their DH public key with a '0' */
m.pk[m.pklen]=0;
/* Invent our DH secret key */
- st->random->generate(st->random->st,st->dh->len,st->dhsecret);
+ st->random->generate(st->random->st,st->dh->secret_len,st->dhsecret);
/* Generate the shared key and set up the transform */
if (!set_new_transform(st,m.pk)) return False;
FILLZERO(st->localN);
FILLZERO(st->remoteN);
dispose_transform(&st->new_transform);
- memset(st->dhsecret,0,st->dh->len);
+ memset(st->dhsecret,0,st->dh->secret_len);
if (st->sharedsecret) memset(st->sharedsecret,0,st->sharedsecretlen);
set_link_quality(st);
assert(index_sequence < 0xffffffffUL);
st->index = ++index_sequence;
st->local_capabilities = 0;
+ st->early_capabilities = CAPAB_PRIORITY_MOBILE;
st->netlink=find_cl_if(dict,"link",CL_NETLINK,True,"site",loc);
#define GET_CLOSURE_LIST(dictkey,things,nthings,CL_TYPE) do{ \
transport_peers_clear(st,&st->peers);
transport_peers_clear(st,&st->setup_peers);
/* XXX mlock these */
- st->dhsecret=safe_malloc(st->dh->len,"site:dhsecret");
+ st->dhsecret=safe_malloc(st->dh->secret_len,"site:dhsecret");
st->sharedsecretlen=st->sharedsecretallocd=0;
st->sharedsecret=0;