1 //******************************************************************
3 // Copyright 2016 Samsung Electronics All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
11 // http://www.apache.org/licenses/LICENSE-2.0
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21 #ifndef _OXM_VERIFY_COMMON_
22 #define _OXM_VERIFY_COMMON_
24 #include "securevirtualresourcetypes.h"
25 #include "casecurityinterface.h"
31 /** Verification Number Length */
32 #define MUTUAL_VERIF_NUM_LEN (3)
35 #define LABEL_LEN (30)
38 * Verification Method Option definition
39 * This type supports multiple bit set.
41 typedef enum VerifyOptionBitmask
44 DISPLAY_NUM = (0x1 << 0),
45 USER_CONFIRM = (0x1 << 1)
46 } VerifyOptionBitmask_t;
49 * Function pointer to display verification PIN
51 typedef OCStackResult (*DisplayNumCallback)(void * ctx, uint8_t verifNum[MUTUAL_VERIF_NUM_LEN]);
54 * Function pointer to get user confirmation
56 typedef OCStackResult (*UserConfirmCallback)(void * ctx);
59 * Function pointer to notify user input state
61 typedef OCStackResult (*InputStateCallback)(void * ctx);
64 * Context for displaying verification PIN
66 typedef struct DisplayNumContext
68 DisplayNumCallback callback;
70 } DisplayNumContext_t;
73 * Context for getting user confirmation
75 typedef struct UserConfirmContext
77 UserConfirmCallback callback;
79 } UserConfirmContext_t;
82 * Context for notifying user input state
84 typedef struct InputStateContext
86 InputStateCallback callback;
88 } InputStateContext_t;
91 * Set Callback for displaying verification PIN
93 void SetDisplayNumCB(void * ptr, DisplayNumCallback displayNumCB);
96 * Unset Callback for displaying verification PIN
98 void* UnsetDisplayNumCB();
101 * Set Callback for getting user confirmation
103 void SetUserConfirmCB(void * ptr, UserConfirmCallback userConfirmCB);
106 * Unset Callback for getting user confirmation
108 void* UnsetUserConfirmCB();
111 * Set Callback for notifying user input state
113 void SetInputStateCB(void * ptr, UserConfirmCallback userConfirmCB);
116 * Unset Callback for notifying user input state
118 void* UnsetInputStateCB();
121 * Set verification method option.
122 * The default is both display PIN and get user confirmation.
124 void SetVerifyOption(VerifyOptionBitmask_t verifyOption);
127 * Call the Callback for Verifying Ownership Transfer process.
129 OCStackResult VerifyOwnershipTransfer(uint8_t mutualVerifNum[MUTUAL_VERIF_NUM_LEN],
130 VerifyOptionBitmask_t verifyOption);
133 * Call the Callback for notifying user input state
135 OCStackResult NotifyInputState(void);