2009-12-10 02:01:45 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2009 The Android Open Source Project
|
|
|
|
*
|
2016-02-04 02:02:09 +01:00
|
|
|
* Licensed under the Apache License, version 2.0 (the "License");
|
2009-12-10 02:01:45 +01:00
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
2016-02-04 02:02:09 +01:00
|
|
|
* Unless required by applicable law or agree to in writing, software
|
2009-12-10 02:01:45 +01:00
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2014-12-29 21:46:43 +01:00
|
|
|
#include <errno.h>
|
|
|
|
#include <fcntl.h>
|
2009-12-10 02:01:45 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2014-01-13 23:16:58 +01:00
|
|
|
#include <sys/stat.h>
|
2016-04-04 16:17:01 +02:00
|
|
|
#include <sys/types.h>
|
2009-12-10 02:01:45 +01:00
|
|
|
|
2016-02-04 02:02:09 +01:00
|
|
|
#include <string>
|
2016-02-02 23:02:27 +01:00
|
|
|
#include <vector>
|
|
|
|
|
2017-03-17 01:37:38 +01:00
|
|
|
#include <android-base/file.h>
|
2016-02-04 02:02:09 +01:00
|
|
|
#include <android-base/stringprintf.h>
|
2018-10-15 20:44:14 +02:00
|
|
|
#include <android-base/strings.h>
|
2018-10-11 00:44:17 +02:00
|
|
|
#include <android-base/unique_fd.h>
|
2018-05-04 07:41:23 +02:00
|
|
|
#include <gtest/gtest.h>
|
2018-10-24 08:31:43 +02:00
|
|
|
#include <openssl/bn.h>
|
|
|
|
#include <openssl/ec.h>
|
|
|
|
#include <openssl/nid.h>
|
2018-10-15 20:44:14 +02:00
|
|
|
#include <ziparchive/zip_writer.h>
|
2016-02-04 02:02:09 +01:00
|
|
|
|
2016-03-10 02:51:34 +01:00
|
|
|
#include "common/test_constants.h"
|
2018-05-04 07:41:23 +02:00
|
|
|
#include "otautil/sysutil.h"
|
2016-02-04 02:02:09 +01:00
|
|
|
#include "verifier.h"
|
|
|
|
|
2017-03-27 08:25:11 +02:00
|
|
|
using namespace std::string_literals;
|
|
|
|
|
2018-10-11 00:44:17 +02:00
|
|
|
static void LoadKeyFromFile(const std::string& file_name, Certificate* cert) {
|
|
|
|
std::string testkey_string;
|
|
|
|
ASSERT_TRUE(android::base::ReadFileToString(file_name, &testkey_string));
|
|
|
|
ASSERT_TRUE(LoadCertificateFromBuffer(
|
|
|
|
std::vector<uint8_t>(testkey_string.begin(), testkey_string.end()), cert));
|
|
|
|
}
|
|
|
|
|
2018-10-15 20:44:14 +02:00
|
|
|
static void VerifyPackageWithCertificates(const std::string& name,
|
|
|
|
const std::vector<Certificate>& certs) {
|
2018-10-11 00:44:17 +02:00
|
|
|
std::string package = from_testdata_base(name);
|
|
|
|
MemMapping memmap;
|
|
|
|
if (!memmap.MapFile(package)) {
|
|
|
|
FAIL() << "Failed to mmap " << package << ": " << strerror(errno) << "\n";
|
|
|
|
}
|
|
|
|
|
2018-10-15 20:44:14 +02:00
|
|
|
ASSERT_EQ(VERIFY_SUCCESS, verify_file(memmap.addr, memmap.length, certs));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void VerifyPackageWithSingleCertificate(const std::string& name, Certificate&& cert) {
|
2018-10-11 00:44:17 +02:00
|
|
|
std::vector<Certificate> certs;
|
|
|
|
certs.emplace_back(std::move(cert));
|
2018-10-15 20:44:14 +02:00
|
|
|
VerifyPackageWithCertificates(name, certs);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void BuildCertificateArchive(const std::vector<std::string>& file_names, int fd) {
|
|
|
|
FILE* zip_file_ptr = fdopen(fd, "wb");
|
|
|
|
ZipWriter zip_writer(zip_file_ptr);
|
|
|
|
|
|
|
|
for (const auto& name : file_names) {
|
|
|
|
std::string content;
|
|
|
|
ASSERT_TRUE(android::base::ReadFileToString(name, &content));
|
|
|
|
|
|
|
|
// Makes sure the zip entry name has the correct suffix.
|
|
|
|
std::string entry_name = name;
|
|
|
|
if (!android::base::EndsWith(entry_name, "x509.pem")) {
|
|
|
|
entry_name += "x509.pem";
|
|
|
|
}
|
|
|
|
ASSERT_EQ(0, zip_writer.StartEntry(entry_name.c_str(), ZipWriter::kCompress));
|
|
|
|
ASSERT_EQ(0, zip_writer.WriteBytes(content.data(), content.size()));
|
|
|
|
ASSERT_EQ(0, zip_writer.FinishEntry());
|
|
|
|
}
|
|
|
|
|
|
|
|
ASSERT_EQ(0, zip_writer.Finish());
|
|
|
|
ASSERT_EQ(0, fclose(zip_file_ptr));
|
2018-10-11 00:44:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(VerifierTest, LoadCertificateFromBuffer_failure) {
|
|
|
|
Certificate cert(0, Certificate::KEY_TYPE_RSA, nullptr, nullptr);
|
|
|
|
std::string testkey_string;
|
|
|
|
ASSERT_TRUE(
|
|
|
|
android::base::ReadFileToString(from_testdata_base("testkey_v1.txt"), &testkey_string));
|
|
|
|
ASSERT_FALSE(LoadCertificateFromBuffer(
|
|
|
|
std::vector<uint8_t>(testkey_string.begin(), testkey_string.end()), &cert));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(VerifierTest, LoadCertificateFromBuffer_sha1_exponent3) {
|
|
|
|
Certificate cert(0, Certificate::KEY_TYPE_RSA, nullptr, nullptr);
|
|
|
|
LoadKeyFromFile(from_testdata_base("testkey_v1.x509.pem"), &cert);
|
|
|
|
|
|
|
|
ASSERT_EQ(SHA_DIGEST_LENGTH, cert.hash_len);
|
|
|
|
ASSERT_EQ(Certificate::KEY_TYPE_RSA, cert.key_type);
|
|
|
|
ASSERT_EQ(nullptr, cert.ec);
|
|
|
|
|
2018-10-15 20:44:14 +02:00
|
|
|
VerifyPackageWithSingleCertificate("otasigned_v1.zip", std::move(cert));
|
2018-10-11 00:44:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(VerifierTest, LoadCertificateFromBuffer_sha1_exponent65537) {
|
|
|
|
Certificate cert(0, Certificate::KEY_TYPE_RSA, nullptr, nullptr);
|
|
|
|
LoadKeyFromFile(from_testdata_base("testkey_v2.x509.pem"), &cert);
|
|
|
|
|
|
|
|
ASSERT_EQ(SHA_DIGEST_LENGTH, cert.hash_len);
|
|
|
|
ASSERT_EQ(Certificate::KEY_TYPE_RSA, cert.key_type);
|
|
|
|
ASSERT_EQ(nullptr, cert.ec);
|
|
|
|
|
2018-10-15 20:44:14 +02:00
|
|
|
VerifyPackageWithSingleCertificate("otasigned_v2.zip", std::move(cert));
|
2018-10-11 00:44:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(VerifierTest, LoadCertificateFromBuffer_sha256_exponent3) {
|
|
|
|
Certificate cert(0, Certificate::KEY_TYPE_RSA, nullptr, nullptr);
|
|
|
|
LoadKeyFromFile(from_testdata_base("testkey_v3.x509.pem"), &cert);
|
|
|
|
|
|
|
|
ASSERT_EQ(SHA256_DIGEST_LENGTH, cert.hash_len);
|
|
|
|
ASSERT_EQ(Certificate::KEY_TYPE_RSA, cert.key_type);
|
|
|
|
ASSERT_EQ(nullptr, cert.ec);
|
|
|
|
|
2018-10-15 20:44:14 +02:00
|
|
|
VerifyPackageWithSingleCertificate("otasigned_v3.zip", std::move(cert));
|
2018-10-11 00:44:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(VerifierTest, LoadCertificateFromBuffer_sha256_exponent65537) {
|
|
|
|
Certificate cert(0, Certificate::KEY_TYPE_RSA, nullptr, nullptr);
|
|
|
|
LoadKeyFromFile(from_testdata_base("testkey_v4.x509.pem"), &cert);
|
|
|
|
|
|
|
|
ASSERT_EQ(SHA256_DIGEST_LENGTH, cert.hash_len);
|
|
|
|
ASSERT_EQ(Certificate::KEY_TYPE_RSA, cert.key_type);
|
|
|
|
ASSERT_EQ(nullptr, cert.ec);
|
|
|
|
|
2018-10-15 20:44:14 +02:00
|
|
|
VerifyPackageWithSingleCertificate("otasigned_v4.zip", std::move(cert));
|
2018-10-11 00:44:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(VerifierTest, LoadCertificateFromBuffer_sha256_ec256bits) {
|
|
|
|
Certificate cert(0, Certificate::KEY_TYPE_RSA, nullptr, nullptr);
|
|
|
|
LoadKeyFromFile(from_testdata_base("testkey_v5.x509.pem"), &cert);
|
|
|
|
|
|
|
|
ASSERT_EQ(SHA256_DIGEST_LENGTH, cert.hash_len);
|
|
|
|
ASSERT_EQ(Certificate::KEY_TYPE_EC, cert.key_type);
|
|
|
|
ASSERT_EQ(nullptr, cert.rsa);
|
|
|
|
|
2018-10-15 20:44:14 +02:00
|
|
|
VerifyPackageWithSingleCertificate("otasigned_v5.zip", std::move(cert));
|
|
|
|
}
|
|
|
|
|
2018-10-24 08:31:43 +02:00
|
|
|
TEST(VerifierTest, LoadCertificateFromBuffer_check_rsa_keys) {
|
|
|
|
std::unique_ptr<RSA, RSADeleter> rsa(RSA_new());
|
|
|
|
std::unique_ptr<BIGNUM, decltype(&BN_free)> exponent(BN_new(), BN_free);
|
|
|
|
BN_set_word(exponent.get(), 3);
|
|
|
|
RSA_generate_key_ex(rsa.get(), 2048, exponent.get(), nullptr);
|
|
|
|
ASSERT_TRUE(CheckRSAKey(rsa));
|
|
|
|
|
|
|
|
// Exponent is expected to be 3 or 65537
|
|
|
|
BN_set_word(exponent.get(), 17);
|
|
|
|
RSA_generate_key_ex(rsa.get(), 2048, exponent.get(), nullptr);
|
|
|
|
ASSERT_FALSE(CheckRSAKey(rsa));
|
|
|
|
|
|
|
|
// Modulus is expected to be 2048.
|
|
|
|
BN_set_word(exponent.get(), 3);
|
|
|
|
RSA_generate_key_ex(rsa.get(), 1024, exponent.get(), nullptr);
|
|
|
|
ASSERT_FALSE(CheckRSAKey(rsa));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(VerifierTest, LoadCertificateFromBuffer_check_ec_keys) {
|
|
|
|
std::unique_ptr<EC_KEY, ECKEYDeleter> ec(EC_KEY_new_by_curve_name(NID_X9_62_prime256v1));
|
|
|
|
ASSERT_EQ(1, EC_KEY_generate_key(ec.get()));
|
|
|
|
ASSERT_TRUE(CheckECKey(ec));
|
|
|
|
|
|
|
|
// Expects 256-bit EC key with curve NIST P-256
|
|
|
|
ec.reset(EC_KEY_new_by_curve_name(NID_secp224r1));
|
|
|
|
ASSERT_EQ(1, EC_KEY_generate_key(ec.get()));
|
|
|
|
ASSERT_FALSE(CheckECKey(ec));
|
|
|
|
}
|
|
|
|
|
2018-10-15 20:44:14 +02:00
|
|
|
TEST(VerifierTest, LoadKeysFromZipfile_empty_archive) {
|
|
|
|
TemporaryFile otacerts;
|
|
|
|
BuildCertificateArchive({}, otacerts.release());
|
|
|
|
std::vector<Certificate> certs = LoadKeysFromZipfile(otacerts.path);
|
|
|
|
ASSERT_TRUE(certs.empty());
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(VerifierTest, LoadKeysFromZipfile_single_key) {
|
|
|
|
TemporaryFile otacerts;
|
|
|
|
BuildCertificateArchive({ from_testdata_base("testkey_v1.x509.pem") }, otacerts.release());
|
|
|
|
std::vector<Certificate> certs = LoadKeysFromZipfile(otacerts.path);
|
|
|
|
ASSERT_EQ(1, certs.size());
|
|
|
|
|
|
|
|
VerifyPackageWithCertificates("otasigned_v1.zip", certs);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(VerifierTest, LoadKeysFromZipfile_corrupted_key) {
|
|
|
|
TemporaryFile corrupted_key;
|
|
|
|
std::string content;
|
|
|
|
ASSERT_TRUE(android::base::ReadFileToString(from_testdata_base("testkey_v1.x509.pem"), &content));
|
|
|
|
content = "random-contents" + content;
|
|
|
|
ASSERT_TRUE(android::base::WriteStringToFd(content, corrupted_key.release()));
|
|
|
|
|
|
|
|
TemporaryFile otacerts;
|
|
|
|
BuildCertificateArchive({ from_testdata_base("testkey_v2.x509.pem"), corrupted_key.path },
|
|
|
|
otacerts.release());
|
|
|
|
std::vector<Certificate> certs = LoadKeysFromZipfile(otacerts.path);
|
|
|
|
ASSERT_EQ(0, certs.size());
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(VerifierTest, LoadKeysFromZipfile_multiple_key) {
|
|
|
|
TemporaryFile otacerts;
|
|
|
|
BuildCertificateArchive(
|
|
|
|
{
|
|
|
|
from_testdata_base("testkey_v3.x509.pem"),
|
|
|
|
from_testdata_base("testkey_v4.x509.pem"),
|
|
|
|
from_testdata_base("testkey_v5.x509.pem"),
|
|
|
|
|
|
|
|
},
|
|
|
|
otacerts.release());
|
|
|
|
std::vector<Certificate> certs = LoadKeysFromZipfile(otacerts.path);
|
|
|
|
ASSERT_EQ(3, certs.size());
|
|
|
|
|
|
|
|
VerifyPackageWithCertificates("otasigned_v3.zip", certs);
|
|
|
|
VerifyPackageWithCertificates("otasigned_v4.zip", certs);
|
|
|
|
VerifyPackageWithCertificates("otasigned_v5.zip", certs);
|
2018-10-11 00:44:17 +02:00
|
|
|
}
|
|
|
|
|
2016-02-04 02:02:09 +01:00
|
|
|
class VerifierTest : public testing::TestWithParam<std::vector<std::string>> {
|
2017-03-17 01:37:38 +01:00
|
|
|
protected:
|
|
|
|
void SetUp() override {
|
|
|
|
std::vector<std::string> args = GetParam();
|
|
|
|
std::string package = from_testdata_base(args[0]);
|
2017-04-19 08:54:29 +02:00
|
|
|
if (!memmap.MapFile(package)) {
|
2017-03-17 01:37:38 +01:00
|
|
|
FAIL() << "Failed to mmap " << package << ": " << strerror(errno) << "\n";
|
2013-04-10 20:32:17 +02:00
|
|
|
}
|
2013-10-09 19:14:35 +02:00
|
|
|
|
2017-03-17 01:37:38 +01:00
|
|
|
for (auto it = ++args.cbegin(); it != args.cend(); ++it) {
|
2018-10-20 02:23:21 +02:00
|
|
|
std::string public_key_file = from_testdata_base("testkey_" + *it + ".x509.pem");
|
|
|
|
certs.emplace_back(0, Certificate::KEY_TYPE_RSA, nullptr, nullptr);
|
|
|
|
LoadKeyFromFile(public_key_file, &certs.back());
|
2013-10-09 19:14:35 +02:00
|
|
|
}
|
2017-03-17 01:37:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
MemMapping memmap;
|
|
|
|
std::vector<Certificate> certs;
|
2016-02-04 02:02:09 +01:00
|
|
|
};
|
2013-10-09 19:14:35 +02:00
|
|
|
|
2016-02-04 02:02:09 +01:00
|
|
|
class VerifierSuccessTest : public VerifierTest {
|
|
|
|
};
|
2012-07-25 22:10:58 +02:00
|
|
|
|
2016-02-04 02:02:09 +01:00
|
|
|
class VerifierFailureTest : public VerifierTest {
|
|
|
|
};
|
2011-10-31 17:34:15 +01:00
|
|
|
|
2017-03-21 00:57:25 +01:00
|
|
|
TEST(VerifierTest, BadPackage_AlteredFooter) {
|
|
|
|
std::vector<Certificate> certs;
|
2018-10-20 02:23:21 +02:00
|
|
|
certs.emplace_back(0, Certificate::KEY_TYPE_RSA, nullptr, nullptr);
|
|
|
|
LoadKeyFromFile(from_testdata_base("testkey_v3.x509.pem"), &certs.back());
|
2017-03-21 00:57:25 +01:00
|
|
|
|
|
|
|
std::string package;
|
|
|
|
ASSERT_TRUE(android::base::ReadFileToString(from_testdata_base("otasigned_v3.zip"), &package));
|
|
|
|
ASSERT_EQ(std::string("\xc0\x06\xff\xff\xd2\x06", 6), package.substr(package.size() - 6, 6));
|
|
|
|
|
|
|
|
// Alter the footer.
|
|
|
|
package[package.size() - 5] = '\x05';
|
|
|
|
ASSERT_EQ(VERIFY_FAILURE,
|
|
|
|
verify_file(reinterpret_cast<const unsigned char*>(package.data()), package.size(),
|
|
|
|
certs));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(VerifierTest, BadPackage_AlteredContent) {
|
|
|
|
std::vector<Certificate> certs;
|
2018-10-20 02:23:21 +02:00
|
|
|
certs.emplace_back(0, Certificate::KEY_TYPE_RSA, nullptr, nullptr);
|
|
|
|
LoadKeyFromFile(from_testdata_base("testkey_v3.x509.pem"), &certs.back());
|
2017-03-21 00:57:25 +01:00
|
|
|
|
|
|
|
std::string package;
|
|
|
|
ASSERT_TRUE(android::base::ReadFileToString(from_testdata_base("otasigned_v3.zip"), &package));
|
|
|
|
ASSERT_GT(package.size(), static_cast<size_t>(100));
|
|
|
|
|
|
|
|
// Alter the content.
|
|
|
|
std::string altered1(package);
|
|
|
|
altered1[50] += 1;
|
|
|
|
ASSERT_EQ(VERIFY_FAILURE,
|
|
|
|
verify_file(reinterpret_cast<const unsigned char*>(altered1.data()), altered1.size(),
|
|
|
|
certs));
|
|
|
|
|
|
|
|
std::string altered2(package);
|
|
|
|
altered2[10] += 1;
|
|
|
|
ASSERT_EQ(VERIFY_FAILURE,
|
|
|
|
verify_file(reinterpret_cast<const unsigned char*>(altered2.data()), altered2.size(),
|
|
|
|
certs));
|
|
|
|
}
|
|
|
|
|
2017-03-27 08:25:11 +02:00
|
|
|
TEST(VerifierTest, BadPackage_SignatureStartOutOfBounds) {
|
|
|
|
std::vector<Certificate> certs;
|
2018-10-20 02:23:21 +02:00
|
|
|
certs.emplace_back(0, Certificate::KEY_TYPE_RSA, nullptr, nullptr);
|
|
|
|
LoadKeyFromFile(from_testdata_base("testkey_v3.x509.pem"), &certs.back());
|
2017-03-27 08:25:11 +02:00
|
|
|
|
|
|
|
// Signature start is 65535 (0xffff) while comment size is 0 (Bug: 31914369).
|
|
|
|
std::string package = "\x50\x4b\x05\x06"s + std::string(12, '\0') + "\xff\xff\xff\xff\x00\x00"s;
|
|
|
|
ASSERT_EQ(VERIFY_FAILURE, verify_file(reinterpret_cast<const unsigned char*>(package.data()),
|
|
|
|
package.size(), certs));
|
|
|
|
}
|
|
|
|
|
2016-02-04 02:02:09 +01:00
|
|
|
TEST_P(VerifierSuccessTest, VerifySucceed) {
|
2017-03-17 01:37:38 +01:00
|
|
|
ASSERT_EQ(verify_file(memmap.addr, memmap.length, certs, nullptr), VERIFY_SUCCESS);
|
2016-02-04 02:02:09 +01:00
|
|
|
}
|
2014-01-13 23:16:58 +01:00
|
|
|
|
2016-02-04 02:02:09 +01:00
|
|
|
TEST_P(VerifierFailureTest, VerifyFailure) {
|
2017-03-17 01:37:38 +01:00
|
|
|
ASSERT_EQ(verify_file(memmap.addr, memmap.length, certs, nullptr), VERIFY_FAILURE);
|
2009-12-10 02:01:45 +01:00
|
|
|
}
|
2016-02-04 02:02:09 +01:00
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(SingleKeySuccess, VerifierSuccessTest,
|
2017-03-17 01:37:38 +01:00
|
|
|
::testing::Values(
|
|
|
|
std::vector<std::string>({"otasigned_v1.zip", "v1"}),
|
|
|
|
std::vector<std::string>({"otasigned_v2.zip", "v2"}),
|
|
|
|
std::vector<std::string>({"otasigned_v3.zip", "v3"}),
|
|
|
|
std::vector<std::string>({"otasigned_v4.zip", "v4"}),
|
|
|
|
std::vector<std::string>({"otasigned_v5.zip", "v5"})));
|
2016-02-04 02:02:09 +01:00
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(MultiKeySuccess, VerifierSuccessTest,
|
2017-03-17 01:37:38 +01:00
|
|
|
::testing::Values(
|
|
|
|
std::vector<std::string>({"otasigned_v1.zip", "v1", "v2"}),
|
|
|
|
std::vector<std::string>({"otasigned_v2.zip", "v5", "v2"}),
|
|
|
|
std::vector<std::string>({"otasigned_v3.zip", "v5", "v1", "v3"}),
|
|
|
|
std::vector<std::string>({"otasigned_v4.zip", "v5", "v1", "v4"}),
|
|
|
|
std::vector<std::string>({"otasigned_v5.zip", "v4", "v1", "v5"})));
|
2016-02-04 02:02:09 +01:00
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(WrongKey, VerifierFailureTest,
|
2017-03-17 01:37:38 +01:00
|
|
|
::testing::Values(
|
|
|
|
std::vector<std::string>({"otasigned_v1.zip", "v2"}),
|
|
|
|
std::vector<std::string>({"otasigned_v2.zip", "v1"}),
|
|
|
|
std::vector<std::string>({"otasigned_v3.zip", "v5"}),
|
|
|
|
std::vector<std::string>({"otasigned_v4.zip", "v5"}),
|
|
|
|
std::vector<std::string>({"otasigned_v5.zip", "v3"})));
|
2016-02-04 02:02:09 +01:00
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(WrongHash, VerifierFailureTest,
|
2017-03-17 01:37:38 +01:00
|
|
|
::testing::Values(
|
|
|
|
std::vector<std::string>({"otasigned_v1.zip", "v3"}),
|
|
|
|
std::vector<std::string>({"otasigned_v2.zip", "v4"}),
|
|
|
|
std::vector<std::string>({"otasigned_v3.zip", "v1"}),
|
|
|
|
std::vector<std::string>({"otasigned_v4.zip", "v2"})));
|
2016-02-04 02:02:09 +01:00
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(BadPackage, VerifierFailureTest,
|
2017-03-17 01:37:38 +01:00
|
|
|
::testing::Values(
|
|
|
|
std::vector<std::string>({"random.zip", "v1"}),
|
2017-03-21 00:57:25 +01:00
|
|
|
std::vector<std::string>({"fake-eocd.zip", "v1"})));
|