]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
SHA: Fixing small bugs and code style
authorPavel Tvrdík <pawel.tvrdik@gmail.cz>
Tue, 28 Apr 2015 07:08:43 +0000 (09:08 +0200)
committerPavel Tvrdík <pawel.tvrdik@gmail.cz>
Tue, 28 Apr 2015 14:58:31 +0000 (16:58 +0200)
Thanks to Ondrej Zajicek

lib/sha1.h
lib/sha256.h
lib/sha256_hmac.h

index cb2a5f1411fea9d35ef148bef8c60cdddef05e8e..78023b7201f8dad966d3734d01521914e27273ea 100644 (file)
@@ -12,8 +12,8 @@
  *     Can be freely distributed and used under the terms of the GNU GPL.
  */
 
-#ifndef _BIRD_SHA1_H
-#define _BIRD_SHA1_H
+#ifndef _BIRD_SHA1_H_
+#define _BIRD_SHA1_H_
 
 #include "sysdep/config.h"
 
@@ -79,8 +79,8 @@ void sha1_hmac_init(sha1_hmac_context *hd, const byte *key, uint keylen);     /** In
 void sha1_hmac_update(sha1_hmac_context *hd, const byte *data, uint datalen);  /** Hash another @datalen bytes of data. See sha1_update(). */
 byte *sha1_hmac_final(sha1_hmac_context *hd);                                  /** Terminate the HMAC and return a pointer to the allocated hash. See sha1_final(). */
 
-#define SHA1_SIZE 20 /** Size of the SHA1 hash in its binary representation **/
-#define SHA1_HEX_SIZE 41 /** Buffer length for a string containing SHA1 in hexadecimal format. **/
-#define SHA1_BLOCK_SIZE 64 /** SHA1 splits input to blocks of this size. **/
+#define SHA1_SIZE 20           /** Size of the SHA1 hash in its binary representation **/
+#define SHA1_HEX_SIZE 41       /** Buffer length for a string containing SHA1 in hexadecimal format. **/
+#define SHA1_BLOCK_SIZE 64     /** SHA1 splits input to blocks of this size. **/
 
-#endif
+#endif /* _BIRD_SHA1_H_ */
index 622f760399927cd3fa02b704722454f028c2888a..266c66ca413ca5c95bc1e48e1c7ad947bf79297e 100644 (file)
@@ -9,8 +9,8 @@
  *     Can be freely distributed and used under the terms of the GNU GPL.
  */
 
-#ifndef _BIRD_SHA256_H
-#define _BIRD_SHA256_H
+#ifndef _BIRD_SHA256_H_
+#define _BIRD_SHA256_H_
 
 #define SHA256_SIZE            32
 #define SHA256_HEX_SIZE                65
@@ -28,7 +28,7 @@ typedef struct {
 typedef sha256_context sha224_context;
 
 void sha256_init(sha256_context *ctx);
-void sha256_init(sha224_context *ctx);
+void sha224_init(sha224_context *ctx);
 
 void sha256_update(sha256_context *ctx, const byte *in_buf, size_t in_len);
 void sha224_update(sha224_context *ctx, const byte *in_buf, size_t in_len)
@@ -42,4 +42,4 @@ byte* sha224_final(sha224_context *ctx)
   return sha256_final(ctx);
 }
 
-#endif
+#endif /* _BIRD_SHA256_H_ */
index 72d1797a43b46d3fda38b329ca12f81a0e0fe32d..cc90357ead69b9d25b424ced625f9ae42f1d5a3e 100644 (file)
@@ -9,8 +9,8 @@
  *     Can be freely distributed and used under the terms of the GNU GPL.
  */
 
-#ifndef SHA256_HMAC_H
-#define SHA256_HMAC_H
+#ifndef _BIRD_SHA256_HMAC_H_
+#define _BIRD_SHA256_HMAC_H_
 
 #define SHA256_SIZE            32
 #define SHA256_HEX_SIZE                65
@@ -34,4 +34,4 @@ void sha256_hmac_init(sha256_hmac_context *ctx, const void *key, size_t keylen);
 void sha256_hmac_update(sha256_hmac_context *ctx, const void *buf, size_t buflen);
 const byte *sha256_hmac_final(sha256_hmac_context *ctx);
 
-#endif /* SHA256_HMAC_H */
+#endif /* _BIRD_SHA256_HMAC_H_ */