diff --git a/drivers/crypto/chelsio/chcr_algo.c b/drivers/crypto/chelsio/chcr_algo.c index bd3ee2a..1102301 100644 --- a/drivers/crypto/chelsio/chcr_algo.c +++ b/drivers/crypto/chelsio/chcr_algo.c @@ -225,12 +225,32 @@ static inline int chcr_handle_aead_resp(struct aead_request *req, struct chcr_aead_reqctx *reqctx = aead_request_ctx(req); struct crypto_aead *tfm = crypto_aead_reqtfm(req); struct chcr_dev *dev = a_ctx(tfm)->dev; + u8 tmp[64]; + int skip, lenp, authsize; chcr_aead_common_exit(req); if (reqctx->verify == VERIFY_SW) { chcr_verify_tag(req, input, &err); reqctx->verify = VERIFY_HW; } + if (err == -EBADMSG) { + authsize = crypto_aead_authsize(tfm); + skip = req->assoclen + req->cryptlen - authsize - 16; + lenp = authsize + 16; + printk("authsize %d cryptlen %d\n", authsize, req->cryptlen); + sg_pcopy_to_buffer(req->dst, sg_nents(req->dst), + tmp, lenp, skip); + // sg_pcopy_to_buffer(req->dst, sg_nents(req->dst), + // tmp, req->assoclen + 16, 972); + + print_hex_dump(KERN_CONT, "dt", DUMP_PREFIX_OFFSET, 16, 1,tmp, lenp, false); + sg_pcopy_to_buffer(req->dst, sg_nents(req->dst), + tmp, req->assoclen, 0); + print_hex_dump(KERN_CONT, "ass", DUMP_PREFIX_OFFSET, 16, 1,tmp, req->assoclen, false); + // print_hex_dump(KERN_CONT, "assbef", DUMP_PREFIX_OFFSET, 16, 1,reqctx->tmp, req->assoclen, false); + + + } chcr_dec_wrcount(dev); req->base.complete(&req->base, err); @@ -3023,6 +3043,14 @@ static struct sk_buff *create_gcm_wr(struct aead_request *req, error = chcr_aead_common_init(req); if (error) return ERR_PTR(error); + if (req->assoclen == 20) { + sg_pcopy_to_buffer(req->src, sg_nents(req->src), reqctx->tmp, 20, 0); +#if 1 + if (reqctx->tmp[7]) { + printk("assoclen 8th byte %d clen %d op %d\n", reqctx->tmp[7], req->cryptlen, reqctx->op); + } +#endif + } dnents = sg_nents_xlen(req->dst, req->assoclen + req->cryptlen + (reqctx->op ? -authsize : authsize), CHCR_DST_SG_SIZE, 0); diff --git a/drivers/crypto/chelsio/chcr_crypto.h b/drivers/crypto/chelsio/chcr_crypto.h index e231e8b..7940fcf 100644 --- a/drivers/crypto/chelsio/chcr_crypto.h +++ b/drivers/crypto/chelsio/chcr_crypto.h @@ -189,6 +189,7 @@ struct chcr_aead_reqctx { u16 imm; u16 verify; u8 iv[CHCR_MAX_CRYPTO_IV_LEN + MAX_SCRATCH_PAD_SIZE]; + u8 tmp[24]; u8 *scratch_pad; }; diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_pci_id_tbl.h b/drivers/net/ethernet/chelsio/cxgb4/t4_pci_id_tbl.h index 60df66f..8689109 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_pci_id_tbl.h +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_pci_id_tbl.h @@ -205,6 +205,7 @@ CH_PCI_ID_TABLE_FENTRY(0x6009), CH_PCI_ID_TABLE_FENTRY(0x600d), CH_PCI_ID_TABLE_FENTRY(0x6011), + CH_PCI_ID_TABLE_FENTRY(0x6010), CH_PCI_ID_TABLE_FENTRY(0x6014), CH_PCI_ID_TABLE_FENTRY(0x6015), CH_PCI_ID_TABLE_FENTRY(0x6080), diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c index 9768901..6fffac6 100644 --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c @@ -761,7 +761,15 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb) aead_request_set_crypt(req, sg, sg, elen + ivlen, iv); aead_request_set_ad(req, assoclen); +#if 0 +{ + u8 tmp[24]; +sg_pcopy_to_buffer(sg, sg_nents(sg), + tmp, assoclen, 0); +print_hex_dump(KERN_CONT, "espass", DUMP_PREFIX_OFFSET, 16, 1,tmp, assoclen, false); +} +#endif err = crypto_aead_decrypt(req); if (err == -EINPROGRESS) goto out; diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c index be3520e..70d0e5a 100644 --- a/net/xfrm/xfrm_input.c +++ b/net/xfrm/xfrm_input.c @@ -384,7 +384,8 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type) XFRM_SKB_CB(skb)->seq.input.low = seq; XFRM_SKB_CB(skb)->seq.input.hi = seq_hi; - +if (seq_hi) + trace_printk("hi %x lo %x\n", seq_hi, seq); skb_dst_force(skb); dev_hold(skb->dev); diff --git a/net/xfrm/xfrm_replay.c b/net/xfrm/xfrm_replay.c index 9e3a5e85..059bbfb 100644 --- a/net/xfrm/xfrm_replay.c +++ b/net/xfrm/xfrm_replay.c @@ -35,8 +35,10 @@ u32 xfrm_replay_seqhi(struct xfrm_state *x, __be32 net_seq) if (likely(replay_esn->seq >= replay_esn->replay_window - 1)) { /* A. same subspace */ - if (unlikely(seq < bottom)) + if (unlikely(seq < bottom)) { seq_hi++; + trace_printk("seq_hi 0x %x seq 0x %x bottom 0x %x replay seq 0x %x replay window 0x %x\n", seq_hi, seq, bottom, replay_esn->seq, replay_esn->replay_window); + } } else { /* B. window spans two subspaces */ if (unlikely(seq >= bottom))