Added sha256 hash function and hmac functions (with and without salt) to the kernel

and userspace.

In userspace, this is accessed through #include <secure.h>
In the kernel, this is access through #include <kern/secure.h>

There is a unit test for this (hm1) that computes the hmac and compares it to
the known value.  The salted vesion tested offline.

-----

Also, fixed usespace compile issue with not changing KERNEL_SECRET => SECRET.
This commit is contained in:
Scott Haseley
2016-02-01 01:35:53 -05:00
parent dc49fc79a4
commit a97b1c80b2
13 changed files with 3449 additions and 4 deletions

View File

@@ -309,6 +309,14 @@ file ../common/libc/string/strlen.c
file ../common/libc/string/strrchr.c
file ../common/libc/string/strtok_r.c
#
# Security functions that we've added to the C library and
# use for secure output.
#
file ../common/libc/secure/secure.c
file ../common/libc/secure/sha256.c
########################################
# #
# Core kernel source files #
@@ -435,6 +443,7 @@ file test/threadtest.c
file test/tt3.c
file test/synchtest.c
file test/semunit.c
file test/hmacunit.c
file test/kmalloctest.c
file test/fstest.c
file test/lib.c