Bemanitools v5.26 release
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
testexes += security-id-test
|
||||
|
||||
srcdir_security-id-test := src/test/security
|
||||
|
||||
libs_security-id-test := \
|
||||
security \
|
||||
test \
|
||||
util \
|
||||
|
||||
src_security-id-test := \
|
||||
security-id-test.c \
|
||||
|
||||
################################################################################
|
||||
|
||||
testexes += security-mcode-test
|
||||
|
||||
srcdir_security-mcode-test := src/test/security
|
||||
|
||||
libs_security-mcode-test := \
|
||||
security \
|
||||
test \
|
||||
util \
|
||||
|
||||
src_security-mcode-test := \
|
||||
security-mcode-test.c \
|
||||
|
||||
################################################################################
|
||||
|
||||
testexes += security-util-test
|
||||
|
||||
srcdir_security-util-test := src/test/security
|
||||
|
||||
libs_security-util-test := \
|
||||
security \
|
||||
test \
|
||||
util \
|
||||
|
||||
src_security-util-test := \
|
||||
security-util-test.c \
|
||||
|
||||
################################################################################
|
||||
|
||||
testexes += security-rp-test
|
||||
|
||||
srcdir_security-rp-test := src/test/security
|
||||
|
||||
libs_security-rp-test := \
|
||||
security \
|
||||
test \
|
||||
util \
|
||||
|
||||
src_security-rp-test := \
|
||||
security-rp-test.c \
|
||||
|
||||
################################################################################
|
||||
|
||||
testexes += security-rp2-test
|
||||
|
||||
srcdir_security-rp2-test := src/test/security
|
||||
|
||||
libs_security-rp2-test := \
|
||||
security \
|
||||
test \
|
||||
util \
|
||||
|
||||
src_security-rp2-test := \
|
||||
security-rp2-test.c \
|
||||
|
||||
################################################################################
|
||||
|
||||
testexes += security-rp3-test
|
||||
|
||||
srcdir_security-rp3-test := src/test/security
|
||||
|
||||
libs_security-rp3-test := \
|
||||
security \
|
||||
test \
|
||||
util \
|
||||
|
||||
src_security-rp3-test := \
|
||||
security-rp3-test.c \
|
||||
|
||||
################################################################################
|
||||
@@ -0,0 +1,57 @@
|
||||
#include "security/id.h"
|
||||
|
||||
#include "test/check.h"
|
||||
#include "test/test.h"
|
||||
|
||||
static void test_to_str()
|
||||
{
|
||||
check_str_eq(security_id_to_str(&security_id_default, false),
|
||||
"0101020304050607086F");
|
||||
check_str_eq(security_id_to_str(&security_id_default, true),
|
||||
"0102030405060708");
|
||||
}
|
||||
|
||||
static void test_parse_valid()
|
||||
{
|
||||
struct security_id id;
|
||||
|
||||
check_bool_true(security_id_parse("0101020304050607086F", &id));
|
||||
check_bool_true(security_id_verify(&id));
|
||||
}
|
||||
|
||||
static void test_parse_invalid()
|
||||
{
|
||||
struct security_id id;
|
||||
|
||||
check_bool_true(security_id_parse("0102030405060708", &id));
|
||||
check_bool_false(security_id_verify(&id));
|
||||
|
||||
check_bool_true(security_id_parse("010102030405060708FF", &id));
|
||||
check_bool_false(security_id_verify(&id));
|
||||
|
||||
check_bool_false(security_id_parse("asdf", &id));
|
||||
}
|
||||
|
||||
static void test_prepare_and_verify()
|
||||
{
|
||||
struct security_id id;
|
||||
|
||||
check_bool_true(security_id_parse("01AB50E2DC4F832A9A78", &id));
|
||||
check_bool_true(security_id_verify(&id));
|
||||
}
|
||||
|
||||
static void test_prepare_and_verify_invalid()
|
||||
{
|
||||
struct security_id id;
|
||||
|
||||
check_bool_true(security_id_parse("01AB50E2DC4F832A9A79", &id));
|
||||
check_bool_false(security_id_verify(&id));
|
||||
}
|
||||
|
||||
TEST_MODULE_BEGIN("security-id")
|
||||
TEST_MODULE_TEST(test_to_str)
|
||||
TEST_MODULE_TEST(test_parse_valid)
|
||||
TEST_MODULE_TEST(test_parse_invalid)
|
||||
TEST_MODULE_TEST(test_prepare_and_verify)
|
||||
TEST_MODULE_TEST(test_prepare_and_verify_invalid)
|
||||
TEST_MODULE_END()
|
||||
@@ -0,0 +1,63 @@
|
||||
#include "security/mcode.h"
|
||||
|
||||
#include "test/check.h"
|
||||
#include "test/test.h"
|
||||
|
||||
static void test_parse_valid()
|
||||
{
|
||||
struct security_mcode mcode;
|
||||
|
||||
check_bool_true(security_mcode_parse("GQD01JAA", &mcode));
|
||||
check_char_eq(mcode.header, 'G');
|
||||
check_char_eq(mcode.unkn, 'Q');
|
||||
check_data_eq(mcode.game, sizeof(mcode.game), "D01", 3);
|
||||
check_char_eq(mcode.region, 'J');
|
||||
check_char_eq(mcode.cabinet, 'A');
|
||||
check_char_eq(mcode.revision, 'A');
|
||||
}
|
||||
|
||||
static void test_parse_valid_2()
|
||||
{
|
||||
struct security_mcode mcode;
|
||||
|
||||
check_bool_true(security_mcode_parse("GQD01", &mcode));
|
||||
check_char_eq(mcode.header, 'G');
|
||||
check_char_eq(mcode.unkn, 'Q');
|
||||
check_data_eq(mcode.game, sizeof(mcode.game), "D01", 3);
|
||||
check_char_eq(mcode.region, ' ');
|
||||
check_char_eq(mcode.cabinet, ' ');
|
||||
check_char_eq(mcode.revision, ' ');
|
||||
}
|
||||
|
||||
static void test_parse_invalid()
|
||||
{
|
||||
struct security_mcode mcode;
|
||||
|
||||
check_bool_false(security_mcode_parse("GQD01JAAA", &mcode));
|
||||
check_char_eq(mcode.header, ' ');
|
||||
check_char_eq(mcode.unkn, ' ');
|
||||
check_data_eq(mcode.game, sizeof(mcode.game), " ", 3);
|
||||
check_char_eq(mcode.region, ' ');
|
||||
check_char_eq(mcode.cabinet, ' ');
|
||||
check_char_eq(mcode.revision, ' ');
|
||||
}
|
||||
|
||||
static void test_to_str()
|
||||
{
|
||||
struct security_mcode mcode;
|
||||
mcode.header = 'G';
|
||||
mcode.unkn = 'Q';
|
||||
memcpy(mcode.game, "D01", 3);
|
||||
mcode.region = 'J';
|
||||
mcode.cabinet = 'A';
|
||||
mcode.revision = 'A';
|
||||
|
||||
check_str_eq(security_mcode_to_str(&mcode), "GQD01JAA");
|
||||
}
|
||||
|
||||
TEST_MODULE_BEGIN("security-mcode")
|
||||
TEST_MODULE_TEST(test_parse_valid)
|
||||
TEST_MODULE_TEST(test_parse_valid_2)
|
||||
TEST_MODULE_TEST(test_parse_invalid)
|
||||
TEST_MODULE_TEST(test_to_str)
|
||||
TEST_MODULE_END()
|
||||
@@ -0,0 +1,163 @@
|
||||
#include "security/id.h"
|
||||
#include "security/rp.h"
|
||||
|
||||
#include "test/check.h"
|
||||
#include "test/test.h"
|
||||
|
||||
static const struct security_mcode boot_version_iidx_09_to_13 = {
|
||||
.header = SECURITY_MCODE_HEADER,
|
||||
.unkn = SECURITY_MCODE_UNKN_E,
|
||||
.game = SECURITY_MCODE_GAME_IIDX_9,
|
||||
.region = SECURITY_MCODE_FIELD_BLANK,
|
||||
.cabinet = SECURITY_MCODE_FIELD_BLANK,
|
||||
.revision = SECURITY_MCODE_FIELD_BLANK,
|
||||
};
|
||||
|
||||
static const uint32_t boot_seeds_iidx_09[3] = {0, 0, 0};
|
||||
static const uint32_t boot_seeds_iidx_10[3] = {0, 1, 1};
|
||||
static const uint32_t boot_seeds_iidx_11[3] = {0, 2, 2};
|
||||
static const uint32_t boot_seeds_iidx_12[3] = {0, 3, 3};
|
||||
static const uint32_t boot_seeds_iidx_13[3] = {0, 4, 4};
|
||||
|
||||
static const struct security_mcode black_plug_mcode_iidx_09 = {
|
||||
.header = SECURITY_MCODE_HEADER,
|
||||
.unkn = SECURITY_MCODE_UNKN_Q,
|
||||
.game = SECURITY_MCODE_GAME_IIDX_9,
|
||||
.region = SECURITY_MCODE_REGION_JAPAN,
|
||||
.cabinet = SECURITY_MCODE_CABINET_A,
|
||||
.revision = SECURITY_MCODE_REVISION_A,
|
||||
};
|
||||
|
||||
static const struct security_mcode black_plug_mcode_iidx_10 = {
|
||||
.header = SECURITY_MCODE_HEADER,
|
||||
.unkn = SECURITY_MCODE_UNKN_Q,
|
||||
.game = SECURITY_MCODE_GAME_IIDX_10,
|
||||
.region = SECURITY_MCODE_REGION_JAPAN,
|
||||
.cabinet = SECURITY_MCODE_CABINET_A,
|
||||
.revision = SECURITY_MCODE_REVISION_A,
|
||||
};
|
||||
|
||||
static const struct security_mcode black_plug_mcode_iidx_11 = {
|
||||
.header = SECURITY_MCODE_HEADER,
|
||||
.unkn = SECURITY_MCODE_UNKN_Q,
|
||||
.game = SECURITY_MCODE_GAME_IIDX_11,
|
||||
.region = SECURITY_MCODE_REGION_JAPAN,
|
||||
.cabinet = SECURITY_MCODE_CABINET_A,
|
||||
.revision = SECURITY_MCODE_REVISION_A,
|
||||
};
|
||||
|
||||
static const struct security_mcode black_plug_mcode_iidx_12 = {
|
||||
.header = SECURITY_MCODE_HEADER,
|
||||
.unkn = SECURITY_MCODE_UNKN_Q,
|
||||
.game = SECURITY_MCODE_GAME_IIDX_12,
|
||||
.region = SECURITY_MCODE_REGION_JAPAN,
|
||||
.cabinet = SECURITY_MCODE_CABINET_A,
|
||||
.revision = SECURITY_MCODE_REVISION_A,
|
||||
};
|
||||
|
||||
static const struct security_mcode black_plug_mcode_iidx_13 = {
|
||||
.header = SECURITY_MCODE_HEADER,
|
||||
.unkn = SECURITY_MCODE_UNKN_Q,
|
||||
.game = SECURITY_MCODE_GAME_IIDX_13,
|
||||
.region = SECURITY_MCODE_REGION_JAPAN,
|
||||
.cabinet = SECURITY_MCODE_CABINET_A,
|
||||
.revision = SECURITY_MCODE_REVISION_A,
|
||||
};
|
||||
|
||||
static const struct security_rp_eeprom exp_iidx_09_black_eeprom = {
|
||||
.signature = {0x07, 0x5D, 0x45, 0xCB, 0xDA, 0x19},
|
||||
.packed_payload = {0x86, 0x1A, 0x92, 0x42, 0x3C, 0x67},
|
||||
};
|
||||
|
||||
static const struct security_rp_eeprom exp_iidx_10_black_eeprom = {
|
||||
.signature = {0x10, 0x45, 0x30, 0x7D, 0x1C, 0x13},
|
||||
.packed_payload = {0x86, 0x1A, 0x91, 0x42, 0x4C, 0x67},
|
||||
};
|
||||
|
||||
static const struct security_rp_eeprom exp_iidx_11_black_eeprom = {
|
||||
.signature = {0xA2, 0x8B, 0x97, 0xA3, 0x3B, 0x23},
|
||||
.packed_payload = {0x86, 0x1A, 0x91, 0x46, 0x5C, 0x67},
|
||||
};
|
||||
|
||||
static const struct security_rp_eeprom exp_iidx_12_black_eeprom = {
|
||||
.signature = {0x1B, 0xC5, 0xF1, 0x02, 0xF0, 0xB8},
|
||||
.packed_payload = {0x86, 0x1A, 0xAF, 0x8E, 0x5C, 0x67},
|
||||
};
|
||||
|
||||
static const struct security_rp_eeprom exp_iidx_13_black_eeprom = {
|
||||
.signature = {0x37, 0xCE, 0x49, 0x54, 0x20, 0x83},
|
||||
.packed_payload = {0x86, 0x1A, 0xA4, 0x92, 0x6C, 0x67},
|
||||
};
|
||||
|
||||
static void test_encode_iidx_09_black_dongle()
|
||||
{
|
||||
struct security_rp_eeprom result;
|
||||
|
||||
security_rp_generate_signed_eeprom_data(&boot_version_iidx_09_to_13,
|
||||
boot_seeds_iidx_09, &black_plug_mcode_iidx_09, &security_id_default,
|
||||
&result);
|
||||
|
||||
check_data_eq((void*) &exp_iidx_09_black_eeprom,
|
||||
sizeof(struct security_rp_eeprom), (void*) &result,
|
||||
sizeof(struct security_rp_eeprom));
|
||||
}
|
||||
|
||||
static void test_encode_iidx_10_black_dongle()
|
||||
{
|
||||
struct security_rp_eeprom result;
|
||||
|
||||
security_rp_generate_signed_eeprom_data(&boot_version_iidx_09_to_13,
|
||||
boot_seeds_iidx_10, &black_plug_mcode_iidx_10, &security_id_default,
|
||||
&result);
|
||||
|
||||
check_data_eq((void*) &exp_iidx_10_black_eeprom,
|
||||
sizeof(struct security_rp_eeprom), (void*) &result,
|
||||
sizeof(struct security_rp_eeprom));
|
||||
}
|
||||
|
||||
static void test_encode_iidx_11_black_dongle()
|
||||
{
|
||||
struct security_rp_eeprom result;
|
||||
|
||||
security_rp_generate_signed_eeprom_data(&boot_version_iidx_09_to_13,
|
||||
boot_seeds_iidx_11, &black_plug_mcode_iidx_11, &security_id_default,
|
||||
&result);
|
||||
|
||||
check_data_eq((void*) &exp_iidx_11_black_eeprom,
|
||||
sizeof(struct security_rp_eeprom), (void*) &result,
|
||||
sizeof(struct security_rp_eeprom));
|
||||
}
|
||||
|
||||
static void test_encode_iidx_12_black_dongle()
|
||||
{
|
||||
struct security_rp_eeprom result;
|
||||
|
||||
security_rp_generate_signed_eeprom_data(&boot_version_iidx_09_to_13,
|
||||
boot_seeds_iidx_12, &black_plug_mcode_iidx_12, &security_id_default,
|
||||
&result);
|
||||
|
||||
check_data_eq((void*) &exp_iidx_12_black_eeprom,
|
||||
sizeof(struct security_rp_eeprom), (void*) &result,
|
||||
sizeof(struct security_rp_eeprom));
|
||||
}
|
||||
|
||||
static void test_encode_iidx_13_black_dongle()
|
||||
{
|
||||
struct security_rp_eeprom result;
|
||||
|
||||
security_rp_generate_signed_eeprom_data(&boot_version_iidx_09_to_13,
|
||||
boot_seeds_iidx_13, &black_plug_mcode_iidx_13, &security_id_default,
|
||||
&result);
|
||||
|
||||
check_data_eq((void*) &exp_iidx_13_black_eeprom,
|
||||
sizeof(struct security_rp_eeprom), (void*) &result,
|
||||
sizeof(struct security_rp_eeprom));
|
||||
}
|
||||
|
||||
TEST_MODULE_BEGIN("security-rp")
|
||||
TEST_MODULE_TEST(test_encode_iidx_09_black_dongle)
|
||||
TEST_MODULE_TEST(test_encode_iidx_10_black_dongle)
|
||||
TEST_MODULE_TEST(test_encode_iidx_11_black_dongle)
|
||||
TEST_MODULE_TEST(test_encode_iidx_12_black_dongle)
|
||||
TEST_MODULE_TEST(test_encode_iidx_13_black_dongle)
|
||||
TEST_MODULE_END()
|
||||
@@ -0,0 +1,224 @@
|
||||
#include "security/id.h"
|
||||
#include "security/rp2.h"
|
||||
|
||||
#include "test/check.h"
|
||||
#include "test/test.h"
|
||||
|
||||
static const struct security_mcode boot_version_iidx_14 = {
|
||||
.header = SECURITY_MCODE_HEADER,
|
||||
.unkn = SECURITY_MCODE_UNKN_Q,
|
||||
.game = SECURITY_MCODE_GAME_IIDX_14,
|
||||
.region = SECURITY_MCODE_REGION_JAPAN,
|
||||
.cabinet = SECURITY_MCODE_CABINET_A,
|
||||
.revision = SECURITY_MCODE_REVISION_A,
|
||||
};
|
||||
|
||||
static const struct security_mcode boot_version_iidx_15 = {
|
||||
.header = SECURITY_MCODE_HEADER,
|
||||
.unkn = SECURITY_MCODE_UNKN_Q,
|
||||
.game = SECURITY_MCODE_GAME_IIDX_15,
|
||||
.region = SECURITY_MCODE_REGION_JAPAN,
|
||||
.cabinet = SECURITY_MCODE_CABINET_A,
|
||||
.revision = SECURITY_MCODE_REVISION_A,
|
||||
};
|
||||
|
||||
static const struct security_mcode boot_version_iidx_16 = {
|
||||
.header = SECURITY_MCODE_HEADER,
|
||||
.unkn = SECURITY_MCODE_UNKN_Q,
|
||||
.game = SECURITY_MCODE_GAME_IIDX_16,
|
||||
.region = SECURITY_MCODE_REGION_JAPAN,
|
||||
.cabinet = SECURITY_MCODE_CABINET_A,
|
||||
.revision = SECURITY_MCODE_REVISION_A,
|
||||
};
|
||||
|
||||
static const struct security_mcode boot_version_iidx_17 = {
|
||||
.header = SECURITY_MCODE_HEADER,
|
||||
.unkn = SECURITY_MCODE_UNKN_C,
|
||||
.game = SECURITY_MCODE_GAME_IIDX_17,
|
||||
.region = SECURITY_MCODE_REGION_JAPAN,
|
||||
.cabinet = SECURITY_MCODE_CABINET_A,
|
||||
.revision = SECURITY_MCODE_REVISION_A,
|
||||
};
|
||||
|
||||
static const struct security_mcode black_plug_mcode_iidx_14 = {
|
||||
.header = SECURITY_MCODE_HEADER,
|
||||
.unkn = SECURITY_MCODE_UNKN_Q,
|
||||
.game = SECURITY_MCODE_GAME_IIDX_14,
|
||||
.region = SECURITY_MCODE_REGION_JAPAN,
|
||||
.cabinet = SECURITY_MCODE_CABINET_A,
|
||||
.revision = SECURITY_MCODE_FIELD_NULL,
|
||||
};
|
||||
|
||||
static const struct security_mcode black_plug_mcode_iidx_15 = {
|
||||
.header = SECURITY_MCODE_HEADER,
|
||||
.unkn = SECURITY_MCODE_UNKN_Q,
|
||||
.game = SECURITY_MCODE_GAME_IIDX_15,
|
||||
.region = SECURITY_MCODE_REGION_JAPAN,
|
||||
.cabinet = SECURITY_MCODE_CABINET_A,
|
||||
.revision = SECURITY_MCODE_FIELD_NULL,
|
||||
};
|
||||
|
||||
static const struct security_mcode black_plug_mcode_iidx_16 = {
|
||||
.header = SECURITY_MCODE_HEADER,
|
||||
.unkn = SECURITY_MCODE_UNKN_Q,
|
||||
.game = SECURITY_MCODE_GAME_IIDX_16,
|
||||
.region = SECURITY_MCODE_REGION_JAPAN,
|
||||
.cabinet = SECURITY_MCODE_CABINET_A,
|
||||
.revision = SECURITY_MCODE_FIELD_NULL,
|
||||
};
|
||||
|
||||
static const struct security_mcode black_plug_mcode_iidx_17 = {
|
||||
.header = SECURITY_MCODE_HEADER,
|
||||
.unkn = SECURITY_MCODE_UNKN_C,
|
||||
.game = SECURITY_MCODE_GAME_IIDX_17,
|
||||
.region = SECURITY_MCODE_REGION_JAPAN,
|
||||
.cabinet = SECURITY_MCODE_CABINET_A,
|
||||
.revision = SECURITY_MCODE_FIELD_NULL,
|
||||
};
|
||||
|
||||
static const struct security_rp2_eeprom exp_iidx_14_black_eeprom = {
|
||||
.signature = {0x17, 0xC6, 0x2B, 0x6A, 0xDA, 0x29},
|
||||
.packed_payload = {0x67, 0x7C, 0xB2, 0xA4, 0x1A, 0x82},
|
||||
};
|
||||
|
||||
static const struct security_rp2_eeprom exp_iidx_15_black_eeprom = {
|
||||
.signature = {0xCE, 0xF8, 0xC7, 0xEF, 0xA6, 0xDF},
|
||||
.packed_payload = {0x67, 0x8C, 0x92, 0xA4, 0x1A, 0x82},
|
||||
};
|
||||
|
||||
static const struct security_rp2_eeprom exp_iidx_16_black_eeprom = {
|
||||
.signature = {0xE0, 0x58, 0xDA, 0xE4, 0x61, 0xF9},
|
||||
.packed_payload = {0x67, 0x9C, 0x42, 0x90, 0x1A, 0x82},
|
||||
};
|
||||
|
||||
static const struct security_rp2_eeprom exp_iidx_17_black_eeprom = {
|
||||
.signature = {0xC3, 0x4B, 0xF8, 0xAA, 0xC1, 0x3E},
|
||||
.packed_payload = {0xE7, 0xA8, 0x92, 0xAA, 0x1A, 0x82},
|
||||
};
|
||||
|
||||
static const struct security_rp2_eeprom exp_iidx_14_white_eeprom = {
|
||||
.signature = {0x45, 0xF7, 0xE3, 0x4C, 0x59, 0xE0},
|
||||
.packed_payload = {0x20, 0x08, 0x82, 0x20, 0x08, 0x82},
|
||||
};
|
||||
|
||||
static const struct security_rp2_eeprom exp_iidx_15_white_eeprom = {
|
||||
.signature = {0x45, 0xF7, 0xE3, 0x4C, 0x59, 0xE0},
|
||||
.packed_payload = {0x20, 0x08, 0x82, 0x20, 0x08, 0x82},
|
||||
};
|
||||
|
||||
static const struct security_rp2_eeprom exp_iidx_16_white_eeprom = {
|
||||
.signature = {0x45, 0xF7, 0xE3, 0x4C, 0x59, 0xE0},
|
||||
.packed_payload = {0x20, 0x08, 0x82, 0x20, 0x08, 0x82},
|
||||
};
|
||||
|
||||
static const struct security_rp2_eeprom exp_iidx_17_white_eeprom = {
|
||||
.signature = {0x45, 0xF7, 0xE3, 0x4C, 0x59, 0xE0},
|
||||
.packed_payload = {0x20, 0x08, 0x82, 0x20, 0x08, 0x82},
|
||||
};
|
||||
|
||||
static void test_encode_iidx_14_black_dongle()
|
||||
{
|
||||
struct security_rp2_eeprom result;
|
||||
|
||||
security_rp2_generate_signed_eeprom_data(SECURITY_RP_UTIL_RP_TYPE_BLACK,
|
||||
&boot_version_iidx_14, &black_plug_mcode_iidx_14, &security_id_default,
|
||||
&result);
|
||||
|
||||
check_data_eq((void*) &result, sizeof(struct security_rp2_eeprom),
|
||||
(void*) &exp_iidx_14_black_eeprom, sizeof(struct security_rp2_eeprom));
|
||||
}
|
||||
|
||||
static void test_encode_iidx_14_white_dongle()
|
||||
{
|
||||
struct security_rp2_eeprom result;
|
||||
|
||||
security_rp2_generate_signed_eeprom_data(SECURITY_RP_UTIL_RP_TYPE_WHITE,
|
||||
&boot_version_iidx_14, &security_mcode_eamuse, &security_id_default,
|
||||
&result);
|
||||
|
||||
check_data_eq((void*) &result, sizeof(struct security_rp2_eeprom),
|
||||
(void*) &exp_iidx_14_white_eeprom, sizeof(struct security_rp2_eeprom));
|
||||
}
|
||||
|
||||
static void test_encode_iidx_15_black_dongle()
|
||||
{
|
||||
struct security_rp2_eeprom result;
|
||||
|
||||
security_rp2_generate_signed_eeprom_data(SECURITY_RP_UTIL_RP_TYPE_BLACK,
|
||||
&boot_version_iidx_15, &black_plug_mcode_iidx_15, &security_id_default,
|
||||
&result);
|
||||
|
||||
check_data_eq((void*) &result, sizeof(struct security_rp2_eeprom),
|
||||
(void*) &exp_iidx_15_black_eeprom, sizeof(struct security_rp2_eeprom));
|
||||
}
|
||||
|
||||
static void test_encode_iidx_15_white_dongle()
|
||||
{
|
||||
struct security_rp2_eeprom result;
|
||||
|
||||
security_rp2_generate_signed_eeprom_data(SECURITY_RP_UTIL_RP_TYPE_WHITE,
|
||||
&boot_version_iidx_15, &security_mcode_eamuse, &security_id_default,
|
||||
&result);
|
||||
|
||||
check_data_eq((void*) &result, sizeof(struct security_rp2_eeprom),
|
||||
(void*) &exp_iidx_15_white_eeprom, sizeof(struct security_rp2_eeprom));
|
||||
}
|
||||
|
||||
static void test_encode_iidx_16_black_dongle()
|
||||
{
|
||||
struct security_rp2_eeprom result;
|
||||
|
||||
security_rp2_generate_signed_eeprom_data(SECURITY_RP_UTIL_RP_TYPE_BLACK,
|
||||
&boot_version_iidx_16, &black_plug_mcode_iidx_16, &security_id_default,
|
||||
&result);
|
||||
|
||||
check_data_eq((void*) &result, sizeof(struct security_rp2_eeprom),
|
||||
(void*) &exp_iidx_16_black_eeprom, sizeof(struct security_rp2_eeprom));
|
||||
}
|
||||
|
||||
static void test_encode_iidx_16_white_dongle()
|
||||
{
|
||||
struct security_rp2_eeprom result;
|
||||
|
||||
security_rp2_generate_signed_eeprom_data(SECURITY_RP_UTIL_RP_TYPE_WHITE,
|
||||
&boot_version_iidx_16, &security_mcode_eamuse, &security_id_default,
|
||||
&result);
|
||||
|
||||
check_data_eq((void*) &result, sizeof(struct security_rp2_eeprom),
|
||||
(void*) &exp_iidx_16_white_eeprom, sizeof(struct security_rp2_eeprom));
|
||||
}
|
||||
|
||||
static void test_encode_iidx_17_black_dongle()
|
||||
{
|
||||
struct security_rp2_eeprom result;
|
||||
|
||||
security_rp2_generate_signed_eeprom_data(SECURITY_RP_UTIL_RP_TYPE_BLACK,
|
||||
&boot_version_iidx_17, &black_plug_mcode_iidx_17, &security_id_default,
|
||||
&result);
|
||||
|
||||
check_data_eq((void*) &result, sizeof(struct security_rp2_eeprom),
|
||||
(void*) &exp_iidx_17_black_eeprom, sizeof(struct security_rp2_eeprom));
|
||||
}
|
||||
|
||||
static void test_encode_iidx_17_white_dongle()
|
||||
{
|
||||
struct security_rp2_eeprom result;
|
||||
|
||||
security_rp2_generate_signed_eeprom_data(SECURITY_RP_UTIL_RP_TYPE_WHITE,
|
||||
&boot_version_iidx_17, &security_mcode_eamuse, &security_id_default,
|
||||
&result);
|
||||
|
||||
check_data_eq((void*) &result, sizeof(struct security_rp2_eeprom),
|
||||
(void*) &exp_iidx_17_white_eeprom, sizeof(struct security_rp2_eeprom));
|
||||
}
|
||||
|
||||
TEST_MODULE_BEGIN("security-rp2")
|
||||
TEST_MODULE_TEST(test_encode_iidx_14_black_dongle)
|
||||
TEST_MODULE_TEST(test_encode_iidx_14_white_dongle)
|
||||
TEST_MODULE_TEST(test_encode_iidx_15_black_dongle)
|
||||
TEST_MODULE_TEST(test_encode_iidx_15_white_dongle)
|
||||
TEST_MODULE_TEST(test_encode_iidx_16_black_dongle)
|
||||
TEST_MODULE_TEST(test_encode_iidx_16_white_dongle)
|
||||
TEST_MODULE_TEST(test_encode_iidx_17_black_dongle)
|
||||
TEST_MODULE_TEST(test_encode_iidx_17_white_dongle)
|
||||
TEST_MODULE_END()
|
||||
@@ -0,0 +1,61 @@
|
||||
#include "security/rp3.h"
|
||||
#include "security/rp-sign-key.h"
|
||||
|
||||
#include "test/check.h"
|
||||
#include "test/test.h"
|
||||
|
||||
static const struct security_mcode black_plug_mcode_jubeat = {
|
||||
.header = SECURITY_MCODE_HEADER,
|
||||
.unkn = SECURITY_MCODE_UNKN_C,
|
||||
.game = SECURITY_MCODE_GAME_JB_1,
|
||||
.region = SECURITY_MCODE_REGION_JAPAN,
|
||||
.cabinet = SECURITY_MCODE_CABINET_A,
|
||||
.revision = SECURITY_MCODE_REVISION_B,
|
||||
};
|
||||
|
||||
static const struct security_rp3_eeprom exp_jubeat_black_eeprom = {
|
||||
.signature = {0x73, 0x66, 0xBA, 0xBD, 0xDE, 0x36},
|
||||
.packed_payload = {0xE7, 0x88, 0x52, 0x94, 0x1A, 0x8A},
|
||||
.zeros = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
.crc = 0xA3,
|
||||
};
|
||||
|
||||
static const struct security_rp3_eeprom exp_jubeat_white_eeprom = {
|
||||
.signature = {0x43, 0x17, 0xB4, 0x2A, 0x3E, 0x87},
|
||||
.packed_payload = {0x20, 0x08, 0x82, 0x20, 0x08, 0x82},
|
||||
.zeros = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
.crc = 0x94,
|
||||
};
|
||||
|
||||
static void test_mcode_encode_black_dongle_jubeat()
|
||||
{
|
||||
struct security_rp3_eeprom result;
|
||||
|
||||
security_rp3_generate_signed_eeprom_data(SECURITY_RP_UTIL_RP_TYPE_BLACK,
|
||||
&security_rp_sign_key_black_gfdmv4, &black_plug_mcode_jubeat,
|
||||
&security_id_default, &result);
|
||||
|
||||
check_data_eq((void*) &exp_jubeat_black_eeprom,
|
||||
sizeof(struct security_rp3_eeprom), (void*) &result,
|
||||
sizeof(struct security_rp3_eeprom));
|
||||
}
|
||||
|
||||
static void test_mcode_encode_white_dongle_jubeat()
|
||||
{
|
||||
struct security_rp3_eeprom result;
|
||||
|
||||
security_rp3_generate_signed_eeprom_data(SECURITY_RP_UTIL_RP_TYPE_WHITE,
|
||||
&security_rp_sign_key_white_eamuse, &security_mcode_eamuse,
|
||||
&security_id_default, &result);
|
||||
|
||||
check_data_eq((void*) &exp_jubeat_white_eeprom,
|
||||
sizeof(struct security_rp3_eeprom), (void*) &result,
|
||||
sizeof(struct security_rp3_eeprom));
|
||||
}
|
||||
|
||||
TEST_MODULE_BEGIN("security-rp3")
|
||||
TEST_MODULE_TEST(test_mcode_encode_black_dongle_jubeat)
|
||||
TEST_MODULE_TEST(test_mcode_encode_white_dongle_jubeat)
|
||||
TEST_MODULE_END()
|
||||
@@ -0,0 +1,72 @@
|
||||
#include "security/mcode.h"
|
||||
#include "security/util.h"
|
||||
|
||||
#include "test/check.h"
|
||||
#include "test/test.h"
|
||||
|
||||
static const struct security_mcode black_plug_mcode_jubeat = {
|
||||
.header = SECURITY_MCODE_HEADER,
|
||||
.unkn = SECURITY_MCODE_UNKN_C,
|
||||
.game = SECURITY_MCODE_GAME_JB_1,
|
||||
.region = SECURITY_MCODE_REGION_JAPAN,
|
||||
.cabinet = SECURITY_MCODE_CABINET_A,
|
||||
.revision = SECURITY_MCODE_REVISION_B,
|
||||
};
|
||||
|
||||
static void test_mcode_encode_decode_eamuse()
|
||||
{
|
||||
uint8_t buffer[8];
|
||||
uint8_t result[8];
|
||||
|
||||
security_util_8_to_6_encode((const uint8_t*) &security_mcode_eamuse, buffer);
|
||||
security_util_6_to_8_decode(buffer, result);
|
||||
|
||||
check_data_eq(result, sizeof(result), &security_mcode_eamuse,
|
||||
sizeof(security_mcode_eamuse));
|
||||
}
|
||||
|
||||
static void test_mcode_encode_decode_jubeat()
|
||||
{
|
||||
uint8_t buffer[8];
|
||||
uint8_t result[8];
|
||||
|
||||
security_util_8_to_6_encode((const uint8_t*) &black_plug_mcode_jubeat,
|
||||
buffer);
|
||||
security_util_6_to_8_decode(buffer, result);
|
||||
|
||||
check_data_eq(result, sizeof(result), &black_plug_mcode_jubeat,
|
||||
sizeof(black_plug_mcode_jubeat));
|
||||
}
|
||||
|
||||
static void test_mcode_encode_decode_reverse_eamuse()
|
||||
{
|
||||
uint8_t buffer[8];
|
||||
uint8_t result[8];
|
||||
|
||||
security_util_8_to_6_encode_reverse((const uint8_t*) &security_mcode_eamuse,
|
||||
buffer);
|
||||
security_util_6_to_8_decode_reverse(buffer, result);
|
||||
|
||||
check_data_eq(result, sizeof(result), &security_mcode_eamuse,
|
||||
sizeof(security_mcode_eamuse));
|
||||
}
|
||||
|
||||
static void test_mcode_encode_decode_reverse_jubeat()
|
||||
{
|
||||
uint8_t buffer[8];
|
||||
uint8_t result[8];
|
||||
|
||||
security_util_8_to_6_encode_reverse(
|
||||
(const uint8_t*) &black_plug_mcode_jubeat, buffer);
|
||||
security_util_6_to_8_decode_reverse(buffer, result);
|
||||
|
||||
check_data_eq(result, sizeof(result), &black_plug_mcode_jubeat,
|
||||
sizeof(black_plug_mcode_jubeat));
|
||||
}
|
||||
|
||||
TEST_MODULE_BEGIN("security-util")
|
||||
TEST_MODULE_TEST(test_mcode_encode_decode_eamuse)
|
||||
TEST_MODULE_TEST(test_mcode_encode_decode_jubeat)
|
||||
TEST_MODULE_TEST(test_mcode_encode_decode_reverse_eamuse)
|
||||
TEST_MODULE_TEST(test_mcode_encode_decode_reverse_jubeat)
|
||||
TEST_MODULE_END()
|
||||
Reference in New Issue
Block a user