-void hmac_sha256_final(hmac_sha256_ctx_t *s, void* key, uint16_t keylength_b){
- uint8_t buffer[SHA256_HASH_BYTES];
- uint8_t i;
- sha256_ctx_t a;
-
- memset(buffer, 0, SHA256_HASH_BYTES);
- if (keylength_b > SHA256_BLOCK_BITS){
- sha256((void*)buffer, key, keylength_b);
- } else {
- memcpy(buffer, key, (keylength_b+7)/8);
- }
-
- for (i=0; i<SHA256_HASH_BYTES; ++i){
- buffer[i] ^= OPAD;
+void hmac_sha256_nextBlock(hmac_sha256_ctx_t *s, const void* block){
+ sha256_nextBlock(&(s->a), block);
+}
+
+void hmac_sha256_lastBlock(hmac_sha256_ctx_t *s, const void* block, uint16_t length_b){
+/* while(length_b>=SHA256_BLOCK_BITS){
+ sha256_nextBlock(&(s->a), block);
+ block = (uint8_t*)block + SHA256_BLOCK_BYTES;
+ length_b -= SHA256_BLOCK_BITS;