diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e771482d..404245be 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/src/sa/mariadb/sadb_routine_mariadb.template.c b/src/sa/mariadb/sadb_routine_mariadb.template.c index 9e199cba..8d1cdbba 100644 --- a/src/sa/mariadb/sadb_routine_mariadb.template.c +++ b/src/sa/mariadb/sadb_routine_mariadb.template.c @@ -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); @@ -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;