I'm doing the Atmega Challenge

If your having problems with using the command line assembler (DOS) then i'd recommend you to install AVRStudio. Download for free direct from the Atmel website.
Accepts rubbish registration details on their website, lol. :sneaky:
 
@edds nice one.

; Check if its one of the allowed keychange EMM's and handle if it is.
RCALL CHKKEYMASK1
RCALL CHKKEYMASK2
RCALL CHKKEYMASK3 ; *** Suggest you disable this for PURE NTL ! ***
RCALL CHKKEYMASK4
RCALL CHKKEYMASK5
;*****************************************************
; Add call to your new keyroll method here !
;*****************************************************
[
Is this correct?


Next do i edit the following or is it there as an example?
; Keychange Method 5
;------------------------------------------------------------------------------------------------
;
; This is the new keyroll method as implemented on 14/08/06 by NTL/TW
;
;
; 3F -> Filter: ANY CARD
; 5A01 PROVIDER ID (Telewest (Cable))
;
; FA -> RUN CODE FOR ROM10:
; 3F41A602CD90E33F 4DA6B9B74EA60ECD 90E3A6ADB74EA60E CD90E3A621CC6B01
; 835B014205F29612 F4475D5100000000 3C8B73CE26E32600 BC4285BD
;
I think this is there as an example but just double checking, my provider is 5E01.
 
Accepts rubbish registration details on their website, lol. :sneaky:

Doesn't really matter as its free but if you want any device samples then a proper registration helps.

Some of the new XMega parts look really nice - Upto 256k of flash memory and 16k RAM with built in crypto engine for DES and AES (hmm wonder what you can use that for ;) ) plus runs at upto 30Mhz from a 5Mhz box clock - thats 6 times faster than an ATMega !
 
Ok
Now lets see if I am getting this right.
BYTES DUMP:
---------------------
00A1: 83 5D 01 42 05 E3 26 AE
00A9: 0C 2F FF 13 00 00 00 00
00B1: 70 EE 80 79 77 74 46 00
00B9: 70 42 85 28
if they do a key roll only the bold & underlined change.

But if they change the method you get something like this
BYTES DUMP:
---------------------
00A3: 00 00 00 83 55 01 42 05
00AB: 62 BD 22 0A C6 86 E5 93
00B3: 42 85 80 D4 D1 D3 80 90
00BB: FF 2B
And this is why I have to write a new method to find the keys?


A great man once said:eek:
I appreciate that most of you probably cant write assembly level code but that doesn't stop you asking questions or coming up with ideas. If you cant code then write out what you think needs to be done in plain English. This thread is all about trying to give you some insight into these cards and how they work and also to show you that although you may not be able to do it on your own you could probably do it as a group if your willing to put some effort in and give it a go !
 
Here are 2 EMMs 17/03/2009 first is a rom10 second rom7 might help someone.
Thanks goto Nozzer for doing most of the work
3F -> Filter: ANY CARD
5E01 PROVIDER ID (Chorus Primary)

FA -> RUN CODE FOR ROM10:
5FA6CEB741A6022D 079BCD20209A2003 CD20209FB8ACB7AC 9FB8B7B7B7A626CC
6B01000000835F01 4205CED72E878061 7490428562FA17F3 CE05FA79

DISASSEMBLY OF CODE:
------------------------------

0081: 5F clrx ; x <-- 0
0082: A6 CE lda #$CE ; Load in A
0084: B7 41 sta TEMPA ; Store A in...
0086: A6 02 lda #$02 ; Load in A
0088: 2D 07 bms $91 ; Branch if mask=1
008A: 9B sei ; I <-- 1
008B: CD 20 20 jsr $2020 ; Go to subroutine
008E: 9A cli ; I <-- 0
008F: 20 03 bra $94 ; Branch always
0091: CD 20 20 jsr $2020 ; Go to subroutine
0094: 9F txa ; X --> A
0095: B8 AC eor $AC ; A= A xor ...
0097: B7 AC sta $AC ; Store A in...
0099: 9F txa ; X --> A
009A: B8 B7 eor $B7 ; A= A xor ...
009C: B7 B7 sta $B7 ; Store A in...
009E: A6 26 lda #$26 ; Load in A
00A0: CC 6B 01 jmp $6B01 ; Jump

BYTES DUMP:
---------------------
00A3: 00 00 00 83 5F 01 42 05
00AB: CE D7 2E 87 80 61 74 90
00B3: 42 85 62 FA 17 F3 CE 05
00BB: FA 79
3F -> Filter: ANY CARD
5E01 PROVIDER ID (Chorus Primary)

