Editing Kirk

Jump to navigation Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 934: Line 934:


== Command 0xF: Seed RNG buffer ==
== Command 0xF: Seed RNG buffer ==
This function seeds the Kirk 32-byte RNG buffer used to generate all the random data coming from Kirk.
This function seeds the Kirk RNG buffer used to generate all the random data coming from Kirk.


It takes as an input and output data of size 0x1c:
It takes as an input and output data of size 0x1c:


* 0x00 - 64-bit counter - increased by 1 in the output
* 0x00 - unknown - modified by an unknown opcode
* 0x08 - seed data (0x14 bytes long) - used for seeding as an input, and contains fresh reseeded data for the output
* 0x04 - counter - increased by 1 in the output
* 0x08 - seed data - used for seeding, and contains fresh reseeded data for the output


Seeding works this way:
Seeding works this way:


# Increment the input counter
# Increase input counter and do unknown operation on offset 0x00
# Set the first 0x14 bytes of the PRNG seed to the input seed data, XOR'ed with a SHA1 of data coming from a true random number generator
# Set the PRNG seed to the input seed data, XOR'ed with a SHA1 of data coming from a true random number generator
# Initialize the 32-byte RNG buffer to two empty words, and two words taken from the input data at offsets 0x00 and 0x04
# Initialize RNG buffer to two empty words, and then output data at offsets 0x00 and 0x04
# Do a reseeding (see below)
# Do a reseeding
# Output the bytes contained in the first 0x14 bytes of the PRNG seed after the reseeding
# Output resulting buffer.


Reseeding is then done by all operations requiring random data and works this way:
Reseeding is then done by all operations requiring random data and works this way:


# Encrypt RNG buffer with AES per-console key with seed 6
# Encrypt RNG buffer with AES per-console key with seed 6
# Set the last half of the PRNG seed (0x14 bytes) to the contents RNG buffer
# Reseed the PRNG with the RNG buffer
# Regenerate data with the PRNG
# Regenerate data with the PRNG
The functions requiring random data then use some parts of the PRNG state ("seed" (first 0x28 bytes of the PRNG state) or "result" (last 0x14 bytes of the PRNG state)) as random data to be used.


== Command 0x10: ECDSA signature generation ==
== Command 0x10: ECDSA signature generation ==
Please note that all contributions to PSP Developer wiki are considered to be released under the GNU Free Documentation License 1.2 (see PSP Developer wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following hCaptcha:

Cancel Editing help (opens in new window)