Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
3ced458
OcCryptoLib: Add Streebog support
Aug 2, 2022
67271a3
streebog support fixes v1
Aug 9, 2022
b271206
streebog support fixes v2
Aug 9, 2022
b32abbb
streebog support fixes v3
Aug 9, 2022
c227f20
streebog support fixes v4
Aug 9, 2022
c71eae4
streebog support fixes v5
Aug 9, 2022
9b71475
streebog support fixes v6
Aug 9, 2022
af94c94
streebog tests fixes v1
Aug 24, 2022
6de11ce
uncrustify fixes
Aug 24, 2022
952405c
uncrustify fixes v2
Aug 24, 2022
78b2365
uncrustify fixes v3
Aug 24, 2022
99dee8d
uncrustify fixes v4
Aug 24, 2022
06fb3f0
test fixes v1
Aug 24, 2022
f0012e2
test fixes v2
Aug 24, 2022
06e75d7
build fix
Aug 26, 2022
4f822a5
test fix
Aug 26, 2022
06e11b9
test fix v2
Aug 26, 2022
20954e5
OcCryptoLib fix
Aug 27, 2022
6d318de
CodeStyle fixes v1
Aug 29, 2022
7d9491c
fix array size
PMheart Sep 30, 2023
80abeda
fix CompareMem codestyle
PMheart Sep 30, 2023
4d6ab89
fix `STREEBOG_CONTEXT_` name
PMheart Sep 30, 2023
8a0e0ae
define `UINT512` on a UINT64 array with 8 items
PMheart Sep 30, 2023
59ae16d
fix prototype param order
PMheart Oct 1, 2023
42629d7
fix tool build
PMheart Oct 1, 2023
6b4b606
temporarily revert Streebog len to UINT32
PMheart Oct 1, 2023
76fd7bd
Merge remote-tracking branch 'upstream/master' into ilikesn0w-strbg-2…
ilikesn0w Sep 18, 2026
66a8fb8
Use UINTN for indices
ilikesn0w Sep 18, 2026
f5d308c
Use STREEBOG512_DIGEST_SIZE / 8 instead of 64
ilikesn0w Sep 18, 2026
b5090a7
Introduce STREEBOG_LITTLE_ENDIAN, STREEBOG_BIG_ENDIAN, STREEBOG_QWORD…
ilikesn0w Sep 18, 2026
c5f9dff
Add IN\OUT specifiers
ilikesn0w Sep 18, 2026
8099e87
Rename i to Index
ilikesn0w Sep 18, 2026
a1c75f2
Use STREEBOG256_DIGEST_SIZE instead of 256 and STREEBOG512_DIGEST_SIZ…
ilikesn0w Sep 18, 2026
98246f4
Use PascalCase codestyle
ilikesn0w Sep 18, 2026
18a357e
Switch from UINT32 to UINTN in Length
ilikesn0w Oct 24, 2026
ef59786
Drop BE
ilikesn0w Nov 30, 2026
a608b57
Rename _DataI to _DataIndex
ilikesn0w Nov 30, 2026
1c36968
Drop Uint512uCpy
ilikesn0w Nov 30, 2026
0aee42c
Add M3 and M4 tests
ilikesn0w Nov 30, 2026
41b282b
Get rid of HASHSIZE, define constants in bytes
ilikesn0w Nov 30, 2026
4b73bf3
Get rid of MasCpy
ilikesn0w Nov 30, 2026
0bb01ee
sizof -> sizeof
ilikesn0w Nov 30, 2026
3651d47
Move DigestSize check out of the loop
ilikesn0w Nov 30, 2026
50cd038
Get rid of UINT512
ilikesn0w Dec 1, 2026
8f6eeb2
Get rid of GOST34112012Cleanup
ilikesn0w Dec 1, 2026
19b7e1d
> 0, STREEBOG*_DIGEST_SIZE
ilikesn0w Dec 1, 2026
719774f
CopyMem
ilikesn0w Dec 1, 2026
5d0c0a2
Credit @PMheart
ilikesn0w Dec 1, 2026
e2a84be
Pad ZeroMem, GOST34112012Update CopyMem
ilikesn0w Dec 1, 2026
f6f7a53
STATIC tests
ilikesn0w Dec 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 79 additions & 14 deletions Include/Acidanthera/Library/OcCryptoLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,30 +30,35 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
// Set supported hashes to all by default.
//
#ifndef CONFIG_HAS_SUPPORTED_HASHES
#define OC_CRYPTO_SUPPORTS_SHA256 1
#define OC_CRYPTO_SUPPORTS_SHA384 1
#define OC_CRYPTO_SUPPORTS_SHA512 1
#define OC_CRYPTO_SUPPORTS_SHA1 1
#define OC_CRYPTO_SUPPORTS_MD5 1
#define OC_CRYPTO_SUPPORTS_SHA256 1
#define OC_CRYPTO_SUPPORTS_SHA384 1
#define OC_CRYPTO_SUPPORTS_SHA512 1
#define OC_CRYPTO_SUPPORTS_SHA1 1
#define OC_CRYPTO_SUPPORTS_MD5 1
#define OC_CRYPTO_SUPPORTS_STREEBOG 1
#endif

