Skip to content

Commit

Permalink
[#164] Update CI to include test build flags and sa/mariadb to avoid …
Browse files Browse the repository at this point in the history
…freeing data;
  • Loading branch information
jlucas9 committed Jun 21, 2023
1 parent 98fcb56 commit 64343c0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 29 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DDEBUG=1 -DSA_MARIADB=0 -DCRYPTO_LIBGCRYPT=1 -DCRYPTO_KMC=0
run: cmake -B ${{github.workspace}}/build -DDEBUG=1 -DSA_MARIADB=0 -DCRYPTO_LIBGCRYPT=1 -DCRYPTO_KMC=0 -DTEST=1 -DTEST_ENC=1

- name: Build
# Build your program with the given configuration
Expand All @@ -49,7 +49,7 @@ jobs:
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DDEBUG=0 -DSA_MARIADB=0 -DCRYPTO_LIBGCRYPT=1 -DCRYPTO_KMC=0
run: cmake -B ${{github.workspace}}/build -DDEBUG=0 -DSA_MARIADB=0 -DCRYPTO_LIBGCRYPT=1 -DCRYPTO_KMC=0 -DTEST=1 -DTEST_ENC=1

- name: Build
# Build your program with the given configuration
Expand All @@ -75,7 +75,7 @@ jobs:
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DDEBUG=1 -DSA_MARIADB=1 -DCRYPTO_LIBGCRYPT=1 -DCRYPTO_KMC=0
run: cmake -B ${{github.workspace}}/build -DDEBUG=1 -DSA_MARIADB=1 -DCRYPTO_LIBGCRYPT=1 -DCRYPTO_KMC=0 -DTEST=1 -DTEST_ENC=1

- name: Build
# Build your program with the given configuration
Expand All @@ -101,7 +101,7 @@ jobs:
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DDEBUG=0 -DSA_MARIADB=1 -DCRYPTO_LIBGCRYPT=1 -DCRYPTO_KMC=0
run: cmake -B ${{github.workspace}}/build -DDEBUG=0 -DSA_MARIADB=1 -DCRYPTO_LIBGCRYPT=1 -DCRYPTO_KMC=0 -DTEST=1 -DTEST_ENC=1

- name: Build
# Build your program with the given configuration
Expand All @@ -127,7 +127,7 @@ jobs:
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DDEBUG=1 -DSA_MARIADB=1 -DCRYPTO_LIBGCRYPT=1 -DCRYPTO_KMC=1
run: cmake -B ${{github.workspace}}/build -DDEBUG=1 -DSA_MARIADB=1 -DCRYPTO_LIBGCRYPT=1 -DCRYPTO_KMC=1 -DTEST=1 -DTEST_ENC=1

- name: Build
# Build your program with the given configuration
Expand All @@ -153,7 +153,7 @@ jobs:
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DDEBUG=0 -DSA_MARIADB=1 -DCRYPTO_LIBGCRYPT=1 -DCRYPTO_KMC=1
run: cmake -B ${{github.workspace}}/build -DDEBUG=0 -DSA_MARIADB=1 -DCRYPTO_LIBGCRYPT=1 -DCRYPTO_KMC=1 -DTEST=1 -DTEST_ENC=1

- name: Build
# Build your program with the given configuration
Expand Down
26 changes: 3 additions & 23 deletions src/sa/mariadb/sadb_routine_mariadb.template.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,18 +252,8 @@ static int32_t sadb_save_sa(SecurityAssociation_t* sa)
// todo - if query fails, need to push failure message to error stack instead of just return code.

// We free the allocated SA memory in the save function.
if (sa->iv != NULL)
free(sa->iv);
if (sa->abm != NULL)
free(sa->abm);
if (sa->arsn != NULL)
free(sa->arsn);
if (sa->ek_ref != NULL)
free(sa->ek_ref);
if (sa->ecs != NULL)
free(sa->ecs);
if (sa->acs != NULL)
free(sa->acs);
if (sa->ak_ref != NULL)
free(sa->ak_ref);
free(sa);
Expand Down Expand Up @@ -525,25 +515,15 @@ static int32_t parse_sa_from_mysql_query(char* query, SecurityAssociation_t** se
}
// printf("\n");
}
if (iv_byte_str == NULL){
sa->iv = NULL;
}
else{
sa->iv = (uint8_t* )calloc(1, sa->iv_len * sizeof(uint8_t));
}

sa->arsn = (uint8_t* )calloc(1, sa->arsn_len * sizeof(uint8_t));
sa->abm = (uint8_t* )calloc(1, sa->abm_len * sizeof(uint8_t));
sa->ecs = (uint8_t* )calloc(1, sa->ecs_len * sizeof(uint8_t));
sa->acs = (uint8_t* )calloc(1, sa->acs_len * sizeof(uint8_t));

if(iv_byte_str != NULL){
if(sa->iv_len > 0) convert_hexstring_to_byte_array(iv_byte_str, sa->iv);
}

if(sa->arsn_len > 0) convert_hexstring_to_byte_array(arc_byte_str, sa->arsn);
if(sa->abm_len > 0) convert_hexstring_to_byte_array(abm_byte_str, sa->abm);
if(sa->ecs_len > 0) convert_hexstring_to_byte_array(ecs_byte_str, sa->ecs);
if(sa->acs_len > 0) convert_hexstring_to_byte_array(acs_byte_str, sa->acs);
if(sa->ecs_len > 0) convert_hexstring_to_byte_array(ecs_byte_str, &sa->ecs);
if(sa->acs_len > 0) convert_hexstring_to_byte_array(acs_byte_str, &sa->acs);

//arsnw_len is not necessary for mariadb interface, putty dummy/default value for prints.
sa->arsnw_len = 1;
Expand Down

0 comments on commit 64343c0

Please sign in to comment.