]> Git Repo - J-u-boot.git/blobdiff - include/u-boot/rsa-mod-exp.h
image: Use Kconfig to enable FIT_RSASSA_PSS on host
[J-u-boot.git] / include / u-boot / rsa-mod-exp.h
index fce445a082a2f9ea28353d080243d2d6bf070c3b..fc9557c7819c2cf1d536620e9f5be05ec753a7b8 100644 (file)
@@ -1,8 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
 /*
- * Copyright (c) 2014, Ruchika Gupta.
- *
- * SPDX-License-Identifier:    GPL-2.0+
-*/
+ * Copyright 2014 Freescale Semiconductor, Inc.
+ */
 
 #ifndef _RSA_MOD_EXP_H
 #define _RSA_MOD_EXP_H
@@ -10,6 +9,8 @@
 #include <errno.h>
 #include <image.h>
 
+struct udevice;
+
 /**
  * struct key_prop - holder for a public key properties
  *
@@ -27,6 +28,29 @@ struct key_prop {
        uint32_t exp_len;       /* Exponent length in number of uint8_t */
 };
 
+/**
+ * rsa_gen_key_prop() - Generate key properties of RSA public key
+ * @key:       Specifies key data in DER format
+ * @keylen:    Length of @key
+ * @prop:      Generated key property
+ *
+ * This function takes a blob of encoded RSA public key data in DER
+ * format, parse it and generate all the relevant properties
+ * in key_prop structure.
+ * Return a pointer to struct key_prop in @prop on success.
+ *
+ * Return:     0 on success, negative on error
+ */
+int rsa_gen_key_prop(const void *key, uint32_t keylen, struct key_prop **proc);
+
+/**
+ * rsa_free_key_prop() - Free key properties
+ * @prop:      Pointer to struct key_prop
+ *
+ * This function frees all the memories allocated by rsa_gen_key_prop().
+ */
+void rsa_free_key_prop(struct key_prop *prop);
+
 /**
  * rsa_mod_exp_sw() - Perform RSA Modular Exponentiation in sw
  *
@@ -43,6 +67,10 @@ int rsa_mod_exp_sw(const uint8_t *sig, uint32_t sig_len,
 int rsa_mod_exp(struct udevice *dev, const uint8_t *sig, uint32_t sig_len,
                struct key_prop *node, uint8_t *out);
 
+#if defined(CONFIG_CMD_ZYNQ_RSA)
+int zynq_pow_mod(uint32_t *keyptr, uint32_t *inout);
+#endif
+
 /**
  * struct struct mod_exp_ops - Driver model for RSA Modular Exponentiation
  *                             operations
This page took 0.027932 seconds and 4 git commands to generate.