Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: ee511 on March 20, 2011, 03:05:02 pm

Title: Program DRM?
Post by: ee511 on March 20, 2011, 03:05:02 pm
How would one create some sort of a way to keep people from sharing your calculator program? The easiest way to do this that i can think of is a program that creates an appvar with an encrypted version of the calculator's ID in it, and then in the main program I would have a decryption algorithm, but I don't know how to do that...  ???
Title: Re: Program DRM?
Post by: calcdude84se on March 20, 2011, 03:15:54 pm
There's the problem that you can change your calc's ID, because it's stored in flash. However, most people won't bother to mess with that, so it's probably a good start.
However, if you don't mind waiting, SirCmpwn's store idea (in the funding topic, IIRC) will probably include a DRM-type mechanism.
To get the ID to begin with, you'll need some ASM, which I don't exactly know. There's almost certainly a bcall for it, but otherwise you'll have to unlock flash.
Whatever en-/decryption method you use, be aware that you have to be able to prevent the user from simply changing the appvar to match their calc ID. A method like app signing (but with a secret key only you know) could work, but getting enough strength to prevent quick cracking is difficult if not impossible to do with good speed.
Title: Re: Program DRM?
Post by: ee511 on March 20, 2011, 03:19:58 pm
well, the people who would be playing my games *probably* aren't paying any attention in math class, so I highly doubt that they can crack an encryptio algorithm or create a program to modify their flash. Is there any unique data on a calculator that cant be changed?
Title: Re: Program DRM?
Post by: AngelFish on March 20, 2011, 03:23:23 pm
There is no unique data on a calculator that you can change that no one else can change.
Title: Re: Program DRM?
Post by: ee511 on March 20, 2011, 03:24:12 pm
I meant something that is a unique, unchangeable identifier of that particular calculator.
Title: Re: Program DRM?
Post by: calcdude84se on March 20, 2011, 03:27:11 pm
To my knowledge, there's no unique immutable data. If you don't think that they'd do things like hack appvars or bother to discover an encryption method, then a simple checksum (adding all the bytes together) of the calc ID is probably enough.
I don't know how to get the ID, so you'll just have to wait for someone who does and you should be set.
You program would, then, at start-up checksum the ID and compare it to the one in the appvar. If they're different, then it would quit.
You'd also need to write a small program to generate the appvar, but that's trivial once you have the ID :)
Title: Re: Program DRM?
Post by: ee511 on March 20, 2011, 03:46:11 pm
well, I would have a program that I would run when i gave them the program which would create the appvar, and then I could either delete the program, or (if at all possible) have the game delete the authentication program automatically the first time it ran.
Title: Re: Program DRM?
Post by: calcdude84se on March 20, 2011, 03:49:12 pm
Excellent, then :D Program deletion is possible in Axe using the DelVar command, btw.
Title: Re: Program DRM?
Post by: ee511 on March 20, 2011, 03:52:40 pm
so would the code be something like "DelVar prgmDRMAUTH"? and if the program "DRMAUTH" doesn't exist, what happens?
Title: Re: Program DRM?
Post by: calcdude84se on March 20, 2011, 03:56:41 pm
I think you need
Code: [Select]
DelVar "prgmDELETEME"(notice the quotes)
If it doesn't exist, nothing bad will happen. DelVar might return a success value, I'm not sure.
Title: Re: Program DRM?
Post by: ee511 on March 20, 2011, 03:59:47 pm
awesome! I knew I had to put quotes, but since i put the quotes around the code I had written, I didn't want to put quotes in.
Title: Re: Program DRM?
Post by: ztrumpet on March 21, 2011, 08:19:22 pm
ThePenguin went into a little bit of detail to explain how to fetch the calc's ID number here (http://ourl.ca/9398/179274).  Good luck. ;)
Title: Re: Program DRM?
Post by: thepenguin77 on March 21, 2011, 08:41:37 pm
Fill OP4 with some default value, (in case the calc has no ID (emulators)). Asm(EF7E80) then look in OP4 for the CalcID, it is 5 bytes long. (I don't know where OP4 is in Axe, but I'm sure you can find it, it's 8499h in memory.)
Title: Re: Program DRM?
Post by: jnesselr on March 21, 2011, 10:19:07 pm
What will it be filled with if it's an emulator?  Or will it just return?  Does this apply to the nSpire as well?
Title: Re: Program DRM?
Post by: thepenguin77 on March 21, 2011, 10:49:32 pm
I have no idea on the Nspire, that's in Ti/Calc84's hands.

If it's an emulator, it appears that it just returns, at least that's what it did when I just watched it in wabbitEmu. It returns NZ if it couldn't get the ID, but I don't know how to check that in Axe.
Title: Re: Program DRM?
Post by: ee511 on March 22, 2011, 04:39:57 pm
What's "op4"
Title: Re: Program DRM?
Post by: jnesselr on March 22, 2011, 04:42:05 pm
What's "op4"
It's a 11 byte location in memory.  There are OP1 through OP6.  Thy are used to store names, and such.  It's really an ASM thing.  Look here: http://wikiti.brandonw.net/index.php?title=83Plus:RAM:8478