Skip to content

Commit

Permalink
Fix review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
joeljfischer committed Apr 27, 2021
1 parent 8a34f69 commit 6f55654
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion SmartDeviceLink/private/SDLProtocol.m
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,10 @@ - (BOOL)sendRPC:(SDLRPCMessage *)message encrypted:(BOOL)encryption error:(NSErr
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; }
Expand Down Expand Up @@ -438,7 +442,7 @@ - (void)sendRawData:(NSData *)data withServiceType:(SDLServiceType)serviceType {
}

- (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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@
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];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

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];

Expand Down
2 changes: 1 addition & 1 deletion generator/rpc_spec
Submodule rpc_spec updated 1 files
+26 −26 MOBILE_API.xml

0 comments on commit 6f55654

Please sign in to comment.