Crypto.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#ifndef CRYPTO_H_
18
19#define CRYPTO_H_
20
21#include <media/ICrypto.h>
22#include <utils/threads.h>
23
24namespace android {
25
26struct Crypto : public BnCrypto {
27    Crypto();
28
29    virtual status_t initialize();
30    virtual status_t terminate();
31
32    virtual status_t setEntitlementKey(
33            const void *key, size_t keyLength);
34
35    virtual status_t setEntitlementControlMessage(
36            const void *msg, size_t msgLength);
37
38    virtual ssize_t decryptVideo(
39            const void *iv, size_t ivLength,
40            const void *srcData, size_t srcDataSize,
41            void *dstData, size_t dstDataOffset);
42
43    virtual ssize_t decryptAudio(
44            const void *iv, size_t ivLength,
45            const void *srcData, size_t srcDataSize,
46            void *dstData, size_t dstDataSize);
47
48protected:
49    virtual ~Crypto();
50
51private:
52    DISALLOW_EVIL_CONSTRUCTORS(Crypto);
53};
54
55}  // namespace android
56
57#endif  // CRYPTO_H_
58