blob: 376c32640066ecb1eb514f1c0c2e1daa5ec1fe53 [file] [log] [blame]
Andreas Hubered3e3e02012-03-26 11:13:27 -07001/*
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>
Andreas Huber1bd139a2012-04-03 14:19:20 -070019#include <media/hardware/CryptoAPI.h>
Andreas Hubered3e3e02012-03-26 11:13:27 -070020
21#ifndef ANDROID_ICRYPTO_H_
22
23#define ANDROID_ICRYPTO_H_
24
25namespace android {
26
27struct ICrypto : public IInterface {
28 DECLARE_META_INTERFACE(Crypto);
29
Andreas Huber1bd139a2012-04-03 14:19:20 -070030 virtual status_t initCheck() const = 0;
Andreas Hubered3e3e02012-03-26 11:13:27 -070031
Andreas Huber1bd139a2012-04-03 14:19:20 -070032 virtual bool isCryptoSchemeSupported(const uint8_t uuid[16]) const = 0;
Andreas Hubered3e3e02012-03-26 11:13:27 -070033
Andreas Huber1bd139a2012-04-03 14:19:20 -070034 virtual status_t createPlugin(
35 const uint8_t uuid[16], const void *data, size_t size) = 0;
Andreas Hubered3e3e02012-03-26 11:13:27 -070036
Andreas Huber1bd139a2012-04-03 14:19:20 -070037 virtual status_t destroyPlugin() = 0;
Andreas Hubered3e3e02012-03-26 11:13:27 -070038
Andreas Huber1bd139a2012-04-03 14:19:20 -070039 virtual bool requiresSecureDecoderComponent(
40 const char *mime) const = 0;
41
42 virtual status_t decrypt(
43 bool secure,
44 const uint8_t key[16],
45 const uint8_t iv[16],
46 CryptoPlugin::Mode mode,
47 const void *srcPtr,
48 const CryptoPlugin::SubSample *subSamples, size_t numSubSamples,
49 void *dstPtr) = 0;
Andreas Hubered3e3e02012-03-26 11:13:27 -070050
51private:
52 DISALLOW_EVIL_CONSTRUCTORS(ICrypto);
53};
54
55struct BnCrypto : public BnInterface<ICrypto> {
56 virtual status_t onTransact(
57 uint32_t code, const Parcel &data, Parcel *reply,
58 uint32_t flags = 0);
59};
60
61} // namespace android
62
63#endif // ANDROID_ICRYPTO_H_
64