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

Side by Side Diff: src/platform/vboot_reference/include/rsa_utility.h

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/include/rsa.h ('k') | src/platform/vboot_reference/include/sha.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 * found in the LICENSE file.
4 *
5 * Some utility functions for use with RSA signature verification.
6 */
7
8 #ifndef VBOOT_REFERENCE_RSA_UTILITY_H_
9 #define VBOOT_REFERENCE_RSA_UTILITY_H_
10
11 #include "rsa.h"
12
13 /* Returns the size of a pre-processed RSA public key in bytes with algorithm
14 * [algorithm]. */
15 int RSAProcessedKeySize(int algorithm);
16
17 /* Allocate a new RSAPublicKey structure and initialize its pointer fields to
18 * NULL */
19 RSAPublicKey* RSAPublicKeyNew(void);
20
21 /* Deep free the contents of [key]. */
22 void RSAPublicKeyFree(RSAPublicKey* key);
23
24 /* Create a RSAPublic key structure from binary blob [buf] of length
25 * [len].
26 *
27 * Caller owns the returned key and must free it.
28 */
29 RSAPublicKey* RSAPublicKeyFromBuf(const uint8_t* buf, int len);
30
31 /* Perform RSA signature verification on [buf] of length [len] against expected
32 * signature [sig] using signature algorithm [algorithm]. The public key used
33 * for verification can either be in the form of a pre-process key blob
34 * [key_blob] or RSAPublicKey structure [key]. One of [key_blob] or [key] must
35 * be non-NULL, and the other NULL or the function will fail.
36 *
37 * Returns 1 on verification success, 0 on verification failure or invalid
38 * arguments.
39 *
40 * Note: This function is for use in the firmware and assumes all pointers point
41 * to areas in the memory of the right size.
42 *
43 */
44 int RSAVerifyBinary_f(const uint8_t* key_blob,
45 const RSAPublicKey* key,
46 const uint8_t* buf,
47 uint64_t len,
48 const uint8_t* sig,
49 int algorithm);
50
51 /* Version of RSAVerifyBinary_f() where instead of the raw binary blob
52 * of data, its digest is passed as the argument. */
53 int RSAVerifyBinaryWithDigest_f(const uint8_t* key_blob,
54 const RSAPublicKey* key,
55 const uint8_t* digest,
56 const uint8_t* sig,
57 int algorithm);
58 #endif /* VBOOT_REFERENCE_RSA_UTILITY_H_ */
OLDNEW
« no previous file with comments | « src/platform/vboot_reference/include/rsa.h ('k') | src/platform/vboot_reference/include/sha.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698