mbed TLS v3.1.0
md5.h
Go to the documentation of this file.
1 
10 /*
11  * Copyright The Mbed TLS Contributors
12  * SPDX-License-Identifier: Apache-2.0
13  *
14  * Licensed under the Apache License, Version 2.0 (the "License"); you may
15  * not use this file except in compliance with the License.
16  * You may obtain a copy of the License at
17  *
18  * http://www.apache.org/licenses/LICENSE-2.0
19  *
20  * Unless required by applicable law or agreed to in writing, software
21  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
22  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23  * See the License for the specific language governing permissions and
24  * limitations under the License.
25  */
26 #ifndef MBEDTLS_MD5_H
27 #define MBEDTLS_MD5_H
28 #include "mbedtls/private_access.h"
29 
30 #include "mbedtls/build_info.h"
31 
32 #include <stddef.h>
33 #include <stdint.h>
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 #if !defined(MBEDTLS_MD5_ALT)
40 // Regular implementation
41 //
42 
51 typedef struct mbedtls_md5_context
52 {
53  uint32_t MBEDTLS_PRIVATE(total)[2];
54  uint32_t MBEDTLS_PRIVATE(state)[4];
55  unsigned char MBEDTLS_PRIVATE(buffer)[64];
56 }
57 mbedtls_md5_context;
58 
59 #else /* MBEDTLS_MD5_ALT */
60 #include "md5_alt.h"
61 #endif /* MBEDTLS_MD5_ALT */
62 
73 void mbedtls_md5_init( mbedtls_md5_context *ctx );
74 
85 void mbedtls_md5_free( mbedtls_md5_context *ctx );
86 
98 void mbedtls_md5_clone( mbedtls_md5_context *dst,
99  const mbedtls_md5_context *src );
100 
113 int mbedtls_md5_starts( mbedtls_md5_context *ctx );
114 
129 int mbedtls_md5_update( mbedtls_md5_context *ctx,
130  const unsigned char *input,
131  size_t ilen );
132 
146 int mbedtls_md5_finish( mbedtls_md5_context *ctx,
147  unsigned char output[16] );
148 
162 int mbedtls_internal_md5_process( mbedtls_md5_context *ctx,
163  const unsigned char data[64] );
164 
179 int mbedtls_md5( const unsigned char *input,
180  size_t ilen,
181  unsigned char output[16] );
182 
183 #if defined(MBEDTLS_SELF_TEST)
184 
195 int mbedtls_md5_self_test( int verbose );
196 
197 #endif /* MBEDTLS_SELF_TEST */
198 
199 #ifdef __cplusplus
200 }
201 #endif
202 
203 #endif /* mbedtls_md5.h */
int mbedtls_md5_update(mbedtls_md5_context *ctx, const unsigned char *input, size_t ilen)
MD5 process buffer.
#define MBEDTLS_PRIVATE(member)
int mbedtls_md5(const unsigned char *input, size_t ilen, unsigned char output[16])
Output = MD5( input buffer )
void mbedtls_md5_init(mbedtls_md5_context *ctx)
Initialize MD5 context.
int mbedtls_internal_md5_process(mbedtls_md5_context *ctx, const unsigned char data[64])
MD5 process data block (internal use only)
void mbedtls_md5_clone(mbedtls_md5_context *dst, const mbedtls_md5_context *src)
Clone (the state of) an MD5 context.
int mbedtls_md5_finish(mbedtls_md5_context *ctx, unsigned char output[16])
MD5 final digest.
void mbedtls_md5_free(mbedtls_md5_context *ctx)
Clear MD5 context.
Macro wrapper for struct's memebrs.
int mbedtls_md5_starts(mbedtls_md5_context *ctx)
MD5 context setup.
Build-time configuration info.
int mbedtls_md5_self_test(int verbose)
Checkup routine.