mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
changing {} style to match majority of previous style
This commit is contained in:
parent
da6cdf014b
commit
961d929f4d
320 changed files with 5502 additions and 10485 deletions
|
@ -89,13 +89,11 @@ static const int supported_digests[] = {
|
|||
MBEDTLS_MD_NONE
|
||||
};
|
||||
|
||||
const int *mbedtls_md_list(void)
|
||||
{
|
||||
const int *mbedtls_md_list(void) {
|
||||
return (supported_digests);
|
||||
}
|
||||
|
||||
const mbedtls_md_info_t *mbedtls_md_info_from_string(const char *md_name)
|
||||
{
|
||||
const mbedtls_md_info_t *mbedtls_md_info_from_string(const char *md_name) {
|
||||
if (NULL == md_name)
|
||||
return (NULL);
|
||||
|
||||
|
@ -135,8 +133,7 @@ const mbedtls_md_info_t *mbedtls_md_info_from_string(const char *md_name)
|
|||
return (NULL);
|
||||
}
|
||||
|
||||
const mbedtls_md_info_t *mbedtls_md_info_from_type(mbedtls_md_type_t md_type)
|
||||
{
|
||||
const mbedtls_md_info_t *mbedtls_md_info_from_type(mbedtls_md_type_t md_type) {
|
||||
switch (md_type) {
|
||||
#if defined(MBEDTLS_MD2_C)
|
||||
case MBEDTLS_MD_MD2:
|
||||
|
@ -175,13 +172,11 @@ const mbedtls_md_info_t *mbedtls_md_info_from_type(mbedtls_md_type_t md_type)
|
|||
}
|
||||
}
|
||||
|
||||
void mbedtls_md_init(mbedtls_md_context_t *ctx)
|
||||
{
|
||||
void mbedtls_md_init(mbedtls_md_context_t *ctx) {
|
||||
memset(ctx, 0, sizeof(mbedtls_md_context_t));
|
||||
}
|
||||
|
||||
void mbedtls_md_free(mbedtls_md_context_t *ctx)
|
||||
{
|
||||
void mbedtls_md_free(mbedtls_md_context_t *ctx) {
|
||||
if (ctx == NULL || ctx->md_info == NULL)
|
||||
return;
|
||||
|
||||
|
@ -198,11 +193,10 @@ void mbedtls_md_free(mbedtls_md_context_t *ctx)
|
|||
}
|
||||
|
||||
int mbedtls_md_clone(mbedtls_md_context_t *dst,
|
||||
const mbedtls_md_context_t *src)
|
||||
{
|
||||
const mbedtls_md_context_t *src) {
|
||||
if (dst == NULL || dst->md_info == NULL ||
|
||||
src == NULL || src->md_info == NULL ||
|
||||
dst->md_info != src->md_info) {
|
||||
src == NULL || src->md_info == NULL ||
|
||||
dst->md_info != src->md_info) {
|
||||
return (MBEDTLS_ERR_MD_BAD_INPUT_DATA);
|
||||
}
|
||||
|
||||
|
@ -212,14 +206,12 @@ int mbedtls_md_clone(mbedtls_md_context_t *dst,
|
|||
}
|
||||
|
||||
#if ! defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
int mbedtls_md_init_ctx(mbedtls_md_context_t *ctx, const mbedtls_md_info_t *md_info)
|
||||
{
|
||||
int mbedtls_md_init_ctx(mbedtls_md_context_t *ctx, const mbedtls_md_info_t *md_info) {
|
||||
return mbedtls_md_setup(ctx, md_info, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
int mbedtls_md_setup(mbedtls_md_context_t *ctx, const mbedtls_md_info_t *md_info, int hmac)
|
||||
{
|
||||
int mbedtls_md_setup(mbedtls_md_context_t *ctx, const mbedtls_md_info_t *md_info, int hmac) {
|
||||
if (md_info == NULL || ctx == NULL)
|
||||
return (MBEDTLS_ERR_MD_BAD_INPUT_DATA);
|
||||
|
||||
|
@ -239,24 +231,21 @@ int mbedtls_md_setup(mbedtls_md_context_t *ctx, const mbedtls_md_info_t *md_info
|
|||
return (0);
|
||||
}
|
||||
|
||||
int mbedtls_md_starts(mbedtls_md_context_t *ctx)
|
||||
{
|
||||
int mbedtls_md_starts(mbedtls_md_context_t *ctx) {
|
||||
if (ctx == NULL || ctx->md_info == NULL)
|
||||
return (MBEDTLS_ERR_MD_BAD_INPUT_DATA);
|
||||
|
||||
return (ctx->md_info->starts_func(ctx->md_ctx));
|
||||
}
|
||||
|
||||
int mbedtls_md_update(mbedtls_md_context_t *ctx, const unsigned char *input, size_t ilen)
|
||||
{
|
||||
int mbedtls_md_update(mbedtls_md_context_t *ctx, const unsigned char *input, size_t ilen) {
|
||||
if (ctx == NULL || ctx->md_info == NULL)
|
||||
return (MBEDTLS_ERR_MD_BAD_INPUT_DATA);
|
||||
|
||||
return (ctx->md_info->update_func(ctx->md_ctx, input, ilen));
|
||||
}
|
||||
|
||||
int mbedtls_md_finish(mbedtls_md_context_t *ctx, unsigned char *output)
|
||||
{
|
||||
int mbedtls_md_finish(mbedtls_md_context_t *ctx, unsigned char *output) {
|
||||
if (ctx == NULL || ctx->md_info == NULL)
|
||||
return (MBEDTLS_ERR_MD_BAD_INPUT_DATA);
|
||||
|
||||
|
@ -264,8 +253,7 @@ int mbedtls_md_finish(mbedtls_md_context_t *ctx, unsigned char *output)
|
|||
}
|
||||
|
||||
int mbedtls_md(const mbedtls_md_info_t *md_info, const unsigned char *input, size_t ilen,
|
||||
unsigned char *output)
|
||||
{
|
||||
unsigned char *output) {
|
||||
if (md_info == NULL)
|
||||
return (MBEDTLS_ERR_MD_BAD_INPUT_DATA);
|
||||
|
||||
|
@ -273,8 +261,7 @@ int mbedtls_md(const mbedtls_md_info_t *md_info, const unsigned char *input, siz
|
|||
}
|
||||
|
||||
#if defined(MBEDTLS_FS_IO)
|
||||
int mbedtls_md_file(const mbedtls_md_info_t *md_info, const char *path, unsigned char *output)
|
||||
{
|
||||
int mbedtls_md_file(const mbedtls_md_info_t *md_info, const char *path, unsigned char *output) {
|
||||
int ret;
|
||||
FILE *f;
|
||||
size_t n;
|
||||
|
@ -313,8 +300,7 @@ cleanup:
|
|||
}
|
||||
#endif /* MBEDTLS_FS_IO */
|
||||
|
||||
int mbedtls_md_hmac_starts(mbedtls_md_context_t *ctx, const unsigned char *key, size_t keylen)
|
||||
{
|
||||
int mbedtls_md_hmac_starts(mbedtls_md_context_t *ctx, const unsigned char *key, size_t keylen) {
|
||||
int ret;
|
||||
unsigned char sum[MBEDTLS_MD_MAX_SIZE];
|
||||
unsigned char *ipad, *opad;
|
||||
|
@ -358,16 +344,14 @@ cleanup:
|
|||
return (ret);
|
||||
}
|
||||
|
||||
int mbedtls_md_hmac_update(mbedtls_md_context_t *ctx, const unsigned char *input, size_t ilen)
|
||||
{
|
||||
int mbedtls_md_hmac_update(mbedtls_md_context_t *ctx, const unsigned char *input, size_t ilen) {
|
||||
if (ctx == NULL || ctx->md_info == NULL || ctx->hmac_ctx == NULL)
|
||||
return (MBEDTLS_ERR_MD_BAD_INPUT_DATA);
|
||||
|
||||
return (ctx->md_info->update_func(ctx->md_ctx, input, ilen));
|
||||
}
|
||||
|
||||
int mbedtls_md_hmac_finish(mbedtls_md_context_t *ctx, unsigned char *output)
|
||||
{
|
||||
int mbedtls_md_hmac_finish(mbedtls_md_context_t *ctx, unsigned char *output) {
|
||||
int ret;
|
||||
unsigned char tmp[MBEDTLS_MD_MAX_SIZE];
|
||||
unsigned char *opad;
|
||||
|
@ -390,8 +374,7 @@ int mbedtls_md_hmac_finish(mbedtls_md_context_t *ctx, unsigned char *output)
|
|||
return (ctx->md_info->finish_func(ctx->md_ctx, output));
|
||||
}
|
||||
|
||||
int mbedtls_md_hmac_reset(mbedtls_md_context_t *ctx)
|
||||
{
|
||||
int mbedtls_md_hmac_reset(mbedtls_md_context_t *ctx) {
|
||||
int ret;
|
||||
unsigned char *ipad;
|
||||
|
||||
|
@ -409,8 +392,7 @@ int mbedtls_md_hmac_reset(mbedtls_md_context_t *ctx)
|
|||
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)
|
||||
{
|
||||
unsigned char *output) {
|
||||
mbedtls_md_context_t ctx;
|
||||
int ret;
|
||||
|
||||
|
@ -435,32 +417,28 @@ cleanup:
|
|||
return (ret);
|
||||
}
|
||||
|
||||
int mbedtls_md_process(mbedtls_md_context_t *ctx, const unsigned char *data)
|
||||
{
|
||||
int mbedtls_md_process(mbedtls_md_context_t *ctx, const unsigned char *data) {
|
||||
if (ctx == NULL || ctx->md_info == NULL)
|
||||
return (MBEDTLS_ERR_MD_BAD_INPUT_DATA);
|
||||
|
||||
return (ctx->md_info->process_func(ctx->md_ctx, data));
|
||||
}
|
||||
|
||||
unsigned char mbedtls_md_get_size(const mbedtls_md_info_t *md_info)
|
||||
{
|
||||
unsigned char mbedtls_md_get_size(const mbedtls_md_info_t *md_info) {
|
||||
if (md_info == NULL)
|
||||
return (0);
|
||||
|
||||
return md_info->size;
|
||||
}
|
||||
|
||||
mbedtls_md_type_t mbedtls_md_get_type(const mbedtls_md_info_t *md_info)
|
||||
{
|
||||
mbedtls_md_type_t mbedtls_md_get_type(const mbedtls_md_info_t *md_info) {
|
||||
if (md_info == NULL)
|
||||
return (MBEDTLS_MD_NONE);
|
||||
|
||||
return md_info->type;
|
||||
}
|
||||
|
||||
const char *mbedtls_md_get_name(const mbedtls_md_info_t *md_info)
|
||||
{
|
||||
const char *mbedtls_md_get_name(const mbedtls_md_info_t *md_info) {
|
||||
if (md_info == NULL)
|
||||
return (NULL);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue