Re: [PATCH] crypto: digest: Fix digesting over memory chunks > 4096 bytes

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

 



Am Donnerstag, den 06.07.2017, 20:01 +0200 schrieb Uwe Kleine-König:
> There are two different cases that are handled in digest_file_window:
> 
>  a) the file to digest is memmappable (e.g. /dev/mem)
>  b) it isn't (e.g. files in /)
> 
> In both cases a file is digested in hunks of (up to) 4096 bytes. After
> each hunk in b) the buffer that is fed to digest_update() is then
> overwritten using read() to get the next hunk to digest. In case a)
> however it was forgotten to step forward in the buffer and instead the
> same data was handed to digest_update() again and again.
> 
> So to fix that increase buffer by the number of bytes already digested
> for case a) which is characterized by flags == 0.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
> ---
> Hello,
> 
> this is the obvious and minimal patch to fix this issue. Maybe it is
> worth to simplify the function by splitting it in two where each one
> handles one of the cases above.

Yes, making this less confusing to the casual reader of the code seems
like a good idea. I've applied this minimal fix for master.

Regards,
Lucas


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux