summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCástor Muñoz <cmvidal@gmail.com>2014-12-06 23:27:01 +0100
committerCástor Muñoz <cmvidal@gmail.com>2015-10-07 06:15:04 +0200
commitb2d650f511d1eef08138f09ecd4e96656eef173b (patch)
treee71b58ec419eac8b81daf131529cdc4c94390032
parentefd047a08bf990b9d10be5e5df1bce83968bd4e4 (diff)
downloadrockbox-b2d650f511d1eef08138f09ecd4e96656eef173b.tar.gz
rockbox-b2d650f511d1eef08138f09ecd4e96656eef173b.zip
iAP: authentication 1.0
Change-Id: I71b8e9f7ce2568c180396d6695cef18ce94ded32
-rw-r--r--apps/iap/iap-core.c3
-rw-r--r--apps/iap/iap-core.h1
-rw-r--r--apps/iap/iap-lingo0.c23
3 files changed, 24 insertions, 3 deletions
diff --git a/apps/iap/iap-core.c b/apps/iap/iap-core.c
index 4fa9c09a47..9e5771ab50 100644
--- a/apps/iap/iap-core.c
+++ b/apps/iap/iap-core.c
@@ -718,7 +718,8 @@ void iap_periodic(void)
718 * is in the RX buffer right now. 718 * is in the RX buffer right now.
719 */ 719 */
720 IAP_TX_INIT(0x00, 0x17); 720 IAP_TX_INIT(0x00, 0x17);
721 IAP_TX_PUT_DATA(iap_rxstart, 20); 721 IAP_TX_PUT_DATA(iap_rxstart,
722 (device.auth.version == 0x100) ? 16 : 20);
722 IAP_TX_PUT(0x01); 723 IAP_TX_PUT(0x01);
723 724
724 iap_send_tx(); 725 iap_send_tx();
diff --git a/apps/iap/iap-core.h b/apps/iap/iap-core.h
index d06e3c300c..61b72d4ca2 100644
--- a/apps/iap/iap-core.h
+++ b/apps/iap/iap-core.h
@@ -88,6 +88,7 @@ struct auth_t {
88 enum authen_state state; /* Current state of authentication */ 88 enum authen_state state; /* Current state of authentication */
89 unsigned char max_section; /* The maximum number of certificate sections */ 89 unsigned char max_section; /* The maximum number of certificate sections */
90 unsigned char next_section; /* The next expected section number */ 90 unsigned char next_section; /* The next expected section number */
91 uint16_t version; /* Authentication version */
91}; 92};
92 93
93/* State of GetAccessoryInfo */ 94/* State of GetAccessoryInfo */
diff --git a/apps/iap/iap-lingo0.c b/apps/iap/iap-lingo0.c
index 9e0355cb3f..e69b42beae 100644
--- a/apps/iap/iap-lingo0.c
+++ b/apps/iap/iap-lingo0.c
@@ -603,8 +603,27 @@ void iap_handlepkt_mode0(const unsigned int len, const unsigned char *buf)
603 break; 603 break;
604 } 604 }
605 605
606 /* We only support version 2.0 */ 606 device.auth.version = (buf[2] << 8) | buf[3];
607 if ((buf[2] != 2) || (buf[3] != 0)) { 607
608 /* We support authentication versions 1.0 and 2.0 */
609 if (device.auth.version == 0x100) {
610 /* If we could really do authentication we'd have to
611 * check the certificate here. Since we can't, just acknowledge
612 * the packet with an "everything OK" AckDevAuthenticationInfo
613 *
614 * Skip GetAccessoryInfo process, this command together with
615 * authentication level 2 were added in iAP release 24, it is
616 * not be supported by devices authenticating at level 1.
617 */
618 IAP_TX_INIT(0x00, 0x16);
619 IAP_TX_PUT(0x00);
620
621 iap_send_tx();
622 device.auth.state = AUST_CERTDONE;
623 break;
624 }
625
626 if (device.auth.version != 0x200) {
608 /* Version mismatches are signalled by AckDevAuthenticationInfo 627 /* Version mismatches are signalled by AckDevAuthenticationInfo
609 * with the status set to Authentication Information unsupported 628 * with the status set to Authentication Information unsupported
610 */ 629 */