Difference between revisions of "SSL Services"

From 3dbrew
Jump to navigation Jump to search
Line 5: Line 5:
 
!  Command Header
 
!  Command Header
 
!  Available since system-version
 
!  Available since system-version
 +
!  Available from service-sessions
 
!  Description
 
!  Description
 
|-
 
|-
 
| 0x00010002
 
| 0x00010002
 +
|
 
|  
 
|  
 
| (<value-0x20 kernel PID header>) Initialize
 
| (<value-0x20 kernel PID header>) Initialize
 
|-
 
|-
 
| 0x000200C2
 
| 0x000200C2
 +
|
 
|  
 
|  
 
| [[SSLC:CreateContext|CreateContext]]
 
| [[SSLC:CreateContext|CreateContext]]
 
|-
 
|-
 
| 0x00030000
 
| 0x00030000
 +
|
 
|  
 
|  
 
| [[SSLC:CreateRootCertChain|CreateRootCertChain]]
 
| [[SSLC:CreateRootCertChain|CreateRootCertChain]]
 
|-
 
|-
 
| 0x00040040
 
| 0x00040040
 +
|
 
|  
 
|  
 
| [[SSLC:DestroyRootCertChain|DestroyRootCertChain]]
 
| [[SSLC:DestroyRootCertChain|DestroyRootCertChain]]
 
|-
 
|-
 
| 0x00050082
 
| 0x00050082
 +
|
 
|  
 
|  
 
| [[SSLC:AddTrustedRootCA|AddTrustedRootCA]]
 
| [[SSLC:AddTrustedRootCA|AddTrustedRootCA]]
 
|-
 
|-
 
| 0x00060080
 
| 0x00060080
 +
|
 
|  
 
|  
 
| [[SSLC:RootCertChainAddDefaultCert|RootCertChainAddDefaultCert]]
 
| [[SSLC:RootCertChainAddDefaultCert|RootCertChainAddDefaultCert]]
 
|-
 
|-
 
| 0x00070080
 
| 0x00070080
 +
|
 
|  
 
|  
 
| (u32 RootCertChain_contexthandle, u32 inval)
 
| (u32 RootCertChain_contexthandle, u32 inval)
 
|-
 
|-
 
| 0x00080000
 
| 0x00080000
 +
|
 
|  
 
|  
 
| This writes an output u32 to cmdreply[2](created context handle).
 
| This writes an output u32 to cmdreply[2](created context handle).
 
|-
 
|-
 
| 0x00090040
 
| 0x00090040
 +
|
 
|  
 
|  
 
| (u32 handle for a context) This is used for destroying a context created by command 0x00080000.
 
| (u32 handle for a context) This is used for destroying a context created by command 0x00080000.
 
|-
 
|-
 
| 0x000A0082
 
| 0x000A0082
 +
|
 
|  
 
|  
 
| (u32 contexthandle, u32 size, ((Size<<4)  <nowiki>|</nowiki> 10), inbufptr) Writes an output u32 to cmdreply[2]. This uses a context created by command 0x00080000.
 
| (u32 contexthandle, u32 size, ((Size<<4)  <nowiki>|</nowiki> 10), inbufptr) Writes an output u32 to cmdreply[2]. This uses a context created by command 0x00080000.
 
|-
 
|-
 
| 0x000B0080
 
| 0x000B0080
 +
|
 
|  
 
|  
 
| (u32 contexthandle, u8 inval2) Writes an output u32 to cmdreply[2]. This uses a context created by command 0x00080000.
 
| (u32 contexthandle, u8 inval2) Writes an output u32 to cmdreply[2]. This uses a context created by command 0x00080000.
 
|-
 
|-
 
| 0x000C0080
 
| 0x000C0080
 +
|
 
|  
 
|  
 
| (u32 contexthandle, u32 inval) This uses a context created by command 0x00080000.
 
| (u32 contexthandle, u32 inval) This uses a context created by command 0x00080000.
 
|-
 
|-
 
| 0x000D0084
 
| 0x000D0084
 +
|
 
|  
 
|  
 
| (u32 size0, u32 size1, ((Size0<<4) <nowiki>|</nowiki> 10), inbufptr0, ((Size1<<4) <nowiki>|</nowiki> 10), inbufptr1) Writes an output u32 to cmdreply[2](created context handle). This is the same type of context created by command 0x000E0040.
 
| (u32 size0, u32 size1, ((Size0<<4) <nowiki>|</nowiki> 10), inbufptr0, ((Size1<<4) <nowiki>|</nowiki> 10), inbufptr1) Writes an output u32 to cmdreply[2](created context handle). This is the same type of context created by command 0x000E0040.
 
|-
 
|-
 
| 0x000E0040
 
| 0x000E0040
 +
|
 
|  
 
|  
 
| (u8 inval) Writes an output u32 to cmdreply[2](created context handle).
 
