Skip to content

Commit bbfcb96

Browse files
authored
Merge pull request #477 from #474
[#474]
2 parents 07a5e88 + f48b43d commit bbfcb96

File tree

6 files changed

+14
-13
lines changed

6 files changed

+14
-13
lines changed

include/crypto.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
/*
6161
** User Prototypes
6262
*/
63-
uint8_t gf_mul(uint8_t a, uint8_t b);
63+
uint8_t Crypto_gf_mul(uint8_t a, uint8_t b);
6464

6565
// Crypto Library Configuration functions
6666
extern int32_t Crypto_Config_CryptoLib(uint8_t key_type, uint8_t mc_type, uint8_t sa_type, uint8_t cryptography_type,
@@ -363,11 +363,11 @@ extern uint32_t crc32Table[CRC32TBL_SIZE];
363363
extern uint16_t crc16Table[CRC16TBL_SIZE];
364364

365365
// GF(2^4) field and logarithm tables
366-
static const uint8_t gf_exp[15] = {1, 2, 4, 8, 3, 6, 12, 11, 5, 10, 7, 14, 15, 13, 9};
366+
static const uint8_t crypto_gf_exp[15] = {1, 2, 4, 8, 3, 6, 12, 11, 5, 10, 7, 14, 15, 13, 9};
367367

368-
static const uint8_t gf_log[GF_SIZE] = {0, 0, 1, 4, 2, 8, 5, 10, 3, 14, 9, 7, 6, 13, 11, 12};
368+
static const uint8_t crypto_gf_log[GF_SIZE] = {0, 0, 1, 4, 2, 8, 5, 10, 3, 14, 9, 7, 6, 13, 11, 12};
369369

370370
// Generator polynomial coefficients for g(x) = x^4 + a^3x^3 + ax^2 + a^3x + 1
371-
static const uint8_t gen_poly[RS_PARITY + 1] = {1, 8, 2, 8, 1};
371+
static const uint8_t crypto_gen_poly[RS_PARITY + 1] = {1, 8, 2, 8, 1};
372372

373373
#endif // CRYPTO_H

src/core/crypto.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -434,15 +434,15 @@ uint16_t Crypto_Calc_CRC16(uint8_t *data, int size)
434434
return crc;
435435
}
436436

437-
uint8_t gf_mul(uint8_t a, uint8_t b)
437+
uint8_t Crypto_gf_mul(uint8_t a, uint8_t b)
438438
{
439439
if (a == 0 || b == 0)
440440
{
441441
return 0;
442442
}
443443
else
444444
{
445-
return gf_exp[(gf_log[a] + gf_log[b]) % (GF_SIZE - 1)];
445+
return crypto_gf_exp[(crypto_gf_log[a] + crypto_gf_log[b]) % (GF_SIZE - 1)];
446446
}
447447
}
448448

@@ -474,7 +474,7 @@ uint16_t Crypto_Calc_FHECF(uint8_t *data)
474474

475475
for (j = 0; j < RS_PARITY; j++)
476476
{
477-
parity[j] ^= gf_mul(feedback, gen_poly[j + 1]);
477+
parity[j] ^= Crypto_gf_mul(feedback, crypto_gen_poly[j + 1]);
478478
}
479479
}
480480
#ifdef AOS_DEBUG

src/core/crypto_config.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ int32_t Crypto_SC_Init(void)
7979
TC_CHECK_FECF_TRUE, 0x3F, SA_INCREMENT_NONTRANSMITTED_IV_TRUE);
8080
// TC
8181
GvcidManagedParameters_t TC_UT_Managed_Parameters = {
82-
0, 0x0003, 0, TC_HAS_FECF, AOS_FHEC_NA, AOS_IZ_NA, 0, TC_HAS_SEGMENT_HDRS, 1024, TC_OCF_NA, 1};
82+
0, 0x0003, 0, TC_NO_FECF, AOS_FHEC_NA, AOS_IZ_NA, 0, TC_HAS_SEGMENT_HDRS, 1024, TC_OCF_NA, 1};
8383
Crypto_Config_Add_Gvcid_Managed_Parameters(TC_UT_Managed_Parameters);
8484
TC_UT_Managed_Parameters.vcid = 2;
8585
Crypto_Config_Add_Gvcid_Managed_Parameters(TC_UT_Managed_Parameters);

src/sa/internal/sa_interface_inmemory.template.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1755,13 +1755,13 @@ static int32_t sa_status(uint8_t *ingest)
17551755

17561756
// Read ingest
17571757
spi = ((uint8_t)sdls_frame.tlv_pdu.data[0] << BYTE_LEN) | (uint8_t)sdls_frame.tlv_pdu.data[1];
1758-
printf("spi = %d \n", spi);
1758+
// printf("spi = %d \n", spi);
17591759

17601760
// Check SPI exists
17611761
if (spi < NUM_SA)
17621762
{
1763-
printf("SIZE: %ld\n", SDLS_SA_STATUS_RPLY_SIZE);
1764-
// Prepare for Reply
1763+
// printf("SIZE: %ld\n", SDLS_SA_STATUS_RPLY_SIZE);
1764+
// Prepare for Reply
17651765
sdls_frame.tlv_pdu.hdr.pdu_len = SDLS_SA_STATUS_RPLY_SIZE * BYTE_LEN;
17661766
sdls_frame.hdr.pkt_length =
17671767
CCSDS_HDR_SIZE + ECSS_PUS_SIZE + SDLS_TLV_HDR_SIZE + (sdls_frame.tlv_pdu.hdr.pdu_len / BYTE_LEN) - 1;

support/standalone/standalone.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,14 +473,15 @@ void *crypto_standalone_tc_apply(void *socks)
473473
}
474474
printf("\n");
475475
}
476-
476+
// printf("About to write to port %d!\n", tc_write_sock->port);
477477
/* Reply */
478478
status = sendto(tc_write_sock->sockfd, tc_out_ptr, tc_out_len, 0,
479479
(struct sockaddr *)&tc_write_sock->saddr, sizeof(tc_write_sock->saddr));
480480
if ((status == -1) || (status != tc_out_len))
481481
{
482482
printf("crypto_standalone_tc_apply - Reply error %d \n", status);
483483
}
484+
// printf("Allegedly wrote %d bytes to port %d!\n", tc_out_len, tc_write_sock->port);
484485
}
485486
else
486487
{

support/standalone/standalone.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ extern "C"
4848
*/
4949
#define CRYPTOLIB_HOSTNAME "cryptolib"
5050
#define GSW_HOSTNAME "cosmos"
51-
#define SC_HOSTNAME "radio-sim"
51+
#define SC_HOSTNAME "radio_sim"
5252
#define TC_APPLY_PORT 6010
5353
#define TC_APPLY_FWD_PORT 8010
5454
#define TM_PROCESS_PORT 8011

0 commit comments

Comments
 (0)