CryptoLib icon indicating copy to clipboard operation
CryptoLib copied to clipboard

Conditional Error Code Review

Open dccutrig opened this issue 2 years ago • 0 comments

Wish to improve logic in scenarios such as follows in updated version of crypto_tm.c:

                if((*(sa_ptr->acs) == CRYPTO_MAC_CMAC_AES256 || *(sa_ptr->acs) == CRYPTO_MAC_HMAC_SHA256 || *(sa_ptr->acs) == CRYPTO_MAC_HMAC_SHA512) &&
                    sa_ptr->iv_len > 0 )
                    {
                        return CRYPTO_LIB_ERR_IV_NOT_SUPPORTED_FOR_ACS_ALGO;
                    }

The intent of above is to make sure that IV cannot be set in ACS only algorithms, however this check would fail if a new ACS was added functionally and not updated here. This might need re-written (and check for similar cases) to reduce future code maintenance.

Issue to be analyzed further after TM integration.

dccutrig avatar Apr 06 '23 03:04 dccutrig