ReactOS  0.4.14-dev-115-g4576127
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: GPL-2.0
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License along
21  * with this program; if not, write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23  *
24  * This file is part of Mbed TLS (https://tls.mbed.org)
25  */
26 #ifndef MBEDTLS_SHA256_H
27 #define MBEDTLS_SHA256_H
28 
29 #if !defined(MBEDTLS_CONFIG_FILE)
30 #include "config.h"
31 #else
32 #include MBEDTLS_CONFIG_FILE
33 #endif
34 
35 #include <stddef.h>
36 #include <stdint.h>
37 
38 #define MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED -0x0037
40 #if !defined(MBEDTLS_SHA256_ALT)
41 // Regular implementation
42 //
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
55 typedef struct
56 {
57  uint32_t total[2];
59  unsigned char buffer[64];
60  int is224;
63 }
65 
72 
79 
87  const mbedtls_sha256_context *src );
88 
101 
113  const unsigned char *input,
114  size_t ilen );
115 
126  unsigned char output[32] );
127 
139  const unsigned char data[64] );
140 
141 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
142 #if defined(MBEDTLS_DEPRECATED_WARNING)
143 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
144 #else
145 #define MBEDTLS_DEPRECATED
146 #endif
147 
158  int is224 );
159 
171  const unsigned char *input,
172  size_t ilen );
173 
184  unsigned char output[32] );
185 
197  const unsigned char data[64] );
198 
199 #undef MBEDTLS_DEPRECATED
200 #endif /* !MBEDTLS_DEPRECATED_REMOVED */
201 #ifdef __cplusplus
202 }
203 #endif
204 
205 #else /* MBEDTLS_SHA256_ALT */
206 #include "sha256_alt.h"
207 #endif /* MBEDTLS_SHA256_ALT */
208 
209 #ifdef __cplusplus
210 extern "C" {
211 #endif
212 
230 int mbedtls_sha256_ret( const unsigned char *input,
231  size_t ilen,
232  unsigned char output[32],
233  int is224 );
234 
235 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
236 #if defined(MBEDTLS_DEPRECATED_WARNING)
237 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
238 #else
239 #define MBEDTLS_DEPRECATED
240 #endif
241 
261 MBEDTLS_DEPRECATED void mbedtls_sha256( const unsigned char *input,
262  size_t ilen,
263  unsigned char output[32],
264  int is224 );
265 
266 #undef MBEDTLS_DEPRECATED
267 #endif /* !MBEDTLS_DEPRECATED_REMOVED */
268 
275 
276 #ifdef __cplusplus
277 }
278 #endif
279 
280 #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:239
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:55
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.