-void sha1_lastBlock(sha1_ctx_t *state, const void* block, uint16_t length){
- uint8_t lb[SHA1_BLOCK_BITS/8]; /* local block */
+void sha1_lastBlock(sha1_ctx_t *state, const void *block, uint16_t length){
+ uint8_t lb[SHA1_BLOCK_BYTES]; /* local block */
+ while(length>=SHA1_BLOCK_BITS){
+ sha1_nextBlock(state, block);
+ length -= SHA1_BLOCK_BITS;
+ block = (uint8_t*)block + SHA1_BLOCK_BYTES;
+ }