libosmogsm 1.13.1.1-afb4 Osmocom GSM library

Macros | Typedefs | Functions
sha1-internal.c File Reference
`#include "common.h"`
`#include "sha1.h"`
`#include "sha1_i.h"`
`#include "crypto.h"`

## Macros
#define | SHA1HANDSOFF
#define | rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
#define | blk0(i)
#define | blk(i)
#define | R0(v, w, x, y, z, i)
#define | R1(v, w, x, y, z, i)
#define | R2(v, w, x, y, z, i) z += (w ^ x ^ y) + blk(i) + 0x6ED9EBA1 + rol(v, 5); w = rol(w, 30);
#define | R3(v, w, x, y, z, i)
#define | R4(v, w, x, y, z, i)

## Typedefs
typedef struct SHA1Context | SHA1_CTX

## Functions
void | SHA1Transform (u32 state[5], const unsigned char buffer[64])
int | sha1_vector (size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
| sha1_vector - SHA-1 hash for data vector @num_elem: Number of elements in the data vector @addr: Pointers to the data areas @len: Lengths of the data blocks @mac: Buffer for the hash Returns: 0 on success, -1 of failure More...
void | SHA1Init (SHA1_CTX *context)
void | SHA1Update (SHA1_CTX *context, const void *_data, u32 len)
void | SHA1Final (unsigned char digest[20], SHA1_CTX *context)

## Macro Definition Documentation

## ◆ blk

#define blk | ( |  | i | ) |

Value:
(block->l[i & 15] = rol(block->l[(i + 13) & 15] ^ \
block->l[(i + 8) & 15] ^ block->l[(i + 2) & 15] ^ block->l[i & 15], 1))
rol
#define rol(value, bits)
Definition: sha1-internal.c:130

## ◆ blk0

#define blk0 | ( |  | i | ) |

Value:
(block->l[i] = (rol(block->l[i], 24) & 0xFF00FF00) | \
(rol(block->l[i], 8) & 0x00FF00FF))

## ◆ R0

#define R0 | ( |  | v,
|  |  | w,
|  |  | x,
|  |  | y,
|  |  | z,
|  |  | i
| ) |  |

Value:
z += ((w & (x ^ y)) ^ y) + blk0(i) + 0x5A827999 + rol(v, 5); \
w = rol(w, 30);
x
uint32_t x
blk0
#define blk0(i)
Definition: sha1-internal.c:135

## ◆ R1

#define R1 | ( |  | v,
|  |  | w,
|  |  | x,
|  |  | y,
|  |  | z,
|  |  | i
| ) |  |

Value:
z += ((w & (x ^ y)) ^ y) + blk(i) + 0x5A827999 + rol(v, 5); \
w = rol(w, 30);
blk
#define blk(i)
Definition: sha1-internal.c:140

## ◆ R2

#define R2 | ( |  | v,
|  |  | w,
|  |  | x,
|  |  | y,
|  |  | z,
|  |  | i
| ) |  | z += (w ^ x ^ y) + blk(i) + 0x6ED9EBA1 + rol(v, 5); w = rol(w, 30);

## ◆ R3

#define R3 | ( |  | v,
|  |  | w,
|  |  | x,
|  |  | y,
|  |  | z,
|  |  | i
| ) |  |

Value:
z += (((w | x) & y) | (w & x)) + blk(i) + 0x8F1BBCDC + rol(v, 5); \
w = rol(w, 30);

## ◆ R4

#define R4 | ( |  | v,
|  |  | w,
|  |  | x,
|  |  | y,
|  |  | z,
|  |  | i
| ) |  |

Value:
z += (w ^ x ^ y) + blk(i) + 0xCA62C1D6 + rol(v, 5); \
w=rol(w, 30);

## ◆ rol

#define rol | ( |  | value,
|  |  | bits
| ) |  | (((value) << (bits)) | ((value) >> (32 - (bits))))

## ◆ SHA1HANDSOFF

#define SHA1HANDSOFF

## Typedef Documentation

## ◆ SHA1_CTX

typedef struct SHA1Context SHA1_CTX

## Function Documentation

## ◆ sha1_vector()

int sha1_vector | ( | size_t | num_elem,
|  | const u8 * | addr[],
|  | const size_t * | len,
|  | u8 * | mac
| ) |  |

sha1_vector - SHA-1 hash for data vector @num_elem: Number of elements in the data vector @addr: Pointers to the data areas @len: Lengths of the data blocks @mac: Buffer for the hash Returns: 0 on success, -1 of failure

sha1_vector - SHA-1 hash for data vector @num_elem: Number of elements in the data vector @addr: Pointers to the data areas @len: Lengths of the data blocks @mac: Buffer for the hash Returns: 0 on success, -1 on failure

References len, SHA1Final(), SHA1Init(), and SHA1Update().

Referenced by hmac_sha1_vector().

## ◆ SHA1Final()

void SHA1Final | ( | unsigned char | digest[20],
|  | SHA1_CTX * | context
| ) |  |

References SHA1Context::buffer, SHA1Context::count, os_memset, SHA1Update(), and SHA1Context::state.

Referenced by sha1_vector().

## ◆ SHA1Init()

void SHA1Init | ( | SHA1_CTX * | context | ) |

References SHA1Context::count, and SHA1Context::state.

Referenced by sha1_vector().

## ◆ SHA1Transform()

void SHA1Transform | ( | u32 | state[5],
|  | const unsigned char | buffer[64]
| ) |  |

References c, l, os_memcpy, os_memset, R0, R1, R2, R3, and R4.

Referenced by SHA1Update().

## ◆ SHA1Update()

void SHA1Update | ( | SHA1_CTX * | context,
|  | const void * | _data,
|  | u32 | len
| ) |  |

References SHA1Context::buffer, SHA1Context::count, data, len, os_memcpy, SHA1Transform(), and SHA1Context::state.

Referenced by sha1_vector(), and SHA1Final().