C API for BALTECH SDK
security_protocol.h
Go to the documentation of this file.
1 
9 #ifndef __CRYPTO_PROTOCOL_H__
10 #define __CRYPTO_PROTOCOL_H__
11 
12 
13 #include "protocol.h"
14 
15 
16 #define BRP_AES_KEY_SIZE 16
17 #define BRP_AES_BLOCK_SIZE 16
18 
22 typedef unsigned char brp_sec_key[BRP_AES_KEY_SIZE];
23 
24 
28 typedef unsigned char brp_sec_iv[BRP_AES_BLOCK_SIZE];
29 
30 
55 #define BRP_SECMODE_STD 0
56 
68 #define BRP_SECMODE_PLAIN 1
69 
88 #define BRP_SECMODE_STATELESS 2
89 
95 #define BRP_MAX_SECURITY_LEVEL 3
96 
97 
108 (
109  int security_level,
110  brp_sec_key key,
111  int sec_mode
113 );
115 
116 
127 (
128  brp_protocol protocol,
129  int security_level,
131  brp_sec_key key,
132  int * req_auth_modes,
134  brp_sec_key session_key
135 );
138 
139 
147 (
148  brp_protocol protocol,
149  int security_level,
151  int sec_mode,
152  brp_sec_key key,
154  brp_sec_iv iv,
156  int cmd_code,
163  brp_buf param_buf,
166  size_t param_len,
169  brp_time cmd_timeout,
170  int mode
173 );
175 
176 
184 (
185  brp_protocol protocol,
186  int sec_mode,
188  brp_sec_key key,
190  brp_sec_iv iv,
194  int cmd_code,
201  brp_frame resp_frm,
203  brp_time timeout
205 );
207 
208 
209 #endif
210  // end of defgroup brp_lib
unsigned char brp_sec_key[BRP_AES_KEY_SIZE]
A AES128 key, that is required for crypto operations.
BRP_LIB brp_protocol brp_create_secure_channel(int security_level, brp_sec_key key, int sec_mode)
Creates a new secured channel that allows you to establish an authenticated and encrypted connection ...
unsigned int brp_errcode
This type is used library-wide for passing error codes in the return value of functions.
Definition: errorcodes.h:23
struct brp_protocol_t * brp_protocol
This is a generic handle of a protocol.
Definition: protocol.h:34
unsigned long brp_time
absolute/relative timeout/delay in ms.
Definition: common.h:67
This file primarly defines the common part of all protocol's data structures (:brp_protocol_t) and AP...
#define BRP_AES_BLOCK_SIZE
BRP_LIB brp_errcode brp_secured_send_frm(brp_protocol protocol, int security_level, int sec_mode, brp_sec_key key, brp_sec_iv iv, int cmd_code, brp_buf param_buf, size_t param_len, brp_time cmd_timeout, int mode)
Sends an encrypted command.
unsigned char brp_sec_iv[BRP_AES_BLOCK_SIZE]
A AES IV.
BRP_LIB brp_errcode brp_mutual_authenticate(brp_protocol protocol, int security_level, brp_sec_key key, int *req_auth_modes, brp_sec_key session_key)
Does a mutual authentication and generates a session key.
#define BRP_AES_KEY_SIZE
BRP_LIB brp_errcode brp_secured_recv_frm(brp_protocol protocol, int sec_mode, brp_sec_key key, brp_sec_iv iv, int cmd_code, brp_frame resp_frm, brp_time timeout)
Sends an encrypted command.
unsigned char * brp_buf
represents a pointer to a protocol data buffer.
Definition: common.h:61