1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef HUKS_SIGNVERIFY_ED25519_TEST_H 17 #define HUKS_SIGNVERIFY_ED25519_TEST_H 18 19 #include <string> 20 #include "huks_three_stage_test_common.h" 21 namespace Unittest::Ed25519 { 22 static const std::string tmpInData = "OH_HUKS_ED25519_Sign_Verify_Test_000000000000000000000000000000000000000000000000000" 23 "00000000000000000000000000000000000000000000000000000000000000000000000000000000" 24 "0000000000000000000000000000000000000000000000000000000000000000000000000_string"; 25 static const struct OH_Huks_Blob g_inData = { tmpInData.length(), (uint8_t *)tmpInData.c_str() }; 26 27 static const uint32_t ED25519_COMMON_SIZE = 1024; 28 29 static struct OH_Huks_Param g_genParamsTest001[] = { 30 { 31 .tag = OH_HUKS_TAG_ALGORITHM, 32 .uint32Param = OH_HUKS_ALG_ED25519 33 }, { 34 .tag = OH_HUKS_TAG_PURPOSE, 35 .uint32Param = OH_HUKS_KEY_PURPOSE_SIGN | OH_HUKS_KEY_PURPOSE_VERIFY 36 }, { 37 .tag = OH_HUKS_TAG_KEY_SIZE, 38 .uint32Param = OH_HUKS_CURVE25519_KEY_SIZE_256 39 }, { 40 .tag = OH_HUKS_TAG_DIGEST, 41 .uint32Param = OH_HUKS_DIGEST_SHA1 42 } 43 }; 44 static struct OH_Huks_Param g_signParamsTest001[] = { 45 { 46 .tag = OH_HUKS_TAG_ALGORITHM, 47 .uint32Param = OH_HUKS_ALG_ED25519 48 }, { 49 .tag = OH_HUKS_TAG_PURPOSE, 50 .uint32Param = OH_HUKS_KEY_PURPOSE_SIGN 51 }, { 52 .tag = OH_HUKS_TAG_KEY_SIZE, 53 .uint32Param = OH_HUKS_CURVE25519_KEY_SIZE_256 54 }, { 55 .tag = OH_HUKS_TAG_DIGEST, 56 .uint32Param = OH_HUKS_DIGEST_SHA1 57 } 58 }; 59 static struct OH_Huks_Param g_verifyParamsTest001[] = { 60 { 61 .tag = OH_HUKS_TAG_ALGORITHM, 62 .uint32Param = OH_HUKS_ALG_ED25519 63 }, { 64 .tag = OH_HUKS_TAG_PURPOSE, 65 .uint32Param = OH_HUKS_KEY_PURPOSE_VERIFY 66 }, { 67 .tag = OH_HUKS_TAG_KEY_SIZE, 68 .uint32Param = OH_HUKS_CURVE25519_KEY_SIZE_256 69 }, { 70 .tag = OH_HUKS_TAG_DIGEST, 71 .uint32Param = OH_HUKS_DIGEST_SHA1 72 } 73 }; 74 75 static struct OH_Huks_Param g_genParamsTest002[] = { 76 { 77 .tag = OH_HUKS_TAG_ALGORITHM, 78 .uint32Param = OH_HUKS_ALG_ED25519 79 }, { 80 .tag = OH_HUKS_TAG_PURPOSE, 81 .uint32Param = OH_HUKS_KEY_PURPOSE_SIGN | OH_HUKS_KEY_PURPOSE_VERIFY 82 }, { 83 .tag = OH_HUKS_TAG_KEY_SIZE, 84 .uint32Param = OH_HUKS_CURVE25519_KEY_SIZE_256 85 }, { 86 .tag = OH_HUKS_TAG_DIGEST, 87 .uint32Param = OH_HUKS_DIGEST_SHA1 88 } 89 }; 90 static struct OH_Huks_Param g_signParamsTest002[] = { 91 { 92 .tag = OH_HUKS_TAG_ALGORITHM, 93 .uint32Param = OH_HUKS_ALG_ED25519 94 }, { 95 .tag = OH_HUKS_TAG_PURPOSE, 96 .uint32Param = OH_HUKS_KEY_PURPOSE_SIGN 97 }, { 98 .tag = OH_HUKS_TAG_KEY_SIZE, 99 .uint32Param = OH_HUKS_CURVE25519_KEY_SIZE_256 100 }, { 101 .tag = OH_HUKS_TAG_DIGEST, 102 .uint32Param = OH_HUKS_DIGEST_SHA1 103 } 104 }; 105 static struct OH_Huks_Param g_verifyParamsTest002[] = { 106 { 107 .tag = OH_HUKS_TAG_ALGORITHM, 108 .uint32Param = OH_HUKS_ALG_ED25519 109 }, { 110 .tag = OH_HUKS_TAG_PURPOSE, 111 .uint32Param = OH_HUKS_KEY_PURPOSE_VERIFY 112 }, { 113 .tag = OH_HUKS_TAG_KEY_SIZE, 114 .uint32Param = OH_HUKS_CURVE25519_KEY_SIZE_256 115 }, { 116 .tag = OH_HUKS_TAG_DIGEST, 117 .uint32Param = OH_HUKS_DIGEST_SHA1 118 } 119 }; 120 static struct OH_Huks_Param g_genParamsTest003[] = { 121 { 122 .tag = OH_HUKS_TAG_ALGORITHM, 123 .uint32Param = OH_HUKS_ALG_ED25519 124 }, { 125 .tag = OH_HUKS_TAG_PURPOSE, 126 .uint32Param = OH_HUKS_KEY_PURPOSE_SIGN | OH_HUKS_KEY_PURPOSE_VERIFY 127 }, { 128 .tag = OH_HUKS_TAG_KEY_SIZE, 129 .uint32Param = OH_HUKS_CURVE25519_KEY_SIZE_256 130 }, { 131 .tag = OH_HUKS_TAG_DIGEST, 132 .uint32Param = OH_HUKS_DIGEST_SHA1 133 } 134 }; 135 static struct OH_Huks_Param g_signParamsTest003[] = { 136 { 137 .tag = OH_HUKS_TAG_ALGORITHM, 138 .uint32Param = OH_HUKS_ALG_ED25519 139 }, { 140 .tag = OH_HUKS_TAG_PURPOSE, 141 .uint32Param = OH_HUKS_KEY_PURPOSE_SIGN 142 }, { 143 .tag = OH_HUKS_TAG_KEY_SIZE, 144 .uint32Param = OH_HUKS_CURVE25519_KEY_SIZE_256 145 }, { 146 .tag = OH_HUKS_TAG_DIGEST, 147 .uint32Param = OH_HUKS_DIGEST_SHA1 148 } 149 }; 150 151 static struct OH_Huks_Param g_genParamsTest004[] = { 152 { 153 .tag = OH_HUKS_TAG_ALGORITHM, 154 .uint32Param = OH_HUKS_ALG_ED25519 155 }, { 156 .tag = OH_HUKS_TAG_PURPOSE, 157 .uint32Param = OH_HUKS_KEY_PURPOSE_SIGN | OH_HUKS_KEY_PURPOSE_VERIFY 158 }, { 159 .tag = OH_HUKS_TAG_KEY_SIZE, 160 .uint32Param = OH_HUKS_CURVE25519_KEY_SIZE_256 161 }, { 162 .tag = OH_HUKS_TAG_DIGEST, 163 .uint32Param = OH_HUKS_DIGEST_SHA1 164 } 165 }; 166 static struct OH_Huks_Param g_signParamsTest004[] = { 167 { 168 .tag = OH_HUKS_TAG_ALGORITHM, 169 .uint32Param = OH_HUKS_ALG_ED25519 170 }, { 171 .tag = OH_HUKS_TAG_PURPOSE, 172 .uint32Param = OH_HUKS_KEY_PURPOSE_SIGN 173 }, { 174 .tag = OH_HUKS_TAG_KEY_SIZE, 175 .uint32Param = OH_HUKS_CURVE25519_KEY_SIZE_256 176 } 177 }; 178 } // namespace Unittest::Ed25519 179 #endif // HUKS_SIGNVERIFY_ED25519_TEST_H