ICrypto.h revision fa2b8f243eb048fb2b8e5a14356190f69eb31a36
199b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com/* 299b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com * Copyright (C) 2012 The Android Open Source Project 399b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com * 499b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com * Licensed under the Apache License, Version 2.0 (the "License"); 599b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com * you may not use this file except in compliance with the License. 699b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com * You may obtain a copy of the License at 799b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com * 899b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com * http://www.apache.org/licenses/LICENSE-2.0 999b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com * 1099b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com * Unless required by applicable law or agreed to in writing, software 1199b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com * distributed under the License is distributed on an "AS IS" BASIS, 12bdf981cb383b7ec472ee86d2fedb53937285f894rtoy@google.com * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13048e632be7693f6198bfdd54130a0220a2ccb5abrtoy@google.com * See the License for the specific language governing permissions and 14048e632be7693f6198bfdd54130a0220a2ccb5abrtoy@google.com * limitations under the License. 15048e632be7693f6198bfdd54130a0220a2ccb5abrtoy@google.com */ 1699b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com 1799b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com#include <binder/IInterface.h> 1899b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com#include <media/stagefright/foundation/ABase.h> 1999b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com#include <media/hardware/CryptoAPI.h> 2099b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com 2199b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com#ifndef ANDROID_ICRYPTO_H_ 2299b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com 2399b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com#define ANDROID_ICRYPTO_H_ 2499b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com 2599b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.comnamespace android { 2699b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com 2799b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.comstruct AString; 2899b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com 2999b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.comstruct ICrypto : public IInterface { 306ae14cb23aa5d478d267519f29d05558fd8f2f0drtoy@google.com DECLARE_META_INTERFACE(Crypto); 3199b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com 3299b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com virtual status_t initCheck() const = 0; 3399b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com 3499b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com virtual bool isCryptoSchemeSupported(const uint8_t uuid[16]) const = 0; 3599b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com 3699b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com virtual status_t createPlugin( 3799b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com const uint8_t uuid[16], const void *data, size_t size) = 0; 3899b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com 3999b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com virtual status_t destroyPlugin() = 0; 406ae14cb23aa5d478d267519f29d05558fd8f2f0drtoy@google.com 4199b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com virtual bool requiresSecureDecoderComponent( 4299b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com const char *mime) const = 0; 4399b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com 4499b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com virtual ssize_t decrypt( 4599b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com bool secure, 4699b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com const uint8_t key[16], 4799b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com const uint8_t iv[16], 4899b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com CryptoPlugin::Mode mode, 4999b31ea5d0f4629ceddf4852f96757c9c73654artoy@google.com const void *srcPtr, 50 const CryptoPlugin::SubSample *subSamples, size_t numSubSamples, 51 void *dstPtr, 52 AString *errorDetailMsg) = 0; 53 54private: 55 DISALLOW_EVIL_CONSTRUCTORS(ICrypto); 56}; 57 58struct BnCrypto : public BnInterface<ICrypto> { 59 virtual status_t onTransact( 60 uint32_t code, const Parcel &data, Parcel *reply, 61 uint32_t flags = 0); 62}; 63 64} // namespace android 65 66#endif // ANDROID_ICRYPTO_H_ 67 68