1 /* 2 * Copyright (C) 2021 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 #pragma once 18 19 #include <cstdint> 20 #include <map> 21 #include <vector> 22 23 namespace clearkeydrm { 24 25 const uint8_t kBlockSize = 16; // AES_BLOCK_SIZE; 26 typedef uint8_t KeyId[kBlockSize]; 27 typedef uint8_t Iv[kBlockSize]; 28 29 typedef std::map<std::vector<uint8_t>, std::vector<uint8_t>> KeyMap; 30 31 #define CLEARKEY_DISALLOW_COPY_AND_ASSIGN(TypeName) \ 32 TypeName(const TypeName&) = delete; \ 33 void operator=(const TypeName&) = delete; 34 35 #define CLEARKEY_DISALLOW_COPY_AND_ASSIGN_AND_NEW(TypeName) \ 36 TypeName() = delete; \ 37 TypeName(const TypeName&) = delete; \ 38 void operator=(const TypeName&) = delete; 39 40 enum CdmResponseType : int32_t { 41 OK = 0, 42 ERROR_NO_LICENSE = 1, 43 ERROR_SESSION_NOT_OPENED = 3, 44 ERROR_CANNOT_HANDLE = 4, 45 ERROR_INVALID_STATE = 5, 46 BAD_VALUE = 6, 47 ERROR_DECRYPT = 11, 48 ERROR_UNKNOWN = 12, 49 ERROR_INSUFFICIENT_SECURITY = 13, 50 ERROR_FRAME_TOO_LARGE = 14, 51 ERROR_SESSION_LOST_STATE = 15, 52 ERROR_RESOURCE_CONTENTION = 16, 53 }; 54 55 enum CdmKeyType : int32_t { 56 KEY_TYPE_OFFLINE = 0, 57 KEY_TYPE_STREAMING = 1, 58 KEY_TYPE_RELEASE = 2, 59 }; 60 61 } // namespace clearkeydrm 62