host,test: Remove unneeded vb1 rsa functions

Another in a continued stream of refactoring.  This change removes more
of the vb1 rsa library code and associated tests, in favor of their vb2
equivalents.  This change touches only host-side code and its tests, not
firmware.

BUG=chromium:611535
BRANCH=none
TEST=make runtests; emerge-kevin coreboot depthcharge

Change-Id: I1973bc2f03c60da62232e30bab0fa5fe791b6b34
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/400901
This commit is contained in:
Randall Spangler
2016-10-14 15:37:25 -07:00
committed by chrome-bot
parent 13b109762a
commit 5a9f498182
18 changed files with 131 additions and 1082 deletions

View File

@@ -22,74 +22,4 @@
#define RSA4096NUMWORDS (RSA4096NUMBYTES / sizeof(uint32_t))
#define RSA8192NUMWORDS (RSA8192NUMBYTES / sizeof(uint32_t))
typedef struct RSAPublicKey {
uint32_t len; /* Length of n[] in number of uint32_t */
uint32_t n0inv; /* -1 / n[0] mod 2^32 */
uint32_t* n; /* modulus as little endian array */
uint32_t* rr; /* R^2 as little endian array */
unsigned int algorithm; /* Algorithm to use when verifying with the key */
} RSAPublicKey;
/* Verify a RSA PKCS1.5 signature [sig] of [sig_type] and length [sig_len]
* against an expected [hash] using [key]. Returns 0 on failure, 1 on success.
*/
int RSAVerify(const RSAPublicKey *key,
const uint8_t* sig,
const uint32_t sig_len,
const uint8_t sig_type,
const uint8_t* hash);
/* Perform RSA signature verification on [buf] of length [len] against expected
* signature [sig] using signature algorithm [algorithm]. The public key used
* for verification can either be in the form of a pre-process key blob
* [key_blob] or RSAPublicKey structure [key]. One of [key_blob] or [key] must
* be non-NULL, and the other NULL or the function will fail.
*
* Returns 1 on verification success, 0 on verification failure or invalid
* arguments.
*
* Note: This function is for use in the firmware and assumes all pointers point
* to areas in the memory of the right size.
*
*/
int RSAVerifyBinary_f(const uint8_t* key_blob,
const RSAPublicKey* key,
const uint8_t* buf,
uint64_t len,
const uint8_t* sig,
unsigned int algorithm);
/* Version of RSAVerifyBinary_f() where instead of the raw binary blob
* of data, its digest is passed as the argument. */
int RSAVerifyBinaryWithDigest_f(const uint8_t* key_blob,
const RSAPublicKey* key,
const uint8_t* digest,
const uint8_t* sig,
unsigned int algorithm);
/* ----Some additional utility functions for RSA.---- */
/* Returns the size of a pre-processed RSA public key in
* [out_size] with the algorithm [algorithm].
*
* Returns 1 on success, 0 on failure.
*/
uint64_t RSAProcessedKeySize(uint64_t algorithm, uint64_t* out_size);
/* Allocate a new RSAPublicKey structure and initialize its pointer fields to
* NULL */
RSAPublicKey* RSAPublicKeyNew(void);
/* Deep free the contents of [key]. */
void RSAPublicKeyFree(RSAPublicKey* key);
/* Create a RSAPublic key structure from binary blob [buf] of length
* [len].
*
* Caller owns the returned key and must free it.
*/
RSAPublicKey* RSAPublicKeyFromBuf(const uint8_t* buf, uint64_t len);
#endif /* VBOOT_REFERENCE_RSA_H_ */