Skip to content

Commit

Permalink
Merge pull request #238 from nasa/211-sa-ptr-memory-leak-pr
Browse files Browse the repository at this point in the history
[#211] Modify sadb_get_sa_from_spi.  Unnecessary NULL
  • Loading branch information
rjbrown2 committed May 2, 2024
2 parents fb72ee2 + d28cb6e commit 318c371
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/sa/internal/sa_interface_inmemory.template.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,16 +435,13 @@ static int32_t sa_close(void)
static int32_t sa_get_from_spi(uint16_t spi, SecurityAssociation_t** security_association)
{
int32_t status = CRYPTO_LIB_SUCCESS;
if (sa == NULL)
{
return CRYPTO_LIB_ERR_NO_INIT;
}
*security_association = &sa[spi];
if (sa[spi].iv == NULL && (sa[spi].shivf_len > 0) && crypto_config.cryptography_type != CRYPTOGRAPHY_TYPE_KMCCRYPTO)
if ((sa[spi].iv == NULL) && (sa[spi].shivf_len > 0) && crypto_config.cryptography_type != CRYPTOGRAPHY_TYPE_KMCCRYPTO)
{
return CRYPTO_LIB_ERR_NULL_IV;
} // Must have IV if doing encryption or authentication
if (sa[spi].abm == NULL && sa[spi].ast)

if ((sa[spi].abm_len == 0) && sa[spi].ast)
{
return CRYPTO_LIB_ERR_NULL_ABM;
} // Must have abm if doing authentication
Expand Down

0 comments on commit 318c371

Please sign in to comment.