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

Side by Side Diff: src/platform/vboot_reference/crypto/rsa_utility.c

Issue 1574005: 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
« no previous file with comments | « src/platform/vboot_reference/crypto/rsa.c ('k') | src/platform/vboot_reference/crypto/sha1.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 * Utility functions for message digest functions. 5 * Implementation of RSA utility functions.
6 */ 6 */
7 7
8 #include "padding.h" 8 #include "cryptolib.h"
9 #include "rsa_utility.h"
10 #include "sha_utility.h"
11 #include "utility.h" 9 #include "utility.h"
12 10
13 int RSAProcessedKeySize(int algorithm) { 11 int RSAProcessedKeySize(int algorithm) {
14 int key_len = siglen_map[algorithm]; /* Key length in 12 int key_len = siglen_map[algorithm]; /* Key length in
15 * bytes. */ 13 * bytes. */
16 /* Total size needed by a RSAPublicKey structure is = 14 /* Total size needed by a RSAPublicKey structure is =
17 * 2 * key_len bytes for the n and rr arrays 15 * 2 * key_len bytes for the n and rr arrays
18 * + sizeof len + sizeof n0inv. 16 * + sizeof len + sizeof n0inv.
19 */ 17 */
20 return (2 * key_len + sizeof(int) + sizeof(uint32_t)); 18 return (2 * key_len + sizeof(int) + sizeof(uint32_t));
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 verification_key = (RSAPublicKey*) key; /* Supress const warning. */ 124 verification_key = (RSAPublicKey*) key; /* Supress const warning. */
127 else 125 else
128 return 0; /* Both can't be NULL or non-NULL. */ 126 return 0; /* Both can't be NULL or non-NULL. */
129 127
130 success = RSAVerify(verification_key, sig, sig_size, algorithm, digest); 128 success = RSAVerify(verification_key, sig, sig_size, algorithm, digest);
131 129
132 if (!key) 130 if (!key)
133 RSAPublicKeyFree(verification_key); /* Only free if we allocated it. */ 131 RSAPublicKeyFree(verification_key); /* Only free if we allocated it. */
134 return success; 132 return success;
135 } 133 }
OLDNEW
« no previous file with comments | « src/platform/vboot_reference/crypto/rsa.c ('k') | src/platform/vboot_reference/crypto/sha1.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698