summaryrefslogtreecommitdiff
path: root/include/rsa.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/rsa.h')
-rw-r--r--include/rsa.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/rsa.h b/include/rsa.h
new file mode 100644
index 0000000000..95e17450c6
--- /dev/null
+++ b/include/rsa.h
@@ -0,0 +1,26 @@
+/* Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef _INCLUDE_RSA_H
+#define _INCLUDE_RSA_H
+
+#include "common.h"
+
+#define RSANUMBYTES 256 /* 2048 bit key length */
+#define RSANUMWORDS (RSANUMBYTES / sizeof(uint32_t))
+
+/* 2048-bit RSA public key definition */
+struct rsa_public_key {
+ uint32_t n[RSANUMWORDS]; /* modulus as little endian array */
+ uint32_t rr[RSANUMWORDS]; /* R^2 as little endian array */
+ uint32_t n0inv; /* -1 / n[0] mod 2^32 */
+};
+
+int rsa_verify(const struct rsa_public_key *key,
+ const uint8_t *signature,
+ const uint8_t *sha,
+ uint32_t *workbuf32);
+
+#endif /* _INCLUDE_RSA_H */