crc.c File Reference
SIGNATURE.
`#include "system.h"`
`#include "crc.h"`
`#include "debug.h"`
Include dependency graph for crc.c:

Go to the source code of this file.

## Macros

#define | BASE 65521UL /* largest prime smaller than 65536 */
#define | NMAX 5552
#define | DO1(buf, i) {adler += (rpmuint32_t) (buf)[i]; sum2 += adler;}
#define | DO2(buf, i) DO1(buf,i); DO1(buf,i+1);
#define | DO4(buf, i) DO2(buf,i); DO2(buf,i+2);
#define | DO8(buf, i) DO4(buf,i); DO4(buf,i+4);
#define | DO16(buf) DO8(buf,0); DO8(buf,8);
#define | MOD(a) a %= BASE
#define | MOD4(a) a %= BASE

## Functions

rpmuint32_t | __crc32 (rpmuint32_t crc, const rpmuint8_t *data, size_t size)
static rpmuint32_t | gf2_matrix_times32 (rpmuint32_t *mat, rpmuint32_t vec)
static void | gf2_matrix_square32 (rpmuint32_t *square, rpmuint32_t *mat)
rpmuint32_t | __crc32_combine (rpmuint32_t crc1, rpmuint32_t crc2, size_t len2)
rpmuint64_t | __crc64 (rpmuint64_t crc, const rpmuint8_t *data, size_t size)
static rpmuint64_t | gf2_matrix_times64 (rpmuint64_t *mat, rpmuint64_t vec)
static void | gf2_matrix_square64 (rpmuint64_t *square, rpmuint64_t *mat)
rpmuint64_t | __crc64_combine (rpmuint64_t crc1, rpmuint64_t crc2, size_t len2)
rpmuint32_t | __adler32 (rpmuint32_t adler, const rpmuint8_t *buf, rpmuint32_t len)
rpmuint32_t | __adler32_combine (rpmuint32_t adler1, rpmuint32_t adler2, size_t len2)
int | sum32Reset (register sum32Param *mp)
int | sum32Update (sum32Param *mp, const rpmuint8_t *data, size_t size)
int | sum32Digest (sum32Param *mp, rpmuint8_t *data)
int | sum64Reset (register sum64Param *mp)
int | sum64Update (sum64Param *mp, const rpmuint8_t *data, size_t size)
int | sum64Digest (sum64Param *mp, rpmuint8_t *data)

## Variables

static int | gf2_dim32 = 32
static int | gf2_dim64 = 64

## Macro Definition Documentation

#define BASE 65521UL /* largest prime smaller than 65536 */

Definition at line 266 of file crc.c.

Referenced by __adler32(), and __adler32_combine().

#define DO1 | ( |  | buf,
|  |  | i
| ) |  | {adler += (rpmuint32_t) (buf)[i]; sum2 += adler;}

Definition at line 270 of file crc.c.

#define DO16 | ( |  | buf | ) | DO8(buf,0); DO8(buf,8);

Definition at line 274 of file crc.c.

Referenced by __adler32().

#define DO2 | ( |  | buf,
|  |  | i
| ) |  | DO1(buf,i); DO1(buf,i+1);

Definition at line 271 of file crc.c.

#define DO4 | ( |  | buf,
|  |  | i
| ) |  | DO2(buf,i); DO2(buf,i+2);

Definition at line 272 of file crc.c.

#define DO8 | ( |  | buf,
|  |  | i
| ) |  | DO4(buf,i); DO4(buf,i+4);

Definition at line 273 of file crc.c.

#define MOD | ( |  | a | ) | a %= BASE

Definition at line 307 of file crc.c.

Referenced by __adler32(), and __adler32_combine().

#define MOD4 | ( |  | a | ) | a %= BASE

Definition at line 308 of file crc.c.

Referenced by __adler32().

#define NMAX 5552

Definition at line 267 of file crc.c.

Referenced by __adler32().

## Function Documentation

rpmuint32_t __adler32 | ( | rpmuint32_t | adler,
|  | const rpmuint8_t * | buf,
|  | rpmuint32_t | len
| ) |  |

Definition at line 311 of file crc.c.

References BASE, DO16, MOD, MOD4, and NMAX.

Referenced by rpmDigestInit().

