Google Cloud IoT device SDK for embedded C  1.0.2
iotc_bsp_crypto.h
Go to the documentation of this file.
1 /* Copyright 2018-2020 Google LLC
2  *
3  * This is part of the Google Cloud IoT Device SDK for Embedded C.
4  * It is licensed under the BSD 3-Clause license; you may not use this file
5  * except in compliance with the License.
6  *
7  * You may obtain a copy of the License at:
8  * https://opensource.org/licenses/BSD-3-Clause
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __IOTC_BSP_CRYPTO_H__
18 #define __IOTC_BSP_CRYPTO_H__
19 
20 #include <stdint.h>
21 #include <sys/types.h>
22 #include <unistd.h>
23 
24 #include "iotc_types.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
66 
85  unsigned char* dst_string, size_t dst_string_size, size_t* bytes_written,
86  const uint8_t* src_buf, size_t src_buf_size);
87 
98 iotc_bsp_crypto_state_t iotc_bsp_sha256(uint8_t* dst_buf_32_bytes,
99  const uint8_t* src_buf,
100  uint32_t src_buf_size);
101 
118 iotc_bsp_crypto_state_t iotc_bsp_ecc(const iotc_crypto_key_data_t* private_key,
119  uint8_t* dst_buf, size_t dst_buf_size,
120  size_t* bytes_written,
121  const uint8_t* src_buf,
122  size_t src_buf_size);
123 
124 #ifdef __cplusplus
125 }
126 #endif
127 
128 #endif /* __IOTC_BSP_CRYPTO_H__ */
Something went wrong.
Can't base64-encode string.
iotc_bsp_crypto_state_t iotc_bsp_base64_encode_urlsafe(unsigned char *dst_string, size_t dst_string_size, size_t *bytes_written, const uint8_t *src_buf, size_t src_buf_size)
Encodes a string as a URL-safe, base64 string by replacing all URL-unsafe characters with a - (dash) ...
Can't parse private key data.
enum iotc_bsp_crypto_state_e iotc_bsp_crypto_state_t
The crytography function states.
iotc_bsp_crypto_state_t iotc_bsp_sha256(uint8_t *dst_buf_32_bytes, const uint8_t *src_buf, uint32_t src_buf_size)
Generates a SHA256 cryptographic hash.
iotc_bsp_crypto_state_e
Can't write data to the buffer because the data is larger than the buffer.
iotc_bsp_crypto_state_t iotc_bsp_ecc(const iotc_crypto_key_data_t *private_key, uint8_t *dst_buf, size_t dst_buf_size, size_t *bytes_written, const uint8_t *src_buf, size_t src_buf_size)
Generates an Elliptic Curve signature for a private key.
The cryptography function succeeded.
Can't create SHA256 digest.
Can't create ECC signature.