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 * Function pointer to notify user selected OXM
66 typedef void (*InformOxmSelectedCallback_t)(OicSecOxm_t oxmSel);
69 * Context for displaying verification PIN
71 typedef struct DisplayNumContext
73 DisplayNumCallback callback;
75 } DisplayNumContext_t;
78 * Context for getting user confirmation
80 typedef struct UserConfirmContext
82 UserConfirmCallback callback;
84 } UserConfirmContext_t;
87 * Context for notifying user input state
89 typedef struct InputStateContext
91 InputStateCallback callback;
93 } InputStateContext_t;
96 * Set Callback for displaying verification PIN
98 void SetDisplayNumCB(void * ptr, DisplayNumCallback displayNumCB);
101 * Unset Callback for displaying verification PIN
103 void* UnsetDisplayNumCB();
106 * Set Callback for getting user confirmation
108 void SetUserConfirmCB(void * ptr, UserConfirmCallback userConfirmCB);
111 * Unset Callback for getting user confirmation
113 void* UnsetUserConfirmCB();
116 * Set Callback for notifying user input state
118 void SetInputStateCB(void * ptr, UserConfirmCallback userConfirmCB);
121 * Unset Callback for notifying user input state
123 void* UnsetInputStateCB();
126 * Set verification method option.
127 * The default is both display PIN and get user confirmation.
129 void SetVerifyOption(VerifyOptionBitmask_t verifyOption);
132 * Set notify selected OXM callback
134 void SetInformOxmSelCB(InformOxmSelectedCallback_t informOxmSelCB);
137 * Set notify selected OXM callback
139 void UnsetInformOxmSelCB();
142 * Call the Callback for Verifying Ownership Transfer process.
144 OCStackResult VerifyOwnershipTransfer(uint8_t mutualVerifNum[MUTUAL_VERIF_NUM_LEN],
145 VerifyOptionBitmask_t verifyOption);
148 * Call the Callback for notifying user input state
150 OCStackResult NotifyInputState(void);