mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
PolarSSL: update to current stable version (1.3.4)
I just removed Externals/polarssl/, added the new version, then deleted the following files/directories: DartConfiguration.tcl Makefile doxygen/ library/Makefile programs/ scripts/ tests/ visualc/
This commit is contained in:
411
Externals/polarssl/library/md_wrap.c
vendored
411
Externals/polarssl/library/md_wrap.c
vendored
@ -5,7 +5,7 @@
|
||||
*
|
||||
* \author Adriaan de Jong <dejong@fox-it.com>
|
||||
*
|
||||
* Copyright (C) 2006-2010, Brainspark B.V.
|
||||
* Copyright (C) 2006-2013, Brainspark B.V.
|
||||
*
|
||||
* This file is part of PolarSSL (http://www.polarssl.org)
|
||||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
|
||||
@ -45,16 +45,27 @@
|
||||
#include "polarssl/md5.h"
|
||||
#endif
|
||||
|
||||
#if defined(POLARSSL_RIPEMD160_C)
|
||||
#include "polarssl/ripemd160.h"
|
||||
#endif
|
||||
|
||||
#if defined(POLARSSL_SHA1_C)
|
||||
#include "polarssl/sha1.h"
|
||||
#endif
|
||||
|
||||
#if defined(POLARSSL_SHA2_C)
|
||||
#include "polarssl/sha2.h"
|
||||
#if defined(POLARSSL_SHA256_C)
|
||||
#include "polarssl/sha256.h"
|
||||
#endif
|
||||
|
||||
#if defined(POLARSSL_SHA4_C)
|
||||
#include "polarssl/sha4.h"
|
||||
#if defined(POLARSSL_SHA512_C)
|
||||
#include "polarssl/sha512.h"
|
||||
#endif
|
||||
|
||||
#if defined(POLARSSL_MEMORY_C)
|
||||
#include "polarssl/memory.h"
|
||||
#else
|
||||
#define polarssl_malloc malloc
|
||||
#define polarssl_free free
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
@ -76,7 +87,7 @@ static void md2_finish_wrap( void *ctx, unsigned char *output )
|
||||
md2_finish( (md2_context *) ctx, output );
|
||||
}
|
||||
|
||||
int md2_file_wrap( const char *path, unsigned char *output )
|
||||
static int md2_file_wrap( const char *path, unsigned char *output )
|
||||
{
|
||||
#if defined(POLARSSL_FS_IO)
|
||||
return md2_file( path, output );
|
||||
@ -109,12 +120,19 @@ static void md2_hmac_reset_wrap( void *ctx )
|
||||
|
||||
static void * md2_ctx_alloc( void )
|
||||
{
|
||||
return malloc( sizeof( md2_context ) );
|
||||
return polarssl_malloc( sizeof( md2_context ) );
|
||||
}
|
||||
|
||||
static void md2_ctx_free( void *ctx )
|
||||
{
|
||||
free( ctx );
|
||||
polarssl_free( ctx );
|
||||
}
|
||||
|
||||
static void md2_process_wrap( void *ctx, const unsigned char *data )
|
||||
{
|
||||
((void) data);
|
||||
|
||||
md2_process( (md2_context *) ctx );
|
||||
}
|
||||
|
||||
const md_info_t md2_info = {
|
||||
@ -133,28 +151,29 @@ const md_info_t md2_info = {
|
||||
md2_hmac,
|
||||
md2_ctx_alloc,
|
||||
md2_ctx_free,
|
||||
md2_process_wrap,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(POLARSSL_MD4_C)
|
||||
|
||||
void md4_starts_wrap( void *ctx )
|
||||
static void md4_starts_wrap( void *ctx )
|
||||
{
|
||||
md4_starts( (md4_context *) ctx );
|
||||
}
|
||||
|
||||
void md4_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
|
||||
static void md4_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
|
||||
{
|
||||
md4_update( (md4_context *) ctx, input, ilen );
|
||||
}
|
||||
|
||||
void md4_finish_wrap( void *ctx, unsigned char *output )
|
||||
static void md4_finish_wrap( void *ctx, unsigned char *output )
|
||||
{
|
||||
md4_finish( (md4_context *) ctx, output );
|
||||
}
|
||||
|
||||
int md4_file_wrap( const char *path, unsigned char *output )
|
||||
static int md4_file_wrap( const char *path, unsigned char *output )
|
||||
{
|
||||
#if defined(POLARSSL_FS_IO)
|
||||
return md4_file( path, output );
|
||||
@ -165,34 +184,39 @@ int md4_file_wrap( const char *path, unsigned char *output )
|
||||
#endif
|
||||
}
|
||||
|
||||
void md4_hmac_starts_wrap( void *ctx, const unsigned char *key, size_t keylen )
|
||||
static void md4_hmac_starts_wrap( void *ctx, const unsigned char *key, size_t keylen )
|
||||
{
|
||||
md4_hmac_starts( (md4_context *) ctx, key, keylen );
|
||||
}
|
||||
|
||||
void md4_hmac_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
|
||||
static void md4_hmac_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
|
||||
{
|
||||
md4_hmac_update( (md4_context *) ctx, input, ilen );
|
||||
}
|
||||
|
||||
void md4_hmac_finish_wrap( void *ctx, unsigned char *output )
|
||||
static void md4_hmac_finish_wrap( void *ctx, unsigned char *output )
|
||||
{
|
||||
md4_hmac_finish( (md4_context *) ctx, output );
|
||||
}
|
||||
|
||||
void md4_hmac_reset_wrap( void *ctx )
|
||||
static void md4_hmac_reset_wrap( void *ctx )
|
||||
{
|
||||
md4_hmac_reset( (md4_context *) ctx );
|
||||
}
|
||||
|
||||
void *md4_ctx_alloc( void )
|
||||
static void *md4_ctx_alloc( void )
|
||||
{
|
||||
return malloc( sizeof( md4_context ) );
|
||||
return polarssl_malloc( sizeof( md4_context ) );
|
||||
}
|
||||
|
||||
void md4_ctx_free( void *ctx )
|
||||
static void md4_ctx_free( void *ctx )
|
||||
{
|
||||
free( ctx );
|
||||
polarssl_free( ctx );
|
||||
}
|
||||
|
||||
static void md4_process_wrap( void *ctx, const unsigned char *data )
|
||||
{
|
||||
md4_process( (md4_context *) ctx, data );
|
||||
}
|
||||
|
||||
const md_info_t md4_info = {
|
||||
@ -211,6 +235,7 @@ const md_info_t md4_info = {
|
||||
md4_hmac,
|
||||
md4_ctx_alloc,
|
||||
md4_ctx_free,
|
||||
md4_process_wrap,
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -232,7 +257,7 @@ static void md5_finish_wrap( void *ctx, unsigned char *output )
|
||||
md5_finish( (md5_context *) ctx, output );
|
||||
}
|
||||
|
||||
int md5_file_wrap( const char *path, unsigned char *output )
|
||||
static int md5_file_wrap( const char *path, unsigned char *output )
|
||||
{
|
||||
#if defined(POLARSSL_FS_IO)
|
||||
return md5_file( path, output );
|
||||
@ -265,12 +290,17 @@ static void md5_hmac_reset_wrap( void *ctx )
|
||||
|
||||
static void * md5_ctx_alloc( void )
|
||||
{
|
||||
return malloc( sizeof( md5_context ) );
|
||||
return polarssl_malloc( sizeof( md5_context ) );
|
||||
}
|
||||
|
||||
static void md5_ctx_free( void *ctx )
|
||||
{
|
||||
free( ctx );
|
||||
polarssl_free( ctx );
|
||||
}
|
||||
|
||||
static void md5_process_wrap( void *ctx, const unsigned char *data )
|
||||
{
|
||||
md5_process( (md5_context *) ctx, data );
|
||||
}
|
||||
|
||||
const md_info_t md5_info = {
|
||||
@ -289,28 +319,113 @@ const md_info_t md5_info = {
|
||||
md5_hmac,
|
||||
md5_ctx_alloc,
|
||||
md5_ctx_free,
|
||||
md5_process_wrap,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(POLARSSL_RIPEMD160_C)
|
||||
|
||||
static void ripemd160_starts_wrap( void *ctx )
|
||||
{
|
||||
ripemd160_starts( (ripemd160_context *) ctx );
|
||||
}
|
||||
|
||||
static void ripemd160_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
|
||||
{
|
||||
ripemd160_update( (ripemd160_context *) ctx, input, ilen );
|
||||
}
|
||||
|
||||
static void ripemd160_finish_wrap( void *ctx, unsigned char *output )
|
||||
{
|
||||
ripemd160_finish( (ripemd160_context *) ctx, output );
|
||||
}
|
||||
|
||||
static int ripemd160_file_wrap( const char *path, unsigned char *output )
|
||||
{
|
||||
#if defined(POLARSSL_FS_IO)
|
||||
return ripemd160_file( path, output );
|
||||
#else
|
||||
((void) path);
|
||||
((void) output);
|
||||
return POLARSSL_ERR_MD_FEATURE_UNAVAILABLE;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ripemd160_hmac_starts_wrap( void *ctx, const unsigned char *key, size_t keylen )
|
||||
{
|
||||
ripemd160_hmac_starts( (ripemd160_context *) ctx, key, keylen );
|
||||
}
|
||||
|
||||
static void ripemd160_hmac_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
|
||||
{
|
||||
ripemd160_hmac_update( (ripemd160_context *) ctx, input, ilen );
|
||||
}
|
||||
|
||||
static void ripemd160_hmac_finish_wrap( void *ctx, unsigned char *output )
|
||||
{
|
||||
ripemd160_hmac_finish( (ripemd160_context *) ctx, output );
|
||||
}
|
||||
|
||||
static void ripemd160_hmac_reset_wrap( void *ctx )
|
||||
{
|
||||
ripemd160_hmac_reset( (ripemd160_context *) ctx );
|
||||
}
|
||||
|
||||
static void * ripemd160_ctx_alloc( void )
|
||||
{
|
||||
return polarssl_malloc( sizeof( ripemd160_context ) );
|
||||
}
|
||||
|
||||
static void ripemd160_ctx_free( void *ctx )
|
||||
{
|
||||
polarssl_free( ctx );
|
||||
}
|
||||
|
||||
static void ripemd160_process_wrap( void *ctx, const unsigned char *data )
|
||||
{
|
||||
ripemd160_process( (ripemd160_context *) ctx, data );
|
||||
}
|
||||
|
||||
const md_info_t ripemd160_info = {
|
||||
POLARSSL_MD_RIPEMD160,
|
||||
"RIPEMD160",
|
||||
20,
|
||||
ripemd160_starts_wrap,
|
||||
ripemd160_update_wrap,
|
||||
ripemd160_finish_wrap,
|
||||
ripemd160,
|
||||
ripemd160_file_wrap,
|
||||
ripemd160_hmac_starts_wrap,
|
||||
ripemd160_hmac_update_wrap,
|
||||
ripemd160_hmac_finish_wrap,
|
||||
ripemd160_hmac_reset_wrap,
|
||||
ripemd160_hmac,
|
||||
ripemd160_ctx_alloc,
|
||||
ripemd160_ctx_free,
|
||||
ripemd160_process_wrap,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(POLARSSL_SHA1_C)
|
||||
|
||||
void sha1_starts_wrap( void *ctx )
|
||||
static void sha1_starts_wrap( void *ctx )
|
||||
{
|
||||
sha1_starts( (sha1_context *) ctx );
|
||||
}
|
||||
|
||||
void sha1_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
|
||||
static void sha1_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
|
||||
{
|
||||
sha1_update( (sha1_context *) ctx, input, ilen );
|
||||
}
|
||||
|
||||
void sha1_finish_wrap( void *ctx, unsigned char *output )
|
||||
static void sha1_finish_wrap( void *ctx, unsigned char *output )
|
||||
{
|
||||
sha1_finish( (sha1_context *) ctx, output );
|
||||
}
|
||||
|
||||
int sha1_file_wrap( const char *path, unsigned char *output )
|
||||
static int sha1_file_wrap( const char *path, unsigned char *output )
|
||||
{
|
||||
#if defined(POLARSSL_FS_IO)
|
||||
return sha1_file( path, output );
|
||||
@ -321,34 +436,39 @@ int sha1_file_wrap( const char *path, unsigned char *output )
|
||||
#endif
|
||||
}
|
||||
|
||||
void sha1_hmac_starts_wrap( void *ctx, const unsigned char *key, size_t keylen )
|
||||
static void sha1_hmac_starts_wrap( void *ctx, const unsigned char *key, size_t keylen )
|
||||
{
|
||||
sha1_hmac_starts( (sha1_context *) ctx, key, keylen );
|
||||
}
|
||||
|
||||
void sha1_hmac_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
|
||||
static void sha1_hmac_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
|
||||
{
|
||||
sha1_hmac_update( (sha1_context *) ctx, input, ilen );
|
||||
}
|
||||
|
||||
void sha1_hmac_finish_wrap( void *ctx, unsigned char *output )
|
||||
static void sha1_hmac_finish_wrap( void *ctx, unsigned char *output )
|
||||
{
|
||||
sha1_hmac_finish( (sha1_context *) ctx, output );
|
||||
}
|
||||
|
||||
void sha1_hmac_reset_wrap( void *ctx )
|
||||
static void sha1_hmac_reset_wrap( void *ctx )
|
||||
{
|
||||
sha1_hmac_reset( (sha1_context *) ctx );
|
||||
}
|
||||
|
||||
void * sha1_ctx_alloc( void )
|
||||
static void * sha1_ctx_alloc( void )
|
||||
{
|
||||
return malloc( sizeof( sha1_context ) );
|
||||
return polarssl_malloc( sizeof( sha1_context ) );
|
||||
}
|
||||
|
||||
void sha1_ctx_free( void *ctx )
|
||||
static void sha1_ctx_free( void *ctx )
|
||||
{
|
||||
free( ctx );
|
||||
polarssl_free( ctx );
|
||||
}
|
||||
|
||||
static void sha1_process_wrap( void *ctx, const unsigned char *data )
|
||||
{
|
||||
sha1_process( (sha1_context *) ctx, data );
|
||||
}
|
||||
|
||||
const md_info_t sha1_info = {
|
||||
@ -367,6 +487,7 @@ const md_info_t sha1_info = {
|
||||
sha1_hmac,
|
||||
sha1_ctx_alloc,
|
||||
sha1_ctx_free,
|
||||
sha1_process_wrap,
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -374,33 +495,33 @@ const md_info_t sha1_info = {
|
||||
/*
|
||||
* Wrappers for generic message digests
|
||||
*/
|
||||
#if defined(POLARSSL_SHA2_C)
|
||||
#if defined(POLARSSL_SHA256_C)
|
||||
|
||||
void sha224_starts_wrap( void *ctx )
|
||||
static void sha224_starts_wrap( void *ctx )
|
||||
{
|
||||
sha2_starts( (sha2_context *) ctx, 1 );
|
||||
sha256_starts( (sha256_context *) ctx, 1 );
|
||||
}
|
||||
|
||||
void sha224_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
|
||||
static void sha224_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
|
||||
{
|
||||
sha2_update( (sha2_context *) ctx, input, ilen );
|
||||
sha256_update( (sha256_context *) ctx, input, ilen );
|
||||
}
|
||||
|
||||
void sha224_finish_wrap( void *ctx, unsigned char *output )
|
||||
static void sha224_finish_wrap( void *ctx, unsigned char *output )
|
||||
{
|
||||
sha2_finish( (sha2_context *) ctx, output );
|
||||
sha256_finish( (sha256_context *) ctx, output );
|
||||
}
|
||||
|
||||
void sha224_wrap( const unsigned char *input, size_t ilen,
|
||||
static void sha224_wrap( const unsigned char *input, size_t ilen,
|
||||
unsigned char *output )
|
||||
{
|
||||
sha2( input, ilen, output, 1 );
|
||||
sha256( input, ilen, output, 1 );
|
||||
}
|
||||
|
||||
int sha224_file_wrap( const char *path, unsigned char *output )
|
||||
static int sha224_file_wrap( const char *path, unsigned char *output )
|
||||
{
|
||||
#if defined(POLARSSL_FS_IO)
|
||||
return sha2_file( path, output, 1 );
|
||||
return sha256_file( path, output, 1 );
|
||||
#else
|
||||
((void) path);
|
||||
((void) output);
|
||||
@ -408,41 +529,46 @@ int sha224_file_wrap( const char *path, unsigned char *output )
|
||||
#endif
|
||||
}
|
||||
|
||||
void sha224_hmac_starts_wrap( void *ctx, const unsigned char *key, size_t keylen )
|
||||
static void sha224_hmac_starts_wrap( void *ctx, const unsigned char *key, size_t keylen )
|
||||
{
|
||||
sha2_hmac_starts( (sha2_context *) ctx, key, keylen, 1 );
|
||||
sha256_hmac_starts( (sha256_context *) ctx, key, keylen, 1 );
|
||||
}
|
||||
|
||||
void sha224_hmac_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
|
||||
static void sha224_hmac_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
|
||||
{
|
||||
sha2_hmac_update( (sha2_context *) ctx, input, ilen );
|
||||
sha256_hmac_update( (sha256_context *) ctx, input, ilen );
|
||||
}
|
||||
|
||||
void sha224_hmac_finish_wrap( void *ctx, unsigned char *output )
|
||||
static void sha224_hmac_finish_wrap( void *ctx, unsigned char *output )
|
||||
{
|
||||
sha2_hmac_finish( (sha2_context *) ctx, output );
|
||||
sha256_hmac_finish( (sha256_context *) ctx, output );
|
||||
}
|
||||
|
||||
void sha224_hmac_reset_wrap( void *ctx )
|
||||
static void sha224_hmac_reset_wrap( void *ctx )
|
||||
{
|
||||
sha2_hmac_reset( (sha2_context *) ctx );
|
||||
sha256_hmac_reset( (sha256_context *) ctx );
|
||||
}
|
||||
|
||||
void sha224_hmac_wrap( const unsigned char *key, size_t keylen,
|
||||
static void sha224_hmac_wrap( const unsigned char *key, size_t keylen,
|
||||
const unsigned char *input, size_t ilen,
|
||||
unsigned char *output )
|
||||
{
|
||||
sha2_hmac( key, keylen, input, ilen, output, 1 );
|
||||
sha256_hmac( key, keylen, input, ilen, output, 1 );
|
||||
}
|
||||
|
||||
void * sha224_ctx_alloc( void )
|
||||
static void * sha224_ctx_alloc( void )
|
||||
{
|
||||
return malloc( sizeof( sha2_context ) );
|
||||
return polarssl_malloc( sizeof( sha256_context ) );
|
||||
}
|
||||
|
||||
void sha224_ctx_free( void *ctx )
|
||||
static void sha224_ctx_free( void *ctx )
|
||||
{
|
||||
free( ctx );
|
||||
polarssl_free( ctx );
|
||||
}
|
||||
|
||||
static void sha224_process_wrap( void *ctx, const unsigned char *data )
|
||||
{
|
||||
sha256_process( (sha256_context *) ctx, data );
|
||||
}
|
||||
|
||||
const md_info_t sha224_info = {
|
||||
@ -461,33 +587,34 @@ const md_info_t sha224_info = {
|
||||
sha224_hmac_wrap,
|
||||
sha224_ctx_alloc,
|
||||
sha224_ctx_free,
|
||||
sha224_process_wrap,
|
||||
};
|
||||
|
||||
void sha256_starts_wrap( void *ctx )
|
||||
static void sha256_starts_wrap( void *ctx )
|
||||
{
|
||||
sha2_starts( (sha2_context *) ctx, 0 );
|
||||
sha256_starts( (sha256_context *) ctx, 0 );
|
||||
}
|
||||
|
||||
void sha256_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
|
||||
static void sha256_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
|
||||
{
|
||||
sha2_update( (sha2_context *) ctx, input, ilen );
|
||||
sha256_update( (sha256_context *) ctx, input, ilen );
|
||||
}
|
||||
|
||||
void sha256_finish_wrap( void *ctx, unsigned char *output )
|
||||
static void sha256_finish_wrap( void *ctx, unsigned char *output )
|
||||
{
|
||||
sha2_finish( (sha2_context *) ctx, output );
|
||||
sha256_finish( (sha256_context *) ctx, output );
|
||||
}
|
||||
|
||||
void sha256_wrap( const unsigned char *input, size_t ilen,
|
||||
static void sha256_wrap( const unsigned char *input, size_t ilen,
|
||||
unsigned char *output )
|
||||
{
|
||||
sha2( input, ilen, output, 0 );
|
||||
sha256( input, ilen, output, 0 );
|
||||
}
|
||||
|
||||
int sha256_file_wrap( const char *path, unsigned char *output )
|
||||
static int sha256_file_wrap( const char *path, unsigned char *output )
|
||||
{
|
||||
#if defined(POLARSSL_FS_IO)
|
||||
return sha2_file( path, output, 0 );
|
||||
return sha256_file( path, output, 0 );
|
||||
#else
|
||||
((void) path);
|
||||
((void) output);
|
||||
@ -495,41 +622,46 @@ int sha256_file_wrap( const char *path, unsigned char *output )
|
||||
#endif
|
||||
}
|
||||
|
||||
void sha256_hmac_starts_wrap( void *ctx, const unsigned char *key, size_t keylen )
|
||||
static void sha256_hmac_starts_wrap( void *ctx, const unsigned char *key, size_t keylen )
|
||||
{
|
||||
sha2_hmac_starts( (sha2_context *) ctx, key, keylen, 0 );
|
||||
sha256_hmac_starts( (sha256_context *) ctx, key, keylen, 0 );
|
||||
}
|
||||
|
||||
void sha256_hmac_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
|
||||
static void sha256_hmac_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
|
||||
{
|
||||
sha2_hmac_update( (sha2_context *) ctx, input, ilen );
|
||||
sha256_hmac_update( (sha256_context *) ctx, input, ilen );
|
||||
}
|
||||
|
||||
void sha256_hmac_finish_wrap( void *ctx, unsigned char *output )
|
||||
static void sha256_hmac_finish_wrap( void *ctx, unsigned char *output )
|
||||
{
|
||||
sha2_hmac_finish( (sha2_context *) ctx, output );
|
||||
sha256_hmac_finish( (sha256_context *) ctx, output );
|
||||
}
|
||||
|
||||
void sha256_hmac_reset_wrap( void *ctx )
|
||||
static void sha256_hmac_reset_wrap( void *ctx )
|
||||
{
|
||||
sha2_hmac_reset( (sha2_context *) ctx );
|
||||
sha256_hmac_reset( (sha256_context *) ctx );
|
||||
}
|
||||
|
||||
void sha256_hmac_wrap( const unsigned char *key, size_t keylen,
|
||||
static void sha256_hmac_wrap( const unsigned char *key, size_t keylen,
|
||||
const unsigned char *input, size_t ilen,
|
||||
unsigned char *output )
|
||||
{
|
||||
sha2_hmac( key, keylen, input, ilen, output, 0 );
|
||||
sha256_hmac( key, keylen, input, ilen, output, 0 );
|
||||
}
|
||||
|
||||
void * sha256_ctx_alloc( void )
|
||||
static void * sha256_ctx_alloc( void )
|
||||
{
|
||||
return malloc( sizeof( sha2_context ) );
|
||||
return polarssl_malloc( sizeof( sha256_context ) );
|
||||
}
|
||||
|
||||
void sha256_ctx_free( void *ctx )
|
||||
static void sha256_ctx_free( void *ctx )
|
||||
{
|
||||
free( ctx );
|
||||
polarssl_free( ctx );
|
||||
}
|
||||
|
||||
static void sha256_process_wrap( void *ctx, const unsigned char *data )
|
||||
{
|
||||
sha256_process( (sha256_context *) ctx, data );
|
||||
}
|
||||
|
||||
const md_info_t sha256_info = {
|
||||
@ -548,37 +680,38 @@ const md_info_t sha256_info = {
|
||||
sha256_hmac_wrap,
|
||||
sha256_ctx_alloc,
|
||||
sha256_ctx_free,
|
||||
sha256_process_wrap,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(POLARSSL_SHA4_C)
|
||||
#if defined(POLARSSL_SHA512_C)
|
||||
|
||||
void sha384_starts_wrap( void *ctx )
|
||||
static void sha384_starts_wrap( void *ctx )
|
||||
{
|
||||
sha4_starts( (sha4_context *) ctx, 1 );
|
||||
sha512_starts( (sha512_context *) ctx, 1 );
|
||||
}
|
||||
|
||||
void sha384_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
|
||||
static void sha384_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
|
||||
{
|
||||
sha4_update( (sha4_context *) ctx, input, ilen );
|
||||
sha512_update( (sha512_context *) ctx, input, ilen );
|
||||
}
|
||||
|
||||
void sha384_finish_wrap( void *ctx, unsigned char *output )
|
||||
static void sha384_finish_wrap( void *ctx, unsigned char *output )
|
||||
{
|
||||
sha4_finish( (sha4_context *) ctx, output );
|
||||
sha512_finish( (sha512_context *) ctx, output );
|
||||
}
|
||||
|
||||
void sha384_wrap( const unsigned char *input, size_t ilen,
|
||||
static void sha384_wrap( const unsigned char *input, size_t ilen,
|
||||
unsigned char *output )
|
||||
{
|
||||
sha4( input, ilen, output, 1 );
|
||||
sha512( input, ilen, output, 1 );
|
||||
}
|
||||
|
||||
int sha384_file_wrap( const char *path, unsigned char *output )
|
||||
static int sha384_file_wrap( const char *path, unsigned char *output )
|
||||
{
|
||||
#if defined(POLARSSL_FS_IO)
|
||||
return sha4_file( path, output, 1 );
|
||||
return sha512_file( path, output, 1 );
|
||||
#else
|
||||
((void) path);
|
||||
((void) output);
|
||||
@ -586,41 +719,46 @@ int sha384_file_wrap( const char *path, unsigned char *output )
|
||||
#endif
|
||||
}
|
||||
|
||||
void sha384_hmac_starts_wrap( void *ctx, const unsigned char *key, size_t keylen )
|
||||
static void sha384_hmac_starts_wrap( void *ctx, const unsigned char *key, size_t keylen )
|
||||
{
|
||||
sha4_hmac_starts( (sha4_context *) ctx, key, keylen, 1 );
|
||||
sha512_hmac_starts( (sha512_context *) ctx, key, keylen, 1 );
|
||||
}
|
||||
|
||||
void sha384_hmac_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
|
||||
static void sha384_hmac_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
|
||||
{
|
||||
sha4_hmac_update( (sha4_context *) ctx, input, ilen );
|
||||
sha512_hmac_update( (sha512_context *) ctx, input, ilen );
|
||||
}
|
||||
|
||||
void sha384_hmac_finish_wrap( void *ctx, unsigned char *output )
|
||||
static void sha384_hmac_finish_wrap( void *ctx, unsigned char *output )
|
||||
{
|
||||
sha4_hmac_finish( (sha4_context *) ctx, output );
|
||||
sha512_hmac_finish( (sha512_context *) ctx, output );
|
||||
}
|
||||
|
||||
void sha384_hmac_reset_wrap( void *ctx )
|
||||
static void sha384_hmac_reset_wrap( void *ctx )
|
||||
{
|
||||
sha4_hmac_reset( (sha4_context *) ctx );
|
||||
sha512_hmac_reset( (sha512_context *) ctx );
|
||||
}
|
||||
|
||||
void sha384_hmac_wrap( const unsigned char *key, size_t keylen,
|
||||
static void sha384_hmac_wrap( const unsigned char *key, size_t keylen,
|
||||
const unsigned char *input, size_t ilen,
|
||||
unsigned char *output )
|
||||
{
|
||||
sha4_hmac( key, keylen, input, ilen, output, 1 );
|
||||
sha512_hmac( key, keylen, input, ilen, output, 1 );
|
||||
}
|
||||
|
||||
void * sha384_ctx_alloc( void )
|
||||
static void * sha384_ctx_alloc( void )
|
||||
{
|
||||
return malloc( sizeof( sha4_context ) );
|
||||
return polarssl_malloc( sizeof( sha512_context ) );
|
||||
}
|
||||
|
||||
void sha384_ctx_free( void *ctx )
|
||||
static void sha384_ctx_free( void *ctx )
|
||||
{
|
||||
free( ctx );
|
||||
polarssl_free( ctx );
|
||||
}
|
||||
|
||||
static void sha384_process_wrap( void *ctx, const unsigned char *data )
|
||||
{
|
||||
sha512_process( (sha512_context *) ctx, data );
|
||||
}
|
||||
|
||||
const md_info_t sha384_info = {
|
||||
@ -639,33 +777,34 @@ const md_info_t sha384_info = {
|
||||
sha384_hmac_wrap,
|
||||
sha384_ctx_alloc,
|
||||
sha384_ctx_free,
|
||||
sha384_process_wrap,
|
||||
};
|
||||
|
||||
void sha512_starts_wrap( void *ctx )
|
||||
static void sha512_starts_wrap( void *ctx )
|
||||
{
|
||||
sha4_starts( (sha4_context *) ctx, 0 );
|
||||
sha512_starts( (sha512_context *) ctx, 0 );
|
||||
}
|
||||
|
||||
void sha512_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
|
||||
static void sha512_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
|
||||
{
|
||||
sha4_update( (sha4_context *) ctx, input, ilen );
|
||||
sha512_update( (sha512_context *) ctx, input, ilen );
|
||||
}
|
||||
|
||||
void sha512_finish_wrap( void *ctx, unsigned char *output )
|
||||
static void sha512_finish_wrap( void *ctx, unsigned char *output )
|
||||
{
|
||||
sha4_finish( (sha4_context *) ctx, output );
|
||||
sha512_finish( (sha512_context *) ctx, output );
|
||||
}
|
||||
|
||||
void sha512_wrap( const unsigned char *input, size_t ilen,
|
||||
static void sha512_wrap( const unsigned char *input, size_t ilen,
|
||||
unsigned char *output )
|
||||
{
|
||||
sha4( input, ilen, output, 0 );
|
||||
sha512( input, ilen, output, 0 );
|
||||
}
|
||||
|
||||
int sha512_file_wrap( const char *path, unsigned char *output )
|
||||
static int sha512_file_wrap( const char *path, unsigned char *output )
|
||||
{
|
||||
#if defined(POLARSSL_FS_IO)
|
||||
return sha4_file( path, output, 0 );
|
||||
return sha512_file( path, output, 0 );
|
||||
#else
|
||||
((void) path);
|
||||
((void) output);
|
||||
@ -673,41 +812,46 @@ int sha512_file_wrap( const char *path, unsigned char *output )
|
||||
#endif
|
||||
}
|
||||
|
||||
void sha512_hmac_starts_wrap( void *ctx, const unsigned char *key, size_t keylen )
|
||||
static void sha512_hmac_starts_wrap( void *ctx, const unsigned char *key, size_t keylen )
|
||||
{
|
||||
sha4_hmac_starts( (sha4_context *) ctx, key, keylen, 0 );
|
||||
sha512_hmac_starts( (sha512_context *) ctx, key, keylen, 0 );
|
||||
}
|
||||
|
||||
void sha512_hmac_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
|
||||
static void sha512_hmac_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
|
||||
{
|
||||
sha4_hmac_update( (sha4_context *) ctx, input, ilen );
|
||||
sha512_hmac_update( (sha512_context *) ctx, input, ilen );
|
||||
}
|
||||
|
||||
void sha512_hmac_finish_wrap( void *ctx, unsigned char *output )
|
||||
static void sha512_hmac_finish_wrap( void *ctx, unsigned char *output )
|
||||
{
|
||||
sha4_hmac_finish( (sha4_context *) ctx, output );
|
||||
sha512_hmac_finish( (sha512_context *) ctx, output );
|
||||
}
|
||||
|
||||
void sha512_hmac_reset_wrap( void *ctx )
|
||||
static void sha512_hmac_reset_wrap( void *ctx )
|
||||
{
|
||||
sha4_hmac_reset( (sha4_context *) ctx );
|
||||
sha512_hmac_reset( (sha512_context *) ctx );
|
||||
}
|
||||
|
||||
void sha512_hmac_wrap( const unsigned char *key, size_t keylen,
|
||||
static void sha512_hmac_wrap( const unsigned char *key, size_t keylen,
|
||||
const unsigned char *input, size_t ilen,
|
||||
unsigned char *output )
|
||||
{
|
||||
sha4_hmac( key, keylen, input, ilen, output, 0 );
|
||||
sha512_hmac( key, keylen, input, ilen, output, 0 );
|
||||
}
|
||||
|
||||
void * sha512_ctx_alloc( void )
|
||||
static void * sha512_ctx_alloc( void )
|
||||
{
|
||||
return malloc( sizeof( sha4_context ) );
|
||||
return polarssl_malloc( sizeof( sha512_context ) );
|
||||
}
|
||||
|
||||
void sha512_ctx_free( void *ctx )
|
||||
static void sha512_ctx_free( void *ctx )
|
||||
{
|
||||
free( ctx );
|
||||
polarssl_free( ctx );
|
||||
}
|
||||
|
||||
static void sha512_process_wrap( void *ctx, const unsigned char *data )
|
||||
{
|
||||
sha512_process( (sha512_context *) ctx, data );
|
||||
}
|
||||
|
||||
const md_info_t sha512_info = {
|
||||
@ -726,6 +870,7 @@ const md_info_t sha512_info = {
|
||||
sha512_hmac_wrap,
|
||||
sha512_ctx_alloc,
|
||||
sha512_ctx_free,
|
||||
sha512_process_wrap,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user