dect
/
libdect
Archived
13
0
Fork 0

mm: properly support key allocation procedure

Key allocation includes mutual authentication, accept authentication
requests while a key allocation procedure is in progress.

Signed-off-by: Patrick McHardy <kaber@trash.net>
This commit is contained in:
Patrick McHardy 2010-07-04 11:26:49 +02:00
parent 007d2e2a5f
commit 3a1ff7e707
1 changed files with 12 additions and 4 deletions

View File

@ -765,13 +765,18 @@ int dect_mm_authenticate_req(struct dect_handle *dh,
const struct dect_mm_authenticate_param *param)
{
struct dect_mm_procedure *mp = &mme->procedure[DECT_TRANSACTION_INITIATOR];
struct dect_mm_procedure *mpr = &mme->procedure[DECT_TRANSACTION_RESPONDER];
struct dect_mm_authentication_request_msg msg;
int err;
mm_debug_entry(mme, "MM_AUTHENTICATE-req");
err = dect_mm_procedure_initiate(dh, mme, DECT_MMP_AUTHENTICATE);
if (err < 0)
goto err1;
if (mpr->type == DECT_MMP_KEY_ALLOCATION)
mp = mpr;
else {
err = dect_mm_procedure_initiate(dh, mme, DECT_MMP_AUTHENTICATE);
if (err < 0)
goto err1;
}
memset(&msg, 0, sizeof(msg));
msg.auth_type = param->auth_type;
@ -921,11 +926,14 @@ static void dect_mm_rcv_authentication_reply(struct dect_handle *dh,
struct dect_msg_buf *mb)
{
struct dect_mm_procedure *mp = &mme->procedure[DECT_TRANSACTION_INITIATOR];
struct dect_mm_procedure *mpr = &mme->procedure[DECT_TRANSACTION_RESPONDER];
struct dect_mm_authentication_reply_msg msg;
struct dect_mm_authenticate_param *param;
mm_debug(mme, "AUTHENTICATION-REPLY");
if (mp->type != DECT_MMP_AUTHENTICATE)
if (mpr->type == DECT_MMP_KEY_ALLOCATION)
mp = mpr;
else if (mp->type != DECT_MMP_AUTHENTICATE)
return;
if (dect_parse_sfmt_msg(dh, &mm_authentication_reply_msg_desc,