-
Notifications
You must be signed in to change notification settings - Fork 8
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
base: master
Are you sure you want to change the base?
Cred mgr test #60
Conversation
…eration is tested as well
…eration is tested as well
…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.
…d deletes that affect no rows to fail
…reflect table changes
…ry key. \nMoved auth class from resc to auth table. \nEdited cred mgr to reflect change in resc table.
…trieve all to use auth class
…d tests for auth table's delete all and retrieve all functions.
…generated PK value to the struct.
…including how auth's PK was handled.
There was a problem hiding this 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); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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"; |
There was a problem hiding this comment.
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.
…the DB to be within the local testing dir.
Thank you for the feedback. I pushed a commit with the requested changes. |
There was a problem hiding this 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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this 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!
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? |
This code should achieve the following:
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.