summaryrefslogtreecommitdiff
path: root/include/rsa.h
diff options
context:
space:
mode:
authorTom Rini <trini@ti.com>2014-04-17 14:33:25 -0400
committerTom Rini <trini@ti.com>2014-04-17 14:33:25 -0400
commit0f507779ca00d90cdd4bcc8252630370339b7ea6 (patch)
treea91a89ac67dcbd42c8a4357501d155a129fa1e5a /include/rsa.h
parent0f605c1501f6e82553e9affc6e17876a85db408c (diff)
parentece0d370144fdecb6f3ed5738ffe96f5b12f9e96 (diff)
downloadu-boot-imx-0f507779ca00d90cdd4bcc8252630370339b7ea6.zip
u-boot-imx-0f507779ca00d90cdd4bcc8252630370339b7ea6.tar.gz
u-boot-imx-0f507779ca00d90cdd4bcc8252630370339b7ea6.tar.bz2
Merge branch 'next'
Diffstat (limited to 'include/rsa.h')
-rw-r--r--include/rsa.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/rsa.h b/include/rsa.h
index add4c78..a5680ab 100644
--- a/include/rsa.h
+++ b/include/rsa.h
@@ -15,6 +15,20 @@
#include <errno.h>
#include <image.h>
+/**
+ * struct rsa_public_key - holder for a public key
+ *
+ * An RSA public key consists of a modulus (typically called N), the inverse
+ * and R^2, where R is 2^(# key bits).
+ */
+
+struct rsa_public_key {
+ uint len; /* len of modulus[] in number of uint32_t */
+ uint32_t n0inv; /* -1 / modulus[0] mod 2^32 */
+ uint32_t *modulus; /* modulus as little endian array */
+ uint32_t *rr; /* R^2 as little endian array */
+};
+
#if IMAGE_ENABLE_SIGN
/**
* sign() - calculate and return signature for given input data
@@ -89,4 +103,14 @@ static inline int rsa_verify(struct image_sign_info *info,
}
#endif
+#define RSA2048_BYTES (2048 / 8)
+#define RSA4096_BYTES (4096 / 8)
+
+/* This is the minimum/maximum key size we support, in bits */
+#define RSA_MIN_KEY_BITS 2048
+#define RSA_MAX_KEY_BITS 4096
+
+/* This is the maximum signature length that we support, in bits */
+#define RSA_MAX_SIG_BITS 4096
+
#endif