summaryrefslogtreecommitdiff
path: root/firmware/2lib/2sha256.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/2lib/2sha256.c')
-rw-r--r--firmware/2lib/2sha256.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/firmware/2lib/2sha256.c b/firmware/2lib/2sha256.c
index fd41258c..d2cf6726 100644
--- a/firmware/2lib/2sha256.c
+++ b/firmware/2lib/2sha256.c
@@ -314,3 +314,21 @@ void vb2_sha256_finalize(struct vb2_sha256_context *ctx, uint8_t *digest)
UNPACK32(ctx->h[7], &digest[28]);
#endif /* !UNROLL_LOOPS */
}
+
+void vb2_sha256_extend(const uint8_t *from, const uint8_t *by, uint8_t *to)
+{
+ struct vb2_sha256_context dc;
+ int i;
+
+ for (i = 0; i < 8; i++) {
+ PACK32(from, &dc.h[i]);
+ from += 4;
+ }
+
+ vb2_sha256_transform(&dc, by, 1);
+
+ for (i = 0; i < 8; i++) {
+ UNPACK32(dc.h[i], to);
+ to += 4;
+ }
+}