summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2021-04-27 15:18:37 -0400
committerJoel Fischer <joeljfischer@gmail.com>2021-04-27 15:18:37 -0400
commit6f5565403f723fd8705e3863a7a1812630ab616d (patch)
treeb3eac75a59f7d07d1883822798fbe52bb55a6e9a
parent8a34f697ab6bbf9d423d0129e33836333b3e6060 (diff)
downloadsdl_ios-bugfix/issue-1954-rpc-encryption-multi-frame.tar.gz
-rw-r--r--SmartDeviceLink/private/SDLProtocol.m6
-rw-r--r--SmartDeviceLinkTests/ProtocolSpecs/MessageSpecs/SDLProtocolSpec.m2
-rw-r--r--SmartDeviceLinkTests/ProtocolSpecs/SDLProtocolMessageDisassemblerSpec.m2
m---------generator/rpc_spec0
4 files changed, 7 insertions, 3 deletions
diff --git a/SmartDeviceLink/private/SDLProtocol.m b/SmartDeviceLink/private/SDLProtocol.m
index 5f1b8302a..8f87bbdfb 100644
--- a/SmartDeviceLink/private/SDLProtocol.m
+++ b/SmartDeviceLink/private/SDLProtocol.m
@@ -397,6 +397,10 @@ NS_ASSUME_NONNULL_BEGIN
return YES;
}
+/// Receives an array of `SDLProtocolMessage` and attempts to encrypt their payloads in place through the active security manager. If anything fails, it will return NO and pass back the error.
+/// @param protocolMessages The array of protocol messages to encrypt.
+/// @param error A passback error object if attempting to encrypt the protocol message payloads fails.
+/// @returns YES if the encryption was successful, NO if it was not
- (BOOL)sdl_encryptProtocolMessages:(NSArray<SDLProtocolMessage *> *)protocolMessages error:(NSError *__autoreleasing *)error {
for (SDLProtocolMessage *message in protocolMessages) {
if (message.header.frameType == SDLFrameTypeFirst) { continue; }
@@ -438,7 +442,7 @@ NS_ASSUME_NONNULL_BEGIN
}
- (void)sendEncryptedRawData:(NSData *)data onService:(SDLServiceType)serviceType {
- // We need to chunk encrypted data beneath the max TLS size
+ // Break up data larger than the max TLS size so the data can be encrypted by the security manager without failing due to the data size being too big
NSUInteger offset = 0;
do {
NSUInteger remainingDataLength = data.length - offset;
diff --git a/SmartDeviceLinkTests/ProtocolSpecs/MessageSpecs/SDLProtocolSpec.m b/SmartDeviceLinkTests/ProtocolSpecs/MessageSpecs/SDLProtocolSpec.m
index aa6537b14..0dee191ef 100644
--- a/SmartDeviceLinkTests/ProtocolSpecs/MessageSpecs/SDLProtocolSpec.m
+++ b/SmartDeviceLinkTests/ProtocolSpecs/MessageSpecs/SDLProtocolSpec.m
@@ -372,7 +372,7 @@ describe(@"SendRPC Tests", ^{
testProtocol.securityManager = securityManager;
});
- fit(@"should correctly adjust the MTU size when the packet is encrypted and the service MTU size is larger than the TLS max size", ^{
+ it(@"should correctly adjust the MTU size when the packet is encrypted and the service MTU size is larger than the TLS max size", ^{
char dummyBytes[dataSize];
SDLDeleteCommand *deleteRequest = [[SDLDeleteCommand alloc] initWithId:55];
diff --git a/SmartDeviceLinkTests/ProtocolSpecs/SDLProtocolMessageDisassemblerSpec.m b/SmartDeviceLinkTests/ProtocolSpecs/SDLProtocolMessageDisassemblerSpec.m
index e2df2b5c8..a65652060 100644
--- a/SmartDeviceLinkTests/ProtocolSpecs/SDLProtocolMessageDisassemblerSpec.m
+++ b/SmartDeviceLinkTests/ProtocolSpecs/SDLProtocolMessageDisassemblerSpec.m
@@ -49,7 +49,7 @@ describe(@"SDLProtocolMessageDisassembler Tests", ^ {
context(@"when the MTU size is smaller than the payload size", ^{
it(@"Should disassemble the message properly", ^ {
- //Allocate 2000 bytes, and use it as sample data
+ //Allocate 4000 bytes and use it as sample data
const NSUInteger dataLength = 4000;
char dummyBytes[dataLength];
diff --git a/generator/rpc_spec b/generator/rpc_spec
-Subproject 72632f946941d63a57ee5e99896e3eae3627f7d
+Subproject 6b98355357b5b1893bbb59cb668d28545023457