2 * Copyright © 2000 Keith Packard
3 * Copyright © 2005 Patrick Lam
5 * Permission to use, copy, modify, distribute, and sell this software and its
6 * documentation for any purpose is hereby granted without fee, provided that
7 * the above copyright notice appear in all copies and that both that
8 * copyright notice and this permission notice appear in supporting
9 * documentation, and that the name of Keith Packard not be used in
10 * advertising or publicity pertaining to distribution of the software without
11 * specific, written prior permission. Keith Packard makes no
12 * representations about the suitability of this software for any purpose. It
13 * is provided "as is" without express or implied warranty.
15 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
17 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
19 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
20 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
21 * PERFORMANCE OF THIS SOFTWARE.
25 #include "../fc-arch/fcarch.h"
30 #include <sys/types.h>
32 #if defined(HAVE_MMAP) || defined(__CYGWIN__)
34 # include <sys/mman.h>
49 static void MD5Init(struct MD5Context *ctx);
50 static void MD5Update(struct MD5Context *ctx, unsigned char *buf, unsigned len);
51 static void MD5Final(unsigned char digest[16], struct MD5Context *ctx);
52 static void MD5Transform(FcChar32 buf[4], FcChar32 in[16]);
54 #define CACHEBASE_LEN (1 + 32 + 1 + sizeof (FC_ARCHITECTURE) + sizeof (FC_CACHE_SUFFIX))
56 static const char bin2hex[] = { '0', '1', '2', '3',
62 FcDirCacheBasename (const FcChar8 * dir, FcChar8 cache_base[CACHEBASE_LEN])
64 unsigned char hash[16];
67 struct MD5Context ctx;
70 MD5Update (&ctx, (unsigned char *)dir, strlen ((char *) dir));
72 MD5Final (hash, &ctx);
75 hex_hash = cache_base + 1;
76 for (cnt = 0; cnt < 16; ++cnt)
78 hex_hash[2*cnt ] = bin2hex[hash[cnt] >> 4];
79 hex_hash[2*cnt+1] = bin2hex[hash[cnt] & 0xf];
82 strcat ((char *) cache_base, "-" FC_ARCHITECTURE FC_CACHE_SUFFIX);
88 FcDirCacheUnlink (const FcChar8 *dir, FcConfig *config)
90 FcChar8 *cache_hashed = NULL;
91 FcChar8 cache_base[CACHEBASE_LEN];
95 FcDirCacheBasename (dir, cache_base);
97 list = FcStrListCreate (config->cacheDirs);
101 while ((cache_dir = FcStrListNext (list)))
103 cache_hashed = FcStrPlus (cache_dir, cache_base);
106 (void) unlink ((char *) cache_hashed);
107 FcStrFree (cache_hashed);
109 FcStrListDone (list);
110 /* return FcFalse if something went wrong */
117 FcDirCacheOpenFile (const FcChar8 *cache_file, struct stat *file_stat)
121 fd = open((char *) cache_file, O_RDONLY | O_BINARY);
124 if (fstat (fd, file_stat) < 0)
133 * Look for a cache file for the specified dir. Attempt
134 * to use each one we find, stopping when the callback
138 FcDirCacheProcess (FcConfig *config, const FcChar8 *dir,
139 FcBool (*callback) (int fd, struct stat *stat, void *closure),
140 void *closure, FcChar8 **cache_file_ret)
143 FcChar8 cache_base[CACHEBASE_LEN];
146 struct stat file_stat, dir_stat;
147 FcBool ret = FcFalse;
149 if (stat ((char *) dir, &dir_stat) < 0)
152 FcDirCacheBasename (dir, cache_base);
154 list = FcStrListCreate (config->cacheDirs);
158 while ((cache_dir = FcStrListNext (list)))
160 FcChar8 *cache_hashed = FcStrPlus (cache_dir, cache_base);
163 fd = FcDirCacheOpenFile (cache_hashed, &file_stat);
165 if (dir_stat.st_mtime <= file_stat.st_mtime)
167 ret = (*callback) (fd, &file_stat, closure);
171 *cache_file_ret = cache_hashed;
173 FcStrFree (cache_hashed);
180 FcStrFree (cache_hashed);
182 FcStrListDone (list);
187 #define FC_CACHE_MIN_MMAP 1024
190 * Skip list element, make sure the 'next' pointer is the last thing
191 * in the structure, it will be allocated large enough to hold all
192 * of the necessary pointers
195 typedef struct _FcCacheSkip FcCacheSkip;
197 struct _FcCacheSkip {
204 FcCacheSkip *next[1];
208 * The head of the skip list; pointers for every possible level
209 * in the skip list, plus the largest level in the list
212 #define FC_CACHE_MAX_LEVEL 16
214 static FcCacheSkip *fcCacheChains[FC_CACHE_MAX_LEVEL];
215 static int fcCacheMaxLevel;
218 # define FcRandom() random()
221 # define FcRandom() lrand48()
224 # define FcRandom() rand()
229 * Generate a random level number, distributed
230 * so that each level is 1/4 as likely as the one before
232 * Note that level numbers run 1 <= level <= MAX_LEVEL
237 /* tricky bit -- each bit is '1' 75% of the time */
238 long int bits = FcRandom () | FcRandom ();
241 while (++level < FC_CACHE_MAX_LEVEL)
251 * Insert cache into the list
254 FcCacheInsert (FcCache *cache, struct stat *cache_stat)
256 FcCacheSkip **update[FC_CACHE_MAX_LEVEL];
257 FcCacheSkip *s, **next;
261 * Find links along each chain
263 next = fcCacheChains;
264 for (i = fcCacheMaxLevel; --i >= 0; )
266 for (; (s = next[i]); next = s->next)
267 if (s->cache > cache)
269 update[i] = &next[i];
273 * Create new list element
275 level = random_level ();
276 if (level > fcCacheMaxLevel)
278 level = fcCacheMaxLevel + 1;
279 update[fcCacheMaxLevel] = &fcCacheChains[fcCacheMaxLevel];
280 fcCacheMaxLevel = level;
283 s = malloc (sizeof (FcCacheSkip) + (level - 1) * sizeof (FcCacheSkip *));
288 s->size = cache->size;
292 s->cache_dev = cache_stat->st_dev;
293 s->cache_ino = cache_stat->st_ino;
294 s->cache_mtime = cache_stat->st_mtime;
304 * Insert into all fcCacheChains
306 for (i = 0; i < level; i++)
308 s->next[i] = *update[i];
315 FcCacheFindByAddr (void *object)
318 FcCacheSkip **next = fcCacheChains;
322 * Walk chain pointers one level at a time
324 for (i = fcCacheMaxLevel; --i >= 0;)
325 while (next[i] && (char *) object >= ((char *) next[i]->cache + next[i]->size))
326 next = next[i]->next;
331 if (s && (char *) object < ((char *) s->cache + s->size))
337 FcCacheRemove (FcCache *cache)
339 FcCacheSkip **update[FC_CACHE_MAX_LEVEL];
340 FcCacheSkip *s, **next;
344 * Find links along each chain
346 next = fcCacheChains;
347 for (i = fcCacheMaxLevel; --i >= 0; )
349 for (; (s = next[i]); next = s->next)
350 if (s->cache >= cache)
352 update[i] = &next[i];
355 for (i = 0; i < fcCacheMaxLevel && *update[i] == s; i++)
356 *update[i] = s->next[i];
357 while (fcCacheMaxLevel > 0 && fcCacheChains[fcCacheMaxLevel - 1] == NULL)
363 FcCacheFindByStat (struct stat *cache_stat)
367 for (s = fcCacheChains[0]; s; s = s->next[0])
368 if (s->cache_dev == cache_stat->st_dev &&
369 s->cache_ino == cache_stat->st_ino &&
370 s->cache_mtime == cache_stat->st_mtime)
379 FcDirCacheDispose (FcCache *cache)
381 switch (cache->magic) {
382 case FC_CACHE_MAGIC_ALLOC:
385 case FC_CACHE_MAGIC_MMAP:
386 #if defined(HAVE_MMAP) || defined(__CYGWIN__)
387 munmap (cache, cache->size);
388 #elif defined(_WIN32)
389 UnmapViewOfFile (cache);
393 FcCacheRemove (cache);
397 FcCacheObjectReference (void *object)
399 FcCacheSkip *skip = FcCacheFindByAddr (object);
406 FcCacheObjectDereference (void *object)
408 FcCacheSkip *skip = FcCacheFindByAddr (object);
414 FcDirCacheDispose (skip->cache);
423 for (i = 0; i < FC_CACHE_MAX_LEVEL; i++)
424 assert (fcCacheChains[i] == NULL);
425 assert (fcCacheMaxLevel == 0);
429 * Map a cache file into memory
432 FcDirCacheMapFd (int fd, struct stat *fd_stat)
435 FcBool allocated = FcFalse;
437 if (fd_stat->st_size < sizeof (FcCache))
439 cache = FcCacheFindByStat (fd_stat);
443 * For small cache files, just read them into memory
445 if (fd_stat->st_size >= FC_CACHE_MIN_MMAP)
447 #if defined(HAVE_MMAP) || defined(__CYGWIN__)
448 cache = mmap (0, fd_stat->st_size, PROT_READ, MAP_SHARED, fd, 0);
449 #elif defined(_WIN32)
454 hFileMap = CreateFileMapping((HANDLE) _get_osfhandle(fd), NULL,
455 PAGE_READONLY, 0, 0, NULL);
456 if (hFileMap != NULL)
458 cache = MapViewOfFile (hFileMap, FILE_MAP_READ, 0, 0,
460 CloseHandle (hFileMap);
467 cache = malloc (fd_stat->st_size);
471 if (read (fd, cache, fd_stat->st_size) != fd_stat->st_size)
478 if (cache->magic != FC_CACHE_MAGIC_MMAP ||
479 cache->version < FC_CACHE_CONTENT_VERSION ||
480 cache->size != fd_stat->st_size ||
481 !FcCacheInsert (cache, fd_stat))
487 #if defined(HAVE_MMAP) || defined(__CYGWIN__)
488 munmap (cache, fd_stat->st_size);
489 #elif defined(_WIN32)
490 UnmapViewOfFile (cache);
496 /* Mark allocated caches so they're freed rather than unmapped */
498 cache->magic = FC_CACHE_MAGIC_ALLOC;
504 FcDirCacheReference (FcCache *cache, int nref)
506 FcCacheSkip *skip = FcCacheFindByAddr (cache);
513 FcDirCacheUnload (FcCache *cache)
515 FcCacheObjectDereference (cache);
519 FcDirCacheMapHelper (int fd, struct stat *fd_stat, void *closure)
521 FcCache *cache = FcDirCacheMapFd (fd, fd_stat);
525 *((FcCache **) closure) = cache;
530 FcDirCacheLoad (const FcChar8 *dir, FcConfig *config, FcChar8 **cache_file)
532 FcCache *cache = NULL;
534 if (!FcDirCacheProcess (config, dir,
542 FcDirCacheLoadFile (const FcChar8 *cache_file, struct stat *file_stat)
547 fd = FcDirCacheOpenFile (cache_file, file_stat);
550 cache = FcDirCacheMapFd (fd, file_stat);
556 * Validate a cache file by reading the header and checking
557 * the magic number and the size field
560 FcDirCacheValidateHelper (int fd, struct stat *fd_stat, void *closure)
565 if (read (fd, &c, sizeof (FcCache)) != sizeof (FcCache))
567 else if (c.magic != FC_CACHE_MAGIC_MMAP)
569 else if (c.version < FC_CACHE_CONTENT_VERSION)
571 else if (fd_stat->st_size != c.size)
577 FcDirCacheValidConfig (const FcChar8 *dir, FcConfig *config)
579 return FcDirCacheProcess (config, dir,
580 FcDirCacheValidateHelper,
585 FcDirCacheValid (const FcChar8 *dir)
589 config = FcConfigGetCurrent ();
593 return FcDirCacheValidConfig (dir, config);
597 * Build a cache structure from the given contents
600 FcDirCacheBuild (FcFontSet *set, const FcChar8 *dir, FcStrSet *dirs)
602 FcSerialize *serialize = FcSerializeCreate ();
605 intptr_t cache_offset;
606 intptr_t dirs_offset;
607 FcChar8 *dir_serialize;
608 intptr_t *dirs_serialize;
609 FcFontSet *set_serialize;
614 * Space for cache structure
616 cache_offset = FcSerializeReserve (serialize, sizeof (FcCache));
620 if (!FcStrSerializeAlloc (serialize, dir))
625 dirs_offset = FcSerializeAlloc (serialize, dirs, dirs->num * sizeof (FcChar8 *));
626 for (i = 0; i < dirs->num; i++)
627 if (!FcStrSerializeAlloc (serialize, dirs->strs[i]))
633 if (!FcFontSetSerializeAlloc (serialize, set))
636 /* Serialize layout complete. Now allocate space and fill it */
637 cache = malloc (serialize->size);
640 /* shut up valgrind */
641 memset (cache, 0, serialize->size);
643 serialize->linear = cache;
645 cache->magic = FC_CACHE_MAGIC_ALLOC;
646 cache->version = FC_CACHE_CONTENT_VERSION;
647 cache->size = serialize->size;
650 * Serialize directory name
652 dir_serialize = FcStrSerialize (serialize, dir);
655 cache->dir = FcPtrToOffset (cache, dir_serialize);
660 dirs_serialize = FcSerializePtr (serialize, dirs);
663 cache->dirs = FcPtrToOffset (cache, dirs_serialize);
664 cache->dirs_count = dirs->num;
665 for (i = 0; i < dirs->num; i++)
667 FcChar8 *d_serialize = FcStrSerialize (serialize, dirs->strs[i]);
670 dirs_serialize[i] = FcPtrToOffset (dirs_serialize, d_serialize);
676 set_serialize = FcFontSetSerialize (serialize, set);
679 cache->set = FcPtrToOffset (cache, set_serialize);
681 FcSerializeDestroy (serialize);
683 FcCacheInsert (cache, NULL);
690 FcSerializeDestroy (serialize);
696 #define mkdir(path,mode) _mkdir(path)
700 FcMakeDirectory (const FcChar8 *dir)
705 if (strlen ((char *) dir) == 0)
708 parent = FcStrDirname (dir);
711 if (access ((char *) parent, W_OK|X_OK) == 0)
712 ret = mkdir ((char *) dir, 0777) == 0;
713 else if (access ((char *) parent, F_OK) == -1)
714 ret = FcMakeDirectory (parent) && (mkdir ((char *) dir, 0777) == 0);
721 /* write serialized state to the cache file */
723 FcDirCacheWrite (FcCache *cache, FcConfig *config)
725 FcChar8 *dir = FcCacheDir (cache);
726 FcChar8 cache_base[CACHEBASE_LEN];
727 FcChar8 *cache_hashed;
731 FcChar8 *cache_dir = NULL;
737 * Write it to the first directory in the list which is writable
740 list = FcStrListCreate (config->cacheDirs);
743 while ((test_dir = FcStrListNext (list))) {
744 if (access ((char *) test_dir, W_OK|X_OK) == 0)
746 cache_dir = test_dir;
752 * If the directory doesn't exist, try to create it
754 if (access ((char *) test_dir, F_OK) == -1) {
755 if (FcMakeDirectory (test_dir))
757 cache_dir = test_dir;
763 FcStrListDone (list);
767 FcDirCacheBasename (dir, cache_base);
768 cache_hashed = FcStrPlus (cache_dir, cache_base);
772 if (FcDebug () & FC_DBG_CACHE)
773 printf ("FcDirCacheWriteDir dir \"%s\" file \"%s\"\n",
776 atomic = FcAtomicCreate ((FcChar8 *)cache_hashed);
780 if (!FcAtomicLock (atomic))
783 fd = open((char *)FcAtomicNewFile (atomic), O_RDWR | O_CREAT | O_BINARY, 0666);
787 /* Temporarily switch magic to MMAP while writing to file */
788 magic = cache->magic;
789 if (magic != FC_CACHE_MAGIC_MMAP)
790 cache->magic = FC_CACHE_MAGIC_MMAP;
793 * Write cache contents to file
795 written = write (fd, cache, cache->size);
797 /* Switch magic back */
798 if (magic != FC_CACHE_MAGIC_MMAP)
799 cache->magic = magic;
801 if (written != cache->size)
803 perror ("write cache");
808 if (!FcAtomicReplaceOrig(atomic))
810 FcStrFree (cache_hashed);
811 FcAtomicUnlock (atomic);
812 FcAtomicDestroy (atomic);
818 FcAtomicUnlock (atomic);
820 FcAtomicDestroy (atomic);
822 FcStrFree (cache_hashed);
827 * Hokey little macro trick to permit the definitions of C functions
828 * with the same name as CPP macros
831 #define args2(x,y) (x,y)
834 FcCacheDir args1(const FcCache *c)
836 return FcCacheDir (c);
840 FcCacheCopySet args1(const FcCache *c)
842 FcFontSet *old = FcCacheSet (c);
843 FcFontSet *new = FcFontSetCreate ();
848 for (i = 0; i < old->nfont; i++)
850 FcPattern *font = FcFontSetFont (old, i);
852 FcPatternReference (font);
853 if (!FcFontSetAdd (new, font))
855 FcFontSetDestroy (new);
863 FcCacheSubdir args2(const FcCache *c, int i)
865 return FcCacheSubdir (c, i);
869 FcCacheNumSubdir args1(const FcCache *c)
871 return c->dirs_count;
875 FcCacheNumFont args1(const FcCache *c)
877 return FcCacheSet(c)->nfont;
881 * This code implements the MD5 message-digest algorithm.
882 * The algorithm is due to Ron Rivest. This code was
883 * written by Colin Plumb in 1993, no copyright is claimed.
884 * This code is in the public domain; do with it what you wish.
886 * Equivalent code is available from RSA Data Security, Inc.
887 * This code has been tested against that, and is equivalent,
888 * except that you don't need to include two pages of legalese
891 * To compute the message digest of a chunk of bytes, declare an
892 * MD5Context structure, pass it to MD5Init, call MD5Update as
893 * needed on buffers full of bytes, and then call MD5Final, which
894 * will fill a supplied 16-byte array with the digest.
898 #define byteReverse(buf, len) /* Nothing */
901 * Note: this code is harmless on little-endian machines.
903 void byteReverse(unsigned char *buf, unsigned longs)
907 t = (FcChar32) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
908 ((unsigned) buf[1] << 8 | buf[0]);
909 *(FcChar32 *) buf = t;
916 * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
917 * initialization constants.
919 static void MD5Init(struct MD5Context *ctx)
921 ctx->buf[0] = 0x67452301;
922 ctx->buf[1] = 0xefcdab89;
923 ctx->buf[2] = 0x98badcfe;
924 ctx->buf[3] = 0x10325476;
931 * Update context to reflect the concatenation of another buffer full
934 static void MD5Update(struct MD5Context *ctx, unsigned char *buf, unsigned len)
938 /* Update bitcount */
941 if ((ctx->bits[0] = t + ((FcChar32) len << 3)) < t)
942 ctx->bits[1]++; /* Carry from low to high */
943 ctx->bits[1] += len >> 29;
945 t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */
947 /* Handle any leading odd-sized chunks */
950 unsigned char *p = (unsigned char *) ctx->in + t;
958 byteReverse(ctx->in, 16);
959 MD5Transform(ctx->buf, (FcChar32 *) ctx->in);
963 /* Process data in 64-byte chunks */
966 memcpy(ctx->in, buf, 64);
967 byteReverse(ctx->in, 16);
968 MD5Transform(ctx->buf, (FcChar32 *) ctx->in);
973 /* Handle any remaining bytes of data. */
975 memcpy(ctx->in, buf, len);
979 * Final wrapup - pad to 64-byte boundary with the bit pattern
980 * 1 0* (64-bit count of bits processed, MSB-first)
982 static void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
987 /* Compute number of bytes mod 64 */
988 count = (ctx->bits[0] >> 3) & 0x3F;
990 /* Set the first char of padding to 0x80. This is safe since there is
991 always at least one byte free */
995 /* Bytes of padding needed to make 64 bytes */
996 count = 64 - 1 - count;
998 /* Pad out to 56 mod 64 */
1000 /* Two lots of padding: Pad the first block to 64 bytes */
1001 memset(p, 0, count);
1002 byteReverse(ctx->in, 16);
1003 MD5Transform(ctx->buf, (FcChar32 *) ctx->in);
1005 /* Now fill the next block with 56 bytes */
1006 memset(ctx->in, 0, 56);
1008 /* Pad block to 56 bytes */
1009 memset(p, 0, count - 8);
1011 byteReverse(ctx->in, 14);
1013 /* Append length in bits and transform */
1014 ((FcChar32 *) ctx->in)[14] = ctx->bits[0];
1015 ((FcChar32 *) ctx->in)[15] = ctx->bits[1];
1017 MD5Transform(ctx->buf, (FcChar32 *) ctx->in);
1018 byteReverse((unsigned char *) ctx->buf, 4);
1019 memcpy(digest, ctx->buf, 16);
1020 memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
1024 /* The four core functions - F1 is optimized somewhat */
1026 /* #define F1(x, y, z) (x & y | ~x & z) */
1027 #define F1(x, y, z) (z ^ (x & (y ^ z)))
1028 #define F2(x, y, z) F1(z, x, y)
1029 #define F3(x, y, z) (x ^ y ^ z)
1030 #define F4(x, y, z) (y ^ (x | ~z))
1032 /* This is the central step in the MD5 algorithm. */
1033 #define MD5STEP(f, w, x, y, z, data, s) \
1034 ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
1037 * The core of the MD5 algorithm, this alters an existing MD5 hash to
1038 * reflect the addition of 16 longwords of new data. MD5Update blocks
1039 * the data and converts bytes into longwords for this routine.
1041 static void MD5Transform(FcChar32 buf[4], FcChar32 in[16])
1043 register FcChar32 a, b, c, d;
1050 MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
1051 MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
1052 MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
1053 MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
1054 MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
1055 MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
1056 MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
1057 MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
1058 MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
1059 MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
1060 MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
1061 MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
1062 MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
1063 MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
1064 MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
1065 MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
1067 MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
1068 MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
1069 MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
1070 MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
1071 MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
1072 MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
1073 MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
1074 MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
1075 MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
1076 MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
1077 MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
1078 MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
1079 MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
1080 MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
1081 MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
1082 MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
1084 MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
1085 MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
1086 MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
1087 MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
1088 MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
1089 MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
1090 MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
1091 MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
1092 MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
1093 MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
1094 MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
1095 MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
1096 MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
1097 MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
1098 MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
1099 MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
1101 MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
1102 MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
1103 MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
1104 MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
1105 MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
1106 MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
1107 MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
1108 MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
1109 MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
1110 MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
1111 MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
1112 MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
1113 MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
1114 MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
1115 MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
1116 MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
1124 #include "fcaliastail.h"