Kirk: Difference between revisions

From PSP Developer wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
The PSP KIRK Crypto Engine is a security hardware device that is embedded into the TACHYON main IC chip. It is a bus master and can DMA to/from main DDR RAM memory, operating independantly of the CPU. It is intefaced via memory mapped registers at base of 0xBDE00000 ([SPOCK Crypto Engine] on the other hand is mapped to 0xBDF00000). It is capable of performing AES encryption, decryption, SHA1 Hash, pseudo random number generation, and signature checks (OMAC and ECDSA).
The PSP KIRK Crypto Engine is a security hardware device that is embedded into the TACHYON main IC chip. It is a bus master and can DMA to/from main DDR RAM memory, operating independantly of the CPU. It is intefaced via memory mapped registers at base of 0xBDE00000 ([SPOCK Crypto Engine] on the other hand is mapped to 0xBDF00000). It is capable of performing AES encryption, decryption, SHA1 Hash, pseudo random number generation, and signature generation and verifications (ECDSA) and CMAC.


= Commands =
= Commands =
Line 18: Line 18:
|-
|-
| 1
| 1
|  
| KIRK_CMD_DECRYPT_PRIVATE
| Super-Duper decryption (no inverse)
| Super-Duper decryption (no inverse)
| buf_size+0x40
| buf_size+0x40
Line 26: Line 26:
|-
|-
| 2
| 2
|  
| KIRK_CMD_2
| Encrypt Operation (inverse of cmd 3)
| Encrypt Operation (inverse of cmd 3)
|  
|  
Line 34: Line 34:
|-
|-
| 3
| 3
|  
| KIRK_CMD_3
| Decrypt Operation (inverse of cmd 2)
| Decrypt Operation (inverse of cmd 2)
|  
|  
Line 42: Line 42:
|-
|-
| 4
| 4
|  
| KIRK_CMD_ENCRYPT_IV_0
| Encrypt Operation (inverse of cmd 7) (IV=0)
| Encrypt Operation (inverse of cmd 7) (IV=0)
| buf_size+0x14
| buf_size+0x14
Line 50: Line 50:
|-
|-
| 5
| 5
|  
| KIRK_CMD_ENCRYPT_IV_FUSE
| Encrypt Operation (inverse of cmd 8) (IV=FuseID)
| Encrypt Operation (inverse of cmd 8) (IV=FuseID)
| buf_size+0x14
| buf_size+0x14
Line 58: Line 58:
|-
|-
| 6
| 6
|  
| KIRK_CMD_ENCRYPT_IV_USER
| Encrypt Operation (inverse of cmd 9) (IV=UserDefined)
| Encrypt Operation (inverse of cmd 9) (IV=UserDefined)
|  
|  
Line 66: Line 66:
|-
|-
| 7
| 7
|  
| KIRK_CMD_DECRYPT_IV_0
| Decrypt Operation (inverse of cmd 4) (IV=0)
| Decrypt Operation (inverse of cmd 4) (IV=0)
| buf_size+0x14
| buf_size+0x14
Line 74: Line 74:
|-
|-
| 8
| 8
|  
| KIRK_CMD_DECRYPT_IV_FUSE
| Decrypt Operation (inverse of cmd 5) (IV=FuseID)
| Decrypt Operation (inverse of cmd 5) (IV=FuseID)
| buf_size+0x14
| buf_size+0x14
Line 82: Line 82:
|-
|-
| 9
| 9
|  
| KIRK_CMD_DECRYPT_IV_USER
| Decrypt Operation (inverse of cmd 6) (IV=UserDefined)
| Decrypt Operation (inverse of cmd 6) (IV=UserDefined)
|  
|  
Line 90: Line 90:
|-
|-
| 10 (0xA)
| 10 (0xA)
|  
| KIRK_CMD_PRIV_SIGVRY
| Private Signature Check (checks for private SCE sig)
| Private Signature Verify (checks for private SCE sig)
|  
|  
|  
|  
Line 98: Line 98:
|-
|-
| 11 (0xB)
| 11 (0xB)
|  
| KIRK_CMD_HASH
| SHA1 Hash
| SHA1 Hash
| buf_size >= 0x14
| buf_size >= 0x14
Line 106: Line 106:
|-
|-
| 12 (0xC)
| 12 (0xC)
|  
| KIRK_CMD_MUL1
| Mul1
| ECDSA Generate Keys
| 0
| 0
| 0x3C
| 0x3C
Line 114: Line 114:
|-
|-
| 13 (0xD)
| 13 (0xD)
|  
| KIRK_CMD_MUL2
| Mul2
| ECDSA Multiply Point
| 0x3C
| 0x3C
| 0x3C
| 0x3C
Line 122: Line 122:
|-
|-
| 14 (0xE)
| 14 (0xE)
|  
| KIRK_CMD_PRNGEN
| Pseudo Random Number Generation
| Pseudo Random Number Generation
| 0
| 0
Line 130: Line 130:
|-
|-
| 15 (0xF)
| 15 (0xF)
|  
| KIRK_CMD_15
| (absolutely no idea – could be KIRK initialization)
| (absolutely no idea – could be KIRK initialization)
|  
|  
Line 138: Line 138:
|-
|-
| 16 (0x10)
| 16 (0x10)
|  
| KIRK_CMD_SIGGEN
| Signature Generation
| ECDSA Signature Generation
| 0x34
| 0x34
| 0x34
| 0x34
Line 146: Line 146:
|-
|-
| 17 (0x11)
| 17 (0x11)
|  
| KIRK_CMD_SIGVRY
| Signature Check (checks for generated sigs)
| Signature Verification (checks for generated sigs)
| 0x64
| 0x64
| 0
| 0
Line 154: Line 154:
|-
|-
| 18 (0x12)
| 18 (0x12)
|  
| KIRK_CMD_CERTVRY
| Certificate Check (IDStorage certificates signatures and digests)
| Certificate Check (IDStorage certificates)
| 0xB8
| 0xB8
| 0
| 0

