ReactOS  0.4.15-dev-492-ga1108f6
sha256.h
Go to the documentation of this file.
1 
6 /*
7  * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved
8  * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
9  *
10  * This file is provided under the Apache License 2.0, or the
11  * GNU General Public License v2.0 or later.
12  *
13  * **********
14  * Apache License 2.0:
15  *
16  * Licensed under the Apache License, Version 2.0 (the "License"); you may
17  * not use this file except in compliance with the License.
18  * You may obtain a copy of the License at
19  *
20  * http://www.apache.org/licenses/LICENSE-2.0
21  *
22  * Unless required by applicable law or agreed to in writing, software
23  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
24  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25  * See the License for the specific language governing permissions and
26  * limitations under the License.
27  *
28  * **********
29  *
30  * **********
31  * GNU General Public License v2.0 or later:
32  *
33  * This program is free software; you can redistribute it and/or modify
34  * it under the terms of the GNU General Public License as published by
35  * the Free Software Foundation; either version 2 of the License, or
36  * (at your option) any later version.
37  *
38  * This program is distributed in the hope that it will be useful,
39  * but WITHOUT ANY WARRANTY; without even the implied warranty of
40  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
41  * GNU General Public License for more details.
42  *
43  * You should have received a copy of the GNU General Public License along
44  * with this program; if not, write to the Free Software Foundation, Inc.,
45  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
46  *
47  * **********
48  *
49  * This file is part of Mbed TLS (https://tls.mbed.org)
50  */
51 #ifndef MBEDTLS_SHA256_H
52 #define MBEDTLS_SHA256_H
53 
54 #if !defined(MBEDTLS_CONFIG_FILE)
55 #include "config.h"
56 #else
57 #include MBEDTLS_CONFIG_FILE
58 #endif
59 
60 #include <stddef.h>
61 #include <stdint.h>
62 
63 #define MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED -0x0037
65 #if !defined(MBEDTLS_SHA256_ALT)
66 // Regular implementation
67 //
68 
69 #ifdef __cplusplus
70 extern "C" {
71 #endif
72 
80 typedef struct
81 {
82  uint32_t total[2];
84  unsigned char buffer[64];
85  int is224;
88 }
90 
97 
104 
112  const mbedtls_sha256_context *src );
113 
126 
138  const unsigned char *input,
139  size_t ilen );
140 
151  unsigned char output[32] );
152 
164  const unsigned char data[64] );
165 
166 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
167 #if defined(MBEDTLS_DEPRECATED_WARNING)
168 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
169 #else
170 #define MBEDTLS_DEPRECATED
171 #endif
172 
183  int is224 );
184 
196  const unsigned char *input,
197  size_t ilen );
198 
209  unsigned char output[32] );
210 
222  const unsigned char data[64] );
223 
224 #undef MBEDTLS_DEPRECATED
225 #endif /* !MBEDTLS_DEPRECATED_REMOVED */
226 #ifdef __cplusplus
227 }
228 #endif
229 
230 #else /* MBEDTLS_SHA256_ALT */
231 #include "sha256_alt.h"
232 #endif /* MBEDTLS_SHA256_ALT */
233 
234 #ifdef __cplusplus
235 extern "C" {
236 #endif
237 
255 int mbedtls_sha256_ret( const unsigned char *input,
256  size_t ilen,
257  unsigned char output[32],
258  int is224 );
259 
260 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
261 #if defined(MBEDTLS_DEPRECATED_WARNING)
262 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
263 #else
264 #define MBEDTLS_DEPRECATED
265 #endif
266 
286 MBEDTLS_DEPRECATED void mbedtls_sha256( const unsigned char *input,
287  size_t ilen,
288  unsigned char output[32],
289  int is224 );
290 
291 #undef MBEDTLS_DEPRECATED
292 #endif /* !MBEDTLS_DEPRECATED_REMOVED */
293 
300 
301 #ifdef __cplusplus
302 }
303 #endif
304 
305 #endif /* mbedtls_sha256.h */
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
int mbedtls_internal_sha256_process(mbedtls_sha256_context *ctx, const unsigned char data[64])
This function processes a single data block within the ongoing SHA-256 computation....
MBEDTLS_DEPRECATED void mbedtls_sha256_finish(mbedtls_sha256_context *ctx, unsigned char output[32])
This function finishes the SHA-256 operation, and writes the result to the output buffer.
void mbedtls_sha256_init(mbedtls_sha256_context *ctx)
This function initializes a SHA-256 context.
int mbedtls_sha256_update_ret(mbedtls_sha256_context *ctx, const unsigned char *input, size_t ilen)
This function feeds an input buffer into an ongoing SHA-256 checksum calculation.
void mbedtls_sha256_free(mbedtls_sha256_context *ctx)
This function clears a SHA-256 context.
int mbedtls_sha256_starts_ret(mbedtls_sha256_context *ctx, int is224)
This function starts a SHA-224 or SHA-256 checksum calculation.
GLuint buffer
Definition: glext.h:5915
#define verbose
Definition: rosglue.h:36
int mbedtls_sha256_finish_ret(mbedtls_sha256_context *ctx, unsigned char output[32])
This function finishes the SHA-256 operation, and writes the result to the output buffer.
#define MBEDTLS_DEPRECATED
Definition: sha256.h:264
MBEDTLS_DEPRECATED void mbedtls_sha256_update(mbedtls_sha256_context *ctx, const unsigned char *input, size_t ilen)
This function feeds an input buffer into an ongoing SHA-256 checksum calculation.
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
The SHA-256 context structure.
Definition: sha256.h:80
static int state
Definition: maze.c:121
GLenum src
Definition: glext.h:6340
MBEDTLS_DEPRECATED void mbedtls_sha256(const unsigned char *input, size_t ilen, unsigned char output[32], int is224)
This function calculates the SHA-224 or SHA-256 checksum of a buffer.
int mbedtls_sha256_ret(const unsigned char *input, size_t ilen, unsigned char output[32], int is224)
This function calculates the SHA-224 or SHA-256 checksum of a buffer.
GLenum GLenum GLenum input
Definition: glext.h:9031
GLenum GLenum dst
Definition: glext.h:6340
UINT32 uint32_t
Definition: types.h:75
MBEDTLS_DEPRECATED void mbedtls_sha256_process(mbedtls_sha256_context *ctx, const unsigned char data[64])
This function processes a single data block within the ongoing SHA-256 computation....
void mbedtls_sha256_clone(mbedtls_sha256_context *dst, const mbedtls_sha256_context *src)
This function clones the state of a SHA-256 context.
MBEDTLS_DEPRECATED void mbedtls_sha256_starts(mbedtls_sha256_context *ctx, int is224)
This function starts a SHA-256 checksum calculation.
int mbedtls_sha256_self_test(int verbose)
The SHA-224 and SHA-256 checkup routine.