//
// Digest sizes.
//
#define MD5_DIGEST_SIZE 16
#define SHA1_DIGEST_SIZE 20
#define SHA256_DIGEST_SIZE 32
#define SHA384_DIGEST_SIZE 48
#define SHA512_DIGEST_SIZE 64
#define MD5_DIGEST_SIZE 16
#define SHA1_DIGEST_SIZE 20
#define SHA256_DIGEST_SIZE 32
#define SHA384_DIGEST_SIZE 48
#define SHA512_DIGEST_SIZE 64
#define STREEBOG256_DIGEST_SIZE 32
#define STREEBOG512_DIGEST_SIZE 64

#define OC_MAX_SHA_DIGEST_SIZE SHA512_DIGEST_SIZE
#define OC_MAX_SHA_DIGEST_SIZE STREEBOG512_DIGEST_SIZE

//
// Block sizes.
//
#define SHA256_BLOCK_SIZE 64
#define SHA512_BLOCK_SIZE 128
#define SHA384_BLOCK_SIZE SHA512_BLOCK_SIZE
#define SHA256_BLOCK_SIZE 64
#define SHA512_BLOCK_SIZE 128
#define SHA384_BLOCK_SIZE SHA512_BLOCK_SIZE
#define STREEBOG256_BLOCK_SIZE 64
#define STREEBOG512_BLOCK_SIZE STREEBOG256_BLOCK_SIZE

//
// Derived parameters.
Expand Down Expand Up @@ -145,6 +150,16 @@ typedef struct SHA512_CONTEXT_ {

typedef SHA512_CONTEXT SHA384_CONTEXT;

typedef struct STREEBOG_CONTEXT_ {
UINT8 Buffer[64];
UINT64 Hash[8];
UINT64 H[8];
UINT64 N[8];
UINT64 Sigma[8];
UINT32 BufSize;
UINT32 DigestSize;
} STREEBOG_CONTEXT;

///
/// The structure describing the RSA Public Key format.
/// The exponent is always 65537.
Expand Down Expand Up @@ -394,6 +409,56 @@ Sha384 (
UINTN Len
);

VOID
Streebog256Init (
IN OUT STREEBOG_CONTEXT *Context
);

VOID
Streebog256Update (
IN OUT STREEBOG_CONTEXT *Context,
IN CONST UINT8 *Data,
IN UINTN Length
);

VOID
Streebog256Final (
IN OUT STREEBOG_CONTEXT *Context,
OUT UINT8 *Digest
);

VOID
Streebog256 (
IN CONST UINT8 *Data,
OUT UINT8 *Digest,
IN UINTN Length
);

VOID
Streebog512Init (
IN OUT STREEBOG_CONTEXT *Context
);

VOID
Streebog512Update (
IN OUT STREEBOG_CONTEXT *Context,
IN CONST UINT8 *Data,
IN UINTN Length
);

VOID
Streebog512Final (
IN OUT STREEBOG_CONTEXT *Context,
OUT UINT8 *Digest
);

VOID
Streebog512 (
IN CONST UINT8 *Data,
OUT UINT8 *Digest,
IN UINTN Length
);

BOOLEAN
EFIAPI
TryEnableAccel (
Expand Down
2 changes: 2 additions & 0 deletions Library/OcCryptoLib/OcCryptoLib.inf
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
RsaDigitalSign.c
Sha1.c
Sha2.c
Streebog.h
Streebog.c
SecureMem.c
PasswordHash.c
BigNumLib.h
Expand Down
Loading
Loading