From dd545573337e3c54ad4c2c64d72f750ad03aa2c9 Mon Sep 17 00:00:00 2001 From: Michael Krelin Date: Wed, 13 Feb 2013 22:32:22 +0000 Subject: introduced streaming integrity digest updater Signed-off-by: Michael Krelin --- diff --git a/src/eyetil.cc b/src/eyetil.cc index cd22eea..6ccc4ae 100644 --- a/src/eyetil.cc +++ b/src/eyetil.cc @@ -89,6 +89,34 @@ uint16_t block512_t::tcpcksum(block512_t& data) { return 0xffff&~sum; } +void integrity_digester::update(const void *d_,size_t s) { + uint8_t *d=(uint8_t*)d_; + if(data_size) { + int l = sizeof(data)-data_size; + if(l>s) { + memmove(data.dptr(data_size),d,s); data_size+=s; return; + } + memmove(data.dptr(data_size),d,l); d+=l; s-=l; + md5.update( data.tcpcksum(data) ); + } + if(s(),block512_t::tcpcksum); + size_t ss=bb*sizeof(block512_t); + d+=ss; s-=ss; + assert(s