Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: HTTPClient-SSL WS_SERVER
md.c File Reference
Generic message digest wrapper for mbed TLS. More...
Go to the source code of this file.
Functions | |
| const int * | md_list (void) |
| Returns the list of digests supported by the generic digest module. | |
| const md_info_t * | md_info_from_string (const char *md_name) |
| Returns the message digest information associated with the given digest name. | |
| const md_info_t * | md_info_from_type (md_type_t md_type) |
| Returns the message digest information associated with the given digest type. | |
| void | md_init (md_context_t *ctx) |
| Initialize a md_context (as NONE) | |
| void | md_free (md_context_t *ctx) |
| Free and clear the message-specific context of ctx. | |
| int | md_init_ctx (md_context_t *ctx, const md_info_t *md_info) |
| Initialises and fills the message digest context structure with the appropriate values. | |
| int | md_free_ctx (md_context_t *ctx) |
| Free the message-specific context of ctx. | |
| int | md_starts (md_context_t *ctx) |
| Set-up the given context for a new message digest. | |
| int | md_update (md_context_t *ctx, const unsigned char *input, size_t ilen) |
| Generic message digest process buffer. | |
| int | md_finish (md_context_t *ctx, unsigned char *output) |
| Generic message digest final digest. | |
| int | md (const md_info_t *md_info, const unsigned char *input, size_t ilen, unsigned char *output) |
| Output = message_digest( input buffer ) | |
| int | md_file (const md_info_t *md_info, const char *path, unsigned char *output) |
| Output = message_digest( file contents ) | |
| int | md_hmac_starts (md_context_t *ctx, const unsigned char *key, size_t keylen) |
| Generic HMAC context setup. | |
| int | md_hmac_update (md_context_t *ctx, const unsigned char *input, size_t ilen) |
| Generic HMAC process buffer. | |
| int | md_hmac_finish (md_context_t *ctx, unsigned char *output) |
| Generic HMAC final digest. | |
| int | md_hmac_reset (md_context_t *ctx) |
| Generic HMAC context reset. | |
| int | md_hmac (const md_info_t *md_info, const unsigned char *key, size_t keylen, const unsigned char *input, size_t ilen, unsigned char *output) |
| Output = Generic_HMAC( hmac key, input buffer ) | |
Detailed Description
Generic message digest wrapper for mbed TLS.
Copyright (C) 2006-2014, ARM Limited, All Rights Reserved
This file is part of mbed TLS (https://tls.mbed.org)
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Definition in file md.c.
Function Documentation
| int md | ( | const md_info_t * | md_info, |
| const unsigned char * | input, | ||
| size_t | ilen, | ||
| unsigned char * | output | ||
| ) |
Output = message_digest( input buffer )
- Parameters:
-
md_info message digest info input buffer holding the data ilen length of the input data output Generic message digest checksum result
- Returns:
- 0 on success, POLARSSL_ERR_MD_BAD_INPUT_DATA if parameter verification fails.
| int md_file | ( | const md_info_t * | md_info, |
| const char * | path, | ||
| unsigned char * | output | ||
| ) |
Output = message_digest( file contents )
- Parameters:
-
md_info message digest info path input file name output generic message digest checksum result
- Returns:
- 0 if successful, POLARSSL_ERR_MD_FILE_OPEN_FAILED if fopen failed, POLARSSL_ERR_MD_FILE_READ_FAILED if fread failed, POLARSSL_ERR_MD_BAD_INPUT_DATA if md_info was NULL.
| int md_finish | ( | md_context_t * | ctx, |
| unsigned char * | output | ||
| ) |
| void md_free | ( | md_context_t * | ctx ) |
| int md_free_ctx | ( | md_context_t * | ctx ) |
| int md_hmac | ( | const md_info_t * | md_info, |
| const unsigned char * | key, | ||
| size_t | keylen, | ||
| const unsigned char * | input, | ||
| size_t | ilen, | ||
| unsigned char * | output | ||
| ) |
Output = Generic_HMAC( hmac key, input buffer )
- Parameters:
-
md_info message digest info key HMAC secret key keylen length of the HMAC key input buffer holding the data ilen length of the input data output Generic HMAC-result
- Returns:
- 0 on success, POLARSSL_ERR_MD_BAD_INPUT_DATA if parameter verification fails.
| int md_hmac_finish | ( | md_context_t * | ctx, |
| unsigned char * | output | ||
| ) |
| int md_hmac_reset | ( | md_context_t * | ctx ) |
| int md_hmac_starts | ( | md_context_t * | ctx, |
| const unsigned char * | key, | ||
| size_t | keylen | ||
| ) |
| int md_hmac_update | ( | md_context_t * | ctx, |
| const unsigned char * | input, | ||
| size_t | ilen | ||
| ) |
| const md_info_t* md_info_from_string | ( | const char * | md_name ) |
| const md_info_t* md_info_from_type | ( | md_type_t | md_type ) |
| void md_init | ( | md_context_t * | ctx ) |
| int md_init_ctx | ( | md_context_t * | ctx, |
| const md_info_t * | md_info | ||
| ) |
Initialises and fills the message digest context structure with the appropriate values.
- Note:
- Currently also clears structure. In future versions you will be required to call md_init() on the structure first.
- Parameters:
-
ctx context to initialise. May not be NULL. The digest-specific context (ctx->md_ctx) must be NULL. It will be allocated, and must be freed using md_free_ctx() later. md_info message digest to use.
- Returns:
0on success,POLARSSL_ERR_MD_BAD_INPUT_DATAon parameter failure,POLARSSL_ERR_MD_ALLOC_FAILEDif allocation of the digest-specific context failed.
| const int* md_list | ( | void | ) |
| int md_starts | ( | md_context_t * | ctx ) |
| int md_update | ( | md_context_t * | ctx, |
| const unsigned char * | input, | ||
| size_t | ilen | ||
| ) |
Generated on Tue Jul 12 2022 13:50:40 by
1.7.2