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

Cred mgr test #60

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

Cred mgr test #60

wants to merge 20 commits into from

Conversation

nboard
Copy link
Contributor

@nboard nboard commented Jul 8, 2022

This code should achieve the following:

  • Test and confirm the following Crypto functionality:
  1. Init/cleanup
  2. gen salt, iv, and random keys
  3. RSA keypair generation
  4. AES and RSA encryption/decryption
  5. Key destruction
  • Test and confirm the following DB functionality:
  1. init/clode
  2. insert, retrieve, update, and delete for all three tables (auth, resc, and user data)
  3. delete all for resc and auth
  4. retrieve linked list for auth
  • Provide the following DB changes (along with tests):
  1. Remove salt from the Auth table
  2. Move teh AuthClass field from the resc table to the auth table
  3. Change the group retrieve and delete for auth to use the AuthClass field
  4. Fix return codes for updates and deletes that affect 0 items
  5. Individual updates and deletes for auth table, as well as retrieval by PK

Please note that the credentials_mgr.h and credentials_mgr.c documents were changed to accommodate changes in the way functions are called. The changed regions did not appear to be used anywhere, so the changes should not break anything.

gbeeley and others added 18 commits June 14, 2022 15:45
…into cred-mgr-test

Correcting mislabled author on last commit.
…into cred-mgr-test

Correcting mislabled author on last commit. For real this time.
…into cred-mgr-test

Fixing author on commits, hopefully the last time.
…s key destruction and keys generated from passwords.
…ry key. \nMoved auth class from resc to auth table. \nEdited cred mgr to reflect change in resc table.
…d tests for auth table's delete all and retrieve all functions.
Copy link
Member

@gbeeley gbeeley left a comment

Choose a reason for hiding this comment

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

Looking good! A few changes needed here.

assert(result == CXSS_CRYPTO_SUCCESS);
result = cxssEncryptAES256(short1, strlen(short1)+1, key2, iv1, &ciphertext2, &cipherLen2);
assert(result == CXSS_CRYPTO_SUCCESS);
assert(strcmp(ciphertext2, ciphertext1) != 0);
Copy link
Member

Choose a reason for hiding this comment

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

Use memcmp() on binary data, as strcmp() will stop when it hits a NUL byte. Also other locations here too.

/** Basic test of init and release */
cxss_internal_InitEntropy(1280); /* must be into first */
cxssCryptoInit();
cxssCryptoCleanup();
Copy link
Member

Choose a reason for hiding this comment

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

Does this test need to assert anything or is it just a test to ensure init/cleanup don't segfault?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was done just to ensure it does not segfault. There does not appear to be anything done by these functions that can be easily confirmed externally.



/** Basic test of init and release */
char * PATH = "/home/devel/test.db";
Copy link
Member

Choose a reason for hiding this comment

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

Be sure to not have an install-dependent path in the tests. There may not always be a user "devel". You may want to use a relative path in the current folder instead of an absolute path.

@nboard
Copy link
Contributor Author

nboard commented Jul 13, 2022

Thank you for the feedback. I pushed a commit with the requested changes.

Copy link
Member

@gbeeley gbeeley left a comment

Choose a reason for hiding this comment

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

One minor change. Thanks!

return 0;
}

void clearBuff(char* array, int length)
Copy link
Member

Choose a reason for hiding this comment

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

You can use memset() or bzero() for this purpose.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it! thanks for the tip

Copy link
Member

@gbeeley gbeeley left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks Noah!

@nboard
Copy link
Contributor Author

nboard commented Oct 27, 2023

I think I did not realize the approval meant I should have merged it. Is it fine to merge now, or does that need reevaluated now that is has been so long?

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

Successfully merging this pull request may close these issues.

2 participants