F7 -> RUN CODE FOR ROM7:
5FA6F7B721A6022D 079BCD200F9A2003 CD200F9FB8ADB7AD 9FB8B6B7B6A626CC
48BB000000835F01 4205CE19D9878061 74904285620DD9F3 CE05FA79

DISASSEMBLY OF CODE:
------------------------------

0081: 5F clrx ; x <-- 0
0082: A6 F7 lda #$F7 ; Load in A
0084: B7 21 sta RC0ADDRH ; Store A in...
0086: A6 02 lda #$02 ; Load in A
0088: 2D 07 bms $91 ; Branch if mask=1
008A: 9B sei ; I <-- 1
008B: CD 20 0F jsr $200F ; Go to subroutine
008E: 9A cli ; I <-- 0
008F: 20 03 bra $94 ; Branch always
0091: CD 20 0F jsr $200F ; Go to subroutine
0094: 9F txa ; X --> A
0095: B8 AD eor $AD ; A= A xor ...
0097: B7 AD sta $AD ; Store A in...
0099: 9F txa ; X --> A
009A: B8 B6 eor $B6 ; A= A xor ...
009C: B7 B6 sta $B6 ; Store A in...
009E: A6 26 lda #$26 ; Load in A
00A0: CC 48 BB jmp FILTEROK ; 2


BYTES DUMP:
---------------------
00A3: 00 00 00 83 5F 01 42 05
00AB: CE 19 D9 87 80 61 74 90
00B3: 42 85 62 0D D9 F3 CE 05
00BB: FA 79
Please delete if not allowed here
 
The Atmega Challenge Help Please

Now I have a few of examples to play
_0 1 2 3 4 5 6 7 8 9 A B C D E F 101112131415161718191A1B1C1D1E1F 202122232425262728292A2B2C2D2E2F 303132333435363738393A3B3C3D3E3F
3F5A01FA3F41A602CD90E33F4DA6B9B7 4EA60ECD90E3A6ADB74EA60ECD90E3A6 21CC6B01835B014205F29612F4475D51 000000003C8B73CE26E32600BC4285BD
3F5C01FA3F41A602CD90E33F4DA6B9B7 4EA60ECD90E3A6ADB74EA60ECD90E3A6 21CC6B01835D014205E326AE0C2FFF13 0000000070EE80797774460070428528
3F5E01F75FA6F7B721A6022D079BCD20 0F9A2003CD200F9FB8ADB7AD9FB8B6B7 B6A626CC48BB000000835F014205CE19 D987806174904285620DD9F3CE05FA79
3F5E01FA5FA6CEB741A6022D079BCD20 209A2003CD20209FB8ACB7AC9FB8B7B7 B7A626CC6B01000000835F014205CED7 2E8780617490428562FA17F3CE05FA79
So The top 2 lines are no good to me.
_0 1 2 3 4 5 6 7 8 9 A B C D E F 101112131415161718191A1B1C1D1E1F 202122232425262728292A2B2C2D2E2F 303132333435363738393A3B3C3D3E3F

3F5E01F75FA6F7B721A6022D079BCD20 0F9A2003CD200F9FB8ADB7AD9FB8B6B7 B6A626CC48BB000000835F014205CE19 D987806174904285620DD9F3CE05FA79
3F5E01FA5FA6CEB741A6022D079BCD20 209A2003CD20209FB8ACB7AC9FB8B7B7 B7A626CC6B01000000835F014205CED7 2E8780617490428562FA17F3CE05FA79
Now I would like to break them down so I can understand what they do:

3F= filter any card.
5E 01= my provider.
F7 or FA or FB= type of rom.
bytes 5F to 6B 01 is the disassembly code?
bytes 00 00 00 00 83 to FA 79 are the dumped bytes?

Bytes in the dump are
00A3: 00 00 00 83 5F 01 42 05
00AB: CE D7 2E 87 80 61 74 90
00B3: 42 85 62 FA 17 F3 CE 05
00BB: FA 79
breaking them down.
00A3:00 00 00= dont know?? 5F 01= service provider/ 42 05= key 00
00AB:CE D7 2E 87 80 62 74 90 = keys.
00B3:42 85= key 01/ 62 FA 17 F3 CE 05=keys.
00BB:FA 79= keys.

Have I got that right??


Now i need to edit this

