Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OcCryptoLib: Add Streebog support #377

Open
wants to merge 26 commits into
base: master
Choose a base branch
from

Conversation

lakreite
Copy link

@lakreite lakreite commented Aug 4, 2022

Streebog support added into OcCryptoLib.

Copy link
Contributor

@vit9696 vit9696 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented about most obvious issues with the code. There also are several codestyle issues with the code. Check https://edk2-docs.gitbook.io/edk-ii-c-coding-standards-specification/.

Include/Acidanthera/Library/OcCryptoLib.h Outdated Show resolved Hide resolved
Library/OcCryptoLib/gost3411-2012-const.h Outdated Show resolved Hide resolved
Library/OcCryptoLib/OcCryptoLib.inf Outdated Show resolved Hide resolved
Library/OcCryptoLib/gost3411-2012-const.h Outdated Show resolved Hide resolved
Library/OcCryptoLib/gost3411-2012-core.c Outdated Show resolved Hide resolved
Utilities/TestStreebog/Makefile Outdated Show resolved Hide resolved
Utilities/TestStreebog/StreebogPreprocess.c Show resolved Hide resolved
Utilities/TestStreebog/Makefile Show resolved Hide resolved
Utilities/TestStreebog/StreebogPreprocess.c Outdated Show resolved Hide resolved
Copy link
Contributor

@vit9696 vit9696 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI is broken again, please fix. Also added more messages inline.

Include/Acidanthera/Library/OcCryptoLib.h Outdated Show resolved Hide resolved
Include/Acidanthera/Library/OcCryptoLib.h Outdated Show resolved Hide resolved
Include/Acidanthera/Library/OcCryptoLib.h Outdated Show resolved Hide resolved
Library/OcCryptoLib/Streebog.c Outdated Show resolved Hide resolved
Library/OcCryptoLib/Streebog.c Outdated Show resolved Hide resolved
Library/OcCryptoLib/Streebog.h Outdated Show resolved Hide resolved
Utilities/TestStreebog/StreebogPreprocess.c Outdated Show resolved Hide resolved
Utilities/TestStreebog/StreebogPreprocess.c Outdated Show resolved Hide resolved
Utilities/TestStreebog/StreebogPreprocess.c Outdated Show resolved Hide resolved
Utilities/TestStreebog/StreebogPreprocess.c Outdated Show resolved Hide resolved
@@ -8,6 +8,8 @@
#include <Library/OcCryptoLib.h>
#include <BigNumLib.h>

#define HASHSIZE 64
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This must come from OcCryptoLib.h, not be defined here.

#elif defined (__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
buf.QWORD[0] = BSWAP64 (CTX->bufsize << 3);
#else
#if (defined (__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || defined(MDE_CPU_IA32) || defined(MDE_CPU_X64)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please introduce separate macros STREEBOG_LITTLE_ENDIAN and STREEBOG_BIG_ENDIAN in Streebog.h to reduce the length.

STREEBOG_CONTEXT *Context
)
{
for (INT32 i = 0; i < 64; ++i) {
Copy link
Member

@PMheart PMheart Oct 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EDK-II convention follows the rule where variables are declared at the beginning of functions; the same idea follows throughout the code.

Also, for indices, UINTN is used.

@@ -394,6 +409,56 @@ Sha384 (
UINTN Len
);

VOID
Streebog256Init (
STREEBOG_CONTEXT *Context
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IN and OUT specifiers are missing, for all.

CONST UINT32 digest_size
)
{
UINT32 i;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be UINTN.

GOST34112012Cleanup (Context);
Context->digest_size = digest_size;

for (i = 0; i < 8; i++) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though clear, is it better if a macro is assigned to the magic number8?

@PMheart
Copy link
Member

PMheart commented Mar 12, 2023

@lakreite Hello! Is this PR still alive? If not, I can start working on this. Thanks!

UPDATE - Assuming the original author will not work on this; I will start it.

@Cam396
Copy link

Cam396 commented Jul 18, 2024

is this pull request ever going to get merged?

@vit9696
Copy link
Contributor

vit9696 commented Jul 18, 2024

Well, currently the review comments are not addressed yet. If you are willing to pick it up and complete, you are gladly welcome ^_^

@Cam396
Copy link

Cam396 commented Jul 18, 2024

i could try but i would have to learn C

@okocsis
Copy link

okocsis commented Jul 23, 2024

i could try but i would have to learn C

Can I land a hand here?

@vit9696
Copy link
Contributor

vit9696 commented Jul 23, 2024

Well, we do not mind, please start with fixing up the CI.

@okocsis
Copy link

okocsis commented Jul 23, 2024

Well, we do not mind, please start with fixing up the CI.

okie doke

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants