aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Nissler2016-04-04 09:17:01 -0500
committerMattias Nissler2016-04-06 08:54:17 -0500
commit452df6d99c81c4eeee3d2c7b2171901e8b7bc54a (patch)
tree2c1e4941bc377422b60ce38baf0681c768691d15 /verifier.h
parent81247500d535dac714fad657860b67474e1f6e42 (diff)
downloadplatform-bootable-recovery-452df6d99c81c4eeee3d2c7b2171901e8b7bc54a.tar.gz
platform-bootable-recovery-452df6d99c81c4eeee3d2c7b2171901e8b7bc54a.tar.xz
platform-bootable-recovery-452df6d99c81c4eeee3d2c7b2171901e8b7bc54a.zip
Convert recovery to use BoringSSL instead of mincrypt.
This changes the verification code in bootable/recovery to use BoringSSL instead of mincrypt. Change-Id: I37b37d84b22e81c32ac180cd1240c02150ddf3a7
Diffstat (limited to 'verifier.h')
-rw-r--r--verifier.h46
1 files changed, 28 insertions, 18 deletions
diff --git a/verifier.h b/verifier.h
index 4eafc756..58083fe1 100644
--- a/verifier.h
+++ b/verifier.h
@@ -20,32 +20,42 @@
20#include <memory> 20#include <memory>
21#include <vector> 21#include <vector>
22 22
23#include "mincrypt/p256.h" 23#include <openssl/ec_key.h>
24#include "mincrypt/rsa.h" 24#include <openssl/rsa.h>
25#include <openssl/sha.h>
25 26
26typedef struct { 27struct RSADeleter {
27 p256_int x; 28 void operator()(RSA* rsa) {
28 p256_int y; 29 RSA_free(rsa);
29} ECPublicKey; 30 }
31};
32
33struct ECKEYDeleter {
34 void operator()(EC_KEY* ec_key) {
35 EC_KEY_free(ec_key);
36 }
37};
30 38
31struct Certificate { 39struct Certificate {
32 typedef enum { 40 typedef enum {
33 RSA, 41 KEY_TYPE_RSA,
34 EC, 42 KEY_TYPE_EC,
35 } KeyType; 43 } KeyType;
36 44
37 Certificate(int hash_len_, KeyType key_type_, 45 Certificate(int hash_len_,
38 std::unique_ptr<RSAPublicKey>&& rsa_, 46 KeyType key_type_,
39 std::unique_ptr<ECPublicKey>&& ec_) : 47 std::unique_ptr<RSA, RSADeleter>&& rsa_,
40 hash_len(hash_len_), 48 std::unique_ptr<EC_KEY, ECKEYDeleter>&& ec_)
41 key_type(key_type_), 49 : hash_len(hash_len_),
42 rsa(std::move(rsa_)), 50 key_type(key_type_),
43 ec(std::move(ec_)) { } 51 rsa(std::move(rsa_)),
52 ec(std::move(ec_)) {}
44 53
45 int hash_len; // SHA_DIGEST_SIZE (SHA-1) or SHA256_DIGEST_SIZE (SHA-256) 54 // SHA_DIGEST_LENGTH (SHA-1) or SHA256_DIGEST_LENGTH (SHA-256)
55 int hash_len;
46 KeyType key_type; 56 KeyType key_type;
47 std::unique_ptr<RSAPublicKey> rsa; 57 std::unique_ptr<RSA, RSADeleter> rsa;
48 std::unique_ptr<ECPublicKey> ec; 58 std::unique_ptr<EC_KEY, ECKEYDeleter> ec;
49}; 59};
50 60
51/* addr and length define a an update package file that has been 61/* addr and length define a an update package file that has been