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

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

Issue 553023: RSA signature verification and SHA-1/256/512 reference implementation for verified boot. (Closed)
Patch Set: 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 unified diff | Download patch
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
6 #ifndef VBOOT_REFERENCE_RSA_H_
7 #define VBOOT_REFERENCE_RSA_H_
8
9 #include <inttypes.h>
10
11 #define RSA1024NUMBYTES 128 /* 1024 bit key length */
12 #define RSA2048NUMBYTES 256 /* 2048 bit key length */
13 #define RSA4096NUMBYTES 512 /* 4096 bit key length */
14 #define RSA8192NUMBYTES 1024 /* 8192 bit key length */
15
16 #define RSA1024NUMWORDS (RSA1024NUMBYTES / sizeof(uint32_t))
17 #define RSA2048NUMWORDS (RSA2048NUMBYTES / sizeof(uint32_t))
18 #define RSA4096NUMWORDS (RSA4096NUMBYTES / sizeof(uint32_t))
19 #define RSA8192NUMWORDS (RSA8192NUMBYTES / sizeof(uint32_t))
20
21 typedef struct RSAPublicKey {
22 int len; /* Length of n[] in number of uint32_t */
23 uint32_t n0inv; /* -1 / n[0] mod 2^32 */
24 uint32_t* n; /* modulus as little endian array */
25 uint32_t* rr; /* R^2 as little endian array */
26 } RSAPublicKey;
27
28 /* Verify a RSA PKCS1.5 signature [sig] of [sig_type] and length [sig_len]
29 * against an expected [hash] using [key]. Returns 0 on failure, 1 on success.
30 */
31 int RSA_verify(const RSAPublicKey *key,
32 const uint8_t* sig,
33 const int sig_len,
34 const uint8_t sig_type,
35 const uint8_t* hash);
36
37 #endif /* VBOOT_REFERENCE_RSA_H_ */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698