RetroArch
md.h
Go to the documentation of this file.
1 
25 #ifndef MBEDTLS_MD_H
26 #define MBEDTLS_MD_H
27 
28 #include <stddef.h>
29 
30 #define MBEDTLS_ERR_MD_FEATURE_UNAVAILABLE -0x5080
31 #define MBEDTLS_ERR_MD_BAD_INPUT_DATA -0x5100
32 #define MBEDTLS_ERR_MD_ALLOC_FAILED -0x5180
33 #define MBEDTLS_ERR_MD_FILE_IO_ERROR -0x5200
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 typedef enum {
51 
52 #if defined(MBEDTLS_SHA512_C)
53 #define MBEDTLS_MD_MAX_SIZE 64 /* longest known is SHA512 */
54 #else
55 #define MBEDTLS_MD_MAX_SIZE 32 /* longest known is SHA256 or less */
56 #endif
57 
62 
66 typedef struct {
69 
71  void *md_ctx;
72 
74  void *hmac_ctx;
76 
83 const int *mbedtls_md_list( void );
84 
94 const mbedtls_md_info_t *mbedtls_md_info_from_string( const char *md_name );
95 
106 
113 
120 
121 #if ! defined(MBEDTLS_DEPRECATED_REMOVED)
122 #if defined(MBEDTLS_DEPRECATED_WARNING)
123 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
124 #else
125 #define MBEDTLS_DEPRECATED
126 #endif
127 
142 #undef MBEDTLS_DEPRECATED
143 #endif /* MBEDTLS_DEPRECATED_REMOVED */
144 
159 int mbedtls_md_setup( mbedtls_md_context_t *ctx, const mbedtls_md_info_t *md_info, int hmac );
160 
176  const mbedtls_md_context_t *src );
177 
185 unsigned char mbedtls_md_get_size( const mbedtls_md_info_t *md_info );
186 
195 
203 const char *mbedtls_md_get_name( const mbedtls_md_info_t *md_info );
204 
216 
229 int mbedtls_md_update( mbedtls_md_context_t *ctx, const unsigned char *input, size_t ilen );
230 
242 int mbedtls_md_finish( mbedtls_md_context_t *ctx, unsigned char *output );
243 
255 int mbedtls_md( const mbedtls_md_info_t *md_info, const unsigned char *input, size_t ilen,
256  unsigned char *output );
257 
258 #if defined(MBEDTLS_FS_IO)
259 
270 int mbedtls_md_file( const mbedtls_md_info_t *md_info, const char *path,
271  unsigned char *output );
272 #endif /* MBEDTLS_FS_IO */
273 
285 int mbedtls_md_hmac_starts( mbedtls_md_context_t *ctx, const unsigned char *key,
286  size_t keylen );
287 
301 int mbedtls_md_hmac_update( mbedtls_md_context_t *ctx, const unsigned char *input,
302  size_t ilen );
303 
317 
329 
343 int mbedtls_md_hmac( const mbedtls_md_info_t *md_info, const unsigned char *key, size_t keylen,
344  const unsigned char *input, size_t ilen,
345  unsigned char *output );
346 
347 /* Internal use */
348 int mbedtls_md_process( mbedtls_md_context_t *ctx, const unsigned char *data );
349 
350 #ifdef __cplusplus
351 }
352 #endif
353 
354 #endif /* MBEDTLS_MD_H */
int mbedtls_md_clone(mbedtls_md_context_t *dst, const mbedtls_md_context_t *src)
Clone the state of an MD context.
Definition: md.c:200
int mbedtls_md_update(mbedtls_md_context_t *ctx, const unsigned char *input, size_t ilen)
Generic message digest process buffer Called between mbedtls_md_starts() and mbedtls_md_finish()....
Definition: md.c:255
int mbedtls_md_hmac_starts(mbedtls_md_context_t *ctx, const unsigned char *key, size_t keylen)
Set HMAC key and prepare to authenticate a new message. Usually called after mbedtls_md_setup() or mb...
Definition: md.c:327
mbedtls_md_type_t mbedtls_md_get_type(const mbedtls_md_info_t *md_info)
Returns the type of the message digest output.
Definition: md.c:452
Definition: md.h:43
void mbedtls_md_free(mbedtls_md_context_t *ctx)
Free and clear the internal structures of ctx. Can be called at any time after mbedtls_md_init()....
Definition: md.c:183
int mbedtls_md_finish(mbedtls_md_context_t *ctx, unsigned char *output)
Generic message digest final digest Called after mbedtls_md_update(). Usually followed by mbedtls_md_...
Definition: md.c:265
GLsizei const GLchar ** path
Definition: glext.h:7901
const mbedtls_md_info_t * mbedtls_md_info_from_type(mbedtls_md_type_t md_type)
Returns the message digest information associated with the given digest type.
Definition: md.c:137
Definition: md.h:41
Definition: md.h:45
int mbedtls_md_process(mbedtls_md_context_t *ctx, const unsigned char *data)
Definition: md.c:434
Definition: md.h:46
int mbedtls_md_init_ctx(mbedtls_md_context_t *ctx, const mbedtls_md_info_t *md_info) MBEDTLS_DEPRECATED
Select MD to use and allocate internal structures. Should be called after mbedtls_md_init() or mbedtl...
Definition: md.c:216
Definition: ibxm.h:9
GLenum GLenum GLenum input
Definition: glext.h:9938
const char * mbedtls_md_get_name(const mbedtls_md_info_t *md_info)
Returns the name of the message digest output.
Definition: md.c:460
mbedtls_md_type_t
Definition: md.h:39
Definition: md.h:40
int mbedtls_md_hmac_finish(mbedtls_md_context_t *ctx, unsigned char *output)
Output HMAC. Called after mbedtls_md_hmac_update(). Usually followed by mbedtls_md_hmac_reset(),...
Definition: md.c:376
#define MBEDTLS_DEPRECATED
Definition: md.h:125
int mbedtls_md(const mbedtls_md_info_t *md_info, const unsigned char *input, size_t ilen, unsigned char *output)
Output = message_digest( input buffer )
Definition: md.c:275
Definition: md.h:48
AVFormatContext * ctx
Definition: record_ffmpeg.c:247
int mbedtls_md_file(const mbedtls_md_info_t *md_info, const char *path, unsigned char *output)
Definition: md.c:287
GLenum src
Definition: glext.h:6980
Definition: md_internal.h:46
void mbedtls_md_init(mbedtls_md_context_t *ctx)
Initialize a md_context (as NONE) This should always be called first. Prepares the context for mbedtl...
Definition: md.c:178
std::string output
Definition: Config.FromFile.cpp:44
const mbedtls_md_info_t * mbedtls_md_info_from_string(const char *md_name)
Returns the message digest information associated with the given digest name.
Definition: md.c:96
const int * mbedtls_md_list(void)
Returns the list of digests supported by the generic digest module.
Definition: md.c:91
int mbedtls_md_hmac(const mbedtls_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 )
Definition: md.c:410
void * hmac_ctx
Definition: md.h:74
Definition: md.h:66
Definition: md.h:47
int mbedtls_md_setup(mbedtls_md_context_t *ctx, const mbedtls_md_info_t *md_info, int hmac)
Select MD to use and allocate internal structures. Should be called after mbedtls_md_init() or mbedtl...
Definition: md.c:222
GLenum GLenum dst
Definition: glext.h:6980
int mbedtls_md_starts(mbedtls_md_context_t *ctx)
Prepare the context to digest a new message. Generally called after mbedtls_md_setup() or mbedtls_md_...
Definition: md.c:245
void * md_ctx
Definition: md.h:71
int mbedtls_md_hmac_update(mbedtls_md_context_t *ctx, const unsigned char *input, size_t ilen)
Generic HMAC process buffer. Called between mbedtls_md_hmac_starts() or mbedtls_md_hmac_reset() and m...
Definition: md.c:366
Definition: md.h:49
unsigned char mbedtls_md_get_size(const mbedtls_md_info_t *md_info)
Returns the size of the message digest output.
Definition: md.c:444
Definition: md.h:42
const mbedtls_md_info_t * md_info
Definition: md.h:68
Definition: md.h:44
int mbedtls_md_hmac_reset(mbedtls_md_context_t *ctx)
Prepare to authenticate a new message with the same key. Called after mbedtls_md_hmac_finish() and be...
Definition: md.c:395