Virgil IoT KIT
secbox.h
Go to the documentation of this file.
1 // Copyright (C) 2015-2020 Virgil Security, Inc.
2 //
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // (1) Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 //
12 // (2) Redistributions in binary form must reproduce the above copyright
13 // notice, this list of conditions and the following disclaimer in
14 // the documentation and/or other materials provided with the
15 // distribution.
16 //
17 // (3) Neither the name of the copyright holder nor the names of its
18 // contributors may be used to endorse or promote products derived from
19 // this software without specific prior written permission.
20 //
21 // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR
22 // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 // DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
25 // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29 // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
30 // IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 // POSSIBILITY OF SUCH DAMAGE.
32 //
33 // Lead Maintainer: Virgil Security Inc. <support@virgilsecurity.com>
34 
79 #ifndef VS_IOT_SECBOX_H
80 #define VS_IOT_SECBOX_H
81 
82 #include <stdint.h>
86 
87 #ifdef __cplusplus
88 namespace VirgilIoTKit {
89 extern "C" {
90 #endif
91 
93 typedef enum {
97 
109 
117 vs_secbox_deinit(void);
118 
127 ssize_t
129 
142 vs_secbox_save(vs_secbox_type_t type, vs_storage_element_id_t id, const uint8_t *data, size_t data_sz);
143 
155 vs_secbox_load(vs_storage_element_id_t id, uint8_t *data, size_t data_sz);
156 
157 
168 
169 #ifdef __cplusplus
170 } // extern "C"
171 } // namespace VirgilIoTKit
172 #endif
173 
174 #endif // VS_IOT_SECBOX_H
vs_secmodule_impl_t
Security Module implementation.
Definition: secmodule.h:458
vs_status_e
vs_status_e
Status code.
Definition: status_code.h:77
VS_SECBOX_SIGNED
@ VS_SECBOX_SIGNED
Signed data.
Definition: secbox.h:94
vs_secbox_init
vs_status_e vs_secbox_init(vs_storage_op_ctx_t *ctx, vs_secmodule_impl_t *secmodule)
Initialize Security Box.
vs_storage_element_id_t
uint8_t vs_storage_element_id_t[VS_STORAGE_ELEMENT_ID_MAX]
Definition: storage_hal.h:72
vs_secbox_load
vs_status_e vs_secbox_load(vs_storage_element_id_t id, uint8_t *data, size_t data_sz)
Load Security Box element.
vs_secbox_file_size
ssize_t vs_secbox_file_size(vs_storage_element_id_t id)
Security Box element size.
VS_SECBOX_SIGNED_AND_ENCRYPTED
@ VS_SECBOX_SIGNED_AND_ENCRYPTED
Signed and encrypted data.
Definition: secbox.h:95
status_code.h
Status codes and macroses.
vs_secbox_type_t
vs_secbox_type_t
Security box operation type.
Definition: secbox.h:93
vs_secbox_save
vs_status_e vs_secbox_save(vs_secbox_type_t type, vs_storage_element_id_t id, const uint8_t *data, size_t data_sz)
Save Security Box element.
vs_secbox_del
vs_status_e vs_secbox_del(vs_storage_element_id_t id)
Delete Security Box element.
vs_storage_op_ctx_t
Storage element context.
Definition: storage_hal.h:221
storage_hal.h
Storage HAL interface.
vs_secbox_deinit
vs_status_e vs_secbox_deinit(void)
Destroy Security Box.
secmodule.h
Security Module implementations signatures.