LLVMFuzzerTestOneInput:
   42|    262|extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
   43|       |
   44|    262|  if (!size)
  ------------------
  |  Branch (44:7): [True: 0, False: 262]
  ------------------
   45|      0|    return 0;
   46|       |
   47|    262|  FuzzedDataProvider stream(data, size);
   48|    262|  hash_state *hs;
   49|    262|  if (init(&hs))
  ------------------
  |  |   28|    262|#define init CONCAT_TYPE(_init)
  |  |  ------------------
  |  |  |  |   26|    262|#define CONCAT_TYPE(x) _PASTE2(HASHTYPE, x)
  |  |  |  |  ------------------
  |  |  |  |  |  |   59|    262|#define _PASTE2(x,y) _PASTE(x,y)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    262|#define _PASTE(x,y) x##y
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (49:7): [True: 0, False: 262]
  ------------------
   50|      0|    return 0;
   51|       |
   52|  1.28k|  while (stream.remaining_bytes()) {
  ------------------
  |  Branch (52:10): [True: 1.15k, False: 121]
  ------------------
   53|  1.15k|    size_t num_bytes = stream.ConsumeIntegral<size_t>();
   54|  1.15k|    std::vector<uint8_t> buffer = stream.ConsumeBytes<uint8_t>(num_bytes);
   55|       |
   56|  1.15k|    if (update(hs, buffer.data(), buffer.size()))
  ------------------
  |  |   29|  1.15k|#define update CONCAT_TYPE(_update)
  |  |  ------------------
  |  |  |  |   26|  1.15k|#define CONCAT_TYPE(x) _PASTE2(HASHTYPE, x)
  |  |  |  |  ------------------
  |  |  |  |  |  |   59|  1.15k|#define _PASTE2(x,y) _PASTE(x,y)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  1.15k|#define _PASTE(x,y) x##y
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (56:9): [True: 141, False: 1.01k]
  ------------------
   57|    141|      goto error;
   58|  1.15k|  }
   59|       |
   60|    121|  uint8_t result[DIGEST_SIZE];
   61|       |
   62|    121|#ifndef DIGEST_THIRD_PARAM
   63|    121|  digest(hs, result);
  ------------------
  |  |   30|    121|#define digest CONCAT_TYPE(_digest)
  |  |  ------------------
  |  |  |  |   26|    121|#define CONCAT_TYPE(x) _PASTE2(HASHTYPE, x)
  |  |  |  |  ------------------
  |  |  |  |  |  |   59|    121|#define _PASTE2(x,y) _PASTE(x,y)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    121|#define _PASTE(x,y) x##y
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   64|       |#else
   65|       |  digest(hs, result, DIGEST_SIZE);
   66|       |#endif
   67|       |
   68|    262|error:
   69|    262|  destroy(hs);
  ------------------
  |  |   31|    262|#define destroy CONCAT_TYPE(_destroy)
  |  |  ------------------
  |  |  |  |   26|    262|#define CONCAT_TYPE(x) _PASTE2(HASHTYPE, x)
  |  |  |  |  ------------------
  |  |  |  |  |  |   59|    262|#define _PASTE2(x,y) _PASTE(x,y)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    262|#define _PASTE(x,y) x##y
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   70|    262|  return 0;
   71|    121|}

_Z14ripemd160_initPP10hash_state:
  146|    262|{
  147|    262|    hash_state *hs;
  148|       |    
  149|       |    /* Initial values for the chaining variables.
  150|       |    * This is just 0123456789ABCDEFFEDCBA9876543210F0E1D2C3 in little-endian. */
  151|    262|    static const uint32_t initial_h[5] = { 0x67452301u, 0xEFCDAB89u, 0x98BADCFEu, 0x10325476u, 0xC3D2E1F0u };
  152|       |
  153|    262|    if (NULL == ripemd160State) {
  ------------------
  |  Branch (153:9): [True: 0, False: 262]
  ------------------
  154|      0|        return ERR_NULL;
  ------------------
  |  |    5|      0|#define ERR_NULL                1
  ------------------
  155|      0|    }
  156|       |
  157|    262|    *ripemd160State = hs = (hash_state*) calloc(1, sizeof(hash_state));
  158|    262|    if (NULL == hs)
  ------------------
  |  Branch (158:9): [True: 0, False: 262]
  ------------------
  159|      0|        return ERR_MEMORY;
  ------------------
  |  |    6|      0|#define ERR_MEMORY              2
  ------------------
  160|       |
  161|    262|    memcpy(hs->h, initial_h, RIPEMD160_DIGEST_SIZE);
  ------------------
  |  |   51|    262|#define RIPEMD160_DIGEST_SIZE 20
  ------------------
  162|    262|    return 0;
  163|    262|}
