|
iPXE
|
iPhone USB Ethernet driver More...
#include <stdint.h>#include <string.h>#include <stdio.h>#include <errno.h>#include <ipxe/netdevice.h>#include <ipxe/ethernet.h>#include <ipxe/if_ether.h>#include <ipxe/profile.h>#include <ipxe/base64.h>#include <ipxe/sha256.h>#include <ipxe/rsa.h>#include <ipxe/x509.h>#include <ipxe/pem.h>#include <ipxe/xfer.h>#include <ipxe/tls.h>#include <ipxe/usb.h>#include "iphone.h"Go to the source code of this file.
Macros | |
| #define | EPIPE_NO_MUX __einfo_error ( EINFO_EPIPE_NO_MUX ) |
| #define | EINFO_EPIPE_NO_MUX |
| #define | EINPROGRESS_PAIRING __einfo_error ( EINFO_EINPROGRESS_PAIRING ) |
| #define | EINFO_EINPROGRESS_PAIRING |
| #define | ENOTCONN_DISABLED __einfo_error ( EINFO_ENOTCONN_DISABLED ) |
| #define | EINFO_ENOTCONN_DISABLED |
| #define | ENOTCONN_STATUS(status) |
| #define | icert_key_suffix a |
| Key pair selection. | |
| #define | icert_key_variable(prefix) |
| #define | icert_public icert_key_variable ( icert_public_ ) |
| #define | icert_private icert_key_variable ( icert_private_ ) |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
| FILE_SECBOOT (PERMITTED) | |
| static int | ipair_create (struct interface *xfer, unsigned int flags) |
| Create a pairing client. | |
| static | LIST_HEAD (imuxes) |
| List of USB multiplexers. | |
| static | LIST_HEAD (iphones) |
| List of iPhone network devices. | |
| static void | icert_free (struct icert *icert) |
| Free pairing certificates. | |
| static int | icert_cert (struct icert *icert, struct asn1_cursor *subject, struct asn1_cursor *issuer, struct asn1_cursor *private, struct asn1_cursor *public, struct asn1_cursor *exts, struct x509_certificate **cert) |
| Construct certificate. | |
| static int | icert_certs (struct icert *icert, struct asn1_cursor *key) |
| Construct certificates. | |
| static int | icert_encode (struct icert *icert, struct x509_certificate *cert, char **encenc) |
| Construct doubly base64-encoded certificate. | |
| static int | imux_tx (struct imux *imux, struct io_buffer *iobuf) |
| Transmit message. | |
| static int | imux_tx_version (struct imux *imux) |
| Transmit version message. | |
| static int | imux_tx_tcp (struct imux *imux, struct io_buffer *iobuf) |
| Transmit pseudo-TCP message. | |
| static int | imux_tx_syn (struct imux *imux) |
| Transmit pseudo-TCP SYN. | |
| static int | imux_start_pair (struct imux *imux) |
| Open pairing client. | |
| static void | imux_rx_version (struct imux *imux) |
| Receive version message. | |
| static void | imux_rx_log (struct imux *imux, struct imux_header *hdr, size_t len) |
| Receive log message. | |
| static void | imux_rx_syn (struct imux *imux) |
| Receive pseudo-TCP SYN+ACK. | |
| static void | imux_rx_tcp (struct imux *imux, struct io_buffer *iobuf) |
| Receive pseudo-TCP message. | |
| static void | imux_in_complete (struct usb_endpoint *ep, struct io_buffer *iobuf, int rc) |
| Complete bulk IN transfer. | |
| static void | imux_out_complete (struct usb_endpoint *ep, struct io_buffer *iobuf, int rc) |
| Complete bulk OUT transfer. | |
| static void | imux_shutdown (struct imux *imux) |
| Shut down USB multiplexer. | |
| static void | imux_close (struct imux *imux, int rc) |
| Close USB multiplexer. | |
| static struct io_buffer * | imux_alloc_iob (struct imux *imux __unused, size_t len) |
| Allocate I/O buffer for pseudo-TCP socket. | |
| static int | imux_deliver (struct imux *imux, struct io_buffer *iobuf, struct xfer_metadata *meta __unused) |
| Transmit packet via pseudo-TCP socket. | |
| static void | imux_step (struct imux *imux) |
| Multiplexer process. | |
| static int | imux_probe (struct usb_function *func, struct usb_configuration_descriptor *config) |
| Probe device. | |
| static void | imux_remove (struct usb_function *func) |
| Remove device. | |
| static int | ipair_tx_pubkey (struct ipair *ipair) |
| Transmit DevicePublicKey message. | |
| static int | ipair_rx_pubkey (struct ipair *ipair, char *msg) |
| Receive DevicePublicKey message. | |
| static int | ipair_tx_pair (struct ipair *ipair) |
| Transmit Pair message. | |
| static int | ipair_rx_pair (struct ipair *ipair, char *msg) |
| Receive Pair message. | |
| static int | ipair_tx_session (struct ipair *ipair) |
| Transmit StartSession message. | |
| static int | ipair_rx_session (struct ipair *ipair, char *msg) |
| Receive StartSession message. | |
| static void | ipair_free (struct refcnt *refcnt) |
| Free pairing client. | |
| static void | ipair_close (struct ipair *ipair, int rc) |
| Shut down pairing client. | |
| static int | ipair_tx (struct ipair *ipair, const char *fmt,...) |
| Transmit XML message. | |
| static int | ipair_rx (struct ipair *ipair, char *msg, size_t len) |
| Receive XML message payload. | |
| static int | ipair_tag (struct ipair *ipair, const char *msg, const char *tag, char **start, char **end) |
| Locate XML tag. | |
| static int | ipair_key (struct ipair *ipair, const char *msg, const char *key, const char *type, char **start, char **end) |
| Locate XML property list dictionary value. | |
| static int | ipair_rx_pair_error (struct ipair *ipair, char *error) |
| Receive Pair message error. | |
| static int | ipair_rx_session_error (struct ipair *ipair, char *error) |
| Receive StartSession message error. | |
| static void | ipair_window_changed (struct ipair *ipair) |
| Handle window change notification. | |
| static int | ipair_deliver (struct ipair *ipair, struct io_buffer *iobuf, struct xfer_metadata *meta __unused) |
| Handle received data. | |
| static void | ipair_expired (struct retry_timer *timer, int over __unused) |
| Pairing transmission timer. | |
| static void | iphone_in_complete (struct usb_endpoint *ep, struct io_buffer *iobuf, int rc) |
| Complete bulk IN transfer. | |
| static int | iphone_out_transmit (struct iphone *iphone, struct io_buffer *iobuf) |
| Transmit packet. | |
| static void | iphone_out_complete (struct usb_endpoint *ep, struct io_buffer *iobuf, int rc) |
| Complete bulk OUT transfer. | |
| static int | iphone_check_pair (struct iphone *iphone) |
| Check pairing status. | |
| static void | iphone_check_link (struct net_device *netdev) |
| Check link status. | |
| static void | iphone_expired (struct retry_timer *timer, int over __unused) |
| Periodically update link status. | |
| static int | iphone_open (struct net_device *netdev) |
| Open network device. | |
| static void | iphone_close (struct net_device *netdev) |
| Close network device. | |
| static int | iphone_transmit (struct net_device *netdev, struct io_buffer *iobuf) |
| Transmit packet. | |
| static void | iphone_poll (struct net_device *netdev) |
| Poll for completed and received packets. | |
| static int | iphone_probe (struct usb_function *func, struct usb_configuration_descriptor *config) |
| Probe device. | |
| static void | iphone_remove (struct usb_function *func) |
| Remove device. | |
| REQUIRING_SYMBOL (iphone_driver) | |
| REQUIRE_OBJECT (rsa_sha256) | |
Variables | |
| static struct profiler iphone_in_profiler | __profiler |
| Bulk IN completion profiler. | |
| static uint8_t | icert_root_fingerprint [SHA256_DIGEST_SIZE] |
| iPhone root certificate fingerprint | |
| static struct x509_root | icert_root |
| Root of trust for iPhone certificates. | |
| static const uint8_t | icert_nul [] = { 0x00 } |
| Single zero byte used in constructed certificates. | |
| static const uint8_t | icert_rsa [] |
| "RSA algorithm" identifier used in constructed certificates | |
| static const uint8_t | icert_sha256_rsa [] |
| "SHA-256 with RSA algorithm" identifier used in constructed certificates | |
| static const uint8_t | icert_root_exts_data [] |
| Extensions used in constructed root certificate. | |
| static struct asn1_cursor | icert_root_exts |
| Extensions used in constructed root certificate. | |
| static const uint8_t | icert_leaf_exts_data [] |
| Extensions used in constructed leaf certificates. | |
| static struct asn1_cursor | icert_leaf_exts |
| Extensions used in constructed leaf certificates. | |
| static const uint8_t | icert_tbs_prefix [] |
| "TBSCertificate" prefix in constructed certificates | |
| static const uint8_t | icert_validity [] |
| Validity period in constructed certificates. | |
| static const uint8_t | icert_name_root_data [] |
| "Root" subject name | |
| static struct asn1_cursor | icert_name_root |
| "Root" subject name | |
| static const uint8_t | icert_name_ipxe_data [] |
| "iPXE" subject name | |
| static struct asn1_cursor | icert_name_ipxe |
| "iPXE" subject name | |
| static const uint8_t | icert_name_iphone_data [] |
| "iPhone" subject name | |
| static struct asn1_cursor | icert_name_iphone |
| "iPhone" subject name | |
| static const uint8_t icert_public_a[] | __unused |
| Public key(s) used for pairing. | |
| static const char | icert_begin [] = "-----BEGIN CERTIFICATE-----\n" |
| PEM certificate prefix. | |
| static const char | icert_end [] = "\n-----END CERTIFICATE-----\n" |
| PEM certificate suffix. | |
| static struct usb_endpoint_driver_operations | imux_in_operations |
| Bulk IN endpoint operations. | |
| static struct usb_endpoint_driver_operations | imux_out_operations |
| Bulk OUT endpoint operations. | |
| static struct interface_operation | imux_tcp_operations [] |
| Pseudo-TCP socket interface operations. | |
| static struct interface_descriptor | imux_tcp_desc |
| Pseudo-TCP socket interface descriptor. | |
| static struct process_descriptor | imux_process_desc |
| Multiplexer process descriptor. | |
| static struct usb_device_id | imux_ids [] |
| USB multiplexer device IDs. | |
| struct usb_driver imux_driver | __usb_driver |
| USB multiplexer driver. | |
| static const char | ipair_prefix [] |
| Common prefix for all pairing messages. | |
| static const char | ipair_suffix [] |
| Common suffix for all pairing messages. | |
| static const char | ipair_system_buid [] = "E4DB92D2-248A-469A-AC34-92045D07E695" |
| Arbitrary system BUID used for pairing. | |
| static const char | ipair_host_id [] = "93CEBC27-8457-4804-9108-F42549DF6143" |
| Arbitrary host ID used for pairing. | |
| static struct interface_operation | ipair_xfer_operations [] |
| Pairing client interface operations. | |
| static struct interface_descriptor | ipair_xfer_desc |
| Pairing client interface descriptor. | |
| static struct usb_endpoint_driver_operations | iphone_in_operations |
| Bulk IN endpoint operations. | |
| static struct usb_endpoint_driver_operations | iphone_out_operations |
| Bulk OUT endpoint operations. | |
| static struct net_device_operations | iphone_operations |
| iPhone network device operations | |
| static struct usb_device_id | iphone_ids [] |
| iPhone device IDs | |
iPhone USB Ethernet driver
Definition in file iphone.c.
| #define EPIPE_NO_MUX __einfo_error ( EINFO_EPIPE_NO_MUX ) |
Definition at line 52 of file iphone.c.
Referenced by iphone_check_pair().
| #define EINFO_EPIPE_NO_MUX |
Definition at line 53 of file iphone.c.
| #define EINPROGRESS_PAIRING __einfo_error ( EINFO_EINPROGRESS_PAIRING ) |
Definition at line 56 of file iphone.c.
Referenced by imux_probe().
| #define EINFO_EINPROGRESS_PAIRING |
Definition at line 57 of file iphone.c.
| #define ENOTCONN_DISABLED __einfo_error ( EINFO_ENOTCONN_DISABLED ) |
| #define EINFO_ENOTCONN_DISABLED |
| #define ENOTCONN_STATUS | ( | status | ) |
Definition at line 64 of file iphone.c.
Referenced by iphone_check_link().
| #define icert_key_suffix a |
| #define icert_key_variable | ( | prefix | ) |
| #define icert_public icert_key_variable ( icert_public_ ) |
Definition at line 317 of file iphone.c.
Referenced by icert_certs().
| #define icert_private icert_key_variable ( icert_private_ ) |
Definition at line 318 of file iphone.c.
Referenced by icert_certs().
| FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
| FILE_SECBOOT | ( | PERMITTED | ) |
|
static |
Create a pairing client.
| xfer | Data transfer interface |
| flags | Initial state flags |
| rc | Return status code |
Definition at line 1833 of file iphone.c.
References ENOMEM, flags, ipair::flags, intf_init(), intf_plug_plug(), ipair_expired(), ipair_free(), ipair_rx_pubkey(), ipair_tx_pubkey(), ipair_xfer_desc, rc, ref_init, ref_put, ipair::refcnt, ipair::rx, start_timer_nodelay(), ipair::timer, ipair::tx, ipair::xfer, and zalloc().
Referenced by imux_start_pair().
|
static |
List of USB multiplexers.
|
static |
List of iPhone network devices.
|
static |
Free pairing certificates.
| icert | Pairing certificates |
Definition at line 331 of file iphone.c.
References icert::device, icert::host, icert::key, memset(), privkey_put(), icert::root, and x509_put().
Referenced by icert_certs(), and ipair_free().
|
static |
Construct certificate.
| icert | Pairing certificates |
| subject | Subject name |
| issuer | Issuer name |
| private | Private key |
| public | Public key |
| exts | Certificate extensions |
| cert | Certificate to fill in |
| rc | Return status code |
On success, the caller is responsible for eventually calling x509_put() on the allocated encoded certificate.
Definition at line 355 of file iphone.c.
References ASN1_BIT_STRING, asn1_prepend_raw(), ASN1_SEQUENCE, asn1_wrap(), asn1_builder::data, asn1_cursor::data, DBGC, DBGC_HDA, digest_final(), digest_init(), digest_update(), free, icert_nul, icert_rsa, icert_sha256_rsa, icert_tbs_prefix, icert_validity, asn1_builder::len, asn1_cursor::len, NULL, pubkey_sign(), raw, rc, rsa_algorithm, sha256_algorithm, SHA256_CTX_SIZE, SHA256_DIGEST_SIZE, and strerror().
Referenced by icert_certs().
|
static |
Construct certificates.
| icert | Certificate set |
| pubkey | Device public key |
| rc | Return status code |
Definition at line 448 of file iphone.c.
References asn1_built(), ASN1_INTEGER, asn1_prepend(), asn1_prepend_raw(), ASN1_SEQUENCE, asn1_wrap(), assert, private_key::builder, data, DBGC, icert::device, digest_algorithm::digestsize, ENOMEM, error, free, icert::host, icert_cert(), icert_free(), icert_leaf_exts, icert_name_iphone, icert_name_ipxe, icert_name_root, icert_nul, icert_private, icert_public, icert_root, icert_root_exts, icert_root_fingerprint, icert::key, key, NULL, privkey_init(), rc, icert::root, strerror(), x509_fingerprint(), and zalloc().
Referenced by ipair_rx_pubkey().
|
static |
Construct doubly base64-encoded certificate.
| icert | Pairing certificates |
| cert | X.509 certificate |
| encenc | Doubly base64-encoded certificate to construct |
| rc | Return status code |
On success, the caller is responsible for eventually calling free() on the allocated doubly encoded encoded certificate.
Definition at line 531 of file iphone.c.
References assert, base64_encode(), base64_encoded_len(), asn1_cursor::data, DBGC2, ENOMEM, free, icert_begin, icert_end, asn1_cursor::len, malloc(), NULL, x509_certificate::raw, rc, strcpy(), and x509_name().
Referenced by ipair_tx_pair().
Transmit message.
| imux | USB multiplexer |
| iobuf | I/O buffer |
| rc | Return status code |
Definition at line 601 of file iphone.c.
References assert, io_buffer::data, DBGCP, DBGCP_HDA, free_iob(), hdr, htonl, htons, imux::in_seq, iob_len(), len, usbnet_device::out, imux::out_seq, rc, usb_stream(), and imux::usbnet.
Referenced by imux_tx_tcp(), and imux_tx_version().
|
static |
Transmit version message.
| imux | USB multiplexer |
| rc | Return status code |
Definition at line 634 of file iphone.c.
References alloc_iob(), ENOMEM, imux_header_version::hdr, htonl, imux_tx(), IMUX_VERSION, iob_disown, iob_put, memset(), imux_header::protocol, and rc.
Referenced by imux_probe().
Transmit pseudo-TCP message.
| imux | USB multiplexer |
| iobuf | I/O buffer |
| rc | Return status code |
Definition at line 663 of file iphone.c.
References tcp_header::ack, assert, io_buffer::data, tcp_header::dest, tcp_header::hlen, htonl, htons, IMUX_PORT_LOCKDOWND, IMUX_TCP, imux_tx(), IMUX_WINDOW, iob_disown, iob_len(), len, imux::port, rc, tcp_header::seq, tcp_header::src, imux_header_tcp::tcp, imux::tcp_ack, imux::tcp_seq, and tcp_header::win.
Referenced by imux_deliver(), and imux_tx_syn().
|
static |
Transmit pseudo-TCP SYN.
| imux | USB multiplexer |
| rc | Return status code |
Definition at line 694 of file iphone.c.
References alloc_iob(), ENOMEM, tcp_header::flags, imux_tx_tcp(), iob_disown, iob_put, memset(), rc, imux_header_tcp::tcp, imux::tcp_seq, and TCP_SYN.
Referenced by imux_close(), and imux_rx_version().
|
static |
Open pairing client.
| imux | USB multiplexer |
| rc | Return status code |
Definition at line 725 of file iphone.c.
References EPIPE, imux::flags, intf_restart(), ipair_create(), rc, and imux::tcp.
Referenced by imux_rx_syn().
|
static |
Receive version message.
| imux | USB multiplexer |
Definition at line 743 of file iphone.c.
References imux::action, imux_tx_syn(), and imux::out_seq.
Referenced by imux_in_complete().
|
static |
Receive log message.
Definition at line 759 of file iphone.c.
References container_of, DBGC, DBGC_HDA, hdr, len, imux_header_log::level, memmove(), imux_header_log::msg, and tmp.
Referenced by imux_in_complete().
|
static |
Receive pseudo-TCP SYN+ACK.
| imux | USB multiplexer |
Definition at line 794 of file iphone.c.
References imux::action, imux_start_pair(), and imux::tcp_ack.
Referenced by imux_rx_tcp().
Receive pseudo-TCP message.
| imux | USB multiplexer |
| iobuf | I/O buffer |
Definition at line 809 of file iphone.c.
References io_buffer::data, DBGC, DBGC2_HDA, DBGC_HDA, tcp_header::dest, error, tcp_header::flags, free_iob(), htons, imux_rx_syn(), iob_disown, iob_len(), iob_pull, len, ntohl, ntohs, imux::port, rc, tcp_header::seq, imux::tcp, imux_header_tcp::tcp, imux::tcp_ack, TCP_RST, TCP_SYN, and xfer_deliver_iob().
Referenced by imux_in_complete().
|
static |
Complete bulk IN transfer.
| ep | USB endpoint |
| iobuf | I/O buffer |
| rc | Completion status code |
Definition at line 868 of file iphone.c.
References container_of, io_buffer::data, DBGC, DBGC_HDA, DBGCP, DBGCP_HDA, free_iob(), hdr, htonl, IMUX_LOG, imux_rx_log(), imux_rx_tcp(), imux_rx_version(), IMUX_TCP, IMUX_VERSION, usbnet_device::in, imux::in_seq, iob_disown, iob_len(), len, ntohl, ntohs, usb_endpoint::open, rc, strerror(), and imux::usbnet.
|
static |
Complete bulk OUT transfer.
| ep | USB endpoint |
| iobuf | I/O buffer |
| rc | Completion status code |
Definition at line 932 of file iphone.c.
References container_of, DBGC, error, free_iob(), usbnet_device::out, rc, strerror(), and imux::usbnet.
|
static |
Shut down USB multiplexer.
| imux | USB multiplexer |
Definition at line 957 of file iphone.c.
References ECANCELED, intf_shutdown(), imux::process, process_del(), process_running(), imux::tcp, imux::usbnet, and usbnet_close().
Referenced by imux_close(), imux_probe(), and imux_remove().
|
static |
Close USB multiplexer.
Definition at line 975 of file iphone.c.
References imux::action, DBGC, imux::flags, imux_shutdown(), imux_tx_syn(), intf_restart(), IPAIR_REQUEST, iphone::list, list_for_each_entry, imux::port, imux::rc, rc, start_timer_nodelay(), strerror(), imux::tcp, iphone::timer, imux::usb, and iphone::usb.
Referenced by imux_step().
Allocate I/O buffer for pseudo-TCP socket.
| iobuf | I/O buffer |
Definition at line 1018 of file iphone.c.
References __unused, alloc_iob(), iob_reserve, len, NULL, and imux_header_tcp::tcp.
|
static |
Transmit packet via pseudo-TCP socket.
| rc | Return status code |
Definition at line 1042 of file iphone.c.
References __unused, tcp_header::flags, imux_tx_tcp(), iob_disown, iob_push, memset(), meta, imux_header_tcp::tcp, and TCP_ACK.
|
static |
Multiplexer process.
| imux | USB multiplexer |
Definition at line 1071 of file iphone.c.
References imux::action, imux::bus, imux_close(), NULL, imux::process, process_running(), rc, usb_poll(), imux::usbnet, and usbnet_refill().
|
static |
Probe device.
| func | USB function |
| config | Configuration descriptor |
| rc | Return status code |
Definition at line 1106 of file iphone.c.
References imux::action, imux::bus, usb_hub::bus, DBGC, EINPROGRESS_PAIRING, ENOMEM, usb_port::hub, IMUX_IN_MAX_FILL, IMUX_IN_MTU, imux_in_operations, imux_out_operations, IMUX_PORT_LOCAL, imux_process_desc, imux_shutdown(), imux_tcp_desc, imux_tx_version(), usbnet_device::in, intf_init(), imux::list, list_add, list_del, NULL, imux::port, usb_device::port, imux::process, process_add(), process_init(), imux::rc, rc, ref_init, ref_put, imux::refcnt, strerror(), imux::tcp, imux::usb, usb_function::usb, usb_func_set_drvdata(), usb_refill_init(), imux::usbnet, usbnet_describe(), usbnet_init(), usbnet_open(), and zalloc().
|
static |
Remove device.
| func | USB function |
Definition at line 1167 of file iphone.c.
References imux_shutdown(), imux::list, list_del, ref_put, imux::refcnt, and usb_func_get_drvdata().
|
static |
Transmit DevicePublicKey message.
| ipair | Pairing client |
| rc | Return status code |
Definition at line 1410 of file iphone.c.
References ipair_prefix, ipair_suffix, ipair_tx(), and rc.
Referenced by ipair_create().
|
static |
Receive DevicePublicKey message.
| rc | Return status code |
Definition at line 1433 of file iphone.c.
References base64_decode(), base64_decoded_max_len(), data, DBGC, DBGC2_HDA, end, ENOMEM, ipair::flags, free, ipair::icert, icert_certs(), ipair_key(), IPAIR_REQUEST, ipair_rx_pair(), ipair_rx_session(), ipair_tx_pair(), ipair_tx_session(), key, len, malloc(), msg(), next, pem_asn1(), rc, ipair::rx, start_timer_nodelay(), ipair::timer, and ipair::tx.
Referenced by ipair_create().
|
static |
Transmit Pair message.
| ipair | Pairing client |
| rc | Return status code |
Definition at line 1516 of file iphone.c.
References icert::device, free, icert::host, ipair::icert, icert_encode(), ipair_host_id, ipair_prefix, ipair_suffix, ipair_system_buid, ipair_tx(), rc, icert::root, and root.
Referenced by ipair_rx_pair_error(), ipair_rx_pubkey(), and ipair_rx_session_error().
|
static |
Receive Pair message.
| rc | Return status code |
Definition at line 1605 of file iphone.c.
References DBGC, end, error, ipair_key(), ipair_rx_pair_error(), ipair_rx_session(), ipair_tx_session(), msg(), rc, ipair::rx, start_timer_nodelay(), ipair::timer, and ipair::tx.
Referenced by ipair_rx_pair_error(), ipair_rx_pubkey(), and ipair_rx_session_error().
|
static |
Transmit StartSession message.
| ipair | Pairing client |
| rc | Return status code |
Definition at line 1641 of file iphone.c.
References ipair_host_id, ipair_prefix, ipair_suffix, ipair_system_buid, ipair_tx(), and rc.
Referenced by ipair_rx_pair(), and ipair_rx_pubkey().
|
static |
Receive StartSession message.
| rc | Return status code |
Definition at line 1692 of file iphone.c.
References add_tls(), DBGC, end, error, ipair::flags, ipair::icert, icert_root, ipair_key(), ipair_rx_session_error(), IPAIR_TLS, icert::key, msg(), rc, strerror(), and ipair::xfer.
Referenced by ipair_rx_pair(), and ipair_rx_pubkey().
|
static |
Free pairing client.
| refcnt | Reference counter |
Definition at line 1231 of file iphone.c.
References container_of, free, ipair::icert, and icert_free().
Referenced by ipair_create().
|
static |
Shut down pairing client.
Definition at line 1244 of file iphone.c.
References intf_shutdown(), rc, stop_timer(), ipair::timer, and ipair::xfer.
Referenced by ipair_deliver(), ipair_expired(), and ipair_window_changed().
|
static |
Transmit XML message.
| rc | Return status code |
Definition at line 1262 of file iphone.c.
References DBGC2, ENOMEM, fmt, hdr, htonl, iob_disown, iob_put, ipair_tx(), len, memset(), msg(), NULL, rc, va_end, va_start, vsnprintf(), ipair::xfer, xfer_alloc_iob(), and xfer_deliver_iob().
Referenced by ipair_tx(), ipair_tx_pair(), ipair_tx_pubkey(), and ipair_tx_session().
Receive XML message payload.
| rc | Return status code |
Definition at line 1306 of file iphone.c.
References DBGC, DBGC2, DBGC_HDA, EPROTO, len, msg(), NULL, rc, ipair::rx, and rx.
Referenced by ipair_deliver().
|
static |
|
static |
Locate XML property list dictionary value.
Definition at line 1382 of file iphone.c.
References end, ipair_tag(), key, memcmp(), msg(), rc, start, and type.
Referenced by ipair_rx_pair(), ipair_rx_pubkey(), and ipair_rx_session().
|
static |
Receive Pair message error.
| rc | Return status code |
Definition at line 1581 of file iphone.c.
References DBGC, EPERM, error, IPAIR_RETRY_DELAY, ipair_rx_pair(), ipair_tx_pair(), ipair::rx, start_timer_fixed(), strcmp(), ipair::timer, and ipair::tx.
Referenced by ipair_rx_pair().
|
static |
Receive StartSession message error.
| rc | Return status code |
Definition at line 1668 of file iphone.c.
References DBGC, EPERM, error, ipair_rx_pair(), ipair_tx_pair(), ipair::rx, start_timer_nodelay(), strcmp(), ipair::timer, and ipair::tx.
Referenced by ipair_rx_session().
|
static |
Handle window change notification.
| ipair | Pairing client |
Definition at line 1734 of file iphone.c.
References assert, DBGC, icert::device, ipair::flags, icert::host, ipair::icert, icert_root, ipair_close(), IPAIR_TLS, NULL, icert::root, x509_is_valid(), ipair::xfer, and xfer_window().
|
static |
Handle received data.
| rc | Return status code |
Definition at line 1761 of file iphone.c.
References __unused, io_buffer::data, error, ipair::flags, free_iob(), hdr, iob_len(), iob_pull, ipair_close(), ipair_rx(), IPAIR_RX_LEN, meta, and rc.
|
static |
Pairing transmission timer.
| timer | Retransmission timer |
| over | Failure indicator |
Definition at line 1798 of file iphone.c.
References __unused, assert, container_of, ipair_close(), NULL, rc, ipair::tx, and tx.
Referenced by ipair_create().
|
static |
Complete bulk IN transfer.
| ep | USB endpoint |
| iobuf | I/O buffer |
| rc | Completion status code |
Definition at line 1877 of file iphone.c.
References container_of, io_buffer::data, DBGC, DBGC_HDA, EINVAL, error, free_iob(), usbnet_device::in, iob_disown, iob_len(), iob_pull, IPHONE_IN_PAD, iphone::netdev, netdev, netdev_rx(), netdev_rx_err(), usb_endpoint::open, profile_start(), profile_stop(), rc, strerror(), and iphone::usbnet.
Transmit packet.
| iphone | iPhone device |
| iobuf | I/O buffer |
| rc | Return status code |
Definition at line 1929 of file iphone.c.
References usbnet_device::out, profile_start(), profile_stop(), rc, usb_stream(), and iphone::usbnet.
Referenced by iphone_transmit().
|
static |
Complete bulk OUT transfer.
| ep | USB endpoint |
| iobuf | I/O buffer |
| rc | Completion status code |
Definition at line 1951 of file iphone.c.
References container_of, iphone::netdev, netdev, netdev_tx_complete_err(), usbnet_device::out, rc, and iphone::usbnet.
|
static |
Check pairing status.
| iphone | iPhone device |
| rc | Return status code |
Definition at line 1971 of file iphone.c.
References EPIPE_NO_MUX, imux::list, list_for_each_entry, imux::rc, imux::usb, and iphone::usb.
Referenced by iphone_check_link().
|
static |
Check link status.
| netdev | Network device |
Definition at line 1988 of file iphone.c.
References DBGC, ENOTCONN_STATUS, iphone_check_pair(), IPHONE_GET_LINK, IPHONE_LINK_UP, netdev, netdev_link_err(), rc, status, strerror(), iphone::usb, and usb_control().
Referenced by iphone_expired(), and iphone_probe().
|
static |
Periodically update link status.
| timer | Link status timer |
| over | Failure indicator |
Definition at line 2039 of file iphone.c.
References __unused, container_of, iphone_check_link(), IPHONE_LINK_CHECK_INTERVAL, iphone::netdev, netdev, netdev_is_open(), and start_timer_fixed().
Referenced by iphone_probe().
|
static |
Open network device.
| netdev | Network device |
| rc | Return status code |
Definition at line 2057 of file iphone.c.
References DBGC, netdev, rc, start_timer_nodelay(), strerror(), iphone::timer, iphone::usbnet, usbnet_close(), and usbnet_open().
|
static |
Close network device.
| netdev | Network device |
Definition at line 2083 of file iphone.c.
References netdev, stop_timer(), iphone::timer, iphone::usbnet, and usbnet_close().
|
static |
Transmit packet.
| netdev | Network device |
| iobuf | I/O buffer |
| rc | Return status code |
Definition at line 2100 of file iphone.c.
References iphone_out_transmit(), netdev, and rc.
|
static |
Poll for completed and received packets.
| netdev | Network device |
Definition at line 2117 of file iphone.c.
References iphone::bus, netdev, netdev_rx_err(), NULL, rc, usb_poll(), iphone::usbnet, and usbnet_refill().
|
static |
Probe device.
| func | USB function |
| config | Configuration descriptor |
| rc | Return status code |
Definition at line 2144 of file iphone.c.
References alloc_etherdev(), iphone::bus, usb_hub::bus, DBGC, usb_function::dev, ENOMEM, ETH_ALEN, usb_port::hub, usbnet_device::in, iphone_check_link(), iphone_expired(), IPHONE_GET_MAC, IPHONE_IN_MAX_FILL, IPHONE_IN_MTU, iphone_in_operations, iphone_operations, iphone_out_operations, iphone::list, list_add, list_del, memset(), usb_function::name, iphone::netdev, netdev, netdev_init(), netdev_nullify(), netdev_put(), NULL, usb_device::port, rc, register_netdev(), strerror(), iphone::timer, unregister_netdev(), iphone::usb, usb_function::usb, usb_control(), usb_func_set_drvdata(), usb_refill_init(), iphone::usbnet, usbnet_describe(), and usbnet_init().
|
static |
Remove device.
| func | USB function |
Definition at line 2215 of file iphone.c.
References iphone::list, list_del, iphone::netdev, netdev, netdev_nullify(), netdev_put(), unregister_netdev(), and usb_func_get_drvdata().
| REQUIRING_SYMBOL | ( | iphone_driver | ) |
| REQUIRE_OBJECT | ( | rsa_sha256 | ) |
|
static |
|
static |
iPhone root certificate fingerprint
Definition at line 92 of file iphone.c.
Referenced by icert_certs().
|
static |
Root of trust for iPhone certificates.
Definition at line 95 of file iphone.c.
Referenced by icert_certs(), ipair_rx_session(), and ipair_window_changed().
|
static |
Single zero byte used in constructed certificates.
Definition at line 103 of file iphone.c.
Referenced by icert_cert(), and icert_certs().
|
static |
"RSA algorithm" identifier used in constructed certificates
Definition at line 106 of file iphone.c.
Referenced by icert_cert().
|
static |
"SHA-256 with RSA algorithm" identifier used in constructed certificates
Definition at line 114 of file iphone.c.
Referenced by icert_cert().
|
static |
Extensions used in constructed root certificate.
Definition at line 121 of file iphone.c.
|
static |
Extensions used in constructed root certificate.
Definition at line 138 of file iphone.c.
Referenced by icert_certs().
|
static |
Extensions used in constructed leaf certificates.
Definition at line 142 of file iphone.c.
|
static |
Extensions used in constructed leaf certificates.
Definition at line 171 of file iphone.c.
Referenced by icert_certs().
|
static |
"TBSCertificate" prefix in constructed certificates
Definition at line 175 of file iphone.c.
Referenced by icert_cert().
|
static |
Validity period in constructed certificates.
Definition at line 187 of file iphone.c.
Referenced by icert_cert().
|
static |
"Root" subject name
Definition at line 201 of file iphone.c.
|
static |
"Root" subject name
Definition at line 209 of file iphone.c.
Referenced by icert_certs().
|
static |
|
static |
"iPXE" subject name
Definition at line 221 of file iphone.c.
Referenced by icert_certs().
|
static |
|
static |
"iPhone" subject name
Definition at line 234 of file iphone.c.
Referenced by icert_certs().
|
static |
Public key(s) used for pairing.
"Private" key(s) used for pairing
Yes, this publicly visible "private" key completely obviates any nominal security provided by the pairing process. Looked at another way, this modifies the iPhone to behave like every other USB tethering device: if the cable is physically connected and tethering is enabled then the device will Just Work.
Unlike Android, the iPhone seems to have no meaningful permissions model: any device that is trusted to use the phone for tethering seems to also be trusted to use the iPhone for any other purpose (e.g. accessing files, reading messages, etc). Apple should probably fix this at some point, e.g. via defining extended key usages in the root and host certificates.
Definition at line 238 of file iphone.c.
|
static |
|
static |
|
static |
Bulk IN endpoint operations.
Definition at line 921 of file iphone.c.
Referenced by imux_probe().
|
static |
Bulk OUT endpoint operations.
Definition at line 948 of file iphone.c.
Referenced by imux_probe().
|
static |
Pseudo-TCP socket interface operations.
Definition at line 1056 of file iphone.c.
|
static |
Pseudo-TCP socket interface descriptor.
Definition at line 1063 of file iphone.c.
Referenced by imux_probe().
|
static |
Multiplexer process descriptor.
Definition at line 1096 of file iphone.c.
Referenced by imux_probe().
|
static |
USB multiplexer device IDs.
| struct usb_driver iphone_driver __usb_driver |
USB multiplexer driver.
iPhone driver
Definition at line 1181 of file iphone.c.
|
static |
Common prefix for all pairing messages.
Definition at line 1198 of file iphone.c.
Referenced by ipair_tx_pair(), ipair_tx_pubkey(), and ipair_tx_session().
|
static |
Common suffix for all pairing messages.
Definition at line 1209 of file iphone.c.
Referenced by ipair_tx_pair(), ipair_tx_pubkey(), and ipair_tx_session().
|
static |
Arbitrary system BUID used for pairing.
Definition at line 1214 of file iphone.c.
Referenced by ipair_tx_pair(), and ipair_tx_session().
|
static |
Arbitrary host ID used for pairing.
Definition at line 1217 of file iphone.c.
Referenced by ipair_tx_pair(), and ipair_tx_session().
|
static |
Pairing client interface operations.
Definition at line 1816 of file iphone.c.
|
static |
Pairing client interface descriptor.
Definition at line 1823 of file iphone.c.
Referenced by ipair_create().
|
static |
Bulk IN endpoint operations.
Definition at line 1918 of file iphone.c.
Referenced by iphone_probe().
|
static |
Bulk OUT endpoint operations.
Definition at line 1961 of file iphone.c.
Referenced by iphone_probe().
|
static |
iPhone network device operations
Definition at line 2130 of file iphone.c.
Referenced by iphone_probe().
|
static |