mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-23 10:11:53 +00:00
SHA: Fixing small bugs and code style
Thanks to Ondrej Zajicek
This commit is contained in:
parent
c23cd84ed5
commit
17a0035a1c
12
lib/sha1.h
12
lib/sha1.h
@ -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_ */
|
||||
|
@ -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_ */
|
||||
|
@ -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_ */
|
||||
|
Loading…
Reference in New Issue
Block a user