1 /*
2  * Copyright (C) 2020 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 #define LOG_TAG "drm_hal_test@1.3"
18 
19 #include "android/hardware/drm/1.3/vts/drm_hal_test.h"
20 
21 namespace android {
22 namespace hardware {
23 namespace drm {
24 namespace V1_3 {
25 namespace vts {
26 
TEST_P(DrmHalTestV1_3,SchemeSupported)27 TEST_P(DrmHalTestV1_3, SchemeSupported) {
28     EXPECT_TRUE(drmFactory_->isCryptoSchemeSupported(GetParam().scheme_));
29 }
30 
TEST_P(DrmHalTestV1_3,SignRsaNotAllowed)31 TEST_P(DrmHalTestV1_3, SignRsaNotAllowed) {
32     hidl_array<uint8_t, 16> kWidevineUUID ({
33         0xED,0xEF,0x8B,0xA9,0x79,0xD6,0x4A,0xCE,
34         0xA3,0xC8,0x27,0xDC,0xD5,0x1D,0x21,0xED
35     });
36 
37     if (!drmFactory_->isCryptoSchemeSupported(kWidevineUUID)) {
38         GTEST_SKIP() << "Widevine only test";
39     }
40 
41     // signRSA
42     const hidl_vec<uint8_t>& sessionId{0};
43     const hidl_string& algorithm{"RSASSA-PSS-SHA1"};
44     const hidl_vec<uint8_t>& message{0};
45     const hidl_vec<uint8_t>& wrappedKey{0};
46     auto res = drmPlugin_->signRSA(
47         sessionId, algorithm, message, wrappedKey,
48         [&](StatusV1_0 status, const hidl_vec<uint8_t>& signature) {
49             EXPECT_EQ(status, StatusV1_0::ERROR_DRM_UNKNOWN);
50             EXPECT_EQ(signature.size(), 0);
51         }
52     );
53     EXPECT_TRUE(res.isOk());
54 }
55 
56 }  // namespace vts
57 }  // namespace V1_3
58 }  // namespace drm
59 }  // namespace hardware
60 }  // namespace android
61