You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/04/17 02:39:58 UTC

[incubator-nuttx-apps] branch master updated (d2625c8 -> 6e403fc)

This is an automated email from the ASF dual-hosted git repository.

gnutt pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git.


    from d2625c8  CI: refine checkpatch commits in check.yml
     new 89b981b  nshlib/nsh_codeccmd.c: fix potential NULL dereference and check malloc return values
     new d10eb2a  Fix nxstyle issue for Juha patch
     new 04856cc  Rescue incorrectly removed line
     new 6e403fc  Fix remaining issues with nxstyle

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 include/netutils/md5.h  | 39 ++++++++++++-----------
 netutils/codecs/Kconfig |  5 +--
 netutils/codecs/md5.c   | 84 ++++++++++++++++++++++++++-----------------------
 nshlib/nsh_codeccmd.c   | 75 ++++++++++++++++++++++++++-----------------
 4 files changed, 114 insertions(+), 89 deletions(-)


[incubator-nuttx-apps] 03/04: Rescue incorrectly removed line

Posted by gn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

gnutt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git

commit 04856ccfdec504f76c69825182398d6b0911f265
Author: Alan C. Assis <en...@siam.ind.br>
AuthorDate: Thu Apr 16 20:52:30 2020 -0300

    Rescue incorrectly removed line
---
 include/netutils/md5.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/netutils/md5.h b/include/netutils/md5.h
index d5bd3e3..9e138c3 100644
--- a/include/netutils/md5.h
+++ b/include/netutils/md5.h
@@ -10,6 +10,8 @@
  *
  *   This code implements the MD5 message-digest algorithm.
  *   The algorithm is due to Ron Rivest.  This code was
+ *   written by Colin Plumb in 1993, no copyright is claimed.
+ *
  *   This code is in the public domain; do with it what you wish.
  *
  *   Equivalent code is available from RSA Data Security, Inc.


[incubator-nuttx-apps] 01/04: nshlib/nsh_codeccmd.c: fix potential NULL dereference and check malloc return values

Posted by gn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

gnutt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git

commit 89b981bdb6c1efa2d489e590815e0d1f6edf8977
Author: Juha Niskanen <ju...@haltian.com>
AuthorDate: Thu Apr 16 13:36:21 2020 +0300

    nshlib/nsh_codeccmd.c: fix potential NULL dereference and check malloc return values
---
 nshlib/nsh_codeccmd.c | 43 +++++++++++++++++++++++++++----------------
 1 file changed, 27 insertions(+), 16 deletions(-)