rpmuint32_t __adler32_combine | ( | rpmuint32_t | adler1,
|  | rpmuint32_t | adler2,
|  | size_t | len2
| ) |  |

Definition at line 378 of file crc.c.

References BASE, and MOD.

Referenced by rpmDigestInit().

rpmuint32_t __crc32 | ( | rpmuint32_t | crc,
|  | const rpmuint8_t * | data,
|  | size_t | size
| ) |  |

Definition at line 10 of file crc.c.

References crc().

Referenced by rpmDigestInit().

rpmuint32_t __crc32_combine | ( | rpmuint32_t | crc1,
|  | rpmuint32_t | crc2,
|  | size_t | len2
| ) |  |

Definition at line 79 of file crc.c.

References alloca(), gf2_dim32, gf2_matrix_square32(), and gf2_matrix_times32().

Referenced by rpmDigestInit().

rpmuint64_t __crc64 | ( | rpmuint64_t | crc,
|  | const rpmuint8_t * | data,
|  | size_t | size
| ) |  |

Definition at line 137 of file crc.c.

References crc().

Referenced by rpmDigestInit().

rpmuint64_t __crc64_combine | ( | rpmuint64_t | crc1,
|  | rpmuint64_t | crc2,
|  | size_t | len2
| ) |  |

Definition at line 207 of file crc.c.

References alloca(), gf2_dim64, gf2_matrix_square64(), and gf2_matrix_times64().

Referenced by rpmDigestInit().

static void gf2_matrix_square32 | ( | rpmuint32_t * | square,
|  | rpmuint32_t * | mat
| ) |  |

static

Definition at line 70 of file crc.c.

References gf2_dim32, and gf2_matrix_times32().

Referenced by __crc32_combine().

static void gf2_matrix_square64 | ( | rpmuint64_t * | square,
|  | rpmuint64_t * | mat
| ) |  |

static

Definition at line 198 of file crc.c.

References gf2_dim64, and gf2_matrix_times64().

Referenced by __crc64_combine().

static rpmuint32_t gf2_matrix_times32 | ( | rpmuint32_t * | mat,
|  | rpmuint32_t | vec
| ) |  |

static

Definition at line 53 of file crc.c.

Referenced by __crc32_combine(), and gf2_matrix_square32().

static rpmuint64_t gf2_matrix_times64 | ( | rpmuint64_t * | mat,
|  | rpmuint64_t | vec
| ) |  |

static

Definition at line 181 of file crc.c.

Referenced by __crc64_combine(), and gf2_matrix_square64().

int sum32Digest | ( | sum32Param * | mp,
|  | rpmuint8_t * | data
| ) |  |

Definition at line 413 of file crc.c.

References sum32Param::crc, and sum32Reset().

Referenced by rpmDigestInit().

int sum32Reset | ( | register sum32Param * | mp | ) |

Definition at line 399 of file crc.c.

References sum32Param::crc, and sum32Param::update.

Referenced by rpmDigestInit(), and sum32Digest().

int sum32Update | ( | sum32Param * | mp,
|  | const rpmuint8_t * | data,
|  | size_t | size
| ) |  |

Definition at line 406 of file crc.c.

References sum32Param::crc, and sum32Param::update.

Referenced by rpmDigestInit().

int sum64Digest | ( | sum64Param * | mp,
|  | rpmuint8_t * | data
| ) |  |

Definition at line 441 of file crc.c.

References sum64Param::crc, and sum64Reset().

Referenced by rpmDigestInit().

int sum64Reset | ( | register sum64Param * | mp | ) |

Definition at line 427 of file crc.c.

References sum64Param::crc, and sum64Param::update.

Referenced by rpmDigestInit(), and sum64Digest().

int sum64Update | ( | sum64Param * | mp,
|  | const rpmuint8_t * | data,
|  | size_t | size
| ) |  |

Definition at line 434 of file crc.c.

References sum64Param::crc, and sum64Param::update.

Referenced by rpmDigestInit().

## Variable Documentation

int gf2_dim32 = 32

static

Definition at line 49 of file crc.c.

Referenced by __crc32_combine(), and gf2_matrix_square32().

int gf2_dim64 = 64

static

Definition at line 177 of file crc.c.

Referenced by __crc64_combine(), and gf2_matrix_square64().