_Z17ripemd160_destroyP10hash_state:
  166|    262|{
  167|    262|    free(hs);
  168|    262|    return 0;
  169|    262|}
_Z16ripemd160_updateP10hash_statePKhm:
  260|  1.15k|{
  261|  1.15k|    unsigned int bytes_needed;
  262|       |
  263|  1.15k|    if (NULL==hs || NULL==in)
  ------------------
  |  Branch (263:9): [True: 0, False: 1.15k]
  |  Branch (263:21): [True: 141, False: 1.01k]
  ------------------
  264|    141|        return ERR_NULL;
  ------------------
  |  |    5|    141|#define ERR_NULL                1
  ------------------
  265|       |
  266|   231k|    while (len > 0) {
  ------------------
  |  Branch (266:12): [True: 231k, False: 215]
  ------------------
  267|       |        /* Figure out how many bytes we need to fill the internal buffer. */
  268|   231k|        bytes_needed = 64 - hs->bufpos;
  269|       |
  270|   231k|        if (len >= bytes_needed) {
  ------------------
  |  Branch (270:13): [True: 230k, False: 803]
  ------------------
  271|       |            /* We have enough bytes, so copy them into the internal buffer and run
  272|       |             * the compression function. */
  273|   230k|            memcpy(&hs->buf[hs->bufpos], in, bytes_needed);
  274|   230k|            hs->bufpos += bytes_needed;
  275|   230k|            hs->length += bytes_needed * 8;    /* length is in bits */
  276|   230k|            in += bytes_needed;
  277|   230k|            ripemd160_compress(hs);
  278|   230k|            len -= bytes_needed;
  279|   230k|            continue;
  280|   230k|        }
  281|       |
  282|       |        /* We do not have enough bytes to fill the internal buffer.
  283|       |         * Copy what's there and return. */
  284|    803|        memcpy(&hs->buf[hs->bufpos], in, len);
  285|    803|        hs->bufpos += (unsigned)len;
  286|    803|        hs->length += (unsigned)(len * 8);    /* length is in bits */
  287|    803|        return 0;
  288|   231k|    }
  289|       |
  290|    215|    return 0;
  291|  1.01k|}
_Z16ripemd160_digestPK10hash_statePh:
  304|    121|{
  305|    121|    hash_state tmp;
  306|    121|    unsigned i;
  307|       |
  308|    121|    if (NULL==hs || digest==NULL)
  ------------------
  |  |   30|    121|#define digest CONCAT_TYPE(_digest)
  |  |  ------------------
  |  |  |  |   26|    121|#define CONCAT_TYPE(x) _PASTE2(HASHTYPE, x)
  |  |  |  |  ------------------
  |  |  |  |  |  |   59|    121|#define _PASTE2(x,y) _PASTE(x,y)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    121|#define _PASTE(x,y) x##y
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (308:9): [True: 0, False: 121]
  |  Branch (308:21): [True: 0, False: 121]
  ------------------
  309|      0|        return ERR_NULL;
  ------------------
  |  |    5|      0|#define ERR_NULL                1
  ------------------
  310|       |
  311|    121|    tmp = *hs;
  312|       |
  313|       |    /* Append the padding */
  314|    121|    tmp.buf[tmp.bufpos++] = 0x80;
  315|       |
  316|    121|    if (tmp.bufpos > 56) {
  ------------------
  |  Branch (316:9): [True: 47, False: 74]
  ------------------
  317|     47|        tmp.bufpos = 64;
  318|     47|        ripemd160_compress(&tmp);
  319|     47|    }
  320|       |
  321|       |    /* Append the length */
  322|    121|    STORE_U64_LITTLE(&tmp.buf[sizeof tmp.buf - 8], tmp.length);
  ------------------
  |  |  184|    121|#define STORE_U64_LITTLE(p, w) u64to8_little((p), &(w))
  ------------------
  323|    121|    tmp.bufpos = 64;
  324|    121|    ripemd160_compress(&tmp);
  325|       |
  326|       |    /* Copy the final state into the output buffer */
  327|    121|    assert(RIPEMD160_DIGEST_SIZE == sizeof tmp.h);
  ------------------
  |  Branch (327:5): [True: 121, Folded]
  ------------------
  328|    726|    for (i=0; i<5; i++)
  ------------------
  |  Branch (328:15): [True: 605, False: 121]
  ------------------
  329|    605|        STORE_U32_LITTLE(digest + i*sizeof tmp.h[0], tmp.h[i]);
  ------------------
  |  |   98|    726|#define STORE_U32_LITTLE(p, w) u32to8_little((p), &(w))
  ------------------
  330|       |
  331|    121|    return 0;
  332|    121|}
