[PATCH] CRC 32, CRC 32 a'la RFC 1510, CRC 24 a'la RFC 2440

Simon Josefsson jas@extundo.com
Mon, 20 Jan 2003 20:40:05 +0100


Simon Josefsson <jas@extundo.com> writes:

> +  while (inlen--) {
> +    ctx->CRC ^= (*inbuf++) << 16;
> +    for (i = 0; i < 8; i++) {
> +      ctx->CRC <<= 1;
> +      if (ctx->CRC & 0x1000000)
> +	ctx->CRC ^= CRC24_POLY;
> +    }
> +  }

I forgot to credit the CRC-24 loop, consider adding the following
comment above the CRC-24 function.  I am sorry for neglecting this.

/*
 * The following CRC 24 routines are adapted from RFC 2440, which has
 * the following copyright notice:
 *
 *   Copyright (C) The Internet Society (1998).  All Rights Reserved.
 *
 *   This document and translations of it may be copied and furnished
 *   to others, and derivative works that comment on or otherwise
 *   explain it or assist in its implementation may be prepared,
 *   copied, published and distributed, in whole or in part, without
 *   restriction of any kind, provided that the above copyright notice
 *   and this paragraph are included on all such copies and derivative
 *   works.  However, this document itself may not be modified in any
 *   way, such as by removing the copyright notice or references to
 *   the Internet Society or other Internet organizations, except as
 *   needed for the purpose of developing Internet standards in which
 *   case the procedures for copyrights defined in the Internet
 *   Standards process must be followed, or as required to translate
 *   it into languages other than English.
 *
 *   The limited permissions granted above are perpetual and will not be
 *   revoked by the Internet Society or its successors or assigns.
 *
 *   This document and the information contained herein is provided on
 *   an "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET
 *   ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR
 *   IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE
 *   OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY
 *   IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
 *   PURPOSE.
 */