Add backward compatibility to OEMCrypto_CopyBuffer

Merge from Widevine repository of http://go/wvgerrit/13912

This CL falls back to OEMCrypto_DecryptCTR if the oemcrypto library
does not implement OEMCrypto_CopyBuffer.  This allows devices with
oem crypto version 9 to function as they previously did.

Change-Id: Id3a4a94b1fd559f426ee260cfbf7077fa9101d8b
This commit is contained in:
Fred Gylys-Colwell
2015-03-31 15:09:45 -07:00
parent a7d2f57bfb
commit ae1711acc0
3 changed files with 24 additions and 18 deletions

View File

@@ -536,10 +536,11 @@ OEMCryptoResult SetDestination(OEMCrypto_DestBufferDesc* out_buffer,
+ out_buffer->buffer.secure.offset;
*max_length = out_buffer->buffer.secure.max_length;
break;
default:
case OEMCrypto_BufferType_Direct:
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
*destination = NULL;
break;
default:
return OEMCrypto_ERROR_INVALID_CONTEXT;
}
if (out_buffer->type != OEMCrypto_BufferType_Direct
@@ -616,7 +617,7 @@ OEMCryptoResult OEMCrypto_CopyBuffer(const uint8_t *data_addr,
&max_length);
if (sts != OEMCrypto_SUCCESS) return sts;
memcpy(destination, data_addr, data_length);
if (destination != NULL) memcpy(destination, data_addr, data_length);
return OEMCrypto_SUCCESS;
}