Lines Matching defs:spec
175 KSSLCipherSpec *spec;
179 spec = &ssl->spec[direction];
181 if (spec->mac_hashsz == 0) {
203 if (IS_TLS(ssl) || (spec->hmac_mech.cm_type != CRYPTO_MECH_INVALID &&
230 mac.cd_length = mac.cd_raw.iov_len = spec->mac_hashsz;
241 rv = crypto_mac(&spec->hmac_mech, &dd, &spec->hmac_key,
259 spec->MAC_HashUpdate((void *)ctx, temp, p - temp);
260 spec->MAC_HashUpdate((void *)ctx, buf, len);
261 spec->MAC_HashFinal(digest, (void *)ctx);
265 spec->MAC_HashUpdate((void *)ctx, digest, spec->mac_hashsz);
266 spec->MAC_HashFinal(digest, (void *)ctx);
1486 KSSLCipherSpec *spec = &ssl->spec[dir];
1489 spec->mac_hashsz = mac_defs[ssl->pending_malg].hashsz;
1490 spec->mac_padsz = mac_defs[ssl->pending_malg].padsz;
1492 spec->MAC_HashInit = mac_defs[ssl->pending_malg].HashInit;
1493 spec->MAC_HashUpdate = mac_defs[ssl->pending_malg].HashUpdate;
1494 spec->MAC_HashFinal = mac_defs[ssl->pending_malg].HashFinal;
1498 spec->mac_hashsz);
1500 bcopy(&(ssl->pending_keyblock[spec->mac_hashsz]),
1501 ssl->mac_secret[dir], spec->mac_hashsz);
1507 spec->MAC_HashInit((void *)ctx);
1508 spec->MAC_HashUpdate((void *)ctx, ssl->mac_secret[dir],
1509 spec->mac_hashsz);
1510 spec->MAC_HashUpdate((void *)ctx, kssl_pad_1,
1511 spec->mac_padsz);
1514 spec->MAC_HashInit((void *)ctx);
1515 spec->MAC_HashUpdate((void *)ctx, ssl->mac_secret[dir],
1516 spec->mac_hashsz);
1517 spec->MAC_HashUpdate((void *)ctx, kssl_pad_2,
1518 spec->mac_padsz);
1521 spec->cipher_type = cipher_defs[ssl->pending_calg].type;
1522 spec->cipher_mech.cm_type = cipher_defs[ssl->pending_calg].mech_type;
1523 spec->cipher_bsize = cipher_defs[ssl->pending_calg].bsize;
1524 spec->cipher_keysz = cipher_defs[ssl->pending_calg].keysz;
1526 if (spec->cipher_ctx != NULL) {
1527 crypto_cancel_ctx(spec->cipher_ctx);
1528 spec->cipher_ctx = 0;
1537 spec->hmac_mech = hmac_md5_mech;
1539 spec->hmac_mech = hmac_sha1_mech;
1542 spec->hmac_key.ck_format = CRYPTO_KEY_RAW;
1543 spec->hmac_key.ck_data = ssl->mac_secret[dir];
1544 spec->hmac_key.ck_length = spec->mac_hashsz * 8;
1548 spec->hmac_mech.cm_type = CRYPTO_MECH_INVALID;
1549 spec->hmac_mech.cm_param = (caddr_t)¶m;
1550 spec->hmac_mech.cm_param_len = sizeof (param);
1552 spec->hmac_mech.cm_type =
1556 spec->hmac_mech.cm_type =
1561 spec->hmac_key.ck_format = CRYPTO_KEY_RAW;
1562 spec->hmac_key.ck_data = ssl->mac_secret[dir];
1563 spec->hmac_key.ck_length = spec->mac_hashsz * 8;
1567 if (spec->cipher_keysz == 0) {
1572 spec->cipher_key.ck_format = CRYPTO_KEY_RAW;
1573 spec->cipher_key.ck_length = 8 * spec->cipher_keysz; /* in bits */
1577 spec->cipher_mech.cm_param =
1578 (caddr_t)&(ssl->pending_keyblock[2 * spec->mac_hashsz +
1579 2 * spec->cipher_keysz]);
1580 spec->cipher_mech.cm_param_len = spec->cipher_bsize;
1582 spec->cipher_data.cd_format = CRYPTO_DATA_RAW;
1584 spec->cipher_mech.cm_param_len =
1588 spec->cipher_key.ck_data =
1589 &(ssl->pending_keyblock[2 * spec->mac_hashsz]);
1591 ret = crypto_decrypt_init(&(spec->cipher_mech),
1592 &(spec->cipher_key), NULL, &spec->cipher_ctx, NULL);
1600 spec->cipher_mech.cm_param += spec->cipher_bsize;
1604 spec->cipher_key.ck_data =
1605 &(ssl->pending_keyblock[2 * spec->mac_hashsz +
1606 spec->cipher_keysz]);
1608 ret = crypto_encrypt_init(&(spec->cipher_mech),
1609 &(spec->cipher_key), NULL, &spec->cipher_ctx, NULL);
1706 KSSLCipherSpec *spec;
1717 spec = &ssl->spec[KSSL_WRITE];
1718 mac_sz = spec->mac_hashsz;
1737 if (spec->cipher_type == type_block) {
1738 pad_sz = spec->cipher_bsize -
1739 (rec_sz & (spec->cipher_bsize - 1));
1752 if (spec->cipher_ctx == 0)
1755 spec->cipher_data.cd_length = rec_sz;
1756 spec->cipher_data.cd_raw.iov_base = (char *)(rstart + SSL3_HDR_LEN);
1757 spec->cipher_data.cd_raw.iov_len = rec_sz;
1759 ret = crypto_encrypt_update(spec->cipher_ctx, &spec->cipher_data,
1777 KSSLCipherSpec *spec;
1796 spec = &ssl->spec[KSSL_WRITE];
1805 ssl->alert_sendbuf = mp = allocb(len + spec->mac_hashsz +
1806 spec->cipher_bsize, BPRI_HI);
2454 KSSLCipherSpec *spec = &ssl->spec[KSSL_READ];
2456 if (spec->cipher_ctx != NULL) {
2457 crypto_cancel_ctx(spec->cipher_ctx);
2458 spec->cipher_ctx = 0;
2461 spec = &ssl->spec[KSSL_WRITE];
2463 if (spec->cipher_ctx != NULL) {
2464 crypto_cancel_ctx(spec->cipher_ctx);
2465 spec->cipher_ctx = 0;