ICrypto.h revision ed3e3e046840d5bf1ca84a8c0cc097425e89d6d6
1/* 2 * Copyright (C) 2012 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17#include <binder/IInterface.h> 18#include <media/stagefright/foundation/ABase.h> 19 20#ifndef ANDROID_ICRYPTO_H_ 21 22#define ANDROID_ICRYPTO_H_ 23 24namespace android { 25 26struct ICrypto : public IInterface { 27 DECLARE_META_INTERFACE(Crypto); 28 29 virtual status_t initialize() = 0; 30 virtual status_t terminate() = 0; 31 32 virtual status_t setEntitlementKey( 33 const void *key, size_t keyLength) = 0; 34 35 virtual status_t setEntitlementControlMessage( 36 const void *msg, size_t msgLength) = 0; 37 38 // "dstData" is in media_server's address space (but inaccessible). 39 virtual ssize_t decryptVideo( 40 const void *iv, size_t ivLength, 41 const void *srcData, size_t srcDataSize, 42 void *dstData, size_t dstDataOffset) = 0; 43 44 // "dstData" is in the calling process' address space. 45 virtual ssize_t decryptAudio( 46 const void *iv, size_t ivLength, 47 const void *srcData, size_t srcDataSize, 48 void *dstData, size_t dstDataSize) = 0; 49 50private: 51 DISALLOW_EVIL_CONSTRUCTORS(ICrypto); 52}; 53 54struct BnCrypto : public BnInterface<ICrypto> { 55 virtual status_t onTransact( 56 uint32_t code, const Parcel &data, Parcel *reply, 57 uint32_t flags = 0); 58}; 59 60} // namespace android 61 62#endif // ANDROID_ICRYPTO_H_ 63 64