RE: RFC: Crypto API User-interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

This is regarding the hash computation over a file with AF_ALG from
user space. [without OpenSSL]

The following link has the mail from Herbert with subject : "RFC:
Crypto API User-interface"
http://lwn.net/Articles/410848/

I was trying to take help from the code snippet he has put in his mail
and I was doing the following to compute
hash over a file of 16 bytes. The file contents are "123456789012345\n".
I read the first 10 bytes first and computed hash over it. Then I read
the next 6 bytes from
the file and computed the hash and I had taken care of using the flags
MSG_MORE and MSG_OOB.

Following is what I am doing:

1. send(opfd, sbuf, len, MSG_MORE);
2. read(opfd, state, 20);
3. send(opfd, state, 20, MSG_OOB);

4. send(opfd, sbuf, len, MSG_MORE);
5. read(opfd, state, 20);
6. /*restore from a partial hash state */
7. send(opfd, state, 20, MSG_OOB);

8.  /* finalize */
9. send(opfd, sbuf, 0, 0);
10. read(opfd, buf, 20);

sbuf
in line 1 contains: "1234567890" (the " is not part of the data, the
data is plain 10 ascii bytes for 1 through 9), len is 10.
the state after line 2 contains correct hash of the above data.

sbuf in line 4 contains: "12345\n". Len is 6.

The hash I am seeing in buf after line 10 is not correct one.

Is there anything obviously wrong with the above code? I am using
2.6.39.4 kernel on rhel 6.4 (santiago)

Thanks for the help!

~Jitendra
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux