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

Side by Side Diff: src/platform/vboot_reference/utils/signature_digest.c

Issue 1593002: Revert "VBoot Reference: Refactor Part 2 - Crypto Libraries" (Closed)
Patch Set: Created 10 years, 8 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 unified diff | Download patch
OLDNEW
1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be 2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file. 3 * found in the LICENSE file.
4 */ 4 */
5 5
6 #include "signature_digest.h" 6 #include "signature_digest.h"
7 #define OPENSSL_NO_SHA 7 #define OPENSSL_NO_SHA
8 #include <openssl/engine.h> 8 #include <openssl/engine.h>
9 #include <openssl/pem.h> 9 #include <openssl/pem.h>
10 #include <openssl/rsa.h> 10 #include <openssl/rsa.h>
11 11
12 #include <stdio.h> 12 #include <stdio.h>
13 #include <stdlib.h> 13 #include <stdlib.h>
14 #include <unistd.h> 14 #include <unistd.h>
15 15
16 #include "cryptolib.h" 16 #include "padding.h"
17 #include "sha.h"
18 #include "sha_utility.h"
17 #include "utility.h" 19 #include "utility.h"
18 20
19 uint8_t* PrependDigestInfo(int algorithm, uint8_t* digest) { 21 uint8_t* PrependDigestInfo(int algorithm, uint8_t* digest) {
20 const int digest_size = hash_size_map[algorithm]; 22 const int digest_size = hash_size_map[algorithm];
21 const int digestinfo_size = digestinfo_size_map[algorithm]; 23 const int digestinfo_size = digestinfo_size_map[algorithm];
22 const uint8_t* digestinfo = hash_digestinfo_map[algorithm]; 24 const uint8_t* digestinfo = hash_digestinfo_map[algorithm];
23 uint8_t* p = Malloc(digestinfo_size + digest_size); 25 uint8_t* p = Malloc(digestinfo_size + digest_size);
24 Memcpy(p, digestinfo, digestinfo_size); 26 Memcpy(p, digestinfo, digestinfo_size);
25 Memcpy(p + digestinfo_size, digest, digest_size); 27 Memcpy(p + digestinfo_size, digest, digest_size);
26 return p; 28 return p;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 key, /* Key to use. */ 67 key, /* Key to use. */
66 RSA_PKCS1_PADDING)) /* Padding to use. */ 68 RSA_PKCS1_PADDING)) /* Padding to use. */
67 fprintf(stderr, "SignatureBuf(): RSA_private_encrypt() failed.\n"); 69 fprintf(stderr, "SignatureBuf(): RSA_private_encrypt() failed.\n");
68 } 70 }
69 fclose(key_fp); 71 fclose(key_fp);
70 if (key) 72 if (key)
71 RSA_free(key); 73 RSA_free(key);
72 Free(signature_digest); 74 Free(signature_digest);
73 return signature; 75 return signature;
74 } 76 }
OLDNEW
« no previous file with comments | « src/platform/vboot_reference/utils/kernel_utility.cc ('k') | src/platform/vboot_reference/utils/verify_data.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698