Mistake on this page?
Report an issue in GitHub or email us
test_data.h
Go to the documentation of this file.
1 /** @file
2  * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
3  * SPDX-License-Identifier : Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16 **/
17 
18 #include "val_attestation.h"
19 
20 typedef struct {
21  char test_desc[100];
22  uint32_t challenge_size;
23  uint32_t actual_challenge_size;
24  uint32_t token_size;
25  psa_status_t expected_status;
26 } test_data;
27 
28 
29 static test_data check1[] = {
30 {"Test psa_initial_attestation_get_token with Challenge 32\n",
32 },
33 
34 {"Test psa_initial_attestation_get_token with Challenge 48\n",
35  PSA_INITIAL_ATTEST_CHALLENGE_SIZE_48, PSA_INITIAL_ATTEST_CHALLENGE_SIZE_48, TOKEN_SIZE, PSA_SUCCESS
36 },
37 
38 {"Test psa_initial_attestation_get_token with Challenge 64\n",
39  PSA_INITIAL_ATTEST_CHALLENGE_SIZE_64, PSA_INITIAL_ATTEST_CHALLENGE_SIZE_64, TOKEN_SIZE, PSA_SUCCESS
40 },
41 
42 {"Test psa_initial_attestation_get_token with zero challenge size\n",
43  0, 0, TOKEN_SIZE, PSA_ATTEST_ERR_INVALID_INPUT
44 },
45 
46 {"Test psa_initial_attestation_get_token with small challenge size\n",
48  TOKEN_SIZE, PSA_ATTEST_ERR_INVALID_INPUT
49 },
50 
51 {"Test psa_initial_attestation_get_token with invalid challenge size\n",
53  TOKEN_SIZE, PSA_ATTEST_ERR_INVALID_INPUT
54 },
55 
56 {"Test psa_initial_attestation_get_token with large challenge size\n",
57  MAX_CHALLENGE_SIZE+1, MAX_CHALLENGE_SIZE+1, TOKEN_SIZE, PSA_ATTEST_ERR_INVALID_INPUT
58 },
59 
60 {"Test psa_initial_attestation_get_token with zero as token size\n",
62  0, PSA_ATTEST_ERR_INVALID_INPUT
63 },
64 
65 {"Test psa_initial_attestation_get_token with small token size\n",
67  PSA_INITIAL_ATTEST_CHALLENGE_SIZE_32-1, PSA_ATTEST_ERR_TOKEN_BUFFER_OVERFLOW
68 },
69 };
70 
71 static test_data check2[] = {
72 {"Test psa_initial_attestation_get_token_size with Challenge 32\n",
74 },
75 
76 {"Test psa_initial_attestation_get_token_size with Challenge 48\n",
77  PSA_INITIAL_ATTEST_CHALLENGE_SIZE_48, PSA_INITIAL_ATTEST_CHALLENGE_SIZE_48, TOKEN_SIZE, PSA_SUCCESS
78 },
79 
80 {"Test psa_initial_attestation_get_token_size with Challenge 64\n",
81  PSA_INITIAL_ATTEST_CHALLENGE_SIZE_64, PSA_INITIAL_ATTEST_CHALLENGE_SIZE_64, TOKEN_SIZE, PSA_SUCCESS
82 },
83 
84 {"Test psa_initial_attestation_get_token_size with zero challenge size\n",
85  0, 0,
87 },
88 
89 {"Test psa_initial_attestation_get_token_size with small challenge size\n",
91  TOKEN_SIZE, PSA_ATTEST_ERR_INVALID_INPUT
92 },
93 
94 {"Test psa_initial_attestation_get_token_size with invalid challenge size\n",
96  TOKEN_SIZE, PSA_ATTEST_ERR_INVALID_INPUT
97 },
98 
99 {"Test psa_initial_attestation_get_token_size with large challenge size\n",
100  MAX_CHALLENGE_SIZE+1, MAX_CHALLENGE_SIZE+1,
101  TOKEN_SIZE, PSA_ATTEST_ERR_INVALID_INPUT
102 },
103 };
Some parameter or combination of parameters are recognised as invalid:
Copyright (c) 2019, Arm Limited or its affiliates.
Token buffer is too small to store the created token there.
#define PSA_INITIAL_ATTEST_CHALLENGE_SIZE_32
The allowed size of input challenge in bytes: 32, 48, 64 Challenge can be a nonce from server or the ...
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.