summaryrefslogtreecommitdiffstats
path: root/src/idevice.c
AgeCommit message (Collapse)AuthorFilesLines
2024-03-16Add libimobiledevice_version() function to interfaceGravatar Nikias Bassen1-0/+8
2024-01-31Move LIBIMOBILEDEVICE_API to public headersGravatar Nikias Bassen1-23/+23
2023-12-16idevice: Update for LibreSSL >= 3.6.0Gravatar orbea1-1/+2
Since LibreSSL 3.6.0 SSL_CTX_set_security_level() has been available.
2023-12-12Fix iOS 1 SSL connectionGravatar tihmstar1-0/+14
Detect if we're talking to iOS 1 `if (connection->device->version == 0)` and set `SSL_CTX_set_min_proto_version(ssl_ctx, 0);` to support SSL3. iOS 1 doesn't understand TLS1_VERSION, it can only speak SSL3_VERSION. However, modern OpenSSL is usually compiled without SSLv3 support. So if we set min_proto_version to SSL3_VERSION on an OpenSSL instance which doesn't support it, it will just ignore min_proto_version altogether and fall back to an even higher version. To avoid accidentally breaking iOS 2.0+, we set min version to 0 instead.
2023-07-05Updated OpenSSL-specific code to use OpenSSL 3.0+ APIGravatar Nikias Bassen1-2/+32
2023-06-28idevice: Add missing include for WindowsGravatar Nikias Bassen1-0/+1
2023-06-28idevice: Fix network address handling in other code paths tooGravatar Nikias Bassen1-4/+37
2023-06-27idevice: Use network addresses as is from what we get from (lib)usbmuxdGravatar Nikias Bassen1-19/+8
2023-01-11idevice: Use more reliable version check macro for OpenSSL 3 specific thingsGravatar Nikias Bassen1-1/+1
OpenSSL versions pre 3.0 do not define OPENSSL_VERSION_MAJOR etc.
2023-01-11idevice: Fix connections to <= iOS 5 devices with OpenSSL 3Gravatar Nikias Bassen1-1/+10
Thanks @tihmstar for pointing this out.
2023-01-11idevice: Simplify TLS version selection code for older devicesGravatar Nikias Bassen1-6/+4
Turns out that SSL_CTX_set_options does *not* clear options that have been set before.
2022-07-03idevice: Fix OpenSSL 3.0 internal error on read timeoutGravatar Ruipu Ma1-0/+12
2022-05-10idevice: Restore original behavior for idevice_event_unsubscribe()Gravatar Nikias Bassen1-0/+1
Due to an implementation detail from the past, a call to idevice_event_unsubscribe would not cause the callback function to be called with IDEVICE_DEVICE_REMOVE events, even though originally it was planned to be that way. Due to the internal changes for the newer idevice_events_subscribe/unsubscribe API, that behavior changed and it would call the callback. Now to not break current software implementations depending on the original behavior we modify the old API to behave the same as before the change.
2022-05-09Add new idevice_events_subscribe/unsubscribe API with contextGravatar Nikias Bassen1-10/+49
The older API idevice_event_subscribe/unsubscribe can only be used by a single instance. With the addition of a context, is is now possible to register multiple callback functions in different threads. For backwards compatibility the old API will still be available for a while before being removed in a future release.
2022-05-02idevice: Fix sign issue in idevice_get_device_list_extendedGravatar Семён Марьясин1-1/+1
In sync with idevice_from_mux_device, line 384. Without this fix, data size 128 (the common value) is treated as -128, resulting in incorrect allocation. Related to #1248 but doesn't fully fix it.
2022-04-30[clang-tidy] Do not use else after returnGravatar Rosen Penev1-37/+39
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-04-22idevice: Fix mistreatment of 0-byte sent casesGravatar Li Beinan1-1/+4
Currently if 0 byte gets sent, it is treated as not-enough-data. This is wrong, because with TCP, 0-byte-sent usually means the receiver end is closed. We must set a new case for this and must not normalize the sent-bytes to 0 in general.
2022-03-29idevice: Fix debug message showing function name twiceGravatar Nikias Bassen1-1/+1
2022-03-29idevice: win32: Add winsock2.h include for struct sockaddr_storageGravatar Nikias Bassen1-4/+5
2022-03-29idevice: Make sure ECONNREFUSED is definedGravatar Nikias Bassen1-0/+4
2022-02-09Add support for wireless pairingGravatar Nikias Bassen1-1/+4
2021-10-12idevice: Add IDEVICE_E_CONNREFUSED and have idevice_connect() return ↵Gravatar Nikias Bassen1-2/+17
meaningful error codes This allows clients to properly detect that a connection to the requested port failed because it is not open on the device, instead of just returning an "unknown error"
2021-09-13Check availability of constructor attribute and use it on Windows in favor ↵Gravatar Nikias Bassen1-10/+18
of DllMain
2021-09-01Remove common code in favor of new libimobiledevice-glueGravatar Nikias Bassen1-2/+3
2021-07-30idevice: Reset receive length variable in internal_ssl_read retry loop and ↵Gravatar Nikias Bassen1-1/+2
fix wrong variable in debug message
2021-07-29lockdown: Get DeviceClass to make sure OS version dependent code is executed ↵Gravatar Nikias Bassen1-0/+1
correctly The code in lockdownd_client_new_with_handshake would call the function lockdownd_validate_pair based on the OS version being less than 7.0 without taking into account that Watch OS has a different versioning scheme compared to the other device classes. For this and any future version/device specific checks, the code now queries the DeviceClass and stores it in the idevice_private struct.
2021-07-29Handle error cases in relevant code when retrieving pair record failsGravatar Nikias Bassen1-3/+3
2021-07-27Add support for MbedTLSGravatar Nikias Bassen1-25/+170
2021-07-26idevice: Remove unnecessary memcpy from internal_ssl_read()Gravatar Nikias Bassen1-29/+15
2021-07-26idevice: Route OpenSSL reads/writes through internal_connection_*Gravatar Kabir Oberai1-42/+64
Let's not allow OpenSSL to directly access our file descriptors
2021-07-25idevice: Make sure to handle timeout condition for network connections tooGravatar Nikias Bassen1-9/+11
2021-02-01idevice: Allow partial reads in idevice_connection_receive_timeout() and ↵Gravatar Nikias Bassen1-6/+9
handle timeouts more adequate idevice_connection_receive_timeout(), when in SSL mode, was assuming it should always try to read the exact amount of data specified in `len` parameter. While this works with most protocols that have length fields or fixed sized headers/packets, some others (e.g. debugserver) break because it will request a read but doesn't know the size that is expected to be returned beforehand. This commit will handle timeouts better and return the number of bytes that were read in such cases (instead of returning 0 bytes read + error). Note that in the event of a timeout, IDEVICE_E_TIMEOUT will be returned even though actual data might have been read. The number of bytes read will be returned in recv_bytes.
2020-11-19idevice: Handle -EAGAIN in case usbmuxd_send() returns itGravatar Nikias Bassen1-1/+4
2020-08-06idevice: Fix build with LibreSSLGravatar Nikias Bassen1-1/+1
2020-06-13Allow OpenSSL >= 1.1.0 to use older/disallowed TLS versionsGravatar Author: Frederik Carlier1-1/+5
2020-06-08Remove whitespace errors from all filesGravatar Martin Szulecki1-1/+1
2020-06-08idevice: Add fix for potential SSL_write timeout error caseGravatar Nikias Bassen1-3/+3
2020-06-06idevice: Revert not copying scope id for IPv6 addresses from usbmuxd againGravatar Martin Szulecki1-2/+2
This should still catch the more common case when using usbmuxd on the same host. Not copying the scope id in that case actually removes vital routing information.
2020-06-06idevice: Slightly improve connectivity logic and fix IPv6 for network devicesGravatar Martin Szulecki1-6/+8
This change removes copying the scope id for IPv6 connections which caused problems if the usbmux connection data is used on different hosts or context.
2020-06-06idevice: Add some newlines for better code readabilityGravatar Martin Szulecki1-0/+7
2020-06-04idevice: Fix compiler warning about switch case fallthroughGravatar Martin Szulecki1-1/+1
2020-05-21idevice: [OpenSSL] Handle non-blocking SSL_writeGravatar Nikias Bassen1-0/+13
2020-05-18idevice_connection_send: Make sure send works with non-blocking socketsGravatar Nikias Bassen1-1/+17
2020-05-18Use direct socket connection for network devicesGravatar Nikias Bassen1-7/+76
Instead of relaying data via usbmuxd this change will have it connect directly to the device via network after retrieving its address from usbmuxd
2020-05-17idevice: [OpenSSL] Fix SSL_read with non-blocking socketsGravatar Nikias Bassen1-1/+10
2020-05-15idevice: [OpenSSL] Make sure SSL handshake works with non-blocking socketGravatar Nikias Bassen1-8/+18
2020-02-20introduces optional `idevice_connection_disable_ssl` with ability not to ↵Gravatar Demyan Kimitsa1-13/+23
send SSL shutdown message. As in debugserver this message will be considered as GDB server communication and break things
2020-01-05Define ETIMEDOUT if requiredGravatar Nikias Bassen1-0/+4
2019-11-07Add new idevice_get_device_list_extended() allowing to list all devices, ↵Gravatar Nikias Bassen1-0/+56
including network Instead of just returning a list of UDIDs (like idevice_get_device_list) this function will return idevice_info_t* records which also contains the type of the connection and the connection data.
2019-11-07Add propert support for network (WiFi) devices via new ↵Gravatar Nikias Bassen1-21/+71
idevice_new_with_options()