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

Unified Diff: src/platform/vboot_reference/crypto/padding.c

Issue 552227: Utility to output digests in format suitable for RSA signatures. (Closed)
Patch Set: Nit fixes. Created 10 years, 11 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
« no previous file with comments | « src/platform/vboot_reference/crypto/genpadding.sh ('k') | src/platform/vboot_reference/include/padding.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform/vboot_reference/crypto/padding.c
diff --git a/src/platform/vboot_reference/crypto/padding.c b/src/platform/vboot_reference/crypto/padding.c
index 4874bff9f40ab593dc294de4e1343e29d2801f59..2b2e98cbe8a3bdf9ef3976078cb1209063f3a307 100644
--- a/src/platform/vboot_reference/crypto/padding.c
+++ b/src/platform/vboot_reference/crypto/padding.c
@@ -95,6 +95,36 @@ const uint8_t paddingRSA8192_SHA512[RSA8192NUMBYTES - SHA512_DIGEST_SIZE] = {
const int kNumAlgorithms = 12;
#define NUMALGORITHMS 12
+#define SHA1_DIGESTINFO_LEN 15
+#define SHA256_DIGESTINFO_LEN 19
+#define SHA512_DIGESTINFO_LEN 19
+const uint8_t SHA1_digestinfo[] = {
+0x30,0x21,0x30,0x09,0x06,0x05,0x2b,0x0e,0x03,0x02,0x1a,0x05,0x00,0x04,0x14
+};
+
+const uint8_t SHA256_digestinfo[] = {
+0x30,0x31,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x01,0x05,0x00,0x04,0x20
+};
+
+const uint8_t SHA512_digestinfo[] = {
+0x30,0x51,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x03,0x05,0x00,0x04,0x40
+};
+
+const int digestinfo_size_map[] = {
+SHA1_DIGESTINFO_LEN,
+SHA256_DIGESTINFO_LEN,
+SHA512_DIGESTINFO_LEN,
+SHA1_DIGESTINFO_LEN,
+SHA256_DIGESTINFO_LEN,
+SHA512_DIGESTINFO_LEN,
+SHA1_DIGESTINFO_LEN,
+SHA256_DIGESTINFO_LEN,
+SHA512_DIGESTINFO_LEN,
+SHA1_DIGESTINFO_LEN,
+SHA256_DIGESTINFO_LEN,
+SHA512_DIGESTINFO_LEN,
+};
+
const int siglen_map[NUMALGORITHMS] = {
RSA1024NUMWORDS,
RSA1024NUMWORDS,
@@ -140,6 +170,21 @@ RSA8192NUMBYTES - SHA256_DIGEST_SIZE,
RSA8192NUMBYTES - SHA512_DIGEST_SIZE,
};
+const int hash_size_map[NUMALGORITHMS] = {
+SHA1_DIGEST_SIZE,
+SHA256_DIGEST_SIZE,
+SHA512_DIGEST_SIZE,
+SHA1_DIGEST_SIZE,
+SHA256_DIGEST_SIZE,
+SHA512_DIGEST_SIZE,
+SHA1_DIGEST_SIZE,
+SHA256_DIGEST_SIZE,
+SHA512_DIGEST_SIZE,
+SHA1_DIGEST_SIZE,
+SHA256_DIGEST_SIZE,
+SHA512_DIGEST_SIZE,
+};
+
const int hash_blocksize_map[NUMALGORITHMS] = {
SHA1_BLOCK_SIZE,
SHA256_BLOCK_SIZE,
@@ -155,6 +200,21 @@ SHA256_BLOCK_SIZE,
SHA512_BLOCK_SIZE,
};
+const uint8_t* hash_digestinfo_map[NUMALGORITHMS] = {
+SHA1_digestinfo,
+SHA256_digestinfo,
+SHA512_digestinfo,
+SHA1_digestinfo,
+SHA256_digestinfo,
+SHA512_digestinfo,
+SHA1_digestinfo,
+SHA256_digestinfo,
+SHA512_digestinfo,
+SHA1_digestinfo,
+SHA256_digestinfo,
+SHA512_digestinfo,
+};
+
const char* algo_strings[NUMALGORITHMS] = {
"RSA1024 SHA1",
"RSA1024 SHA256",
« no previous file with comments | « src/platform/vboot_reference/crypto/genpadding.sh ('k') | src/platform/vboot_reference/include/padding.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698