.DB 0x3F,0x00,0x01,0xFA,0x3F,0x41,0xA6,0x02
.DB 0xCD,0x90,0xE3,0x3F,0x4D,0xA6,0x00,0xB7
.DB 0x4E,0xA6,0x0E,0xCD,0x90,0xE3,0xA6,0x00
.DB 0xB7,0x4E,0xA6,0x0E,0xCD,0x90,0xE3,0xA6
.DB 0x21,0xCC,0x6B,0x01,0x83,0x00,0x01,0x00
.DB 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
.DB 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
.DB 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
In the above example byte 3=0xFA but on my lines it can be F7 FA or FB so should mine look like this
.DB 0x3F,0x5E,0x01,0x00,0x5F,0x41,0xA6,0x00
.DB 0xB7,0x00,0xA6,0x02,0x2D,0x07,0x9B,0xCD
.DB 0x20,0x00,0x00,0xA2,0x00,0x3C,0xCD,0x20
.DB 0x00,0x9F,0xFB,0x8A,0x00,0x7A,0x00,0xFB
.DB 0x8B,0x00,0x7B,0x00,0xA6,0x26,0xCC,0x00
.DB 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
.DB 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
.DB 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
In the above I also changed a few more to match my lines does this look right?
 
Last edited:
Re: The Atmega Challenge Help Please

Bytes in the dump arebreaking them down.
00A3:00 00 00= dont know?? 5F 01= service provider/ 42 05= key 00
00AB:CE D7 2E 87 80 62 74 90 = keys.
00B3:42 85= key 01/ 62 FA 17 F3 CE 05=keys.
00BB:FA 79= keys.

Part of the trick is to treat the dumped bytes as a seperate Emm. Once the code section of the Emm has completed its work (manipulating the actual key data) then it sets things up so that the card's Emm interpreter works on whats left.

so, with -

Code:
You don't have permission to view the code content. Log in or register now.

The Emm execution will be arranged so the Emm is interpreted from address $A6 (Thus the 00 00 00 are just irrelevant padding bytes) as can be seen from the following code.

Code:
You don't have permission to view the code content. Log in or register now.

If you take it that Emm execution starts at address $80, then the above is basically saying "i've executed the 1st $26 bytes so continue interpreting Emm Nano's from there" - ie $80 +$26 = $A6)

So, arranging things by Emm Nano code -

Code:
You don't have permission to view the code content. Log in or register now.

The 83 Nano tells the card that the rest of the Emm should be treated as if its for provider 5F01

the 42 Nano is the key update Nano. The next byte (05 or 85) describes which key is to be updated. 05=key0, 85=key1. The next 8 bytes are, of course, the key.

Note, in this explanation I have NOT taken into account the manipulations done by the initial code so the keys will NOT be correct.

The object of your ATMega code is to recognise the above nano's as being a keyroll AND to apply the manipulations of the initial code to this keyroll in order to get the real keys.
 
Last edited:
Re: The Atmega Challenge Help Please

Just looking back I think my DBs is wrong.
Because I have edited it for both types of rom, me thinks I would have to write RCALL CHKKEYMASK for each type of ROM. Please correct me if wrong.
Note, in this explanation I have NOT taken into account the manipulations done by the initial code so the keys will NOT be correct.
Spoted that only because I know what they should be. Is there something that explains what is going on in the "Disassembly Of Code" or do I not realy need to know?
 
Re: The Atmega Challenge Help Please

Just looking back I think my DBs is wrong.
Because I have edited it for both types of rom, me thinks I would have to write RCALL CHKKEYMASK for each type of ROM. Please correct me if wrong.

You stick with one type of Rom only. You will usually be building a card to simulate either a Rom10 or Rom11 but you'd rarely do both !

Is there something that explains what is going on in the "Disassembly Of Code" or do I not realy need to know?

The NagraFaq document explains about most of the Emm Nano's but when it comes to pure code then its basically down to a copy of the Rom10/11 disassembly and sheer hard slog !

In order to get the real keys you really need to know a good bit about what the code section is doing. Without this information you would find it difficult to simulate the system to end up with the real keys.
 
Re: The Atmega Challenge Help Please

The NagraFaq document explains about most of the Emm Nano's
Dont have that but found one by stuntguy is that it?
but when it comes to pure code then its basically down to a copy of the Rom10/11 disassembly and sheer hard slog !
Well thats all i needed to here:arrrr:
 
Re: The Atmega Challenge Help Please

Dont have that but found one by stuntguy is that it?

Yes, thats the thing. There's a text only version and a pdf version. The pdf is much easier for navigating around.

thats all i needed to here:arrrr:

Sorry, you dont get anything for nothing. ;)

First place to start is with the assembler pneumonics for the processor on the Rom10/11 card. Its very similar to a device from Motorola called the 68HC05. If you have a look around you should be able to find a user manual for this processor (may be Freescale - think Motorola spun the micro branch off as a seperate company at some point). The manual should have a list of pneumonics, what they do and the corresponding hex opcodes.

