Skip to content

Commit 96e26c9

Browse files
committed
[#375] Ran formatter
1 parent a0433de commit 96e26c9

21 files changed

+373
-288
lines changed

include/crypto_config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
#define CHALLENGE_MAC_SIZE 16 /* bytes */
137137
#define BYTE_LEN 8 /* bits */
138138
#define CRYPTOLIB_APPID 128
139-
#define MAX_IV_LEN 32 /* bytes */
139+
#define MAX_IV_LEN 32 /* bytes */
140140

141141
// Monitoring and Control Defines
142142
#define EMV_SIZE 4 /* bytes */

include/crypto_error.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@
151151
#define CRYPTO_LIB_ERR_TM_FL_LT_MAX_FRAME_SIZE (-78)
152152
#define CRYPTO_LIB_ERR_INVALID_FHECF (-79)
153153

154-
155154
#define CRYPTO_CORE_ERROR_CODES_MAX -79
156155

157156
// Define codes for returning MDB Strings, and determining error based on strings

include/crypto_structs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,8 @@ typedef struct
346346
typedef struct
347347
{
348348
CCSDS_SPP_HDR_t hdr;
349-
ECSS_PUS_t pus;
350-
SDLS_TLV_t tlv_pdu;
349+
ECSS_PUS_t pus;
350+
SDLS_TLV_t tlv_pdu;
351351
} __attribute__((packed)) CCSDS_t;
352352
#define CCSDS_SIZE (sizeof(CCSDS_t))
353353

src/core/crypto.c

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,8 @@ uint8_t Crypto_Prep_Reply(uint8_t *reply, uint8_t appID)
298298
}
299299

300300
// Fill reply with Tag and Length
301-
reply[count++] = (sdls_frame.tlv_pdu.hdr.type << 7) | (sdls_frame.tlv_pdu.hdr.uf << 6) | (sdls_frame.tlv_pdu.hdr.sg << 4) |
302-
(sdls_frame.tlv_pdu.hdr.pid);
301+
reply[count++] = (sdls_frame.tlv_pdu.hdr.type << 7) | (sdls_frame.tlv_pdu.hdr.uf << 6) |
302+
(sdls_frame.tlv_pdu.hdr.sg << 4) | (sdls_frame.tlv_pdu.hdr.pid);
303303
reply[count++] = (sdls_frame.tlv_pdu.hdr.pdu_len & 0xFF00) >> 8;
304304
reply[count++] = (sdls_frame.tlv_pdu.hdr.pdu_len & 0x00FF);
305305

