md5: Add const qualifiers
This commit is contained in:
parent
4ed2811210
commit
e856f0a920
2 changed files with 6 additions and 6 deletions
10
md5.c
10
md5.c
|
|
@ -46,7 +46,7 @@
|
|||
* doesn't work.
|
||||
*/
|
||||
#if defined(__i386__) || defined(__vax__)
|
||||
# define SET(n) (*(MD5_u32plus *)&ptr[(n) * 4])
|
||||
# define SET(n) (*(const MD5_u32plus *)&ptr[(n) * 4])
|
||||
# define GET(n) SET(n)
|
||||
#else
|
||||
# define SET(n) \
|
||||
|
|
@ -63,9 +63,9 @@
|
|||
* This processes one or more 64-byte data blocks, but does NOT update
|
||||
* the bit counters. There're no alignment requirements.
|
||||
*/
|
||||
static void *body(MD5_CTX *ctx, void *data, unsigned long size)
|
||||
static const void *body(MD5_CTX *ctx, const void *data, unsigned long size)
|
||||
{
|
||||
unsigned char *ptr;
|
||||
const unsigned char *ptr;
|
||||
MD5_u32plus a, b, c, d;
|
||||
MD5_u32plus saved_a, saved_b, saved_c, saved_d;
|
||||
|
||||
|
|
@ -181,7 +181,7 @@ void MD5_Init(MD5_CTX *ctx)
|
|||
ctx->hi = 0;
|
||||
}
|
||||
|
||||
void MD5_Update(MD5_CTX *ctx, void *data, unsigned long size)
|
||||
void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size)
|
||||
{
|
||||
MD5_u32plus saved_lo;
|
||||
unsigned long used, free;
|
||||
|
|
@ -205,7 +205,7 @@ void MD5_Update(MD5_CTX *ctx, void *data, unsigned long size)
|
|||
}
|
||||
|
||||
memcpy(&ctx->buffer[used], data, free);
|
||||
data = (unsigned char *)data + free;
|
||||
data = (const unsigned char *)data + free;
|
||||
size -= free;
|
||||
body(ctx, ctx->buffer, MD5_BLOCK_SZ);
|
||||
}
|
||||
|
|
|
|||
2
md5.h
2
md5.h
|
|
@ -23,7 +23,7 @@ typedef struct {
|
|||
} MD5_CTX;
|
||||
|
||||
extern void MD5_Init(MD5_CTX *ctx);
|
||||
extern void MD5_Update(MD5_CTX *ctx, void *data, unsigned long size);
|
||||
extern void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size);
|
||||
extern void MD5_Final(unsigned char *result, MD5_CTX *ctx);
|
||||
|
||||
#endif /* __MD5_H__ */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue