I am trying to implement some encryption in the kernel space. I need to use crypto api, which requires the use of scatterlist. I need to simple encrypt a string of characters and the store the encrypted string. I think I have most of my code right, but I seem to have a problem when extracting the string back from the scatterlist. Lets say I do the following:
I am expecting my code to print "abc" but it doesn't. It prints some junk. How can I get a pointer to my string back once I put it into the scatterlist?Code:char p = "abc"; char *t; dst.page = virt_to_page(p); dst.offset = offset_in_page(p); dst.length = 3; t = kmap (dst.page + dst.offset); *(t+3) = '\0'; printk("%s\n",t);
Thank you for any suggestions you might have.