# OEMCrypto Unit Tests ## Basic Functionality Tests Most unit tests in this category verify that the basic functionality of opening sessions, initializing and terminating the system, and reporting status work correctly. ## Decrypt Tests The decrypt tests verify that encrypted data is correctly decrypted with the desired key. These tests cover a large variety of patterns, sample sizes, and subsample sizes. ## Secure Buffers If OEMCrypto implements the function `OEMCrypto_AllocateSecureBuffer`, then all of the decrypt tests will also run with the output buffer being a secure buffer. If the function `OEMCrypto_SupportsDecryptHash` returns `OEMCrypto_CRC_Clear_Buffer`, then the secure buffer decryption will be verified with the CRC32 hash of the input data. ## Usage Table Tests Usage table tests verify that the usage table is correctly procesed. The usage table is used to control reloading keys for offline playback, and for reporting secure stops for online playback. ## Duration Tests Duration tests verify that license durations are enforced correctly. Most of this functionality can be met by keeping an accurate system time, and calling the ODK functions as described in the document "License Duration and Renewal". ## OEMCrypto Memory Unit Tests ### Objective * Add OEMCrypto buffer overflow unit tests (indirect way of fuzzing) to verify OEMCrypto API behavior when the parameters passed to the API are out of range or not reasonable. The API can return an error code, but shouldn't crash. * A lot of OEMCrypto APIs take buffers and their length as inputs to the APIs and we have added unit tests with buffers of varying lengths (small to huge) to verify API behavior which is an indirect and simplest way of fuzz testing to detect buffer overflows. * Add the tests for OEMCrypto APIs with prefix `OEMCryptoMemory` in the following format. Huge length is set at 100 MB as of now. ```cpp for (size_t length=small_length; length