MOD5270 random number generator

Discussion to talk about hardware related topics only.
Post Reply
rmjoshi
Posts: 2
Joined: Wed Jan 05, 2011 6:34 am

MOD5270 random number generator

Post by rmjoshi »

Hello folks,
I've been trying to program the random number generator. The program itself is pretty simple:

sim.rng.rngcr = 0x00000007; // I've also tried other combinations, including setting just the GO bit

Then in the main program, I loop waiting for the status register to indicate that a number is available.
However, I never see the status register (sim.rng.rngsr) anything but 0 always.

I've checked the actual addresses that sim.rng.rngcr and sim.rng.rngsr map to, and they seem correct:
address of rngcr: 0x401a0000
address of rngsr: 0x401a0004

Does anyone have pointers as to what I'm missing? It's almost as if the hw is not initialized correctly, but I don't know what I'm missing from the initialization step - its pretty basic. Appreciate any help.

Regards,
User avatar
pbreed
Posts: 1088
Joined: Thu Apr 24, 2008 3:58 pm

Re: MOD5270 random number generator

Post by pbreed »

Its a MCF5270, not a MCF5271, the 5270 has the Random number generator disabled.
If we ship a product with hardware random numbers or cryptography its an ITAR controlled object and we need a license to export.
So no hardware random in ANY of the current NetBurner products.

(This is not something we turn off, the CPU comes that way from freescale and I believe it is set by the hardware chip bondout inside the die)


Paul
User avatar
lgitlitz
Posts: 331
Joined: Wed Apr 23, 2008 11:43 am
Location: San Diego, CA
Contact:

Re: MOD5270 random number generator

Post by lgitlitz »

Paul explained about ITAR limiting NetBurner from shipping processors with hardware cryptography in our standard products. I am pretty sure every product that NetBurner currently ships has a pin/package equivalent processor with the hardware cryptography peripheral. If you are only doing a handful of products you can just purchase this processor from a distributor and have a BGA capable design house swap the CPUs. If you are looking for larger quantities then you should inquire with NetBurner sales about custom order possibilities. I work on the Engineering side of NetBurner so I am not familiar with any specifics of custom orders of this type.
rmjoshi
Posts: 2
Joined: Wed Jan 05, 2011 6:34 am

Re: MOD5270 random number generator

Post by rmjoshi »

Thank you for your prompt response and clarification. Regards,
User avatar
lgitlitz
Posts: 331
Joined: Wed Apr 23, 2008 11:43 am
Location: San Diego, CA
Contact:

Re: MOD5270 random number generator

Post by lgitlitz »

Just wanted to add that there are functions available in the NNDK for getting pseudo-random numbers. Look at the functions in the following header (C:\nburn\include\random.h). For most applications the random numbers generated here should work. The software generated random numbers are created by capturing the least significant bits of the hardware timer used for the OS Tick, this timer is running at 75MHz on the 5270. Anytime an interrupt occurs on a UART or on the Ethernet peripheral the least significant byte of the timer is pushed into a 256 byte FIFO. Then when one of the getRandom functions is called a MD5 hash of this FIFO along with previous hashes is made to generate the random number. You can also call the random_seed(); function anywhere in your application where it would be a good place to add another timer capture to the FIFO. If you are using Ethernet and/or the UARTs this should generate good enough random numbers where it will be extremely difficult to predict future numbers. There are some things you can do to increase the randomness like pinging remote servers before you get a random number. You actually should ping a few remote servers at initialization before you start using any random numbers since right after boot the numbers will be the least random. The NNDK SSL/SSH add-on has a more complex pseudo-random number algorithm which is required for the encryption.

-Larry
Post Reply