Once you've got a basic idea of the instruction set then you can take a look at the Rom10 disassembly by Gesinas to see how the card actually does things. The listing is also an essential part of understanding what the keyroll code is doing as it may often call subroutines within the Rom code itself.

Unfortunately, there's no way to get around having to know the basic instruction set for both the Rom10 card and your target processor (the Fun/ATMega card)
 
Last edited:
Re: The Atmega Challenge Help Please

First place to start is with the assembler pneumonics for the processor on the Rom10/11 card. Its very similar to a device from Motorola called the 68HC05
OK found this hope its the right one 68HC05 Memory Organization

While I am away reading the National Library:sleep: When we had the hits in April & November i was looking at the emm dumps I have & the softcam.key file on the dreambox I have noticed that if you could get at least 3 different sets of keys like the 3 byte dumps below you could work out what the correct combo was eg
Code:
You don't have permission to view the code content. Log in or register now.
Code:
You don't have permission to view the code content. Log in or register now.
Code:
You don't have permission to view the code content. Log in or register now.
Now here comes the Noobie question would it not be easyer to just take the dumps and do a quick check on each byte & when you get 2 that match from diff byte dumps thats the correct byte. Then put them all together & you have your set of keys?:slaps: Before anybody Shoots me I have done it manual.
 
A better 68HC05 introduction would be one of the device manuals directly from Motorola/Freescale.

http://www.freescale.com/files/microcontrollers/doc/data_sheet/MC68HC05C8A.pdf?pspll=1

Is a pretty good one. The periperals etc aren't really whats on the smartcard but the core processor is very very smilar.

If you have a look from about Page 71 then you'll get an idea of the instructions and what they do. The Rom10 listing will likely start to make a bit more sense to you then.

Your idea for the keyrolls is ok for manual use where you dont particularly understand what the code is doing but its not really a good way for an emulator/simulator to do things. Part of the reason for that is you would have to find somewhere to store all the information you are going to aquire from multiple Emm's and storage in Funcards especially is tight. Another reason would be time taken. Funcards/ATMega's already miss 3/4 of Emm's due to their slow Emm decrypt speed (about 8 secs, whilst Emm's arrive approx once every 2 secs). It could take considerable time to aquire the correct 3 Emm's
 
take a look at the Rom10 disassembly by Gesinas to see how the card actually does things. The listing is also an essential part of understanding what the keyroll code is doing as it may often call subroutines within the Rom code itself.
Anybody got a copy of this please?
 
Never mind found it.
Another bit of light reading JESUS|

Is anybody else doing this or am I on my own?
 
Never mind found it.
Another bit of light reading JESUS

You probably shouldn't try and get it all at once. You'll end up being very confused and not knowing what instruction is for which processor.

I'd advise you to start with the ATMega (Forget about card stuff initially). Download the AVRStudio package and start writing small test programs from scratch. Learn to use the tools and then learn what each processor instruction does (use the build in processor simulator). Once you've got the hang of that then your ready to look at the ATMega card programs and have a good idea of whats going on !

If you feel like really having a play then get yourself an ATMega test board (You can often find something suitable on ebay or you could just build one yourself). That way you can have the fun of watching LED's sequence or see things happen when you press a button etc. A board doesn't have to be complex - just enough to load your small test programs into and see them run.

A slightly more complex board might also link into AVRStudio in a fairly seamless way so you can program the chip from within the environment and possibly even single step your code etc via the jtag port.

Once you've had a play for a few weeks you'll soon get familiar with how things work. Then you can move onto the next stage !
 
You probably shouldn't try and get it all at once. You'll end up being very confused and not knowing what instruction is for which processor.
Yes was starting to get a nose bleed

If you feel like really having a play then get yourself an ATMega test board. A slightly more complex board might also link into AVRStudio in a fairly seamless way so you can program the chip from within the environment and possibly even single step your code etc via the jtag port.
Like this one? AVR JTAG ICE AVRISP ISP Programmer Emulator4 ATMEL V2 on eBay, also Assemblies EM Devices, Electronic Components, Electrical Test Equipment, Business Industrial (end time 26-Mar-09 05:02:22 GMT)
 

Thats basically just a Jtag/programmer device although its nice that it interfaces into AVRStudio. For experimenting you would still need a target device.

The target can be very simple though. I'd recommend something like an ATMega16 or 32 device (you can get those in the easy to handle DIL package). Slap it on some veroboard with a crystal and a few connectors etc, maybe a few LED's and a switch or two and you have a perfect device to learn with.

If you wanted to use the same device as in an ATMega card then go for the Mega163 (think its jtag enabled - need to check) but its very simialr to the Mega16/32 range.

You can usually buy these processors on ebay fairly cheaply
 
Back
Top