| (u8 inval) Writes an output u32 to cmdreply[2](created context handle).
 
|-
 
|-
 
| 0x000F0040
 
| 0x000F0040
 +
|
 
|  
 
|  
 
| (u32 handle for a context) This is used for destroying a context created by command 0x000E0040.
 
| (u32 handle for a context) This is used for destroying a context created by command 0x000E0040.
 
|-
 
|-
 
| 0x00100000
 
| 0x00100000
 +
|
 
|  
 
|  
 
| ?
 
| ?
 
|-
 
|-
 
| 0x00110042
 
| 0x00110042
 +
|
 
|  
 
|  
 
| [[SSLC:GenerateRandomData|GenerateRandomData]]
 
| [[SSLC:GenerateRandomData|GenerateRandomData]]
 
|-
 
|-
 
| 0x00120042
 
| 0x00120042
 +
|
 
|  
 
|  
 
| [[SSLC:InitializeConnectionSession|InitializeConnectionSession]]
 
| [[SSLC:InitializeConnectionSession|InitializeConnectionSession]]
 
|-
 
|-
 
| 0x00130040
 
| 0x00130040
 +
|
 
|  
 
|  
 
| (u32 [[SSLC:CreateContext|contexthandle]])
 
| (u32 [[SSLC:CreateContext|contexthandle]])
 
|-
 
|-
 
| 0x00140040
 
| 0x00140040
 +
|
 
|  
 
|  
 
| (u32 inval) Writes two u32s to cmdreply[2] and cmdreply[3].
 
| (u32 inval) Writes two u32s to cmdreply[2] and cmdreply[3].
 
|-
 
|-
 
| 0x00150082
 
| 0x00150082
 +
|
 
|  
 
|  
 
| [[SSLC:Read|Read]]
 
| [[SSLC:Read|Read]]
 
|-
 
|-
 
| 0x00160082
 
| 0x00160082
 +
|
 
|  
 
|  
 
| (u32 inval, u32 size, ((Size<<4)  <nowiki>|</nowiki> 12), outbufptr) Writes an output u32 to cmdreply[2].
 
| (u32 inval, u32 size, ((Size<<4)  <nowiki>|</nowiki> 12), outbufptr) Writes an output u32 to cmdreply[2].
 
|-
 
|-
 
| 0x00170082
 
| 0x00170082
 +
|
 
|  
 
|  
 
| [[SSLC:Write|Write]]
 
| [[SSLC:Write|Write]]
 
|-
 
|-
 
| 0x00180080
 
| 0x00180080
 +
|
 
|  
 
|  
 
| [[SSLC:ContextSetRootCertChain|ContextSetRootCertChain]]
 
| [[SSLC:ContextSetRootCertChain|ContextSetRootCertChain]]
 
|-
 
|-
 
| 0x00190080
 
| 0x00190080
 +
|
 
|  
 
|  
 
| (u32 [[SSLC:CreateContext|contexthandle]], u32 inval)
 
| (u32 [[SSLC:CreateContext|contexthandle]], u32 inval)
 
|-
 
|-
 
| 0x001A0080
 
| 0x001A0080
 +
|
 
|  
 
|  
 
| (u32 [[SSLC:CreateContext|contexthandle]], u32 inval)
 
| (u32 [[SSLC:CreateContext|contexthandle]], u32 inval)
 
|-
 
|-
 
| 0x001B0080
 
| 0x001B0080
 +
|
 
|  
 
|  
 
| (u32 [[SSLC:CreateContext|contexthandle]], u32 inval)
 
| (u32 [[SSLC:CreateContext|contexthandle]], u32 inval)
 
|-
 
|-
 
| 0x001C00C4
 
| 0x001C00C4
 +
|
 
|  
 
|  
 
| (u32 inval, u32 size0, u32 size1, ((Size0<<4)  <nowiki>|</nowiki> 12), outbufptr0, ((Size1<<4)  <nowiki>|</nowiki> 12), outbufptr1)
 
| (u32 inval, u32 size0, u32 size1, ((Size0<<4)  <nowiki>|</nowiki> 12), outbufptr0, ((Size1<<4)  <nowiki>|</nowiki> 12), outbufptr1)
 
|-
 
|-
 
| 0x001D0040
 
| 0x001D0040
 +
|
 
|  
 
|  
 
| (u32 inval) Writes an output u32 to cmdreply[2].
 
| (u32 inval) Writes an output u32 to cmdreply[2].
 
|-
 
|-
 
| 0x001E0040
 
| 0x001E0040
 +
|
 
|  
 
|  
 
| [[SSLC:DestroyContext|DestroyContext]]
 
| [[SSLC:DestroyContext|DestroyContext]]
Line 129: Line 160:
 
| 0x001F0082
 
| 0x001F0082
 
|  
 
|  
 +
| Context-only
 
| (u32 inval, u32 inval2, <value-0x0 handle-transfer header>, handle)
 
| (u32 inval, u32 inval2, <value-0x0 handle-transfer header>, handle)
 
|-
 
|-
 
| 0x00200082
 
| 0x00200082
 +
|
 
|  
 
|  
 
| (u32 inval, u32 size, ((Size<<4)  <nowiki>|</nowiki> 10), inbufptr)
 
| (u32 inval, u32 size, ((Size<<4)  <nowiki>|</nowiki> 10), inbufptr)
Line 139: Line 172:
  
 
Similar to HTTPC, each SSL [[SSLC:CreateContext|context]] is used with a dedicated service session which gets opened after creating that context. Following creating the context + opening the service session, [[SSLC:InitializeConnectionSession]] is used from that service session for that context. Afterwards, all commands which require a handle for this context are done with this dedicated service session.
 
Similar to HTTPC, each SSL [[SSLC:CreateContext|context]] is used with a dedicated service session which gets opened after creating that context. Following creating the context + opening the service session, [[SSLC:InitializeConnectionSession]] is used from that service session for that context. Afterwards, all commands which require a handle for this context are done with this dedicated service session.
 +
 +
Internally there's a separate object vtable used with the above SSLC commands, for the main session(where [[SSLC:InitializeConnectionSession]] wasn't used), and context sessions where [[SSLC:InitializeConnectionSession]] was used. Error 0xD960BBF4 will be returned if a command was used with the wrong session type.

Revision as of 00:07, 20 February 2016

SSL service "ssl:C"

Command Header Available since system-version Available from service-sessions Description
0x00010002 (<value-0x20 kernel PID header>) Initialize
0x000200C2 CreateContext
0x00030000 CreateRootCertChain
0x00040040 DestroyRootCertChain
0x00050082 AddTrustedRootCA
0x00060080 RootCertChainAddDefaultCert
0x00070080 (u32 RootCertChain_contexthandle, u32 inval)
0x00080000 This writes an output u32 to cmdreply[2](created context handle).
0x00090040 (u32 handle for a context) This is used for destroying a context created by command 0x00080000.
0x000A0082 (u32 contexthandle, u32 size, ((Size<<4) | 10), inbufptr) Writes an output u32 to cmdreply[2]. This uses a context created by command 0x00080000.
0x000B0080 (u32 contexthandle, u8 inval2) Writes an output u32 to cmdreply[2]. This uses a context created by command 0x00080000.
0x000C0080 (u32 contexthandle, u32 inval) This uses a context created by command 0x00080000.
0x000D0084 (u32 size0, u32 size1, ((Size0<<4) | 10), inbufptr0, ((Size1<<4) | 10), inbufptr1) Writes an output u32 to cmdreply[2](created context handle). This is the same type of context created by command 0x000E0040.
0x000E0040 (u8 inval) Writes an output u32 to cmdreply[2](created context handle).
0x000F0040 (u32 handle for a context) This is used for destroying a context created by command 0x000E0040.
0x00100000 ?
0x00110042 GenerateRandomData
0x00120042 InitializeConnectionSession
0x00130040 (u32 contexthandle)
0x00140040 (u32 inval) Writes two u32s to cmdreply[2] and cmdreply[3].
0x00150082 Read
0x00160082 (u32 inval, u32 size, ((Size<<4) | 12), outbufptr) Writes an output u32 to cmdreply[2].
0x00170082 Write
0x00180080 ContextSetRootCertChain
0x00190080 (u32 contexthandle, u32 inval)
0x001A0080 (u32 contexthandle, u32 inval)
0x001B0080 (u32 contexthandle, u32 inval)
0x001C00C4 (u32 inval, u32 size0, u32 size1, ((Size0<<4) | 12), outbufptr0, ((Size1<<4) | 12), outbufptr1)
0x001D0040 (u32 inval) Writes an output u32 to cmdreply[2].
0x001E0040 DestroyContext
0x001F0082 Context-only (u32 inval, u32 inval2, <value-0x0 handle-transfer header>, handle)
0x00200082 (u32 inval, u32 size, ((Size<<4) | 10), inbufptr)

Going by strings in the SSL sysmodule it appears the sysmodule uses RSA BSAFE(like certain other 3DS software), this is also likely where the "ssl:C" name comes from(RSA BSAFE "SSL-C").

Similar to HTTPC, each SSL context is used with a dedicated service session which gets opened after creating that context. Following creating the context + opening the service session, SSLC:InitializeConnectionSession is used from that service session for that context. Afterwards, all commands which require a handle for this context are done with this dedicated service session.

Internally there's a separate object vtable used with the above SSLC commands, for the main session(where SSLC:InitializeConnectionSession wasn't used), and context sessions where SSLC:InitializeConnectionSession was used. Error 0xD960BBF4 will be returned if a command was used with the wrong session type.