ReactOS  0.4.15-dev-5142-g967f5b9
sha256.h
Go to the documentation of this file.
1 
9 /*
10  * Copyright The Mbed TLS Contributors
11  * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
12  *
13  * This file is provided under the Apache License 2.0, or the
14  * GNU General Public License v2.0 or later.
15  *
16  * **********
17  * Apache License 2.0:
18  *
19  * Licensed under the Apache License, Version 2.0 (the "License"); you may
20  * not use this file except in compliance with the License.
21  * You may obtain a copy of the License at
22  *
23  * http://www.apache.org/licenses/LICENSE-2.0
24  *
25  * Unless required by applicable law or agreed to in writing, software
26  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
27  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28  * See the License for the specific language governing permissions and
29  * limitations under the License.
30  *
31  * **********
32  *
33  * **********
34  * GNU General Public License v2.0 or later:
35  *
36  * This program is free software; you can redistribute it and/or modify
37  * it under the terms of the GNU General Public License as published by
38  * the Free Software Foundation; either version 2 of the License, or
39  * (at your option) any later version.
40  *
41  * This program is distributed in the hope that it will be useful,
42  * but WITHOUT ANY WARRANTY; without even the implied warranty of
43  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
44  * GNU General Public License for more details.
45  *
46  * You should have received a copy of the GNU General Public License along
47  * with this program; if not, write to the Free Software Foundation, Inc.,
48  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
49  *
50  * **********
51  */
52 #ifndef MBEDTLS_SHA256_H
53 #define MBEDTLS_SHA256_H
54 
55 #if !defined(MBEDTLS_CONFIG_FILE)
56 #include "config.h"
57 #else
58 #include MBEDTLS_CONFIG_FILE
59 #endif
60 
61 #include <stddef.h>
62 #include <stdint.h>
63 
64 /* MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED is deprecated and should not be used. */
65 #define MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED -0x0037
66 #define MBEDTLS_ERR_SHA256_BAD_INPUT_DATA -0x0074
68 #ifdef __cplusplus
69 extern "C" {
70 #endif
71 
72 #if !defined(MBEDTLS_SHA256_ALT)
73 // Regular implementation
74 //
75 
83 typedef struct mbedtls_sha256_context
84 {
87  unsigned char buffer[64];
88  int is224;
90 }
92 
93 #else /* MBEDTLS_SHA256_ALT */
94 #include "sha256_alt.h"
95 #endif /* MBEDTLS_SHA256_ALT */
96 
103 
112 
120  const mbedtls_sha256_context *src );
121 
134 
149  const unsigned char *input,
150  size_t ilen );
151 
165  unsigned char output[32] );
166 
180  const unsigned char data[64] );
181 
182 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
183 #if defined(MBEDTLS_DEPRECATED_WARNING)
184 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
185 #else
186 #define MBEDTLS_DEPRECATED
187 #endif
188 
199  int is224 );
200 
214  const unsigned char *input,
215  size_t ilen );
216 
229  unsigned char output[32] );
230 
243  const unsigned char data[64] );
244 
245 #undef MBEDTLS_DEPRECATED
246 #endif /* !MBEDTLS_DEPRECATED_REMOVED */
247 
266 int mbedtls_sha256_ret( const unsigned char *input,
267  size_t ilen,
268  unsigned char output[32],
269  int is224 );
270 
271 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
272 #if defined(MBEDTLS_DEPRECATED_WARNING)
273 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
274 #else
275 #define MBEDTLS_DEPRECATED
276 #endif
277 
298 MBEDTLS_DEPRECATED void mbedtls_sha256( const unsigned char *input,
299  size_t ilen,
300  unsigned char output[32],
301  int is224 );
302 
303 #undef MBEDTLS_DEPRECATED
304 #endif /* !MBEDTLS_DEPRECATED_REMOVED */
305 
306 #if defined(MBEDTLS_SELF_TEST)
307 
314 int mbedtls_sha256_self_test( int verbose );
315 
316 #endif /* MBEDTLS_SELF_TEST */
317 
318 #ifdef __cplusplus
319 }
320 #endif
321 
322 #endif /* mbedtls_sha256.h */
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.
uint32_t total[2]
Definition: sha256.h:85
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:275
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.
uint32_t state[8]
Definition: sha256.h:86
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
struct mbedtls_sha256_context mbedtls_sha256_context
The SHA-256 context structure.
The SHA-256 context structure.
Definition: sha256.h:83
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-224 or SHA-256 checksum calculation.