Re: [PATCH 14/17] btrfs: directly call into crypto framework for checsumming

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

 



On Fri, May 10, 2019 at 01:45:47PM +0000, Chris Mason wrote:
> I'm a little concerned about about btrfs_csum_data() and 
> btrfs_csum_final() below.  We're using two different 
> SHASH_DESC_ON_STACK() and then overwriting internals (shash_desc_ctx()) 
> with the assumption that whatever we're doing is going to be the same as 
> using the same shash_desc struct for both the update and final calls.  I 
> think we should be either using or adding a helper to the crypto api for 
> this.  We're digging too deep into cryptoapi private structs with the 
> current usage.
 
I think I found the solution. Instead of doing memset() + memcpy() +
crypto_shash_update() + crypto_shash_final(), I could call
crypto_shash_digest() which would wrap all of them for me in both the crc32c
and sha256 case.

Let me have a look and throw it in some testing.

> Otherwise, thanks for doing this, it looks great overall.

Thanks :)
-- 
Johannes Thumshirn                            SUSE Labs Filesystems
jthumshirn@xxxxxxx                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850



[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux