Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(781)

Unified Diff: src/platform/vboot_reference/include/rsa_utility.h

Issue 650105: Vboot Reference: Add the "real" reference firmware verification function (VerifyFirmware). (Closed)
Patch Set: Review fixes. Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/platform/vboot_reference/include/rsa_utility.h
diff --git a/src/platform/vboot_reference/include/rsa_utility.h b/src/platform/vboot_reference/include/rsa_utility.h
index 808d17a825b8dce3cf8c0ac0061c0124012d779f..71492ae659a2104db91cfb2b734e07ef51ef5edb 100644
--- a/src/platform/vboot_reference/include/rsa_utility.h
+++ b/src/platform/vboot_reference/include/rsa_utility.h
@@ -14,8 +14,34 @@
* [algorithm]. */
int RSAProcessedKeySize(int algorithm);
+/* Deep free the contents of [key]. */
+void RSAPublicKeyFree(RSAPublicKey* key);
+
/* Create a RSAPublic key structure from binary blob [buf] of length
- * [len]. */
-RSAPublicKey* RSAPublicKeyFromBuf(uint8_t* buf, int len);
+ * [len].
+ *
+ * Caller owns the returned key and must free it.
+ */
+RSAPublicKey* RSAPublicKeyFromBuf(const uint8_t* buf, int len);
+
+/* Perform RSA signature verification on [buf] of length [len] against expected
+ * signature [sig] using signature algorithm [algorithm]. The public key used
+ * for verification can either be in the form of a pre-process key blob
+ * [key_blob] or RSAPublicKey structure [key]. One of [key_blob] or [key] must
+ * be non-NULL, and the other NULL or the function will fail.
+ *
+ * Returns 1 on verification success, 0 on verification failure or invalid
+ * arguments.
+ *
+ * Note: This function is for use in the firmware and assumes all pointers point
+ * to areas in the memory of the right size.
+ *
+ */
+int RSAVerifyBinary_f(const uint8_t* key_blob,
+ const RSAPublicKey* key,
+ const uint8_t* buf,
+ int len,
+ const uint8_t* sig,
+ int algorithm);
#endif /* VBOOT_REFERENCE_RSA_UTILITY_H_ */
« no previous file with comments | « src/platform/vboot_reference/include/firmware_image.h ('k') | src/platform/vboot_reference/include/sha_utility.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698