Revision as of 01:54, 7 March 2020

The PSP KIRK Crypto Engine is a security hardware device that is embedded into the TACHYON main IC chip. It is a bus master and can DMA to/from main DDR RAM memory, operating independantly of the CPU. It is intefaced via memory mapped registers at base of 0xBDE00000 ([SPOCK Crypto Engine] on the other hand is mapped to 0xBDF00000). It is capable of performing AES encryption, decryption, SHA1 Hash, pseudo random number generation, and signature generation and verifications (ECDSA) and CMAC.

Commands

On PSP there are 18 KIRK commands. On PSVita, there are these 18 commands plus some new commands to support bigger keys (192 bits for example). See F00D commands.

Table

Command ID Name Short description Input size Output size Result Used in
1 KIRK_CMD_DECRYPT_PRIVATE Super-Duper decryption (no inverse) buf_size+0x40 buf_size memlmd, mesg_led
2 KIRK_CMD_2 Encrypt Operation (inverse of cmd 3)
3 KIRK_CMD_3 Decrypt Operation (inverse of cmd 2)
4 KIRK_CMD_ENCRYPT_IV_0 Encrypt Operation (inverse of cmd 7) (IV=0) buf_size+0x14 buf_size+0x14 chnnlsv, memab
5 KIRK_CMD_ENCRYPT_IV_FUSE Encrypt Operation (inverse of cmd 8) (IV=FuseID) buf_size+0x14 buf_size+0x14 chnnlsv
6 KIRK_CMD_ENCRYPT_IV_USER Encrypt Operation (inverse of cmd 9) (IV=UserDefined)
7 KIRK_CMD_DECRYPT_IV_0 Decrypt Operation (inverse of cmd 4) (IV=0) buf_size+0x14 buf_size+0x14 memlmd, mesg_led,chnnlsv, memab
8 KIRK_CMD_DECRYPT_IV_FUSE Decrypt Operation (inverse of cmd 5) (IV=FuseID) buf_size+0x14 buf_size+0x14 chnnlsv
9 KIRK_CMD_DECRYPT_IV_USER Decrypt Operation (inverse of cmd 6) (IV=UserDefined)
10 (0xA) KIRK_CMD_PRIV_SIGVRY Private Signature Verify (checks for private SCE sig)
11 (0xB) KIRK_CMD_HASH SHA1 Hash buf_size >= 0x14 ?buf_size? memlmd, mesg_led, memab
12 (0xC) KIRK_CMD_MUL1 ECDSA Generate Keys 0 0x3C memab
13 (0xD) KIRK_CMD_MUL2 ECDSA Multiply Point 0x3C 0x3C
14 (0xE) KIRK_CMD_PRNGEN Pseudo Random Number Generation 0 0x14 mesg_led, chnnlsv, memab, semawm
15 (0xF) KIRK_CMD_15 (absolutely no idea – could be KIRK initialization)
16 (0x10) KIRK_CMD_SIGGEN ECDSA Signature Generation 0x34 0x34 memab
17 (0x11) KIRK_CMD_SIGVRY Signature Verification (checks for generated sigs) 0x64 0 memab
18 (0x12) KIRK_CMD_CERTVRY Certificate Check (IDStorage certificates) 0xB8 0 openpsid, memab

Command 1

Usages

Algorithm

Vulnerabilities

Command 2

Command 3

Command 4

Command 5

Command 6

Command 7

Command 8

Command 9

Command 10

Command 11

Command 12

Command 13

Command 14

Command 15

Command 16

Command 17

Command 18

Library

Calling commands using KIRK registers

Notes

In 2008 SilverSpring wrote:

Currently what is known about the cipher is that it is:
a block cipher operating in CBC mode
an all zero 128-bit initialization vector
128-bit block and key sizes
cmd4/7 uses a static key that is identical in all PSP’s
cmd5/8 uses a key based off the fuseID making all operations unique per PSP
cmd6/9 uses a user-defined 128-bit key
cmd1/2/3 uses the block cipher but also signature algorithms
the remaining KIRK cmd’s do not use the block cipher (sig, hash, & prng algo’s)
</source>