tizen 2.3 release
[framework/system/deviced.git] / src / icd / sha2.h
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements.  See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License.  You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 /*
18  * FILE:        sha2.h
19  * AUTHOR:      Aaron D. Gifford <me@aarongifford.com>
20  *
21  * A licence was granted to the ASF by Aaron on 4 November 2003.
22  */
23
24 #ifndef __SHA2_H__
25 #define __SHA2_H__
26
27 #include <stdint.h>
28
29 /*** SHA-256 Various Length Definitions ***********************/
30 #define SECKM_SHA256_BLOCK_LENGTH             64
31 #define SECKM_SHA256_DIGEST_LENGTH            32
32 #define SECKM_SHA256_DIGEST_STRING_LENGTH     (SECKM_SHA256_DIGEST_LENGTH * 2 + 1)
33
34
35 /*** SHA-256 Context Structures *******************************/
36 typedef struct _SECKM_SHA256_CTX {
37         uint32_t    state[8];
38         uint64_t    bitcount;
39         unsigned char      buffer[SECKM_SHA256_BLOCK_LENGTH];
40 } SECKM_SHA256_CTX;
41
42
43 /*** SHA-256 Function Prototypes ******************************/
44 void SECKM_SHA256_Init(SECKM_SHA256_CTX *);
45 void SECKM_SHA256_Update(SECKM_SHA256_CTX *, const unsigned char *, size_t);
46 void SECKM_SHA256_Final(SECKM_SHA256_CTX *, unsigned char [SECKM_SHA256_DIGEST_LENGTH]);
47
48 #endif /* __SHA2_H__ */
49
50