acassis commented on code in PR #3532:
URL: https://github.com/apache/nuttx-apps/pull/3532#discussion_r3448474594


##########
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 Since this kind of code applies to dropbear, you don't need to 
modify to follow the NuttX style



##########
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);
++
+       return CRYPT_OK;
+ }
+
+--- a/src/common-channel.c
++++ b/src/common-channel.c
+@@ -410,7 +410,9 @@
+
+ #ifndef HAVE_WRITEV
+ static int writechannel_fallback(struct Channel* channel, int fd, circbuffer 
*cbuf,
+-      const unsigned char *UNUSED(moredata), unsigned int *morelen) {
++      const unsigned char *moredata, unsigned int *morelen) {
++      UNUSED(moredata);
++
+
+       unsigned char *circ_p1, *circ_p2;
+       unsigned int circ_len1, circ_len2;
+--- a/src/common-kex.c
++++ b/src/common-kex.c
+@@ -420,11 +420,15 @@
+                       && ses.keys->recv.algo_comp == 
DROPBEAR_COMP_ZLIB_DELAY);
+ }
+
+-static void* dropbear_zalloc(void* UNUSED(opaque), uInt items, uInt size) {
++static void *dropbear_zalloc(void *opaque, uInt items, uInt size) {
++      UNUSED(opaque);
++
+       return m_calloc(items, size);
+ }
+
+-static void dropbear_zfree(void* UNUSED(opaque), void* ptr) {
++static void dropbear_zfree(void *opaque, void *ptr) {
++      UNUSED(opaque);
++
+       m_free(ptr);
+ }
+
+--- a/src/dbutil.c
++++ b/src/dbutil.c
+@@ -133,8 +133,10 @@
+       dropbear_exit("Failed assertion (%s:%d): `%s'", file, line, expr);
+ }
+
+-static void generic_dropbear_log(int UNUSED(priority), const char* format,
++static void generic_dropbear_log(int priority, const char* format,
+               va_list param) {
++      UNUSED(priority);
++
+
+       char printbuf[1024];
+
+--- a/src/gcm.c
++++ b/src/gcm.c
+@@ -37,9 +37,11 @@
+
+ static int dropbear_gcm_start(int cipher, const unsigned char *IV,
+                       const unsigned char *key, int keylen,
+-                      int UNUSED(num_rounds), dropbear_gcm_state *state) {
++                      int num_rounds, dropbear_gcm_state *state) {
+       int err;
+
++      UNUSED(num_rounds);
++

Review Comment:
   Ditto



##########
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);
++
+       return CRYPT_OK;
+ }
+
+--- a/src/common-channel.c
++++ b/src/common-channel.c
+@@ -410,7 +410,9 @@
+
+ #ifndef HAVE_WRITEV
+ static int writechannel_fallback(struct Channel* channel, int fd, circbuffer 
*cbuf,
+-      const unsigned char *UNUSED(moredata), unsigned int *morelen) {
++      const unsigned char *moredata, unsigned int *morelen) {
++      UNUSED(moredata);
++
+
+       unsigned char *circ_p1, *circ_p2;
+       unsigned int circ_len1, circ_len2;
+--- a/src/common-kex.c
++++ b/src/common-kex.c
+@@ -420,11 +420,15 @@
+                       && ses.keys->recv.algo_comp == 
DROPBEAR_COMP_ZLIB_DELAY);
+ }
+
+-static void* dropbear_zalloc(void* UNUSED(opaque), uInt items, uInt size) {
++static void *dropbear_zalloc(void *opaque, uInt items, uInt size) {
++      UNUSED(opaque);
++
+       return m_calloc(items, size);
+ }
+
+-static void dropbear_zfree(void* UNUSED(opaque), void* ptr) {
++static void dropbear_zfree(void *opaque, void *ptr) {
++      UNUSED(opaque);
++
+       m_free(ptr);
+ }
+
+--- a/src/dbutil.c
++++ b/src/dbutil.c
+@@ -133,8 +133,10 @@
+       dropbear_exit("Failed assertion (%s:%d): `%s'", file, line, expr);
+ }
+
+-static void generic_dropbear_log(int UNUSED(priority), const char* format,
++static void generic_dropbear_log(int priority, const char* format,
+               va_list param) {
++      UNUSED(priority);
++
+
+       char printbuf[1024];
+
+--- a/src/gcm.c
++++ b/src/gcm.c
+@@ -37,9 +37,11 @@
+
+ static int dropbear_gcm_start(int cipher, const unsigned char *IV,
+                       const unsigned char *key, int keylen,
+-                      int UNUSED(num_rounds), dropbear_gcm_state *state) {
++                      int num_rounds, dropbear_gcm_state *state) {
+       int err;
+
++      UNUSED(num_rounds);
++
+       TRACE2(("enter dropbear_gcm_start"))
+
+       if ((err = gcm_init(&state->gcm, cipher, key, keylen)) != CRYPT_OK) {
+@@ -51,13 +53,15 @@
+       return CRYPT_OK;
+ }
+
+-static int dropbear_gcm_crypt(unsigned int UNUSED(seq),
++static int dropbear_gcm_crypt(unsigned int seq,
+                       const unsigned char *in, unsigned char *out,
+                       unsigned long len, unsigned long taglen,
+                       dropbear_gcm_state *state, int direction) {
+       unsigned char *iv, tag[GHASH_LEN];
+       int i, err;
+
++      UNUSED(seq);
++
+       TRACE2(("enter dropbear_gcm_crypt"))
+
+       if (len < 4 || taglen != GHASH_LEN) {
+@@ -97,9 +101,12 @@
+       return CRYPT_OK;
+ }
+
+-static int dropbear_gcm_getlength(unsigned int UNUSED(seq),
++static int dropbear_gcm_getlength(unsigned int seq,
+                       const unsigned char *in, unsigned int *outlen,
+-                      unsigned long len, dropbear_gcm_state* UNUSED(state)) {
++                      unsigned long len, dropbear_gcm_state *state) {
++      UNUSED(seq);
++      UNUSED(state);
++
+       TRACE2(("enter dropbear_gcm_getlength"))
+
+       if (len < 4) {
+--- a/src/ltc_prng.c
++++ b/src/ltc_prng.c
+@@ -32,8 +32,10 @@
+   @param prng     [out] The PRNG state to initialize
+   @return CRYPT_OK if successful
+ */
+-int dropbear_prng_start(prng_state* UNUSED(prng))
++int dropbear_prng_start(prng_state *prng)
+ {
++   UNUSED(prng);
++

Review Comment:
   Ditto



##########
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);
++
+       return CRYPT_OK;
+ }
+
+--- a/src/common-channel.c
++++ b/src/common-channel.c
+@@ -410,7 +410,9 @@
+
+ #ifndef HAVE_WRITEV
+ static int writechannel_fallback(struct Channel* channel, int fd, circbuffer 
*cbuf,
+-      const unsigned char *UNUSED(moredata), unsigned int *morelen) {
++      const unsigned char *moredata, unsigned int *morelen) {
++      UNUSED(moredata);
++
+
+       unsigned char *circ_p1, *circ_p2;
+       unsigned int circ_len1, circ_len2;
+--- a/src/common-kex.c
++++ b/src/common-kex.c
+@@ -420,11 +420,15 @@
+                       && ses.keys->recv.algo_comp == 
DROPBEAR_COMP_ZLIB_DELAY);
+ }
+
+-static void* dropbear_zalloc(void* UNUSED(opaque), uInt items, uInt size) {
++static void *dropbear_zalloc(void *opaque, uInt items, uInt size) {
++      UNUSED(opaque);
++
+       return m_calloc(items, size);
+ }
+
+-static void dropbear_zfree(void* UNUSED(opaque), void* ptr) {
++static void dropbear_zfree(void *opaque, void *ptr) {
++      UNUSED(opaque);
++

Review Comment:
   Ditto



##########
netutils/dropbear/patch/0008-fix-strict-prototypes-warnings.patch:
##########
@@ -0,0 +1,76 @@
+--- a/src/common-kex.c
++++ b/src/common-kex.c
+@@ -117,7 +117,7 @@ void send_msg_kexinit() {
+
+ }
+
+-static void switch_keys() {
++static void switch_keys(void) {
+       TRACE2(("enter switch_keys"))
+       if (!(ses.kexstate.sentkexinit && ses.kexstate.recvkexinit)) {
+               dropbear_exit("Unexpected newkeys message");
+--- a/src/common-session.c
++++ b/src/common-session.c
+@@ -503,7 +503,7 @@ void ignore_recv_response() {
+       TRACE(("Ignored msg_request_response"))
+ }
+
+-static void send_msg_keepalive() {
++static void send_msg_keepalive(void) {
+       time_t old_time_idle = ses.last_packet_time_idle;
+       struct Channel *chan = get_any_ready_channel();
+
+--- a/src/dbrandom.c
++++ b/src/dbrandom.c
+@@ -129,7 +129,7 @@ static void addrandom(const unsigned char * buf, unsigned 
int len) {
+       sha256_done(&hs, hashpool);
+ }
+
+-static void write_urandom()
++static void write_urandom(void)

Review Comment:
   I think this commit could be submitted to dropbear mainline, right @mkj ?



##########
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);
++

Review Comment:
   @FelipeMdeO Since this kind of code applies to dropbear, you don't need to 
modify to follow the NuttX style



##########
netutils/dropbear/patch/0008-fix-strict-prototypes-warnings.patch:
##########
@@ -0,0 +1,76 @@
+--- a/src/common-kex.c
++++ b/src/common-kex.c
+@@ -117,7 +117,7 @@ void send_msg_kexinit() {
+
+ }
+
+-static void switch_keys() {
++static void switch_keys(void) {
+       TRACE2(("enter switch_keys"))
+       if (!(ses.kexstate.sentkexinit && ses.kexstate.recvkexinit)) {
+               dropbear_exit("Unexpected newkeys message");
+--- a/src/common-session.c
++++ b/src/common-session.c
+@@ -503,7 +503,7 @@ void ignore_recv_response() {
+       TRACE(("Ignored msg_request_response"))
+ }
+
+-static void send_msg_keepalive() {
++static void send_msg_keepalive(void) {
+       time_t old_time_idle = ses.last_packet_time_idle;
+       struct Channel *chan = get_any_ready_channel();
+
+--- a/src/dbrandom.c
++++ b/src/dbrandom.c
+@@ -129,7 +129,7 @@ static void addrandom(const unsigned char * buf, unsigned 
int len) {
+       sha256_done(&hs, hashpool);
+ }
+
+-static void write_urandom()
++static void write_urandom(void)
+ {
+ #if DROPBEAR_FUZZ
+       if (fuzz.fuzzing) {
+--- a/src/packet.c
++++ b/src/packet.c
+@@ -475,7 +475,7 @@ int packet_is_okay_for_queues(unsigned char type) {
+       return 1;
+ }
+
+-static void enqueue_reply_packet() {
++static void enqueue_reply_packet(void) {
+       struct packetlist * new_item = NULL;
+       new_item = m_malloc(sizeof(struct packetlist));
+       new_item->next = NULL;
+--- a/src/svr-kex.c
++++ b/src/svr-kex.c
+@@ -114,7 +114,7 @@
+
+ #if DROPBEAR_DELAY_HOSTKEY
+
+-static void svr_ensure_hostkey() {
++static void svr_ensure_hostkey(void) {
+
+       const char* fn = NULL;
+       char *expand_fn = NULL;
+--- a/src/svr-runopts.c
++++ b/src/svr-runopts.c
+@@ -38,7 +38,7 @@ svr_runopts svr_opts; /* GLOBAL */
+ static void printhelp(const char * progname);
+ static void addportandaddress(const char* spec);
+ static void loadhostkey(const char *keyfile, int fatal_duplicate);
+ static void addhostkey(const char *keyfile);
+-static void load_banner();
++static void load_banner(void);

Review Comment:
   Ditto



-- 
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]

Reply via email to