pcd_hash_fuzzer.cc:_ZL18ripemd160_compressP10hash_state:
  173|   230k|{
  174|   230k|    unsigned w, round;
  175|   230k|    uint32_t T;
  176|   230k|    uint32_t AL, BL, CL, DL, EL;    /* left line */
  177|   230k|    uint32_t AR, BR, CR, DR, ER;    /* right line */
  178|   230k|    uint32_t bufw[16];
  179|       |
  180|  3.92M|    for (w=0; w<16; w++)
  ------------------
  |  Branch (180:15): [True: 3.69M, False: 230k]
  ------------------
  181|  3.69M|        bufw[w] = LOAD_U32_LITTLE(&self->buf[w*4]);
  ------------------
  |  |   95|  3.69M|#define LOAD_U32_LITTLE(p) load_u8to32_little(p)
  ------------------
  182|       |
  183|       |    /* Load the left and right lines with the initial state */
  184|   230k|    AL = AR = self->h[0];
  185|   230k|    BL = BR = self->h[1];
  186|   230k|    CL = CR = self->h[2];
  187|   230k|    DL = DR = self->h[3];
  188|   230k|    EL = ER = self->h[4];
  189|       |
  190|       |    /* Round 1 */
  191|   230k|    round = 0;
  192|  3.92M|    for (w = 0; w < 16; w++) { /* left line */
  ------------------
  |  Branch (192:17): [True: 3.69M, False: 230k]
  ------------------
  193|  3.69M|        T = ROL(SL[round][w], AL + F1(BL, CL, DL) + bufw[RL[round][w]] + KL[round]) + EL;
  ------------------
  |  |   63|  3.69M|#define ROL(s, n) (((n) << (s)) | ((n) >> (32-(s))))
  ------------------
  194|  3.69M|        AL = EL; EL = DL; DL = ROL(10, CL); CL = BL; BL = T;
  ------------------
  |  |   63|  3.69M|#define ROL(s, n) (((n) << (s)) | ((n) >> (32-(s))))
  ------------------
  195|  3.69M|    }
  196|  3.92M|    for (w = 0; w < 16; w++) { /* right line */
  ------------------
  |  Branch (196:17): [True: 3.69M, False: 230k]
  ------------------
  197|  3.69M|        T = ROL(SR[round][w], AR + F5(BR, CR, DR) + bufw[RR[round][w]] + KR[round]) + ER;
  ------------------
  |  |   63|  3.69M|#define ROL(s, n) (((n) << (s)) | ((n) >> (32-(s))))
  ------------------
  198|  3.69M|        AR = ER; ER = DR; DR = ROL(10, CR); CR = BR; BR = T;
  ------------------
  |  |   63|  3.69M|#define ROL(s, n) (((n) << (s)) | ((n) >> (32-(s))))
  ------------------
  199|  3.69M|    }
  200|       |
  201|       |    /* Round 2 */
  202|   230k|    round++;
  203|  3.92M|    for (w = 0; w < 16; w++) { /* left line */
  ------------------
  |  Branch (203:17): [True: 3.69M, False: 230k]
  ------------------
  204|  3.69M|        T = ROL(SL[round][w], AL + F2(BL, CL, DL) + bufw[RL[round][w]] + KL[round]) + EL;
  ------------------
  |  |   63|  3.69M|#define ROL(s, n) (((n) << (s)) | ((n) >> (32-(s))))
  ------------------
  205|  3.69M|        AL = EL; EL = DL; DL = ROL(10, CL); CL = BL; BL = T;
  ------------------
  |  |   63|  3.69M|#define ROL(s, n) (((n) << (s)) | ((n) >> (32-(s))))
  ------------------
  206|  3.69M|    }
  207|  3.92M|    for (w = 0; w < 16; w++) { /* right line */
  ------------------
  |  Branch (207:17): [True: 3.69M, False: 230k]
  ------------------
  208|  3.69M|        T = ROL(SR[round][w], AR + F4(BR, CR, DR) + bufw[RR[round][w]] + KR[round]) + ER;
  ------------------
  |  |   63|  3.69M|#define ROL(s, n) (((n) << (s)) | ((n) >> (32-(s))))
  ------------------
  209|  3.69M|        AR = ER; ER = DR; DR = ROL(10, CR); CR = BR; BR = T;
  ------------------
  |  |   63|  3.69M|#define ROL(s, n) (((n) << (s)) | ((n) >> (32-(s))))
  ------------------
  210|  3.69M|    }
  211|       |
  212|       |    /* Round 3 */
  213|   230k|    round++;
  214|  3.92M|    for (w = 0; w < 16; w++) { /* left line */
  ------------------
  |  Branch (214:17): [True: 3.69M, False: 230k]
  ------------------
  215|  3.69M|        T = ROL(SL[round][w], AL + F3(BL, CL, DL) + bufw[RL[round][w]] + KL[round]) + EL;
  ------------------
  |  |   63|  3.69M|#define ROL(s, n) (((n) << (s)) | ((n) >> (32-(s))))
  ------------------
  216|  3.69M|        AL = EL; EL = DL; DL = ROL(10, CL); CL = BL; BL = T;
  ------------------
  |  |   63|  3.69M|#define ROL(s, n) (((n) << (s)) | ((n) >> (32-(s))))
  ------------------
  217|  3.69M|    }
  218|  3.92M|    for (w = 0; w < 16; w++) { /* right line */
  ------------------
  |  Branch (218:17): [True: 3.69M, False: 230k]
  ------------------
  219|  3.69M|        T = ROL(SR[round][w], AR + F3(BR, CR, DR) + bufw[RR[round][w]] + KR[round]) + ER;
  ------------------
  |  |   63|  3.69M|#define ROL(s, n) (((n) << (s)) | ((n) >> (32-(s))))
  ------------------
  220|  3.69M|        AR = ER; ER = DR; DR = ROL(10, CR); CR = BR; BR = T;
  ------------------
  |  |   63|  3.69M|#define ROL(s, n) (((n) << (s)) | ((n) >> (32-(s))))
  ------------------
  221|  3.69M|    }
  222|       |
  223|       |    /* Round 4 */
  224|   230k|    round++;
  225|  3.92M|    for (w = 0; w < 16; w++) { /* left line */
  ------------------
  |  Branch (225:17): [True: 3.69M, False: 230k]
  ------------------
  226|  3.69M|        T = ROL(SL[round][w], AL + F4(BL, CL, DL) + bufw[RL[round][w]] + KL[round]) + EL;
  ------------------
  |  |   63|  3.69M|#define ROL(s, n) (((n) << (s)) | ((n) >> (32-(s))))
  ------------------
  227|  3.69M|        AL = EL; EL = DL; DL = ROL(10, CL); CL = BL; BL = T;
  ------------------
  |  |   63|  3.69M|#define ROL(s, n) (((n) << (s)) | ((n) >> (32-(s))))
  ------------------
  228|  3.69M|    }
  229|  3.92M|    for (w = 0; w < 16; w++) { /* right line */
  ------------------
  |  Branch (229:17): [True: 3.69M, False: 230k]
  ------------------
  230|  3.69M|        T = ROL(SR[round][w], AR + F2(BR, CR, DR) + bufw[RR[round][w]] + KR[round]) + ER;
  ------------------
  |  |   63|  3.69M|#define ROL(s, n) (((n) << (s)) | ((n) >> (32-(s))))
  ------------------
  231|  3.69M|        AR = ER; ER = DR; DR = ROL(10, CR); CR = BR; BR = T;
  ------------------
  |  |   63|  3.69M|#define ROL(s, n) (((n) << (s)) | ((n) >> (32-(s))))
  ------------------
  232|  3.69M|    }
  233|       |
  234|       |    /* Round 5 */
  235|   230k|    round++;
  236|  3.92M|    for (w = 0; w < 16; w++) { /* left line */
  ------------------
  |  Branch (236:17): [True: 3.69M, False: 230k]
  ------------------
  237|  3.69M|        T = ROL(SL[round][w], AL + F5(BL, CL, DL) + bufw[RL[round][w]] + KL[round]) + EL;
  ------------------
  |  |   63|  3.69M|#define ROL(s, n) (((n) << (s)) | ((n) >> (32-(s))))
  ------------------
  238|  3.69M|        AL = EL; EL = DL; DL = ROL(10, CL); CL = BL; BL = T;
  ------------------
  |  |   63|  3.69M|#define ROL(s, n) (((n) << (s)) | ((n) >> (32-(s))))
  ------------------
  239|  3.69M|    }
  240|  3.92M|    for (w = 0; w < 16; w++) { /* right line */
  ------------------
  |  Branch (240:17): [True: 3.69M, False: 230k]
  ------------------
  241|  3.69M|        T = ROL(SR[round][w], AR + F1(BR, CR, DR) + bufw[RR[round][w]] + KR[round]) + ER;
  ------------------
  |  |   63|  3.69M|#define ROL(s, n) (((n) << (s)) | ((n) >> (32-(s))))
  ------------------
  242|  3.69M|        AR = ER; ER = DR; DR = ROL(10, CR); CR = BR; BR = T;
  ------------------
  |  |   63|  3.69M|#define ROL(s, n) (((n) << (s)) | ((n) >> (32-(s))))
  ------------------
  243|  3.69M|    }
  244|       |
  245|       |    /* Final mixing stage */
  246|   230k|    T = self->h[1] + CL + DR;
  247|   230k|    self->h[1] = self->h[2] + DL + ER;
  248|   230k|    self->h[2] = self->h[3] + EL + AR;
  249|   230k|    self->h[3] = self->h[4] + AL + BR;
  250|   230k|    self->h[4] = self->h[0] + BL + CR;
  251|   230k|    self->h[0] = T;
  252|       |
  253|       |    /* Clear the buffer and wipe the temporary variables */
  254|   230k|    T = AL = BL = CL = DL = EL = AR = BR = CR = DR = ER = 0;
  255|   230k|    memset(&self->buf, 0, sizeof(self->buf));
  256|   230k|    self->bufpos = 0;
  257|   230k|}

