mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
iAP: authentication 1.0
Change-Id: I71b8e9f7ce2568c180396d6695cef18ce94ded32
This commit is contained in:
parent
efd047a08b
commit
b2d650f511
3 changed files with 24 additions and 3 deletions
|
@ -718,7 +718,8 @@ void iap_periodic(void)
|
|||
* is in the RX buffer right now.
|
||||
*/
|
||||
IAP_TX_INIT(0x00, 0x17);
|
||||
IAP_TX_PUT_DATA(iap_rxstart, 20);
|
||||
IAP_TX_PUT_DATA(iap_rxstart,
|
||||
(device.auth.version == 0x100) ? 16 : 20);
|
||||
IAP_TX_PUT(0x01);
|
||||
|
||||
iap_send_tx();
|
||||
|
|
|
@ -88,6 +88,7 @@ struct auth_t {
|
|||
enum authen_state state; /* Current state of authentication */
|
||||
unsigned char max_section; /* The maximum number of certificate sections */
|
||||
unsigned char next_section; /* The next expected section number */
|
||||
uint16_t version; /* Authentication version */
|
||||
};
|
||||
|
||||
/* State of GetAccessoryInfo */
|
||||
|
|
|
@ -603,8 +603,27 @@ void iap_handlepkt_mode0(const unsigned int len, const unsigned char *buf)
|
|||
break;
|
||||
}
|
||||
|
||||
/* We only support version 2.0 */
|
||||
if ((buf[2] != 2) || (buf[3] != 0)) {
|
||||
device.auth.version = (buf[2] << 8) | buf[3];
|
||||
|
||||
/* We support authentication versions 1.0 and 2.0 */
|
||||
if (device.auth.version == 0x100) {
|
||||
/* If we could really do authentication we'd have to
|
||||
* check the certificate here. Since we can't, just acknowledge
|
||||
* the packet with an "everything OK" AckDevAuthenticationInfo
|
||||
*
|
||||
* Skip GetAccessoryInfo process, this command together with
|
||||
* authentication level 2 were added in iAP release 24, it is
|
||||
* not be supported by devices authenticating at level 1.
|
||||
*/
|
||||
IAP_TX_INIT(0x00, 0x16);
|
||||
IAP_TX_PUT(0x00);
|
||||
|
||||
iap_send_tx();
|
||||
device.auth.state = AUST_CERTDONE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (device.auth.version != 0x200) {
|
||||
/* Version mismatches are signalled by AckDevAuthenticationInfo
|
||||
* with the status set to Authentication Information unsupported
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue