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

Initial support for explicit EC #245

Merged
merged 2 commits into from
Jul 14, 2023
Merged

Conversation

manison
Copy link
Contributor

@manison manison commented May 30, 2023

This is initial PoC for #205 for review purposes.

@simo5
Copy link
Member

simo5 commented May 30, 2023

I know I created curve name and pub key attributes for convenience, but I think it is just too much to create that many attributes that are used only in the export function.

I would rather revert and remove those convenience attributes and explicitly decode CKA_EC_PARAMS where needed rather than extending their use this way.

@manison
Copy link
Contributor Author

manison commented May 31, 2023

OK, I understand. I'll try to refactor without using the convenience attributes.

@manison manison force-pushed the feature/explicit-ec branch from 947c0c1 to 9611123 Compare June 29, 2023 13:48
@manison
Copy link
Contributor Author

manison commented Jun 29, 2023

I have rewritten the export function to not use the pseudo attributes. Now it decodes the CKA_EC_PARAMS as needed. Can you take a look whether it is the right direction?

Copy link
Member

@simo5 simo5 left a comment

Choose a reason for hiding this comment

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

Just nits, but this version is much better than the previous

src/encoder.c Outdated Show resolved Hide resolved
src/objects.c Outdated
if (p == NULL) {
return NULL;
}
export_ctx->allocs[export_ctx->ialloc++] = p;
Copy link
Member

Choose a reason for hiding this comment

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

Please increment on the next line in cases like this.
I am more interested in readability than compactness of the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Completely removed and refactored.

src/objects.c Show resolved Hide resolved
src/objects.c Outdated Show resolved Hide resolved
src/objects.c Outdated Show resolved Hide resolved
@simo5
Copy link
Member

simo5 commented Jul 7, 2023

Sorry for late review, I was on vacation.

@manison
Copy link
Contributor Author

manison commented Jul 7, 2023

Thanks for the review. No need to be sorry, hope you enjoyed your vacation :) I'll walk through your comments and prepare updated revision of the PR.

@manison manison force-pushed the feature/explicit-ec branch from 9611123 to 26bade5 Compare July 11, 2023 15:10
@manison
Copy link
Contributor Author

manison commented Jul 11, 2023

I pushed another update, can you please take a look? Thanks.

src/encoder.c Outdated
union {
ASN1_OBJECT *object;
ASN1_STRING *sequence;
void *p;
Copy link
Member

Choose a reason for hiding this comment

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

why do you need p?

you can always just set k->curve.object = NULL when you need to clear this.

@simo5
Copy link
Member

simo5 commented Jul 11, 2023

Looks mostly good, but I do a full re-review in the next few days.

@simo5 simo5 self-requested a review July 11, 2023 16:57
Copy link
Member

@simo5 simo5 left a comment

Choose a reason for hiding this comment

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

LGTM
Only style fixes and the p attribute in the union should be fixed, otherwise I am good with this.

@manison
Copy link
Contributor Author

manison commented Jul 13, 2023

Done. Should I prepare the final PR? I suppose I will squash everything into a single commit (both code changes and tests). Are you ok with that?

@simo5
Copy link
Member

simo5 commented Jul 14, 2023

Done. Should I prepare the final PR? I suppose I will squash everything into a single commit (both code changes and tests). Are you ok with that?

I think we are good.
Either one commit or one for code and one for tests, up to you.

manison added 2 commits July 14, 2023 15:33
Signed-off-by: manison <manison@users.noreply.github.com>
Signed-off-by: manison <manison@users.noreply.github.com>
@manison manison force-pushed the feature/explicit-ec branch from 82b9dab to cf834be Compare July 14, 2023 13:44
@manison manison marked this pull request as ready for review July 14, 2023 13:52
@manison
Copy link
Contributor Author

manison commented Jul 14, 2023

The PR is ready, I ended up making it two commits.

The SEGV from LSAN might be bug in LSAN itself (see e.g. skupperproject/skupper-router#206, google/sanitizers#1322, https://bugzilla.mozilla.org/show_bug.cgi?id=1635327 and lot more). I cannot reproduce locally and in my fork it fails rather randomly.

@simo5
Copy link
Member

simo5 commented Jul 14, 2023

I am rerunning the test, let's see if it is a flake or if more analysis is needed

@simo5
Copy link
Member

simo5 commented Jul 14, 2023

Well, what do you know, it is flakey,
That is not great, but I see no reason to stop merging your contribution.

And thanks a lot for your patience, I really believe the code was improved 10 folds from first submission and really like the result!

@simo5 simo5 merged commit eb476fa into latchset:main Jul 14, 2023
@manison manison deleted the feature/explicit-ec branch July 14, 2023 14:28
@manison
Copy link
Contributor Author

manison commented Jul 14, 2023

And thanks a lot for your patience, I really believe the code was improved 10 folds from first submission and really like the result!

I'm happy for your review and I like the result better too. Thanks for providing your feedback and merging my contribution.

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