@@ -894,7 +894,7 @@ int32_t Crypto_Process_Extended_Procedure_Pdu(TC_t *tc_sdls_processed_frame, uin
894894
sdls_frame.pus.sid = (tc_sdls_processed_frame->tc_pdu[9] & 0xF0) >> 4;
895895
sdls_frame.pus.spare = (tc_sdls_processed_frame->tc_pdu[9] & 0x0F);
896896

897-
// SDLS TLV PDU
897+
// SDLS TLV PDU
898898
sdls_frame.tlv_pdu.hdr.type = (tc_sdls_processed_frame->tc_pdu[10] & 0x80) >> 7;
899899
sdls_frame.tlv_pdu.hdr.uf = (tc_sdls_processed_frame->tc_pdu[10] & 0x40) >> 6;
900900
sdls_frame.tlv_pdu.hdr.sg = (tc_sdls_processed_frame->tc_pdu[10] & 0x30) >> 4;
@@ -903,25 +903,28 @@ int32_t Crypto_Process_Extended_Procedure_Pdu(TC_t *tc_sdls_processed_frame, uin
903903
(tc_sdls_processed_frame->tc_pdu[11] << 8) | tc_sdls_processed_frame->tc_pdu[12];
904904

905905
// Subtract headers from total frame length
906-
uint16_t derived_tlv = (tc_sdls_processed_frame->tc_pdu_len - CCSDS_HDR_SIZE - ECSS_PUS_SIZE - SDLS_TLV_HDR_SIZE);
906+
uint16_t derived_tlv =
907+
(tc_sdls_processed_frame->tc_pdu_len - CCSDS_HDR_SIZE - ECSS_PUS_SIZE - SDLS_TLV_HDR_SIZE);
907908
len_ingest = len_ingest; // suppress error for now
908909
#ifdef CCSDS_DEBUG
909910
printf("Printing lengths for sanity check:\n");
910911
printf("\t TC Frame Header Length (bytes): %d \n", tc_sdls_processed_frame->tc_header.fl);
911-
printf("\t TC Frame Actual Length (bytes): %d \n", tc_sdls_processed_frame->tc_header.fl+1);
912+
printf("\t TC Frame Actual Length (bytes): %d \n", tc_sdls_processed_frame->tc_header.fl + 1);
912913
printf("\t TC Frame Space Pkt Length (bytes): %d \n", tc_sdls_processed_frame->tc_pdu_len);
913914
printf("\t Received TLV Length (bits): %d \n", sdls_frame.tlv_pdu.hdr.pdu_len);
914915
printf("\t Derived TLV Length (bytes): %d \n", derived_tlv);
915-
printf("\t Received TLV Length (bytes): %f \n", sdls_frame.tlv_pdu.hdr.pdu_len/8.0);
916+
printf("\t Received TLV Length (bytes): %f \n", sdls_frame.tlv_pdu.hdr.pdu_len / 8.0);
916917
#endif
917918
// Sanity check - does the length of the pdu header match the number of bytes we have?
918-
// CODE REVIEW - PDUs allow lengths in bits, it is plausible that only a few bits of a byte are needed
919-
// but would require a full byte for transmission. I can't find anything atm in docs to dispute this
920-
if (((double)(sdls_frame.tlv_pdu.hdr.pdu_len/8.0) != derived_tlv) && (floor((double)(sdls_frame.tlv_pdu.hdr.pdu_len/8.0)) != derived_tlv-1))
919+
// CODE REVIEW - PDUs allow lengths in bits, it is plausible that only a few bits of a byte are
920+
// needed but would require a full byte for transmission. I can't find anything atm in docs to
921+
// dispute this
922+
if (((double)(sdls_frame.tlv_pdu.hdr.pdu_len / 8.0) != derived_tlv) &&
923+
(floor((double)(sdls_frame.tlv_pdu.hdr.pdu_len / 8.0)) != derived_tlv - 1))
921924
{
922925
#ifdef PDU_DEBUG
923926
printf(KRED "Packet PDU_LEN Not Equal To Derived PDU Len\n" RESET);
924-
#endif
927+
#endif
925928
return CRYPTO_LIB_ERR_BAD_TLV_LENGTH;
926929
}
927930

@@ -936,7 +939,7 @@ int32_t Crypto_Process_Extended_Procedure_Pdu(TC_t *tc_sdls_processed_frame, uin
936939
{
937940
#ifdef PDU_DEBUG
938941
printf(KRED "Packet Header Length GT TLV_DATA_SIZE\n" RESET);
939-
#endif
942+
#endif
940943
status = CRYPTO_LIB_ERR_BAD_TLV_LENGTH;
941944
return status;
942945
}
@@ -954,15 +957,15 @@ int32_t Crypto_Process_Extended_Procedure_Pdu(TC_t *tc_sdls_processed_frame, uin
954957

955958
// Make sure TLV isn't larger than we have allocated, and it is sane given total frame length
956959
uint16_t max_tlv = tc_sdls_processed_frame->tc_header.fl - CCSDS_HDR_SIZE - SDLS_TLV_HDR_SIZE;
957-
len_ingest = len_ingest; // suppress error for now
960+
len_ingest = len_ingest; // suppress error for now
958961
#ifdef PDU_DEBUG
959-
printf("PDU_LEN: %d\n",sdls_frame.tlv_pdu.hdr.pdu_len);
960-
#endif
962+
printf("PDU_LEN: %d\n", sdls_frame.tlv_pdu.hdr.pdu_len);
963+
#endif
961964
if ((sdls_frame.tlv_pdu.hdr.pdu_len / 8) > max_tlv)
962965
{
963966
#ifdef PDU_DEBUG
964967
printf(KRED "PDU_LEN GT MAX_TLV\n" RESET);
965-
#endif
968+
#endif
966969
return CRYPTO_LIB_ERR_BAD_TLV_LENGTH;
967970
}
968971
if ((sdls_frame.hdr.pkt_length < TLV_DATA_SIZE) && (sdls_frame.hdr.pkt_length < max_tlv))
@@ -1019,7 +1022,7 @@ int32_t Crypto_Process_Extended_Procedure_Pdu(TC_t *tc_sdls_processed_frame, uin
10191022
#endif
10201023
// No Packet HDR or PUS in these frames
10211024
// SDLS TLV PDU
1022-
sdls_frame.hdr.type = (tc_sdls_processed_frame->tc_pdu[0] & 0x80) >> 7;
1025+
sdls_frame.hdr.type = (tc_sdls_processed_frame->tc_pdu[0] & 0x80) >> 7;
10231026
sdls_frame.tlv_pdu.hdr.uf = (tc_sdls_processed_frame->tc_pdu[0] & 0x40) >> 6;
10241027
sdls_frame.tlv_pdu.hdr.sg = (tc_sdls_processed_frame->tc_pdu[0] & 0x30) >> 4;
10251028
sdls_frame.tlv_pdu.hdr.pid = (tc_sdls_processed_frame->tc_pdu[0] & 0x0F);

src/core/crypto_aos.c

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ int32_t Crypto_AOS_ApplySecurity(uint8_t *pTfBuffer, uint16_t len_ingest)
5555
uint32_t pkcs_padding = 0;
5656
uint16_t new_fecf = 0x0000;
5757
uint8_t ecs_is_aead_algorithm;
58-
SecurityAssociation_t *sa_ptr = NULL;
59-
uint8_t tfvn = 0;
60-
uint16_t scid = 0;
61-
uint16_t vcid = 0;
58+
SecurityAssociation_t *sa_ptr = NULL;
59+
uint8_t tfvn = 0;
60+
uint16_t scid = 0;
61+
uint16_t vcid = 0;
6262
uint16_t cbc_padding = 0;
6363

6464
// Prevent set but unused error
@@ -122,15 +122,16 @@ int32_t Crypto_AOS_ApplySecurity(uint8_t *pTfBuffer, uint16_t len_ingest)
122122
return status;
123123
}
124124

125-
if((len_ingest < current_managed_parameters_struct.max_frame_size) && (sa_ptr->ecs != CRYPTO_CIPHER_AES256_CBC) && (sa_ptr->ecs != CRYPTO_CIPHER_AES256_CBC_MAC))
125+
if ((len_ingest < current_managed_parameters_struct.max_frame_size) && (sa_ptr->ecs != CRYPTO_CIPHER_AES256_CBC) &&
126+
(sa_ptr->ecs != CRYPTO_CIPHER_AES256_CBC_MAC))
126127
{
127128
status = CRYPTO_LIB_ERR_AOS_FL_LT_MAX_FRAME_SIZE;
128129
mc_if->mc_log(status);
129130
return status;
130131
}
131132
else if ((sa_ptr->ecs == CRYPTO_CIPHER_AES256_CBC) || (sa_ptr->ecs == CRYPTO_CIPHER_AES256_CBC_MAC))
132133
{
133-
if((current_managed_parameters_struct.max_frame_size - len_ingest) <= 16)
134+
if ((current_managed_parameters_struct.max_frame_size - len_ingest) <= 16)
134135
{
135136
cbc_padding = current_managed_parameters_struct.max_frame_size - len_ingest;
136137
}
@@ -217,9 +218,9 @@ int32_t Crypto_AOS_ApplySecurity(uint8_t *pTfBuffer, uint16_t len_ingest)
217218
printf(KYEL "Calculating FHECF...\n" RESET);
218219
#endif
219220
uint16_t calculated_fhecf = Crypto_Calc_FHECF(pTfBuffer);
220-
pTfBuffer[idx] = (calculated_fhecf >> 8) & 0x00FF ;
221-
pTfBuffer[idx+1] = (calculated_fhecf) & 0x00FF ;
222-
idx = 8;
221+
pTfBuffer[idx] = (calculated_fhecf >> 8) & 0x00FF;
222+
pTfBuffer[idx + 1] = (calculated_fhecf)&0x00FF;
223+
idx = 8;
223224
}
224225

225226
// Detect if optional variable length Insert Zone is present
@@ -378,7 +379,7 @@ int32_t Crypto_AOS_ApplySecurity(uint8_t *pTfBuffer, uint16_t len_ingest)
378379
pdu_len -= 2;
379380
}
380381

381-
if(current_managed_parameters_struct.max_frame_size < pdu_len)
382+
if (current_managed_parameters_struct.max_frame_size < pdu_len)
382383
{
383384
status = CRYPTO_LIB_ERR_AOS_FRAME_LENGTH_UNDERFLOW;
384385
mc_if->mc_log(status);
@@ -708,13 +709,13 @@ int32_t Crypto_AOS_ProcessSecurity(uint8_t *p_ingest, uint16_t len_ingest, uint8
708709
uint8_t ecs_is_aead_algorithm;
709710
uint32_t encryption_cipher = 0;
710711
uint8_t iv_loc = 0;
711-
int mac_loc = 0;
712-
uint16_t pdu_len = 1;
713-
uint8_t *p_new_dec_frame = NULL;
714-
SecurityAssociation_t *sa_ptr = NULL;
715-
uint8_t sa_service_type = -1;
716-
uint8_t spi = -1;
717-
uint8_t aos_hdr_len = 6;
712+
int mac_loc = 0;
713+
uint16_t pdu_len = 1;
714+
uint8_t *p_new_dec_frame = NULL;
715+
SecurityAssociation_t *sa_ptr = NULL;
716+
uint8_t sa_service_type = -1;
717+
uint8_t spi = -1;
718+
uint8_t aos_hdr_len = 6;
718719

719720
// Bit math to give concise access to values in the ingest
720721
aos_frame_pri_hdr.tfvn = ((uint8_t)p_ingest[0] & 0xC0) >> 6;

src/core/crypto_key_mgmt.c

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,17 @@ int32_t Crypto_Key_OTAR(void)
4545
int y;
4646
int32_t status = CRYPTO_LIB_SUCCESS;
4747

48-
int pdu_keys = ((sdls_frame.tlv_pdu.hdr.pdu_len/BYTE_LEN) - SDLS_KEYID_LEN - SDLS_IV_LEN - MAC_SIZE) / (SDLS_KEYID_LEN + SDLS_KEY_LEN);
48+
int pdu_keys = ((sdls_frame.tlv_pdu.hdr.pdu_len / BYTE_LEN) - SDLS_KEYID_LEN - SDLS_IV_LEN - MAC_SIZE) /
49+
(SDLS_KEYID_LEN + SDLS_KEY_LEN);
4950

5051
int w;
51-
crypto_key_t *ekp = NULL;
52+
crypto_key_t *ekp = NULL;
5253
int expected_pdu_len = SDLS_KEYID_LEN + SDLS_IV_LEN + ((SDLS_KEYID_LEN + SDLS_KEY_LEN) * pdu_keys) + MAC_SIZE;
5354
#ifdef DEBUG
5455
printf("Expected PDU Length: %d (%d keys)\n", expected_pdu_len, pdu_keys);
5556
#endif
56-
if ((sdls_frame.tlv_pdu.hdr.pdu_len / BYTE_LEN) < SDLS_KEYID_LEN + SDLS_IV_LEN + ((SDLS_KEYID_LEN + SDLS_KEY_LEN) * pdu_keys) + MAC_SIZE)
57+
if ((sdls_frame.tlv_pdu.hdr.pdu_len / BYTE_LEN) <
58+
SDLS_KEYID_LEN + SDLS_IV_LEN + ((SDLS_KEYID_LEN + SDLS_KEY_LEN) * pdu_keys) + MAC_SIZE)
5759
{
5860
return CRYPTO_LIB_ERR_OTAR_BAD_TLV_LENGTH;
5961
}
@@ -93,7 +95,7 @@ int32_t Crypto_Key_OTAR(void)
9395
#endif
9496
}
9597

96-
count = (sdls_frame.tlv_pdu.hdr.pdu_len/8) - MAC_SIZE;
98+
count = (sdls_frame.tlv_pdu.hdr.pdu_len / 8) - MAC_SIZE;
9799
for (w = 0; w < MAC_SIZE; w++)
98100
{ // MAC
99101
packet.mac[w] = sdls_frame.tlv_pdu.data[count + w];
@@ -117,7 +119,7 @@ int32_t Crypto_Key_OTAR(void)
117119

118120
uint8_t ecs = CRYPTO_CIPHER_AES256_GCM; // Per SDLS baseline
119121
status = cryptography_if->cryptography_aead_decrypt(
120-
&(sdls_frame.tlv_pdu.data[14]), // plaintext output
122+
&(sdls_frame.tlv_pdu.data[14]), // plaintext output
121123
(size_t)(pdu_keys * (SDLS_KEYID_LEN + SDLS_KEY_LEN)), // length of data
122124
NULL, // in place decryption
123125
0, // in data length
@@ -229,8 +231,8 @@ int32_t Crypto_Key_update(uint8_t state)
229231
int32_t status;
230232
crypto_key_t *ekp = NULL;
231233
int x;
232-
int pdu_length = sdls_frame.tlv_pdu.hdr.pdu_len / 8;
233-
int frame_length = sdls_frame.hdr.pkt_length;
234+
int pdu_length = sdls_frame.tlv_pdu.hdr.pdu_len / 8;
235+
int frame_length = sdls_frame.hdr.pkt_length;
234236

235237
if (key_if == NULL)
236238
{
@@ -243,7 +245,8 @@ int32_t Crypto_Key_update(uint8_t state)
243245
printf(KYEL "PDU Length not long enough to hold key values\n" RESET);
244246
#endif
245247
}
246-
if ((state == KEY_DEACTIVATED || state == KEY_ACTIVE) && (pdu_length > SDLS_MAX_KEY_UPDATE_LEN || pdu_length > frame_length))
248+
if ((state == KEY_DEACTIVATED || state == KEY_ACTIVE) &&
249+
(pdu_length > SDLS_MAX_KEY_UPDATE_LEN || pdu_length > frame_length))
247250
{
248251
#ifdef PDU_DEBUG
249252
printf(KRED "PDU Length Exceded!\n" RESET);
@@ -260,7 +263,7 @@ int32_t Crypto_Key_update(uint8_t state)
260263
{
261264
#ifdef PDU_DEBUG
262265
printf(KRED "\nMax key updates exceded, exiting...\n" RESET);
263-
#endif
266+
#endif
264267
return CRYPTO_LIB_ERROR;
265268
}
266269

@@ -378,15 +381,17 @@ int32_t Crypto_Key_inventory(uint8_t *ingest)
378381
}
379382

380383
// Read in PDU
381-
packet.kid_first = ((uint8_t)sdls_frame.tlv_pdu.data[count] << BYTE_LEN) | ((uint8_t)sdls_frame.tlv_pdu.data[count + 1]);
382-
count = count + 2;
383-
packet.kid_last = ((uint8_t)sdls_frame.tlv_pdu.data[count] << BYTE_LEN) | ((uint8_t)sdls_frame.tlv_pdu.data[count + 1]);
384-
count = count + 2;
384+
packet.kid_first =
385+
((uint8_t)sdls_frame.tlv_pdu.data[count] << BYTE_LEN) | ((uint8_t)sdls_frame.tlv_pdu.data[count + 1]);
386+
count = count + 2;
387+
packet.kid_last =
388+
((uint8_t)sdls_frame.tlv_pdu.data[count] << BYTE_LEN) | ((uint8_t)sdls_frame.tlv_pdu.data[count + 1]);
389+
count = count + 2;
385390

386391
// Prepare for Reply
387-
range = packet.kid_last - packet.kid_first + 1;
392+
range = packet.kid_last - packet.kid_first + 1;
388393
sdls_frame.tlv_pdu.hdr.pdu_len = (SDLS_KEY_INVENTORY_RPLY_SIZE * (range)) * BYTE_LEN;
389-
sdls_frame.hdr.pkt_length = CCSDS_HDR_SIZE + ECSS_PUS_SIZE + SDLS_TLV_HDR_SIZE +
394+
sdls_frame.hdr.pkt_length = CCSDS_HDR_SIZE + ECSS_PUS_SIZE + SDLS_TLV_HDR_SIZE +
390395
(sdls_frame.tlv_pdu.hdr.pdu_len / BYTE_LEN) - 1 +
391396
2; // 2 = Num Keys Returned Field (2 Bytes)
392397
count = Crypto_Prep_Reply(sdls_ep_reply, CRYPTOLIB_APPID);
@@ -427,7 +432,7 @@ int32_t Crypto_Key_verify(TC_t *tc_frame)
427432
{
428433
// Local variables
429434
SDLS_KEYV_CMD_t packet;
430-
int pdu_keys = (sdls_frame.tlv_pdu.hdr.pdu_len/ 8) / SDLS_KEYV_CMD_BLK_SIZE;
435+
int pdu_keys = (sdls_frame.tlv_pdu.hdr.pdu_len / 8) / SDLS_KEYV_CMD_BLK_SIZE;
431436
int x;
432437
int y;
433438
uint16_t count = 0;
@@ -475,11 +480,12 @@ int32_t Crypto_Key_verify(TC_t *tc_frame)
475480
{
476481
sdls_frame.hdr.pkt_length =
477482
CCSDS_HDR_SIZE + ECSS_PUS_SIZE + SDLS_TLV_HDR_SIZE + (sdls_frame.tlv_pdu.hdr.pdu_len / BYTE_LEN) - 1;
478-
printf("NO PUS: sdls_frame.hdr.pkt_length Calced as %d\n", sdls_frame.hdr.pkt_length);
483+
printf("NO PUS: sdls_frame.hdr.pkt_length Calced as %d\n", sdls_frame.hdr.pkt_length);
479484
}
480485
else
481486
{
482-
sdls_frame.hdr.pkt_length = CCSDS_HDR_SIZE + SDLS_TLV_HDR_SIZE + (sdls_frame.tlv_pdu.hdr.pdu_len / BYTE_LEN) - 1;
487+
sdls_frame.hdr.pkt_length =
488+
CCSDS_HDR_SIZE + SDLS_TLV_HDR_SIZE + (sdls_frame.tlv_pdu.hdr.pdu_len / BYTE_LEN) - 1;
483489
printf("WITH PUS: sdls_frame.hdr.pkt_length Calced as %d\n", sdls_frame.hdr.pkt_length);
484490
}
485491

@@ -491,10 +497,10 @@ int32_t Crypto_Key_verify(TC_t *tc_frame)
491497
// Key ID
492498
sdls_ep_keyv_reply.blk[x].kid = packet.blk[x].kid;
493499

494-
sdls_ep_reply[pdu_data_idx] = (packet.blk[x].kid & 0xFF00) >> BYTE_LEN;
500+
sdls_ep_reply[pdu_data_idx] = (packet.blk[x].kid & 0xFF00) >> BYTE_LEN;
495501
pdu_data_idx += 1;
496502

497-
sdls_ep_reply[pdu_data_idx] = (packet.blk[x].kid & 0x00FF);
503+
sdls_ep_reply[pdu_data_idx] = (packet.blk[x].kid & 0x00FF);
498504
pdu_data_idx += 1;
499505
count += 2;
500506

@@ -508,14 +514,14 @@ int32_t Crypto_Key_verify(TC_t *tc_frame)
508514
// Initialization Vector
509515
for (y = 0; y < SDLS_IV_LEN; y++)
510516
{
511-
sdls_ep_keyv_reply.blk[x].iv[y] = 0x00; //= *(tc_frame->tc_sec_header.iv + y);
512-
sdls_ep_reply[pdu_data_idx] = 0x00; //= *(tc_frame->tc_sec_header.iv + y);
517+
sdls_ep_keyv_reply.blk[x].iv[y] = 0x00; //= *(tc_frame->tc_sec_header.iv + y);
518+
sdls_ep_reply[pdu_data_idx] = 0x00; //= *(tc_frame->tc_sec_header.iv + y);
513519
pdu_data_idx += 1;
514520
count += 1;
515521
}
516522
// ***** This increments the lowest bytes of the IVs so they aren't identical
517-
sdls_ep_keyv_reply.blk[x].iv[SDLS_IV_LEN - 1] = sdls_ep_keyv_reply.blk[x].iv[SDLS_IV_LEN - 1] + x + 1;
518-
sdls_ep_reply[pdu_data_idx - 1] = sdls_ep_reply[pdu_data_idx - 1] + x + 1;
523+
sdls_ep_keyv_reply.blk[x].iv[SDLS_IV_LEN - 1] = sdls_ep_keyv_reply.blk[x].iv[SDLS_IV_LEN - 1] + x + 1;
524+
sdls_ep_reply[pdu_data_idx - 1] = sdls_ep_reply[pdu_data_idx - 1] + x + 1;
519525

520526
// Encrypt challenge
521527
uint8_t ecs = CRYPTO_CIPHER_AES256_GCM;

src/core/crypto_mc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ int32_t Crypto_MC_selftest(uint8_t *ingest)
230230
sdls_frame.hdr.pkt_length =
231231
CCSDS_HDR_SIZE + ECSS_PUS_SIZE + SDLS_TLV_HDR_SIZE + (sdls_frame.tlv_pdu.hdr.pdu_len / BYTE_LEN) - 1;
232232
sdls_frame.tlv_pdu.data[0] = result;
233-
count = Crypto_Prep_Reply(sdls_ep_reply, CRYPTOLIB_APPID);
233+
count = Crypto_Prep_Reply(sdls_ep_reply, CRYPTOLIB_APPID);
234234

235235
sdls_ep_reply[count] = result;
236236
count++;
@@ -271,7 +271,7 @@ int32_t Crypto_SA_readARSN(uint8_t *ingest)
271271

272272
// Read ingest
273273
spi = ((uint8_t)sdls_frame.tlv_pdu.data[0] << BYTE_LEN) | (uint8_t)sdls_frame.tlv_pdu.data[1];
274-
274+
275275
status = sa_if->sa_get_from_spi(spi, &sa_ptr);
276276

277277
if (status != CRYPTO_LIB_SUCCESS)

0 commit comments

Comments
 (0)