Previous 199869 Revisions Next

r34456 Sunday 18th January, 2015 at 12:27:54 UTC by Andreas Naive
Updates to SEGA's 315-5881 encryption based on new findings from Virtua Striker 2 '98 (Model3) [Andreas Naive]
[src/mame/drivers]naomi.c
[src/mame/machine]315-5881_crypt.c naomicrypt.c

trunk/src/mame/drivers/naomi.c
r242967r242968
60146014   ROM_LOAD( "wk1ma10.4c",  0xa000000, 0x1000000, CRC(e96f312c) SHA1(0a92640277111aef5c6e9dab4218a8ae2196ce61) )
60156015
60166016   ROM_REGION( 4, "rom_key", 0 )
6017   ROM_LOAD( "wldkicks-key.bin", 0, 4, CRC(c1e3000b) SHA1(36c2546833effe9452e2b3f7d31335fc5e349f49) )
6017   ROM_LOAD( "wldkicks-key.bin", 0, 4, CRC(1708ebb9) SHA1(c1115e4dd675f10d5fb41f57c1eea8e6a4f09fed) )
60186018ROM_END
60196019
60206020ROM_START( wldkicksa )
r242967r242968
60366036   ROM_LOAD( "wk1ma10.4c",  0xa000000, 0x1000000, CRC(e96f312c) SHA1(0a92640277111aef5c6e9dab4218a8ae2196ce61) )
60376037
60386038   ROM_REGION( 4, "rom_key", 0 )
6039   ROM_LOAD( "wldkicks-key.bin", 0, 4, CRC(c1e3000b) SHA1(36c2546833effe9452e2b3f7d31335fc5e349f49) )
6039   ROM_LOAD( "wldkicks-key.bin", 0, 4, CRC(1708ebb9) SHA1(c1115e4dd675f10d5fb41f57c1eea8e6a4f09fed) )
60406040ROM_END
60416041
60426042ROM_START( wldkicksb )
r242967r242968
60586058   ROM_LOAD( "wk1ma10.4c",  0xa000000, 0x1000000, CRC(e96f312c) SHA1(0a92640277111aef5c6e9dab4218a8ae2196ce61) )
60596059
60606060   ROM_REGION( 4, "rom_key", 0 )
6061   ROM_LOAD( "wldkicks-key.bin", 0, 4, CRC(c1e3000b) SHA1(36c2546833effe9452e2b3f7d31335fc5e349f49) )
6061   ROM_LOAD( "wldkicks-key.bin", 0, 4, CRC(1708ebb9) SHA1(c1115e4dd675f10d5fb41f57c1eea8e6a4f09fed) )
60626062ROM_END
60636063
60646064ROM_START( toukon4 )
r242967r242968
60856085   ROM_LOAD( "trf1ma15.6l", 0xf000000, 0x1000000, CRC(42d318c5) SHA1(f9fe82ffbfc51fcb52333f94c55a7092e7124fb4) )
60866086
60876087   ROM_REGION( 4, "rom_key", 0 )
6088   ROM_LOAD( "tr4ae-key.bin", 0x000000, 0x000004, CRC(986a7cee) SHA1(70c3ff80f86de6a0655251658c66a156fb644995) )
6088   ROM_LOAD( "tr4ae-key.bin", 0x000000, 0x000004, CRC(1708ebb9) SHA1(c1115e4dd675f10d5fb41f57c1eea8e6a4f09fed) )
60896089ROM_END
60906090
60916091ROM_START( ninjaslt )
r242967r242968
78057805   ROM_LOAD( "mpr-23662.ic11", 0xa800000, 0x0800000, CRC(d6ef7d68) SHA1(4ee396af6c5caf4c5af6e9ad0e03a7ac2c5039f4) )
78067806
78077807   ROM_REGION( 4, "rom_key", 0 )
7808   ROM_LOAD( "vstrik3c-key.bin", 0, 4, CRC(049f41b0) SHA1(4ea444878c8e9288ec95b1763d48bc92c634acdd) )
7808   ROM_LOAD( "vstrik3c-key.bin", 0, 4, CRC(8c9012fe) SHA1(d81e00d6377a3f0eeed01dc523707e36ca1b434d) )
78097809ROM_END
78107810
78117811ROM_START( vstrik3cb )
r242967r242968
78277827   ROM_LOAD( "mpr-23662.ic11", 0xa800000, 0x0800000, CRC(d6ef7d68) SHA1(4ee396af6c5caf4c5af6e9ad0e03a7ac2c5039f4) )
78287828
78297829   ROM_REGION( 4, "rom_key", 0 )
7830   ROM_LOAD( "vstrik3c-key.bin", 0, 4, CRC(049f41b0) SHA1(4ea444878c8e9288ec95b1763d48bc92c634acdd) )
7830   ROM_LOAD( "vstrik3c-key.bin", 0, 4, CRC(8c9012fe) SHA1(d81e00d6377a3f0eeed01dc523707e36ca1b434d) )
78317831ROM_END
78327832
78337833ROM_START( wldrider )
r242967r242968
78707870   ROM_LOAD( "mpr-23784.ic11", 0xa800000, 0x1000000, CRC(f74f2fee) SHA1(84b07baa6d116727e66ef27e24ba6484c3393891) )
78717871
78727872   ROM_REGION( 4, "rom_key", 0 )
7873   ROM_LOAD( "vf4cart-key.bin", 0, 4, CRC(22838e16) SHA1(afee674dce3cfdd20360c30da2da5ba69f8d4682) )
7873   ROM_LOAD( "vf4cart-key.bin", 0, 4, CRC(aa8cdd58) SHA1(e282b7d215044a005b50c8553b8056f3d599135c) )
78747874ROM_END
78757875
78767876// There is also a development cart (171-7885A) with 20x 64Mb FlashROMs instead of 10x 128Mb MaskROMs. Content is the same.
trunk/src/mame/machine/315-5881_crypt.c
r242967r242968
121121The encryption is done by a stream cipher operating in counter mode, which use a 16-bits internal block cipher.
122122
123123There are 2 "control bits" at the start of the decrypted stream which control the mode of operation: bit #1 set to 1 means
124that the decrypted stream needs to be decompressed after being decrypted. More on this later.
124that the stream needs to be decompressed after being decrypted. More on this later.
125125
126126The next 16-bits are part of the header (they don't belong to the plaintext), but his meaning is unclear. It has been
127127conjectured that it could stablish when to "reset" the process and start processing a new stream (based on some tests
r242967r242968
134134given plaintext word, and the remaining 2 to the next plaintext word.
135135
136136The underlying block cipher consists of two 4-round Feistel Networks (FN): the first one takes the counter (16 bits),
137the game-key (>=26 bits) and the sequence-key (16 bits) and output a middle result (16 bits) which will act as another key
137the game-key (>=27 bits) and the sequence-key (16 bits) and output a middle result (16 bits) which will act as another key
138138for the second one. The second FN will take the encrypted word (16 bits), the game-key, the sequence-key and the result
139139from the first FN and will output the decrypted word (16 bits).
140140
141Each round of the Feistel Networks use four substitution sboxes, each having 6 inputs and 2 outputs. The input can be the
142XOR of at most two "sources bits", being source bits the bits from the previous round and the bits from the different keys.
141Each round of the Feistel Networks use four substitution sboxes, each having 6 inputs and 2 outputs. The input is the
142XOR of at most one bit from the previous round and at most one bit from the different keys.
143143
144144The underlying block cipher has the same structure than the one used by the CPS-2 (Capcom Play System 2) and,
145145indeed, some of the used sboxes are exactly the same and appear in the same FN/round in both systems (this is not evident,
r242967r242968
151151some (encrypted word-decrypted word) pairs suffice. However, due to the weak key scheduling, it should be noted that some
152152related keys can produce the same output bytes for some (short) input sequences.
153153
154The only difference in the decryption process between M2 and M3 is the initialization of the counter. In M3, the counter is
155always set to 0 at the beginning of the decryption while, in M2, the bits #1-#16 of the ciphertext's address are used
156to initialize the counter.
157
158154Note that this implementation considers that the counter initialization for ram decryption is 0 simply because the ram is
159155mapped to multiples of 128K.
160156
r242967r242968
164160chosen so as to make the key for CAPSNK equal to 0.
165161
166162It can be observed that a couple of sboxes have incomplete tables (a 255 value indicate an unknown value). The recovered keys
167as of december/2010 show small randomness and big correlations, making possible that some unseen bits could make the
163as of january/2015 show small randomness and big correlations, making possible that some unseen bits could make the
168164decryption need those incomplete parts.
169165
170166****************************************************************************************/
r242967r242968
478474   {1,29},  {1,71},  {2,4},   {2,54},  {3,8},   {4,56},  {4,73},  {5,11},
479475   {6,51},  {7,92},  {8,89},  {9,9},   {9,10},  {9,39},  {9,41},  {9,58},
480476   {9,59},  {9,86},  {10,90}, {11,6},  {12,64}, {13,49}, {14,44}, {15,40},
481   {16,69}, {17,15}, {18,23}, {18,43}, {19,82}, {20,81}, {21,32}, {21,61},
482   {22,5},  {23,66}, {24,13}, {24,45}, {25,12}, {25,35}
477    {16,69}, {17,15}, {18,23}, {18,43}, {19,82}, {20,81}, {21,32}, {22,5},
478   {23,66}, {24,13}, {24,45}, {25,12}, {25,35}, {26,61},
483479};
484480
485481const int sega_315_5881_crypt_device::fn2_game_key_scheduling[34][2] = {
486482   {0,0},   {1,3},   {2,11},  {3,20},  {4,22},  {5,23},  {6,29},  {7,38},
487483   {8,39},  {9,47},  {9,55},  {9,86},  {9,87},  {9,90},  {10,50}, {10,53},
488484   {11,57}, {12,59}, {13,61}, {13,64}, {14,63}, {15,67}, {16,72}, {17,83},
489   {18,88}, {19,94}, {20,35}, {21,17}, {21,92}, {22,6},  {22,11}, {23,85},
490   {24,16}, {25,25}
485    {18,88}, {19,94}, {20,35}, {21,17}, {22,6},  {22,11}, {23,85}, {24,16},
486   {25,25}, {26,92}
491487};
492488
493489const int sega_315_5881_crypt_device::fn1_sequence_key_scheduling[20][2] = {
trunk/src/mame/machine/naomicrypt.c
r242967r242968
2828{
2929   // name             key              gameid #         year
3030// M2
31   { "wldkicks",        0x00ae2901 }, // 25209801    2000
32   { "toukon4",         0x012e2901 }, // 25349801    2000
31   { "wldkicks",        0x052e2901 }, // 25209801    2000
32   { "toukon4",         0x052e2901 }, // 25349801    2000
3333   { "ninjaslt",        0x000ca510 }, // 25469801    2000
3434   { "ninjaslt4",       0x000ca510 }, // 25469801    2000
3535   { "gunsur2e",        0x000680d0 }, // 25709801    2001
r242967r242968
6868   { "alienfnt",        0x00174343 }, // 840-0048    2001
6969   { "alienfnta",       0x00174343 }, // 840-0048    2001
7070   { "crackdj2",        0x00428247 }, // 840-0068    2001
71   { "vf4cart",         0x02ef2f96 }, // 840-0080    2002
71   { "vf4cart",         0x06ef2f92 }, // 840-0080    2002
7272   { "pstone",          0x000e69c1 }, // 841-0001    1999
7373   { "suchie3",         0x000368e1 }, // 841-0002    1999
7474   { "doa2",            0x0008ad01 }, // 841-0003    1999


Previous 199869 Revisions Next


© 1997-2024 The MAME Team