Imported Upstream version 0.9.1
[platform/upstream/iotivity.git] / resource / csdk / connectivity / external / inc / ocsecurityconfig.h
1 //******************************************************************
2 //
3 // Copyright 2014 Intel Corporation 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 OC_SECURITY_CONFIG_H
22 #define OC_SECURITY_CONFIG_H
23
24 #include <stdint.h>
25
26 #define DTLS_PSK_ID_LEN 16
27 #define DTLS_PSK_PSK_LEN 16
28
29 #define DtlsPskCredsBlobVer_1 1 /**< Credentials stored in plaintext */
30 #define DtlsPskCredsBlobVer_CurrentVersion DtlsPskCredsBlobVer_1
31
32 /**
33  * Credentials for a device. Includes identity and the associated PSK.
34  */
35 typedef struct
36 {
37    unsigned char id[DTLS_PSK_ID_LEN];
38    unsigned char psk[DTLS_PSK_PSK_LEN];
39 } OCDtlsPskCreds;
40
41 /**
42  * Binary blob containing device identity and the credentials for all devices
43  * trusted by this device.
44  */
45 typedef struct
46 {
47    unsigned char identity[DTLS_PSK_ID_LEN]; /** identity of self */
48    uint32_t num;                            /** number of credentials in this blob */
49    OCDtlsPskCreds creds[1];                 /** list of credentials. Size of this
50                                                 array is determined by 'num' variable. */
51 } OCDtlsPskCredsBlob;
52
53 #endif //OC_SECURITY_CONFIG_H
54
55
56