X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/80e2389990082500d76eb566d4946be3e786c3ef..d8f41ccd20de16f8ebe2ccc84d47bf1cb2b26bbb:/authd/crc.h diff --git a/authd/crc.h b/authd/crc.h deleted file mode 100644 index 3459678d..00000000 --- a/authd/crc.h +++ /dev/null @@ -1,53 +0,0 @@ -/* Copyright (c) 2012 Apple Inc. All rights reserved. */ - -#ifndef _SECURITY_AUTH_CRC_H_ -#define _SECURITY_AUTH_CRC_H_ - -#if defined(__cplusplus) -extern "C" { -#endif - -extern const uint64_t _crc_table64[256]; -extern const uint64_t xorout; - -AUTH_INLINE uint64_t -crc64_init() -{ - return xorout; -} - -AUTH_INLINE uint64_t -crc64_final(uint64_t crc) -{ - return crc ^= xorout; -} - -AUTH_INLINE AUTH_NONNULL_ALL uint64_t -crc64_update(uint64_t crc, const void *buf, uint64_t len) -{ - const unsigned char * ptr = (const unsigned char *) buf; - - while (len-- > 0) { - crc = _crc_table64[((crc >> 56) ^ *(ptr++)) & 0xff] ^ (crc << 8); - } - - return crc; -} - -AUTH_INLINE uint64_t -crc64(const void *buf, uint64_t len) -{ - uint64_t crc = crc64_init(); - - crc = crc64_update(crc, buf, len); - - crc = crc64_final(crc); - - return crc; -} - -#if defined(__cplusplus) -} -#endif - -#endif /* !_SECURITY_AUTH_CRC_H_ */