comparison lib/md2.c @ 9659:5680cf5b5595

md2: clarify comments to say that alignment is not required. * lib/md2.h: Remove warning about alignment in comment. * lib/md2.c (md2_read_ctx, md2_finish_ctx): Doc fix, alignment has never been required.
author Simon Josefsson <simon@josefsson.org>
date Thu, 31 Jan 2008 11:10:36 +0100
parents a88f85e4728f
children e8fbc5424b99
comparison
equal deleted inserted replaced
9658:b704008db267 9659:5680cf5b5595
1 /* Functions to compute MD2 message digest of files or memory blocks. 1 /* Functions to compute MD2 message digest of files or memory blocks.
2 according to the definition of MD2 in RFC 1319 from April 1992. 2 according to the definition of MD2 in RFC 1319 from April 1992.
3 Copyright (C) 1995,1996,1997,1999,2000,2001,2002,2003,2005,2006 3 Copyright (C) 1995,1996,1997,1999,2000,2001,2002,2003,2005,2006,2008
4 Free Software Foundation, Inc. 4 Free Software Foundation, Inc.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the 7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any 8 Free Software Foundation; either version 2, or (at your option) any
51 memset (ctx->buf, 0, sizeof (ctx->buf)); 51 memset (ctx->buf, 0, sizeof (ctx->buf));
52 ctx->curlen = 0; 52 ctx->curlen = 0;
53 } 53 }
54 54
55 /* Put result from CTX in first 16 bytes following RESBUF. The result 55 /* Put result from CTX in first 16 bytes following RESBUF. The result
56 must be in little endian byte order. 56 must be in little endian byte order. */
57
58 IMPORTANT: On some systems it is required that RESBUF is correctly
59 aligned for a 32 bits value. */
60 void * 57 void *
61 md2_read_ctx (const struct md2_ctx *ctx, void *resbuf) 58 md2_read_ctx (const struct md2_ctx *ctx, void *resbuf)
62 { 59 {
63 memcpy (resbuf, ctx->X, 16); 60 memcpy (resbuf, ctx->X, 16);
64 61
65 return resbuf; 62 return resbuf;
66 } 63 }
67 64
68 /* Process the remaining bytes in the internal buffer and the usual 65 /* Process the remaining bytes in the internal buffer and the usual
69 prolog according to the standard and write the result to RESBUF. 66 prolog according to the standard and write the result to RESBUF. */
70
71 IMPORTANT: On some systems it is required that RESBUF is correctly
72 aligned for a 32 bits value. */
73 void * 67 void *
74 md2_finish_ctx (struct md2_ctx *ctx, void *resbuf) 68 md2_finish_ctx (struct md2_ctx *ctx, void *resbuf)
75 { 69 {
76 unsigned long i, k; 70 unsigned long i, k;
77 71