Hi,

I am trying add and test kernel authenc to cryptodev. When executing the
test with cao.src = cao.dst, the cipher is generated successfully but
kernel crash when generating the icv.

The problem is that in authen.c
                        if (caop->op == COP_ENCRYPT) dst_len = caop->len +
cryptodev_cipher_get_tag_size(&ses_ptr->cdata);
                        else dst_len = caop->len;


                        ret = get_userbuf(ses_ptr, caop->src, caop->len,
caop->dst, dst_len,
                                          kcaop->task, kcaop->mm, &src_sg,
&dst_sg);

But in get_userbuf()
        if (src == dst) {       /* inplace operation */
                rc = __get_userbuf(src, src_len, 1, ses->used_pages,
                                       ses->pages, ses->sg, task, mm);
                if (unlikely(rc)) {
                        dprintk(1, KERN_ERR,
                                "failed to get user pages for data IO\n");
                        return rc;
                }
                (*src_sg) = (*dst_sg) = ses->sg;
                return 0;
        }

The ICV failed because the scatterlist dst_sg is created with shorter
length than required (should be caop->len +
cryptodev_cipher_get_tag_size(&ses_ptr->cdata)).

A possible fix is to change
rc = __get_userbuf(src, src_len, 1, ses->used_pages,
                                       ses->pages, ses->sg, task, mm);
to
rc = __get_userbuf(dst, dst_len, 1, ses->used_pages,
                                       ses->pages, ses->sg, task, mm);

Please correct me if I am wrong.

Thanks and Best Regards,
Dien

-- 
Nguyen Tien Hoang Dien

Embedded Software Engineer 2

Applied Micro Circuits Corporation (AMCC) Vietnam

(+84) 091-624-9609

nguyentienhoangd...@gmail.com
skype: dthnguyen
_______________________________________________
Cryptodev-linux-devel mailing list
Cryptodev-linux-devel@gna.org
https://mail.gna.org/listinfo/cryptodev-linux-devel

Reply via email to