Skip to content

Commit 02d99d9

Browse files
authored
Merge pull request #395 from nasa/356-rename-crypto_tc_do_encrypt_nonplaintext
[#356] Renamed do_encrypt_plaintext to encrypt, do_encr…
2 parents c0c8973 + 6bacaeb commit 02d99d9

File tree

3 files changed

+21
-24
lines changed

3 files changed

+21
-24
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
name: CryptoLib
22

3-
global_env:
4-
CODECOV_TOKEN: 71699f25-12a3-44a4-8a83-be777b9e577a
5-
63
on:
74
pull_request:
85
branches: [ main, dev ]
@@ -57,7 +54,7 @@ jobs:
5754
- name: Upload
5855
uses: codecov/codecov-action@v4
5956
env:
60-
CODECOV_TOKEN: ${{ matrix.global_env.CODECOV_TOKEN }}
57+
CODECOV_TOKEN: 71699f25-12a3-44a4-8a83-be777b9e577a
6158
with:
6259
files: 'coverage/*.c.gcov'
6360
verbose: true
@@ -106,7 +103,7 @@ jobs:
106103
# - name: Upload
107104
# uses: codecov/codecov-action@v4
108105
# env:
109-
# CODECOV_TOKEN: ${{ matrix.global_env.CODECOV_TOKEN }}
106+
# CODECOV_TOKEN: 71699f25-12a3-44a4-8a83-be777b9e577a
110107
# with:
111108
# files: 'coverage/*.c.gcov'
112109
# verbose: true
@@ -159,7 +156,7 @@ jobs:
159156
- name: Upload
160157
uses: codecov/codecov-action@v4
161158
env:
162-
CODECOV_TOKEN: ${{ matrix.global_env.CODECOV_TOKEN }}
159+
CODECOV_TOKEN: 71699f25-12a3-44a4-8a83-be777b9e577a
163160
with:
164161
files: 'coverage/*.c.gcov'
165162
verbose: true
@@ -213,7 +210,7 @@ jobs:
213210
- name: Upload
214211
uses: codecov/codecov-action@v4
215212
env:
216-
CODECOV_TOKEN: ${{ matrix.global_env.CODECOV_TOKEN }}
213+
CODECOV_TOKEN: 71699f25-12a3-44a4-8a83-be777b9e577a
217214
with:
218215
files: 'coverage/*.c.gcov'
219216
verbose: true
@@ -247,7 +244,7 @@ jobs:
247244
- name: Upload
248245
uses: codecov/codecov-action@v4
249246
env:
250-
CODECOV_TOKEN: ${{ matrix.global_env.CODECOV_TOKEN }}
247+
CODECOV_TOKEN: 71699f25-12a3-44a4-8a83-be777b9e577a
251248
with:
252249
files: 'coverage/*.c.gcov'
253-
verbose: true
250+
verbose: true

include/crypto.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,12 @@ int32_t Crypto_TC_Frame_Validation(uint16_t *p_enc_frame_len);
136136
int32_t Crypto_TC_Accio_Buffer(uint8_t **p_new_enc_frame, uint16_t *p_enc_frame_len);
137137
int32_t Crypto_TC_ACS_Algo_Check(SecurityAssociation_t *sa_ptr);
138138
int32_t Crypto_TC_Check_IV_Setup(SecurityAssociation_t *sa_ptr, uint8_t *p_new_enc_frame, uint16_t *index);
139-
int32_t Crypto_TC_Do_Encrypt_PLAINTEXT(uint8_t sa_service_type, SecurityAssociation_t *sa_ptr, uint16_t *mac_loc,
139+
int32_t Crypto_TC_Encrypt(uint8_t sa_service_type, SecurityAssociation_t *sa_ptr, uint16_t *mac_loc,
140140
uint16_t tf_payload_len, uint8_t segment_hdr_len, uint8_t *p_new_enc_frame,
141141
crypto_key_t *ekp, uint8_t **aad, uint8_t ecs_is_aead_algorithm,
142142
uint16_t *index_p, const uint8_t *p_in_frame, char *cam_cookies,
143143
uint32_t pkcs_padding);
144-
void Crypto_TC_Do_Encrypt_NONPLAINTEXT(uint8_t sa_service_type, SecurityAssociation_t *sa_ptr);
144+
void Crypto_TC_Increment_IV_ARSN(uint8_t sa_service_type, SecurityAssociation_t *sa_ptr);
145145
int32_t Crypto_TC_Do_Encrypt(uint8_t sa_service_type, SecurityAssociation_t *sa_ptr, uint16_t *mac_loc,
146146
uint16_t tf_payload_len, uint8_t segment_hdr_len, uint8_t *p_new_enc_frame,
147147
crypto_key_t *ekp, uint8_t **aad, uint8_t ecs_is_aead_algorithm, uint16_t *index_p,

src/core/crypto_tc.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ int32_t Crypto_TC_Check_IV_Setup(SecurityAssociation_t *sa_ptr, uint8_t *p_new_e
323323
}
324324

325325
/**
326-
* @brief Function: Crypto_TC_Do_Encrypt_PLAINTEXT
326+
* @brief Function: Crypto_TC_Encrypt
327327
* Handles Plaintext TC Encryption
328328
* @param sa_service_type: uint8_t
329329
* @param sa_ptr: SecurityAssociation_t*
@@ -340,11 +340,11 @@ int32_t Crypto_TC_Check_IV_Setup(SecurityAssociation_t *sa_ptr, uint8_t *p_new_e
340340
* @param pkcs_padding:uint32_t
341341
* @return int32: Success/Failure
342342
**/
343-
int32_t Crypto_TC_Do_Encrypt_PLAINTEXT(uint8_t sa_service_type, SecurityAssociation_t *sa_ptr, uint16_t *mac_loc,
344-
uint16_t tf_payload_len, uint8_t segment_hdr_len, uint8_t *p_new_enc_frame,
345-
crypto_key_t *ekp, uint8_t **aad, uint8_t ecs_is_aead_algorithm,
346-
uint16_t *index_p, const uint8_t *p_in_frame, char *cam_cookies,
347-
uint32_t pkcs_padding)
343+
int32_t Crypto_TC_Encrypt(uint8_t sa_service_type, SecurityAssociation_t *sa_ptr, uint16_t *mac_loc,
344+
uint16_t tf_payload_len, uint8_t segment_hdr_len, uint8_t *p_new_enc_frame,
345+
crypto_key_t *ekp, uint8_t **aad, uint8_t ecs_is_aead_algorithm,
346+
uint16_t *index_p, const uint8_t *p_in_frame, char *cam_cookies,
347+
uint32_t pkcs_padding)
348348
{
349349
int32_t status = CRYPTO_LIB_SUCCESS;
350350
uint16_t index = *index_p;
@@ -524,13 +524,13 @@ int32_t Crypto_TC_Do_Encrypt_PLAINTEXT(uint8_t sa_service_type, SecurityAssociat
524524
}
525525

526526
/**
527-
* @brief Function: Crypto_TC_Do_Encrypt_NONPLAINTEXT
528-
* Handles NON-Plaintext TC Encryption
527+
* @brief Function: Crypto_TC_Increment_IV_ARSN
528+
* Handles Incrementing IV and ARSN of SA
529529
* @param sa_service_type: uint8_t
530530
* @param sa_ptr: SecurityAssociation_t*
531531
* @return int32: Success/Failure
532532
**/
533-
void Crypto_TC_Do_Encrypt_NONPLAINTEXT(uint8_t sa_service_type, SecurityAssociation_t *sa_ptr)
533+
void Crypto_TC_Increment_IV_ARSN(uint8_t sa_service_type, SecurityAssociation_t *sa_ptr)
534534
{
535535
if (sa_service_type != SA_PLAINTEXT)
536536
{
@@ -617,17 +617,17 @@ int32_t Crypto_TC_Do_Encrypt(uint8_t sa_service_type, SecurityAssociation_t *sa_
617617
{
618618
int32_t status = CRYPTO_LIB_SUCCESS;
619619
uint16_t index = *index_p;
620-
status = Crypto_TC_Do_Encrypt_PLAINTEXT(sa_service_type, sa_ptr, mac_loc, tf_payload_len, segment_hdr_len,
621-
p_new_enc_frame, ekp, aad, ecs_is_aead_algorithm, index_p, p_in_frame,
622-
cam_cookies, pkcs_padding);
620+
status = Crypto_TC_Encrypt(sa_service_type, sa_ptr, mac_loc, tf_payload_len, segment_hdr_len,
621+
p_new_enc_frame, ekp, aad, ecs_is_aead_algorithm, index_p, p_in_frame,
622+
cam_cookies, pkcs_padding);
623623
if (status != CRYPTO_LIB_SUCCESS)
624624
{
625625
Crypto_TC_Safe_Free_Ptr(*aad);
626626
mc_if->mc_log(status);
627627
return status;
628628
}
629629
// TODO: Status?
630-
Crypto_TC_Do_Encrypt_NONPLAINTEXT(sa_service_type, sa_ptr);
630+
Crypto_TC_Increment_IV_ARSN(sa_service_type, sa_ptr);
631631
/*
632632
** End Authentication / Encryption
633633
*/

0 commit comments

Comments
 (0)