diff --git a/nshlib/nsh_codeccmd.c b/nshlib/nsh_codeccmd.c
index e106f9a..a2ed61a 100644
--- a/nshlib/nsh_codeccmd.c
+++ b/nshlib/nsh_codeccmd.c
@@ -156,7 +156,7 @@ static void urlencode_cb(FAR char *src, int srclen, FAR char *dest,
 static void urldecode_cb(FAR char *src, int srclen, FAR char *dest,
                          FAR int *destlen, int mode)
 {
-  urldecode(src,srclen,dest,destlen);
+  urldecode(src, srclen, dest, destlen);
 }
 #endif
 
@@ -359,7 +359,13 @@ static int cmd_codecs_proc(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv,
           goto exit;
         }
 
-      srcbuf = malloc(CONFIG_NSH_CODECS_BUFSIZE+2);
+      srcbuf = malloc(CONFIG_NSH_CODECS_BUFSIZE + 2);
+      if (!srcbuf)
+        {
+          fmt = g_fmtcmdoutofmemory;
+          goto errout;
+        }
+
 #ifdef HAVE_CODECS_BASE64ENC
       if (mode == CODEC_MODE_BASE64ENC)
         {
@@ -371,19 +377,25 @@ static int cmd_codecs_proc(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv,
           srclen = CONFIG_NSH_CODECS_BUFSIZE;
         }
 
-      buflen = calc_codec_buffsize(srclen+2, mode);
+      buflen = calc_codec_buffsize(srclen + 2, mode);
       destbuf = malloc(buflen);
+      if (!destbuf)
+        {
+          fmt = g_fmtcmdoutofmemory;
+          goto errout;
+        }
+
       while (true)
         {
-          memset(srcbuf, 0, srclen+2);
-          ret=read(fd, srcbuf, srclen);
+          memset(srcbuf, 0, srclen + 2);
+          ret = read(fd, srcbuf, srclen);
           if (ret < 0)
             {
               nsh_error(vtbl, g_fmtcmdfailed, argv[0], "read", NSH_ERRNO);
               ret = ERROR;
               goto exit;
             }
-          else if (ret==0)
+          else if (ret == 0)
             {
               break;
             }
@@ -391,13 +403,13 @@ static int cmd_codecs_proc(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv,
 #ifdef HAVE_CODECS_URLDECODE
           if (mode == CODEC_MODE_URLDECODE)
             {
-              if (srcbuf[srclen-1]=='%')
+              if (srcbuf[srclen - 1] == '%')
                 {
-                  ret += read(fd,&srcbuf[srclen],2);
+                  ret += read(fd, &srcbuf[srclen], 2);
                 }
-              else if (srcbuf[srclen-2]=='%')
+              else if (srcbuf[srclen - 2] == '%')
                 {
-                  ret += read(fd,&srcbuf[srclen],1);
+                  ret += read(fd, &srcbuf[srclen], 1);
                 }
             }
 #endif
@@ -407,17 +419,17 @@ static int cmd_codecs_proc(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv,
 #ifdef HAVE_CODECS_HASH_MD5
               if (mode == CODEC_MODE_HASH_MD5)
                 {
-                  func(srcbuf, ret, (char *)&ctx, &buflen,0);
+                  func(srcbuf, ret, (char *)&ctx, &buflen, 0);
                 }
               else
 #endif
                 {
-                  func(srcbuf, ret, destbuf, &buflen,(iswebsafe)?1:0);
+                  func(srcbuf, ret, destbuf, &buflen, iswebsafe ? 1 : 0);
                   nsh_output(vtbl, "%s", destbuf);
                 }
             }
 
-          buflen = calc_codec_buffsize(srclen+2, mode);
+          buflen = calc_codec_buffsize(srclen + 2, mode);
         }
 
 #ifdef HAVE_CODECS_HASH_MD5
@@ -447,7 +459,6 @@ static int cmd_codecs_proc(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv,
       srclen  = strlen(sdata);
       buflen  = calc_codec_buffsize(srclen, mode);
       destbuf = malloc(buflen);
-      destbuf[0]=0;
       if (!destbuf)
         {
           fmt = g_fmtcmdoutofmemory;
@@ -477,11 +488,11 @@ static int cmd_codecs_proc(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv,
           else
 #endif
             {
-              func(srcbuf, srclen, destbuf, &buflen,(iswebsafe)?1:0);
+              func(srcbuf, srclen, destbuf, &buflen, iswebsafe ? 1 : 0);
             }
         }
 
-      nsh_output(vtbl, "%s\n",destbuf);
+      nsh_output(vtbl, "%s\n", destbuf);
       srcbuf = NULL;
       goto exit;
     }


[incubator-nuttx-apps] 04/04: Fix remaining issues with nxstyle

Posted by gn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

gnutt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git

commit 6e403fc343ef7bae91c06db8eebfc4df5c73663a
Author: Alan C. Assis <en...@siam.ind.br>
AuthorDate: Thu Apr 16 23:02:46 2020 -0300

    Fix remaining issues with nxstyle
---
 include/netutils/md5.h | 22 +++++++++++-----------
 netutils/codecs/md5.c  | 22 +++++++++++-----------
 nshlib/nsh_codeccmd.c  | 18 ++++++++++++------
 3 files changed, 34 insertions(+), 28 deletions(-)

diff --git a/include/netutils/md5.h b/include/netutils/md5.h
index 9e138c3..ff10c4e 100644
--- a/include/netutils/md5.h
+++ b/include/netutils/md5.h
@@ -41,17 +41,17 @@
  *      may be used to endorse or promote products derived from this software
  *      without specific prior written permission.
  *
- *   THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- *   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *   ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- *   FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- *   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- *   OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- *   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- *   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- *   OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- *   SUCH DAMAGE.
+ *   THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS''
+ *   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ *   THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ *   PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS
+ *   BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ *   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ *   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ *   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ *   THE POSSIBILITY OF SUCH DAMAGE.
  *
  ****************************************************************************/
 
diff --git a/netutils/codecs/md5.c b/netutils/codecs/md5.c
index 132b8bd..694e50f 100644
--- a/netutils/codecs/md5.c
+++ b/netutils/codecs/md5.c
@@ -40,17 +40,17 @@
  *      may be used to endorse or promote products derived from this software
  *      without specific prior written permission.
  *
- *   THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- *   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *   ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- *   FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- *   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- *   OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- *   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- *   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- *   OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- *   SUCH DAMAGE.
+ *   THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS''
+ *   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ *   THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ *   PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS
+ *   BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ *   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ *   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ *   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ *   THE POSSIBILITY OF SUCH DAMAGE.
  *
  ****************************************************************************/
 
diff --git a/nshlib/nsh_codeccmd.c b/nshlib/nsh_codeccmd.c
index fe6ea6f..4b70a90 100644
--- a/nshlib/nsh_codeccmd.c
+++ b/nshlib/nsh_codeccmd.c
@@ -249,8 +249,9 @@ static int calc_codec_buffsize(int srclen, uint8_t mode)
  ****************************************************************************/
 
 #ifdef NEED_CMD_CODECS_PROC
-static int cmd_codecs_proc(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv,
-                           uint8_t mode, codec_callback_t func)
+static int cmd_codecs_proc(FAR struct nsh_vtbl_s *vtbl, int argc,
+                           char **argv, uint8_t mode,
+                           codec_callback_t func)
 {
 #ifdef HAVE_CODECS_HASH_MD5
   static const unsigned char hexchars[] = "0123456789abcdef";
@@ -289,7 +290,8 @@ static int cmd_codecs_proc(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv,
           case 'w':
             iswebsafe = true;
 
-            if (!(mode == CODEC_MODE_BASE64ENC || mode == CODEC_MODE_BASE64DEC))
+            if (!(mode == CODEC_MODE_BASE64ENC ||
+                  mode == CODEC_MODE_BASE64DEC))
               {
                 badarg = true;
               }
@@ -308,7 +310,9 @@ static int cmd_codecs_proc(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv,
         }
     }
 
-  /* If a bad argument was encountered, then return without processing the command */
+  /* If a bad argument was encountered, then return without processing
+   * the command
+   */
 
   if (badarg)
     {
@@ -540,7 +544,8 @@ errout:
 #ifdef HAVE_CODECS_URLENCODE
 int cmd_urlencode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
 {
-  return cmd_codecs_proc(vtbl, argc, argv, CODEC_MODE_URLENCODE, urlencode_cb);
+  return cmd_codecs_proc(vtbl, argc, argv, CODEC_MODE_URLENCODE,
+                         urlencode_cb);
 }
 #endif
 
@@ -551,7 +556,8 @@ int cmd_urlencode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
 #ifdef HAVE_CODECS_URLDECODE
 int cmd_urldecode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
 {
-  return cmd_codecs_proc(vtbl, argc, argv, CODEC_MODE_URLDECODE, urldecode_cb);
+  return cmd_codecs_proc(vtbl, argc, argv, CODEC_MODE_URLDECODE,
+                         urldecode_cb);
 }
 #endif
 


[incubator-nuttx-apps] 02/04: Fix nxstyle issue for Juha patch

Posted by gn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

gnutt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git

commit d10eb2ae3a85c06e9489c7b72804851c7ff12291
Author: Alan C. Assis <en...@siam.ind.br>
AuthorDate: Thu Apr 16 10:28:12 2020 -0300

    Fix nxstyle issue for Juha patch
---
 include/netutils/md5.h  | 17 +++++++-------
 netutils/codecs/Kconfig |  5 ++--
 netutils/codecs/md5.c   | 62 ++++++++++++++++++++++++++-----------------------
 nshlib/nsh_codeccmd.c   | 14 ++++++-----
 4 files changed, 52 insertions(+), 46 deletions(-)

diff --git a/include/netutils/md5.h b/include/netutils/md5.h
index bb75e6d..d5bd3e3 100644
--- a/include/netutils/md5.h
+++ b/include/netutils/md5.h
@@ -10,7 +10,6 @@
  *
  *   This code implements the MD5 message-digest algorithm.
  *   The algorithm is due to Ron Rivest.  This code was
- *   written by Colin Plumb in 1993, no copyright is claimed.
  *   This code is in the public domain; do with it what you wish.
  *
  *   Equivalent code is available from RSA Data Security, Inc.
@@ -19,8 +18,8 @@
  *   with every copy.
  *
  *   To compute the message digest of a chunk of bytes, declare an
- *   MD5Context structure, pass it to MD5Init, call MD5Update as
- *   needed on buffers full of bytes, and then call MD5Final, which
+ *   md5_context_s structure, pass it to md5_init, call md5_update as
+ *   needed on buffers full of bytes, and then call md5_final, which
  *   will fill a supplied 16-byte array with the digest.
  *
  *   See README and COPYING for more details.
@@ -74,24 +73,24 @@ extern "C"
  * Public Types
  ****************************************************************************/
 
-struct MD5Context
+struct md5_context_s
 {
   uint32_t buf[4];
   uint32_t bits[2];
   uint8_t in[64];
 };
 
-typedef struct MD5Context MD5_CTX;
+typedef struct md5_context_s MD5_CTX;
 
 /****************************************************************************
  * Public Function Prototypes
  ****************************************************************************/
 
-void MD5Init(struct MD5Context *context);
-void MD5Update(struct MD5Context *context, unsigned char const *buf,
+void md5_init(struct md5_context_s *context);
+void md5_update(struct md5_context_s *context, unsigned char const *buf,
                unsigned len);
-void MD5Final(unsigned char digest[16], struct MD5Context *context);
-void MD5Transform(uint32_t buf[4], uint32_t const in[16]);
+void md5_final(unsigned char digest[16], struct md5_context_s *context);
+void md5_transform(uint32_t buf[4], uint32_t const in[16]);
 
 void md5_sum(const uint8_t *addr, const size_t len, uint8_t *mac);
 char *md5_hash(const uint8_t *addr, const size_t len);
diff --git a/netutils/codecs/Kconfig b/netutils/codecs/Kconfig
index 096b732..baa88bb 100644
--- a/netutils/codecs/Kconfig
+++ b/netutils/codecs/Kconfig
@@ -24,8 +24,9 @@ config CODECS_HASH_MD5
 	bool "MD5 Support"
 	default n
 	---help---
-		Enables support for the following interfaces: MD5Init(),
-		MD5Update(), MD5Final(), MD5Transform(), md5_sum() and md5_hash()
+		Enables support for the following interfaces: md5_init(),
+		md5_update(), md5_final(), md5_transform(), md5_sum() and
+                md5_hash()
 
 		Contributed NuttX by Darcy Gong.
 
diff --git a/netutils/codecs/md5.c b/netutils/codecs/md5.c
index 2d5d136..132b8bd 100644
--- a/netutils/codecs/md5.c
+++ b/netutils/codecs/md5.c
@@ -19,8 +19,8 @@
  *   with every copy.
  *
  *   To compute the message digest of a chunk of bytes, declare an
- *   MD5Context structure, pass it to MD5Init, call MD5Update as
- *   needed on buffers full of bytes, and then call MD5Final, which
+ *   md5_context_s structure, pass it to md5_init, call md5_update as
+ *   needed on buffers full of bytes, and then call md5_final, which
  *   will fill a supplied 16-byte array with the digest.
  *
  *   See README and COPYING for more details.
@@ -91,13 +91,13 @@
  ****************************************************************************/
 
 /****************************************************************************
- * Name: byteReverse
+ * Name: byte_reverse
  ****************************************************************************/
 
 #ifndef CONFIG_ENDIAN_BIG
-#  define byteReverse(buf, len)
+#  define byte_reverse(buf, len)
 #else
-static void byteReverse(FAR unsigned char *buf, unsigned longs)
+static void byte_reverse(FAR unsigned char *buf, unsigned longs)
 {
   uint32_t t;
   do
@@ -107,7 +107,7 @@ static void byteReverse(FAR unsigned char *buf, unsigned longs)
           ((uint32_t)buf[1] << 8)  |
            (uint32_t)buf[0];
 
-      *(uint32_t*)buf = t;
+      *(uint32_t *)buf = t;
       buf += 4;
     }
   while (--longs);
@@ -119,7 +119,7 @@ static void byteReverse(FAR unsigned char *buf, unsigned longs)
  ****************************************************************************/
 
 /****************************************************************************
- * Name: MD5Init
+ * Name: md5_init
  *
  * Description:
  *   Start MD5 accumulation.  Set bit count to 0 and buffer to mysterious
@@ -127,7 +127,7 @@ static void byteReverse(FAR unsigned char *buf, unsigned longs)
  *
  ****************************************************************************/
 
-void MD5Init(struct MD5Context *ctx)
+void md5_init(struct md5_context_s *ctx)
 {
   ctx->buf[0] = 0x67452301;
   ctx->buf[1] = 0xefcdab89;
@@ -139,7 +139,7 @@ void MD5Init(struct MD5Context *ctx)
 }
 
 /****************************************************************************
- * Name: MD5Update
+ * Name: md5_update
  *
  * Description:
  *   Update context to reflect the concatenation of another buffer full
@@ -147,7 +147,8 @@ void MD5Init(struct MD5Context *ctx)
  *
  ****************************************************************************/
 
-void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
+void md5_update(struct md5_context_s *ctx, unsigned char const *buf,
+               unsigned len)
 {
   uint32_t t;
 
@@ -181,8 +182,8 @@ void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
         }
 
       memcpy(p, buf, t);
-      byteReverse(ctx->in, 16);
-      MD5Transform(ctx->buf, (uint32_t *) ctx->in);
+      byte_reverse(ctx->in, 16);
+      md5_transform(ctx->buf, (uint32_t *) ctx->in);
       buf += t;
       len -= t;
     }
@@ -192,8 +193,8 @@ void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
   while (len >= 64)
     {
       memcpy(ctx->in, buf, 64);
-      byteReverse(ctx->in, 16);
-      MD5Transform(ctx->buf, (uint32_t *) ctx->in);
+      byte_reverse(ctx->in, 16);
+      md5_transform(ctx->buf, (uint32_t *) ctx->in);
       buf += 64;
       len -= 64;
     }
@@ -204,7 +205,7 @@ void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
 }
 
 /****************************************************************************
- * Name: MD5Final
+ * Name: md5_final
  *
  * Description:
  *   Final wrapup - pad to 64-byte boundary with the bit pattern
@@ -212,7 +213,7 @@ void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
  *
  ****************************************************************************/
 
-void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
+void md5_final(unsigned char digest[16], struct md5_context_s *ctx)
 {
   unsigned count;
   unsigned char *p;
@@ -239,8 +240,8 @@ void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
       /* Two lots of padding: Pad the first block to 64 bytes */
 
       memset(p, 0, count);
-      byteReverse(ctx->in, 16);
-      MD5Transform(ctx->buf, (uint32_t *) ctx->in);
+      byte_reverse(ctx->in, 16);
+      md5_transform(ctx->buf, (uint32_t *) ctx->in);
 
       /* Now fill the next block with 56 bytes */
 
@@ -253,32 +254,35 @@ void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
       memset(p, 0, count - 8);
     }
 
-  byteReverse(ctx->in, 14);
+  byte_reverse(ctx->in, 14);
 
   /* Append length in bits and transform */
 
   ((uint32_t *)ctx->in)[14] = ctx->bits[0];
   ((uint32_t *)ctx->in)[15] = ctx->bits[1];
 
-  MD5Transform(ctx->buf, (uint32_t *) ctx->in);
-  byteReverse((unsigned char *)ctx->buf, 4);
+  md5_transform(ctx->buf, (uint32_t *) ctx->in);
+  byte_reverse((unsigned char *)ctx->buf, 4);
   memcpy(digest, ctx->buf, 16);
-  memset(ctx, 0, sizeof(struct MD5Context));  /* In case it's sensitive */
+  memset(ctx, 0, sizeof(struct md5_context_s));  /* In case it's sensitive */
 }
 
 /****************************************************************************
- * Name: MD5Transform
+ * Name: md5_transform
  *
  * Description:
  *   The core of the MD5 algorithm, this alters an existing MD5 hash to
- *   reflect the addition of 16 longwords of new data.  MD5Update blocks
+ *   reflect the addition of 16 longwords of new data. md5_update blocks
  *   the data and converts bytes into longwords for this routine.
  *
  ****************************************************************************/
 
-void MD5Transform(uint32_t buf[4], uint32_t const in[16])
+void md5_transform(uint32_t buf[4], uint32_t const in[16])
 {
-  register uint32_t a, b, c, d;
+  register uint32_t a;
+  register uint32_t b;
+  register uint32_t c;
+  register uint32_t d;
 
   a = buf[0];
   b = buf[1];
@@ -376,9 +380,9 @@ void md5_sum(const uint8_t * addr, const size_t len, uint8_t * mac)
 {
   MD5_CTX ctx;
 
-  MD5Init(&ctx);
-  MD5Update(&ctx, addr, len);
-  MD5Final(mac, &ctx);
+  md5_init(&ctx);
+  md5_update(&ctx, addr, len);
+  md5_final(mac, &ctx);
 }
 
 /****************************************************************************
diff --git a/nshlib/nsh_codeccmd.c b/nshlib/nsh_codeccmd.c
index a2ed61a..fe6ea6f 100644
--- a/nshlib/nsh_codeccmd.c
+++ b/nshlib/nsh_codeccmd.c
@@ -197,7 +197,7 @@ static void b64dec_cb(FAR char *src, int srclen, FAR char *dest,
   else
     {
       base64w_decode((unsigned char *)src, srclen,
-                     (unsigned char *)dest,(size_t *)destlen);
+                     (unsigned char *)dest, (size_t *)destlen);
     }
 }
 #endif
@@ -210,7 +210,7 @@ static void b64dec_cb(FAR char *src, int srclen, FAR char *dest,
 static void md5_cb(FAR char *src, int srclen, FAR char *dest,
                    FAR int *destlen, int mode)
 {
-  MD5Update((MD5_CTX *)dest, (unsigned char *)src, srclen);
+  md5_update((MD5_CTX *)dest, (unsigned char *)src, srclen);
 }
 #endif
 
@@ -317,7 +317,7 @@ static int cmd_codecs_proc(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv,
 
   /* There should be exactly on parameter left on the command-line */
 
-  if (optind == argc-1)
+  if (optind == argc - 1)
     {
       sdata = argv[optind];
     }
@@ -335,7 +335,7 @@ static int cmd_codecs_proc(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv,
 #ifdef HAVE_CODECS_HASH_MD5
   if (mode == CODEC_MODE_HASH_MD5)
     {
-      MD5Init(&ctx);
+      md5_init(&ctx);
     }
 #endif
 
@@ -412,6 +412,7 @@ static int cmd_codecs_proc(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv,
                   ret += read(fd, &srcbuf[srclen], 1);
                 }
             }
+
 #endif
           memset(destbuf, 0, buflen);
           if (func)
@@ -437,7 +438,7 @@ static int cmd_codecs_proc(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv,
         {
           int i;
 
-          MD5Final(mac, &ctx);
+          md5_final(mac, &ctx);
           src = (FAR char *)&mac;
           dest = destbuf;
           for (i = 0; i < 16; i++, src++)
@@ -449,6 +450,7 @@ static int cmd_codecs_proc(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv,
           *dest = '\0';
           nsh_output(vtbl, "%s\n", destbuf);
         }
+
 #endif
       ret = OK;
       goto exit;
@@ -474,7 +476,7 @@ static int cmd_codecs_proc(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv,
               int i;
 
               func(srcbuf, srclen, (char *)&ctx, &buflen, 0);
-              MD5Final(mac, &ctx);
+              md5_final(mac, &ctx);
               src = (char *)&mac;
               dest = destbuf;
               for (i = 0; i < 16; i++, src++)