refactor: remove unused function
This commit is contained in:
parent
65690e7f43
commit
0fd29467a3
1 changed files with 0 additions and 50 deletions
|
@ -214,56 +214,6 @@ static void sha2_256_finalize(SHA2Context *context, uint8_t pad_byte) {
|
||||||
context->computed = true;
|
context->computed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* SHA256FinalBits
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* This function will add in any final bits of the message.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* context: [in/out]
|
|
||||||
* The SHA context to update.
|
|
||||||
* message_bits: [in]
|
|
||||||
* The final bits of the message, in the upper portion of the
|
|
||||||
* byte. (Use 0b###00000 instead of 0b00000### to input the
|
|
||||||
* three bits ###.)
|
|
||||||
* length: [in]
|
|
||||||
* The number of bits in message_bits, between 1 and 7.
|
|
||||||
*
|
|
||||||
* Returns:
|
|
||||||
* sha Error Code.
|
|
||||||
*/
|
|
||||||
static SHA2Result sha2_256_final_bits(SHA2Context *context,
|
|
||||||
uint8_t message_bits, size_t len) {
|
|
||||||
static uint8_t masks[8] = {
|
|
||||||
/* 0 0b00000000 */ 0x00, /* 1 0b10000000 */ 0x80,
|
|
||||||
/* 2 0b11000000 */ 0xC0, /* 3 0b11100000 */ 0xE0,
|
|
||||||
/* 4 0b11110000 */ 0xF0, /* 5 0b11111000 */ 0xF8,
|
|
||||||
/* 6 0b11111100 */ 0xFC, /* 7 0b11111110 */ 0xFE};
|
|
||||||
static uint8_t markbit[8] = {
|
|
||||||
/* 0 0b10000000 */ 0x80, /* 1 0b01000000 */ 0x40,
|
|
||||||
/* 2 0b00100000 */ 0x20, /* 3 0b00010000 */ 0x10,
|
|
||||||
/* 4 0b00001000 */ 0x08, /* 5 0b00000100 */ 0x04,
|
|
||||||
/* 6 0b00000010 */ 0x02, /* 7 0b00000001 */ 0x01};
|
|
||||||
|
|
||||||
if (!context)
|
|
||||||
return shaNull;
|
|
||||||
if (!len)
|
|
||||||
return shaSuccess;
|
|
||||||
if (context->corrupted)
|
|
||||||
return context->corrupted;
|
|
||||||
if (context->computed)
|
|
||||||
return context->corrupted = shaStateError;
|
|
||||||
if (len >= 8)
|
|
||||||
return context->corrupted = shaBadArg;
|
|
||||||
|
|
||||||
sha2_256_add_length(context, len);
|
|
||||||
sha2_256_finalize(context,
|
|
||||||
(uint8_t)((message_bits & masks[len]) | markbit[len]));
|
|
||||||
|
|
||||||
return context->corrupted;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* sha2_reset
|
* sha2_reset
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue