60 return ( ( v->
b & v->
c ) | ( (~v->
b) & v->
d ) );
70 return ( v->
b ^ v->
c ^ v->
d );
80 return ( ( v->
b & v->
c ) | ( v->
b & v->
d ) | ( v->
c & v->
d ) );
155 DBGC ( context,
"SHA1 digesting:\n" );
164 for ( i = 0 ; i < (
sizeof (
u.ddd.dword ) /
165 sizeof (
u.ddd.dword[0] ) ) ; i++ ) {
171 for ( i = 16 ; i < 80 ; i++ )
172 w[i] =
rol32 ( ( w[i-3] ^ w[i-8] ^ w[i-14] ^ w[i-16] ), 1 );
175 for ( i = 0 ; i < 80 ; i++ ) {
179 temp = (
rol32 ( *a, 5 ) +
f + *e +
k + w[i] );
185 DBGC2 ( context,
"%2d : %08x %08x %08x %08x %08x\n",
186 i, *a, *b, *
c, *d, *e );
190 for ( i = 0 ; i < 5 ; i++ ) {
193 u.ddd.dd.digest.h[i] );
196 DBGC ( context,
"SHA1 digested:\n" );
220 if ( ( context->
len % sizeof ( context->
ddd.
dd.
data ) ) == 0 )
244 }
while ( ( context->
len % sizeof ( context->
ddd.
dd.
data ) ) !=
static uint32_t sha1_f_40_59(struct sha1_variables *v)
f(a,b,c,d) for steps 40 to 59
static __always_inline void off_t int c
static u32 rol32(u32 v, int bits)
Rotate 32-bit value left.
union sha1_block data
Accumulated data.
unsigned long long uint64_t
#define offsetof(type, field)
Get offset of a field within a structure.
struct golan_eq_context ctx
uint32_t dword[sizeof(struct sha1_digest_data)/sizeof(uint32_t)]
Raw dwords.
static void sha1_init(void *ctx)
Initialise SHA-1 algorithm.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
struct sha1_digest_data dd
Digest and data block.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
uint8_t byte[64]
Raw bytes.
#define build_assert(condition)
Assert a condition at build time (after dead code elimination)
uint32_t(* f)(struct sha1_variables *v)
Calculate f(a,b,c,d)
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
uint32_t h[5]
Hash output.
static const uint32_t k[64]
MD5 constants.
SHA-1 digest and data block.
static void sha1_digest(struct sha1_context *context)
Calculate SHA-1 digest of accumulated data.
#define cpu_to_be32(value)
#define be32_to_cpus(ptr)
static void sha1_final(void *ctx, void *out)
Generate SHA-1 digest.
size_t len
Amount of accumulated data.
static void sha1_update(void *ctx, const void *data, size_t len)
Accumulate data with SHA-1 algorithm.
const char * name
Algorithm name.
union sha1_digest_data_dwords ddd
Digest and accumulated data.
static uint32_t sha1_f_0_19(struct sha1_variables *v)
f(a,b,c,d) for steps 0 to 19
void step(void)
Single-step a single process.
static uint32_t sha1_f_20_39_60_79(struct sha1_variables *v)
f(a,b,c,d) for steps 20 to 39 and 60 to 79
A message digest algorithm.
#define cpu_to_be64(value)
uint8_t data[48]
Additional event data.
uint16_t offset
Offset to command line.
typeof(acpi_finder=acpi_find)
ACPI table finder.
uint32_t digestsize
Digest size (i.e.
struct sha1_digest digest
Digest of data already processed.
static struct sha1_step sha1_steps[4]
SHA-1 steps.
struct digest_algorithm sha1_algorithm
SHA-1 algorithm.