blob: ac2b3babec37505f574067bf829f10f065e8cbc8 [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
Andreas Huber5b8987e2012-04-19 12:52:20 -070027struct AString;
Jeff Tinkerc481b502015-04-06 18:21:05 -070028struct IMemory;
Andreas Huber5b8987e2012-04-19 12:52:20 -070029
Andreas Hubered3e3e02012-03-26 11:13:27 -070030struct ICrypto : public IInterface {
31 DECLARE_META_INTERFACE(Crypto);
32
Andreas Huber1bd139a2012-04-03 14:19:20 -070033 virtual status_t initCheck() const = 0;
Andreas Hubered3e3e02012-03-26 11:13:27 -070034
Jeff Tinkerbafb6822013-03-22 15:26:39 -070035 virtual bool isCryptoSchemeSupported(const uint8_t uuid[16]) = 0;
Andreas Hubered3e3e02012-03-26 11:13:27 -070036
Andreas Huber1bd139a2012-04-03 14:19:20 -070037 virtual status_t createPlugin(
38 const uint8_t uuid[16], const void *data, size_t size) = 0;
Andreas Hubered3e3e02012-03-26 11:13:27 -070039
Andreas Huber1bd139a2012-04-03 14:19:20 -070040 virtual status_t destroyPlugin() = 0;
Andreas Hubered3e3e02012-03-26 11:13:27 -070041
Andreas Huber1bd139a2012-04-03 14:19:20 -070042 virtual bool requiresSecureDecoderComponent(
43 const char *mime) const = 0;
44
Jeff Tinker2514d082014-11-03 13:29:35 -080045 virtual void notifyResolution(uint32_t width, uint32_t height) = 0;
46
Edwin Wongfa2b8f22012-07-10 20:01:13 -070047 virtual ssize_t decrypt(
Andreas Huber1bd139a2012-04-03 14:19:20 -070048 bool secure,
49 const uint8_t key[16],
50 const uint8_t iv[16],
51 CryptoPlugin::Mode mode,
Jeff Tinkerc481b502015-04-06 18:21:05 -070052 const sp<IMemory> &sharedBuffer, size_t offset,
Andreas Huber1bd139a2012-04-03 14:19:20 -070053 const CryptoPlugin::SubSample *subSamples, size_t numSubSamples,
Andreas Huber5b8987e2012-04-19 12:52:20 -070054 void *dstPtr,
55 AString *errorDetailMsg) = 0;
Andreas Hubered3e3e02012-03-26 11:13:27 -070056
57private:
58 DISALLOW_EVIL_CONSTRUCTORS(ICrypto);
59};
60
61struct BnCrypto : public BnInterface<ICrypto> {
62 virtual status_t onTransact(
63 uint32_t code, const Parcel &data, Parcel *reply,
64 uint32_t flags = 0);
65};
66
67} // namespace android
68
69#endif // ANDROID_ICRYPTO_H_