Lines Matching defs:context

973 	u8		 valid;	    // Flag to say if context is valid or not
978 miccntx mCtx; // Multicast context
979 miccntx uCtx; // Unicast context
1297 static int RxSeqValid(struct airo_info *ai, miccntx *context, int mcast, u32 micSeq);
1298 static void MoveWindow(miccntx *context, u32 micSeq);
1299 static void emmh32_setseed(emmh32_context *context, u8 *pkey, int keylen,
1301 static void emmh32_init(emmh32_context *context);
1302 static void emmh32_update(emmh32_context *context, u8 *pOctets, int len);
1303 static void emmh32_final(emmh32_context *context, u8 digest[4]);
1309 /* If the current MIC context is valid and its key is the same as
1318 /* Initialize new context */
1404 miccntx *context;
1406 // Determine correct context
1410 context = &ai->mod[0].mCtx;
1412 context = &ai->mod[0].uCtx;
1414 if (!context->valid)
1422 mic->seq = htonl(context->tx);
1423 context->tx += 2;
1425 emmh32_init(&context->seed); // Mic the packet
1426 emmh32_update(&context->seed, frame->da, ETH_ALEN * 2); // DA, SA
1427 emmh32_update(&context->seed, (u8*)&mic->typelen, 10); // Type/Length and Snap
1428 emmh32_update(&context->seed, (u8*)&mic->seq, sizeof(mic->seq)); //SEQ
1429 emmh32_update(&context->seed, (u8*)(frame + 1), payLen); //payload
1430 emmh32_final(&context->seed, (u8*)&mic->mic);
1462 miccntx *context;
1499 //Determine proper context
1500 context = mcast ? &ai->mod[i].mCtx : &ai->mod[i].uCtx;
1502 //Make sure context is valid
1503 if (!context->valid) {
1513 emmh32_init(&context->seed);
1514 emmh32_update(&context->seed, eth->da, ETH_ALEN*2);
1515 emmh32_update(&context->seed, (u8 *)&mic->typelen, sizeof(mic->typelen)+sizeof(mic->u.snap));
1516 emmh32_update(&context->seed, (u8 *)&mic->seq, sizeof(mic->seq));
1517 emmh32_update(&context->seed, (u8 *)(eth + 1), payLen);
1519 emmh32_final(&context->seed, digest);
1529 if (RxSeqValid(ai, context, mcast, micSEQ) == SUCCESS) {
1552 * Inputs: miccntx - mic context to check seq against
1562 static int RxSeqValid(struct airo_info *ai, miccntx *context, int mcast, u32 micSeq)
1572 context->window = (micSeq > 33) ? micSeq : 33;
1573 context->rx = 0; // Reset rx
1577 context->window = (micSeq > 33) ? micSeq : 33; // Move window
1578 context->rx = 0; // Reset rx
1582 seq = micSeq - (context->window - 33);
1590 MoveWindow(context, micSeq);
1594 // We are in the window. Now check the context rx bit to see if it was already sent
1598 if (!(context->rx & index)) {
1601 context->rx |= index;
1603 MoveWindow(context, micSeq);
1610 static void MoveWindow(miccntx *context, u32 micSeq)
1615 if (micSeq > context->window) {
1616 shift = (micSeq - context->window) >> 1;
1620 context->rx >>= shift;
1622 context->rx = 0;
1624 context->window = micSeq; //Move window
1634 context->accum += (u64)(val) * be32_to_cpu(context->coeff[coeff_position++]);
1637 static void emmh32_setseed(emmh32_context *context, u8 *pkey, int keylen,
1641 /* run through AES counter mode to generate context->coeff[] */
1650 memset(context->coeff, 0, sizeof(context->coeff));
1651 sg_init_one(&sg, context->coeff, sizeof(context->coeff));
1655 skcipher_request_set_crypt(req, &sg, &sg, sizeof(context->coeff), iv);
1662 static void emmh32_init(emmh32_context *context)
1665 context->accum = 0;
1666 context->position = 0;
1670 static void emmh32_update(emmh32_context *context, u8 *pOctets, int len)
1676 coeff_position = context->position >> 2;
1679 byte_position = context->position & 3;
1684 context->part.d8[byte_position++] = *pOctets++;
1685 context->position++;
1688 MIC_ACCUM(ntohl(context->part.d32));
1694 context->position += 4;
1702 context->part.d8[byte_position++] = *pOctets++;
1703 context->position++;
1712 static void emmh32_final(emmh32_context *context, u8 digest[4])
1720 coeff_position = context->position >> 2;
1723 byte_position = context->position & 3;
1726 val = ntohl(context->part.d32);
1731 sum = context->accum;