Loading...
Searching...
No Matches
sha1.c File Reference
`#include <stdbool.h>`
`#include <stdint.h>`
`#include <stdio.h>`
`#include <string.h>`
`#include "decls.h"`
`#include "sha1.h"`

Go to the source code of this file.

## Macros

#define | AARU_LOCAL static
#define | ROTL32(v, n)
#define | F0(b, c, d)
#define | F1(b, c, d)
#define | F2(b, c, d)
#define | F3(b, c, d)

## Functions

void | aaruf_sha1_init (sha1_ctx *ctx)
static void | sha1_transform (uint32_t state[5], const uint8_t block[64])
void | aaruf_sha1_update (sha1_ctx *ctx, const void *data_ptr, unsigned long len)
void | aaruf_sha1_final (sha1_ctx *ctx, unsigned char *digest)
void | aaruf_sha1_buffer (const void *data, unsigned long size, unsigned char *result)

## Macro Definition Documentation

## AARU_LOCAL

#define AARU_LOCAL static

Definition at line 18 of file sha1.c.

## F0

#define F0 | ( |  | b,
|  |  | c,
|  |  | d )

Value:
(((b) & (c)) | (~(b) & (d)))

Definition at line 29 of file sha1.c.

Referenced by sha1_transform().

## F1

#define F1 | ( |  | b,
|  |  | c,
|  |  | d )

Value:
((b) ^ (c) ^ (d))

Definition at line 30 of file sha1.c.

Referenced by sha1_transform().

## F2

#define F2 | ( |  | b,
|  |  | c,
|  |  | d )

Value:
(((b) & (c)) | ((b) & (d)) | ((c) & (d)))

Definition at line 31 of file sha1.c.

Referenced by sha1_transform().

## F3

#define F3 | ( |  | b,
|  |  | c,
|  |  | d )

Value:
((b) ^ (c) ^ (d))

Definition at line 32 of file sha1.c.

Referenced by sha1_transform().

## ROTL32

#define ROTL32 | ( |  | v,
|  |  | n )

Value:
(((v) << (n)) | ((v) >> (32 - (n))))

Definition at line 25 of file sha1.c.

Referenced by sha1_transform().

## Function Documentation

## aaruf_sha1_buffer()

void aaruf_sha1_buffer | ( | const void * | data,
|  | unsigned long | size,
|  | unsigned char * | result )

Definition at line 155 of file sha1.c.

References AARU_CALL, AARU_EXPORT, aaruf_sha1_final(), aaruf_sha1_init(), and aaruf_sha1_update().

## aaruf_sha1_final()

void aaruf_sha1_final | ( | sha1_ctx * | ctx,
|  | unsigned char * | digest )

Definition at line 124 of file sha1.c.

References AARU_CALL, AARU_EXPORT, aaruf_sha1_update(), sha1_ctx::buffer, sha1_ctx::count, and sha1_ctx::state.

Referenced by aaruf_sha1_buffer(), and write_checksum_block().

## aaruf_sha1_init()

void aaruf_sha1_init | ( | sha1_ctx * | ctx | ) |

Definition at line 34 of file sha1.c.

References AARU_CALL, AARU_EXPORT, sha1_ctx::buffer, sha1_ctx::count, and sha1_ctx::state.

Referenced by aaruf_create(), and aaruf_sha1_buffer().

## aaruf_sha1_update()

void aaruf_sha1_update | ( | sha1_ctx * | ctx,
|  | const void * | data_ptr,
|  | unsigned long | len )

Definition at line 89 of file sha1.c.

References AARU_CALL, AARU_EXPORT, sha1_ctx::buffer, sha1_ctx::count, sha1_transform(), and sha1_ctx::state.

Referenced by aaruf_sha1_buffer(), aaruf_sha1_final(), aaruf_write_sector(), and aaruf_write_sector_long().

## sha1_transform()

void sha1_transform | ( | uint32_t | state[5],
|  | const uint8_t | block[64] )

static

Definition at line 45 of file sha1.c.

References AARU_LOCAL, F0, F1, F2, F3, and ROTL32.

Referenced by aaruf_sha1_update().