NS services: Difference between revisions

No edit summary
Line 1,662: Line 1,662:
Takes a type-0x15 input buffer containing a [[#SystemDeliveryInfo]], a type-0x5 input buffer containing an array of [[#SystemDeliveryInfo]], a type-0x5 input buffer containing an array of [[#ApplicationDeliveryInfo]], and returns an output s32.
Takes a type-0x15 input buffer containing a [[#SystemDeliveryInfo]], a type-0x5 input buffer containing an array of [[#SystemDeliveryInfo]], a type-0x5 input buffer containing an array of [[#ApplicationDeliveryInfo]], and returns an output s32.


This determines the latest version from the input [[#ApplicationDeliveryInfo]] array, using value 0 if the array is empty. If this value is less than a state field, the state field value is used instead. Then this selects a [[#SystemDeliveryInfo]] with the latest version from the input array, where the minimum version is the previously mentioned value. The version must also be also be at least the version value from the type-0x15 [[#SystemDeliveryInfo]] buffer. This also does various validation, etc. The output s32 is an index in that array for the selected entry, -1 if none found.
This determines the latest version (RequiredSystemVersion) from the input [[#ApplicationDeliveryInfo]] array (ApplicationDeliveryProtocolVersion and the HMAC are also validated), using value 0 if the array is empty.
 
[20.0.0+] When the SystemDeliveryInfoPlatform from the type-0x15 [[#SystemDeliveryInfo]] buffer matches the [[System_Settings|sys-setting]], it then loops through the [[#ApplicationDeliveryInfo]] array again:
* A func is called with the [[#ApplicationDeliveryInfo]], returning error if this fails. This func essentially uses [[Shared_Database_services|pl:s]] GetFunctionBlackListSystemVersionToAuthorize with ApplicationFunctionAuthorizationId=0x5 and parses the output, using cached data if available.
* tmp_version = out_u8 == 0 ? 0 : out_u32 + 0x10000;
* Then the current latest-version value is updated with tmp_version, if tmp_version is higher.
 
If this version value is less than a state field, the state field value is used instead (state field originates from [[System_Settings|system-setting]] <code>contents_delivery!required_system_version_to_deliver_application</code>).
 
Then this selects a [[#SystemDeliveryInfo]] with the latest version from the input array, where the minimum version is the previously mentioned value. The version must also be also be at least the version value from the type-0x15 [[#SystemDeliveryInfo]] buffer. This also does various validation, etc. The output s32 is an index in that array for the selected entry, -1 if none found.


==== VerifyDeliveryProtocolVersion ====
==== VerifyDeliveryProtocolVersion ====
Line 4,552: Line 4,561:
! Description
! Description
|-
|-
| 0x0 || 0x8 || ?
| 0x0 || 0x4 || ApplicationDeliveryProtocolVersion.
|-
| 0x4 || 0x4 || ?
|-
|-
| 0x8 || 0x8 || ApplicationId.
| 0x8 || 0x8 || ApplicationId.