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

Support post-quantum KYBER_LEVEL1 and P256_KYBER_LEVEL1 with FALCON_LEVEL1 in wolfMQTT. #300

Merged
merged 2 commits into from
Jun 6, 2022

Conversation

anhu
Copy link
Member

@anhu anhu commented Jun 2, 2022

No description provided.

@anhu anhu requested a review from embhorn June 2, 2022 21:40
Comment on lines 50 to 52
/* REVIEWER: Should the other mTls* variables be initialized?
* This comment should be removed during review.
*/
Copy link
Member Author

Choose a reason for hiding this comment

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

Please comment.

Copy link
Contributor

Choose a reason for hiding this comment

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

Remove your code comment. Static globals are guaranteed to be zero initialized. It is part of the C standard.

Comment on lines 636 to 640
/* REVIEWER: This has nothing to do with PQC but I think this fixes a
* a bug where we would have de-referenced client->tls.ctx even if it
* NULL.
* This comment should be removed during review.
*/
Copy link
Member Author

Choose a reason for hiding this comment

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

Please comment.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks good. Remove your comment. You should put comments in the PR not in the code.

Comment on lines 636 to 640
/* REVIEWER: This has nothing to do with PQC but I think this fixes a
* a bug where we would have de-referenced client->tls.ctx even if it
* NULL.
* This comment should be removed during review.
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks good. Remove your comment. You should put comments in the PR not in the code.

#endif /* HAVE_SNI */
#ifdef HAVE_PQC
int group = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Declare int group in brace or top of function.

@@ -482,6 +482,10 @@ WOLFMQTT_API int MqttClient_CancelMessage(

/*! \brief Performs network connect with TLS (if use_tls is non-zero value)
* Will perform the MqttTlsCb callback if use_tls is non-zero value
* \note The callback function that cb points to does not have to initialize
Copy link
Contributor

Choose a reason for hiding this comment

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

You could fix mqtt_socket.c to use the WOLFSSL versions....

WOLFSSL_API void wolfSSL_SSLSetIORecv(WOLFSSL *ssl, CallbackIORecv CBIORecv);
WOLFSSL_API void wolfSSL_SSLSetIOSend(WOLFSSL *ssl, CallbackIOSend CBIOSend);

Copy link
Member Author

Choose a reason for hiding this comment

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

hmmm....I don't know what the difference is and I don't know why mqtt has its own custom ones in the first place. I'll look into it tomorrow.

Copy link
Member Author

Choose a reason for hiding this comment

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

OH !!! You mean call those functions after the callback returns!! I get it now. Will do tomorrow.

}

if (group != 0) {
/* Setup the IO callbacks */
Copy link
Contributor

Choose a reason for hiding this comment

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

You could fix mqtt_socket.c to use the WOLFSSL versions....

WOLFSSL_API void wolfSSL_SSLSetIORecv(WOLFSSL *ssl, CallbackIORecv CBIORecv);
WOLFSSL_API void wolfSSL_SSLSetIOSend(WOLFSSL *ssl, CallbackIOSend CBIOSend);

} else if (XSTRCMP(mTlsPQAlg, "P256_KYBER_LEVEL1") == 0) {
group = WOLFSSL_P256_KYBER_LEVEL1;
} else {
PRINTF("invalid post-quantum KEM specified");
Copy link
Contributor

Choose a reason for hiding this comment

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

"Invalid" case.

Comment on lines 50 to 52
/* REVIEWER: Should the other mTls* variables be initialized?
* This comment should be removed during review.
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove your code comment. Static globals are guaranteed to be zero initialized. It is part of the C standard.

@dgarske dgarske assigned anhu and unassigned embhorn Jun 2, 2022
@dgarske
Copy link
Contributor

dgarske commented Jun 2, 2022

Add a section in the README.md please showing steps to use PQ with MQTT. This would require the server to have PQ enabled to, so guessing there are many tips you can add.

@anhu
Copy link
Member Author

anhu commented Jun 2, 2022

Add a section in the README.md please showing steps to use PQ with MQTT. This would require the server to have PQ enabled to, so guessing there are many tips you can add.

Sure, will get to it tomorrow.

@anhu anhu changed the title Support post-quantum KYBER_LEVEL1 and P256_KYBER_LEVEL1 in wolfMQTT. Support post-quantum KYBER_LEVEL1 and P256_KYBER_LEVEL1 with FALCON_LEVEL1 in wolfMQTT. Jun 3, 2022
@anhu
Copy link
Member Author

anhu commented Jun 3, 2022

Not ready for merge yet. Still need to do README.md additions.

@anhu
Copy link
Member Author

anhu commented Jun 3, 2022

Firmware test is failing...repro'd on my local system. I still need to investigate.

@dgarske dgarske assigned embhorn and unassigned anhu Jun 3, 2022
@dgarske
Copy link
Contributor

dgarske commented Jun 3, 2022

Don't investigate, just retry the test. It isn't you... it is because our tests use a public server and the tests sometimes collide. We don't have our own MQTT broker for testing....

@anhu
Copy link
Member Author

anhu commented Jun 3, 2022

Already retried. Repro'd locally, consistently and got seg fault. Can't be result of collision .

@dgarske dgarske assigned anhu and unassigned embhorn Jun 3, 2022
@dgarske
Copy link
Contributor

dgarske commented Jun 3, 2022

Already retried. Repro'd locally, consistently and got seg fault. Can't be result of collision .

That's great. Should be easy then. I won't merge yet.

@anhu
Copy link
Member Author

anhu commented Jun 3, 2022

Yup. Will investigate on Monday morning.

@anhu anhu removed their assignment Jun 6, 2022
@anhu
Copy link
Member Author

anhu commented Jun 6, 2022

Once the tests pass (pretty sure it will pass now) then this commit is good to go.

@dgarske dgarske merged commit 608d5ae into wolfSSL:master Jun 6, 2022
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.

3 participants