[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
little endian value returned from kernel thru a system call
Hi everyone,
I am trying to implement the md5 check summing of a
message digest as a system call. I have everything
working except a little issue where the checksum
returned is in the little endian format.
I passed the string "abc" to be check summed by the
algorithm. The correct checksum for the string 'abc'
is:
"900150983cd24fb0d6963f7d28e17f72"
but the value that the system call returns is:
"ffffff900150ffffff983cffffffd24fffffffb0ffffffd6ffffff963f7d28ffffffe17f72"
which essentially contains the checksum embedded
inside. I looked through the source of 2.4.22 and 2.6
[test kernels] and saw that their implementation had a
le32_to_cpu_array and a vice versa function. I am not
sure what they do and how i should use them in my
program if i need to.
A little info about my program:
---------
char *message = "abc";
char checksum[16];
i =
md5checksum(message,(char*)checksum,strlen(message));
---------
The system call is a syscall3 type and it stores the
computed checksum in the variable checksum passed to
it.
Inside the system call:
---------
unsigned char md5sum[16];
....
....
md5_finish( &ctx, md5sum );
copy_to_user(checksum, md5sum,sizeof(md5sum));
---------
Any help to solve the problem would be of gr8 help to
me. I am trying to achieve this on a 2.4.21 kernel.
TIA
Karthik
__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/