예제 #1
0
파일: ampe.c 프로젝트: cozybit/authsae
static void peer_ampe_init(
    struct ampe_config *aconf,
    struct candidate *cand,
    void *cookie) {
  le16 llid;

  assert(cand);

  RAND_bytes((unsigned char *)&llid, sizeof(llid));
  RAND_bytes(cand->my_nonce, sizeof(cand->my_nonce));
  memset(cand->peer_nonce, 0, sizeof(cand->peer_nonce));
  cand->cookie = cookie;
  cand->my_lid = llid;
  cand->peer_lid = 0;
  set_link_state(cand, PLINK_LISTEN);
  cand->timeout = aconf->retry_timeout_ms;
  cand->conf = aconf;

  memset(cand->mtk, 0, sizeof(cand->mtk));
  memset(cand->mgtk, 0, sizeof(cand->mgtk));
  memset(cand->igtk, 0, sizeof(cand->igtk));
  cand->has_igtk = false;

  if (aconf->mesh->conf->is_secure) {
    derive_aek(cand);
    siv_init(&cand->sivctx, cand->aek, SIV_256);
  }
}
예제 #2
0
파일: ampe.c 프로젝트: cococorp/authsae
static void peer_ampe_init(struct ampe_config *aconf,
                           struct candidate *cand, unsigned char *me, void *cookie)
{
	le16 llid;

    assert(cand && me);

    RAND_bytes((unsigned char *) &llid, 2);
    RAND_bytes(cand->my_nonce, sizeof(cand->my_nonce));
    cand->cookie = cookie;
	cand->my_lid = llid;
	cand->peer_lid = 0;
	set_link_state(cand, PLINK_LISTEN);
    cand->timeout = aconf->retry_timeout_ms;
    cand->conf = aconf;
    derive_aek(cand);
    siv_init(&cand->sivctx, cand->aek, SIV_256);
	return;
}