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

_Z14ripemd160_initPP10hash_state:
  146|    272|{
  147|    272|    hash_state *hs;
  148|       |    
  149|       |    /* Initial values for the chaining variables.
  150|       |    * This is just 0123456789ABCDEFFEDCBA9876543210F0E1D2C3 in little-endian. */
  151|    272|    static const uint32_t initial_h[5] = { 0x67452301u, 0xEFCDAB89u, 0x98BADCFEu, 0x10325476u, 0xC3D2E1F0u };
  152|       |
  153|    272|    if (NULL == ripemd160State) {
  ------------------
  |  Branch (153:9): [True: 0, False: 272]
  ------------------
  154|      0|        return ERR_NULL;
  ------------------
  |  |    5|      0|#define ERR_NULL                1
  ------------------
  155|      0|    }
  156|       |
  157|    272|    *ripemd160State = hs = (hash_state*) calloc(1, sizeof(hash_state));
  158|    272|    if (NULL == hs)
  ------------------
  |  Branch (158:9): [True: 0, False: 272]
  ------------------
  159|      0|        return ERR_MEMORY;
  ------------------
  |  |    6|      0|#define ERR_MEMORY              2
  ------------------
  160|       |
  161|    272|    memcpy(hs->h, initial_h, RIPEMD160_DIGEST_SIZE);
  ------------------
  |  |   51|    272|#define RIPEMD160_DIGEST_SIZE 20
  ------------------
  162|    272|    return 0;
  163|    272|}
_Z17ripemd160_destroyP10hash_state:
  166|    272|{
  167|    272|    free(hs);
  168|    272|    return 0;
  169|    272|}
_Z16ripemd160_updateP10hash_statePKhm:
  260|  1.36k|{
  261|  1.36k|    unsigned int bytes_needed;
  262|  1.36k|    unsigned bufpos;
  263|       |
  264|  1.36k|    if (NULL==hs || NULL==in)
  ------------------
  |  Branch (264:9): [True: 0, False: 1.36k]
  |  Branch (264:21): [True: 140, False: 1.22k]
  ------------------
  265|    140|        return ERR_NULL;
  ------------------
  |  |    5|    140|#define ERR_NULL                1
  ------------------
  266|       |
  267|       |    /*
  268|       |     * Read the position in buf[] only once, and check it: if several
  269|       |     * threads used the object at once (not supported), the state could
  270|       |     * be inconsistent, but buf[] must never overflow.
  271|       |     */
  272|  1.22k|    bufpos = hs->bufpos;
  273|  1.22k|    if (bufpos >= 64)
  ------------------
  |  Branch (273:9): [True: 0, False: 1.22k]
  ------------------
  274|      0|        return ERR_STATE;
  ------------------
  |  |   26|      0|#define ERR_STATE               20
  ------------------
  275|       |
  276|   231k|    while (len > 0) {
  ------------------
  |  Branch (276:12): [True: 231k, False: 402]
  ------------------
  277|       |        /* Figure out how many bytes we need to fill the internal buffer. */
  278|   231k|        bytes_needed = 64 - bufpos;
  279|       |
  280|   231k|        if (len >= bytes_needed) {
  ------------------
  |  Branch (280:13): [True: 230k, False: 822]
  ------------------
  281|       |            /* We have enough bytes, so copy them into the internal buffer and run
  282|       |             * the compression function. */
  283|   230k|            memcpy(&hs->buf[bufpos], in, bytes_needed);
  284|   230k|            hs->length += bytes_needed * 8;    /* length is in bits */
  285|   230k|            in += bytes_needed;
  286|   230k|            ripemd160_compress(hs);
  287|   230k|            bufpos = 0;
  288|   230k|            len -= bytes_needed;
  289|   230k|            continue;
  290|   230k|        }
  291|       |
  292|       |        /* We do not have enough bytes to fill the internal buffer.
  293|       |         * Copy what's there and return. */
  294|    822|        memcpy(&hs->buf[bufpos], in, len);
  295|    822|        bufpos += (unsigned)len;
  296|    822|        hs->length += (unsigned)(len * 8);    /* length is in bits */
  297|    822|        break;
  298|   231k|    }
  299|       |
  300|  1.22k|    hs->bufpos = bufpos;
  301|  1.22k|    return 0;
  302|  1.22k|}
