Skip to content

Commit 552a20f

Browse files
authored
469 dcs ci workflow (#470)
* [#469] intial DCS CI test * [#469] remove sudo * [#469] try to fix python * [#469] try to fix python (2) * [#469] try to fix python (3) * [#469] try to fix python (4) * [#469] debug DCS clone * [#469] debug DCS clone (2) * [#469] debug DCS clone (3) * [#469] debug DCS clone (4) * [#469] debug DCS clone (5) * [#469] debug DCS clone (6) * [#469] debug DCS clone (7) * [#469] debug DCS clone (8) * [#469] debug DCS clone (9) * [#469] debug DCS clone (10) * [#469] debug DCS clone (11) * [#469] debug DCS clone (12) * [#469] debug DCS clone (13) * [#469] debug DCS clone (14) * [#469] debug DCS clone (15) * [#469] debug DCS clone (16) * [#469] debug DCS clone (17) * [#469] debug DCS clone (18) * [#469] take care off -Werror warnings * [#469] take care off -Werror warnings (2) * [#469] download jars to runner * [#469] remove CI debug prints * [#469] remove run on push
1 parent 187358b commit 552a20f

File tree

2 files changed

+48
-65
lines changed

2 files changed

+48
-65
lines changed

.github/workflows/build.yml

Lines changed: 39 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -62,50 +62,45 @@ jobs:
6262
#
6363
# KMC Build
6464
#
65-
# kmc_build:
66-
# # Container Setup
67-
# runs-on: ubuntu-latest
68-
# steps:
69-
# - uses: actions/checkout@v4
70-
# - name: Update
71-
# run: sudo apt-get update
72-
# - name: Install Dependencies
73-
# run: sudo apt-get install -y lcov libcurl4-openssl-dev libmariadb-dev libmariadb-dev-compat python3
74-
# - name: Install Python Libraries
75-
# run: sudo pip install pycryptodome
76-
# - name: Install Libgcrypt
77-
# run: >
78-
# curl
79-
# -LS https://www.gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-1.50.tar.bz2
80-
# -o /tmp/libgpg-error-1.50.tar.bz2
81-
# && tar -xjf /tmp/libgpg-error-1.50.tar.bz2 -C /tmp/
82-
# && cd /tmp/libgpg-error-1.50
83-
# && sudo ./configure
84-
# && sudo make install
85-
# && curl
86-
# -LS https://www.gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-1.11.0.tar.bz2
87-
# -o /tmp/libgcrypt-1.11.0.tar.bz2
88-
# && tar -xjf /tmp/libgcrypt-1.11.0.tar.bz2 -C /tmp/
89-
# && cd /tmp/libgcrypt-1.11.0
90-
# && sudo ./configure
91-
# && sudo make install
92-
# && sudo ldconfig
93-
# # End Container Setup
94-
95-
# - name: KMC Build Script
96-
# working-directory: ${{github.workspace}}
97-
# run: bash ${GITHUB_WORKSPACE}/support/scripts/build_kmc.sh
98-
99-
# - name: Code-Coverage
100-
# working-directory: ${{github.workspace}}
101-
# run: make gcov
102-
103-
# - name: Upload
104-
# uses: codecov/codecov-action@v4
105-
# with:
106-
# token: ${{ secrets.CODECOV_TOKEN }}
107-
# files: 'coverage/*.c.gcov'
108-
# verbose: true
65+
kmc_build:
66+
# Container Setup
67+
runs-on: ubuntu-latest
68+
container:
69+
image: ivvitc/cryptolib:20250108
70+
steps:
71+
- uses: actions/checkout@v4
72+
with:
73+
repository: NASA-AMMOS/DCS
74+
path: DCS
75+
submodules: recursive
76+
- name: setup python
77+
uses: actions/setup-python@v5
78+
with:
79+
python-version: '3.11'
80+
- name: Set current branch
81+
run: echo "BRANCH_NAME=$(echo ${{ github.head_ref || github.ref_name }})" >> $GITHUB_ENV
82+
- name: Update
83+
run: apt-get update
84+
- name: Install Dependencies
85+
run: apt-get install -y libcurl4-openssl-dev libmariadb-dev libmariadb-dev-compat python3 openjdk-17-jdk openjdk-17-jre cmake swig maven podman default-jdk
86+
- name: Install Python Libraries
87+
run: |
88+
pip3 install --break-system-packages pycryptodome cffi invoke
89+
- name: update Cryptolib
90+
run: |
91+
cd DCS/ammos-cryptolib
92+
rm -rf CryptoLib
93+
git clone --single-branch --branch $BRANCH_NAME https://github.com/nasa/CryptoLib.git
94+
- name: add required jars
95+
run: |
96+
cd DCS/ammos-cryptolib/kmc_sdls/kmc_sdls_java/kmc_sdls_java_test
97+
curl -LS https://repo1.maven.org/maven2/junit/junit/4.13.2/junit-4.13.2.jar -o ./junit-4.13.2.jar
98+
curl -LS https://repo1.maven.org/maven2/org/hamcrest/hamcrest/2.2/hamcrest-2.2.jar -o ./hamcrest-2.2.jar
99+
- name: build DCS
100+
run: |
101+
cd ./DCS
102+
export JAVA_HOME=/lib/jvm/java-17-openjdk-amd64
103+
./kmc-resources/scripts/build.sh
109104
110105
#
111106
# Wolf Build

src/sa/mariadb/sa_interface_mariadb.template.c

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ static const char *SQL_SADB_UPDATE_IV_ARC_BY_SPI =
5858
"UPDATE security_associations"
5959
" SET iv=X'%s', arsn=X'%s'"
6060
" WHERE spi='%d' AND tfvn='%d' AND scid='%d' AND vcid='%d' AND mapid='%d'";
61-
static const char *SQL_SADB_UPDATE_IV_ARC_BY_SPI_NULL_IV =
62-
"UPDATE security_associations"
63-
" SET arsn=X'%s'"
64-
" WHERE spi='%d' AND tfvn='%d' AND scid='%d' AND vcid='%d' AND mapid='%d'";
61+
// static const char *SQL_SADB_UPDATE_IV_ARC_BY_SPI_NULL_IV =
62+
// "UPDATE security_associations"
63+
// " SET arsn=X'%s'"
64+
// " WHERE spi='%d' AND tfvn='%d' AND scid='%d' AND vcid='%d' AND mapid='%d'";
6565

6666
// sa_if mariaDB private helper functions
6767
static int32_t parse_sa_from_mysql_query(char *query, SecurityAssociation_t **security_association);
@@ -216,29 +216,17 @@ static int32_t sa_save_sa(SecurityAssociation_t *sa)
216216
char update_sa_query[2048];
217217
char *iv_h = malloc(sa->iv_len * 2 + 1);
218218

219-
if (sa->iv != NULL)
220-
{
221-
convert_byte_array_to_hexstring(sa->iv, sa->iv_len, iv_h);
222-
}
219+
convert_byte_array_to_hexstring(sa->iv, sa->iv_len, iv_h);
223220

224221
char *arsn_h = malloc(sa->arsn_len * 2 + 1);
225222
convert_byte_array_to_hexstring(sa->arsn, sa->arsn_len, arsn_h);
226223

227-
if (sa->iv != NULL)
228-
{
229-
snprintf(update_sa_query, sizeof(update_sa_query), SQL_SADB_UPDATE_IV_ARC_BY_SPI, iv_h, arsn_h, sa->spi,
230-
sa->gvcid_blk.tfvn, sa->gvcid_blk.scid, sa->gvcid_blk.vcid, sa->gvcid_blk.mapid);
231-
232-
free(iv_h);
233-
}
234-
else
235-
{
236-
snprintf(update_sa_query, sizeof(update_sa_query), SQL_SADB_UPDATE_IV_ARC_BY_SPI_NULL_IV, arsn_h, sa->spi,
237-
sa->gvcid_blk.tfvn, sa->gvcid_blk.scid, sa->gvcid_blk.vcid, sa->gvcid_blk.mapid);
238-
free(iv_h);
239-
}
224+
snprintf(update_sa_query, sizeof(update_sa_query), SQL_SADB_UPDATE_IV_ARC_BY_SPI, iv_h, arsn_h, sa->spi,
225+
sa->gvcid_blk.tfvn, sa->gvcid_blk.scid, sa->gvcid_blk.vcid, sa->gvcid_blk.mapid);
240226

227+
free(iv_h);
241228
free(arsn_h);
229+
242230
#ifdef SA_DEBUG
243231
fprintf(stderr, "MySQL Insert SA Query: %s \n", update_sa_query);
244232
#endif

0 commit comments

Comments
 (0)