client-c  0.7.0
ext_sha.h
Go to the documentation of this file.
1 /*
2  * Copyright 2015 CyberVision, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
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 /*
18 * @file ext_sha.h
19 * @brief External SHA functions.
20 */
21 
22 #ifndef EXT_SHA_H_
23 #define EXT_SHA_H_
24 
25 #include "../kaa_error.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 
32 
33 #define SHA_1_DIGEST_LENGTH 20
34 typedef unsigned char kaa_digest[SHA_1_DIGEST_LENGTH];
35 typedef unsigned char* kaa_digest_p;
36 
37 /*
38  * @brief SHA1 hash calculation function.
39  * SHA1 hash calculation function.
40  * @param[in] data Date for which SHA1 calculates.
41  * @param[in] data_size Size of data.
42  * @param[out] digest SHA1 calculated digest.
43  *
44  * @return kaa_error_t Error code.
45  */
46 kaa_error_t ext_calculate_sha_hash(const char *data, size_t data_size, kaa_digest digest);
47 
48 /*
49  * @brief Copy SHA1 digest.
50  * Copy SHA1 digest from src to dst.
51  * @param[out] dst Destination SHA1 digest.
52  * @param[in] src Source SHA1 digest.
53  *
54  * @return Error code.
55  */
56 kaa_error_t ext_copy_sha_hash(kaa_digest_p dst, const kaa_digest_p src);
57 
58 #ifdef __cplusplus
59 } /* extern "C" */
60 #endif
61 #endif /* EXT_SHA_H_ */
unsigned char kaa_digest[SHA_1_DIGEST_LENGTH]
Definition: ext_sha.h:34
kaa_error_t
Definition: kaa_error.h:31
unsigned char * kaa_digest_p
Definition: ext_sha.h:35
kaa_error_t ext_calculate_sha_hash(const char *data, size_t data_size, kaa_digest digest)
kaa_error_t ext_copy_sha_hash(kaa_digest_p dst, const kaa_digest_p src)
#define SHA_1_DIGEST_LENGTH
Definition: ext_sha.h:33