_Z16ripemd160_digestPK10hash_statePh:
  315|    132|{
  316|    132|    hash_state tmp;
  317|    132|    unsigned i;
  318|       |
  319|    132|    if (NULL==hs || digest==NULL)
  ------------------
  |  |   30|    132|#define digest CONCAT_TYPE(_digest)
  |  |  ------------------
  |  |  |  |   26|    132|#define CONCAT_TYPE(x) _PASTE2(HASHTYPE, x)
  |  |  |  |  ------------------
  |  |  |  |  |  |   33|    132|#define _PASTE2(x,y) _PASTE(x,y)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   32|    132|#define _PASTE(x,y) x##y
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (319:9): [True: 0, False: 132]
  |  Branch (319:21): [True: 0, False: 132]
  ------------------
  320|      0|        return ERR_NULL;
  ------------------
  |  |    5|      0|#define ERR_NULL                1
  ------------------
  321|       |
  322|    132|    tmp = *hs;
  323|       |    /* tmp is a private copy, but it may come from an inconsistent state */
  324|    132|    if (tmp.bufpos >= 64)
  ------------------
  |  Branch (324:9): [True: 0, False: 132]
  ------------------
  325|      0|        return ERR_STATE;
  ------------------
  |  |   26|      0|#define ERR_STATE               20
  ------------------
  326|       |
  327|       |    /* Append the padding */
  328|    132|    tmp.buf[tmp.bufpos++] = 0x80;
  329|       |
  330|    132|    if (tmp.bufpos > 56) {
  ------------------
  |  Branch (330:9): [True: 52, False: 80]
  ------------------
  331|     52|        tmp.bufpos = 64;
  332|     52|        ripemd160_compress(&tmp);
  333|     52|    }
  334|       |
  335|       |    /* Append the length */
  336|    132|    STORE_U64_LITTLE(&tmp.buf[sizeof tmp.buf - 8], tmp.length);
  ------------------
  |  |  158|    132|#define STORE_U64_LITTLE(p, w) u64to8_little((p), &(w))
  ------------------
  337|    132|    tmp.bufpos = 64;
  338|    132|    ripemd160_compress(&tmp);
  339|       |
  340|       |    /* Copy the final state into the output buffer */
  341|    132|    assert(RIPEMD160_DIGEST_SIZE == sizeof tmp.h);
  ------------------
  |  Branch (341:5): [True: 132, Folded]
  ------------------
  342|    792|    for (i=0; i<5; i++)
  ------------------
  |  Branch (342:15): [True: 660, False: 132]
  ------------------
  343|    660|        STORE_U32_LITTLE(digest + i*sizeof tmp.h[0], tmp.h[i]);
  ------------------
  |  |   72|    792|#define STORE_U32_LITTLE(p, w) u32to8_little((p), &(w))
  ------------------
  344|       |
  345|    132|    return 0;
  346|    132|}
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]);
  ------------------
  |  |   69|  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:
   54|  3.69M|{
   55|  3.69M|    uint32_t w;
   56|       |
   57|  3.69M|    u8to32_little(&w, p);
   58|  3.69M|    return w;
   59|  3.69M|}
pcd_hash_fuzzer.cc:_ZL13u8to32_littlePjPKh:
   24|  3.69M|{
   25|       |#ifdef PYCRYPTO_LITTLE_ENDIAN
   26|       |    memcpy(w, p, 4);
   27|       |#else
   28|  3.69M|    *w = (uint32_t)p[0] | (uint32_t)p[1]<<8 | (uint32_t)p[2]<<16 | (uint32_t)p[3]<<24;
   29|  3.69M|#endif
   30|  3.69M|}
pcd_hash_fuzzer.cc:_ZL13u64to8_littlePhPKm:
   76|    132|{
   77|       |#ifdef PYCRYPTO_LITTLE_ENDIAN
   78|       |    memcpy(p, w, 8);
   79|       |#else
   80|    132|    p[0] = (uint8_t)*w;
   81|    132|    p[1] = (uint8_t)(*w >> 8);
   82|    132|    p[2] = (uint8_t)(*w >> 16);
   83|    132|    p[3] = (uint8_t)(*w >> 24);
   84|    132|    p[4] = (uint8_t)(*w >> 32);
   85|    132|    p[5] = (uint8_t)(*w >> 40);
   86|    132|    p[6] = (uint8_t)(*w >> 48);
   87|    132|    p[7] = (uint8_t)(*w >> 56);
   88|    132|#endif
   89|    132|}
pcd_hash_fuzzer.cc:_ZL13u32to8_littlePhPKj:
   12|    660|{
   13|       |#ifdef PYCRYPTO_LITTLE_ENDIAN
   14|       |    memcpy(p, w, 4);
   15|       |#else
   16|    660|    p[0] = (uint8_t)*w;
   17|    660|    p[1] = (uint8_t)(*w >> 8);
   18|    660|    p[2] = (uint8_t)(*w >> 16);
   19|    660|    p[3] = (uint8_t)(*w >> 24);
   20|    660|#endif
   21|    660|}

