Hi, I''ve compiled /export/testws/usr/src/lib/crypt_modules/sha256/test.c and tried to use it to calculate the checksum of the uberblock. This I did as the sha256 executable that comes with solaris is not giving me the correct values for uberblock.(the output is 64chars whereas zfs output is only 49chars) Uberblock magic = 0000000000bab10c version = 16 txg = 697 guid_sum = 13079999420161054854 timestamp = 1252581875 UTC = Thu Sep 10 16:54:35 2009 so, I got that part of uberblock using ''dd'' into another file. I''m opening this file and reading the contents in test.c as follows: char *buf; fp=fopen("/root/ub_dump","rb"); fseek(fp,0,SEEK_END); len=ftell(fp); fseek(fp,0,SEEK_SET); buf=(char *)malloc(len); then, calling res = crypt_genhash_impl(mybuffer, mybufflen, buf, "$5$rounds=123456$asaltof16chars..", NULL); "zdb -uuu charlie" gives me the uberblock checksum as: cksum=112d7c6202:6268950ffa7:1243ab8101197:25779601f5266b but the result from the above modified test.c is not same as this. Can someone point out if my approach is wrong? Thanks, pak -- This message posted from opensolaris.org
P. Anil Kumar wrote:> Hi, > > I''ve compiled /export/testws/usr/src/lib/crypt_modules/sha256/test.c and tried to use it to calculate the checksum of the uberblock. This I did as the sha256 executable that comes with solaris is not giving me the correct values for uberblock.(the output is 64chars whereas zfs output is only 49chars)That won''t work it has nothing what so ever to do with ZFS. That is a plugin for the crypt(3C) function used to hash users passwords. ZFS uses normal SHA256 which you can access using the /usr/bin/digest command.> Can someone point out if my approach is wrong?Yes it is completely wrong. What problem are you actually trying to solve ? What made you think that the file you grabbed was anything to do with ZFS ? -- Darren J Moffat
Hi, Thanks for the prompt response. I tried using digest with sha256 to calculate the uberblock checksum. Now, digest gives me a 65 char''s ouput, while zdb -uuu pool-name, gives me only 49 char output. how can this be accounted? I''m trying to understand how the checksum is calculated and displayed in zdb -uuu. Please help. Regards, pak. -- This message posted from opensolaris.org