+ uint8_t *block_in;
+
+ /*
+ * Choose a number of block that fill input context buffer.
+ */
+ size_t missing_len = MIN(block_len, CONFIG_MD2_BLOCK_LEN - context->counter);
+
+ block_in = (uint8_t *)_block_in;
+
+ while(block_len > 0)
+ {
+ /*
+ * Copy in the buffer input block.
+ */
+ memcpy(&context->buffer[context->counter], block_in, missing_len);
+
+ /*
+ * Update a context counter, input block length and remaning
+ * context buffer block lenght.
+ */
+ context->counter += missing_len;
+ block_len -= missing_len;
+ block_in += missing_len;
+
+ /*
+ * If buffer is full, compute it.
+ */
+ if (context->counter >= CONFIG_MD2_BLOCK_LEN)
+ {
+ md2_compute(context->state, context->checksum, context->buffer);
+ context->counter = 0;
+ }
+ }