Restrict usage table size in mod mock

Merge from Widevine repo of http://go/wvgerrit/58820

This adds an option to the oemcrypto mod mock so that it will limit
the usage table to the specified size.  It returns the resource limit
error code when the maximum size is reached.

bug: 111260263
test: unit tests
Change-Id: I166b06855fba77ae8ddd13a922fe05be93f2c8f6
This commit is contained in:
Fred Gylys-Colwell
2018-09-02 13:24:11 -07:00
parent 562c14b5f1
commit f572d60633
2 changed files with 20 additions and 0 deletions

View File

@@ -152,6 +152,10 @@ class CryptoEngine {
// Rate limit for nonce generation. Default to 20 nonce/second.
virtual int nonce_flood_count() { return 20; }
// Limit for size of usage table. If this is zero, then the
// size is unlimited -- or limited only by memory size.
virtual size_t max_usage_table_size() { return 0; }
// Set destination pointer based on the output destination description.
OEMCryptoResult SetDestination(OEMCrypto_DestBufferDesc* out_description,
size_t data_length, uint8_t subsample_flags);