acassis commented on code in PR #3532:
URL: https://github.com/apache/nuttx-apps/pull/3532#discussion_r3454399497
##########
netutils/dropbear/patch/0007-use-nuttx-unused-macro.patch:
##########
@@ -0,0 +1,267 @@
+--- a/src/chachapoly.c
++++ b/src/chachapoly.c
+@@ -43,11 +43,15 @@
+ const struct dropbear_cipher dropbear_chachapoly =
+ {&dummy, CHACHA20_KEY_LEN*2, CHACHA20_BLOCKSIZE};
+
+-static int dropbear_chachapoly_start(int UNUSED(cipher), const unsigned char*
UNUSED(IV),
++static int dropbear_chachapoly_start(int cipher, const unsigned char *IV,
+ const unsigned char *key, int keylen,
+- int UNUSED(num_rounds), dropbear_chachapoly_state
*state) {
++ int num_rounds, dropbear_chachapoly_state *state) {
+ int err;
+
++ UNUSED(cipher);
++ UNUSED(IV);
++ UNUSED(num_rounds);
++
+ TRACE2(("enter dropbear_chachapoly_start"))
+
+ if (keylen != CHACHA20_KEY_LEN*2) {
+--- a/src/common-algo.c
++++ b/src/common-algo.c
+@@ -40,16 +40,25 @@
+ * decide which ciphers/hashes/compression/signing to use during key
exchange*/
+
+ static int void_cipher(const unsigned char* in, unsigned char* out,
+- unsigned long len, void* UNUSED(cipher_state)) {
++ unsigned long len, void *cipher_state) {
++ UNUSED(cipher_state);
++
+ if (in != out) {
+ memmove(out, in, len);
+ }
+ return CRYPT_OK;
+ }
+
+-static int void_start(int UNUSED(cipher), const unsigned char* UNUSED(IV),
+- const unsigned char* UNUSED(key),
+- int UNUSED(keylen), int UNUSED(num_rounds), void*
UNUSED(cipher_state)) {
++static int void_start(int cipher, const unsigned char *IV,
++ const unsigned char *key,
++ int keylen, int num_rounds, void *cipher_state) {
++ UNUSED(cipher);
++ UNUSED(IV);
++ UNUSED(key);
++ UNUSED(keylen);
++ UNUSED(num_rounds);
++ UNUSED(cipher_state);
++
Review Comment:
@FelipeMdeO understood, thank you. So NuttX UNUSED() is not compatible with
Dropbear.
@mkj so the way UNUSED is used in Dropbear only works if the compiler
supports it, the suggestion you propose to detect compiler and create a UNUSED
macro for old compilers will not work.
@FelipeMdeO ok, since we don't have other option here, let's to live with
more this .patch
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]