pcd_hash_fuzzer.cc:_ZL18load_u8to32_littlePKh:
   80|  3.69M|{
   81|  3.69M|    uint32_t w;
   82|       |
   83|  3.69M|    u8to32_little(&w, p);
   84|  3.69M|    return w;
   85|  3.69M|}
pcd_hash_fuzzer.cc:_ZL13u8to32_littlePjPKh:
   50|  3.69M|{
   51|       |#ifdef PYCRYPTO_LITTLE_ENDIAN
   52|       |    memcpy(w, p, 4);
   53|       |#else
   54|  3.69M|    *w = (uint32_t)p[0] | (uint32_t)p[1]<<8 | (uint32_t)p[2]<<16 | (uint32_t)p[3]<<24;
   55|  3.69M|#endif
   56|  3.69M|}
pcd_hash_fuzzer.cc:_ZL13u64to8_littlePhPKm:
  102|    121|{
  103|       |#ifdef PYCRYPTO_LITTLE_ENDIAN
  104|       |    memcpy(p, w, 8);
  105|       |#else
  106|    121|    p[0] = (uint8_t)*w;
  107|    121|    p[1] = (uint8_t)(*w >> 8);
  108|    121|    p[2] = (uint8_t)(*w >> 16);
  109|    121|    p[3] = (uint8_t)(*w >> 24);
  110|    121|    p[4] = (uint8_t)(*w >> 32);
  111|    121|    p[5] = (uint8_t)(*w >> 40);
  112|    121|    p[6] = (uint8_t)(*w >> 48);
  113|    121|    p[7] = (uint8_t)(*w >> 56);
  114|    121|#endif
  115|    121|}
pcd_hash_fuzzer.cc:_ZL13u32to8_littlePhPKj:
   38|    605|{
   39|       |#ifdef PYCRYPTO_LITTLE_ENDIAN
   40|       |    memcpy(p, w, 4);
   41|       |#else
   42|    605|    p[0] = (uint8_t)*w;
   43|    605|    p[1] = (uint8_t)(*w >> 8);
   44|    605|    p[2] = (uint8_t)(*w >> 16);
   45|    605|    p[3] = (uint8_t)(*w >> 24);
   46|    605|#endif
   47|    605|}

