merge master code to build iotivity
[platform/upstream/iotivity.git] / resource / csdk / security / provisioning / include / oxm / oxmrandompin.h
1 /* *****************************************************************
2  *
3  * Copyright 2015 Samsung Electronics All Rights Reserved.
4  *
5  *
6  *
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
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  * *****************************************************************/
20
21 #ifndef OXM_RANDOM_PIN_H_
22 #define OXM_RANDOM_PIN_H_
23
24 #include "ocstack.h"
25 #include "securevirtualresourcetypes.h"
26 #include "ownershiptransfermanager.h"
27 #include "pmtypes.h"
28 #include "pinoxmcommon.h"
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif // __cplusplus
33
34 #define OXM_PBKDF2_ITERATIONS 1000
35
36 /**
37  * Callback implementation to input the PIN code from user.
38  *
39  * @otmCtx  Context of OTM, It includes current device infomation.
40  * @return OC_STACK_SUCCESS in case of success and other value otherwise.
41  */
42 OCStackResult InputPinCodeCallback(OTMContext_t* otmCtx);
43
44 /**
45  * Callback implemenration to establish a secure channel with PSK cipher suite
46  *
47  * @param[in] selectedDeviceInfo Selected device infomation
48  * @return OC_STACK_SUCCESS in case of success and other value otherwise.
49  */
50 OCStackResult CreateSecureSessionRandomPinCallbak(OTMContext_t* otmCtx);
51
52 /**
53  * Generate payload for select OxM request.
54  *
55  * @param[in] selectedDeviceInfo Selected device infomation
56  * @return DOXM JSON payload including the selected OxM.
57  *         NOTE : Returned memory should be deallocated by caller.
58  */
59 char* CreatePinBasedSelectOxmPayload(OTMContext_t* otmCtx);
60
61 /**
62  * Generate payload for owner transfer request.
63  *
64  * @param[in] selectedDeviceInfo Selected device infomation
65  * @return DOXM JSON payload including the owner information.
66  *         NOTE : Returned memory should be deallocated by caller.
67  */
68 char* CreatePinBasedOwnerTransferPayload(OTMContext_t* otmCtx);
69
70 #ifdef __cplusplus
71 }
72 #endif
73 #endif //OXM_RANDOM_PIN_H_