From 6f5565403f723fd8705e3863a7a1812630ab616d Mon Sep 17 00:00:00 2001 From: Joel Fischer Date: Tue, 27 Apr 2021 15:18:37 -0400 Subject: Fix review comments --- SmartDeviceLink/private/SDLProtocol.m | 6 +++++- SmartDeviceLinkTests/ProtocolSpecs/MessageSpecs/SDLProtocolSpec.m | 2 +- .../ProtocolSpecs/SDLProtocolMessageDisassemblerSpec.m | 2 +- generator/rpc_spec | 2 +- 4 files changed, 8 insertions(+), 4 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 *)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 index 72632f946..6b9835535 160000 --- a/generator/rpc_spec +++ b/generator/rpc_spec @@ -1 +1 @@ -Subproject commit 72632f946941d63a57ee5e99896e3eae3627f7dd +Subproject commit 6b98355357b5b1893bbb59cb668d28545023457c -- cgit v1.2.1