ossl_err_load_ASN1_strings:
  210|      2|{
  211|      2|#ifndef OPENSSL_NO_ERR
  212|      2|    if (ERR_reason_error_string(ASN1_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (212:9): [True: 2, False: 0]
  ------------------
  213|      2|        ERR_load_strings_const(ASN1_str_reasons);
  214|      2|#endif
  215|      2|    return 1;
  216|      2|}

ossl_err_load_ASYNC_strings:
   31|      2|{
   32|      2|#ifndef OPENSSL_NO_ERR
   33|      2|    if (ERR_reason_error_string(ASYNC_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (33:9): [True: 2, False: 0]
  ------------------
   34|      2|        ERR_load_strings_const(ASYNC_str_reasons);
   35|      2|#endif
   36|      2|    return 1;
   37|      2|}

ossl_err_load_BIO_strings:
   93|      2|{
   94|      2|#ifndef OPENSSL_NO_ERR
   95|      2|    if (ERR_reason_error_string(BIO_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (95:9): [True: 2, False: 0]
  ------------------
   96|      2|        ERR_load_strings_const(BIO_str_reasons);
   97|      2|#endif
   98|      2|    return 1;
   99|      2|}

bio_cleanup:
  947|      2|{
  948|      2|#ifndef OPENSSL_NO_SOCK
  949|      2|    bio_sock_cleanup_int();
  950|      2|    CRYPTO_THREAD_lock_free(bio_lookup_lock);
  951|      2|    bio_lookup_lock = NULL;
  952|      2|#endif
  953|      2|    CRYPTO_FREE_REF(&bio_type_count);
  954|      2|}

bio_sock_cleanup_int:
  203|      2|{
  204|       |# ifdef OPENSSL_SYS_WINDOWS
  205|       |    if (wsa_init_done) {
  206|       |        wsa_init_done = 0;
  207|       |        WSACleanup();
  208|       |    }
  209|       |# endif
  210|      2|}

ossl_bio_core_globals_free:
   26|      2|{
   27|      2|    OPENSSL_free(vbcg);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   28|      2|}
ossl_bio_core_globals_new:
   31|      2|{
   32|      2|    return OPENSSL_zalloc(sizeof(BIO_CORE_GLOBALS));
  ------------------
  |  |  104|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   33|      2|}

bn_mul_add_words:
  112|  1.01M|{
  113|  1.01M|    BN_ULONG c1 = 0;
  ------------------
  |  |   37|  1.01M|#  define BN_ULONG        unsigned long
  ------------------
  114|       |
  115|  1.01M|    if (num <= 0)
  ------------------
  |  Branch (115:9): [True: 0, False: 1.01M]
  ------------------
  116|      0|        return c1;
  117|       |
  118|  4.52M|    while (num & ~3) {
  ------------------
  |  Branch (118:12): [True: 3.51M, False: 1.01M]
  ------------------
  119|  3.51M|        mul_add(rp[0], ap[0], w, c1);
  ------------------
  |  |   74|  3.51M|# define mul_add(r,a,word,carry) do {   \
  |  |   75|  3.51M|        register BN_ULONG high,low;     \
  |  |   76|  3.51M|        asm ("mulq %3"                  \
  |  |   77|  3.51M|                : "=a"(low),"=d"(high)  \
  |  |   78|  3.51M|                : "a"(word),"m"(a)      \
  |  |   79|  3.51M|                : "cc");                \
  |  |   80|  3.51M|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   81|  3.51M|                : "+r"(carry),"+d"(high)\
  |  |   82|  3.51M|                : "a"(low),"g"(0)       \
  |  |   83|  3.51M|                : "cc");                \
  |  |   84|  3.51M|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   85|  3.51M|                : "+m"(r),"+d"(high)    \
  |  |   86|  3.51M|                : "r"(carry),"g"(0)     \
  |  |   87|  3.51M|                : "cc");                \
  |  |   88|  3.51M|        carry=high;                     \
  |  |   89|  3.51M|        } while (0)
  |  |  ------------------
  |  |  |  Branch (89:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  120|  3.51M|        mul_add(rp[1], ap[1], w, c1);
  ------------------
  |  |   74|  3.51M|# define mul_add(r,a,word,carry) do {   \
  |  |   75|  3.51M|        register BN_ULONG high,low;     \
  |  |   76|  3.51M|        asm ("mulq %3"                  \
  |  |   77|  3.51M|                : "=a"(low),"=d"(high)  \
  |  |   78|  3.51M|                : "a"(word),"m"(a)      \
  |  |   79|  3.51M|                : "cc");                \
  |  |   80|  3.51M|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   81|  3.51M|                : "+r"(carry),"+d"(high)\
  |  |   82|  3.51M|                : "a"(low),"g"(0)       \
  |  |   83|  3.51M|                : "cc");                \
  |  |   84|  3.51M|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   85|  3.51M|                : "+m"(r),"+d"(high)    \
  |  |   86|  3.51M|                : "r"(carry),"g"(0)     \
  |  |   87|  3.51M|                : "cc");                \
  |  |   88|  3.51M|        carry=high;                     \
  |  |   89|  3.51M|        } while (0)
  |  |  ------------------
  |  |  |  Branch (89:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  121|  3.51M|        mul_add(rp[2], ap[2], w, c1);
  ------------------
  |  |   74|  3.51M|# define mul_add(r,a,word,carry) do {   \
  |  |   75|  3.51M|        register BN_ULONG high,low;     \
  |  |   76|  3.51M|        asm ("mulq %3"                  \
  |  |   77|  3.51M|                : "=a"(low),"=d"(high)  \
  |  |   78|  3.51M|                : "a"(word),"m"(a)      \
  |  |   79|  3.51M|                : "cc");                \
  |  |   80|  3.51M|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   81|  3.51M|                : "+r"(carry),"+d"(high)\
  |  |   82|  3.51M|                : "a"(low),"g"(0)       \
  |  |   83|  3.51M|                : "cc");                \
  |  |   84|  3.51M|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   85|  3.51M|                : "+m"(r),"+d"(high)    \
  |  |   86|  3.51M|                : "r"(carry),"g"(0)     \
  |  |   87|  3.51M|                : "cc");                \
  |  |   88|  3.51M|        carry=high;                     \
  |  |   89|  3.51M|        } while (0)
  |  |  ------------------
  |  |  |  Branch (89:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  122|  3.51M|        mul_add(rp[3], ap[3], w, c1);
  ------------------
  |  |   74|  3.51M|# define mul_add(r,a,word,carry) do {   \
  |  |   75|  3.51M|        register BN_ULONG high,low;     \
  |  |   76|  3.51M|        asm ("mulq %3"                  \
  |  |   77|  3.51M|                : "=a"(low),"=d"(high)  \
  |  |   78|  3.51M|                : "a"(word),"m"(a)      \
  |  |   79|  3.51M|                : "cc");                \
  |  |   80|  3.51M|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   81|  3.51M|                : "+r"(carry),"+d"(high)\
  |  |   82|  3.51M|                : "a"(low),"g"(0)       \
  |  |   83|  3.51M|                : "cc");                \
  |  |   84|  3.51M|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   85|  3.51M|                : "+m"(r),"+d"(high)    \
  |  |   86|  3.51M|                : "r"(carry),"g"(0)     \
  |  |   87|  3.51M|                : "cc");                \
  |  |   88|  3.51M|        carry=high;                     \
  |  |   89|  3.51M|        } while (0)
  |  |  ------------------
  |  |  |  Branch (89:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  123|  3.51M|        ap += 4;
  124|  3.51M|        rp += 4;
  125|  3.51M|        num -= 4;
  126|  3.51M|    }
  127|  1.01M|    if (num) {
  ------------------
  |  Branch (127:9): [True: 787k, False: 225k]
  ------------------
  128|   787k|        mul_add(rp[0], ap[0], w, c1);
  ------------------
  |  |   74|   787k|# define mul_add(r,a,word,carry) do {   \
  |  |   75|   787k|        register BN_ULONG high,low;     \
  |  |   76|   787k|        asm ("mulq %3"                  \
  |  |   77|   787k|                : "=a"(low),"=d"(high)  \
  |  |   78|   787k|                : "a"(word),"m"(a)      \
  |  |   79|   787k|                : "cc");                \
  |  |   80|   787k|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   81|   787k|                : "+r"(carry),"+d"(high)\
  |  |   82|   787k|                : "a"(low),"g"(0)       \
  |  |   83|   787k|                : "cc");                \
  |  |   84|   787k|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   85|   787k|                : "+m"(r),"+d"(high)    \
  |  |   86|   787k|                : "r"(carry),"g"(0)     \
  |  |   87|   787k|                : "cc");                \
  |  |   88|   787k|        carry=high;                     \
  |  |   89|   787k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (89:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  129|   787k|        if (--num == 0)
  ------------------
  |  Branch (129:13): [True: 277k, False: 510k]
  ------------------
  130|   277k|            return c1;
  131|   510k|        mul_add(rp[1], ap[1], w, c1);
  ------------------
  |  |   74|   510k|# define mul_add(r,a,word,carry) do {   \
  |  |   75|   510k|        register BN_ULONG high,low;     \
  |  |   76|   510k|        asm ("mulq %3"                  \
  |  |   77|   510k|                : "=a"(low),"=d"(high)  \
  |  |   78|   510k|                : "a"(word),"m"(a)      \
  |  |   79|   510k|                : "cc");                \
  |  |   80|   510k|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   81|   510k|                : "+r"(carry),"+d"(high)\
  |  |   82|   510k|                : "a"(low),"g"(0)       \
  |  |   83|   510k|                : "cc");                \
  |  |   84|   510k|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   85|   510k|                : "+m"(r),"+d"(high)    \
  |  |   86|   510k|                : "r"(carry),"g"(0)     \
  |  |   87|   510k|                : "cc");                \
  |  |   88|   510k|        carry=high;                     \
  |  |   89|   510k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (89:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  132|   510k|        if (--num == 0)
  ------------------
  |  Branch (132:13): [True: 210k, False: 299k]
  ------------------
  133|   210k|            return c1;
  134|   299k|        mul_add(rp[2], ap[2], w, c1);
  ------------------
  |  |   74|   299k|# define mul_add(r,a,word,carry) do {   \
  |  |   75|   299k|        register BN_ULONG high,low;     \
  |  |   76|   299k|        asm ("mulq %3"                  \
  |  |   77|   299k|                : "=a"(low),"=d"(high)  \
  |  |   78|   299k|                : "a"(word),"m"(a)      \
  |  |   79|   299k|                : "cc");                \
  |  |   80|   299k|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   81|   299k|                : "+r"(carry),"+d"(high)\
  |  |   82|   299k|                : "a"(low),"g"(0)       \
  |  |   83|   299k|                : "cc");                \
  |  |   84|   299k|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   85|   299k|                : "+m"(r),"+d"(high)    \
  |  |   86|   299k|                : "r"(carry),"g"(0)     \
  |  |   87|   299k|                : "cc");                \
  |  |   88|   299k|        carry=high;                     \
  |  |   89|   299k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (89:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  135|   299k|        return c1;
  136|   510k|    }
  137|       |
  138|   225k|    return c1;
  139|  1.01M|}
bn_mul_words:
  142|   873k|{
  143|   873k|    BN_ULONG c1 = 0;
  ------------------
  |  |   37|   873k|#  define BN_ULONG        unsigned long
  ------------------
  144|       |
  145|   873k|    if (num <= 0)
  ------------------
  |  Branch (145:9): [True: 0, False: 873k]
  ------------------
  146|      0|        return c1;
  147|       |
  148|  5.54M|    while (num & ~3) {
  ------------------
  |  Branch (148:12): [True: 4.66M, False: 873k]
  ------------------
  149|  4.66M|        mul(rp[0], ap[0], w, c1);
  ------------------
  |  |   91|  4.66M|# define mul(r,a,word,carry) do {       \
  |  |   92|  4.66M|        register BN_ULONG high,low;     \
  |  |   93|  4.66M|        asm ("mulq %3"                  \
  |  |   94|  4.66M|                : "=a"(low),"=d"(high)  \
  |  |   95|  4.66M|                : "a"(word),"g"(a)      \
  |  |   96|  4.66M|                : "cc");                \
  |  |   97|  4.66M|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   98|  4.66M|                : "+r"(carry),"+d"(high)\
  |  |   99|  4.66M|                : "a"(low),"g"(0)       \
  |  |  100|  4.66M|                : "cc");                \
  |  |  101|  4.66M|        (r)=carry, carry=high;          \
  |  |  102|  4.66M|        } while (0)
  |  |  ------------------
  |  |  |  Branch (102:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  150|  4.66M|        mul(rp[1], ap[1], w, c1);
  ------------------
  |  |   91|  4.66M|# define mul(r,a,word,carry) do {       \
  |  |   92|  4.66M|        register BN_ULONG high,low;     \
  |  |   93|  4.66M|        asm ("mulq %3"                  \
  |  |   94|  4.66M|                : "=a"(low),"=d"(high)  \
  |  |   95|  4.66M|                : "a"(word),"g"(a)      \
  |  |   96|  4.66M|                : "cc");                \
  |  |   97|  4.66M|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   98|  4.66M|                : "+r"(carry),"+d"(high)\
  |  |   99|  4.66M|                : "a"(low),"g"(0)       \
  |  |  100|  4.66M|                : "cc");                \
  |  |  101|  4.66M|        (r)=carry, carry=high;          \
  |  |  102|  4.66M|        } while (0)
  |  |  ------------------
  |  |  |  Branch (102:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  151|  4.66M|        mul(rp[2], ap[2], w, c1);
  ------------------
  |  |   91|  4.66M|# define mul(r,a,word,carry) do {       \
  |  |   92|  4.66M|        register BN_ULONG high,low;     \
  |  |   93|  4.66M|        asm ("mulq %3"                  \
  |  |   94|  4.66M|                : "=a"(low),"=d"(high)  \
  |  |   95|  4.66M|                : "a"(word),"g"(a)      \
  |  |   96|  4.66M|                : "cc");                \
  |  |   97|  4.66M|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   98|  4.66M|                : "+r"(carry),"+d"(high)\
  |  |   99|  4.66M|                : "a"(low),"g"(0)       \
  |  |  100|  4.66M|                : "cc");                \
  |  |  101|  4.66M|        (r)=carry, carry=high;          \
  |  |  102|  4.66M|        } while (0)
  |  |  ------------------
  |  |  |  Branch (102:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  152|  4.66M|        mul(rp[3], ap[3], w, c1);
  ------------------
  |  |   91|  4.66M|# define mul(r,a,word,carry) do {       \
  |  |   92|  4.66M|        register BN_ULONG high,low;     \
  |  |   93|  4.66M|        asm ("mulq %3"                  \
  |  |   94|  4.66M|                : "=a"(low),"=d"(high)  \
  |  |   95|  4.66M|                : "a"(word),"g"(a)      \
  |  |   96|  4.66M|                : "cc");                \
  |  |   97|  4.66M|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   98|  4.66M|                : "+r"(carry),"+d"(high)\
  |  |   99|  4.66M|                : "a"(low),"g"(0)       \
  |  |  100|  4.66M|                : "cc");                \
  |  |  101|  4.66M|        (r)=carry, carry=high;          \
  |  |  102|  4.66M|        } while (0)
  |  |  ------------------
  |  |  |  Branch (102:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  153|  4.66M|        ap += 4;
  154|  4.66M|        rp += 4;
  155|  4.66M|        num -= 4;
  156|  4.66M|    }
  157|   873k|    if (num) {
  ------------------
  |  Branch (157:9): [True: 668k, False: 205k]
  ------------------
  158|   668k|        mul(rp[0], ap[0], w, c1);
  ------------------
  |  |   91|   668k|# define mul(r,a,word,carry) do {       \
  |  |   92|   668k|        register BN_ULONG high,low;     \
  |  |   93|   668k|        asm ("mulq %3"                  \
  |  |   94|   668k|                : "=a"(low),"=d"(high)  \
  |  |   95|   668k|                : "a"(word),"g"(a)      \
  |  |   96|   668k|                : "cc");                \
  |  |   97|   668k|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   98|   668k|                : "+r"(carry),"+d"(high)\
  |  |   99|   668k|                : "a"(low),"g"(0)       \
  |  |  100|   668k|                : "cc");                \
  |  |  101|   668k|        (r)=carry, carry=high;          \
  |  |  102|   668k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (102:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  159|   668k|        if (--num == 0)
  ------------------
  |  Branch (159:13): [True: 314k, False: 353k]
  ------------------
  160|   314k|            return c1;
  161|   353k|        mul(rp[1], ap[1], w, c1);
  ------------------
  |  |   91|   353k|# define mul(r,a,word,carry) do {       \
  |  |   92|   353k|        register BN_ULONG high,low;     \
  |  |   93|   353k|        asm ("mulq %3"                  \
  |  |   94|   353k|                : "=a"(low),"=d"(high)  \
  |  |   95|   353k|                : "a"(word),"g"(a)      \
  |  |   96|   353k|                : "cc");                \
  |  |   97|   353k|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   98|   353k|                : "+r"(carry),"+d"(high)\
  |  |   99|   353k|                : "a"(low),"g"(0)       \
  |  |  100|   353k|                : "cc");                \
  |  |  101|   353k|        (r)=carry, carry=high;          \
  |  |  102|   353k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (102:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  162|   353k|        if (--num == 0)
  ------------------
  |  Branch (162:13): [True: 75.9k, False: 277k]
  ------------------
  163|  75.9k|            return c1;
  164|   277k|        mul(rp[2], ap[2], w, c1);
  ------------------
  |  |   91|   277k|# define mul(r,a,word,carry) do {       \
  |  |   92|   277k|        register BN_ULONG high,low;     \
  |  |   93|   277k|        asm ("mulq %3"                  \
  |  |   94|   277k|                : "=a"(low),"=d"(high)  \
  |  |   95|   277k|                : "a"(word),"g"(a)      \
  |  |   96|   277k|                : "cc");                \
  |  |   97|   277k|        asm ("addq %2,%0; adcq %3,%1"   \
  |  |   98|   277k|                : "+r"(carry),"+d"(high)\
  |  |   99|   277k|                : "a"(low),"g"(0)       \
  |  |  100|   277k|                : "cc");                \
  |  |  101|   277k|        (r)=carry, carry=high;          \
  |  |  102|   277k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (102:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  165|   277k|    }
  166|   482k|    return c1;
  167|   873k|}
bn_sqr_words:
  170|   147k|{
  171|   147k|    if (n <= 0)
  ------------------
  |  Branch (171:9): [True: 0, False: 147k]
  ------------------
  172|      0|        return;
  173|       |
  174|   319k|    while (n & ~3) {
  ------------------
  |  Branch (174:12): [True: 171k, False: 147k]
  ------------------
  175|   171k|        sqr(r[0], r[1], a[0]);
  ------------------
  |  |  105|   171k|        asm ("mulq %2"                  \
  |  |  106|   171k|                : "=a"(r0),"=d"(r1)     \
  |  |  107|   171k|                : "a"(a)                \
  |  |  108|   171k|                : "cc");
  ------------------
  176|   171k|        sqr(r[2], r[3], a[1]);
  ------------------
  |  |  105|   171k|        asm ("mulq %2"                  \
  |  |  106|   171k|                : "=a"(r0),"=d"(r1)     \
  |  |  107|   171k|                : "a"(a)                \
  |  |  108|   171k|                : "cc");
  ------------------
  177|   171k|        sqr(r[4], r[5], a[2]);
  ------------------
  |  |  105|   171k|        asm ("mulq %2"                  \
  |  |  106|   171k|                : "=a"(r0),"=d"(r1)     \
  |  |  107|   171k|                : "a"(a)                \
  |  |  108|   171k|                : "cc");
  ------------------
  178|   171k|        sqr(r[6], r[7], a[3]);
  ------------------
  |  |  105|   171k|        asm ("mulq %2"                  \
  |  |  106|   171k|                : "=a"(r0),"=d"(r1)     \
  |  |  107|   171k|                : "a"(a)                \
  |  |  108|   171k|                : "cc");
  ------------------
  179|   171k|        a += 4;
  180|   171k|        r += 8;
  181|   171k|        n -= 4;
  182|   171k|    }
  183|   147k|    if (n) {
  ------------------
  |  Branch (183:9): [True: 146k, False: 1.33k]
  ------------------
  184|   146k|        sqr(r[0], r[1], a[0]);
  ------------------
  |  |  105|   146k|        asm ("mulq %2"                  \
  |  |  106|   146k|                : "=a"(r0),"=d"(r1)     \
  |  |  107|   146k|                : "a"(a)                \
  |  |  108|   146k|                : "cc");
  ------------------
  185|   146k|        if (--n == 0)
  ------------------
  |  Branch (185:13): [True: 122k, False: 23.9k]
  ------------------
  186|   122k|            return;
  187|  23.9k|        sqr(r[2], r[3], a[1]);
  ------------------
  |  |  105|  23.9k|        asm ("mulq %2"                  \
  |  |  106|  23.9k|                : "=a"(r0),"=d"(r1)     \
  |  |  107|  23.9k|                : "a"(a)                \
  |  |  108|  23.9k|                : "cc");
  ------------------
  188|  23.9k|        if (--n == 0)
  ------------------
  |  Branch (188:13): [True: 7.29k, False: 16.6k]
  ------------------
  189|  7.29k|            return;
  190|  16.6k|        sqr(r[4], r[5], a[2]);
  ------------------
  |  |  105|  16.6k|        asm ("mulq %2"                  \
  |  |  106|  16.6k|                : "=a"(r0),"=d"(r1)     \
  |  |  107|  16.6k|                : "a"(a)                \
  |  |  108|  16.6k|                : "cc");
  ------------------
  191|  16.6k|    }
  192|   147k|}
bn_div_words:
  195|   680k|{
  196|   680k|    BN_ULONG ret, waste;
  ------------------
  |  |   37|   680k|#  define BN_ULONG        unsigned long
  ------------------
  197|       |
  198|   680k| asm("divq      %4":"=a"(ret), "=d"(waste)
  199|   680k| :     "a"(l), "d"(h), "r"(d)
  200|   680k| :     "cc");
  201|       |
  202|   680k|    return ret;
  203|   680k|}
bn_add_words:
  207|  1.48M|{
  208|  1.48M|    BN_ULONG ret;
  ------------------
  |  |   37|  1.48M|#  define BN_ULONG        unsigned long
  ------------------
  209|  1.48M|    size_t i = 0;
  210|       |
  211|  1.48M|    if (n <= 0)
  ------------------
  |  Branch (211:9): [True: 1.25k, False: 1.48M]
  ------------------
  212|  1.25k|        return 0;
  213|       |
  214|  1.48M|    asm volatile ("       subq    %0,%0           \n" /* clear carry */
  215|  1.48M|                  "       jmp     1f              \n"
  216|  1.48M|                  ".p2align 4                     \n"
  217|  1.48M|                  "1:     movq    (%4,%2,8),%0    \n"
  218|  1.48M|                  "       adcq    (%5,%2,8),%0    \n"
  219|  1.48M|                  "       movq    %0,(%3,%2,8)    \n"
  220|  1.48M|                  "       lea     1(%2),%2        \n"
  221|  1.48M|                  "       dec     %1              \n"
  222|  1.48M|                  "       jnz     1b              \n"
  223|  1.48M|                  "       sbbq    %0,%0           \n"
  224|  1.48M|                  :"=&r" (ret), "+c"(n), "+r"(i)
  225|  1.48M|                  :"r"(rp), "r"(ap), "r"(bp)
  226|  1.48M|                  :"cc", "memory");
  227|       |
  228|  1.48M|    return ret & 1;
  229|  1.48M|}
bn_sub_words:
  234|  1.32M|{
  235|  1.32M|    BN_ULONG ret;
  ------------------
  |  |   37|  1.32M|#  define BN_ULONG        unsigned long
  ------------------
  236|  1.32M|    size_t i = 0;
  237|       |
  238|  1.32M|    if (n <= 0)
  ------------------
  |  Branch (238:9): [True: 4.66k, False: 1.31M]
  ------------------
  239|  4.66k|        return 0;
  240|       |
  241|  1.31M|    asm volatile ("       subq    %0,%0           \n" /* clear borrow */
  242|  1.31M|                  "       jmp     1f              \n"
  243|  1.31M|                  ".p2align 4                     \n"
  244|  1.31M|                  "1:     movq    (%4,%2,8),%0    \n"
  245|  1.31M|                  "       sbbq    (%5,%2,8),%0    \n"
  246|  1.31M|                  "       movq    %0,(%3,%2,8)    \n"
  247|  1.31M|                  "       lea     1(%2),%2        \n"
  248|  1.31M|                  "       dec     %1              \n"
  249|  1.31M|                  "       jnz     1b              \n"
  250|  1.31M|                  "       sbbq    %0,%0           \n"
  251|  1.31M|                  :"=&r" (ret), "+c"(n), "+r"(i)
  252|  1.31M|                  :"r"(rp), "r"(ap), "r"(bp)
  253|  1.31M|                  :"cc", "memory");
  254|       |
  255|  1.31M|    return ret & 1;
  256|  1.32M|}
bn_mul_comba8:
  394|   329k|{
  395|   329k|    BN_ULONG c1, c2, c3;
  ------------------
  |  |   37|   329k|#  define BN_ULONG        unsigned long
  ------------------
  396|       |
  397|   329k|    c1 = 0;
  398|   329k|    c2 = 0;
  399|   329k|    c3 = 0;
  400|   329k|    mul_add_c(a[0], b[0], c1, c2, c3);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  401|   329k|    r[0] = c1;
  402|   329k|    c1 = 0;
  403|   329k|    mul_add_c(a[0], b[1], c2, c3, c1);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  404|   329k|    mul_add_c(a[1], b[0], c2, c3, c1);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  405|   329k|    r[1] = c2;
  406|   329k|    c2 = 0;
  407|   329k|    mul_add_c(a[2], b[0], c3, c1, c2);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  408|   329k|    mul_add_c(a[1], b[1], c3, c1, c2);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  409|   329k|    mul_add_c(a[0], b[2], c3, c1, c2);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  410|   329k|    r[2] = c3;
  411|   329k|    c3 = 0;
  412|   329k|    mul_add_c(a[0], b[3], c1, c2, c3);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  413|   329k|    mul_add_c(a[1], b[2], c1, c2, c3);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  414|   329k|    mul_add_c(a[2], b[1], c1, c2, c3);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  415|   329k|    mul_add_c(a[3], b[0], c1, c2, c3);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  416|   329k|    r[3] = c1;
  417|   329k|    c1 = 0;
  418|   329k|    mul_add_c(a[4], b[0], c2, c3, c1);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  419|   329k|    mul_add_c(a[3], b[1], c2, c3, c1);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  420|   329k|    mul_add_c(a[2], b[2], c2, c3, c1);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  421|   329k|    mul_add_c(a[1], b[3], c2, c3, c1);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  422|   329k|    mul_add_c(a[0], b[4], c2, c3, c1);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  423|   329k|    r[4] = c2;
  424|   329k|    c2 = 0;
  425|   329k|    mul_add_c(a[0], b[5], c3, c1, c2);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  426|   329k|    mul_add_c(a[1], b[4], c3, c1, c2);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  427|   329k|    mul_add_c(a[2], b[3], c3, c1, c2);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  428|   329k|    mul_add_c(a[3], b[2], c3, c1, c2);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  429|   329k|    mul_add_c(a[4], b[1], c3, c1, c2);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  430|   329k|    mul_add_c(a[5], b[0], c3, c1, c2);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  431|   329k|    r[5] = c3;
  432|   329k|    c3 = 0;
  433|   329k|    mul_add_c(a[6], b[0], c1, c2, c3);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  434|   329k|    mul_add_c(a[5], b[1], c1, c2, c3);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  435|   329k|    mul_add_c(a[4], b[2], c1, c2, c3);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  436|   329k|    mul_add_c(a[3], b[3], c1, c2, c3);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  437|   329k|    mul_add_c(a[2], b[4], c1, c2, c3);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  438|   329k|    mul_add_c(a[1], b[5], c1, c2, c3);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  439|   329k|    mul_add_c(a[0], b[6], c1, c2, c3);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  440|   329k|    r[6] = c1;
  441|   329k|    c1 = 0;
  442|   329k|    mul_add_c(a[0], b[7], c2, c3, c1);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  443|   329k|    mul_add_c(a[1], b[6], c2, c3, c1);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  444|   329k|    mul_add_c(a[2], b[5], c2, c3, c1);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  445|   329k|    mul_add_c(a[3], b[4], c2, c3, c1);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  446|   329k|    mul_add_c(a[4], b[3], c2, c3, c1);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  447|   329k|    mul_add_c(a[5], b[2], c2, c3, c1);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  448|   329k|    mul_add_c(a[6], b[1], c2, c3, c1);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  449|   329k|    mul_add_c(a[7], b[0], c2, c3, c1);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  450|   329k|    r[7] = c2;
  451|   329k|    c2 = 0;
  452|   329k|    mul_add_c(a[7], b[1], c3, c1, c2);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  453|   329k|    mul_add_c(a[6], b[2], c3, c1, c2);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  454|   329k|    mul_add_c(a[5], b[3], c3, c1, c2);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  455|   329k|    mul_add_c(a[4], b[4], c3, c1, c2);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  456|   329k|    mul_add_c(a[3], b[5], c3, c1, c2);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  457|   329k|    mul_add_c(a[2], b[6], c3, c1, c2);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  458|   329k|    mul_add_c(a[1], b[7], c3, c1, c2);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  459|   329k|    r[8] = c3;
  460|   329k|    c3 = 0;
  461|   329k|    mul_add_c(a[2], b[7], c1, c2, c3);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  462|   329k|    mul_add_c(a[3], b[6], c1, c2, c3);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  463|   329k|    mul_add_c(a[4], b[5], c1, c2, c3);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  464|   329k|    mul_add_c(a[5], b[4], c1, c2, c3);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  465|   329k|    mul_add_c(a[6], b[3], c1, c2, c3);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  466|   329k|    mul_add_c(a[7], b[2], c1, c2, c3);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  467|   329k|    r[9] = c1;
  468|   329k|    c1 = 0;
  469|   329k|    mul_add_c(a[7], b[3], c2, c3, c1);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  470|   329k|    mul_add_c(a[6], b[4], c2, c3, c1);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  471|   329k|    mul_add_c(a[5], b[5], c2, c3, c1);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  472|   329k|    mul_add_c(a[4], b[6], c2, c3, c1);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  473|   329k|    mul_add_c(a[3], b[7], c2, c3, c1);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  474|   329k|    r[10] = c2;
  475|   329k|    c2 = 0;
  476|   329k|    mul_add_c(a[4], b[7], c3, c1, c2);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  477|   329k|    mul_add_c(a[5], b[6], c3, c1, c2);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  478|   329k|    mul_add_c(a[6], b[5], c3, c1, c2);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  479|   329k|    mul_add_c(a[7], b[4], c3, c1, c2);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  480|   329k|    r[11] = c3;
  481|   329k|    c3 = 0;
  482|   329k|    mul_add_c(a[7], b[5], c1, c2, c3);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  483|   329k|    mul_add_c(a[6], b[6], c1, c2, c3);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  484|   329k|    mul_add_c(a[5], b[7], c1, c2, c3);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  485|   329k|    r[12] = c1;
  486|   329k|    c1 = 0;
  487|   329k|    mul_add_c(a[6], b[7], c2, c3, c1);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  488|   329k|    mul_add_c(a[7], b[6], c2, c3, c1);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  489|   329k|    r[13] = c2;
  490|   329k|    c2 = 0;
  491|   329k|    mul_add_c(a[7], b[7], c3, c1, c2);
  ------------------
  |  |  349|   329k|#  define mul_add_c(a,b,c0,c1,c2) do {  \
  |  |  350|   329k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|   329k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  351|   329k|        asm ("mulq %3"                  \
  |  |  352|   329k|                : "=a"(t1),"=d"(t2)     \
  |  |  353|   329k|                : "a"(a),"m"(b)         \
  |  |  354|   329k|                : "cc");                \
  |  |  355|   329k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  356|   329k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  357|   329k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  358|   329k|                : "cc");                                \
  |  |  359|   329k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (359:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  492|   329k|    r[14] = c3;
  493|   329k|    r[15] = c1;
  494|   329k|}
bn_sqr_comba8:
  536|  38.8k|{
  537|  38.8k|    BN_ULONG c1, c2, c3;
  ------------------
  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  ------------------
  538|       |
  539|  38.8k|    c1 = 0;
  540|  38.8k|    c2 = 0;
  541|  38.8k|    c3 = 0;
  542|  38.8k|    sqr_add_c(a, 0, c1, c2, c3);
  ------------------
  |  |  361|  38.8k|#  define sqr_add_c(a,i,c0,c1,c2) do {  \
  |  |  362|  38.8k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  363|  38.8k|        asm ("mulq %2"                  \
  |  |  364|  38.8k|                : "=a"(t1),"=d"(t2)     \
  |  |  365|  38.8k|                : "a"(a[i])             \
  |  |  366|  38.8k|                : "cc");                \
  |  |  367|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  368|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  369|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  370|  38.8k|                : "cc");                                \
  |  |  371|  38.8k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (371:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  543|  38.8k|    r[0] = c1;
  544|  38.8k|    c1 = 0;
  545|  38.8k|    sqr_add_c2(a, 1, 0, c2, c3, c1);
  ------------------
  |  |  391|  38.8k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  38.8k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  38.8k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  38.8k|        asm ("mulq %3"                  \
  |  |  |  |  376|  38.8k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  38.8k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  38.8k|                : "cc");                \
  |  |  |  |  379|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  38.8k|                : "cc");                                \
  |  |  |  |  383|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  38.8k|                : "cc");                                \
  |  |  |  |  387|  38.8k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  546|  38.8k|    r[1] = c2;
  547|  38.8k|    c2 = 0;
  548|  38.8k|    sqr_add_c(a, 1, c3, c1, c2);
  ------------------
  |  |  361|  38.8k|#  define sqr_add_c(a,i,c0,c1,c2) do {  \
  |  |  362|  38.8k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  363|  38.8k|        asm ("mulq %2"                  \
  |  |  364|  38.8k|                : "=a"(t1),"=d"(t2)     \
  |  |  365|  38.8k|                : "a"(a[i])             \
  |  |  366|  38.8k|                : "cc");                \
  |  |  367|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  368|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  369|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  370|  38.8k|                : "cc");                                \
  |  |  371|  38.8k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (371:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  549|  38.8k|    sqr_add_c2(a, 2, 0, c3, c1, c2);
  ------------------
  |  |  391|  38.8k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  38.8k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  38.8k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  38.8k|        asm ("mulq %3"                  \
  |  |  |  |  376|  38.8k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  38.8k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  38.8k|                : "cc");                \
  |  |  |  |  379|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  38.8k|                : "cc");                                \
  |  |  |  |  383|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  38.8k|                : "cc");                                \
  |  |  |  |  387|  38.8k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  550|  38.8k|    r[2] = c3;
  551|  38.8k|    c3 = 0;
  552|  38.8k|    sqr_add_c2(a, 3, 0, c1, c2, c3);
  ------------------
  |  |  391|  38.8k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  38.8k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  38.8k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  38.8k|        asm ("mulq %3"                  \
  |  |  |  |  376|  38.8k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  38.8k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  38.8k|                : "cc");                \
  |  |  |  |  379|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  38.8k|                : "cc");                                \
  |  |  |  |  383|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  38.8k|                : "cc");                                \
  |  |  |  |  387|  38.8k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  553|  38.8k|    sqr_add_c2(a, 2, 1, c1, c2, c3);
  ------------------
  |  |  391|  38.8k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  38.8k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  38.8k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  38.8k|        asm ("mulq %3"                  \
  |  |  |  |  376|  38.8k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  38.8k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  38.8k|                : "cc");                \
  |  |  |  |  379|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  38.8k|                : "cc");                                \
  |  |  |  |  383|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  38.8k|                : "cc");                                \
  |  |  |  |  387|  38.8k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  554|  38.8k|    r[3] = c1;
  555|  38.8k|    c1 = 0;
  556|  38.8k|    sqr_add_c(a, 2, c2, c3, c1);
  ------------------
  |  |  361|  38.8k|#  define sqr_add_c(a,i,c0,c1,c2) do {  \
  |  |  362|  38.8k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  363|  38.8k|        asm ("mulq %2"                  \
  |  |  364|  38.8k|                : "=a"(t1),"=d"(t2)     \
  |  |  365|  38.8k|                : "a"(a[i])             \
  |  |  366|  38.8k|                : "cc");                \
  |  |  367|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  368|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  369|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  370|  38.8k|                : "cc");                                \
  |  |  371|  38.8k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (371:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  557|  38.8k|    sqr_add_c2(a, 3, 1, c2, c3, c1);
  ------------------
  |  |  391|  38.8k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  38.8k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  38.8k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  38.8k|        asm ("mulq %3"                  \
  |  |  |  |  376|  38.8k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  38.8k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  38.8k|                : "cc");                \
  |  |  |  |  379|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  38.8k|                : "cc");                                \
  |  |  |  |  383|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  38.8k|                : "cc");                                \
  |  |  |  |  387|  38.8k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  558|  38.8k|    sqr_add_c2(a, 4, 0, c2, c3, c1);
  ------------------
  |  |  391|  38.8k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  38.8k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  38.8k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  38.8k|        asm ("mulq %3"                  \
  |  |  |  |  376|  38.8k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  38.8k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  38.8k|                : "cc");                \
  |  |  |  |  379|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  38.8k|                : "cc");                                \
  |  |  |  |  383|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  38.8k|                : "cc");                                \
  |  |  |  |  387|  38.8k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  559|  38.8k|    r[4] = c2;
  560|  38.8k|    c2 = 0;
  561|  38.8k|    sqr_add_c2(a, 5, 0, c3, c1, c2);
  ------------------
  |  |  391|  38.8k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  38.8k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  38.8k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  38.8k|        asm ("mulq %3"                  \
  |  |  |  |  376|  38.8k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  38.8k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  38.8k|                : "cc");                \
  |  |  |  |  379|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  38.8k|                : "cc");                                \
  |  |  |  |  383|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  38.8k|                : "cc");                                \
  |  |  |  |  387|  38.8k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  562|  38.8k|    sqr_add_c2(a, 4, 1, c3, c1, c2);
  ------------------
  |  |  391|  38.8k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  38.8k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  38.8k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  38.8k|        asm ("mulq %3"                  \
  |  |  |  |  376|  38.8k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  38.8k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  38.8k|                : "cc");                \
  |  |  |  |  379|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  38.8k|                : "cc");                                \
  |  |  |  |  383|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  38.8k|                : "cc");                                \
  |  |  |  |  387|  38.8k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  563|  38.8k|    sqr_add_c2(a, 3, 2, c3, c1, c2);
  ------------------
  |  |  391|  38.8k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  38.8k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  38.8k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  38.8k|        asm ("mulq %3"                  \
  |  |  |  |  376|  38.8k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  38.8k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  38.8k|                : "cc");                \
  |  |  |  |  379|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  38.8k|                : "cc");                                \
  |  |  |  |  383|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  38.8k|                : "cc");                                \
  |  |  |  |  387|  38.8k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  564|  38.8k|    r[5] = c3;
  565|  38.8k|    c3 = 0;
  566|  38.8k|    sqr_add_c(a, 3, c1, c2, c3);
  ------------------
  |  |  361|  38.8k|#  define sqr_add_c(a,i,c0,c1,c2) do {  \
  |  |  362|  38.8k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  363|  38.8k|        asm ("mulq %2"                  \
  |  |  364|  38.8k|                : "=a"(t1),"=d"(t2)     \
  |  |  365|  38.8k|                : "a"(a[i])             \
  |  |  366|  38.8k|                : "cc");                \
  |  |  367|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  368|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  369|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  370|  38.8k|                : "cc");                                \
  |  |  371|  38.8k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (371:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  567|  38.8k|    sqr_add_c2(a, 4, 2, c1, c2, c3);
  ------------------
  |  |  391|  38.8k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  38.8k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  38.8k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  38.8k|        asm ("mulq %3"                  \
  |  |  |  |  376|  38.8k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  38.8k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  38.8k|                : "cc");                \
  |  |  |  |  379|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  38.8k|                : "cc");                                \
  |  |  |  |  383|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  38.8k|                : "cc");                                \
  |  |  |  |  387|  38.8k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  568|  38.8k|    sqr_add_c2(a, 5, 1, c1, c2, c3);
  ------------------
  |  |  391|  38.8k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  38.8k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  38.8k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  38.8k|        asm ("mulq %3"                  \
  |  |  |  |  376|  38.8k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  38.8k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  38.8k|                : "cc");                \
  |  |  |  |  379|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  38.8k|                : "cc");                                \
  |  |  |  |  383|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  38.8k|                : "cc");                                \
  |  |  |  |  387|  38.8k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  569|  38.8k|    sqr_add_c2(a, 6, 0, c1, c2, c3);
  ------------------
  |  |  391|  38.8k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  38.8k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  38.8k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  38.8k|        asm ("mulq %3"                  \
  |  |  |  |  376|  38.8k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  38.8k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  38.8k|                : "cc");                \
  |  |  |  |  379|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  38.8k|                : "cc");                                \
  |  |  |  |  383|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  38.8k|                : "cc");                                \
  |  |  |  |  387|  38.8k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  570|  38.8k|    r[6] = c1;
  571|  38.8k|    c1 = 0;
  572|  38.8k|    sqr_add_c2(a, 7, 0, c2, c3, c1);
  ------------------
  |  |  391|  38.8k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  38.8k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  38.8k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  38.8k|        asm ("mulq %3"                  \
  |  |  |  |  376|  38.8k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  38.8k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  38.8k|                : "cc");                \
  |  |  |  |  379|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  38.8k|                : "cc");                                \
  |  |  |  |  383|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  38.8k|                : "cc");                                \
  |  |  |  |  387|  38.8k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  573|  38.8k|    sqr_add_c2(a, 6, 1, c2, c3, c1);
  ------------------
  |  |  391|  38.8k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  38.8k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  38.8k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  38.8k|        asm ("mulq %3"                  \
  |  |  |  |  376|  38.8k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  38.8k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  38.8k|                : "cc");                \
  |  |  |  |  379|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  38.8k|                : "cc");                                \
  |  |  |  |  383|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  38.8k|                : "cc");                                \
  |  |  |  |  387|  38.8k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  574|  38.8k|    sqr_add_c2(a, 5, 2, c2, c3, c1);
  ------------------
  |  |  391|  38.8k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  38.8k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  38.8k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  38.8k|        asm ("mulq %3"                  \
  |  |  |  |  376|  38.8k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  38.8k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  38.8k|                : "cc");                \
  |  |  |  |  379|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  38.8k|                : "cc");                                \
  |  |  |  |  383|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  38.8k|                : "cc");                                \
  |  |  |  |  387|  38.8k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  575|  38.8k|    sqr_add_c2(a, 4, 3, c2, c3, c1);
  ------------------
  |  |  391|  38.8k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  38.8k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  38.8k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  38.8k|        asm ("mulq %3"                  \
  |  |  |  |  376|  38.8k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  38.8k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  38.8k|                : "cc");                \
  |  |  |  |  379|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  38.8k|                : "cc");                                \
  |  |  |  |  383|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  38.8k|                : "cc");                                \
  |  |  |  |  387|  38.8k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  576|  38.8k|    r[7] = c2;
  577|  38.8k|    c2 = 0;
  578|  38.8k|    sqr_add_c(a, 4, c3, c1, c2);
  ------------------
  |  |  361|  38.8k|#  define sqr_add_c(a,i,c0,c1,c2) do {  \
  |  |  362|  38.8k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  363|  38.8k|        asm ("mulq %2"                  \
  |  |  364|  38.8k|                : "=a"(t1),"=d"(t2)     \
  |  |  365|  38.8k|                : "a"(a[i])             \
  |  |  366|  38.8k|                : "cc");                \
  |  |  367|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  368|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  369|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  370|  38.8k|                : "cc");                                \
  |  |  371|  38.8k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (371:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  579|  38.8k|    sqr_add_c2(a, 5, 3, c3, c1, c2);
  ------------------
  |  |  391|  38.8k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  38.8k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  38.8k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  38.8k|        asm ("mulq %3"                  \
  |  |  |  |  376|  38.8k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  38.8k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  38.8k|                : "cc");                \
  |  |  |  |  379|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  38.8k|                : "cc");                                \
  |  |  |  |  383|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  38.8k|                : "cc");                                \
  |  |  |  |  387|  38.8k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  580|  38.8k|    sqr_add_c2(a, 6, 2, c3, c1, c2);
  ------------------
  |  |  391|  38.8k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  38.8k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  38.8k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  38.8k|        asm ("mulq %3"                  \
  |  |  |  |  376|  38.8k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  38.8k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  38.8k|                : "cc");                \
  |  |  |  |  379|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  38.8k|                : "cc");                                \
  |  |  |  |  383|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  38.8k|                : "cc");                                \
  |  |  |  |  387|  38.8k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  581|  38.8k|    sqr_add_c2(a, 7, 1, c3, c1, c2);
  ------------------
  |  |  391|  38.8k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  38.8k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  38.8k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  38.8k|        asm ("mulq %3"                  \
  |  |  |  |  376|  38.8k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  38.8k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  38.8k|                : "cc");                \
  |  |  |  |  379|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  38.8k|                : "cc");                                \
  |  |  |  |  383|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  38.8k|                : "cc");                                \
  |  |  |  |  387|  38.8k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  582|  38.8k|    r[8] = c3;
  583|  38.8k|    c3 = 0;
  584|  38.8k|    sqr_add_c2(a, 7, 2, c1, c2, c3);
  ------------------
  |  |  391|  38.8k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  38.8k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  38.8k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  38.8k|        asm ("mulq %3"                  \
  |  |  |  |  376|  38.8k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  38.8k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  38.8k|                : "cc");                \
  |  |  |  |  379|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  38.8k|                : "cc");                                \
  |  |  |  |  383|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  38.8k|                : "cc");                                \
  |  |  |  |  387|  38.8k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  585|  38.8k|    sqr_add_c2(a, 6, 3, c1, c2, c3);
  ------------------
  |  |  391|  38.8k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  38.8k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  38.8k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  38.8k|        asm ("mulq %3"                  \
  |  |  |  |  376|  38.8k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  38.8k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  38.8k|                : "cc");                \
  |  |  |  |  379|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  38.8k|                : "cc");                                \
  |  |  |  |  383|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  38.8k|                : "cc");                                \
  |  |  |  |  387|  38.8k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  586|  38.8k|    sqr_add_c2(a, 5, 4, c1, c2, c3);
  ------------------
  |  |  391|  38.8k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  38.8k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  38.8k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  38.8k|        asm ("mulq %3"                  \
  |  |  |  |  376|  38.8k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  38.8k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  38.8k|                : "cc");                \
  |  |  |  |  379|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  38.8k|                : "cc");                                \
  |  |  |  |  383|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  38.8k|                : "cc");                                \
  |  |  |  |  387|  38.8k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  587|  38.8k|    r[9] = c1;
  588|  38.8k|    c1 = 0;
  589|  38.8k|    sqr_add_c(a, 5, c2, c3, c1);
  ------------------
  |  |  361|  38.8k|#  define sqr_add_c(a,i,c0,c1,c2) do {  \
  |  |  362|  38.8k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  363|  38.8k|        asm ("mulq %2"                  \
  |  |  364|  38.8k|                : "=a"(t1),"=d"(t2)     \
  |  |  365|  38.8k|                : "a"(a[i])             \
  |  |  366|  38.8k|                : "cc");                \
  |  |  367|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  368|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  369|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  370|  38.8k|                : "cc");                                \
  |  |  371|  38.8k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (371:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  590|  38.8k|    sqr_add_c2(a, 6, 4, c2, c3, c1);
  ------------------
  |  |  391|  38.8k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  38.8k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  38.8k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  38.8k|        asm ("mulq %3"                  \
  |  |  |  |  376|  38.8k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  38.8k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  38.8k|                : "cc");                \
  |  |  |  |  379|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  38.8k|                : "cc");                                \
  |  |  |  |  383|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  38.8k|                : "cc");                                \
  |  |  |  |  387|  38.8k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  591|  38.8k|    sqr_add_c2(a, 7, 3, c2, c3, c1);
  ------------------
  |  |  391|  38.8k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  38.8k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  38.8k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  38.8k|        asm ("mulq %3"                  \
  |  |  |  |  376|  38.8k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  38.8k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  38.8k|                : "cc");                \
  |  |  |  |  379|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  38.8k|                : "cc");                                \
  |  |  |  |  383|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  38.8k|                : "cc");                                \
  |  |  |  |  387|  38.8k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  592|  38.8k|    r[10] = c2;
  593|  38.8k|    c2 = 0;
  594|  38.8k|    sqr_add_c2(a, 7, 4, c3, c1, c2);
  ------------------
  |  |  391|  38.8k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  38.8k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  38.8k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  38.8k|        asm ("mulq %3"                  \
  |  |  |  |  376|  38.8k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  38.8k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  38.8k|                : "cc");                \
  |  |  |  |  379|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  38.8k|                : "cc");                                \
  |  |  |  |  383|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  38.8k|                : "cc");                                \
  |  |  |  |  387|  38.8k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  595|  38.8k|    sqr_add_c2(a, 6, 5, c3, c1, c2);
  ------------------
  |  |  391|  38.8k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  38.8k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  38.8k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  38.8k|        asm ("mulq %3"                  \
  |  |  |  |  376|  38.8k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  38.8k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  38.8k|                : "cc");                \
  |  |  |  |  379|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  38.8k|                : "cc");                                \
  |  |  |  |  383|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  38.8k|                : "cc");                                \
  |  |  |  |  387|  38.8k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  596|  38.8k|    r[11] = c3;
  597|  38.8k|    c3 = 0;
  598|  38.8k|    sqr_add_c(a, 6, c1, c2, c3);
  ------------------
  |  |  361|  38.8k|#  define sqr_add_c(a,i,c0,c1,c2) do {  \
  |  |  362|  38.8k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  363|  38.8k|        asm ("mulq %2"                  \
  |  |  364|  38.8k|                : "=a"(t1),"=d"(t2)     \
  |  |  365|  38.8k|                : "a"(a[i])             \
  |  |  366|  38.8k|                : "cc");                \
  |  |  367|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  368|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  369|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  370|  38.8k|                : "cc");                                \
  |  |  371|  38.8k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (371:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  599|  38.8k|    sqr_add_c2(a, 7, 5, c1, c2, c3);
  ------------------
  |  |  391|  38.8k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  38.8k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  38.8k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  38.8k|        asm ("mulq %3"                  \
  |  |  |  |  376|  38.8k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  38.8k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  38.8k|                : "cc");                \
  |  |  |  |  379|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  38.8k|                : "cc");                                \
  |  |  |  |  383|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  38.8k|                : "cc");                                \
  |  |  |  |  387|  38.8k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  600|  38.8k|    r[12] = c1;
  601|  38.8k|    c1 = 0;
  602|  38.8k|    sqr_add_c2(a, 7, 6, c2, c3, c1);
  ------------------
  |  |  391|  38.8k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  38.8k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  38.8k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  38.8k|        asm ("mulq %3"                  \
  |  |  |  |  376|  38.8k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  38.8k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  38.8k|                : "cc");                \
  |  |  |  |  379|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  38.8k|                : "cc");                                \
  |  |  |  |  383|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  38.8k|                : "cc");                                \
  |  |  |  |  387|  38.8k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  603|  38.8k|    r[13] = c2;
  604|  38.8k|    c2 = 0;
  605|  38.8k|    sqr_add_c(a, 7, c3, c1, c2);
  ------------------
  |  |  361|  38.8k|#  define sqr_add_c(a,i,c0,c1,c2) do {  \
  |  |  362|  38.8k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  38.8k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  363|  38.8k|        asm ("mulq %2"                  \
  |  |  364|  38.8k|                : "=a"(t1),"=d"(t2)     \
  |  |  365|  38.8k|                : "a"(a[i])             \
  |  |  366|  38.8k|                : "cc");                \
  |  |  367|  38.8k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  368|  38.8k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  369|  38.8k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  370|  38.8k|                : "cc");                                \
  |  |  371|  38.8k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (371:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  606|  38.8k|    r[14] = c3;
  607|  38.8k|    r[15] = c1;
  608|  38.8k|}
bn_sqr_comba4:
  611|  2.33k|{
  612|  2.33k|    BN_ULONG c1, c2, c3;
  ------------------
  |  |   37|  2.33k|#  define BN_ULONG        unsigned long
  ------------------
  613|       |
  614|  2.33k|    c1 = 0;
  615|  2.33k|    c2 = 0;
  616|  2.33k|    c3 = 0;
  617|  2.33k|    sqr_add_c(a, 0, c1, c2, c3);
  ------------------
  |  |  361|  2.33k|#  define sqr_add_c(a,i,c0,c1,c2) do {  \
  |  |  362|  2.33k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  2.33k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  363|  2.33k|        asm ("mulq %2"                  \
  |  |  364|  2.33k|                : "=a"(t1),"=d"(t2)     \
  |  |  365|  2.33k|                : "a"(a[i])             \
  |  |  366|  2.33k|                : "cc");                \
  |  |  367|  2.33k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  368|  2.33k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  369|  2.33k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  370|  2.33k|                : "cc");                                \
  |  |  371|  2.33k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (371:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  618|  2.33k|    r[0] = c1;
  619|  2.33k|    c1 = 0;
  620|  2.33k|    sqr_add_c2(a, 1, 0, c2, c3, c1);
  ------------------
  |  |  391|  2.33k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  2.33k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  2.33k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  2.33k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  2.33k|        asm ("mulq %3"                  \
  |  |  |  |  376|  2.33k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  2.33k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  2.33k|                : "cc");                \
  |  |  |  |  379|  2.33k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  2.33k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  2.33k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  2.33k|                : "cc");                                \
  |  |  |  |  383|  2.33k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  2.33k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  2.33k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  2.33k|                : "cc");                                \
  |  |  |  |  387|  2.33k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  621|  2.33k|    r[1] = c2;
  622|  2.33k|    c2 = 0;
  623|  2.33k|    sqr_add_c(a, 1, c3, c1, c2);
  ------------------
  |  |  361|  2.33k|#  define sqr_add_c(a,i,c0,c1,c2) do {  \
  |  |  362|  2.33k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  2.33k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  363|  2.33k|        asm ("mulq %2"                  \
  |  |  364|  2.33k|                : "=a"(t1),"=d"(t2)     \
  |  |  365|  2.33k|                : "a"(a[i])             \
  |  |  366|  2.33k|                : "cc");                \
  |  |  367|  2.33k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  368|  2.33k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  369|  2.33k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  370|  2.33k|                : "cc");                                \
  |  |  371|  2.33k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (371:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  624|  2.33k|    sqr_add_c2(a, 2, 0, c3, c1, c2);
  ------------------
  |  |  391|  2.33k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  2.33k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  2.33k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  2.33k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  2.33k|        asm ("mulq %3"                  \
  |  |  |  |  376|  2.33k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  2.33k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  2.33k|                : "cc");                \
  |  |  |  |  379|  2.33k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  2.33k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  2.33k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  2.33k|                : "cc");                                \
  |  |  |  |  383|  2.33k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  2.33k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  2.33k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  2.33k|                : "cc");                                \
  |  |  |  |  387|  2.33k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  625|  2.33k|    r[2] = c3;
  626|  2.33k|    c3 = 0;
  627|  2.33k|    sqr_add_c2(a, 3, 0, c1, c2, c3);
  ------------------
  |  |  391|  2.33k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  2.33k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  2.33k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  2.33k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  2.33k|        asm ("mulq %3"                  \
  |  |  |  |  376|  2.33k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  2.33k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  2.33k|                : "cc");                \
  |  |  |  |  379|  2.33k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  2.33k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  2.33k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  2.33k|                : "cc");                                \
  |  |  |  |  383|  2.33k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  2.33k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  2.33k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  2.33k|                : "cc");                                \
  |  |  |  |  387|  2.33k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  628|  2.33k|    sqr_add_c2(a, 2, 1, c1, c2, c3);
  ------------------
  |  |  391|  2.33k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  2.33k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  2.33k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  2.33k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  2.33k|        asm ("mulq %3"                  \
  |  |  |  |  376|  2.33k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  2.33k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  2.33k|                : "cc");                \
  |  |  |  |  379|  2.33k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  2.33k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  2.33k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  2.33k|                : "cc");                                \
  |  |  |  |  383|  2.33k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  2.33k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  2.33k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  2.33k|                : "cc");                                \
  |  |  |  |  387|  2.33k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  629|  2.33k|    r[3] = c1;
  630|  2.33k|    c1 = 0;
  631|  2.33k|    sqr_add_c(a, 2, c2, c3, c1);
  ------------------
  |  |  361|  2.33k|#  define sqr_add_c(a,i,c0,c1,c2) do {  \
  |  |  362|  2.33k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  2.33k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  363|  2.33k|        asm ("mulq %2"                  \
  |  |  364|  2.33k|                : "=a"(t1),"=d"(t2)     \
  |  |  365|  2.33k|                : "a"(a[i])             \
  |  |  366|  2.33k|                : "cc");                \
  |  |  367|  2.33k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  368|  2.33k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  369|  2.33k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  370|  2.33k|                : "cc");                                \
  |  |  371|  2.33k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (371:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  632|  2.33k|    sqr_add_c2(a, 3, 1, c2, c3, c1);
  ------------------
  |  |  391|  2.33k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  2.33k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  2.33k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  2.33k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  2.33k|        asm ("mulq %3"                  \
  |  |  |  |  376|  2.33k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  2.33k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  2.33k|                : "cc");                \
  |  |  |  |  379|  2.33k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  2.33k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  2.33k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  2.33k|                : "cc");                                \
  |  |  |  |  383|  2.33k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  2.33k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  2.33k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  2.33k|                : "cc");                                \
  |  |  |  |  387|  2.33k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  633|  2.33k|    r[4] = c2;
  634|  2.33k|    c2 = 0;
  635|  2.33k|    sqr_add_c2(a, 3, 2, c3, c1, c2);
  ------------------
  |  |  391|  2.33k|        mul_add_c2((a)[i],(a)[j],c0,c1,c2)
  |  |  ------------------
  |  |  |  |  373|  2.33k|#  define mul_add_c2(a,b,c0,c1,c2) do { \
  |  |  |  |  374|  2.33k|        BN_ULONG t1,t2;                 \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  2.33k|#  define BN_ULONG        unsigned long
  |  |  |  |  ------------------
  |  |  |  |  375|  2.33k|        asm ("mulq %3"                  \
  |  |  |  |  376|  2.33k|                : "=a"(t1),"=d"(t2)     \
  |  |  |  |  377|  2.33k|                : "a"(a),"m"(b)         \
  |  |  |  |  378|  2.33k|                : "cc");                \
  |  |  |  |  379|  2.33k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  380|  2.33k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  381|  2.33k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  382|  2.33k|                : "cc");                                \
  |  |  |  |  383|  2.33k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  |  |  384|  2.33k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  |  |  385|  2.33k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  |  |  386|  2.33k|                : "cc");                                \
  |  |  |  |  387|  2.33k|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:18): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  636|  2.33k|    r[5] = c3;
  637|  2.33k|    c3 = 0;
  638|  2.33k|    sqr_add_c(a, 3, c1, c2, c3);
  ------------------
  |  |  361|  2.33k|#  define sqr_add_c(a,i,c0,c1,c2) do {  \
  |  |  362|  2.33k|        BN_ULONG t1,t2;                 \
  |  |  ------------------
  |  |  |  |   37|  2.33k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  363|  2.33k|        asm ("mulq %2"                  \
  |  |  364|  2.33k|                : "=a"(t1),"=d"(t2)     \
  |  |  365|  2.33k|                : "a"(a[i])             \
  |  |  366|  2.33k|                : "cc");                \
  |  |  367|  2.33k|        asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"       \
  |  |  368|  2.33k|                : "+r"(c0),"+r"(c1),"+r"(c2)            \
  |  |  369|  2.33k|                : "r"(t1),"r"(t2),"g"(0)                \
  |  |  370|  2.33k|                : "cc");                                \
  |  |  371|  2.33k|        } while (0)
  |  |  ------------------
  |  |  |  Branch (371:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
  639|  2.33k|    r[6] = c1;
  640|  2.33k|    r[7] = c2;
  641|  2.33k|}

BN_add:
   15|  2.08k|{
   16|  2.08k|    int ret, r_neg, cmp_res;
   17|       |
   18|  2.08k|    bn_check_top(a);
   19|  2.08k|    bn_check_top(b);
   20|       |
   21|  2.08k|    if (a->neg == b->neg) {
  ------------------
  |  Branch (21:9): [True: 0, False: 2.08k]
  ------------------
   22|      0|        r_neg = a->neg;
   23|      0|        ret = BN_uadd(r, a, b);
   24|  2.08k|    } else {
   25|  2.08k|        cmp_res = BN_ucmp(a, b);
   26|  2.08k|        if (cmp_res > 0) {
  ------------------
  |  Branch (26:13): [True: 0, False: 2.08k]
  ------------------
   27|      0|            r_neg = a->neg;
   28|      0|            ret = BN_usub(r, a, b);
   29|  2.08k|        } else if (cmp_res < 0) {
  ------------------
  |  Branch (29:20): [True: 2.08k, False: 0]
  ------------------
   30|  2.08k|            r_neg = b->neg;
   31|  2.08k|            ret = BN_usub(r, b, a);
   32|  2.08k|        } else {
   33|      0|            r_neg = 0;
   34|      0|            BN_zero(r);
  ------------------
  |  |  202|      0|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
   35|      0|            ret = 1;
   36|      0|        }
   37|  2.08k|    }
   38|       |
   39|  2.08k|    r->neg = r_neg;
   40|  2.08k|    bn_check_top(r);
   41|  2.08k|    return ret;
   42|  2.08k|}
BN_sub:
   46|  2.46k|{
   47|  2.46k|    int ret, r_neg, cmp_res;
   48|       |
   49|  2.46k|    bn_check_top(a);
   50|  2.46k|    bn_check_top(b);
   51|       |
   52|  2.46k|    if (a->neg != b->neg) {
  ------------------
  |  Branch (52:9): [True: 0, False: 2.46k]
  ------------------
   53|      0|        r_neg = a->neg;
   54|      0|        ret = BN_uadd(r, a, b);
   55|  2.46k|    } else {
   56|  2.46k|        cmp_res = BN_ucmp(a, b);
   57|  2.46k|        if (cmp_res > 0) {
  ------------------
  |  Branch (57:13): [True: 736, False: 1.73k]
  ------------------
   58|    736|            r_neg = a->neg;
   59|    736|            ret = BN_usub(r, a, b);
   60|  1.73k|        } else if (cmp_res < 0) {
  ------------------
  |  Branch (60:20): [True: 1.73k, False: 0]
  ------------------
   61|  1.73k|            r_neg = !b->neg;
   62|  1.73k|            ret = BN_usub(r, b, a);
   63|  1.73k|        } else {
   64|      0|            r_neg = 0;
   65|      0|            BN_zero(r);
  ------------------
  |  |  202|      0|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
   66|      0|            ret = 1;
   67|      0|        }
   68|  2.46k|    }
   69|       |
   70|  2.46k|    r->neg = r_neg;
   71|  2.46k|    bn_check_top(r);
   72|  2.46k|    return ret;
   73|  2.46k|}
BN_uadd:
   77|  75.2k|{
   78|  75.2k|    int max, min, dif;
   79|  75.2k|    const BN_ULONG *ap, *bp;
   80|  75.2k|    BN_ULONG *rp, carry, t1, t2;
  ------------------
  |  |   37|  75.2k|#  define BN_ULONG        unsigned long
  ------------------
   81|       |
   82|  75.2k|    bn_check_top(a);
   83|  75.2k|    bn_check_top(b);
   84|       |
   85|  75.2k|    if (a->top < b->top) {
  ------------------
  |  Branch (85:9): [True: 1.64k, False: 73.6k]
  ------------------
   86|  1.64k|        const BIGNUM *tmp;
   87|       |
   88|  1.64k|        tmp = a;
   89|  1.64k|        a = b;
   90|  1.64k|        b = tmp;
   91|  1.64k|    }
   92|  75.2k|    max = a->top;
   93|  75.2k|    min = b->top;
   94|  75.2k|    dif = max - min;
   95|       |
   96|  75.2k|    if (bn_wexpand(r, max + 1) == NULL)
  ------------------
  |  Branch (96:9): [True: 0, False: 75.2k]
  ------------------
   97|      0|        return 0;
   98|       |
   99|  75.2k|    r->top = max;
  100|       |
  101|  75.2k|    ap = a->d;
  102|  75.2k|    bp = b->d;
  103|  75.2k|    rp = r->d;
  104|       |
  105|  75.2k|    carry = bn_add_words(rp, ap, bp, min);
  106|  75.2k|    rp += min;
  107|  75.2k|    ap += min;
  108|       |
  109|  83.3k|    while (dif) {
  ------------------
  |  Branch (109:12): [True: 8.07k, False: 75.2k]
  ------------------
  110|  8.07k|        dif--;
  111|  8.07k|        t1 = *(ap++);
  112|  8.07k|        t2 = (t1 + carry) & BN_MASK2;
  ------------------
  |  |   94|  8.07k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  113|  8.07k|        *(rp++) = t2;
  114|  8.07k|        carry &= (t2 == 0);
  115|  8.07k|    }
  116|  75.2k|    *rp = carry;
  117|  75.2k|    r->top += carry;
  118|       |
  119|  75.2k|    r->neg = 0;
  120|  75.2k|    bn_check_top(r);
  121|  75.2k|    return 1;
  122|  75.2k|}
BN_usub:
  126|   134k|{
  127|   134k|    int max, min, dif;
  128|   134k|    BN_ULONG t1, t2, borrow, *rp;
  ------------------
  |  |   37|   134k|#  define BN_ULONG        unsigned long
  ------------------
  129|   134k|    const BN_ULONG *ap, *bp;
  130|       |
  131|   134k|    bn_check_top(a);
  132|   134k|    bn_check_top(b);
  133|       |
  134|   134k|    max = a->top;
  135|   134k|    min = b->top;
  136|   134k|    dif = max - min;
  137|       |
  138|   134k|    if (dif < 0) {              /* hmm... should not be happening */
  ------------------
  |  Branch (138:9): [True: 0, False: 134k]
  ------------------
  139|      0|        ERR_raise(ERR_LIB_BN, BN_R_ARG2_LT_ARG3);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  140|      0|        return 0;
  141|      0|    }
  142|       |
  143|   134k|    if (bn_wexpand(r, max) == NULL)
  ------------------
  |  Branch (143:9): [True: 0, False: 134k]
  ------------------
  144|      0|        return 0;
  145|       |
  146|   134k|    ap = a->d;
  147|   134k|    bp = b->d;
  148|   134k|    rp = r->d;
  149|       |
  150|   134k|    borrow = bn_sub_words(rp, ap, bp, min);
  151|   134k|    ap += min;
  152|   134k|    rp += min;
  153|       |
  154|   176k|    while (dif) {
  ------------------
  |  Branch (154:12): [True: 41.4k, False: 134k]
  ------------------
  155|  41.4k|        dif--;
  156|  41.4k|        t1 = *(ap++);
  157|  41.4k|        t2 = (t1 - borrow) & BN_MASK2;
  ------------------
  |  |   94|  41.4k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  158|  41.4k|        *(rp++) = t2;
  159|  41.4k|        borrow &= (t1 == 0);
  160|  41.4k|    }
  161|       |
  162|   721k|    while (max && *--rp == 0)
  ------------------
  |  Branch (162:12): [True: 720k, False: 1.32k]
  |  Branch (162:19): [True: 586k, False: 133k]
  ------------------
  163|   586k|        max--;
  164|       |
  165|   134k|    r->top = max;
  166|   134k|    r->neg = 0;
  167|   134k|    bn_pollute(r);
  168|       |
  169|   134k|    return 1;
  170|   134k|}

BN_CTX_new_ex:
  119|  3.02k|{
  120|  3.02k|    BN_CTX *ret;
  121|       |
  122|  3.02k|    if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
  ------------------
  |  |  104|  3.02k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|  3.02k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|  3.02k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (122:9): [True: 0, False: 3.02k]
  ------------------
  123|      0|        return NULL;
  124|       |    /* Initialise the structure */
  125|  3.02k|    BN_POOL_init(&ret->pool);
  126|  3.02k|    BN_STACK_init(&ret->stack);
  127|  3.02k|    ret->libctx = ctx;
  128|  3.02k|    return ret;
  129|  3.02k|}
BN_CTX_new:
  133|  3.02k|{
  134|  3.02k|    return BN_CTX_new_ex(NULL);
  135|  3.02k|}
BN_CTX_free:
  155|  4.27k|{
  156|  4.27k|    if (ctx == NULL)
  ------------------
  |  Branch (156:9): [True: 1.25k, False: 3.02k]
  ------------------
  157|  1.25k|        return;
  158|  3.02k|#ifndef FIPS_MODULE
  159|  3.02k|    OSSL_TRACE_BEGIN(BN_CTX) {
  ------------------
  |  |  220|  3.02k|    do {                                        \
  |  |  221|  3.02k|        BIO *trc_out = NULL;                    \
  |  |  222|  3.02k|        if (0)
  |  |  ------------------
  |  |  |  Branch (222:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  160|      0|        BN_POOL_ITEM *pool = ctx->pool.head;
  161|      0|        BIO_printf(trc_out,
  162|      0|                   "BN_CTX_free(): stack-size=%d, pool-bignums=%d\n",
  163|      0|                   ctx->stack.size, ctx->pool.size);
  164|      0|        BIO_printf(trc_out, "  dmaxs: ");
  165|      0|        while (pool) {
  ------------------
  |  Branch (165:16): [True: 0, False: 0]
  ------------------
  166|      0|            unsigned loop = 0;
  167|      0|            while (loop < BN_CTX_POOL_SIZE)
  ------------------
  |  |   15|      0|#define BN_CTX_POOL_SIZE        16
  ------------------
  |  Branch (167:20): [True: 0, False: 0]
  ------------------
  168|      0|                BIO_printf(trc_out, "%02x ", pool->vals[loop++].dmax);
  169|      0|            pool = pool->next;
  170|      0|        }
  171|      0|        BIO_printf(trc_out, "\n");
  172|  3.02k|    } OSSL_TRACE_END(BN_CTX);
  ------------------
  |  |  225|  3.02k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (225:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  173|  3.02k|#endif
  174|  3.02k|    BN_STACK_finish(&ctx->stack);
  175|  3.02k|    BN_POOL_finish(&ctx->pool);
  176|  3.02k|    OPENSSL_free(ctx);
  ------------------
  |  |  115|  3.02k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|  3.02k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|  3.02k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  177|  3.02k|}
BN_CTX_start:
  180|   720k|{
  181|   720k|    CTXDBG("ENTER BN_CTX_start()", ctx);
  ------------------
  |  |  110|   720k|    OSSL_TRACE_BEGIN(BN_CTX) {      \
  |  |  ------------------
  |  |  |  |  220|   720k|    do {                                        \
  |  |  |  |  221|   720k|        BIO *trc_out = NULL;                    \
  |  |  |  |  222|   720k|        if (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (222:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  111|      0|        ctxdbg(trc_out, str, ctx);  \
  |  |  112|   720k|    } OSSL_TRACE_END(BN_CTX)
  |  |  ------------------
  |  |  |  |  225|   720k|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (225:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  182|       |    /* If we're already overflowing ... */
  183|   720k|    if (ctx->err_stack || ctx->too_many)
  ------------------
  |  Branch (183:9): [True: 0, False: 720k]
  |  Branch (183:27): [True: 0, False: 720k]
  ------------------
  184|      0|        ctx->err_stack++;
  185|       |    /* (Try to) get a new frame pointer */
  186|   720k|    else if (!BN_STACK_push(&ctx->stack, ctx->used)) {
  ------------------
  |  Branch (186:14): [True: 0, False: 720k]
  ------------------
  187|      0|        ERR_raise(ERR_LIB_BN, BN_R_TOO_MANY_TEMPORARY_VARIABLES);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  188|      0|        ctx->err_stack++;
  189|      0|    }
  190|   720k|    CTXDBG("LEAVE BN_CTX_start()", ctx);
  ------------------
  |  |  110|   720k|    OSSL_TRACE_BEGIN(BN_CTX) {      \
  |  |  ------------------
  |  |  |  |  220|   720k|    do {                                        \
  |  |  |  |  221|   720k|        BIO *trc_out = NULL;                    \
  |  |  |  |  222|   720k|        if (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (222:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  111|      0|        ctxdbg(trc_out, str, ctx);  \
  |  |  112|   720k|    } OSSL_TRACE_END(BN_CTX)
  |  |  ------------------
  |  |  |  |  225|   720k|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (225:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  191|   720k|}
BN_CTX_end:
  194|   720k|{
  195|   720k|    if (ctx == NULL)
  ------------------
  |  Branch (195:9): [True: 0, False: 720k]
  ------------------
  196|      0|        return;
  197|   720k|    CTXDBG("ENTER BN_CTX_end()", ctx);
  ------------------
  |  |  110|   720k|    OSSL_TRACE_BEGIN(BN_CTX) {      \
  |  |  ------------------
  |  |  |  |  220|   720k|    do {                                        \
  |  |  |  |  221|   720k|        BIO *trc_out = NULL;                    \
  |  |  |  |  222|   720k|        if (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (222:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  111|      0|        ctxdbg(trc_out, str, ctx);  \
  |  |  112|   720k|    } OSSL_TRACE_END(BN_CTX)
  |  |  ------------------
  |  |  |  |  225|   720k|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (225:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  198|   720k|    if (ctx->err_stack)
  ------------------
  |  Branch (198:9): [True: 0, False: 720k]
  ------------------
  199|      0|        ctx->err_stack--;
  200|   720k|    else {
  201|   720k|        unsigned int fp = BN_STACK_pop(&ctx->stack);
  202|       |        /* Does this stack frame have anything to release? */
  203|   720k|        if (fp < ctx->used)
  ------------------
  |  Branch (203:13): [True: 614k, False: 106k]
  ------------------
  204|   614k|            BN_POOL_release(&ctx->pool, ctx->used - fp);
  205|   720k|        ctx->used = fp;
  206|       |        /* Unjam "too_many" in case "get" had failed */
  207|   720k|        ctx->too_many = 0;
  208|   720k|    }
  209|   720k|    CTXDBG("LEAVE BN_CTX_end()", ctx);
  ------------------
  |  |  110|   720k|    OSSL_TRACE_BEGIN(BN_CTX) {      \
  |  |  ------------------
  |  |  |  |  220|   720k|    do {                                        \
  |  |  |  |  221|   720k|        BIO *trc_out = NULL;                    \
  |  |  |  |  222|   720k|        if (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (222:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  111|      0|        ctxdbg(trc_out, str, ctx);  \
  |  |  112|   720k|    } OSSL_TRACE_END(BN_CTX)
  |  |  ------------------
  |  |  |  |  225|   720k|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (225:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  210|   720k|}
BN_CTX_get:
  213|  1.09M|{
  214|  1.09M|    BIGNUM *ret;
  215|       |
  216|  1.09M|    CTXDBG("ENTER BN_CTX_get()", ctx);
  ------------------
  |  |  110|  1.09M|    OSSL_TRACE_BEGIN(BN_CTX) {      \
  |  |  ------------------
  |  |  |  |  220|  1.09M|    do {                                        \
  |  |  |  |  221|  1.09M|        BIO *trc_out = NULL;                    \
  |  |  |  |  222|  1.09M|        if (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (222:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  111|      0|        ctxdbg(trc_out, str, ctx);  \
  |  |  112|  1.09M|    } OSSL_TRACE_END(BN_CTX)
  |  |  ------------------
  |  |  |  |  225|  1.09M|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (225:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  217|  1.09M|    if (ctx->err_stack || ctx->too_many)
  ------------------
  |  Branch (217:9): [True: 0, False: 1.09M]
  |  Branch (217:27): [True: 0, False: 1.09M]
  ------------------
  218|      0|        return NULL;
  219|  1.09M|    if ((ret = BN_POOL_get(&ctx->pool, ctx->flags)) == NULL) {
  ------------------
  |  Branch (219:9): [True: 0, False: 1.09M]
  ------------------
  220|       |        /*
  221|       |         * Setting too_many prevents repeated "get" attempts from cluttering
  222|       |         * the error stack.
  223|       |         */
  224|      0|        ctx->too_many = 1;
  225|      0|        ERR_raise(ERR_LIB_BN, BN_R_TOO_MANY_TEMPORARY_VARIABLES);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  226|      0|        return NULL;
  227|      0|    }
  228|       |    /* OK, make sure the returned bignum is "zero" */
  229|  1.09M|    BN_zero(ret);
  ------------------
  |  |  202|  1.09M|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  230|       |    /* clear BN_FLG_CONSTTIME if leaked from previous frames */
  231|  1.09M|    ret->flags &= (~BN_FLG_CONSTTIME);
  ------------------
  |  |   67|  1.09M|# define BN_FLG_CONSTTIME        0x04
  ------------------
  232|  1.09M|    ctx->used++;
  233|  1.09M|    CTXDBG("LEAVE BN_CTX_get()", ctx);
  ------------------
  |  |  110|  1.09M|    OSSL_TRACE_BEGIN(BN_CTX) {      \
  |  |  ------------------
  |  |  |  |  220|  1.09M|    do {                                        \
  |  |  |  |  221|  1.09M|        BIO *trc_out = NULL;                    \
  |  |  |  |  222|  1.09M|        if (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (222:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  111|      0|        ctxdbg(trc_out, str, ctx);  \
  |  |  112|  1.09M|    } OSSL_TRACE_END(BN_CTX)
  |  |  ------------------
  |  |  |  |  225|  1.09M|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (225:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  234|  1.09M|    return ret;
  235|  1.09M|}
bn_ctx.c:BN_STACK_init:
  249|  3.02k|{
  250|  3.02k|    st->indexes = NULL;
  251|  3.02k|    st->depth = st->size = 0;
  252|  3.02k|}
bn_ctx.c:BN_STACK_finish:
  255|  3.02k|{
  256|  3.02k|    OPENSSL_free(st->indexes);
  ------------------
  |  |  115|  3.02k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|  3.02k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|  3.02k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  257|  3.02k|    st->indexes = NULL;
  258|  3.02k|}
bn_ctx.c:BN_STACK_push:
  262|   720k|{
  263|   720k|    if (st->depth == st->size) {
  ------------------
  |  Branch (263:9): [True: 2.79k, False: 718k]
  ------------------
  264|       |        /* Need to expand */
  265|  2.79k|        unsigned int newsize =
  266|  2.79k|            st->size ? (st->size * 3 / 2) : BN_CTX_START_FRAMES;
  ------------------
  |  |   17|  2.79k|#define BN_CTX_START_FRAMES     32
  ------------------
  |  Branch (266:13): [True: 0, False: 2.79k]
  ------------------
  267|  2.79k|        unsigned int *newitems;
  268|       |
  269|  2.79k|        if ((newitems = OPENSSL_malloc(sizeof(*newitems) * newsize)) == NULL)
  ------------------
  |  |  102|  2.79k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|  2.79k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|  2.79k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (269:13): [True: 0, False: 2.79k]
  ------------------
  270|      0|            return 0;
  271|  2.79k|        if (st->depth)
  ------------------
  |  Branch (271:13): [True: 0, False: 2.79k]
  ------------------
  272|      0|            memcpy(newitems, st->indexes, sizeof(*newitems) * st->depth);
  273|  2.79k|        OPENSSL_free(st->indexes);
  ------------------
  |  |  115|  2.79k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|  2.79k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|  2.79k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  274|  2.79k|        st->indexes = newitems;
  275|  2.79k|        st->size = newsize;
  276|  2.79k|    }
  277|   720k|    st->indexes[(st->depth)++] = idx;
  278|   720k|    return 1;
  279|   720k|}
bn_ctx.c:BN_STACK_pop:
  282|   720k|{
  283|   720k|    return st->indexes[--(st->depth)];
  284|   720k|}
bn_ctx.c:BN_POOL_init:
  291|  3.02k|{
  292|  3.02k|    p->head = p->current = p->tail = NULL;
  293|  3.02k|    p->used = p->size = 0;
  294|  3.02k|}
bn_ctx.c:BN_POOL_finish:
  297|  3.02k|{
  298|  3.02k|    unsigned int loop;
  299|  3.02k|    BIGNUM *bn;
  300|       |
  301|  5.94k|    while (p->head) {
  ------------------
  |  Branch (301:12): [True: 2.92k, False: 3.02k]
  ------------------
  302|  49.7k|        for (loop = 0, bn = p->head->vals; loop++ < BN_CTX_POOL_SIZE; bn++)
  ------------------
  |  |   15|  49.7k|#define BN_CTX_POOL_SIZE        16
  ------------------
  |  Branch (302:44): [True: 46.7k, False: 2.92k]
  ------------------
  303|  46.7k|            if (bn->d)
  ------------------
  |  Branch (303:17): [True: 31.4k, False: 15.3k]
  ------------------
  304|  31.4k|                BN_clear_free(bn);
  305|  2.92k|        p->current = p->head->next;
  306|  2.92k|        OPENSSL_free(p->head);
  ------------------
  |  |  115|  2.92k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|  2.92k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|  2.92k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  307|  2.92k|        p->head = p->current;
  308|  2.92k|    }
  309|  3.02k|}
bn_ctx.c:BN_POOL_get:
  313|  1.09M|{
  314|  1.09M|    BIGNUM *bn;
  315|  1.09M|    unsigned int loop;
  316|       |
  317|       |    /* Full; allocate a new pool item and link it in. */
  318|  1.09M|    if (p->used == p->size) {
  ------------------
  |  Branch (318:9): [True: 2.92k, False: 1.09M]
  ------------------
  319|  2.92k|        BN_POOL_ITEM *item;
  320|       |
  321|  2.92k|        if ((item = OPENSSL_malloc(sizeof(*item))) == NULL)
  ------------------
  |  |  102|  2.92k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|  2.92k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|  2.92k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (321:13): [True: 0, False: 2.92k]
  ------------------
  322|      0|            return NULL;
  323|  49.7k|        for (loop = 0, bn = item->vals; loop++ < BN_CTX_POOL_SIZE; bn++) {
  ------------------
  |  |   15|  49.7k|#define BN_CTX_POOL_SIZE        16
  ------------------
  |  Branch (323:41): [True: 46.7k, False: 2.92k]
  ------------------
  324|  46.7k|            bn_init(bn);
  325|  46.7k|            if ((flag & BN_FLG_SECURE) != 0)
  ------------------
  |  |   68|  46.7k|# define BN_FLG_SECURE           0x08
  ------------------
  |  Branch (325:17): [True: 0, False: 46.7k]
  ------------------
  326|      0|                BN_set_flags(bn, BN_FLG_SECURE);
  ------------------
  |  |   68|      0|# define BN_FLG_SECURE           0x08
  ------------------
  327|  46.7k|        }
  328|  2.92k|        item->prev = p->tail;
  329|  2.92k|        item->next = NULL;
  330|       |
  331|  2.92k|        if (p->head == NULL)
  ------------------
  |  Branch (331:13): [True: 2.79k, False: 127]
  ------------------
  332|  2.79k|            p->head = p->current = p->tail = item;
  333|    127|        else {
  334|    127|            p->tail->next = item;
  335|    127|            p->tail = item;
  336|    127|            p->current = item;
  337|    127|        }
  338|  2.92k|        p->size += BN_CTX_POOL_SIZE;
  ------------------
  |  |   15|  2.92k|#define BN_CTX_POOL_SIZE        16
  ------------------
  339|  2.92k|        p->used++;
  340|       |        /* Return the first bignum from the new pool */
  341|  2.92k|        return item->vals;
  342|  2.92k|    }
  343|       |
  344|  1.09M|    if (!p->used)
  ------------------
  |  Branch (344:9): [True: 2.79k, False: 1.09M]
  ------------------
  345|  2.79k|        p->current = p->head;
  346|  1.09M|    else if ((p->used % BN_CTX_POOL_SIZE) == 0)
  ------------------
  |  |   15|  1.09M|#define BN_CTX_POOL_SIZE        16
  ------------------
  |  Branch (346:14): [True: 718, False: 1.09M]
  ------------------
  347|    718|        p->current = p->current->next;
  348|  1.09M|    return p->current->vals + ((p->used++) % BN_CTX_POOL_SIZE);
  ------------------
  |  |   15|  1.09M|#define BN_CTX_POOL_SIZE        16
  ------------------
  349|  1.09M|}
bn_ctx.c:BN_POOL_release:
  352|   614k|{
  353|   614k|    unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;
  ------------------
  |  |   15|   614k|#define BN_CTX_POOL_SIZE        16
  ------------------
  354|       |
  355|   614k|    p->used -= num;
  356|  1.71M|    while (num--) {
  ------------------
  |  Branch (356:12): [True: 1.09M, False: 614k]
  ------------------
  357|  1.09M|        bn_check_top(p->current->vals + offset);
  358|  1.09M|        if (offset == 0) {
  ------------------
  |  Branch (358:13): [True: 6.43k, False: 1.09M]
  ------------------
  359|  6.43k|            offset = BN_CTX_POOL_SIZE - 1;
  ------------------
  |  |   15|  6.43k|#define BN_CTX_POOL_SIZE        16
  ------------------
  360|  6.43k|            p->current = p->current->prev;
  361|  6.43k|        } else
  362|  1.09M|            offset--;
  363|  1.09M|    }
  364|   614k|}

BN_div:
  211|   108k|{
  212|   108k|    int ret;
  213|       |
  214|   108k|    if (BN_is_zero(divisor)) {
  ------------------
  |  Branch (214:9): [True: 0, False: 108k]
  ------------------
  215|      0|        ERR_raise(ERR_LIB_BN, BN_R_DIV_BY_ZERO);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  216|      0|        return 0;
  217|      0|    }
  218|       |
  219|       |    /*
  220|       |     * Invalid zero-padding would have particularly bad consequences so don't
  221|       |     * just rely on bn_check_top() here (bn_check_top() works only for
  222|       |     * BN_DEBUG builds)
  223|       |     */
  224|   108k|    if (divisor->d[divisor->top - 1] == 0) {
  ------------------
  |  Branch (224:9): [True: 0, False: 108k]
  ------------------
  225|      0|        ERR_raise(ERR_LIB_BN, BN_R_NOT_INITIALIZED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  226|      0|        return 0;
  227|      0|    }
  228|       |
  229|   108k|    ret = bn_div_fixed_top(dv, rm, num, divisor, ctx);
  230|       |
  231|   108k|    if (ret) {
  ------------------
  |  Branch (231:9): [True: 108k, False: 0]
  ------------------
  232|   108k|        if (dv != NULL)
  ------------------
  |  Branch (232:13): [True: 2.74k, False: 105k]
  ------------------
  233|  2.74k|            bn_correct_top(dv);
  234|   108k|        if (rm != NULL)
  ------------------
  |  Branch (234:13): [True: 105k, False: 2.74k]
  ------------------
  235|   105k|            bn_correct_top(rm);
  236|   108k|    }
  237|       |
  238|   108k|    return ret;
  239|   108k|}
bn_div_fixed_top:
  266|   108k|{
  267|   108k|    int norm_shift, i, j, loop;
  268|   108k|    BIGNUM *tmp, *snum, *sdiv, *res;
  269|   108k|    BN_ULONG *resp, *wnum, *wnumtop;
  ------------------
  |  |   37|   108k|#  define BN_ULONG        unsigned long
  ------------------
  270|   108k|    BN_ULONG d0, d1;
  ------------------
  |  |   37|   108k|#  define BN_ULONG        unsigned long
  ------------------
  271|   108k|    int num_n, div_n, num_neg;
  272|       |
  273|   108k|    assert(divisor->top > 0 && divisor->d[divisor->top - 1] != 0);
  274|       |
  275|   108k|    bn_check_top(num);
  276|   108k|    bn_check_top(divisor);
  277|   108k|    bn_check_top(dv);
  278|   108k|    bn_check_top(rm);
  279|       |
  280|   108k|    BN_CTX_start(ctx);
  281|   108k|    res = (dv == NULL) ? BN_CTX_get(ctx) : dv;
  ------------------
  |  Branch (281:11): [True: 105k, False: 2.74k]
  ------------------
  282|   108k|    tmp = BN_CTX_get(ctx);
  283|   108k|    snum = BN_CTX_get(ctx);
  284|   108k|    sdiv = BN_CTX_get(ctx);
  285|   108k|    if (sdiv == NULL)
  ------------------
  |  Branch (285:9): [True: 0, False: 108k]
  ------------------
  286|      0|        goto err;
  287|       |
  288|       |    /* First we normalise the numbers */
  289|   108k|    if (!BN_copy(sdiv, divisor))
  ------------------
  |  Branch (289:9): [True: 0, False: 108k]
  ------------------
  290|      0|        goto err;
  291|   108k|    norm_shift = bn_left_align(sdiv);
  292|   108k|    sdiv->neg = 0;
  293|       |    /*
  294|       |     * Note that bn_lshift_fixed_top's output is always one limb longer
  295|       |     * than input, even when norm_shift is zero. This means that amount of
  296|       |     * inner loop iterations is invariant of dividend value, and that one
  297|       |     * doesn't need to compare dividend and divisor if they were originally
  298|       |     * of the same bit length.
  299|       |     */
  300|   108k|    if (!(bn_lshift_fixed_top(snum, num, norm_shift)))
  ------------------
  |  Branch (300:9): [True: 0, False: 108k]
  ------------------
  301|      0|        goto err;
  302|       |
  303|   108k|    div_n = sdiv->top;
  304|   108k|    num_n = snum->top;
  305|       |
  306|   108k|    if (num_n <= div_n) {
  ------------------
  |  Branch (306:9): [True: 16.5k, False: 91.9k]
  ------------------
  307|       |        /* caller didn't pad dividend -> no constant-time guarantee... */
  308|  16.5k|        if (bn_wexpand(snum, div_n + 1) == NULL)
  ------------------
  |  Branch (308:13): [True: 0, False: 16.5k]
  ------------------
  309|      0|            goto err;
  310|  16.5k|        memset(&(snum->d[num_n]), 0, (div_n - num_n + 1) * sizeof(BN_ULONG));
  311|  16.5k|        snum->top = num_n = div_n + 1;
  312|  16.5k|    }
  313|       |
  314|   108k|    loop = num_n - div_n;
  315|       |    /*
  316|       |     * Lets setup a 'window' into snum This is the part that corresponds to
  317|       |     * the current 'area' being divided
  318|       |     */
  319|   108k|    wnum = &(snum->d[loop]);
  320|   108k|    wnumtop = &(snum->d[num_n - 1]);
  321|       |
  322|       |    /* Get the top 2 words of sdiv */
  323|   108k|    d0 = sdiv->d[div_n - 1];
  324|   108k|    d1 = (div_n == 1) ? 0 : sdiv->d[div_n - 2];
  ------------------
  |  Branch (324:10): [True: 58.9k, False: 49.5k]
  ------------------
  325|       |
  326|       |    /* Setup quotient */
  327|   108k|    if (!bn_wexpand(res, loop))
  ------------------
  |  Branch (327:9): [True: 0, False: 108k]
  ------------------
  328|      0|        goto err;
  329|   108k|    num_neg = num->neg;
  330|   108k|    res->neg = (num_neg ^ divisor->neg);
  331|   108k|    res->top = loop;
  332|   108k|    res->flags |= BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|   108k|#  define BN_FLG_FIXED_TOP 0
  ------------------
  333|   108k|    resp = &(res->d[loop]);
  334|       |
  335|       |    /* space for temp */
  336|   108k|    if (!bn_wexpand(tmp, (div_n + 1)))
  ------------------
  |  Branch (336:9): [True: 0, False: 108k]
  ------------------
  337|      0|        goto err;
  338|       |
  339|   806k|    for (i = 0; i < loop; i++, wnumtop--) {
  ------------------
  |  Branch (339:17): [True: 698k, False: 108k]
  ------------------
  340|   698k|        BN_ULONG q, l0;
  ------------------
  |  |   37|   698k|#  define BN_ULONG        unsigned long
  ------------------
  341|       |        /*
  342|       |         * the first part of the loop uses the top two words of snum and sdiv
  343|       |         * to calculate a BN_ULONG q such that | wnum - sdiv * q | < sdiv
  344|       |         */
  345|       |# if defined(BN_DIV3W)
  346|       |        q = bn_div_3_words(wnumtop, d1, d0);
  347|       |# else
  348|   698k|        BN_ULONG n0, n1, rem = 0;
  ------------------
  |  |   37|   698k|#  define BN_ULONG        unsigned long
  ------------------
  349|       |
  350|   698k|        n0 = wnumtop[0];
  351|   698k|        n1 = wnumtop[-1];
  352|   698k|        if (n0 == d0)
  ------------------
  |  Branch (352:13): [True: 18.0k, False: 680k]
  ------------------
  353|  18.0k|            q = BN_MASK2;
  ------------------
  |  |   94|  18.0k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  354|   680k|        else {                  /* n0 < d0 */
  355|   680k|            BN_ULONG n2 = (wnumtop == wnum) ? 0 : wnumtop[-2];
  ------------------
  |  |   37|   680k|#  define BN_ULONG        unsigned long
  ------------------
  |  Branch (355:27): [True: 69.0k, False: 611k]
  ------------------
  356|       |#  ifdef BN_LLONG
  357|       |            BN_ULLONG t2;
  358|       |
  359|       |#   if defined(BN_LLONG) && defined(BN_DIV2W) && !defined(bn_div_words)
  360|       |            q = (BN_ULONG)(((((BN_ULLONG) n0) << BN_BITS2) | n1) / d0);
  361|       |#   else
  362|       |            q = bn_div_words(n0, n1, d0);
  363|       |#   endif
  364|       |
  365|       |#   ifndef REMAINDER_IS_ALREADY_CALCULATED
  366|       |            /*
  367|       |             * rem doesn't have to be BN_ULLONG. The least we
  368|       |             * know it's less that d0, isn't it?
  369|       |             */
  370|       |            rem = (n1 - q * d0) & BN_MASK2;
  371|       |#   endif
  372|       |            t2 = (BN_ULLONG) d1 *q;
  373|       |
  374|       |            for (;;) {
  375|       |                if (t2 <= ((((BN_ULLONG) rem) << BN_BITS2) | n2))
  376|       |                    break;
  377|       |                q--;
  378|       |                rem += d0;
  379|       |                if (rem < d0)
  380|       |                    break;      /* don't let rem overflow */
  381|       |                t2 -= d1;
  382|       |            }
  383|       |#  else                         /* !BN_LLONG */
  384|   680k|            BN_ULONG t2l, t2h;
  ------------------
  |  |   37|   680k|#  define BN_ULONG        unsigned long
  ------------------
  385|       |
  386|   680k|            q = bn_div_words(n0, n1, d0);
  387|   680k|#   ifndef REMAINDER_IS_ALREADY_CALCULATED
  388|   680k|            rem = (n1 - q * d0) & BN_MASK2;
  ------------------
  |  |   94|   680k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  389|   680k|#   endif
  390|       |
  391|       |#   if defined(BN_UMULT_LOHI)
  392|       |            BN_UMULT_LOHI(t2l, t2h, d1, q);
  393|       |#   elif defined(BN_UMULT_HIGH)
  394|       |            t2l = d1 * q;
  395|       |            t2h = BN_UMULT_HIGH(d1, q);
  396|       |#   else
  397|   680k|            {
  398|   680k|                BN_ULONG ql, qh;
  ------------------
  |  |   37|   680k|#  define BN_ULONG        unsigned long
  ------------------
  399|   680k|                t2l = LBITS(d1);
  ------------------
  |  |  566|   680k|#  define LBITS(a)        ((a)&BN_MASK2l)
  |  |  ------------------
  |  |  |  |   95|   680k|#  define BN_MASK2l       (0xffffffffL)
  |  |  ------------------
  ------------------
  400|   680k|                t2h = HBITS(d1);
  ------------------
  |  |  567|   680k|#  define HBITS(a)        (((a)>>BN_BITS4)&BN_MASK2l)
  |  |  ------------------
  |  |  |  |   93|   680k|#  define BN_BITS4        32
  |  |  ------------------
  |  |               #  define HBITS(a)        (((a)>>BN_BITS4)&BN_MASK2l)
  |  |  ------------------
  |  |  |  |   95|   680k|#  define BN_MASK2l       (0xffffffffL)
  |  |  ------------------
  ------------------
  401|   680k|                ql = LBITS(q);
  ------------------
  |  |  566|   680k|#  define LBITS(a)        ((a)&BN_MASK2l)
  |  |  ------------------
  |  |  |  |   95|   680k|#  define BN_MASK2l       (0xffffffffL)
  |  |  ------------------
  ------------------
  402|   680k|                qh = HBITS(q);
  ------------------
  |  |  567|   680k|#  define HBITS(a)        (((a)>>BN_BITS4)&BN_MASK2l)
  |  |  ------------------
  |  |  |  |   93|   680k|#  define BN_BITS4        32
  |  |  ------------------
  |  |               #  define HBITS(a)        (((a)>>BN_BITS4)&BN_MASK2l)
  |  |  ------------------
  |  |  |  |   95|   680k|#  define BN_MASK2l       (0xffffffffL)
  |  |  ------------------
  ------------------
  403|   680k|                mul64(t2l, t2h, ql, qh); /* t2=(BN_ULLONG)d1*q; */
  ------------------
  |  |  575|   680k|        { \
  |  |  576|   680k|        BN_ULONG m,m1,lt,ht; \
  |  |  ------------------
  |  |  |  |   37|   680k|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  577|   680k| \
  |  |  578|   680k|        lt=l; \
  |  |  579|   680k|        ht=h; \
  |  |  580|   680k|        m =(bh)*(lt); \
  |  |  581|   680k|        lt=(bl)*(lt); \
  |  |  582|   680k|        m1=(bl)*(ht); \
  |  |  583|   680k|        ht =(bh)*(ht); \
  |  |  584|   680k|        m=(m+m1)&BN_MASK2; ht += L2HBITS((BN_ULONG)(m < m1)); \
  |  |  ------------------
  |  |  |  |   94|   680k|#  define BN_MASK2        (0xffffffffffffffffL)
  |  |  ------------------
  |  |                       m=(m+m1)&BN_MASK2; ht += L2HBITS((BN_ULONG)(m < m1)); \
  |  |  ------------------
  |  |  |  |  568|   680k|#  define L2HBITS(a)      (((a)<<BN_BITS4)&BN_MASK2)
  |  |  |  |  ------------------
  |  |  |  |  |  |   93|   680k|#  define BN_BITS4        32
  |  |  |  |  ------------------
  |  |  |  |               #  define L2HBITS(a)      (((a)<<BN_BITS4)&BN_MASK2)
  |  |  |  |  ------------------
  |  |  |  |  |  |   94|   680k|#  define BN_MASK2        (0xffffffffffffffffL)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  585|   680k|        ht+=HBITS(m); \
  |  |  ------------------
  |  |  |  |  567|   680k|#  define HBITS(a)        (((a)>>BN_BITS4)&BN_MASK2l)
  |  |  |  |  ------------------
  |  |  |  |  |  |   93|   680k|#  define BN_BITS4        32
  |  |  |  |  ------------------
  |  |  |  |               #  define HBITS(a)        (((a)>>BN_BITS4)&BN_MASK2l)
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|   680k|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  586|   680k|        m1=L2HBITS(m); \
  |  |  ------------------
  |  |  |  |  568|   680k|#  define L2HBITS(a)      (((a)<<BN_BITS4)&BN_MASK2)
  |  |  |  |  ------------------
  |  |  |  |  |  |   93|   680k|#  define BN_BITS4        32
  |  |  |  |  ------------------
  |  |  |  |               #  define L2HBITS(a)      (((a)<<BN_BITS4)&BN_MASK2)
  |  |  |  |  ------------------
  |  |  |  |  |  |   94|   680k|#  define BN_MASK2        (0xffffffffffffffffL)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  587|   680k|        lt=(lt+m1)&BN_MASK2; ht += (lt < m1); \
  |  |  ------------------
  |  |  |  |   94|   680k|#  define BN_MASK2        (0xffffffffffffffffL)
  |  |  ------------------
  |  |  588|   680k|        (l)=lt; \
  |  |  589|   680k|        (h)=ht; \
  |  |  590|   680k|        }
  ------------------
  404|   680k|            }
  405|   680k|#   endif
  406|       |
  407|   709k|            for (;;) {
  408|   709k|                if ((t2h < rem) || ((t2h == rem) && (t2l <= n2)))
  ------------------
  |  Branch (408:21): [True: 536k, False: 173k]
  |  Branch (408:37): [True: 90.5k, False: 82.6k]
  |  Branch (408:53): [True: 89.4k, False: 1.12k]
  ------------------
  409|   626k|                    break;
  410|  83.8k|                q--;
  411|  83.8k|                rem += d0;
  412|  83.8k|                if (rem < d0)
  ------------------
  |  Branch (412:21): [True: 53.9k, False: 29.8k]
  ------------------
  413|  53.9k|                    break;      /* don't let rem overflow */
  414|  29.8k|                if (t2l < d1)
  ------------------
  |  Branch (414:21): [True: 20.1k, False: 9.75k]
  ------------------
  415|  20.1k|                    t2h--;
  416|  29.8k|                t2l -= d1;
  417|  29.8k|            }
  418|   680k|#  endif                        /* !BN_LLONG */
  419|   680k|        }
  420|   698k|# endif                         /* !BN_DIV3W */
  421|       |
  422|   698k|        l0 = bn_mul_words(tmp->d, sdiv->d, div_n, q);
  423|   698k|        tmp->d[div_n] = l0;
  424|   698k|        wnum--;
  425|       |        /*
  426|       |         * ignore top values of the bignums just sub the two BN_ULONG arrays
  427|       |         * with bn_sub_words
  428|       |         */
  429|   698k|        l0 = bn_sub_words(wnum, wnum, tmp->d, div_n + 1);
  430|   698k|        q -= l0;
  431|       |        /*
  432|       |         * Note: As we have considered only the leading two BN_ULONGs in
  433|       |         * the calculation of q, sdiv * q might be greater than wnum (but
  434|       |         * then (q-1) * sdiv is less or equal than wnum)
  435|       |         */
  436|  19.1M|        for (l0 = 0 - l0, j = 0; j < div_n; j++)
  ------------------
  |  Branch (436:34): [True: 18.4M, False: 698k]
  ------------------
  437|  18.4M|            tmp->d[j] = sdiv->d[j] & l0;
  438|   698k|        l0 = bn_add_words(wnum, wnum, tmp->d, div_n);
  439|   698k|        (*wnumtop) += l0;
  440|   698k|        assert((*wnumtop) == 0);
  441|       |
  442|       |        /* store part of the result */
  443|   698k|        *--resp = q;
  444|   698k|    }
  445|       |    /* snum holds remainder, it's as wide as divisor */
  446|   108k|    snum->neg = num_neg;
  447|   108k|    snum->top = div_n;
  448|   108k|    snum->flags |= BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|   108k|#  define BN_FLG_FIXED_TOP 0
  ------------------
  449|       |
  450|   108k|    if (rm != NULL && bn_rshift_fixed_top(rm, snum, norm_shift) == 0)
  ------------------
  |  Branch (450:9): [True: 105k, False: 2.74k]
  |  Branch (450:23): [True: 0, False: 105k]
  ------------------
  451|      0|        goto err;
  452|       |
  453|   108k|    BN_CTX_end(ctx);
  454|   108k|    return 1;
  455|      0| err:
  456|      0|    bn_check_top(rm);
  457|      0|    BN_CTX_end(ctx);
  458|      0|    return 0;
  459|   108k|}
bn_div.c:bn_left_align:
  142|   108k|{
  143|   108k|    BN_ULONG *d = num->d, n, m, rmask;
  ------------------
  |  |   37|   108k|#  define BN_ULONG        unsigned long
  ------------------
  144|   108k|    int top = num->top;
  145|   108k|    int rshift = BN_num_bits_word(d[top - 1]), lshift, i;
  146|       |
  147|   108k|    lshift = BN_BITS2 - rshift;
  ------------------
  |  |   54|   108k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   108k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  148|   108k|    rshift %= BN_BITS2;            /* say no to undefined behaviour */
  ------------------
  |  |   54|   108k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   108k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  149|   108k|    rmask = (BN_ULONG)0 - rshift;  /* rmask = 0 - (rshift != 0) */
  150|   108k|    rmask |= rmask >> 8;
  151|       |
  152|  1.07M|    for (i = 0, m = 0; i < top; i++) {
  ------------------
  |  Branch (152:24): [True: 963k, False: 108k]
  ------------------
  153|   963k|        n = d[i];
  154|   963k|        d[i] = ((n << lshift) | m) & BN_MASK2;
  ------------------
  |  |   94|   963k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  155|   963k|        m = (n >> rshift) & rmask;
  156|   963k|    }
  157|       |
  158|   108k|    return lshift;
  159|   108k|}

ossl_err_load_BN_strings:
   50|      2|{
   51|      2|#ifndef OPENSSL_NO_ERR
   52|      2|    if (ERR_reason_error_string(BN_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (52:9): [True: 2, False: 0]
  ------------------
   53|      2|        ERR_load_strings_const(BN_str_reasons);
   54|      2|#endif
   55|      2|    return 1;
   56|      2|}

BN_mod_exp:
   99|  2.99k|{
  100|  2.99k|    int ret;
  101|       |
  102|  2.99k|    bn_check_top(a);
  103|  2.99k|    bn_check_top(p);
  104|  2.99k|    bn_check_top(m);
  105|       |
  106|       |    /*-
  107|       |     * For even modulus  m = 2^k*m_odd, it might make sense to compute
  108|       |     * a^p mod m_odd  and  a^p mod 2^k  separately (with Montgomery
  109|       |     * exponentiation for the odd part), using appropriate exponent
  110|       |     * reductions, and combine the results using the CRT.
  111|       |     *
  112|       |     * For now, we use Montgomery only if the modulus is odd; otherwise,
  113|       |     * exponentiation using the reciprocal-based quick remaindering
  114|       |     * algorithm is used.
  115|       |     *
  116|       |     * (Timing obtained with expspeed.c [computations  a^p mod m
  117|       |     * where  a, p, m  are of the same length: 256, 512, 1024, 2048,
  118|       |     * 4096, 8192 bits], compared to the running time of the
  119|       |     * standard algorithm:
  120|       |     *
  121|       |     *   BN_mod_exp_mont   33 .. 40 %  [AMD K6-2, Linux, debug configuration]
  122|       |     *                     55 .. 77 %  [UltraSparc processor, but
  123|       |     *                                  debug-solaris-sparcv8-gcc conf.]
  124|       |     *
  125|       |     *   BN_mod_exp_recp   50 .. 70 %  [AMD K6-2, Linux, debug configuration]
  126|       |     *                     62 .. 118 % [UltraSparc, debug-solaris-sparcv8-gcc]
  127|       |     *
  128|       |     * On the Sparc, BN_mod_exp_recp was faster than BN_mod_exp_mont
  129|       |     * at 2048 and more bits, but at 512 and 1024 bits, it was
  130|       |     * slower even than the standard algorithm!
  131|       |     *
  132|       |     * "Real" timings [linux-elf, solaris-sparcv9-gcc configurations]
  133|       |     * should be obtained when the new Montgomery reduction code
  134|       |     * has been integrated into OpenSSL.)
  135|       |     */
  136|       |
  137|  2.99k|#define MONT_MUL_MOD
  138|  2.99k|#define MONT_EXP_WORD
  139|  2.99k|#define RECP_MUL_MOD
  140|       |
  141|  2.99k|#ifdef MONT_MUL_MOD
  142|  2.99k|    if (BN_is_odd(m)) {
  ------------------
  |  Branch (142:9): [True: 1.41k, False: 1.58k]
  ------------------
  143|  1.41k|# ifdef MONT_EXP_WORD
  144|  1.41k|        if (a->top == 1 && !a->neg
  ------------------
  |  Branch (144:13): [True: 580, False: 830]
  |  Branch (144:28): [True: 393, False: 187]
  ------------------
  145|  1.41k|            && (BN_get_flags(p, BN_FLG_CONSTTIME) == 0)
  ------------------
  |  |   67|    393|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (145:16): [True: 393, False: 0]
  ------------------
  146|  1.41k|            && (BN_get_flags(a, BN_FLG_CONSTTIME) == 0)
  ------------------
  |  |   67|    393|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (146:16): [True: 393, False: 0]
  ------------------
  147|  1.41k|            && (BN_get_flags(m, BN_FLG_CONSTTIME) == 0)) {
  ------------------
  |  |   67|    393|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (147:16): [True: 393, False: 0]
  ------------------
  148|    393|            BN_ULONG A = a->d[0];
  ------------------
  |  |   37|    393|#  define BN_ULONG        unsigned long
  ------------------
  149|    393|            ret = BN_mod_exp_mont_word(r, A, p, m, ctx, NULL);
  150|    393|        } else
  151|  1.01k|# endif
  152|  1.01k|            ret = BN_mod_exp_mont(r, a, p, m, ctx, NULL);
  153|  1.41k|    } else
  154|  1.58k|#endif
  155|  1.58k|#ifdef RECP_MUL_MOD
  156|  1.58k|    {
  157|  1.58k|        ret = BN_mod_exp_recp(r, a, p, m, ctx);
  158|  1.58k|    }
  159|       |#else
  160|       |    {
  161|       |        ret = BN_mod_exp_simple(r, a, p, m, ctx);
  162|       |    }
  163|       |#endif
  164|       |
  165|  2.99k|    bn_check_top(r);
  166|  2.99k|    return ret;
  167|  2.99k|}
BN_mod_exp_recp:
  171|  1.58k|{
  172|  1.58k|    int i, j, bits, ret = 0, wstart, wend, window;
  173|  1.58k|    int start = 1;
  174|  1.58k|    BIGNUM *aa;
  175|       |    /* Table of variables obtained from 'ctx' */
  176|  1.58k|    BIGNUM *val[TABLE_SIZE];
  177|  1.58k|    BN_RECP_CTX recp;
  178|       |
  179|  1.58k|    if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0
  ------------------
  |  |   67|  1.58k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (179:9): [True: 0, False: 1.58k]
  ------------------
  180|  1.58k|            || BN_get_flags(a, BN_FLG_CONSTTIME) != 0
  ------------------
  |  |   67|  1.58k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (180:16): [True: 0, False: 1.58k]
  ------------------
  181|  1.58k|            || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) {
  ------------------
  |  |   67|  1.58k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (181:16): [True: 0, False: 1.58k]
  ------------------
  182|       |        /* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */
  183|      0|        ERR_raise(ERR_LIB_BN, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  184|      0|        return 0;
  185|      0|    }
  186|       |
  187|  1.58k|    bits = BN_num_bits(p);
  188|  1.58k|    if (bits == 0) {
  ------------------
  |  Branch (188:9): [True: 63, False: 1.51k]
  ------------------
  189|       |        /* x**0 mod 1, or x**0 mod -1 is still zero. */
  190|     63|        if (BN_abs_is_word(m, 1)) {
  ------------------
  |  Branch (190:13): [True: 0, False: 63]
  ------------------
  191|      0|            ret = 1;
  192|      0|            BN_zero(r);
  ------------------
  |  |  202|      0|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  193|     63|        } else {
  194|     63|            ret = BN_one(r);
  ------------------
  |  |  197|     63|# define BN_one(a)       (BN_set_word((a),1))
  ------------------
  195|     63|        }
  196|     63|        return ret;
  197|     63|    }
  198|       |
  199|  1.51k|    BN_RECP_CTX_init(&recp);
  200|       |
  201|  1.51k|    BN_CTX_start(ctx);
  202|  1.51k|    aa = BN_CTX_get(ctx);
  203|  1.51k|    val[0] = BN_CTX_get(ctx);
  204|  1.51k|    if (val[0] == NULL)
  ------------------
  |  Branch (204:9): [True: 0, False: 1.51k]
  ------------------
  205|      0|        goto err;
  206|       |
  207|  1.51k|    if (m->neg) {
  ------------------
  |  Branch (207:9): [True: 653, False: 864]
  ------------------
  208|       |        /* ignore sign of 'm' */
  209|    653|        if (!BN_copy(aa, m))
  ------------------
  |  Branch (209:13): [True: 0, False: 653]
  ------------------
  210|      0|            goto err;
  211|    653|        aa->neg = 0;
  212|    653|        if (BN_RECP_CTX_set(&recp, aa, ctx) <= 0)
  ------------------
  |  Branch (212:13): [True: 0, False: 653]
  ------------------
  213|      0|            goto err;
  214|    864|    } else {
  215|    864|        if (BN_RECP_CTX_set(&recp, m, ctx) <= 0)
  ------------------
  |  Branch (215:13): [True: 0, False: 864]
  ------------------
  216|      0|            goto err;
  217|    864|    }
  218|       |
  219|  1.51k|    if (!BN_nnmod(val[0], a, m, ctx))
  ------------------
  |  Branch (219:9): [True: 0, False: 1.51k]
  ------------------
  220|      0|        goto err;               /* 1 */
  221|  1.51k|    if (BN_is_zero(val[0])) {
  ------------------
  |  Branch (221:9): [True: 37, False: 1.48k]
  ------------------
  222|     37|        BN_zero(r);
  ------------------
  |  |  202|     37|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  223|     37|        ret = 1;
  224|     37|        goto err;
  225|     37|    }
  226|       |
  227|  1.48k|    window = BN_window_bits_for_exponent_size(bits);
  ------------------
  |  |  322|  1.48k|                ((b) > 671 ? 6 : \
  |  |  ------------------
  |  |  |  Branch (322:18): [True: 17, False: 1.46k]
  |  |  ------------------
  |  |  323|  1.48k|                 (b) > 239 ? 5 : \
  |  |  ------------------
  |  |  |  Branch (323:18): [True: 21, False: 1.44k]
  |  |  ------------------
  |  |  324|  1.46k|                 (b) >  79 ? 4 : \
  |  |  ------------------
  |  |  |  Branch (324:18): [True: 66, False: 1.37k]
  |  |  ------------------
  |  |  325|  1.44k|                 (b) >  23 ? 3 : 1)
  |  |  ------------------
  |  |  |  Branch (325:18): [True: 121, False: 1.25k]
  |  |  ------------------
  ------------------
  228|  1.48k|    if (window > 1) {
  ------------------
  |  Branch (228:9): [True: 225, False: 1.25k]
  ------------------
  229|    225|        if (!BN_mod_mul_reciprocal(aa, val[0], val[0], &recp, ctx))
  ------------------
  |  Branch (229:13): [True: 0, False: 225]
  ------------------
  230|      0|            goto err;           /* 2 */
  231|    225|        j = 1 << (window - 1);
  232|  1.89k|        for (i = 1; i < j; i++) {
  ------------------
  |  Branch (232:21): [True: 1.66k, False: 225]
  ------------------
  233|  1.66k|            if (((val[i] = BN_CTX_get(ctx)) == NULL) ||
  ------------------
  |  Branch (233:17): [True: 0, False: 1.66k]
  ------------------
  234|  1.66k|                !BN_mod_mul_reciprocal(val[i], val[i - 1], aa, &recp, ctx))
  ------------------
  |  Branch (234:17): [True: 0, False: 1.66k]
  ------------------
  235|      0|                goto err;
  236|  1.66k|        }
  237|    225|    }
  238|       |
  239|  1.48k|    start = 1;                  /* This is used to avoid multiplication etc
  240|       |                                 * when there is only the value '1' in the
  241|       |                                 * buffer. */
  242|  1.48k|    wstart = bits - 1;          /* The top bit of the window */
  243|  1.48k|    wend = 0;                   /* The bottom bit of the window */
  244|       |
  245|  1.48k|    if (r == p) {
  ------------------
  |  Branch (245:9): [True: 0, False: 1.48k]
  ------------------
  246|      0|        BIGNUM *p_dup = BN_CTX_get(ctx);
  247|       |
  248|      0|        if (p_dup == NULL || BN_copy(p_dup, p) == NULL)
  ------------------
  |  Branch (248:13): [True: 0, False: 0]
  |  Branch (248:30): [True: 0, False: 0]
  ------------------
  249|      0|            goto err;
  250|      0|        p = p_dup;
  251|      0|    }
  252|       |
  253|  1.48k|    if (!BN_one(r))
  ------------------
  |  |  197|  1.48k|# define BN_one(a)       (BN_set_word((a),1))
  ------------------
  |  Branch (253:9): [True: 0, False: 1.48k]
  ------------------
  254|      0|        goto err;
  255|       |
  256|  36.1k|    for (;;) {
  257|  36.1k|        int wvalue;             /* The 'value' of the window */
  258|       |
  259|  36.1k|        if (BN_is_bit_set(p, wstart) == 0) {
  ------------------
  |  Branch (259:13): [True: 21.1k, False: 15.0k]
  ------------------
  260|  21.1k|            if (!start)
  ------------------
  |  Branch (260:17): [True: 21.1k, False: 0]
  ------------------
  261|  21.1k|                if (!BN_mod_mul_reciprocal(r, r, r, &recp, ctx))
  ------------------
  |  Branch (261:21): [True: 0, False: 21.1k]
  ------------------
  262|      0|                    goto err;
  263|  21.1k|            if (wstart == 0)
  ------------------
  |  Branch (263:17): [True: 443, False: 20.6k]
  ------------------
  264|    443|                break;
  265|  20.6k|            wstart--;
  266|  20.6k|            continue;
  267|  21.1k|        }
  268|       |        /*
  269|       |         * We now have wstart on a 'set' bit, we now need to work out how bit
  270|       |         * a window to do.  To do this we need to scan forward until the last
  271|       |         * set bit before the end of the window
  272|       |         */
  273|  15.0k|        wvalue = 1;
  274|  15.0k|        wend = 0;
  275|  39.4k|        for (i = 1; i < window; i++) {
  ------------------
  |  Branch (275:21): [True: 24.4k, False: 14.9k]
  ------------------
  276|  24.4k|            if (wstart - i < 0)
  ------------------
  |  Branch (276:17): [True: 106, False: 24.3k]
  ------------------
  277|    106|                break;
  278|  24.3k|            if (BN_is_bit_set(p, wstart - i)) {
  ------------------
  |  Branch (278:17): [True: 16.7k, False: 7.60k]
  ------------------
  279|  16.7k|                wvalue <<= (i - wend);
  280|  16.7k|                wvalue |= 1;
  281|  16.7k|                wend = i;
  282|  16.7k|            }
  283|  24.3k|        }
  284|       |
  285|       |        /* wend is the size of the current window */
  286|  15.0k|        j = wend + 1;
  287|       |        /* add the 'bytes above' */
  288|  15.0k|        if (!start)
  ------------------
  |  Branch (288:13): [True: 13.5k, False: 1.48k]
  ------------------
  289|  46.5k|            for (i = 0; i < j; i++) {
  ------------------
  |  Branch (289:25): [True: 33.0k, False: 13.5k]
  ------------------
  290|  33.0k|                if (!BN_mod_mul_reciprocal(r, r, r, &recp, ctx))
  ------------------
  |  Branch (290:21): [True: 0, False: 33.0k]
  ------------------
  291|      0|                    goto err;
  292|  33.0k|            }
  293|       |
  294|       |        /* wvalue will be an odd number < 2^window */
  295|  15.0k|        if (!BN_mod_mul_reciprocal(r, r, val[wvalue >> 1], &recp, ctx))
  ------------------
  |  Branch (295:13): [True: 0, False: 15.0k]
  ------------------
  296|      0|            goto err;
  297|       |
  298|       |        /* move the 'window' down further */
  299|  15.0k|        wstart -= wend + 1;
  300|  15.0k|        start = 0;
  301|  15.0k|        if (wstart < 0)
  ------------------
  |  Branch (301:13): [True: 1.03k, False: 13.9k]
  ------------------
  302|  1.03k|            break;
  303|  15.0k|    }
  304|  1.48k|    ret = 1;
  305|  1.51k| err:
  306|  1.51k|    BN_CTX_end(ctx);
  307|  1.51k|    BN_RECP_CTX_free(&recp);
  308|  1.51k|    bn_check_top(r);
  309|  1.51k|    return ret;
  310|  1.48k|}
BN_mod_exp_mont:
  314|  1.01k|{
  315|  1.01k|    int i, j, bits, ret = 0, wstart, wend, window;
  316|  1.01k|    int start = 1;
  317|  1.01k|    BIGNUM *d, *r;
  318|  1.01k|    const BIGNUM *aa;
  319|       |    /* Table of variables obtained from 'ctx' */
  320|  1.01k|    BIGNUM *val[TABLE_SIZE];
  321|  1.01k|    BN_MONT_CTX *mont = NULL;
  322|       |
  323|  1.01k|    bn_check_top(a);
  324|  1.01k|    bn_check_top(p);
  325|  1.01k|    bn_check_top(m);
  326|       |
  327|  1.01k|    if (!BN_is_odd(m)) {
  ------------------
  |  Branch (327:9): [True: 0, False: 1.01k]
  ------------------
  328|      0|        ERR_raise(ERR_LIB_BN, BN_R_CALLED_WITH_EVEN_MODULUS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  329|      0|        return 0;
  330|      0|    }
  331|       |
  332|  1.01k|    if (m->top <= BN_CONSTTIME_SIZE_LIMIT
  ------------------
  |  |   46|  2.03k|#define BN_CONSTTIME_SIZE_LIMIT (INT_MAX / BN_BYTES / 256)
  |  |  ------------------
  |  |  |  |   38|  1.01k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  |  Branch (332:9): [True: 1.01k, False: 0]
  ------------------
  333|  1.01k|        && (BN_get_flags(p, BN_FLG_CONSTTIME) != 0
  ------------------
  |  |   67|  1.01k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (333:13): [True: 0, False: 1.01k]
  ------------------
  334|  1.01k|            || BN_get_flags(a, BN_FLG_CONSTTIME) != 0
  ------------------
  |  |   67|  1.01k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (334:16): [True: 0, False: 1.01k]
  ------------------
  335|  1.01k|            || BN_get_flags(m, BN_FLG_CONSTTIME) != 0)) {
  ------------------
  |  |   67|  1.01k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (335:16): [True: 0, False: 1.01k]
  ------------------
  336|      0|        return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont);
  337|      0|    }
  338|       |
  339|  1.01k|    bits = BN_num_bits(p);
  340|  1.01k|    if (bits == 0) {
  ------------------
  |  Branch (340:9): [True: 122, False: 895]
  ------------------
  341|       |        /* x**0 mod 1, or x**0 mod -1 is still zero. */
  342|    122|        if (BN_abs_is_word(m, 1)) {
  ------------------
  |  Branch (342:13): [True: 1, False: 121]
  ------------------
  343|      1|            ret = 1;
  344|      1|            BN_zero(rr);
  ------------------
  |  |  202|      1|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  345|    121|        } else {
  346|    121|            ret = BN_one(rr);
  ------------------
  |  |  197|    121|# define BN_one(a)       (BN_set_word((a),1))
  ------------------
  347|    121|        }
  348|    122|        return ret;
  349|    122|    }
  350|       |
  351|    895|    BN_CTX_start(ctx);
  352|    895|    d = BN_CTX_get(ctx);
  353|    895|    r = BN_CTX_get(ctx);
  354|    895|    val[0] = BN_CTX_get(ctx);
  355|    895|    if (val[0] == NULL)
  ------------------
  |  Branch (355:9): [True: 0, False: 895]
  ------------------
  356|      0|        goto err;
  357|       |
  358|       |    /*
  359|       |     * If this is not done, things will break in the montgomery part
  360|       |     */
  361|       |
  362|    895|    if (in_mont != NULL)
  ------------------
  |  Branch (362:9): [True: 0, False: 895]
  ------------------
  363|      0|        mont = in_mont;
  364|    895|    else {
  365|    895|        if ((mont = BN_MONT_CTX_new()) == NULL)
  ------------------
  |  Branch (365:13): [True: 0, False: 895]
  ------------------
  366|      0|            goto err;
  367|    895|        if (!BN_MONT_CTX_set(mont, m, ctx))
  ------------------
  |  Branch (367:13): [True: 0, False: 895]
  ------------------
  368|      0|            goto err;
  369|    895|    }
  370|       |
  371|    895|    if (a->neg || BN_ucmp(a, m) >= 0) {
  ------------------
  |  Branch (371:9): [True: 187, False: 708]
  |  Branch (371:19): [True: 9, False: 699]
  ------------------
  372|    196|        if (!BN_nnmod(val[0], a, m, ctx))
  ------------------
  |  Branch (372:13): [True: 0, False: 196]
  ------------------
  373|      0|            goto err;
  374|    196|        aa = val[0];
  375|    196|    } else
  376|    699|        aa = a;
  377|    895|    if (!bn_to_mont_fixed_top(val[0], aa, mont, ctx))
  ------------------
  |  Branch (377:9): [True: 0, False: 895]
  ------------------
  378|      0|        goto err;               /* 1 */
  379|       |
  380|    895|    window = BN_window_bits_for_exponent_size(bits);
  ------------------
  |  |  322|    895|                ((b) > 671 ? 6 : \
  |  |  ------------------
  |  |  |  Branch (322:18): [True: 13, False: 882]
  |  |  ------------------
  |  |  323|    895|                 (b) > 239 ? 5 : \
  |  |  ------------------
  |  |  |  Branch (323:18): [True: 23, False: 859]
  |  |  ------------------
  |  |  324|    882|                 (b) >  79 ? 4 : \
  |  |  ------------------
  |  |  |  Branch (324:18): [True: 24, False: 835]
  |  |  ------------------
  |  |  325|    859|                 (b) >  23 ? 3 : 1)
  |  |  ------------------
  |  |  |  Branch (325:18): [True: 41, False: 794]
  |  |  ------------------
  ------------------
  381|    895|    if (window > 1) {
  ------------------
  |  Branch (381:9): [True: 101, False: 794]
  ------------------
  382|    101|        if (!bn_mul_mont_fixed_top(d, val[0], val[0], mont, ctx))
  ------------------
  |  Branch (382:13): [True: 0, False: 101]
  ------------------
  383|      0|            goto err;           /* 2 */
  384|    101|        j = 1 << (window - 1);
  385|  1.14k|        for (i = 1; i < j; i++) {
  ------------------
  |  Branch (385:21): [True: 1.03k, False: 101]
  ------------------
  386|  1.03k|            if (((val[i] = BN_CTX_get(ctx)) == NULL) ||
  ------------------
  |  Branch (386:17): [True: 0, False: 1.03k]
  ------------------
  387|  1.03k|                !bn_mul_mont_fixed_top(val[i], val[i - 1], d, mont, ctx))
  ------------------
  |  Branch (387:17): [True: 0, False: 1.03k]
  ------------------
  388|      0|                goto err;
  389|  1.03k|        }
  390|    101|    }
  391|       |
  392|    895|    start = 1;                  /* This is used to avoid multiplication etc
  393|       |                                 * when there is only the value '1' in the
  394|       |                                 * buffer. */
  395|    895|    wstart = bits - 1;          /* The top bit of the window */
  396|    895|    wend = 0;                   /* The bottom bit of the window */
  397|       |
  398|    895|#if 1                           /* by Shay Gueron's suggestion */
  399|    895|    j = m->top;                 /* borrow j */
  400|    895|    if (m->d[j - 1] & (((BN_ULONG)1) << (BN_BITS2 - 1))) {
  ------------------
  |  |   54|    895|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|    895|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  |  Branch (400:9): [True: 130, False: 765]
  ------------------
  401|    130|        if (bn_wexpand(r, j) == NULL)
  ------------------
  |  Branch (401:13): [True: 0, False: 130]
  ------------------
  402|      0|            goto err;
  403|       |        /* 2^(top*BN_BITS2) - m */
  404|    130|        r->d[0] = (0 - m->d[0]) & BN_MASK2;
  ------------------
  |  |   94|    130|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  405|    323|        for (i = 1; i < j; i++)
  ------------------
  |  Branch (405:21): [True: 193, False: 130]
  ------------------
  406|    193|            r->d[i] = (~m->d[i]) & BN_MASK2;
  ------------------
  |  |   94|    323|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  407|    130|        r->top = j;
  408|    130|        r->flags |= BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|    130|#  define BN_FLG_FIXED_TOP 0
  ------------------
  409|    130|    } else
  410|    765|#endif
  411|    765|    if (!bn_to_mont_fixed_top(r, BN_value_one(), mont, ctx))
  ------------------
  |  Branch (411:9): [True: 0, False: 765]
  ------------------
  412|      0|        goto err;
  413|  24.2k|    for (;;) {
  414|  24.2k|        int wvalue;             /* The 'value' of the window */
  415|       |
  416|  24.2k|        if (BN_is_bit_set(p, wstart) == 0) {
  ------------------
  |  Branch (416:13): [True: 15.0k, False: 9.17k]
  ------------------
  417|  15.0k|            if (!start) {
  ------------------
  |  Branch (417:17): [True: 15.0k, False: 0]
  ------------------
  418|  15.0k|                if (!bn_mul_mont_fixed_top(r, r, r, mont, ctx))
  ------------------
  |  Branch (418:21): [True: 0, False: 15.0k]
  ------------------
  419|      0|                    goto err;
  420|  15.0k|            }
  421|  15.0k|            if (wstart == 0)
  ------------------
  |  Branch (421:17): [True: 388, False: 14.6k]
  ------------------
  422|    388|                break;
  423|  14.6k|            wstart--;
  424|  14.6k|            continue;
  425|  15.0k|        }
  426|       |        /*
  427|       |         * We now have wstart on a 'set' bit, we now need to work out how bit
  428|       |         * a window to do.  To do this we need to scan forward until the last
  429|       |         * set bit before the end of the window
  430|       |         */
  431|  9.17k|        wvalue = 1;
  432|  9.17k|        wend = 0;
  433|  30.4k|        for (i = 1; i < window; i++) {
  ------------------
  |  Branch (433:21): [True: 21.3k, False: 9.11k]
  ------------------
  434|  21.3k|            if (wstart - i < 0)
  ------------------
  |  Branch (434:17): [True: 54, False: 21.2k]
  ------------------
  435|     54|                break;
  436|  21.2k|            if (BN_is_bit_set(p, wstart - i)) {
  ------------------
  |  Branch (436:17): [True: 13.7k, False: 7.55k]
  ------------------
  437|  13.7k|                wvalue <<= (i - wend);
  438|  13.7k|                wvalue |= 1;
  439|  13.7k|                wend = i;
  440|  13.7k|            }
  441|  21.2k|        }
  442|       |
  443|       |        /* wend is the size of the current window */
  444|  9.17k|        j = wend + 1;
  445|       |        /* add the 'bytes above' */
  446|  9.17k|        if (!start)
  ------------------
  |  Branch (446:13): [True: 8.27k, False: 895]
  ------------------
  447|  33.2k|            for (i = 0; i < j; i++) {
  ------------------
  |  Branch (447:25): [True: 24.9k, False: 8.27k]
  ------------------
  448|  24.9k|                if (!bn_mul_mont_fixed_top(r, r, r, mont, ctx))
  ------------------
  |  Branch (448:21): [True: 0, False: 24.9k]
  ------------------
  449|      0|                    goto err;
  450|  24.9k|            }
  451|       |
  452|       |        /* wvalue will be an odd number < 2^window */
  453|  9.17k|        if (!bn_mul_mont_fixed_top(r, r, val[wvalue >> 1], mont, ctx))
  ------------------
  |  Branch (453:13): [True: 0, False: 9.17k]
  ------------------
  454|      0|            goto err;
  455|       |
  456|       |        /* move the 'window' down further */
  457|  9.17k|        wstart -= wend + 1;
  458|  9.17k|        start = 0;
  459|  9.17k|        if (wstart < 0)
  ------------------
  |  Branch (459:13): [True: 507, False: 8.66k]
  ------------------
  460|    507|            break;
  461|  9.17k|    }
  462|       |    /*
  463|       |     * Done with zero-padded intermediate BIGNUMs. Final BN_from_montgomery
  464|       |     * removes padding [if any] and makes return value suitable for public
  465|       |     * API consumer.
  466|       |     */
  467|       |#if defined(SPARC_T4_MONT)
  468|       |    if (OPENSSL_sparcv9cap_P[0] & (SPARCV9_VIS3 | SPARCV9_PREFER_FPU)) {
  469|       |        j = mont->N.top;        /* borrow j */
  470|       |        val[0]->d[0] = 1;       /* borrow val[0] */
  471|       |        for (i = 1; i < j; i++)
  472|       |            val[0]->d[i] = 0;
  473|       |        val[0]->top = j;
  474|       |        if (!BN_mod_mul_montgomery(rr, r, val[0], mont, ctx))
  475|       |            goto err;
  476|       |    } else
  477|       |#endif
  478|    895|    if (!BN_from_montgomery(rr, r, mont, ctx))
  ------------------
  |  Branch (478:9): [True: 0, False: 895]
  ------------------
  479|      0|        goto err;
  480|    895|    ret = 1;
  481|    895| err:
  482|    895|    if (in_mont == NULL)
  ------------------
  |  Branch (482:9): [True: 895, False: 0]
  ------------------
  483|    895|        BN_MONT_CTX_free(mont);
  484|    895|    BN_CTX_end(ctx);
  485|    895|    bn_check_top(rr);
  486|    895|    return ret;
  487|    895|}
BN_mod_exp_mont_word:
 1174|    393|{
 1175|    393|    BN_MONT_CTX *mont = NULL;
 1176|    393|    int b, bits, ret = 0;
 1177|    393|    int r_is_one;
 1178|    393|    BN_ULONG w, next_w;
  ------------------
  |  |   37|    393|#  define BN_ULONG        unsigned long
  ------------------
 1179|    393|    BIGNUM *r, *t;
 1180|    393|    BIGNUM *swap_tmp;
 1181|    393|#define BN_MOD_MUL_WORD(r, w, m) \
 1182|    393|                (BN_mul_word(r, (w)) && \
 1183|    393|                (/* BN_ucmp(r, (m)) < 0 ? 1 :*/  \
 1184|    393|                        (BN_mod(t, r, m, ctx) && (swap_tmp = r, r = t, t = swap_tmp, 1))))
 1185|       |    /*
 1186|       |     * BN_MOD_MUL_WORD is only used with 'w' large, so the BN_ucmp test is
 1187|       |     * probably more overhead than always using BN_mod (which uses BN_copy if
 1188|       |     * a similar test returns true).
 1189|       |     */
 1190|       |    /*
 1191|       |     * We can use BN_mod and do not need BN_nnmod because our accumulator is
 1192|       |     * never negative (the result of BN_mod does not depend on the sign of
 1193|       |     * the modulus).
 1194|       |     */
 1195|    393|#define BN_TO_MONTGOMERY_WORD(r, w, mont) \
 1196|    393|                (BN_set_word(r, (w)) && BN_to_montgomery(r, r, (mont), ctx))
 1197|       |
 1198|    393|    if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0
  ------------------
  |  |   67|    393|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (1198:9): [True: 0, False: 393]
  ------------------
 1199|    393|            || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) {
  ------------------
  |  |   67|    393|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (1199:16): [True: 0, False: 393]
  ------------------
 1200|       |        /* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */
 1201|      0|        ERR_raise(ERR_LIB_BN, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1202|      0|        return 0;
 1203|      0|    }
 1204|       |
 1205|    393|    bn_check_top(p);
 1206|    393|    bn_check_top(m);
 1207|       |
 1208|    393|    if (!BN_is_odd(m)) {
  ------------------
  |  Branch (1208:9): [True: 0, False: 393]
  ------------------
 1209|      0|        ERR_raise(ERR_LIB_BN, BN_R_CALLED_WITH_EVEN_MODULUS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1210|      0|        return 0;
 1211|      0|    }
 1212|    393|    if (m->top == 1)
  ------------------
  |  Branch (1212:9): [True: 327, False: 66]
  ------------------
 1213|    327|        a %= m->d[0];           /* make sure that 'a' is reduced */
 1214|       |
 1215|    393|    bits = BN_num_bits(p);
 1216|    393|    if (bits == 0) {
  ------------------
  |  Branch (1216:9): [True: 8, False: 385]
  ------------------
 1217|       |        /* x**0 mod 1, or x**0 mod -1 is still zero. */
 1218|      8|        if (BN_abs_is_word(m, 1)) {
  ------------------
  |  Branch (1218:13): [True: 1, False: 7]
  ------------------
 1219|      1|            ret = 1;
 1220|      1|            BN_zero(rr);
  ------------------
  |  |  202|      1|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
 1221|      7|        } else {
 1222|      7|            ret = BN_one(rr);
  ------------------
  |  |  197|      7|# define BN_one(a)       (BN_set_word((a),1))
  ------------------
 1223|      7|        }
 1224|      8|        return ret;
 1225|      8|    }
 1226|    385|    if (a == 0) {
  ------------------
  |  Branch (1226:9): [True: 1, False: 384]
  ------------------
 1227|      1|        BN_zero(rr);
  ------------------
  |  |  202|      1|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
 1228|      1|        ret = 1;
 1229|      1|        return ret;
 1230|      1|    }
 1231|       |
 1232|    384|    BN_CTX_start(ctx);
 1233|    384|    r = BN_CTX_get(ctx);
 1234|    384|    t = BN_CTX_get(ctx);
 1235|    384|    if (t == NULL)
  ------------------
  |  Branch (1235:9): [True: 0, False: 384]
  ------------------
 1236|      0|        goto err;
 1237|       |
 1238|    384|    if (in_mont != NULL)
  ------------------
  |  Branch (1238:9): [True: 0, False: 384]
  ------------------
 1239|      0|        mont = in_mont;
 1240|    384|    else {
 1241|    384|        if ((mont = BN_MONT_CTX_new()) == NULL)
  ------------------
  |  Branch (1241:13): [True: 0, False: 384]
  ------------------
 1242|      0|            goto err;
 1243|    384|        if (!BN_MONT_CTX_set(mont, m, ctx))
  ------------------
  |  Branch (1243:13): [True: 0, False: 384]
  ------------------
 1244|      0|            goto err;
 1245|    384|    }
 1246|       |
 1247|    384|    r_is_one = 1;               /* except for Montgomery factor */
 1248|       |
 1249|       |    /* bits-1 >= 0 */
 1250|       |
 1251|       |    /* The result is accumulated in the product r*w. */
 1252|    384|    w = a;                      /* bit 'bits-1' of 'p' is always set */
 1253|  13.9k|    for (b = bits - 2; b >= 0; b--) {
  ------------------
  |  Branch (1253:24): [True: 13.5k, False: 384]
  ------------------
 1254|       |        /* First, square r*w. */
 1255|  13.5k|        next_w = w * w;
 1256|  13.5k|        if ((next_w / w) != w) { /* overflow */
  ------------------
  |  Branch (1256:13): [True: 2.99k, False: 10.5k]
  ------------------
 1257|  2.99k|            if (r_is_one) {
  ------------------
  |  Branch (1257:17): [True: 276, False: 2.72k]
  ------------------
 1258|    276|                if (!BN_TO_MONTGOMERY_WORD(r, w, mont))
  ------------------
  |  | 1196|    276|                (BN_set_word(r, (w)) && BN_to_montgomery(r, r, (mont), ctx))
  |  |  ------------------
  |  |  |  Branch (1196:18): [True: 276, False: 0]
  |  |  |  Branch (1196:41): [True: 276, False: 0]
  |  |  ------------------
  ------------------
 1259|      0|                    goto err;
 1260|    276|                r_is_one = 0;
 1261|  2.72k|            } else {
 1262|  2.72k|                if (!BN_MOD_MUL_WORD(r, w, m))
  ------------------
  |  | 1182|  2.72k|                (BN_mul_word(r, (w)) && \
  |  |  ------------------
  |  |  |  Branch (1182:18): [True: 2.72k, False: 0]
  |  |  ------------------
  |  | 1183|  2.72k|                (/* BN_ucmp(r, (m)) < 0 ? 1 :*/  \
  |  | 1184|  2.72k|                        (BN_mod(t, r, m, ctx) && (swap_tmp = r, r = t, t = swap_tmp, 1))))
  |  |  ------------------
  |  |  |  |  277|  5.44k|# define BN_mod(rem,m,d,ctx) BN_div(NULL,(rem),(m),(d),(ctx))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (277:30): [True: 2.72k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1184:50): [True: 2.72k, False: 0]
  |  |  ------------------
  ------------------
 1263|      0|                    goto err;
 1264|  2.72k|            }
 1265|  2.99k|            next_w = 1;
 1266|  2.99k|        }
 1267|  13.5k|        w = next_w;
 1268|  13.5k|        if (!r_is_one) {
  ------------------
  |  Branch (1268:13): [True: 12.1k, False: 1.44k]
  ------------------
 1269|  12.1k|            if (!BN_mod_mul_montgomery(r, r, r, mont, ctx))
  ------------------
  |  Branch (1269:17): [True: 0, False: 12.1k]
  ------------------
 1270|      0|                goto err;
 1271|  12.1k|        }
 1272|       |
 1273|       |        /* Second, multiply r*w by 'a' if exponent bit is set. */
 1274|  13.5k|        if (BN_is_bit_set(p, b)) {
  ------------------
  |  Branch (1274:13): [True: 7.90k, False: 5.64k]
  ------------------
 1275|  7.90k|            next_w = w * a;
 1276|  7.90k|            if ((next_w / a) != w) { /* overflow */
  ------------------
  |  Branch (1276:17): [True: 1.18k, False: 6.72k]
  ------------------
 1277|  1.18k|                if (r_is_one) {
  ------------------
  |  Branch (1277:21): [True: 85, False: 1.10k]
  ------------------
 1278|     85|                    if (!BN_TO_MONTGOMERY_WORD(r, w, mont))
  ------------------
  |  | 1196|     85|                (BN_set_word(r, (w)) && BN_to_montgomery(r, r, (mont), ctx))
  |  |  ------------------
  |  |  |  Branch (1196:18): [True: 85, False: 0]
  |  |  |  Branch (1196:41): [True: 85, False: 0]
  |  |  ------------------
  ------------------
 1279|      0|                        goto err;
 1280|     85|                    r_is_one = 0;
 1281|  1.10k|                } else {
 1282|  1.10k|                    if (!BN_MOD_MUL_WORD(r, w, m))
  ------------------
  |  | 1182|  1.10k|                (BN_mul_word(r, (w)) && \
  |  |  ------------------
  |  |  |  Branch (1182:18): [True: 1.10k, False: 0]
  |  |  ------------------
  |  | 1183|  1.10k|                (/* BN_ucmp(r, (m)) < 0 ? 1 :*/  \
  |  | 1184|  1.10k|                        (BN_mod(t, r, m, ctx) && (swap_tmp = r, r = t, t = swap_tmp, 1))))
  |  |  ------------------
  |  |  |  |  277|  2.20k|# define BN_mod(rem,m,d,ctx) BN_div(NULL,(rem),(m),(d),(ctx))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (277:30): [True: 1.10k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1184:50): [True: 1.10k, False: 0]
  |  |  ------------------
  ------------------
 1283|      0|                        goto err;
 1284|  1.10k|                }
 1285|  1.18k|                next_w = a;
 1286|  1.18k|            }
 1287|  7.90k|            w = next_w;
 1288|  7.90k|        }
 1289|  13.5k|    }
 1290|       |
 1291|       |    /* Finally, set r:=r*w. */
 1292|    384|    if (w != 1) {
  ------------------
  |  Branch (1292:9): [True: 341, False: 43]
  ------------------
 1293|    341|        if (r_is_one) {
  ------------------
  |  Branch (1293:13): [True: 15, False: 326]
  ------------------
 1294|     15|            if (!BN_TO_MONTGOMERY_WORD(r, w, mont))
  ------------------
  |  | 1196|     15|                (BN_set_word(r, (w)) && BN_to_montgomery(r, r, (mont), ctx))
  |  |  ------------------
  |  |  |  Branch (1196:18): [True: 15, False: 0]
  |  |  |  Branch (1196:41): [True: 15, False: 0]
  |  |  ------------------
  ------------------
 1295|      0|                goto err;
 1296|     15|            r_is_one = 0;
 1297|    326|        } else {
 1298|    326|            if (!BN_MOD_MUL_WORD(r, w, m))
  ------------------
  |  | 1182|    326|                (BN_mul_word(r, (w)) && \
  |  |  ------------------
  |  |  |  Branch (1182:18): [True: 326, False: 0]
  |  |  ------------------
  |  | 1183|    326|                (/* BN_ucmp(r, (m)) < 0 ? 1 :*/  \
  |  | 1184|    326|                        (BN_mod(t, r, m, ctx) && (swap_tmp = r, r = t, t = swap_tmp, 1))))
  |  |  ------------------
  |  |  |  |  277|    652|# define BN_mod(rem,m,d,ctx) BN_div(NULL,(rem),(m),(d),(ctx))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (277:30): [True: 326, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1184:50): [True: 326, False: 0]
  |  |  ------------------
  ------------------
 1299|      0|                goto err;
 1300|    326|        }
 1301|    341|    }
 1302|       |
 1303|    384|    if (r_is_one) {             /* can happen only if a == 1 */
  ------------------
  |  Branch (1303:9): [True: 8, False: 376]
  ------------------
 1304|      8|        if (!BN_one(rr))
  ------------------
  |  |  197|      8|# define BN_one(a)       (BN_set_word((a),1))
  ------------------
  |  Branch (1304:13): [True: 0, False: 8]
  ------------------
 1305|      0|            goto err;
 1306|    376|    } else {
 1307|    376|        if (!BN_from_montgomery(rr, r, mont, ctx))
  ------------------
  |  Branch (1307:13): [True: 0, False: 376]
  ------------------
 1308|      0|            goto err;
 1309|    376|    }
 1310|    384|    ret = 1;
 1311|    384| err:
 1312|    384|    if (in_mont == NULL)
  ------------------
  |  Branch (1312:9): [True: 384, False: 0]
  ------------------
 1313|    384|        BN_MONT_CTX_free(mont);
 1314|    384|    BN_CTX_end(ctx);
 1315|    384|    bn_check_top(rr);
 1316|    384|    return ret;
 1317|    384|}
BN_mod_exp_simple:
 1322|  2.99k|{
 1323|  2.99k|    int i, j, bits, ret = 0, wstart, wend, window;
 1324|  2.99k|    int start = 1;
 1325|  2.99k|    BIGNUM *d;
 1326|       |    /* Table of variables obtained from 'ctx' */
 1327|  2.99k|    BIGNUM *val[TABLE_SIZE];
 1328|       |
 1329|  2.99k|    if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0
  ------------------
  |  |   67|  2.99k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (1329:9): [True: 0, False: 2.99k]
  ------------------
 1330|  2.99k|            || BN_get_flags(a, BN_FLG_CONSTTIME) != 0
  ------------------
  |  |   67|  2.99k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (1330:16): [True: 0, False: 2.99k]
  ------------------
 1331|  2.99k|            || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) {
  ------------------
  |  |   67|  2.99k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (1331:16): [True: 0, False: 2.99k]
  ------------------
 1332|       |        /* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */
 1333|      0|        ERR_raise(ERR_LIB_BN, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1334|      0|        return 0;
 1335|      0|    }
 1336|       |
 1337|  2.99k|    if (r == m) {
  ------------------
  |  Branch (1337:9): [True: 0, False: 2.99k]
  ------------------
 1338|      0|        ERR_raise(ERR_LIB_BN, ERR_R_PASSED_INVALID_ARGUMENT);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1339|      0|        return 0;
 1340|      0|    }
 1341|       |
 1342|  2.99k|    bits = BN_num_bits(p);
 1343|  2.99k|    if (bits == 0) {
  ------------------
  |  Branch (1343:9): [True: 193, False: 2.79k]
  ------------------
 1344|       |        /* x**0 mod 1, or x**0 mod -1 is still zero. */
 1345|    193|        if (BN_abs_is_word(m, 1)) {
  ------------------
  |  Branch (1345:13): [True: 2, False: 191]
  ------------------
 1346|      2|            ret = 1;
 1347|      2|            BN_zero(r);
  ------------------
  |  |  202|      2|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
 1348|    191|        } else {
 1349|    191|            ret = BN_one(r);
  ------------------
  |  |  197|    191|# define BN_one(a)       (BN_set_word((a),1))
  ------------------
 1350|    191|        }
 1351|    193|        return ret;
 1352|    193|    }
 1353|       |
 1354|  2.79k|    BN_CTX_start(ctx);
 1355|  2.79k|    d = BN_CTX_get(ctx);
 1356|  2.79k|    val[0] = BN_CTX_get(ctx);
 1357|  2.79k|    if (val[0] == NULL)
  ------------------
  |  Branch (1357:9): [True: 0, False: 2.79k]
  ------------------
 1358|      0|        goto err;
 1359|       |
 1360|  2.79k|    if (!BN_nnmod(val[0], a, m, ctx))
  ------------------
  |  Branch (1360:9): [True: 0, False: 2.79k]
  ------------------
 1361|      0|        goto err;               /* 1 */
 1362|  2.79k|    if (BN_is_zero(val[0])) {
  ------------------
  |  Branch (1362:9): [True: 740, False: 2.05k]
  ------------------
 1363|    740|        BN_zero(r);
  ------------------
  |  |  202|    740|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
 1364|    740|        ret = 1;
 1365|    740|        goto err;
 1366|    740|    }
 1367|       |
 1368|  2.05k|    window = BN_window_bits_for_exponent_size(bits);
  ------------------
  |  |  322|  2.05k|                ((b) > 671 ? 6 : \
  |  |  ------------------
  |  |  |  Branch (322:18): [True: 23, False: 2.03k]
  |  |  ------------------
  |  |  323|  2.05k|                 (b) > 239 ? 5 : \
  |  |  ------------------
  |  |  |  Branch (323:18): [True: 27, False: 2.00k]
  |  |  ------------------
  |  |  324|  2.03k|                 (b) >  79 ? 4 : \
  |  |  ------------------
  |  |  |  Branch (324:18): [True: 86, False: 1.92k]
  |  |  ------------------
  |  |  325|  2.00k|                 (b) >  23 ? 3 : 1)
  |  |  ------------------
  |  |  |  Branch (325:18): [True: 167, False: 1.75k]
  |  |  ------------------
  ------------------
 1369|  2.05k|    if (window > 1) {
  ------------------
  |  Branch (1369:9): [True: 303, False: 1.75k]
  ------------------
 1370|    303|        if (!BN_mod_mul(d, val[0], val[0], m, ctx))
  ------------------
  |  Branch (1370:13): [True: 0, False: 303]
  ------------------
 1371|      0|            goto err;           /* 2 */
 1372|    303|        j = 1 << (window - 1);
 1373|  2.52k|        for (i = 1; i < j; i++) {
  ------------------
  |  Branch (1373:21): [True: 2.22k, False: 303]
  ------------------
 1374|  2.22k|            if (((val[i] = BN_CTX_get(ctx)) == NULL) ||
  ------------------
  |  Branch (1374:17): [True: 0, False: 2.22k]
  ------------------
 1375|  2.22k|                !BN_mod_mul(val[i], val[i - 1], d, m, ctx))
  ------------------
  |  Branch (1375:17): [True: 0, False: 2.22k]
  ------------------
 1376|      0|                goto err;
 1377|  2.22k|        }
 1378|    303|    }
 1379|       |
 1380|  2.05k|    start = 1;                  /* This is used to avoid multiplication etc
 1381|       |                                 * when there is only the value '1' in the
 1382|       |                                 * buffer. */
 1383|  2.05k|    wstart = bits - 1;          /* The top bit of the window */
 1384|  2.05k|    wend = 0;                   /* The bottom bit of the window */
 1385|       |
 1386|  2.05k|    if (r == p) {
  ------------------
  |  Branch (1386:9): [True: 0, False: 2.05k]
  ------------------
 1387|      0|        BIGNUM *p_dup = BN_CTX_get(ctx);
 1388|       |
 1389|      0|        if (p_dup == NULL || BN_copy(p_dup, p) == NULL)
  ------------------
  |  Branch (1389:13): [True: 0, False: 0]
  |  Branch (1389:30): [True: 0, False: 0]
  ------------------
 1390|      0|            goto err;
 1391|      0|        p = p_dup;
 1392|      0|    }
 1393|       |
 1394|  2.05k|    if (!BN_one(r))
  ------------------
  |  |  197|  2.05k|# define BN_one(a)       (BN_set_word((a),1))
  ------------------
  |  Branch (1394:9): [True: 0, False: 2.05k]
  ------------------
 1395|      0|        goto err;
 1396|       |
 1397|  47.5k|    for (;;) {
 1398|  47.5k|        int wvalue;             /* The 'value' of the window */
 1399|       |
 1400|  47.5k|        if (BN_is_bit_set(p, wstart) == 0) {
  ------------------
  |  Branch (1400:13): [True: 27.3k, False: 20.1k]
  ------------------
 1401|  27.3k|            if (!start)
  ------------------
  |  Branch (1401:17): [True: 27.3k, False: 0]
  ------------------
 1402|  27.3k|                if (!BN_mod_mul(r, r, r, m, ctx))
  ------------------
  |  Branch (1402:21): [True: 0, False: 27.3k]
  ------------------
 1403|      0|                    goto err;
 1404|  27.3k|            if (wstart == 0)
  ------------------
  |  Branch (1404:17): [True: 644, False: 26.6k]
  ------------------
 1405|    644|                break;
 1406|  26.6k|            wstart--;
 1407|  26.6k|            continue;
 1408|  27.3k|        }
 1409|       |        /*
 1410|       |         * We now have wstart on a 'set' bit, we now need to work out how bit
 1411|       |         * a window to do.  To do this we need to scan forward until the last
 1412|       |         * set bit before the end of the window
 1413|       |         */
 1414|  20.1k|        wvalue = 1;
 1415|  20.1k|        wend = 0;
 1416|  52.3k|        for (i = 1; i < window; i++) {
  ------------------
  |  Branch (1416:21): [True: 32.3k, False: 20.0k]
  ------------------
 1417|  32.3k|            if (wstart - i < 0)
  ------------------
  |  Branch (1417:17): [True: 149, False: 32.1k]
  ------------------
 1418|    149|                break;
 1419|  32.1k|            if (BN_is_bit_set(p, wstart - i)) {
  ------------------
  |  Branch (1419:17): [True: 22.1k, False: 10.0k]
  ------------------
 1420|  22.1k|                wvalue <<= (i - wend);
 1421|  22.1k|                wvalue |= 1;
 1422|  22.1k|                wend = i;
 1423|  22.1k|            }
 1424|  32.1k|        }
 1425|       |
 1426|       |        /* wend is the size of the current window */
 1427|  20.1k|        j = wend + 1;
 1428|       |        /* add the 'bytes above' */
 1429|  20.1k|        if (!start)
  ------------------
  |  Branch (1429:13): [True: 18.1k, False: 2.05k]
  ------------------
 1430|  62.1k|            for (i = 0; i < j; i++) {
  ------------------
  |  Branch (1430:25): [True: 43.9k, False: 18.1k]
  ------------------
 1431|  43.9k|                if (!BN_mod_mul(r, r, r, m, ctx))
  ------------------
  |  Branch (1431:21): [True: 0, False: 43.9k]
  ------------------
 1432|      0|                    goto err;
 1433|  43.9k|            }
 1434|       |
 1435|       |        /* wvalue will be an odd number < 2^window */
 1436|  20.1k|        if (!BN_mod_mul(r, r, val[wvalue >> 1], m, ctx))
  ------------------
  |  Branch (1436:13): [True: 0, False: 20.1k]
  ------------------
 1437|      0|            goto err;
 1438|       |
 1439|       |        /* move the 'window' down further */
 1440|  20.1k|        wstart -= wend + 1;
 1441|  20.1k|        start = 0;
 1442|  20.1k|        if (wstart < 0)
  ------------------
  |  Branch (1442:13): [True: 1.41k, False: 18.7k]
  ------------------
 1443|  1.41k|            break;
 1444|  20.1k|    }
 1445|  2.05k|    ret = 1;
 1446|  2.79k| err:
 1447|  2.79k|    BN_CTX_end(ctx);
 1448|  2.79k|    bn_check_top(r);
 1449|  2.79k|    return ret;
 1450|  2.05k|}

int_bn_mod_inverse:
  201|  1.25k|{
  202|  1.25k|    BIGNUM *A, *B, *X, *Y, *M, *D, *T, *R = NULL;
  203|  1.25k|    BIGNUM *ret = NULL;
  204|  1.25k|    int sign;
  205|       |
  206|       |    /* This is invalid input so we don't worry about constant time here */
  207|  1.25k|    if (BN_abs_is_word(n, 1) || BN_is_zero(n)) {
  ------------------
  |  Branch (207:9): [True: 0, False: 1.25k]
  |  Branch (207:33): [True: 0, False: 1.25k]
  ------------------
  208|      0|        *pnoinv = 1;
  209|      0|        return NULL;
  210|      0|    }
  211|       |
  212|  1.25k|    *pnoinv = 0;
  213|       |
  214|  1.25k|    if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0)
  ------------------
  |  |   67|  1.25k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (214:9): [True: 0, False: 1.25k]
  ------------------
  215|  1.25k|        || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) {
  ------------------
  |  |   67|  1.25k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (215:12): [True: 0, False: 1.25k]
  ------------------
  216|      0|        return bn_mod_inverse_no_branch(in, a, n, ctx, pnoinv);
  217|      0|    }
  218|       |
  219|  1.25k|    bn_check_top(a);
  220|  1.25k|    bn_check_top(n);
  221|       |
  222|  1.25k|    BN_CTX_start(ctx);
  223|  1.25k|    A = BN_CTX_get(ctx);
  224|  1.25k|    B = BN_CTX_get(ctx);
  225|  1.25k|    X = BN_CTX_get(ctx);
  226|  1.25k|    D = BN_CTX_get(ctx);
  227|  1.25k|    M = BN_CTX_get(ctx);
  228|  1.25k|    Y = BN_CTX_get(ctx);
  229|  1.25k|    T = BN_CTX_get(ctx);
  230|  1.25k|    if (T == NULL)
  ------------------
  |  Branch (230:9): [True: 0, False: 1.25k]
  ------------------
  231|      0|        goto err;
  232|       |
  233|  1.25k|    if (in == NULL)
  ------------------
  |  Branch (233:9): [True: 0, False: 1.25k]
  ------------------
  234|      0|        R = BN_new();
  235|  1.25k|    else
  236|  1.25k|        R = in;
  237|  1.25k|    if (R == NULL)
  ------------------
  |  Branch (237:9): [True: 0, False: 1.25k]
  ------------------
  238|      0|        goto err;
  239|       |
  240|  1.25k|    if (!BN_one(X))
  ------------------
  |  |  197|  1.25k|# define BN_one(a)       (BN_set_word((a),1))
  ------------------
  |  Branch (240:9): [True: 0, False: 1.25k]
  ------------------
  241|      0|        goto err;
  242|  1.25k|    BN_zero(Y);
  ------------------
  |  |  202|  1.25k|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  243|  1.25k|    if (BN_copy(B, a) == NULL)
  ------------------
  |  Branch (243:9): [True: 0, False: 1.25k]
  ------------------
  244|      0|        goto err;
  245|  1.25k|    if (BN_copy(A, n) == NULL)
  ------------------
  |  Branch (245:9): [True: 0, False: 1.25k]
  ------------------
  246|      0|        goto err;
  247|  1.25k|    A->neg = 0;
  248|  1.25k|    if (B->neg || (BN_ucmp(B, A) >= 0)) {
  ------------------
  |  Branch (248:9): [True: 0, False: 1.25k]
  |  Branch (248:19): [True: 1.25k, False: 0]
  ------------------
  249|  1.25k|        if (!BN_nnmod(B, B, A, ctx))
  ------------------
  |  Branch (249:13): [True: 0, False: 1.25k]
  ------------------
  250|      0|            goto err;
  251|  1.25k|    }
  252|  1.25k|    sign = -1;
  253|       |    /*-
  254|       |     * From  B = a mod |n|,  A = |n|  it follows that
  255|       |     *
  256|       |     *      0 <= B < A,
  257|       |     *     -sign*X*a  ==  B   (mod |n|),
  258|       |     *      sign*Y*a  ==  A   (mod |n|).
  259|       |     */
  260|       |
  261|  1.25k|    if (BN_is_odd(n) && (BN_num_bits(n) <= 2048)) {
  ------------------
  |  Branch (261:9): [True: 1.25k, False: 0]
  |  Branch (261:25): [True: 1.25k, False: 0]
  ------------------
  262|       |        /*
  263|       |         * Binary inversion algorithm; requires odd modulus. This is faster
  264|       |         * than the general algorithm if the modulus is sufficiently small
  265|       |         * (about 400 .. 500 bits on 32-bit systems, but much more on 64-bit
  266|       |         * systems)
  267|       |         */
  268|  1.25k|        int shift;
  269|       |
  270|  48.1k|        while (!BN_is_zero(B)) {
  ------------------
  |  Branch (270:16): [True: 46.8k, False: 1.25k]
  ------------------
  271|       |            /*-
  272|       |             *      0 < B < |n|,
  273|       |             *      0 < A <= |n|,
  274|       |             * (1) -sign*X*a  ==  B   (mod |n|),
  275|       |             * (2)  sign*Y*a  ==  A   (mod |n|)
  276|       |             */
  277|       |
  278|       |            /*
  279|       |             * Now divide B by the maximum possible power of two in the
  280|       |             * integers, and divide X by the same value mod |n|. When we're
  281|       |             * done, (1) still holds.
  282|       |             */
  283|  46.8k|            shift = 0;
  284|  63.0k|            while (!BN_is_bit_set(B, shift)) { /* note that 0 < B */
  ------------------
  |  Branch (284:20): [True: 16.2k, False: 46.8k]
  ------------------
  285|  16.2k|                shift++;
  286|       |
  287|  16.2k|                if (BN_is_odd(X)) {
  ------------------
  |  Branch (287:21): [True: 7.15k, False: 9.04k]
  ------------------
  288|  7.15k|                    if (!BN_uadd(X, X, n))
  ------------------
  |  Branch (288:25): [True: 0, False: 7.15k]
  ------------------
  289|      0|                        goto err;
  290|  7.15k|                }
  291|       |                /*
  292|       |                 * now X is even, so we can easily divide it by two
  293|       |                 */
  294|  16.2k|                if (!BN_rshift1(X, X))
  ------------------
  |  Branch (294:21): [True: 0, False: 16.2k]
  ------------------
  295|      0|                    goto err;
  296|  16.2k|            }
  297|  46.8k|            if (shift > 0) {
  ------------------
  |  Branch (297:17): [True: 11.4k, False: 35.3k]
  ------------------
  298|  11.4k|                if (!BN_rshift(B, B, shift))
  ------------------
  |  Branch (298:21): [True: 0, False: 11.4k]
  ------------------
  299|      0|                    goto err;
  300|  11.4k|            }
  301|       |
  302|       |            /*
  303|       |             * Same for A and Y.  Afterwards, (2) still holds.
  304|       |             */
  305|  46.8k|            shift = 0;
  306|  85.5k|            while (!BN_is_bit_set(A, shift)) { /* note that 0 < A */
  ------------------
  |  Branch (306:20): [True: 38.6k, False: 46.8k]
  ------------------
  307|  38.6k|                shift++;
  308|       |
  309|  38.6k|                if (BN_is_odd(Y)) {
  ------------------
  |  Branch (309:21): [True: 21.2k, False: 17.3k]
  ------------------
  310|  21.2k|                    if (!BN_uadd(Y, Y, n))
  ------------------
  |  Branch (310:25): [True: 0, False: 21.2k]
  ------------------
  311|      0|                        goto err;
  312|  21.2k|                }
  313|       |                /* now Y is even */
  314|  38.6k|                if (!BN_rshift1(Y, Y))
  ------------------
  |  Branch (314:21): [True: 0, False: 38.6k]
  ------------------
  315|      0|                    goto err;
  316|  38.6k|            }
  317|  46.8k|            if (shift > 0) {
  ------------------
  |  Branch (317:17): [True: 34.5k, False: 12.3k]
  ------------------
  318|  34.5k|                if (!BN_rshift(A, A, shift))
  ------------------
  |  Branch (318:21): [True: 0, False: 34.5k]
  ------------------
  319|      0|                    goto err;
  320|  34.5k|            }
  321|       |
  322|       |            /*-
  323|       |             * We still have (1) and (2).
  324|       |             * Both  A  and  B  are odd.
  325|       |             * The following computations ensure that
  326|       |             *
  327|       |             *     0 <= B < |n|,
  328|       |             *      0 < A < |n|,
  329|       |             * (1) -sign*X*a  ==  B   (mod |n|),
  330|       |             * (2)  sign*Y*a  ==  A   (mod |n|),
  331|       |             *
  332|       |             * and that either  A  or  B  is even in the next iteration.
  333|       |             */
  334|  46.8k|            if (BN_ucmp(B, A) >= 0) {
  ------------------
  |  Branch (334:17): [True: 12.3k, False: 34.5k]
  ------------------
  335|       |                /* -sign*(X + Y)*a == B - A  (mod |n|) */
  336|  12.3k|                if (!BN_uadd(X, X, Y))
  ------------------
  |  Branch (336:21): [True: 0, False: 12.3k]
  ------------------
  337|      0|                    goto err;
  338|       |                /*
  339|       |                 * NB: we could use BN_mod_add_quick(X, X, Y, n), but that
  340|       |                 * actually makes the algorithm slower
  341|       |                 */
  342|  12.3k|                if (!BN_usub(B, B, A))
  ------------------
  |  Branch (342:21): [True: 0, False: 12.3k]
  ------------------
  343|      0|                    goto err;
  344|  34.5k|            } else {
  345|       |                /*  sign*(X + Y)*a == A - B  (mod |n|) */
  346|  34.5k|                if (!BN_uadd(Y, Y, X))
  ------------------
  |  Branch (346:21): [True: 0, False: 34.5k]
  ------------------
  347|      0|                    goto err;
  348|       |                /*
  349|       |                 * as above, BN_mod_add_quick(Y, Y, X, n) would slow things down
  350|       |                 */
  351|  34.5k|                if (!BN_usub(A, A, B))
  ------------------
  |  Branch (351:21): [True: 0, False: 34.5k]
  ------------------
  352|      0|                    goto err;
  353|  34.5k|            }
  354|  46.8k|        }
  355|  1.25k|    } else {
  356|       |        /* general inversion algorithm */
  357|       |
  358|      0|        while (!BN_is_zero(B)) {
  ------------------
  |  Branch (358:16): [True: 0, False: 0]
  ------------------
  359|      0|            BIGNUM *tmp;
  360|       |
  361|       |            /*-
  362|       |             *      0 < B < A,
  363|       |             * (*) -sign*X*a  ==  B   (mod |n|),
  364|       |             *      sign*Y*a  ==  A   (mod |n|)
  365|       |             */
  366|       |
  367|       |            /* (D, M) := (A/B, A%B) ... */
  368|      0|            if (BN_num_bits(A) == BN_num_bits(B)) {
  ------------------
  |  Branch (368:17): [True: 0, False: 0]
  ------------------
  369|      0|                if (!BN_one(D))
  ------------------
  |  |  197|      0|# define BN_one(a)       (BN_set_word((a),1))
  ------------------
  |  Branch (369:21): [True: 0, False: 0]
  ------------------
  370|      0|                    goto err;
  371|      0|                if (!BN_sub(M, A, B))
  ------------------
  |  Branch (371:21): [True: 0, False: 0]
  ------------------
  372|      0|                    goto err;
  373|      0|            } else if (BN_num_bits(A) == BN_num_bits(B) + 1) {
  ------------------
  |  Branch (373:24): [True: 0, False: 0]
  ------------------
  374|       |                /* A/B is 1, 2, or 3 */
  375|      0|                if (!BN_lshift1(T, B))
  ------------------
  |  Branch (375:21): [True: 0, False: 0]
  ------------------
  376|      0|                    goto err;
  377|      0|                if (BN_ucmp(A, T) < 0) {
  ------------------
  |  Branch (377:21): [True: 0, False: 0]
  ------------------
  378|       |                    /* A < 2*B, so D=1 */
  379|      0|                    if (!BN_one(D))
  ------------------
  |  |  197|      0|# define BN_one(a)       (BN_set_word((a),1))
  ------------------
  |  Branch (379:25): [True: 0, False: 0]
  ------------------
  380|      0|                        goto err;
  381|      0|                    if (!BN_sub(M, A, B))
  ------------------
  |  Branch (381:25): [True: 0, False: 0]
  ------------------
  382|      0|                        goto err;
  383|      0|                } else {
  384|       |                    /* A >= 2*B, so D=2 or D=3 */
  385|      0|                    if (!BN_sub(M, A, T))
  ------------------
  |  Branch (385:25): [True: 0, False: 0]
  ------------------
  386|      0|                        goto err;
  387|      0|                    if (!BN_add(D, T, B))
  ------------------
  |  Branch (387:25): [True: 0, False: 0]
  ------------------
  388|      0|                        goto err; /* use D (:= 3*B) as temp */
  389|      0|                    if (BN_ucmp(A, D) < 0) {
  ------------------
  |  Branch (389:25): [True: 0, False: 0]
  ------------------
  390|       |                        /* A < 3*B, so D=2 */
  391|      0|                        if (!BN_set_word(D, 2))
  ------------------
  |  Branch (391:29): [True: 0, False: 0]
  ------------------
  392|      0|                            goto err;
  393|       |                        /*
  394|       |                         * M (= A - 2*B) already has the correct value
  395|       |                         */
  396|      0|                    } else {
  397|       |                        /* only D=3 remains */
  398|      0|                        if (!BN_set_word(D, 3))
  ------------------
  |  Branch (398:29): [True: 0, False: 0]
  ------------------
  399|      0|                            goto err;
  400|       |                        /*
  401|       |                         * currently M = A - 2*B, but we need M = A - 3*B
  402|       |                         */
  403|      0|                        if (!BN_sub(M, M, B))
  ------------------
  |  Branch (403:29): [True: 0, False: 0]
  ------------------
  404|      0|                            goto err;
  405|      0|                    }
  406|      0|                }
  407|      0|            } else {
  408|      0|                if (!BN_div(D, M, A, B, ctx))
  ------------------
  |  Branch (408:21): [True: 0, False: 0]
  ------------------
  409|      0|                    goto err;
  410|      0|            }
  411|       |
  412|       |            /*-
  413|       |             * Now
  414|       |             *      A = D*B + M;
  415|       |             * thus we have
  416|       |             * (**)  sign*Y*a  ==  D*B + M   (mod |n|).
  417|       |             */
  418|       |
  419|      0|            tmp = A;    /* keep the BIGNUM object, the value does not matter */
  420|       |
  421|       |            /* (A, B) := (B, A mod B) ... */
  422|      0|            A = B;
  423|      0|            B = M;
  424|       |            /* ... so we have  0 <= B < A  again */
  425|       |
  426|       |            /*-
  427|       |             * Since the former  M  is now  B  and the former  B  is now  A,
  428|       |             * (**) translates into
  429|       |             *       sign*Y*a  ==  D*A + B    (mod |n|),
  430|       |             * i.e.
  431|       |             *       sign*Y*a - D*A  ==  B    (mod |n|).
  432|       |             * Similarly, (*) translates into
  433|       |             *      -sign*X*a  ==  A          (mod |n|).
  434|       |             *
  435|       |             * Thus,
  436|       |             *   sign*Y*a + D*sign*X*a  ==  B  (mod |n|),
  437|       |             * i.e.
  438|       |             *        sign*(Y + D*X)*a  ==  B  (mod |n|).
  439|       |             *
  440|       |             * So if we set  (X, Y, sign) := (Y + D*X, X, -sign), we arrive back at
  441|       |             *      -sign*X*a  ==  B   (mod |n|),
  442|       |             *       sign*Y*a  ==  A   (mod |n|).
  443|       |             * Note that  X  and  Y  stay non-negative all the time.
  444|       |             */
  445|       |
  446|       |            /*
  447|       |             * most of the time D is very small, so we can optimize tmp := D*X+Y
  448|       |             */
  449|      0|            if (BN_is_one(D)) {
  ------------------
  |  Branch (449:17): [True: 0, False: 0]
  ------------------
  450|      0|                if (!BN_add(tmp, X, Y))
  ------------------
  |  Branch (450:21): [True: 0, False: 0]
  ------------------
  451|      0|                    goto err;
  452|      0|            } else {
  453|      0|                if (BN_is_word(D, 2)) {
  ------------------
  |  Branch (453:21): [True: 0, False: 0]
  ------------------
  454|      0|                    if (!BN_lshift1(tmp, X))
  ------------------
  |  Branch (454:25): [True: 0, False: 0]
  ------------------
  455|      0|                        goto err;
  456|      0|                } else if (BN_is_word(D, 4)) {
  ------------------
  |  Branch (456:28): [True: 0, False: 0]
  ------------------
  457|      0|                    if (!BN_lshift(tmp, X, 2))
  ------------------
  |  Branch (457:25): [True: 0, False: 0]
  ------------------
  458|      0|                        goto err;
  459|      0|                } else if (D->top == 1) {
  ------------------
  |  Branch (459:28): [True: 0, False: 0]
  ------------------
  460|      0|                    if (!BN_copy(tmp, X))
  ------------------
  |  Branch (460:25): [True: 0, False: 0]
  ------------------
  461|      0|                        goto err;
  462|      0|                    if (!BN_mul_word(tmp, D->d[0]))
  ------------------
  |  Branch (462:25): [True: 0, False: 0]
  ------------------
  463|      0|                        goto err;
  464|      0|                } else {
  465|      0|                    if (!BN_mul(tmp, D, X, ctx))
  ------------------
  |  Branch (465:25): [True: 0, False: 0]
  ------------------
  466|      0|                        goto err;
  467|      0|                }
  468|      0|                if (!BN_add(tmp, tmp, Y))
  ------------------
  |  Branch (468:21): [True: 0, False: 0]
  ------------------
  469|      0|                    goto err;
  470|      0|            }
  471|       |
  472|      0|            M = Y;      /* keep the BIGNUM object, the value does not matter */
  473|      0|            Y = X;
  474|      0|            X = tmp;
  475|      0|            sign = -sign;
  476|      0|        }
  477|      0|    }
  478|       |
  479|       |    /*-
  480|       |     * The while loop (Euclid's algorithm) ends when
  481|       |     *      A == gcd(a,n);
  482|       |     * we have
  483|       |     *       sign*Y*a  ==  A  (mod |n|),
  484|       |     * where  Y  is non-negative.
  485|       |     */
  486|       |
  487|  1.25k|    if (sign < 0) {
  ------------------
  |  Branch (487:9): [True: 1.25k, False: 0]
  ------------------
  488|  1.25k|        if (!BN_sub(Y, n, Y))
  ------------------
  |  Branch (488:13): [True: 0, False: 1.25k]
  ------------------
  489|      0|            goto err;
  490|  1.25k|    }
  491|       |    /* Now  Y*a  ==  A  (mod |n|).  */
  492|       |
  493|  1.25k|    if (BN_is_one(A)) {
  ------------------
  |  Branch (493:9): [True: 1.25k, False: 0]
  ------------------
  494|       |        /* Y*a == 1  (mod |n|) */
  495|  1.25k|        if (!Y->neg && BN_ucmp(Y, n) < 0) {
  ------------------
  |  Branch (495:13): [True: 736, False: 517]
  |  Branch (495:24): [True: 736, False: 0]
  ------------------
  496|    736|            if (!BN_copy(R, Y))
  ------------------
  |  Branch (496:17): [True: 0, False: 736]
  ------------------
  497|      0|                goto err;
  498|    736|        } else {
  499|    517|            if (!BN_nnmod(R, Y, n, ctx))
  ------------------
  |  Branch (499:17): [True: 0, False: 517]
  ------------------
  500|      0|                goto err;
  501|    517|        }
  502|  1.25k|    } else {
  503|      0|        *pnoinv = 1;
  504|      0|        goto err;
  505|      0|    }
  506|  1.25k|    ret = R;
  507|  1.25k| err:
  508|  1.25k|    if ((ret == NULL) && (in == NULL))
  ------------------
  |  Branch (508:9): [True: 0, False: 1.25k]
  |  Branch (508:26): [True: 0, False: 0]
  ------------------
  509|      0|        BN_free(R);
  510|  1.25k|    BN_CTX_end(ctx);
  511|  1.25k|    bn_check_top(ret);
  512|  1.25k|    return ret;
  513|  1.25k|}
BN_mod_inverse:
  518|  1.25k|{
  519|  1.25k|    BN_CTX *new_ctx = NULL;
  520|  1.25k|    BIGNUM *rv;
  521|  1.25k|    int noinv = 0;
  522|       |
  523|  1.25k|    if (ctx == NULL) {
  ------------------
  |  Branch (523:9): [True: 0, False: 1.25k]
  ------------------
  524|      0|        ctx = new_ctx = BN_CTX_new_ex(NULL);
  525|      0|        if (ctx == NULL) {
  ------------------
  |  Branch (525:13): [True: 0, False: 0]
  ------------------
  526|      0|            ERR_raise(ERR_LIB_BN, ERR_R_BN_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  527|      0|            return NULL;
  528|      0|        }
  529|      0|    }
  530|       |
  531|  1.25k|    rv = int_bn_mod_inverse(in, a, n, ctx, &noinv);
  532|  1.25k|    if (noinv)
  ------------------
  |  Branch (532:9): [True: 0, False: 1.25k]
  ------------------
  533|  1.25k|        ERR_raise(ERR_LIB_BN, BN_R_NO_INVERSE);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  534|  1.25k|    BN_CTX_free(new_ctx);
  535|  1.25k|    return rv;
  536|  1.25k|}

BN_value_one:
   83|    765|{
   84|    765|    static const BN_ULONG data_one = 1L;
   85|    765|    static const BIGNUM const_one = {
   86|    765|        (BN_ULONG *)&data_one, 1, 1, 0, BN_FLG_STATIC_DATA
  ------------------
  |  |   59|    765|# define BN_FLG_STATIC_DATA      0x02
  ------------------
   87|    765|    };
   88|       |
   89|    765|    return &const_one;
   90|    765|}
BN_num_bits_word:
  102|   245k|{
  103|   245k|    BN_ULONG x, mask;
  ------------------
  |  |   37|   245k|#  define BN_ULONG        unsigned long
  ------------------
  104|   245k|    int bits = (l != 0);
  105|       |
  106|   245k|#if BN_BITS2 > 32
  107|   245k|    x = l >> 32;
  108|   245k|    mask = (0 - x) & BN_MASK2;
  ------------------
  |  |   94|   245k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  109|   245k|    mask = (0 - (mask >> (BN_BITS2 - 1)));
  ------------------
  |  |   54|   245k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   245k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  110|   245k|    bits += 32 & mask;
  111|   245k|    l ^= (x ^ l) & mask;
  112|   245k|#endif
  113|       |
  114|   245k|    x = l >> 16;
  115|   245k|    mask = (0 - x) & BN_MASK2;
  ------------------
  |  |   94|   245k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  116|   245k|    mask = (0 - (mask >> (BN_BITS2 - 1)));
  ------------------
  |  |   54|   245k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   245k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  117|   245k|    bits += 16 & mask;
  118|   245k|    l ^= (x ^ l) & mask;
  119|       |
  120|   245k|    x = l >> 8;
  121|   245k|    mask = (0 - x) & BN_MASK2;
  ------------------
  |  |   94|   245k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  122|   245k|    mask = (0 - (mask >> (BN_BITS2 - 1)));
  ------------------
  |  |   54|   245k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   245k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  123|   245k|    bits += 8 & mask;
  124|   245k|    l ^= (x ^ l) & mask;
  125|       |
  126|   245k|    x = l >> 4;
  127|   245k|    mask = (0 - x) & BN_MASK2;
  ------------------
  |  |   94|   245k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  128|   245k|    mask = (0 - (mask >> (BN_BITS2 - 1)));
  ------------------
  |  |   54|   245k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   245k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  129|   245k|    bits += 4 & mask;
  130|   245k|    l ^= (x ^ l) & mask;
  131|       |
  132|   245k|    x = l >> 2;
  133|   245k|    mask = (0 - x) & BN_MASK2;
  ------------------
  |  |   94|   245k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  134|   245k|    mask = (0 - (mask >> (BN_BITS2 - 1)));
  ------------------
  |  |   54|   245k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   245k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  135|   245k|    bits += 2 & mask;
  136|   245k|    l ^= (x ^ l) & mask;
  137|       |
  138|   245k|    x = l >> 1;
  139|   245k|    mask = (0 - x) & BN_MASK2;
  ------------------
  |  |   94|   245k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  140|   245k|    mask = (0 - (mask >> (BN_BITS2 - 1)));
  ------------------
  |  |   54|   245k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   245k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  141|   245k|    bits += 1 & mask;
  142|       |
  143|   245k|    return bits;
  144|   245k|}
BN_num_bits:
  180|  61.6k|{
  181|  61.6k|    int i = a->top - 1;
  182|  61.6k|    bn_check_top(a);
  183|       |
  184|  61.6k|    if (a->flags & BN_FLG_CONSTTIME) {
  ------------------
  |  |   67|  61.6k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (184:9): [True: 0, False: 61.6k]
  ------------------
  185|       |        /*
  186|       |         * We assume that BIGNUMs flagged as CONSTTIME have also been expanded
  187|       |         * so that a->dmax is not leaking secret information.
  188|       |         *
  189|       |         * In other words, it's the caller's responsibility to ensure `a` has
  190|       |         * been preallocated in advance to a public length if we hit this
  191|       |         * branch.
  192|       |         *
  193|       |         */
  194|      0|        return bn_num_bits_consttime(a);
  195|      0|    }
  196|       |
  197|  61.6k|    if (BN_is_zero(a))
  ------------------
  |  Branch (197:9): [True: 386, False: 61.2k]
  ------------------
  198|    386|        return 0;
  199|       |
  200|  61.2k|    return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
  ------------------
  |  |   54|  61.2k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  61.2k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  201|  61.6k|}
BN_clear_free:
  215|  35.2k|{
  216|  35.2k|    if (a == NULL)
  ------------------
  |  Branch (216:9): [True: 0, False: 35.2k]
  ------------------
  217|      0|        return;
  218|  35.2k|    if (a->d != NULL && !BN_get_flags(a, BN_FLG_STATIC_DATA))
  ------------------
  |  |   59|  33.9k|# define BN_FLG_STATIC_DATA      0x02
  ------------------
  |  Branch (218:9): [True: 33.9k, False: 1.27k]
  |  Branch (218:25): [True: 33.9k, False: 0]
  ------------------
  219|  33.9k|        bn_free_d(a, 1);
  220|  35.2k|    if (BN_get_flags(a, BN_FLG_MALLOCED)) {
  ------------------
  |  |   58|  35.2k|# define BN_FLG_MALLOCED         0x01
  ------------------
  |  Branch (220:9): [True: 0, False: 35.2k]
  ------------------
  221|      0|        OPENSSL_cleanse(a, sizeof(*a));
  222|      0|        OPENSSL_free(a);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  223|      0|    }
  224|  35.2k|}
BN_free:
  227|  18.1k|{
  228|  18.1k|    if (a == NULL)
  ------------------
  |  Branch (228:9): [True: 0, False: 18.1k]
  ------------------
  229|      0|        return;
  230|  18.1k|    if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
  ------------------
  |  |   59|  18.1k|# define BN_FLG_STATIC_DATA      0x02
  ------------------
  |  Branch (230:9): [True: 18.1k, False: 0]
  ------------------
  231|  18.1k|        bn_free_d(a, 0);
  232|  18.1k|    if (a->flags & BN_FLG_MALLOCED)
  ------------------
  |  |   58|  18.1k|# define BN_FLG_MALLOCED         0x01
  ------------------
  |  Branch (232:9): [True: 15.1k, False: 3.03k]
  ------------------
  233|  15.1k|        OPENSSL_free(a);
  ------------------
  |  |  115|  15.1k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|  15.1k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|  15.1k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  234|  18.1k|}
bn_init:
  237|  54.9k|{
  238|  54.9k|    static BIGNUM nilbn;
  239|       |
  240|  54.9k|    *a = nilbn;
  241|  54.9k|    bn_check_top(a);
  242|  54.9k|}
BN_new:
  245|  15.1k|{
  246|  15.1k|    BIGNUM *ret;
  247|       |
  248|  15.1k|    if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
  ------------------
  |  |  104|  15.1k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|  15.1k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|  15.1k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (248:9): [True: 0, False: 15.1k]
  ------------------
  249|      0|        return NULL;
  250|  15.1k|    ret->flags = BN_FLG_MALLOCED;
  ------------------
  |  |   58|  15.1k|# define BN_FLG_MALLOCED         0x01
  ------------------
  251|  15.1k|    bn_check_top(ret);
  252|  15.1k|    return ret;
  253|  15.1k|}
bn_expand2:
  301|  75.2k|{
  302|  75.2k|    if (words > b->dmax) {
  ------------------
  |  Branch (302:9): [True: 75.2k, False: 0]
  ------------------
  303|  75.2k|        BN_ULONG *a = bn_expand_internal(b, words);
  ------------------
  |  |   37|  75.2k|#  define BN_ULONG        unsigned long
  ------------------
  304|  75.2k|        if (!a)
  ------------------
  |  Branch (304:13): [True: 0, False: 75.2k]
  ------------------
  305|      0|            return NULL;
  306|  75.2k|        if (b->d != NULL)
  ------------------
  |  Branch (306:13): [True: 25.2k, False: 50.0k]
  ------------------
  307|  25.2k|            bn_free_d(b, 1);
  308|  75.2k|        b->d = a;
  309|  75.2k|        b->dmax = words;
  310|  75.2k|    }
  311|       |
  312|  75.2k|    return b;
  313|  75.2k|}
BN_copy:
  335|   135k|{
  336|   135k|    int bn_words;
  337|       |
  338|   135k|    bn_check_top(b);
  339|       |
  340|   135k|    bn_words = BN_get_flags(b, BN_FLG_CONSTTIME) ? b->dmax : b->top;
  ------------------
  |  |   67|   135k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (340:16): [True: 0, False: 135k]
  ------------------
  341|       |
  342|   135k|    if (a == b)
  ------------------
  |  Branch (342:9): [True: 0, False: 135k]
  ------------------
  343|      0|        return a;
  344|   135k|    if (bn_wexpand(a, bn_words) == NULL)
  ------------------
  |  Branch (344:9): [True: 0, False: 135k]
  ------------------
  345|      0|        return NULL;
  346|       |
  347|   135k|    if (b->top > 0)
  ------------------
  |  Branch (347:9): [True: 130k, False: 5.79k]
  ------------------
  348|   130k|        memcpy(a->d, b->d, sizeof(b->d[0]) * bn_words);
  349|       |
  350|   135k|    a->neg = b->neg;
  351|   135k|    a->top = b->top;
  352|   135k|    a->flags |= b->flags & BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|   135k|#  define BN_FLG_FIXED_TOP 0
  ------------------
  353|   135k|    bn_check_top(a);
  354|   135k|    return a;
  355|   135k|}
BN_clear:
  397|  1.17k|{
  398|  1.17k|    if (a == NULL)
  ------------------
  |  Branch (398:9): [True: 0, False: 1.17k]
  ------------------
  399|      0|        return;
  400|  1.17k|    bn_check_top(a);
  401|  1.17k|    if (a->d != NULL)
  ------------------
  |  Branch (401:9): [True: 0, False: 1.17k]
  ------------------
  402|      0|        OPENSSL_cleanse(a->d, sizeof(*a->d) * a->dmax);
  403|  1.17k|    a->neg = 0;
  404|  1.17k|    a->top = 0;
  405|  1.17k|    a->flags &= ~BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|  1.17k|#  define BN_FLG_FIXED_TOP 0
  ------------------
  406|  1.17k|}
BN_set_word:
  419|  6.73k|{
  420|  6.73k|    bn_check_top(a);
  421|  6.73k|    if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
  ------------------
  |  Branch (421:9): [True: 0, False: 6.73k]
  ------------------
  422|      0|        return 0;
  423|  6.73k|    a->neg = 0;
  424|  6.73k|    a->d[0] = w;
  425|  6.73k|    a->top = (w ? 1 : 0);
  ------------------
  |  Branch (425:15): [True: 6.73k, False: 0]
  ------------------
  426|  6.73k|    a->flags &= ~BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|  6.73k|#  define BN_FLG_FIXED_TOP 0
  ------------------
  427|  6.73k|    bn_check_top(a);
  428|  6.73k|    return 1;
  429|  6.73k|}
BN_bin2bn:
  537|  9.07k|{
  538|  9.07k|    return bin2bn(s, len, ret, BIG, UNSIGNED);
  539|  9.07k|}
BN_ucmp:
  709|   208k|{
  710|   208k|    int i;
  711|   208k|    BN_ULONG t1, t2, *ap, *bp;
  ------------------
  |  |   37|   208k|#  define BN_ULONG        unsigned long
  ------------------
  712|       |
  713|   208k|    ap = a->d;
  714|   208k|    bp = b->d;
  715|       |
  716|   208k|    if (BN_get_flags(a, BN_FLG_CONSTTIME)
  ------------------
  |  |   67|   208k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (716:9): [True: 0, False: 208k]
  ------------------
  717|   208k|            && a->top == b->top) {
  ------------------
  |  Branch (717:16): [True: 0, False: 0]
  ------------------
  718|      0|        int res = 0;
  719|       |
  720|      0|        for (i = 0; i < b->top; i++) {
  ------------------
  |  Branch (720:21): [True: 0, False: 0]
  ------------------
  721|      0|            res = constant_time_select_int(constant_time_lt_bn(ap[i], bp[i]),
  722|      0|                                           -1, res);
  723|      0|            res = constant_time_select_int(constant_time_lt_bn(bp[i], ap[i]),
  724|      0|                                           1, res);
  725|      0|        }
  726|      0|        return res;
  727|      0|    }
  728|       |
  729|   208k|    bn_check_top(a);
  730|   208k|    bn_check_top(b);
  731|       |
  732|   208k|    i = a->top - b->top;
  733|   208k|    if (i != 0)
  ------------------
  |  Branch (733:9): [True: 55.4k, False: 153k]
  ------------------
  734|  55.4k|        return i;
  735|       |
  736|   317k|    for (i = a->top - 1; i >= 0; i--) {
  ------------------
  |  Branch (736:26): [True: 316k, False: 1.31k]
  ------------------
  737|   316k|        t1 = ap[i];
  738|   316k|        t2 = bp[i];
  739|   316k|        if (t1 != t2)
  ------------------
  |  Branch (739:13): [True: 151k, False: 164k]
  ------------------
  740|   151k|            return ((t1 > t2) ? 1 : -1);
  ------------------
  |  Branch (740:21): [True: 63.8k, False: 88.1k]
  ------------------
  741|   316k|    }
  742|  1.31k|    return 0;
  743|   153k|}
BN_cmp:
  746|  2.99k|{
  747|  2.99k|    int i;
  748|  2.99k|    int gt, lt;
  749|  2.99k|    BN_ULONG t1, t2;
  ------------------
  |  |   37|  2.99k|#  define BN_ULONG        unsigned long
  ------------------
  750|       |
  751|  2.99k|    if ((a == NULL) || (b == NULL)) {
  ------------------
  |  Branch (751:9): [True: 0, False: 2.99k]
  |  Branch (751:24): [True: 0, False: 2.99k]
  ------------------
  752|      0|        if (a != NULL)
  ------------------
  |  Branch (752:13): [True: 0, False: 0]
  ------------------
  753|      0|            return -1;
  754|      0|        else if (b != NULL)
  ------------------
  |  Branch (754:18): [True: 0, False: 0]
  ------------------
  755|      0|            return 1;
  756|      0|        else
  757|      0|            return 0;
  758|      0|    }
  759|       |
  760|  2.99k|    bn_check_top(a);
  761|  2.99k|    bn_check_top(b);
  762|       |
  763|  2.99k|    if (a->neg != b->neg) {
  ------------------
  |  Branch (763:9): [True: 0, False: 2.99k]
  ------------------
  764|      0|        if (a->neg)
  ------------------
  |  Branch (764:13): [True: 0, False: 0]
  ------------------
  765|      0|            return -1;
  766|      0|        else
  767|      0|            return 1;
  768|      0|    }
  769|  2.99k|    if (a->neg == 0) {
  ------------------
  |  Branch (769:9): [True: 2.99k, False: 0]
  ------------------
  770|  2.99k|        gt = 1;
  771|  2.99k|        lt = -1;
  772|  2.99k|    } else {
  773|      0|        gt = -1;
  774|      0|        lt = 1;
  775|      0|    }
  776|       |
  777|  2.99k|    if (a->top > b->top)
  ------------------
  |  Branch (777:9): [True: 0, False: 2.99k]
  ------------------
  778|      0|        return gt;
  779|  2.99k|    if (a->top < b->top)
  ------------------
  |  Branch (779:9): [True: 0, False: 2.99k]
  ------------------
  780|      0|        return lt;
  781|  22.4k|    for (i = a->top - 1; i >= 0; i--) {
  ------------------
  |  Branch (781:26): [True: 19.5k, False: 2.99k]
  ------------------
  782|  19.5k|        t1 = a->d[i];
  783|  19.5k|        t2 = b->d[i];
  784|  19.5k|        if (t1 > t2)
  ------------------
  |  Branch (784:13): [True: 0, False: 19.5k]
  ------------------
  785|      0|            return gt;
  786|  19.5k|        if (t1 < t2)
  ------------------
  |  Branch (786:13): [True: 0, False: 19.5k]
  ------------------
  787|      0|            return lt;
  788|  19.5k|    }
  789|  2.99k|    return 0;
  790|  2.99k|}
BN_set_bit:
  793|  4.02k|{
  794|  4.02k|    int i, j, k;
  795|       |
  796|  4.02k|    if (n < 0)
  ------------------
  |  Branch (796:9): [True: 0, False: 4.02k]
  ------------------
  797|      0|        return 0;
  798|       |
  799|  4.02k|    i = n / BN_BITS2;
  ------------------
  |  |   54|  4.02k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  4.02k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  800|  4.02k|    j = n % BN_BITS2;
  ------------------
  |  |   54|  4.02k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  4.02k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  801|  4.02k|    if (a->top <= i) {
  ------------------
  |  Branch (801:9): [True: 4.02k, False: 0]
  ------------------
  802|  4.02k|        if (bn_wexpand(a, i + 1) == NULL)
  ------------------
  |  Branch (802:13): [True: 0, False: 4.02k]
  ------------------
  803|      0|            return 0;
  804|  55.1k|        for (k = a->top; k < i + 1; k++)
  ------------------
  |  Branch (804:26): [True: 51.1k, False: 4.02k]
  ------------------
  805|  51.1k|            a->d[k] = 0;
  806|  4.02k|        a->top = i + 1;
  807|  4.02k|        a->flags &= ~BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|  4.02k|#  define BN_FLG_FIXED_TOP 0
  ------------------
  808|  4.02k|    }
  809|       |
  810|  4.02k|    a->d[i] |= (((BN_ULONG)1) << j);
  811|  4.02k|    bn_check_top(a);
  812|  4.02k|    return 1;
  813|  4.02k|}
BN_is_bit_set:
  834|   347k|{
  835|   347k|    int i, j;
  836|       |
  837|   347k|    bn_check_top(a);
  838|   347k|    if (n < 0)
  ------------------
  |  Branch (838:9): [True: 0, False: 347k]
  ------------------
  839|      0|        return 0;
  840|   347k|    i = n / BN_BITS2;
  ------------------
  |  |   54|   347k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   347k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  841|   347k|    j = n % BN_BITS2;
  ------------------
  |  |   54|   347k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   347k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  842|   347k|    if (a->top <= i)
  ------------------
  |  Branch (842:9): [True: 0, False: 347k]
  ------------------
  843|      0|        return 0;
  844|   347k|    return (int)(((a->d[i]) >> j) & ((BN_ULONG)1));
  845|   347k|}
BN_set_negative:
  880|  6.04k|{
  881|  6.04k|    if (b && !BN_is_zero(a))
  ------------------
  |  Branch (881:9): [True: 3.32k, False: 2.72k]
  |  Branch (881:14): [True: 2.77k, False: 554]
  ------------------
  882|  2.77k|        a->neg = 1;
  883|  3.27k|    else
  884|  3.27k|        a->neg = 0;
  885|  6.04k|}
bn_cmp_words:
  888|   279k|{
  889|   279k|    int i;
  890|   279k|    BN_ULONG aa, bb;
  ------------------
  |  |   37|   279k|#  define BN_ULONG        unsigned long
  ------------------
  891|       |
  892|   279k|    if (n == 0)
  ------------------
  |  Branch (892:9): [True: 0, False: 279k]
  ------------------
  893|      0|        return 0;
  894|       |
  895|   279k|    aa = a[n - 1];
  896|   279k|    bb = b[n - 1];
  897|   279k|    if (aa != bb)
  ------------------
  |  Branch (897:9): [True: 245k, False: 33.8k]
  ------------------
  898|   245k|        return ((aa > bb) ? 1 : -1);
  ------------------
  |  Branch (898:17): [True: 119k, False: 126k]
  ------------------
  899|   190k|    for (i = n - 2; i >= 0; i--) {
  ------------------
  |  Branch (899:21): [True: 181k, False: 9.19k]
  ------------------
  900|   181k|        aa = a[i];
  901|   181k|        bb = b[i];
  902|   181k|        if (aa != bb)
  ------------------
  |  Branch (902:13): [True: 24.6k, False: 156k]
  ------------------
  903|  24.6k|            return ((aa > bb) ? 1 : -1);
  ------------------
  |  Branch (903:21): [True: 14.2k, False: 10.4k]
  ------------------
  904|   181k|    }
  905|  9.19k|    return 0;
  906|  33.8k|}
bn_cmp_part_words:
  918|   324k|{
  919|   324k|    int n, i;
  920|   324k|    n = cl - 1;
  921|       |
  922|   324k|    if (dl < 0) {
  ------------------
  |  Branch (922:9): [True: 34.3k, False: 289k]
  ------------------
  923|  76.9k|        for (i = dl; i < 0; i++) {
  ------------------
  |  Branch (923:22): [True: 73.3k, False: 3.66k]
  ------------------
  924|  73.3k|            if (b[n - i] != 0)
  ------------------
  |  Branch (924:17): [True: 30.7k, False: 42.6k]
  ------------------
  925|  30.7k|                return -1;      /* a < b */
  926|  73.3k|        }
  927|  34.3k|    }
  928|   293k|    if (dl > 0) {
  ------------------
  |  Branch (928:9): [True: 35.1k, False: 258k]
  ------------------
  929|   113k|        for (i = dl; i > 0; i--) {
  ------------------
  |  Branch (929:22): [True: 106k, False: 7.56k]
  ------------------
  930|   106k|            if (a[n + i] != 0)
  ------------------
  |  Branch (930:17): [True: 27.6k, False: 78.6k]
  ------------------
  931|  27.6k|                return 1;       /* a > b */
  932|   106k|        }
  933|  35.1k|    }
  934|   265k|    return bn_cmp_words(a, b, cl);
  935|   293k|}
BN_zero_ex:
 1026|  1.13M|{
 1027|  1.13M|    a->neg = 0;
 1028|  1.13M|    a->top = 0;
 1029|  1.13M|    a->flags &= ~BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|  1.13M|#  define BN_FLG_FIXED_TOP 0
  ------------------
 1030|  1.13M|}
BN_abs_is_word:
 1033|  4.17k|{
 1034|  4.17k|    return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));
  ------------------
  |  Branch (1034:13): [True: 4.11k, False: 56]
  |  Branch (1034:30): [True: 1.28k, False: 2.83k]
  |  Branch (1034:50): [True: 0, False: 2.88k]
  |  Branch (1034:62): [True: 0, False: 0]
  ------------------
 1035|  4.17k|}
BN_is_zero:
 1038|   373k|{
 1039|   373k|    return a->top == 0;
 1040|   373k|}
BN_is_one:
 1043|  2.53k|{
 1044|  2.53k|    return BN_abs_is_word(a, 1) && !a->neg;
  ------------------
  |  Branch (1044:12): [True: 1.27k, False: 1.25k]
  |  Branch (1044:36): [True: 1.27k, False: 0]
  ------------------
 1045|  2.53k|}
BN_is_odd:
 1069|  60.5k|{
 1070|  60.5k|    return (a->top > 0) && (a->d[0] & 1);
  ------------------
  |  Branch (1070:12): [True: 60.5k, False: 0]
  |  Branch (1070:28): [True: 32.4k, False: 28.0k]
  ------------------
 1071|  60.5k|}
BN_to_montgomery:
 1080|    376|{
 1081|    376|    return BN_mod_mul_montgomery(r, a, &(mont->RR), mont, ctx);
 1082|    376|}
BN_get_flags:
 1118|   683k|{
 1119|   683k|    return b->flags & n;
 1120|   683k|}
bn_wexpand:
 1148|  1.41M|{
 1149|  1.41M|    return (words <= a->dmax) ? a : bn_expand2(a, words);
  ------------------
  |  Branch (1149:12): [True: 1.35M, False: 69.6k]
  ------------------
 1150|  1.41M|}
bn_correct_top:
 1175|   549k|{
 1176|   549k|    BN_ULONG *ftl;
  ------------------
  |  |   37|   549k|#  define BN_ULONG        unsigned long
  ------------------
 1177|   549k|    int tmp_top = a->top;
 1178|       |
 1179|   549k|    if (tmp_top > 0) {
  ------------------
  |  Branch (1179:9): [True: 533k, False: 16.0k]
  ------------------
 1180|  1.00M|        for (ftl = &(a->d[tmp_top]); tmp_top > 0; tmp_top--) {
  ------------------
  |  Branch (1180:38): [True: 996k, False: 10.3k]
  ------------------
 1181|   996k|            ftl--;
 1182|   996k|            if (*ftl != 0)
  ------------------
  |  Branch (1182:17): [True: 522k, False: 473k]
  ------------------
 1183|   522k|                break;
 1184|   996k|        }
 1185|   533k|        a->top = tmp_top;
 1186|   533k|    }
 1187|   549k|    if (a->top == 0)
  ------------------
  |  Branch (1187:9): [True: 26.4k, False: 522k]
  ------------------
 1188|  26.4k|        a->neg = 0;
 1189|   549k|    a->flags &= ~BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|   549k|#  define BN_FLG_FIXED_TOP 0
  ------------------
 1190|   549k|    bn_pollute(a);
 1191|   549k|}
bn_lib.c:bn_free_d:
  204|  77.3k|{
  205|  77.3k|    if (BN_get_flags(a, BN_FLG_SECURE))
  ------------------
  |  |   68|  77.3k|# define BN_FLG_SECURE           0x08
  ------------------
  |  Branch (205:9): [True: 0, False: 77.3k]
  ------------------
  206|      0|        OPENSSL_secure_clear_free(a->d, a->dmax * sizeof(a->d[0]));
  ------------------
  |  |  129|      0|        CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  207|  77.3k|    else if (clear != 0)
  ------------------
  |  Branch (207:14): [True: 59.1k, False: 18.1k]
  ------------------
  208|  59.1k|        OPENSSL_clear_free(a->d, a->dmax * sizeof(a->d[0]));
  ------------------
  |  |  113|  59.1k|        CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|  59.1k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|  59.1k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  209|  18.1k|    else
  210|  18.1k|        OPENSSL_free(a->d);
  ------------------
  |  |  115|  18.1k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|  18.1k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|  18.1k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  211|  77.3k|}
bn_lib.c:bn_expand_internal:
  267|  75.2k|{
  268|  75.2k|    BN_ULONG *a = NULL;
  ------------------
  |  |   37|  75.2k|#  define BN_ULONG        unsigned long
  ------------------
  269|       |
  270|  75.2k|    if (words > (INT_MAX / (4 * BN_BITS2))) {
  ------------------
  |  |   54|  75.2k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  75.2k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  |  Branch (270:9): [True: 0, False: 75.2k]
  ------------------
  271|      0|        ERR_raise(ERR_LIB_BN, BN_R_BIGNUM_TOO_LONG);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  272|      0|        return NULL;
  273|      0|    }
  274|  75.2k|    if (BN_get_flags(b, BN_FLG_STATIC_DATA)) {
  ------------------
  |  |   59|  75.2k|# define BN_FLG_STATIC_DATA      0x02
  ------------------
  |  Branch (274:9): [True: 0, False: 75.2k]
  ------------------
  275|      0|        ERR_raise(ERR_LIB_BN, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  276|      0|        return NULL;
  277|      0|    }
  278|  75.2k|    if (BN_get_flags(b, BN_FLG_SECURE))
  ------------------
  |  |   68|  75.2k|# define BN_FLG_SECURE           0x08
  ------------------
  |  Branch (278:9): [True: 0, False: 75.2k]
  ------------------
  279|      0|        a = OPENSSL_secure_zalloc(words * sizeof(*a));
  ------------------
  |  |  125|      0|        CRYPTO_secure_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_secure_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  280|  75.2k|    else
  281|  75.2k|        a = OPENSSL_zalloc(words * sizeof(*a));
  ------------------
  |  |  104|  75.2k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|  75.2k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|  75.2k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  282|  75.2k|    if (a == NULL)
  ------------------
  |  Branch (282:9): [True: 0, False: 75.2k]
  ------------------
  283|      0|        return NULL;
  284|       |
  285|  75.2k|    assert(b->top <= words);
  286|  75.2k|    if (b->top > 0)
  ------------------
  |  Branch (286:9): [True: 9.45k, False: 65.8k]
  ------------------
  287|  9.45k|        memcpy(a, b->d, sizeof(*a) * b->top);
  288|       |
  289|  75.2k|    return a;
  290|  75.2k|}
bn_lib.c:bin2bn:
  436|  9.07k|{
  437|  9.07k|    int inc;
  438|  9.07k|    const unsigned char *s2;
  439|  9.07k|    int inc2;
  440|  9.07k|    int neg = 0, xor = 0, carry = 0;
  441|  9.07k|    unsigned int i;
  442|  9.07k|    unsigned int n;
  443|  9.07k|    BIGNUM *bn = NULL;
  444|       |
  445|       |    /* Negative length is not acceptable */
  446|  9.07k|    if (len < 0)
  ------------------
  |  Branch (446:9): [True: 0, False: 9.07k]
  ------------------
  447|      0|        return NULL;
  448|       |
  449|  9.07k|    if (ret == NULL)
  ------------------
  |  Branch (449:9): [True: 0, False: 9.07k]
  ------------------
  450|      0|        ret = bn = BN_new();
  451|  9.07k|    if (ret == NULL)
  ------------------
  |  Branch (451:9): [True: 0, False: 9.07k]
  ------------------
  452|      0|        return NULL;
  453|  9.07k|    bn_check_top(ret);
  454|       |
  455|       |    /*
  456|       |     * If the input has no bits, the number is considered zero.
  457|       |     * This makes calls with s==NULL and len==0 safe.
  458|       |     */
  459|  9.07k|    if (len == 0) {
  ------------------
  |  Branch (459:9): [True: 1.17k, False: 7.89k]
  ------------------
  460|  1.17k|        BN_clear(ret);
  461|  1.17k|        return ret;
  462|  1.17k|    }
  463|       |
  464|       |    /*
  465|       |     * The loop that does the work iterates from least to most
  466|       |     * significant BIGNUM chunk, so we adapt parameters to transfer
  467|       |     * input bytes accordingly.
  468|       |     */
  469|  7.89k|    if (endianness == LITTLE) {
  ------------------
  |  Branch (469:9): [True: 0, False: 7.89k]
  ------------------
  470|      0|        s2 = s + len - 1;
  471|      0|        inc2 = -1;
  472|      0|        inc = 1;
  473|  7.89k|    } else {
  474|  7.89k|        s2 = s;
  475|  7.89k|        inc2 = 1;
  476|  7.89k|        inc = -1;
  477|  7.89k|        s += len - 1;
  478|  7.89k|    }
  479|       |
  480|       |    /* Take note of the signedness of the input bytes*/
  481|  7.89k|    if (signedness == SIGNED) {
  ------------------
  |  Branch (481:9): [True: 0, False: 7.89k]
  ------------------
  482|      0|        neg = !!(*s2 & 0x80);
  483|      0|        xor = neg ? 0xff : 0x00;
  ------------------
  |  Branch (483:15): [True: 0, False: 0]
  ------------------
  484|      0|        carry = neg;
  485|      0|    }
  486|       |
  487|       |    /*
  488|       |     * Skip leading sign extensions (the value of |xor|).
  489|       |     * This is the only spot where |s2| and |inc2| are used.
  490|       |     */
  491|  8.24k|    for ( ; len > 0 && *s2 == xor; s2 += inc2, len--)
  ------------------
  |  Branch (491:13): [True: 8.22k, False: 15]
  |  Branch (491:24): [True: 345, False: 7.88k]
  ------------------
  492|    345|        continue;
  493|       |
  494|       |    /*
  495|       |     * If there was a set of 0xff, we backtrack one byte unless the next
  496|       |     * one has a sign bit, as the last 0xff is then part of the actual
  497|       |     * number, rather then a mere sign extension.
  498|       |     */
  499|  7.89k|    if (xor == 0xff) {
  ------------------
  |  Branch (499:9): [True: 0, False: 7.89k]
  ------------------
  500|      0|        if (len == 0 || !(*s2 & 0x80))
  ------------------
  |  Branch (500:13): [True: 0, False: 0]
  |  Branch (500:25): [True: 0, False: 0]
  ------------------
  501|      0|            len++;
  502|      0|    }
  503|       |    /* If it was all zeros, we're done */
  504|  7.89k|    if (len == 0) {
  ------------------
  |  Branch (504:9): [True: 15, False: 7.88k]
  ------------------
  505|     15|        ret->top = 0;
  506|     15|        return ret;
  507|     15|    }
  508|  7.88k|    n = ((len - 1) / BN_BYTES) + 1; /* Number of resulting bignum chunks */
  ------------------
  |  |   38|  7.88k|#  define BN_BYTES        8
  ------------------
  509|  7.88k|    if (bn_wexpand(ret, (int)n) == NULL) {
  ------------------
  |  Branch (509:9): [True: 0, False: 7.88k]
  ------------------
  510|      0|        BN_free(bn);
  511|      0|        return NULL;
  512|      0|    }
  513|  7.88k|    ret->top = n;
  514|  7.88k|    ret->neg = neg;
  515|  39.2k|    for (i = 0; n-- > 0; i++) {
  ------------------
  |  Branch (515:17): [True: 31.3k, False: 7.88k]
  ------------------
  516|  31.3k|        BN_ULONG l = 0;        /* Accumulator */
  ------------------
  |  |   37|  31.3k|#  define BN_ULONG        unsigned long
  ------------------
  517|  31.3k|        unsigned int m = 0;    /* Offset in a bignum chunk, in bits */
  518|       |
  519|   238k|        for (; len > 0 && m < BN_BYTES * 8; len--, s += inc, m += 8) {
  ------------------
  |  |   38|   230k|#  define BN_BYTES        8
  ------------------
  |  Branch (519:16): [True: 230k, False: 7.88k]
  |  Branch (519:27): [True: 206k, False: 23.4k]
  ------------------
  520|   206k|            BN_ULONG byte_xored = *s ^ xor;
  ------------------
  |  |   37|   206k|#  define BN_ULONG        unsigned long
  ------------------
  521|   206k|            BN_ULONG byte = (byte_xored + carry) & 0xff;
  ------------------
  |  |   37|   206k|#  define BN_ULONG        unsigned long
  ------------------
  522|       |
  523|   206k|            carry = byte_xored > byte; /* Implicit 1 or 0 */
  524|   206k|            l |= (byte << m);
  525|   206k|        }
  526|  31.3k|        ret->d[i] = l;
  527|  31.3k|    }
  528|       |    /*
  529|       |     * need to call this due to clear byte at top if avoiding having the top
  530|       |     * bit set (-ve number)
  531|       |     */
  532|  7.88k|    bn_correct_top(ret);
  533|  7.88k|    return ret;
  534|  7.88k|}

bn_lib.c:bn_expand:
  670|  6.73k|{
  671|  6.73k|    if (bits > (INT_MAX - BN_BITS2 + 1))
  ------------------
  |  |   54|  6.73k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  6.73k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  |  Branch (671:9): [True: 0, False: 6.73k]
  ------------------
  672|      0|        return NULL;
  673|       |
  674|  6.73k|    if (((bits+BN_BITS2-1)/BN_BITS2) <= (a)->dmax)
  ------------------
  |  |   54|  6.73k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  6.73k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
                  if (((bits+BN_BITS2-1)/BN_BITS2) <= (a)->dmax)
  ------------------
  |  |   54|  6.73k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  6.73k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  |  Branch (674:9): [True: 1.12k, False: 5.61k]
  ------------------
  675|  1.12k|        return a;
  676|       |
  677|  5.61k|    return bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2);
  ------------------
  |  |   54|  5.61k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  5.61k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
                  return bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2);
  ------------------
  |  |   54|  5.61k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  5.61k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  678|  6.73k|}

BN_nnmod:
   15|   100k|{
   16|       |    /*
   17|       |     * like BN_mod, but returns non-negative remainder (i.e., 0 <= r < |d|
   18|       |     * always holds)
   19|       |     */
   20|       |
   21|   100k|    if (r == d) {
  ------------------
  |  Branch (21:9): [True: 0, False: 100k]
  ------------------
   22|      0|        ERR_raise(ERR_LIB_BN, ERR_R_PASSED_INVALID_ARGUMENT);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   23|      0|        return 0;
   24|      0|    }
   25|       |
   26|   100k|    if (!(BN_mod(r, m, d, ctx)))
  ------------------
  |  |  277|   100k|# define BN_mod(rem,m,d,ctx) BN_div(NULL,(rem),(m),(d),(ctx))
  ------------------
  |  Branch (26:9): [True: 0, False: 100k]
  ------------------
   27|      0|        return 0;
   28|   100k|    if (!r->neg)
  ------------------
  |  Branch (28:9): [True: 96.9k, False: 3.30k]
  ------------------
   29|  96.9k|        return 1;
   30|       |    /* now   -|d| < r < 0,  so we have to set  r := r + |d| */
   31|  3.30k|    return (d->neg ? BN_sub : BN_add) (r, r, d);
  ------------------
  |  Branch (31:13): [True: 1.21k, False: 2.08k]
  ------------------
   32|   100k|}
BN_mod_mul:
  208|  94.0k|{
  209|  94.0k|    BIGNUM *t;
  210|  94.0k|    int ret = 0;
  211|       |
  212|  94.0k|    bn_check_top(a);
  213|  94.0k|    bn_check_top(b);
  214|  94.0k|    bn_check_top(m);
  215|       |
  216|  94.0k|    BN_CTX_start(ctx);
  217|  94.0k|    if ((t = BN_CTX_get(ctx)) == NULL)
  ------------------
  |  Branch (217:9): [True: 0, False: 94.0k]
  ------------------
  218|      0|        goto err;
  219|  94.0k|    if (a == b) {
  ------------------
  |  Branch (219:9): [True: 71.5k, False: 22.4k]
  ------------------
  220|  71.5k|        if (!BN_sqr(t, a, ctx))
  ------------------
  |  Branch (220:13): [True: 0, False: 71.5k]
  ------------------
  221|      0|            goto err;
  222|  71.5k|    } else {
  223|  22.4k|        if (!BN_mul(t, a, b, ctx))
  ------------------
  |  Branch (223:13): [True: 0, False: 22.4k]
  ------------------
  224|      0|            goto err;
  225|  22.4k|    }
  226|  94.0k|    if (!BN_nnmod(r, t, m, ctx))
  ------------------
  |  Branch (226:9): [True: 0, False: 94.0k]
  ------------------
  227|      0|        goto err;
  228|  94.0k|    bn_check_top(r);
  229|  94.0k|    ret = 1;
  230|  94.0k| err:
  231|  94.0k|    BN_CTX_end(ctx);
  232|  94.0k|    return ret;
  233|  94.0k|}

BN_mod_mul_montgomery:
   28|  12.4k|{
   29|  12.4k|    int ret = bn_mul_mont_fixed_top(r, a, b, mont, ctx);
   30|       |
   31|  12.4k|    bn_correct_top(r);
   32|  12.4k|    bn_check_top(r);
   33|       |
   34|  12.4k|    return ret;
   35|  12.4k|}
bn_mul_mont_fixed_top:
   39|  64.5k|{
   40|  64.5k|    BIGNUM *tmp;
   41|  64.5k|    int ret = 0;
   42|  64.5k|    int num = mont->N.top;
   43|       |
   44|  64.5k|#if defined(OPENSSL_BN_ASM_MONT) && defined(MONT_WORD)
   45|  64.5k|    if (num > 1 && num <= BN_SOFT_LIMIT && a->top == num && b->top == num) {
  ------------------
  |  |   62|  73.4k|#  define BN_SOFT_LIMIT         (4096 / BN_BYTES)
  |  |  ------------------
  |  |  |  |   38|  8.95k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  |  Branch (45:9): [True: 8.95k, False: 55.5k]
  |  Branch (45:20): [True: 8.95k, False: 0]
  |  Branch (45:44): [True: 7.88k, False: 1.07k]
  |  Branch (45:61): [True: 7.88k, False: 0]
  ------------------
   46|  7.88k|        if (bn_wexpand(r, num) == NULL)
  ------------------
  |  Branch (46:13): [True: 0, False: 7.88k]
  ------------------
   47|      0|            return 0;
   48|  7.88k|        if (bn_mul_mont(r->d, a->d, b->d, mont->N.d, mont->n0, num)) {
  ------------------
  |  Branch (48:13): [True: 7.88k, False: 0]
  ------------------
   49|  7.88k|            r->neg = a->neg ^ b->neg;
   50|  7.88k|            r->top = num;
   51|  7.88k|            r->flags |= BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|  7.88k|#  define BN_FLG_FIXED_TOP 0
  ------------------
   52|  7.88k|            return 1;
   53|  7.88k|        }
   54|  7.88k|    }
   55|  56.6k|#endif
   56|       |
   57|  56.6k|    if ((a->top + b->top) > 2 * num)
  ------------------
  |  Branch (57:9): [True: 0, False: 56.6k]
  ------------------
   58|      0|        return 0;
   59|       |
   60|  56.6k|    BN_CTX_start(ctx);
   61|  56.6k|    tmp = BN_CTX_get(ctx);
   62|  56.6k|    if (tmp == NULL)
  ------------------
  |  Branch (62:9): [True: 0, False: 56.6k]
  ------------------
   63|      0|        goto err;
   64|       |
   65|  56.6k|    bn_check_top(tmp);
   66|  56.6k|    if (a == b) {
  ------------------
  |  Branch (66:9): [True: 46.9k, False: 9.71k]
  ------------------
   67|  46.9k|        if (!bn_sqr_fixed_top(tmp, a, ctx))
  ------------------
  |  Branch (67:13): [True: 0, False: 46.9k]
  ------------------
   68|      0|            goto err;
   69|  46.9k|    } else {
   70|  9.71k|        if (!bn_mul_fixed_top(tmp, a, b, ctx))
  ------------------
  |  Branch (70:13): [True: 0, False: 9.71k]
  ------------------
   71|      0|            goto err;
   72|  9.71k|    }
   73|       |    /* reduce from aRR to aR */
   74|  56.6k|#ifdef MONT_WORD
   75|  56.6k|    if (!bn_from_montgomery_word(r, tmp, mont))
  ------------------
  |  Branch (75:9): [True: 0, False: 56.6k]
  ------------------
   76|      0|        goto err;
   77|       |#else
   78|       |    if (!BN_from_montgomery(r, tmp, mont, ctx))
   79|       |        goto err;
   80|       |#endif
   81|  56.6k|    ret = 1;
   82|  56.6k| err:
   83|  56.6k|    BN_CTX_end(ctx);
   84|  56.6k|    return ret;
   85|  56.6k|}
BN_from_montgomery:
  164|  1.27k|{
  165|  1.27k|    int retn;
  166|       |
  167|  1.27k|    retn = bn_from_mont_fixed_top(ret, a, mont, ctx);
  168|  1.27k|    bn_correct_top(ret);
  169|  1.27k|    bn_check_top(ret);
  170|       |
  171|  1.27k|    return retn;
  172|  1.27k|}
bn_from_mont_fixed_top:
  176|  1.27k|{
  177|  1.27k|    int retn = 0;
  178|  1.27k|#ifdef MONT_WORD
  179|  1.27k|    BIGNUM *t;
  180|       |
  181|  1.27k|    BN_CTX_start(ctx);
  182|  1.27k|    if ((t = BN_CTX_get(ctx)) && BN_copy(t, a)) {
  ------------------
  |  Branch (182:9): [True: 1.27k, False: 0]
  |  Branch (182:34): [True: 1.27k, False: 0]
  ------------------
  183|  1.27k|        retn = bn_from_montgomery_word(ret, t, mont);
  184|  1.27k|    }
  185|  1.27k|    BN_CTX_end(ctx);
  186|       |#else                           /* !MONT_WORD */
  187|       |    BIGNUM *t1, *t2;
  188|       |
  189|       |    BN_CTX_start(ctx);
  190|       |    t1 = BN_CTX_get(ctx);
  191|       |    t2 = BN_CTX_get(ctx);
  192|       |    if (t2 == NULL)
  193|       |        goto err;
  194|       |
  195|       |    if (!BN_copy(t1, a))
  196|       |        goto err;
  197|       |    BN_mask_bits(t1, mont->ri);
  198|       |
  199|       |    if (!BN_mul(t2, t1, &mont->Ni, ctx))
  200|       |        goto err;
  201|       |    BN_mask_bits(t2, mont->ri);
  202|       |
  203|       |    if (!BN_mul(t1, t2, &mont->N, ctx))
  204|       |        goto err;
  205|       |    if (!BN_add(t2, a, t1))
  206|       |        goto err;
  207|       |    if (!BN_rshift(ret, t2, mont->ri))
  208|       |        goto err;
  209|       |
  210|       |    if (BN_ucmp(ret, &(mont->N)) >= 0) {
  211|       |        if (!BN_usub(ret, ret, &(mont->N)))
  212|       |            goto err;
  213|       |    }
  214|       |    retn = 1;
  215|       |    bn_check_top(ret);
  216|       | err:
  217|       |    BN_CTX_end(ctx);
  218|       |#endif                          /* MONT_WORD */
  219|  1.27k|    return retn;
  220|  1.27k|}
bn_to_mont_fixed_top:
  224|  1.66k|{
  225|  1.66k|    return bn_mul_mont_fixed_top(r, a, &(mont->RR), mont, ctx);
  226|  1.66k|}
BN_MONT_CTX_new:
  229|  1.27k|{
  230|  1.27k|    BN_MONT_CTX *ret;
  231|       |
  232|  1.27k|    if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL)
  ------------------
  |  |  102|  1.27k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|  1.27k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|  1.27k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (232:9): [True: 0, False: 1.27k]
  ------------------
  233|      0|        return NULL;
  234|       |
  235|  1.27k|    BN_MONT_CTX_init(ret);
  236|  1.27k|    ret->flags = BN_FLG_MALLOCED;
  ------------------
  |  |   58|  1.27k|# define BN_FLG_MALLOCED         0x01
  ------------------
  237|  1.27k|    return ret;
  238|  1.27k|}
BN_MONT_CTX_init:
  241|  1.27k|{
  242|  1.27k|    ctx->ri = 0;
  243|  1.27k|    bn_init(&ctx->RR);
  244|  1.27k|    bn_init(&ctx->N);
  245|  1.27k|    bn_init(&ctx->Ni);
  246|  1.27k|    ctx->n0[0] = ctx->n0[1] = 0;
  247|  1.27k|    ctx->flags = 0;
  248|  1.27k|}
BN_MONT_CTX_free:
  251|  1.27k|{
  252|  1.27k|    if (mont == NULL)
  ------------------
  |  Branch (252:9): [True: 0, False: 1.27k]
  ------------------
  253|      0|        return;
  254|  1.27k|    BN_clear_free(&mont->RR);
  255|  1.27k|    BN_clear_free(&mont->N);
  256|  1.27k|    BN_clear_free(&mont->Ni);
  257|  1.27k|    if (mont->flags & BN_FLG_MALLOCED)
  ------------------
  |  |   58|  1.27k|# define BN_FLG_MALLOCED         0x01
  ------------------
  |  Branch (257:9): [True: 1.27k, False: 0]
  ------------------
  258|  1.27k|        OPENSSL_free(mont);
  ------------------
  |  |  115|  1.27k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|  1.27k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|  1.27k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  259|  1.27k|}
BN_MONT_CTX_set:
  262|  1.27k|{
  263|  1.27k|    int i, ret = 0;
  264|  1.27k|    BIGNUM *Ri, *R;
  265|       |
  266|  1.27k|    if (BN_is_zero(mod))
  ------------------
  |  Branch (266:9): [True: 0, False: 1.27k]
  ------------------
  267|      0|        return 0;
  268|       |
  269|  1.27k|    BN_CTX_start(ctx);
  270|  1.27k|    if ((Ri = BN_CTX_get(ctx)) == NULL)
  ------------------
  |  Branch (270:9): [True: 0, False: 1.27k]
  ------------------
  271|      0|        goto err;
  272|  1.27k|    R = &(mont->RR);            /* grab RR as a temp */
  273|  1.27k|    if (!BN_copy(&(mont->N), mod))
  ------------------
  |  Branch (273:9): [True: 0, False: 1.27k]
  ------------------
  274|      0|        goto err;               /* Set N */
  275|  1.27k|    if (BN_get_flags(mod, BN_FLG_CONSTTIME) != 0)
  ------------------
  |  |   67|  1.27k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (275:9): [True: 0, False: 1.27k]
  ------------------
  276|      0|        BN_set_flags(&(mont->N), BN_FLG_CONSTTIME);
  ------------------
  |  |   67|      0|# define BN_FLG_CONSTTIME        0x04
  ------------------
  277|  1.27k|    mont->N.neg = 0;
  278|       |
  279|  1.27k|#ifdef MONT_WORD
  280|  1.27k|    {
  281|  1.27k|        BIGNUM tmod;
  282|  1.27k|        BN_ULONG buf[2];
  ------------------
  |  |   37|  1.27k|#  define BN_ULONG        unsigned long
  ------------------
  283|       |
  284|  1.27k|        bn_init(&tmod);
  285|  1.27k|        tmod.d = buf;
  286|  1.27k|        tmod.dmax = 2;
  287|  1.27k|        tmod.neg = 0;
  288|       |
  289|  1.27k|        if (BN_get_flags(mod, BN_FLG_CONSTTIME) != 0)
  ------------------
  |  |   67|  1.27k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (289:13): [True: 0, False: 1.27k]
  ------------------
  290|      0|            BN_set_flags(&tmod, BN_FLG_CONSTTIME);
  ------------------
  |  |   67|      0|# define BN_FLG_CONSTTIME        0x04
  ------------------
  291|       |
  292|  1.27k|        mont->ri = (BN_num_bits(mod) + (BN_BITS2 - 1)) / BN_BITS2 * BN_BITS2;
  ------------------
  |  |   54|  1.27k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  1.27k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
                      mont->ri = (BN_num_bits(mod) + (BN_BITS2 - 1)) / BN_BITS2 * BN_BITS2;
  ------------------
  |  |   54|  1.27k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  1.27k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
                      mont->ri = (BN_num_bits(mod) + (BN_BITS2 - 1)) / BN_BITS2 * BN_BITS2;
  ------------------
  |  |   54|  1.27k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  1.27k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  293|       |
  294|       |# if defined(OPENSSL_BN_ASM_MONT) && (BN_BITS2<=32)
  295|       |        /*
  296|       |         * Only certain BN_BITS2<=32 platforms actually make use of n0[1],
  297|       |         * and we could use the #else case (with a shorter R value) for the
  298|       |         * others.  However, currently only the assembler files do know which
  299|       |         * is which.
  300|       |         */
  301|       |
  302|       |        BN_zero(R);
  303|       |        if (!(BN_set_bit(R, 2 * BN_BITS2)))
  304|       |            goto err;
  305|       |
  306|       |        tmod.top = 0;
  307|       |        if ((buf[0] = mod->d[0]))
  308|       |            tmod.top = 1;
  309|       |        if ((buf[1] = mod->top > 1 ? mod->d[1] : 0))
  310|       |            tmod.top = 2;
  311|       |
  312|       |        if (BN_is_one(&tmod))
  313|       |            BN_zero(Ri);
  314|       |        else if ((BN_mod_inverse(Ri, R, &tmod, ctx)) == NULL)
  315|       |            goto err;
  316|       |        if (!BN_lshift(Ri, Ri, 2 * BN_BITS2))
  317|       |            goto err;           /* R*Ri */
  318|       |        if (!BN_is_zero(Ri)) {
  319|       |            if (!BN_sub_word(Ri, 1))
  320|       |                goto err;
  321|       |        } else {                /* if N mod word size == 1 */
  322|       |
  323|       |            if (bn_expand(Ri, (int)sizeof(BN_ULONG) * 2) == NULL)
  324|       |                goto err;
  325|       |            /* Ri-- (mod double word size) */
  326|       |            Ri->neg = 0;
  327|       |            Ri->d[0] = BN_MASK2;
  328|       |            Ri->d[1] = BN_MASK2;
  329|       |            Ri->top = 2;
  330|       |        }
  331|       |        if (!BN_div(Ri, NULL, Ri, &tmod, ctx))
  332|       |            goto err;
  333|       |        /*
  334|       |         * Ni = (R*Ri-1)/N, keep only couple of least significant words:
  335|       |         */
  336|       |        mont->n0[0] = (Ri->top > 0) ? Ri->d[0] : 0;
  337|       |        mont->n0[1] = (Ri->top > 1) ? Ri->d[1] : 0;
  338|       |# else
  339|  1.27k|        BN_zero(R);
  ------------------
  |  |  202|  1.27k|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  340|  1.27k|        if (!(BN_set_bit(R, BN_BITS2)))
  ------------------
  |  |   54|  1.27k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  1.27k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  |  Branch (340:13): [True: 0, False: 1.27k]
  ------------------
  341|      0|            goto err;           /* R */
  342|       |
  343|  1.27k|        buf[0] = mod->d[0];     /* tmod = N mod word size */
  344|  1.27k|        buf[1] = 0;
  345|  1.27k|        tmod.top = buf[0] != 0 ? 1 : 0;
  ------------------
  |  Branch (345:20): [True: 1.27k, False: 0]
  ------------------
  346|       |        /* Ri = R^-1 mod N */
  347|  1.27k|        if (BN_is_one(&tmod))
  ------------------
  |  Branch (347:13): [True: 26, False: 1.25k]
  ------------------
  348|     26|            BN_zero(Ri);
  ------------------
  |  |  202|     26|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  349|  1.25k|        else if ((BN_mod_inverse(Ri, R, &tmod, ctx)) == NULL)
  ------------------
  |  Branch (349:18): [True: 0, False: 1.25k]
  ------------------
  350|      0|            goto err;
  351|  1.27k|        if (!BN_lshift(Ri, Ri, BN_BITS2))
  ------------------
  |  |   54|  1.27k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  1.27k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  |  Branch (351:13): [True: 0, False: 1.27k]
  ------------------
  352|      0|            goto err;           /* R*Ri */
  353|  1.27k|        if (!BN_is_zero(Ri)) {
  ------------------
  |  Branch (353:13): [True: 1.25k, False: 26]
  ------------------
  354|  1.25k|            if (!BN_sub_word(Ri, 1))
  ------------------
  |  Branch (354:17): [True: 0, False: 1.25k]
  ------------------
  355|      0|                goto err;
  356|  1.25k|        } else {                /* if N mod word size == 1 */
  357|       |
  358|     26|            if (!BN_set_word(Ri, BN_MASK2))
  ------------------
  |  |   94|     26|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  |  Branch (358:17): [True: 0, False: 26]
  ------------------
  359|      0|                goto err;       /* Ri-- (mod word size) */
  360|     26|        }
  361|  1.27k|        if (!BN_div(Ri, NULL, Ri, &tmod, ctx))
  ------------------
  |  Branch (361:13): [True: 0, False: 1.27k]
  ------------------
  362|      0|            goto err;
  363|       |        /*
  364|       |         * Ni = (R*Ri-1)/N, keep only least significant word:
  365|       |         */
  366|  1.27k|        mont->n0[0] = (Ri->top > 0) ? Ri->d[0] : 0;
  ------------------
  |  Branch (366:23): [True: 1.27k, False: 0]
  ------------------
  367|  1.27k|        mont->n0[1] = 0;
  368|  1.27k|# endif
  369|  1.27k|    }
  370|       |#else                           /* !MONT_WORD */
  371|       |    {                           /* bignum version */
  372|       |        mont->ri = BN_num_bits(&mont->N);
  373|       |        BN_zero(R);
  374|       |        if (!BN_set_bit(R, mont->ri))
  375|       |            goto err;           /* R = 2^ri */
  376|       |        /* Ri = R^-1 mod N */
  377|       |        if ((BN_mod_inverse(Ri, R, &mont->N, ctx)) == NULL)
  378|       |            goto err;
  379|       |        if (!BN_lshift(Ri, Ri, mont->ri))
  380|       |            goto err;           /* R*Ri */
  381|       |        if (!BN_sub_word(Ri, 1))
  382|       |            goto err;
  383|       |        /*
  384|       |         * Ni = (R*Ri-1) / N
  385|       |         */
  386|       |        if (!BN_div(&(mont->Ni), NULL, Ri, &mont->N, ctx))
  387|       |            goto err;
  388|       |    }
  389|       |#endif
  390|       |
  391|       |    /* setup RR for conversions */
  392|  1.27k|    BN_zero(&(mont->RR));
  ------------------
  |  |  202|  1.27k|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  393|  1.27k|    if (!BN_set_bit(&(mont->RR), mont->ri * 2))
  ------------------
  |  Branch (393:9): [True: 0, False: 1.27k]
  ------------------
  394|      0|        goto err;
  395|  1.27k|    if (!BN_mod(&(mont->RR), &(mont->RR), &(mont->N), ctx))
  ------------------
  |  |  277|  1.27k|# define BN_mod(rem,m,d,ctx) BN_div(NULL,(rem),(m),(d),(ctx))
  ------------------
  |  Branch (395:9): [True: 0, False: 1.27k]
  ------------------
  396|      0|        goto err;
  397|       |
  398|  1.48k|    for (i = mont->RR.top, ret = mont->N.top; i < ret; i++)
  ------------------
  |  Branch (398:47): [True: 205, False: 1.27k]
  ------------------
  399|    205|        mont->RR.d[i] = 0;
  400|  1.27k|    mont->RR.top = ret;
  401|  1.27k|    mont->RR.flags |= BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|  1.27k|#  define BN_FLG_FIXED_TOP 0
  ------------------
  402|       |
  403|  1.27k|    ret = 1;
  404|  1.27k| err:
  405|  1.27k|    BN_CTX_end(ctx);
  406|  1.27k|    return ret;
  407|  1.27k|}
bn_mont.c:bn_from_montgomery_word:
   89|  57.9k|{
   90|  57.9k|    BIGNUM *n;
   91|  57.9k|    BN_ULONG *ap, *np, *rp, n0, v, carry;
  ------------------
  |  |   37|  57.9k|#  define BN_ULONG        unsigned long
  ------------------
   92|  57.9k|    int nl, max, i;
   93|  57.9k|    unsigned int rtop;
   94|       |
   95|  57.9k|    n = &(mont->N);
   96|  57.9k|    nl = n->top;
   97|  57.9k|    if (nl == 0) {
  ------------------
  |  Branch (97:9): [True: 0, False: 57.9k]
  ------------------
   98|      0|        ret->top = 0;
   99|      0|        return 1;
  100|      0|    }
  101|       |
  102|  57.9k|    max = (2 * nl);             /* carry is stored separately */
  103|  57.9k|    if (bn_wexpand(r, max) == NULL)
  ------------------
  |  Branch (103:9): [True: 0, False: 57.9k]
  ------------------
  104|      0|        return 0;
  105|       |
  106|  57.9k|    r->neg ^= n->neg;
  107|  57.9k|    np = n->d;
  108|  57.9k|    rp = r->d;
  109|       |
  110|       |    /* clear the top words of T */
  111|   188k|    for (rtop = r->top, i = 0; i < max; i++) {
  ------------------
  |  Branch (111:32): [True: 130k, False: 57.9k]
  ------------------
  112|   130k|        v = (BN_ULONG)0 - ((i - rtop) >> (8 * sizeof(rtop) - 1));
  113|   130k|        rp[i] &= v;
  114|   130k|    }
  115|       |
  116|  57.9k|    r->top = max;
  117|  57.9k|    r->flags |= BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|  57.9k|#  define BN_FLG_FIXED_TOP 0
  ------------------
  118|  57.9k|    n0 = mont->n0[0];
  119|       |
  120|       |    /*
  121|       |     * Add multiples of |n| to |r| until R = 2^(nl * BN_BITS2) divides it. On
  122|       |     * input, we had |r| < |n| * R, so now |r| < 2 * |n| * R. Note that |r|
  123|       |     * includes |carry| which is stored separately.
  124|       |     */
  125|   123k|    for (carry = 0, i = 0; i < nl; i++, rp++) {
  ------------------
  |  Branch (125:28): [True: 65.3k, False: 57.9k]
  ------------------
  126|  65.3k|        v = bn_mul_add_words(rp, np, nl, (rp[0] * n0) & BN_MASK2);
  ------------------
  |  |   94|  65.3k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  127|  65.3k|        v = (v + carry + rp[nl]) & BN_MASK2;
  ------------------
  |  |   94|  65.3k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  128|  65.3k|        carry |= (v != rp[nl]);
  129|  65.3k|        carry &= (v <= rp[nl]);
  130|  65.3k|        rp[nl] = v;
  131|  65.3k|    }
  132|       |
  133|  57.9k|    if (bn_wexpand(ret, nl) == NULL)
  ------------------
  |  Branch (133:9): [True: 0, False: 57.9k]
  ------------------
  134|      0|        return 0;
  135|  57.9k|    ret->top = nl;
  136|  57.9k|    ret->flags |= BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|  57.9k|#  define BN_FLG_FIXED_TOP 0
  ------------------
  137|  57.9k|    ret->neg = r->neg;
  138|       |
  139|  57.9k|    rp = ret->d;
  140|       |
  141|       |    /*
  142|       |     * Shift |nl| words to divide by R. We have |ap| < 2 * |n|. Note that |ap|
  143|       |     * includes |carry| which is stored separately.
  144|       |     */
  145|  57.9k|    ap = &(r->d[nl]);
  146|       |
  147|  57.9k|    carry -= bn_sub_words(rp, ap, np, nl);
  148|       |    /*
  149|       |     * |carry| is -1 if |ap| - |np| underflowed or zero if it did not. Note
  150|       |     * |carry| cannot be 1. That would imply the subtraction did not fit in
  151|       |     * |nl| words, and we know at most one subtraction is needed.
  152|       |     */
  153|   123k|    for (i = 0; i < nl; i++) {
  ------------------
  |  Branch (153:17): [True: 65.3k, False: 57.9k]
  ------------------
  154|  65.3k|        rp[i] = (carry & ap[i]) | (~carry & rp[i]);
  155|  65.3k|        ap[i] = 0;
  156|  65.3k|    }
  157|       |
  158|  57.9k|    return 1;
  159|  57.9k|}

bn_sub_part_words:
   30|   312k|{
   31|   312k|    BN_ULONG c, t;
  ------------------
  |  |   37|   312k|#  define BN_ULONG        unsigned long
  ------------------
   32|       |
   33|   312k|    assert(cl >= 0);
   34|   312k|    c = bn_sub_words(r, a, b, cl);
   35|       |
   36|   312k|    if (dl == 0)
  ------------------
  |  Branch (36:9): [True: 242k, False: 69.2k]
  ------------------
   37|   242k|        return c;
   38|       |
   39|  69.2k|    r += cl;
   40|  69.2k|    a += cl;
   41|  69.2k|    b += cl;
   42|       |
   43|  69.2k|    if (dl < 0) {
  ------------------
  |  Branch (43:9): [True: 9.02k, False: 60.2k]
  ------------------
   44|  24.2k|        for (;;) {
   45|  24.2k|            t = b[0];
   46|  24.2k|            r[0] = (0 - t - c) & BN_MASK2;
  ------------------
  |  |   94|  24.2k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
   47|  24.2k|            if (t != 0)
  ------------------
  |  Branch (47:17): [True: 0, False: 24.2k]
  ------------------
   48|      0|                c = 1;
   49|  24.2k|            if (++dl >= 0)
  ------------------
  |  Branch (49:17): [True: 1.11k, False: 23.1k]
  ------------------
   50|  1.11k|                break;
   51|       |
   52|  23.1k|            t = b[1];
   53|  23.1k|            r[1] = (0 - t - c) & BN_MASK2;
  ------------------
  |  |   94|  23.1k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
   54|  23.1k|            if (t != 0)
  ------------------
  |  Branch (54:17): [True: 0, False: 23.1k]
  ------------------
   55|      0|                c = 1;
   56|  23.1k|            if (++dl >= 0)
  ------------------
  |  Branch (56:17): [True: 1.03k, False: 22.1k]
  ------------------
   57|  1.03k|                break;
   58|       |
   59|  22.1k|            t = b[2];
   60|  22.1k|            r[2] = (0 - t - c) & BN_MASK2;
  ------------------
  |  |   94|  22.1k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
   61|  22.1k|            if (t != 0)
  ------------------
  |  Branch (61:17): [True: 0, False: 22.1k]
  ------------------
   62|      0|                c = 1;
   63|  22.1k|            if (++dl >= 0)
  ------------------
  |  Branch (63:17): [True: 6.11k, False: 16.0k]
  ------------------
   64|  6.11k|                break;
   65|       |
   66|  16.0k|            t = b[3];
   67|  16.0k|            r[3] = (0 - t - c) & BN_MASK2;
  ------------------
  |  |   94|  16.0k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
   68|  16.0k|            if (t != 0)
  ------------------
  |  Branch (68:17): [True: 0, False: 16.0k]
  ------------------
   69|      0|                c = 1;
   70|  16.0k|            if (++dl >= 0)
  ------------------
  |  Branch (70:17): [True: 758, False: 15.2k]
  ------------------
   71|    758|                break;
   72|       |
   73|  15.2k|            b += 4;
   74|  15.2k|            r += 4;
   75|  15.2k|        }
   76|  60.2k|    } else {
   77|  60.2k|        int save_dl = dl;
   78|  71.9k|        while (c) {
  ------------------
  |  Branch (78:16): [True: 16.2k, False: 55.6k]
  ------------------
   79|  16.2k|            t = a[0];
   80|  16.2k|            r[0] = (t - c) & BN_MASK2;
  ------------------
  |  |   94|  16.2k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
   81|  16.2k|            if (t != 0)
  ------------------
  |  Branch (81:17): [True: 6.15k, False: 10.1k]
  ------------------
   82|  6.15k|                c = 0;
   83|  16.2k|            if (--dl <= 0)
  ------------------
  |  Branch (83:17): [True: 1.14k, False: 15.1k]
  ------------------
   84|  1.14k|                break;
   85|       |
   86|  15.1k|            t = a[1];
   87|  15.1k|            r[1] = (t - c) & BN_MASK2;
  ------------------
  |  |   94|  15.1k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
   88|  15.1k|            if (t != 0)
  ------------------
  |  Branch (88:17): [True: 5.50k, False: 9.64k]
  ------------------
   89|  5.50k|                c = 0;
   90|  15.1k|            if (--dl <= 0)
  ------------------
  |  Branch (90:17): [True: 440, False: 14.7k]
  ------------------
   91|    440|                break;
   92|       |
   93|  14.7k|            t = a[2];
   94|  14.7k|            r[2] = (t - c) & BN_MASK2;
  ------------------
  |  |   94|  14.7k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
   95|  14.7k|            if (t != 0)
  ------------------
  |  Branch (95:17): [True: 6.67k, False: 8.03k]
  ------------------
   96|  6.67k|                c = 0;
   97|  14.7k|            if (--dl <= 0)
  ------------------
  |  Branch (97:17): [True: 2.46k, False: 12.2k]
  ------------------
   98|  2.46k|                break;
   99|       |
  100|  12.2k|            t = a[3];
  101|  12.2k|            r[3] = (t - c) & BN_MASK2;
  ------------------
  |  |   94|  12.2k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  102|  12.2k|            if (t != 0)
  ------------------
  |  Branch (102:17): [True: 4.90k, False: 7.33k]
  ------------------
  103|  4.90k|                c = 0;
  104|  12.2k|            if (--dl <= 0)
  ------------------
  |  Branch (104:17): [True: 539, False: 11.7k]
  ------------------
  105|    539|                break;
  106|       |
  107|  11.7k|            save_dl = dl;
  108|  11.7k|            a += 4;
  109|  11.7k|            r += 4;
  110|  11.7k|        }
  111|  60.2k|        if (dl > 0) {
  ------------------
  |  Branch (111:13): [True: 55.6k, False: 4.58k]
  ------------------
  112|  55.6k|            if (save_dl > dl) {
  ------------------
  |  Branch (112:17): [True: 0, False: 55.6k]
  ------------------
  113|      0|                switch (save_dl - dl) {
  ------------------
  |  Branch (113:25): [True: 0, False: 0]
  ------------------
  114|      0|                case 1:
  ------------------
  |  Branch (114:17): [True: 0, False: 0]
  ------------------
  115|      0|                    r[1] = a[1];
  116|      0|                    if (--dl <= 0)
  ------------------
  |  Branch (116:25): [True: 0, False: 0]
  ------------------
  117|      0|                        break;
  118|       |                    /* fall through */
  119|      0|                case 2:
  ------------------
  |  Branch (119:17): [True: 0, False: 0]
  ------------------
  120|      0|                    r[2] = a[2];
  121|      0|                    if (--dl <= 0)
  ------------------
  |  Branch (121:25): [True: 0, False: 0]
  ------------------
  122|      0|                        break;
  123|       |                    /* fall through */
  124|      0|                case 3:
  ------------------
  |  Branch (124:17): [True: 0, False: 0]
  ------------------
  125|      0|                    r[3] = a[3];
  126|      0|                    if (--dl <= 0)
  ------------------
  |  Branch (126:25): [True: 0, False: 0]
  ------------------
  127|      0|                        break;
  128|      0|                }
  129|      0|                a += 4;
  130|      0|                r += 4;
  131|      0|            }
  132|  55.6k|        }
  133|  60.2k|        if (dl > 0) {
  ------------------
  |  Branch (133:13): [True: 55.6k, False: 4.58k]
  ------------------
  134|   205k|            for (;;) {
  135|   205k|                r[0] = a[0];
  136|   205k|                if (--dl <= 0)
  ------------------
  |  Branch (136:21): [True: 24.9k, False: 180k]
  ------------------
  137|  24.9k|                    break;
  138|   180k|                r[1] = a[1];
  139|   180k|                if (--dl <= 0)
  ------------------
  |  Branch (139:21): [True: 3.61k, False: 177k]
  ------------------
  140|  3.61k|                    break;
  141|   177k|                r[2] = a[2];
  142|   177k|                if (--dl <= 0)
  ------------------
  |  Branch (142:21): [True: 20.9k, False: 156k]
  ------------------
  143|  20.9k|                    break;
  144|   156k|                r[3] = a[3];
  145|   156k|                if (--dl <= 0)
  ------------------
  |  Branch (145:21): [True: 6.16k, False: 150k]
  ------------------
  146|  6.16k|                    break;
  147|       |
  148|   150k|                a += 4;
  149|   150k|                r += 4;
  150|   150k|            }
  151|  55.6k|        }
  152|  60.2k|    }
  153|  69.2k|    return c;
  154|  69.2k|}
bn_mul_recursive:
  177|   132k|{
  178|   132k|    int n = n2 / 2, c1, c2;
  179|   132k|    int tna = n + dna, tnb = n + dnb;
  180|   132k|    unsigned int neg, zero;
  181|   132k|    BN_ULONG ln, lo, *p;
  ------------------
  |  |   37|   132k|#  define BN_ULONG        unsigned long
  ------------------
  182|       |
  183|   132k|# ifdef BN_MUL_COMBA
  184|       |#  if 0
  185|       |    if (n2 == 4) {
  186|       |        bn_mul_comba4(r, a, b);
  187|       |        return;
  188|       |    }
  189|       |#  endif
  190|       |    /*
  191|       |     * Only call bn_mul_comba 8 if n2 == 8 and the two arrays are complete
  192|       |     * [steve]
  193|       |     */
  194|   132k|    if (n2 == 8 && dna == 0 && dnb == 0) {
  ------------------
  |  Branch (194:9): [True: 4.29k, False: 128k]
  |  Branch (194:20): [True: 2.96k, False: 1.32k]
  |  Branch (194:32): [True: 2.29k, False: 674]
  ------------------
  195|  2.29k|        bn_mul_comba8(r, a, b);
  196|  2.29k|        return;
  197|  2.29k|    }
  198|   130k|# endif                         /* BN_MUL_COMBA */
  199|       |    /* Else do normal multiply */
  200|   130k|    if (n2 < BN_MUL_RECURSIVE_SIZE_NORMAL) {
  ------------------
  |  |  365|   130k|# define BN_MUL_RECURSIVE_SIZE_NORMAL            (16)/* 32 less than */
  ------------------
  |  Branch (200:9): [True: 2.00k, False: 128k]
  ------------------
  201|  2.00k|        bn_mul_normal(r, a, n2 + dna, b, n2 + dnb);
  202|  2.00k|        if ((dna + dnb) < 0)
  ------------------
  |  Branch (202:13): [True: 2.00k, False: 0]
  ------------------
  203|  2.00k|            memset(&r[2 * n2 + dna + dnb], 0,
  204|  2.00k|                   sizeof(BN_ULONG) * -(dna + dnb));
  205|  2.00k|        return;
  206|  2.00k|    }
  207|       |    /* r=(a[0]-a[1])*(b[1]-b[0]) */
  208|   128k|    c1 = bn_cmp_part_words(a, &(a[n]), tna, n - tna);
  209|   128k|    c2 = bn_cmp_part_words(&(b[n]), b, tnb, tnb - n);
  210|   128k|    zero = neg = 0;
  211|   128k|    switch (c1 * 3 + c2) {
  ------------------
  |  Branch (211:13): [True: 0, False: 128k]
  ------------------
  212|  29.0k|    case -4:
  ------------------
  |  Branch (212:5): [True: 29.0k, False: 99.3k]
  ------------------
  213|  29.0k|        bn_sub_part_words(t, &(a[n]), a, tna, tna - n); /* - */
  214|  29.0k|        bn_sub_part_words(&(t[n]), b, &(b[n]), tnb, n - tnb); /* - */
  215|  29.0k|        break;
  216|    983|    case -3:
  ------------------
  |  Branch (216:5): [True: 983, False: 127k]
  ------------------
  217|    983|        zero = 1;
  218|    983|        break;
  219|  25.1k|    case -2:
  ------------------
  |  Branch (219:5): [True: 25.1k, False: 103k]
  ------------------
  220|  25.1k|        bn_sub_part_words(t, &(a[n]), a, tna, tna - n); /* - */
  221|  25.1k|        bn_sub_part_words(&(t[n]), &(b[n]), b, tnb, tnb - n); /* + */
  222|  25.1k|        neg = 1;
  223|  25.1k|        break;
  224|  1.30k|    case -1:
  ------------------
  |  Branch (224:5): [True: 1.30k, False: 127k]
  ------------------
  225|  2.34k|    case 0:
  ------------------
  |  Branch (225:5): [True: 1.03k, False: 127k]
  ------------------
  226|  4.11k|    case 1:
  ------------------
  |  Branch (226:5): [True: 1.77k, False: 126k]
  ------------------
  227|  4.11k|        zero = 1;
  228|  4.11k|        break;
  229|  40.6k|    case 2:
  ------------------
  |  Branch (229:5): [True: 40.6k, False: 87.6k]
  ------------------
  230|  40.6k|        bn_sub_part_words(t, a, &(a[n]), tna, n - tna); /* + */
  231|  40.6k|        bn_sub_part_words(&(t[n]), b, &(b[n]), tnb, n - tnb); /* - */
  232|  40.6k|        neg = 1;
  233|  40.6k|        break;
  234|    867|    case 3:
  ------------------
  |  Branch (234:5): [True: 867, False: 127k]
  ------------------
  235|    867|        zero = 1;
  236|    867|        break;
  237|  27.5k|    case 4:
  ------------------
  |  Branch (237:5): [True: 27.5k, False: 100k]
  ------------------
  238|  27.5k|        bn_sub_part_words(t, a, &(a[n]), tna, n - tna);
  239|  27.5k|        bn_sub_part_words(&(t[n]), &(b[n]), b, tnb, tnb - n);
  240|  27.5k|        break;
  241|   128k|    }
  242|       |
  243|   128k|# ifdef BN_MUL_COMBA
  244|   128k|    if (n == 4 && dna == 0 && dnb == 0) { /* XXX: bn_mul_comba4 could take
  ------------------
  |  Branch (244:9): [True: 0, False: 128k]
  |  Branch (244:19): [True: 0, False: 0]
  |  Branch (244:31): [True: 0, False: 0]
  ------------------
  245|       |                                           * extra args to do this well */
  246|      0|        if (!zero)
  ------------------
  |  Branch (246:13): [True: 0, False: 0]
  ------------------
  247|      0|            bn_mul_comba4(&(t[n2]), t, &(t[n]));
  248|      0|        else
  249|      0|            memset(&t[n2], 0, sizeof(*t) * 8);
  250|       |
  251|      0|        bn_mul_comba4(r, a, b);
  252|      0|        bn_mul_comba4(&(r[n2]), &(a[n]), &(b[n]));
  253|   128k|    } else if (n == 8 && dna == 0 && dnb == 0) { /* XXX: bn_mul_comba8 could
  ------------------
  |  Branch (253:16): [True: 109k, False: 19.3k]
  |  Branch (253:26): [True: 108k, False: 741]
  |  Branch (253:38): [True: 107k, False: 338]
  ------------------
  254|       |                                                  * take extra args to do
  255|       |                                                  * this well */
  256|   107k|        if (!zero)
  ------------------
  |  Branch (256:13): [True: 102k, False: 5.65k]
  ------------------
  257|   102k|            bn_mul_comba8(&(t[n2]), t, &(t[n]));
  258|  5.65k|        else
  259|  5.65k|            memset(&t[n2], 0, sizeof(*t) * 16);
  260|       |
  261|   107k|        bn_mul_comba8(r, a, b);
  262|   107k|        bn_mul_comba8(&(r[n2]), &(a[n]), &(b[n]));
  263|   107k|    } else
  264|  20.3k|# endif                         /* BN_MUL_COMBA */
  265|  20.3k|    {
  266|  20.3k|        p = &(t[n2 * 2]);
  267|  20.3k|        if (!zero)
  ------------------
  |  Branch (267:13): [True: 20.0k, False: 315]
  ------------------
  268|  20.0k|            bn_mul_recursive(&(t[n2]), t, &(t[n]), n, 0, 0, p);
  269|    315|        else
  270|    315|            memset(&t[n2], 0, sizeof(*t) * n2);
  271|  20.3k|        bn_mul_recursive(r, a, b, n, 0, 0, p);
  272|  20.3k|        bn_mul_recursive(&(r[n2]), &(a[n]), &(b[n]), n, dna, dnb, p);
  273|  20.3k|    }
  274|       |
  275|       |    /*-
  276|       |     * t[32] holds (a[0]-a[1])*(b[1]-b[0]), c1 is the sign
  277|       |     * r[10] holds (a[0]*b[0])
  278|       |     * r[32] holds (b[1]*b[1])
  279|       |     */
  280|       |
  281|   128k|    c1 = (int)(bn_add_words(t, r, &(r[n2]), n2));
  282|       |
  283|   128k|    if (neg) {                  /* if t[32] is negative */
  ------------------
  |  Branch (283:9): [True: 65.7k, False: 62.5k]
  ------------------
  284|  65.7k|        c1 -= (int)(bn_sub_words(&(t[n2]), t, &(t[n2]), n2));
  285|  65.7k|    } else {
  286|       |        /* Might have a carry */
  287|  62.5k|        c1 += (int)(bn_add_words(&(t[n2]), &(t[n2]), t, n2));
  288|  62.5k|    }
  289|       |
  290|       |    /*-
  291|       |     * t[32] holds (a[0]-a[1])*(b[1]-b[0])+(a[0]*b[0])+(a[1]*b[1])
  292|       |     * r[10] holds (a[0]*b[0])
  293|       |     * r[32] holds (b[1]*b[1])
  294|       |     * c1 holds the carry bits
  295|       |     */
  296|   128k|    c1 += (int)(bn_add_words(&(r[n]), &(r[n]), &(t[n2]), n2));
  297|   128k|    if (c1) {
  ------------------
  |  Branch (297:9): [True: 43.9k, False: 84.4k]
  ------------------
  298|  43.9k|        p = &(r[n + n2]);
  299|  43.9k|        lo = *p;
  300|  43.9k|        ln = (lo + c1) & BN_MASK2;
  ------------------
  |  |   94|  43.9k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  301|  43.9k|        *p = ln;
  302|       |
  303|       |        /*
  304|       |         * The overflow will stop before we over write words we should not
  305|       |         * overwrite
  306|       |         */
  307|  43.9k|        if (ln < (BN_ULONG)c1) {
  ------------------
  |  Branch (307:13): [True: 884, False: 43.0k]
  ------------------
  308|  2.31k|            do {
  309|  2.31k|                p++;
  310|  2.31k|                lo = *p;
  311|  2.31k|                ln = (lo + 1) & BN_MASK2;
  ------------------
  |  |   94|  2.31k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  312|  2.31k|                *p = ln;
  313|  2.31k|            } while (ln == 0);
  ------------------
  |  Branch (313:22): [True: 1.42k, False: 884]
  ------------------
  314|    884|        }
  315|  43.9k|    }
  316|   128k|}
bn_mul_part_recursive:
  324|  33.6k|{
  325|  33.6k|    int i, j, n2 = n * 2;
  326|  33.6k|    int c1, c2, neg;
  327|  33.6k|    BN_ULONG ln, lo, *p;
  ------------------
  |  |   37|  33.6k|#  define BN_ULONG        unsigned long
  ------------------
  328|       |
  329|  33.6k|    if (n < 8) {
  ------------------
  |  Branch (329:9): [True: 0, False: 33.6k]
  ------------------
  330|      0|        bn_mul_normal(r, a, n + tna, b, n + tnb);
  331|      0|        return;
  332|      0|    }
  333|       |
  334|       |    /* r=(a[0]-a[1])*(b[1]-b[0]) */
  335|  33.6k|    c1 = bn_cmp_part_words(a, &(a[n]), tna, n - tna);
  336|  33.6k|    c2 = bn_cmp_part_words(&(b[n]), b, tnb, tnb - n);
  337|  33.6k|    neg = 0;
  338|  33.6k|    switch (c1 * 3 + c2) {
  ------------------
  |  Branch (338:13): [True: 0, False: 33.6k]
  ------------------
  339|  4.28k|    case -4:
  ------------------
  |  Branch (339:5): [True: 4.28k, False: 29.4k]
  ------------------
  340|  4.28k|        bn_sub_part_words(t, &(a[n]), a, tna, tna - n); /* - */
  341|  4.28k|        bn_sub_part_words(&(t[n]), b, &(b[n]), tnb, n - tnb); /* - */
  342|  4.28k|        break;
  343|    227|    case -3:
  ------------------
  |  Branch (343:5): [True: 227, False: 33.4k]
  ------------------
  344|  1.60k|    case -2:
  ------------------
  |  Branch (344:5): [True: 1.37k, False: 32.3k]
  ------------------
  345|  1.60k|        bn_sub_part_words(t, &(a[n]), a, tna, tna - n); /* - */
  346|  1.60k|        bn_sub_part_words(&(t[n]), &(b[n]), b, tnb, tnb - n); /* + */
  347|  1.60k|        neg = 1;
  348|  1.60k|        break;
  349|    464|    case -1:
  ------------------
  |  Branch (349:5): [True: 464, False: 33.2k]
  ------------------
  350|    669|    case 0:
  ------------------
  |  Branch (350:5): [True: 205, False: 33.4k]
  ------------------
  351|    920|    case 1:
  ------------------
  |  Branch (351:5): [True: 251, False: 33.4k]
  ------------------
  352|  26.3k|    case 2:
  ------------------
  |  Branch (352:5): [True: 25.3k, False: 8.29k]
  ------------------
  353|  26.3k|        bn_sub_part_words(t, a, &(a[n]), tna, n - tna); /* + */
  354|  26.3k|        bn_sub_part_words(&(t[n]), b, &(b[n]), tnb, n - tnb); /* - */
  355|  26.3k|        neg = 1;
  356|  26.3k|        break;
  357|    554|    case 3:
  ------------------
  |  Branch (357:5): [True: 554, False: 33.1k]
  ------------------
  358|  1.49k|    case 4:
  ------------------
  |  Branch (358:5): [True: 941, False: 32.7k]
  ------------------
  359|  1.49k|        bn_sub_part_words(t, a, &(a[n]), tna, n - tna);
  360|  1.49k|        bn_sub_part_words(&(t[n]), &(b[n]), b, tnb, tnb - n);
  361|  1.49k|        break;
  362|  33.6k|    }
  363|       |    /*
  364|       |     * The zero case isn't yet implemented here. The speedup would probably
  365|       |     * be negligible.
  366|       |     */
  367|       |# if 0
  368|       |    if (n == 4) {
  369|       |        bn_mul_comba4(&(t[n2]), t, &(t[n]));
  370|       |        bn_mul_comba4(r, a, b);
  371|       |        bn_mul_normal(&(r[n2]), &(a[n]), tn, &(b[n]), tn);
  372|       |        memset(&r[n2 + tn * 2], 0, sizeof(*r) * (n2 - tn * 2));
  373|       |    } else
  374|       |# endif
  375|  33.6k|    if (n == 8) {
  ------------------
  |  Branch (375:9): [True: 4.40k, False: 29.2k]
  ------------------
  376|  4.40k|        bn_mul_comba8(&(t[n2]), t, &(t[n]));
  377|  4.40k|        bn_mul_comba8(r, a, b);
  378|  4.40k|        bn_mul_normal(&(r[n2]), &(a[n]), tna, &(b[n]), tnb);
  379|  4.40k|        memset(&r[n2 + tna + tnb], 0, sizeof(*r) * (n2 - tna - tnb));
  380|  29.2k|    } else {
  381|  29.2k|        p = &(t[n2 * 2]);
  382|  29.2k|        bn_mul_recursive(&(t[n2]), t, &(t[n]), n, 0, 0, p);
  383|  29.2k|        bn_mul_recursive(r, a, b, n, 0, 0, p);
  384|  29.2k|        i = n / 2;
  385|       |        /*
  386|       |         * If there is only a bottom half to the number, just do it
  387|       |         */
  388|  29.2k|        if (tna > tnb)
  ------------------
  |  Branch (388:13): [True: 1.47k, False: 27.8k]
  ------------------
  389|  1.47k|            j = tna - i;
  390|  27.8k|        else
  391|  27.8k|            j = tnb - i;
  392|  29.2k|        if (j == 0) {
  ------------------
  |  Branch (392:13): [True: 1.23k, False: 28.0k]
  ------------------
  393|  1.23k|            bn_mul_recursive(&(r[n2]), &(a[n]), &(b[n]),
  394|  1.23k|                             i, tna - i, tnb - i, p);
  395|  1.23k|            memset(&r[n2 + i * 2], 0, sizeof(*r) * (n2 - i * 2));
  396|  28.0k|        } else if (j > 0) {     /* eg, n == 16, i == 8 and tn == 11 */
  ------------------
  |  Branch (396:20): [True: 4.67k, False: 23.3k]
  ------------------
  397|  4.67k|            bn_mul_part_recursive(&(r[n2]), &(a[n]), &(b[n]),
  398|  4.67k|                                  i, tna - i, tnb - i, p);
  399|  4.67k|            memset(&(r[n2 + tna + tnb]), 0,
  400|  4.67k|                   sizeof(BN_ULONG) * (n2 - tna - tnb));
  401|  23.3k|        } else {                /* (j < 0) eg, n == 16, i == 8 and tn == 5 */
  402|       |
  403|  23.3k|            memset(&r[n2], 0, sizeof(*r) * n2);
  404|  23.3k|            if (tna < BN_MUL_RECURSIVE_SIZE_NORMAL
  ------------------
  |  |  365|  46.7k|# define BN_MUL_RECURSIVE_SIZE_NORMAL            (16)/* 32 less than */
  ------------------
  |  Branch (404:17): [True: 23.3k, False: 0]
  ------------------
  405|  23.3k|                && tnb < BN_MUL_RECURSIVE_SIZE_NORMAL) {
  ------------------
  |  |  365|  23.3k|# define BN_MUL_RECURSIVE_SIZE_NORMAL            (16)/* 32 less than */
  ------------------
  |  Branch (405:20): [True: 23.3k, False: 0]
  ------------------
  406|  23.3k|                bn_mul_normal(&(r[n2]), &(a[n]), tna, &(b[n]), tnb);
  407|  23.3k|            } else {
  408|      0|                for (;;) {
  409|      0|                    i /= 2;
  410|       |                    /*
  411|       |                     * these simplified conditions work exclusively because
  412|       |                     * difference between tna and tnb is 1 or 0
  413|       |                     */
  414|      0|                    if (i < tna || i < tnb) {
  ------------------
  |  Branch (414:25): [True: 0, False: 0]
  |  Branch (414:36): [True: 0, False: 0]
  ------------------
  415|      0|                        bn_mul_part_recursive(&(r[n2]),
  416|      0|                                              &(a[n]), &(b[n]),
  417|      0|                                              i, tna - i, tnb - i, p);
  418|      0|                        break;
  419|      0|                    } else if (i == tna || i == tnb) {
  ------------------
  |  Branch (419:32): [True: 0, False: 0]
  |  Branch (419:44): [True: 0, False: 0]
  ------------------
  420|      0|                        bn_mul_recursive(&(r[n2]),
  421|      0|                                         &(a[n]), &(b[n]),
  422|      0|                                         i, tna - i, tnb - i, p);
  423|      0|                        break;
  424|      0|                    }
  425|      0|                }
  426|      0|            }
  427|  23.3k|        }
  428|  29.2k|    }
  429|       |
  430|       |    /*-
  431|       |     * t[32] holds (a[0]-a[1])*(b[1]-b[0]), c1 is the sign
  432|       |     * r[10] holds (a[0]*b[0])
  433|       |     * r[32] holds (b[1]*b[1])
  434|       |     */
  435|       |
  436|  33.6k|    c1 = (int)(bn_add_words(t, r, &(r[n2]), n2));
  437|       |
  438|  33.6k|    if (neg) {                  /* if t[32] is negative */
  ------------------
  |  Branch (438:9): [True: 27.9k, False: 5.77k]
  ------------------
  439|  27.9k|        c1 -= (int)(bn_sub_words(&(t[n2]), t, &(t[n2]), n2));
  440|  27.9k|    } else {
  441|       |        /* Might have a carry */
  442|  5.77k|        c1 += (int)(bn_add_words(&(t[n2]), &(t[n2]), t, n2));
  443|  5.77k|    }
  444|       |
  445|       |    /*-
  446|       |     * t[32] holds (a[0]-a[1])*(b[1]-b[0])+(a[0]*b[0])+(a[1]*b[1])
  447|       |     * r[10] holds (a[0]*b[0])
  448|       |     * r[32] holds (b[1]*b[1])
  449|       |     * c1 holds the carry bits
  450|       |     */
  451|  33.6k|    c1 += (int)(bn_add_words(&(r[n]), &(r[n]), &(t[n2]), n2));
  452|  33.6k|    if (c1) {
  ------------------
  |  Branch (452:9): [True: 1.12k, False: 32.5k]
  ------------------
  453|  1.12k|        p = &(r[n + n2]);
  454|  1.12k|        lo = *p;
  455|  1.12k|        ln = (lo + c1) & BN_MASK2;
  ------------------
  |  |   94|  1.12k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  456|  1.12k|        *p = ln;
  457|       |
  458|       |        /*
  459|       |         * The overflow will stop before we over write words we should not
  460|       |         * overwrite
  461|       |         */
  462|  1.12k|        if (ln < (BN_ULONG)c1) {
  ------------------
  |  Branch (462:13): [True: 366, False: 759]
  ------------------
  463|    763|            do {
  464|    763|                p++;
  465|    763|                lo = *p;
  466|    763|                ln = (lo + 1) & BN_MASK2;
  ------------------
  |  |   94|    763|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  467|    763|                *p = ln;
  468|    763|            } while (ln == 0);
  ------------------
  |  Branch (468:22): [True: 397, False: 366]
  ------------------
  469|    366|        }
  470|  1.12k|    }
  471|  33.6k|}
BN_mul:
  498|   142k|{
  499|   142k|    int ret = bn_mul_fixed_top(r, a, b, ctx);
  500|       |
  501|   142k|    bn_correct_top(r);
  502|   142k|    bn_check_top(r);
  503|       |
  504|   142k|    return ret;
  505|   142k|}
bn_mul_fixed_top:
  508|   152k|{
  509|   152k|    int ret = 0;
  510|   152k|    int top, al, bl;
  511|   152k|    BIGNUM *rr;
  512|   152k|#if defined(BN_MUL_COMBA) || defined(BN_RECURSION)
  513|   152k|    int i;
  514|   152k|#endif
  515|   152k|#ifdef BN_RECURSION
  516|   152k|    BIGNUM *t = NULL;
  517|   152k|    int j = 0, k;
  518|   152k|#endif
  519|       |
  520|   152k|    bn_check_top(a);
  521|   152k|    bn_check_top(b);
  522|   152k|    bn_check_top(r);
  523|       |
  524|   152k|    al = a->top;
  525|   152k|    bl = b->top;
  526|       |
  527|   152k|    if ((al == 0) || (bl == 0)) {
  ------------------
  |  Branch (527:9): [True: 3.76k, False: 148k]
  |  Branch (527:22): [True: 1.20k, False: 147k]
  ------------------
  528|  4.97k|        BN_zero(r);
  ------------------
  |  |  202|  4.97k|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  529|  4.97k|        return 1;
  530|  4.97k|    }
  531|   147k|    top = al + bl;
  532|       |
  533|   147k|    BN_CTX_start(ctx);
  534|   147k|    if ((r == a) || (r == b)) {
  ------------------
  |  Branch (534:9): [True: 0, False: 147k]
  |  Branch (534:21): [True: 0, False: 147k]
  ------------------
  535|      0|        if ((rr = BN_CTX_get(ctx)) == NULL)
  ------------------
  |  Branch (535:13): [True: 0, False: 0]
  ------------------
  536|      0|            goto err;
  537|      0|    } else
  538|   147k|        rr = r;
  539|       |
  540|   147k|#if defined(BN_MUL_COMBA) || defined(BN_RECURSION)
  541|   147k|    i = al - bl;
  542|   147k|#endif
  543|   147k|#ifdef BN_MUL_COMBA
  544|   147k|    if (i == 0) {
  ------------------
  |  Branch (544:9): [True: 107k, False: 39.6k]
  ------------------
  545|       |# if 0
  546|       |        if (al == 4) {
  547|       |            if (bn_wexpand(rr, 8) == NULL)
  548|       |                goto err;
  549|       |            rr->top = 8;
  550|       |            bn_mul_comba4(rr->d, a->d, b->d);
  551|       |            goto end;
  552|       |        }
  553|       |# endif
  554|   107k|        if (al == 8) {
  ------------------
  |  Branch (554:13): [True: 455, False: 107k]
  ------------------
  555|    455|            if (bn_wexpand(rr, 16) == NULL)
  ------------------
  |  Branch (555:17): [True: 0, False: 455]
  ------------------
  556|      0|                goto err;
  557|    455|            rr->top = 16;
  558|    455|            bn_mul_comba8(rr->d, a->d, b->d);
  559|    455|            goto end;
  560|    455|        }
  561|   107k|    }
  562|   146k|#endif                          /* BN_MUL_COMBA */
  563|   146k|#ifdef BN_RECURSION
  564|   146k|    if ((al >= BN_MULL_SIZE_NORMAL) && (bl >= BN_MULL_SIZE_NORMAL)) {
  ------------------
  |  |  364|   146k|# define BN_MULL_SIZE_NORMAL                     (16)/* 32 */
  ------------------
                  if ((al >= BN_MULL_SIZE_NORMAL) && (bl >= BN_MULL_SIZE_NORMAL)) {
  ------------------
  |  |  364|  48.6k|# define BN_MULL_SIZE_NORMAL                     (16)/* 32 */
  ------------------
  |  Branch (564:9): [True: 48.6k, False: 98.0k]
  |  Branch (564:40): [True: 42.5k, False: 6.07k]
  ------------------
  565|  42.5k|        if (i >= -1 && i <= 1) {
  ------------------
  |  Branch (565:13): [True: 41.5k, False: 1.00k]
  |  Branch (565:24): [True: 40.9k, False: 586]
  ------------------
  566|       |            /*
  567|       |             * Find out the power of two lower or equal to the longest of the
  568|       |             * two numbers
  569|       |             */
  570|  40.9k|            if (i >= 0) {
  ------------------
  |  Branch (570:17): [True: 35.4k, False: 5.56k]
  ------------------
  571|  35.4k|                j = BN_num_bits_word((BN_ULONG)al);
  572|  35.4k|            }
  573|  40.9k|            if (i == -1) {
  ------------------
  |  Branch (573:17): [True: 5.56k, False: 35.4k]
  ------------------
  574|  5.56k|                j = BN_num_bits_word((BN_ULONG)bl);
  575|  5.56k|            }
  576|  40.9k|            j = 1 << (j - 1);
  577|  40.9k|            assert(j <= al || j <= bl);
  578|  40.9k|            k = j + j;
  579|  40.9k|            t = BN_CTX_get(ctx);
  580|  40.9k|            if (t == NULL)
  ------------------
  |  Branch (580:17): [True: 0, False: 40.9k]
  ------------------
  581|      0|                goto err;
  582|  40.9k|            if (al > j || bl > j) {
  ------------------
  |  Branch (582:17): [True: 26.4k, False: 14.5k]
  |  Branch (582:27): [True: 2.52k, False: 11.9k]
  ------------------
  583|  29.0k|                if (bn_wexpand(t, k * 4) == NULL)
  ------------------
  |  Branch (583:21): [True: 0, False: 29.0k]
  ------------------
  584|      0|                    goto err;
  585|  29.0k|                if (bn_wexpand(rr, k * 4) == NULL)
  ------------------
  |  Branch (585:21): [True: 0, False: 29.0k]
  ------------------
  586|      0|                    goto err;
  587|  29.0k|                bn_mul_part_recursive(rr->d, a->d, b->d,
  588|  29.0k|                                      j, al - j, bl - j, t->d);
  589|  29.0k|            } else {            /* al <= j || bl <= j */
  590|       |
  591|  11.9k|                if (bn_wexpand(t, k * 2) == NULL)
  ------------------
  |  Branch (591:21): [True: 0, False: 11.9k]
  ------------------
  592|      0|                    goto err;
  593|  11.9k|                if (bn_wexpand(rr, k * 2) == NULL)
  ------------------
  |  Branch (593:21): [True: 0, False: 11.9k]
  ------------------
  594|      0|                    goto err;
  595|  11.9k|                bn_mul_recursive(rr->d, a->d, b->d, j, al - j, bl - j, t->d);
  596|  11.9k|            }
  597|  40.9k|            rr->top = top;
  598|  40.9k|            goto end;
  599|  40.9k|        }
  600|  42.5k|    }
  601|   105k|#endif                          /* BN_RECURSION */
  602|   105k|    if (bn_wexpand(rr, top) == NULL)
  ------------------
  |  Branch (602:9): [True: 0, False: 105k]
  ------------------
  603|      0|        goto err;
  604|   105k|    rr->top = top;
  605|   105k|    bn_mul_normal(rr->d, a->d, al, b->d, bl);
  606|       |
  607|   105k|#if defined(BN_MUL_COMBA) || defined(BN_RECURSION)
  608|   147k| end:
  609|   147k|#endif
  610|   147k|    rr->neg = a->neg ^ b->neg;
  611|   147k|    rr->flags |= BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|   147k|#  define BN_FLG_FIXED_TOP 0
  ------------------
  612|   147k|    if (r != rr && BN_copy(r, rr) == NULL)
  ------------------
  |  Branch (612:9): [True: 0, False: 147k]
  |  Branch (612:20): [True: 0, False: 0]
  ------------------
  613|      0|        goto err;
  614|       |
  615|   147k|    ret = 1;
  616|   147k| err:
  617|   147k|    bn_check_top(r);
  618|   147k|    BN_CTX_end(ctx);
  619|   147k|    return ret;
  620|   147k|}
bn_mul_normal:
  623|   135k|{
  624|   135k|    BN_ULONG *rr;
  ------------------
  |  |   37|   135k|#  define BN_ULONG        unsigned long
  ------------------
  625|       |
  626|   135k|    if (na < nb) {
  ------------------
  |  Branch (626:9): [True: 27.1k, False: 108k]
  ------------------
  627|  27.1k|        int itmp;
  628|  27.1k|        BN_ULONG *ltmp;
  ------------------
  |  |   37|  27.1k|#  define BN_ULONG        unsigned long
  ------------------
  629|       |
  630|  27.1k|        itmp = na;
  631|  27.1k|        na = nb;
  632|  27.1k|        nb = itmp;
  633|  27.1k|        ltmp = a;
  634|  27.1k|        a = b;
  635|  27.1k|        b = ltmp;
  636|       |
  637|  27.1k|    }
  638|   135k|    rr = &(r[na]);
  639|   135k|    if (nb <= 0) {
  ------------------
  |  Branch (639:9): [True: 3.51k, False: 131k]
  ------------------
  640|  3.51k|        (void)bn_mul_words(r, a, na, 0);
  641|  3.51k|        return;
  642|  3.51k|    } else
  643|   131k|        rr[0] = bn_mul_words(r, a, na, b[0]);
  644|       |
  645|   178k|    for (;;) {
  646|   178k|        if (--nb <= 0)
  ------------------
  |  Branch (646:13): [True: 93.3k, False: 84.7k]
  ------------------
  647|  93.3k|            return;
  648|  84.7k|        rr[1] = bn_mul_add_words(&(r[1]), a, na, b[1]);
  649|  84.7k|        if (--nb <= 0)
  ------------------
  |  Branch (649:13): [True: 11.5k, False: 73.1k]
  ------------------
  650|  11.5k|            return;
  651|  73.1k|        rr[2] = bn_mul_add_words(&(r[2]), a, na, b[2]);
  652|  73.1k|        if (--nb <= 0)
  ------------------
  |  Branch (652:13): [True: 19.3k, False: 53.8k]
  ------------------
  653|  19.3k|            return;
  654|  53.8k|        rr[3] = bn_mul_add_words(&(r[3]), a, na, b[3]);
  655|  53.8k|        if (--nb <= 0)
  ------------------
  |  Branch (655:13): [True: 7.76k, False: 46.0k]
  ------------------
  656|  7.76k|            return;
  657|  46.0k|        rr[4] = bn_mul_add_words(&(r[4]), a, na, b[4]);
  658|  46.0k|        rr += 4;
  659|  46.0k|        r += 4;
  660|  46.0k|        b += 4;
  661|  46.0k|    }
  662|   131k|}

BN_RECP_CTX_init:
   14|  1.51k|{
   15|  1.51k|    memset(recp, 0, sizeof(*recp));
   16|  1.51k|    bn_init(&(recp->N));
   17|  1.51k|    bn_init(&(recp->Nr));
   18|  1.51k|}
BN_RECP_CTX_free:
   34|  1.51k|{
   35|  1.51k|    if (recp == NULL)
  ------------------
  |  Branch (35:9): [True: 0, False: 1.51k]
  ------------------
   36|      0|        return;
   37|  1.51k|    BN_free(&recp->N);
   38|  1.51k|    BN_free(&recp->Nr);
   39|  1.51k|    if (recp->flags & BN_FLG_MALLOCED)
  ------------------
  |  |   58|  1.51k|# define BN_FLG_MALLOCED         0x01
  ------------------
  |  Branch (39:9): [True: 0, False: 1.51k]
  ------------------
   40|      0|        OPENSSL_free(recp);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   41|  1.51k|}
BN_RECP_CTX_set:
   44|  1.51k|{
   45|  1.51k|    if (BN_is_zero(d) || !BN_copy(&(recp->N), d))
  ------------------
  |  Branch (45:9): [True: 0, False: 1.51k]
  |  Branch (45:26): [True: 0, False: 1.51k]
  ------------------
   46|      0|        return 0;
   47|  1.51k|    BN_zero(&(recp->Nr));
  ------------------
  |  |  202|  1.51k|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
   48|  1.51k|    recp->num_bits = BN_num_bits(d);
   49|  1.51k|    recp->shift = 0;
   50|  1.51k|    return 1;
   51|  1.51k|}
BN_mod_mul_reciprocal:
   55|  71.0k|{
   56|  71.0k|    int ret = 0;
   57|  71.0k|    BIGNUM *a;
   58|  71.0k|    const BIGNUM *ca;
   59|       |
   60|  71.0k|    BN_CTX_start(ctx);
   61|  71.0k|    if ((a = BN_CTX_get(ctx)) == NULL)
  ------------------
  |  Branch (61:9): [True: 0, False: 71.0k]
  ------------------
   62|      0|        goto err;
   63|  71.0k|    if (y != NULL) {
  ------------------
  |  Branch (63:9): [True: 71.0k, False: 0]
  ------------------
   64|  71.0k|        if (x == y) {
  ------------------
  |  Branch (64:13): [True: 54.3k, False: 16.6k]
  ------------------
   65|  54.3k|            if (!BN_sqr(a, x, ctx))
  ------------------
  |  Branch (65:17): [True: 0, False: 54.3k]
  ------------------
   66|      0|                goto err;
   67|  54.3k|        } else {
   68|  16.6k|            if (!BN_mul(a, x, y, ctx))
  ------------------
  |  Branch (68:17): [True: 0, False: 16.6k]
  ------------------
   69|      0|                goto err;
   70|  16.6k|        }
   71|  71.0k|        ca = a;
   72|  71.0k|    } else
   73|      0|        ca = x;                 /* Just do the mod */
   74|       |
   75|  71.0k|    ret = BN_div_recp(NULL, r, ca, recp, ctx);
   76|  71.0k| err:
   77|  71.0k|    BN_CTX_end(ctx);
   78|  71.0k|    bn_check_top(r);
   79|  71.0k|    return ret;
   80|  71.0k|}
BN_div_recp:
   84|  71.0k|{
   85|  71.0k|    int i, j, ret = 0;
   86|  71.0k|    BIGNUM *a, *b, *d, *r;
   87|       |
   88|  71.0k|    BN_CTX_start(ctx);
   89|  71.0k|    d = (dv != NULL) ? dv : BN_CTX_get(ctx);
  ------------------
  |  Branch (89:9): [True: 0, False: 71.0k]
  ------------------
   90|  71.0k|    r = (rem != NULL) ? rem : BN_CTX_get(ctx);
  ------------------
  |  Branch (90:9): [True: 71.0k, False: 0]
  ------------------
   91|  71.0k|    a = BN_CTX_get(ctx);
   92|  71.0k|    b = BN_CTX_get(ctx);
   93|  71.0k|    if (b == NULL)
  ------------------
  |  Branch (93:9): [True: 0, False: 71.0k]
  ------------------
   94|      0|        goto err;
   95|       |
   96|  71.0k|    if (BN_ucmp(m, &(recp->N)) < 0) {
  ------------------
  |  Branch (96:9): [True: 19.4k, False: 51.6k]
  ------------------
   97|  19.4k|        BN_zero(d);
  ------------------
  |  |  202|  19.4k|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
   98|  19.4k|        if (!BN_copy(r, m)) {
  ------------------
  |  Branch (98:13): [True: 0, False: 19.4k]
  ------------------
   99|      0|            BN_CTX_end(ctx);
  100|      0|            return 0;
  101|      0|        }
  102|  19.4k|        BN_CTX_end(ctx);
  103|  19.4k|        return 1;
  104|  19.4k|    }
  105|       |
  106|       |    /*
  107|       |     * We want the remainder Given input of ABCDEF / ab we need multiply
  108|       |     * ABCDEF by 3 digests of the reciprocal of ab
  109|       |     */
  110|       |
  111|       |    /* i := max(BN_num_bits(m), 2*BN_num_bits(N)) */
  112|  51.6k|    i = BN_num_bits(m);
  113|  51.6k|    j = recp->num_bits << 1;
  114|  51.6k|    if (j > i)
  ------------------
  |  Branch (114:9): [True: 37.9k, False: 13.6k]
  ------------------
  115|  37.9k|        i = j;
  116|       |
  117|       |    /* Nr := round(2^i / N) */
  118|  51.6k|    if (i != recp->shift)
  ------------------
  |  Branch (118:9): [True: 1.46k, False: 50.1k]
  ------------------
  119|  1.46k|        recp->shift = BN_reciprocal(&(recp->Nr), &(recp->N), i, ctx);
  120|       |    /* BN_reciprocal could have returned -1 for an error */
  121|  51.6k|    if (recp->shift == -1)
  ------------------
  |  Branch (121:9): [True: 0, False: 51.6k]
  ------------------
  122|      0|        goto err;
  123|       |
  124|       |    /*-
  125|       |     * d := |round(round(m / 2^BN_num_bits(N)) * recp->Nr / 2^(i - BN_num_bits(N)))|
  126|       |     *    = |round(round(m / 2^BN_num_bits(N)) * round(2^i / N) / 2^(i - BN_num_bits(N)))|
  127|       |     *   <= |(m / 2^BN_num_bits(N)) * (2^i / N) * (2^BN_num_bits(N) / 2^i)|
  128|       |     *    = |m/N|
  129|       |     */
  130|  51.6k|    if (!BN_rshift(a, m, recp->num_bits))
  ------------------
  |  Branch (130:9): [True: 0, False: 51.6k]
  ------------------
  131|      0|        goto err;
  132|  51.6k|    if (!BN_mul(b, a, &(recp->Nr), ctx))
  ------------------
  |  Branch (132:9): [True: 0, False: 51.6k]
  ------------------
  133|      0|        goto err;
  134|  51.6k|    if (!BN_rshift(d, b, i - recp->num_bits))
  ------------------
  |  Branch (134:9): [True: 0, False: 51.6k]
  ------------------
  135|      0|        goto err;
  136|  51.6k|    d->neg = 0;
  137|       |
  138|  51.6k|    if (!BN_mul(b, &(recp->N), d, ctx))
  ------------------
  |  Branch (138:9): [True: 0, False: 51.6k]
  ------------------
  139|      0|        goto err;
  140|  51.6k|    if (!BN_usub(r, m, b))
  ------------------
  |  Branch (140:9): [True: 0, False: 51.6k]
  ------------------
  141|      0|        goto err;
  142|  51.6k|    r->neg = 0;
  143|       |
  144|  51.6k|    j = 0;
  145|  83.4k|    while (BN_ucmp(r, &(recp->N)) >= 0) {
  ------------------
  |  Branch (145:12): [True: 31.8k, False: 51.6k]
  ------------------
  146|  31.8k|        if (j++ > 2) {
  ------------------
  |  Branch (146:13): [True: 0, False: 31.8k]
  ------------------
  147|      0|            ERR_raise(ERR_LIB_BN, BN_R_BAD_RECIPROCAL);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  148|      0|            goto err;
  149|      0|        }
  150|  31.8k|        if (!BN_usub(r, r, &(recp->N)))
  ------------------
  |  Branch (150:13): [True: 0, False: 31.8k]
  ------------------
  151|      0|            goto err;
  152|  31.8k|        if (!BN_add_word(d, 1))
  ------------------
  |  Branch (152:13): [True: 0, False: 31.8k]
  ------------------
  153|      0|            goto err;
  154|  31.8k|    }
  155|       |
  156|  51.6k|    r->neg = BN_is_zero(r) ? 0 : m->neg;
  ------------------
  |  Branch (156:14): [True: 67, False: 51.5k]
  ------------------
  157|  51.6k|    d->neg = m->neg ^ recp->N.neg;
  158|  51.6k|    ret = 1;
  159|  51.6k| err:
  160|  51.6k|    BN_CTX_end(ctx);
  161|  51.6k|    bn_check_top(dv);
  162|  51.6k|    bn_check_top(rem);
  163|  51.6k|    return ret;
  164|  51.6k|}
BN_reciprocal:
  173|  1.46k|{
  174|  1.46k|    int ret = -1;
  175|  1.46k|    BIGNUM *t;
  176|       |
  177|  1.46k|    BN_CTX_start(ctx);
  178|  1.46k|    if ((t = BN_CTX_get(ctx)) == NULL)
  ------------------
  |  Branch (178:9): [True: 0, False: 1.46k]
  ------------------
  179|      0|        goto err;
  180|       |
  181|  1.46k|    if (!BN_set_bit(t, len))
  ------------------
  |  Branch (181:9): [True: 0, False: 1.46k]
  ------------------
  182|      0|        goto err;
  183|       |
  184|  1.46k|    if (!BN_div(r, NULL, t, m, ctx))
  ------------------
  |  Branch (184:9): [True: 0, False: 1.46k]
  ------------------
  185|      0|        goto err;
  186|       |
  187|  1.46k|    ret = len;
  188|  1.46k| err:
  189|  1.46k|    bn_check_top(r);
  190|  1.46k|    BN_CTX_end(ctx);
  191|  1.46k|    return ret;
  192|  1.46k|}

BN_rshift1:
   46|  54.8k|{
   47|  54.8k|    BN_ULONG *ap, *rp, t, c;
  ------------------
  |  |   37|  54.8k|#  define BN_ULONG        unsigned long
  ------------------
   48|  54.8k|    int i;
   49|       |
   50|  54.8k|    bn_check_top(r);
   51|  54.8k|    bn_check_top(a);
   52|       |
   53|  54.8k|    if (BN_is_zero(a)) {
  ------------------
  |  Branch (53:9): [True: 0, False: 54.8k]
  ------------------
   54|      0|        BN_zero(r);
  ------------------
  |  |  202|      0|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
   55|      0|        return 1;
   56|      0|    }
   57|  54.8k|    i = a->top;
   58|  54.8k|    ap = a->d;
   59|  54.8k|    if (a != r) {
  ------------------
  |  Branch (59:9): [True: 0, False: 54.8k]
  ------------------
   60|      0|        if (bn_wexpand(r, i) == NULL)
  ------------------
  |  Branch (60:13): [True: 0, False: 0]
  ------------------
   61|      0|            return 0;
   62|      0|        r->neg = a->neg;
   63|      0|    }
   64|  54.8k|    rp = r->d;
   65|  54.8k|    r->top = i;
   66|  54.8k|    t = ap[--i];
   67|  54.8k|    rp[i] = t >> 1;
   68|  54.8k|    c = t << (BN_BITS2 - 1);
  ------------------
  |  |   54|  54.8k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  54.8k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
   69|  54.8k|    r->top -= (t == 1);
   70|  76.9k|    while (i > 0) {
  ------------------
  |  Branch (70:12): [True: 22.1k, False: 54.8k]
  ------------------
   71|  22.1k|        t = ap[--i];
   72|  22.1k|        rp[i] = ((t >> 1) & BN_MASK2) | c;
  ------------------
  |  |   94|  22.1k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
   73|  22.1k|        c = t << (BN_BITS2 - 1);
  ------------------
  |  |   54|  22.1k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  22.1k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
   74|  22.1k|    }
   75|  54.8k|    if (!r->top)
  ------------------
  |  Branch (75:9): [True: 0, False: 54.8k]
  ------------------
   76|      0|        r->neg = 0; /* don't allow negative zero */
   77|  54.8k|    bn_check_top(r);
   78|  54.8k|    return 1;
   79|  54.8k|}
BN_lshift:
   82|  1.27k|{
   83|  1.27k|    int ret;
   84|       |
   85|  1.27k|    if (n < 0) {
  ------------------
  |  Branch (85:9): [True: 0, False: 1.27k]
  ------------------
   86|      0|        ERR_raise(ERR_LIB_BN, BN_R_INVALID_SHIFT);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   87|      0|        return 0;
   88|      0|    }
   89|       |
   90|  1.27k|    ret = bn_lshift_fixed_top(r, a, n);
   91|       |
   92|  1.27k|    bn_correct_top(r);
   93|  1.27k|    bn_check_top(r);
   94|       |
   95|  1.27k|    return ret;
   96|  1.27k|}
bn_lshift_fixed_top:
  105|   109k|{
  106|   109k|    int i, nw;
  107|   109k|    unsigned int lb, rb;
  108|   109k|    BN_ULONG *t, *f;
  ------------------
  |  |   37|   109k|#  define BN_ULONG        unsigned long
  ------------------
  109|   109k|    BN_ULONG l, m, rmask = 0;
  ------------------
  |  |   37|   109k|#  define BN_ULONG        unsigned long
  ------------------
  110|       |
  111|   109k|    assert(n >= 0);
  112|       |
  113|   109k|    bn_check_top(r);
  114|   109k|    bn_check_top(a);
  115|       |
  116|   109k|    nw = n / BN_BITS2;
  ------------------
  |  |   54|   109k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   109k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  117|   109k|    if (bn_wexpand(r, a->top + nw + 1) == NULL)
  ------------------
  |  Branch (117:9): [True: 0, False: 109k]
  ------------------
  118|      0|        return 0;
  119|       |
  120|   109k|    if (a->top != 0) {
  ------------------
  |  Branch (120:9): [True: 101k, False: 7.80k]
  ------------------
  121|   101k|        lb = (unsigned int)n % BN_BITS2;
  ------------------
  |  |   54|   101k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   101k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  122|   101k|        rb = BN_BITS2 - lb;
  ------------------
  |  |   54|   101k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   101k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  123|   101k|        rb %= BN_BITS2;            /* say no to undefined behaviour */
  ------------------
  |  |   54|   101k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   101k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  124|   101k|        rmask = (BN_ULONG)0 - rb;  /* rmask = 0 - (rb != 0) */
  125|   101k|        rmask |= rmask >> 8;
  126|   101k|        f = &(a->d[0]);
  127|   101k|        t = &(r->d[nw]);
  128|   101k|        l = f[a->top - 1];
  129|   101k|        t[a->top] = (l >> rb) & rmask;
  130|  1.40M|        for (i = a->top - 1; i > 0; i--) {
  ------------------
  |  Branch (130:30): [True: 1.30M, False: 101k]
  ------------------
  131|  1.30M|            m = l << lb;
  132|  1.30M|            l = f[i - 1];
  133|  1.30M|            t[i] = (m | ((l >> rb) & rmask)) & BN_MASK2;
  ------------------
  |  |   94|  1.30M|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  134|  1.30M|        }
  135|   101k|        t[0] = (l << lb) & BN_MASK2;
  ------------------
  |  |   94|   101k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  136|   101k|    } else {
  137|       |        /* shouldn't happen, but formally required */
  138|  7.80k|        r->d[nw] = 0;
  139|  7.80k|    }
  140|   109k|    if (nw != 0)
  ------------------
  |  Branch (140:9): [True: 1.27k, False: 108k]
  ------------------
  141|  1.27k|        memset(r->d, 0, sizeof(*t) * nw);
  142|       |
  143|   109k|    r->neg = a->neg;
  144|   109k|    r->top = a->top + nw + 1;
  145|   109k|    r->flags |= BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|   109k|#  define BN_FLG_FIXED_TOP 0
  ------------------
  146|       |
  147|   109k|    return 1;
  148|   109k|}
BN_rshift:
  151|   149k|{
  152|   149k|    int ret = 0;
  153|       |
  154|   149k|    if (n < 0) {
  ------------------
  |  Branch (154:9): [True: 0, False: 149k]
  ------------------
  155|      0|        ERR_raise(ERR_LIB_BN, BN_R_INVALID_SHIFT);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  156|      0|        return 0;
  157|      0|    }
  158|       |
  159|   149k|    bn_check_top(r);
  160|   149k|    bn_check_top(a);
  161|       |
  162|   149k|    ret = bn_rshift_fixed_top(r, a, n);
  163|       |
  164|   149k|    bn_correct_top(r);
  165|   149k|    bn_check_top(r);
  166|       |
  167|   149k|    return ret;
  168|   149k|}
bn_rshift_fixed_top:
  177|   255k|{
  178|   255k|    int i, top, nw;
  179|   255k|    unsigned int lb, rb;
  180|   255k|    BN_ULONG *t, *f;
  ------------------
  |  |   37|   255k|#  define BN_ULONG        unsigned long
  ------------------
  181|   255k|    BN_ULONG l, m, mask;
  ------------------
  |  |   37|   255k|#  define BN_ULONG        unsigned long
  ------------------
  182|       |
  183|   255k|    assert(n >= 0);
  184|       |
  185|   255k|    nw = n / BN_BITS2;
  ------------------
  |  |   54|   255k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   255k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  186|   255k|    if (nw >= a->top) {
  ------------------
  |  Branch (186:9): [True: 1.25k, False: 253k]
  ------------------
  187|       |        /* shouldn't happen, but formally required */
  188|  1.25k|        BN_zero(r);
  ------------------
  |  |  202|  1.25k|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  189|  1.25k|        return 1;
  190|  1.25k|    }
  191|       |
  192|   253k|    rb = (unsigned int)n % BN_BITS2;
  ------------------
  |  |   54|   253k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   253k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  193|   253k|    lb = BN_BITS2 - rb;
  ------------------
  |  |   54|   253k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   253k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  194|   253k|    lb %= BN_BITS2;            /* say no to undefined behaviour */
  ------------------
  |  |   54|   253k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   253k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  195|   253k|    mask = (BN_ULONG)0 - lb;   /* mask = 0 - (lb != 0) */
  196|   253k|    mask |= mask >> 8;
  197|   253k|    top = a->top - nw;
  198|   253k|    if (r != a && bn_wexpand(r, top) == NULL)
  ------------------
  |  Branch (198:9): [True: 207k, False: 46.0k]
  |  Branch (198:19): [True: 0, False: 207k]
  ------------------
  199|      0|        return 0;
  200|       |
  201|   253k|    t = &(r->d[0]);
  202|   253k|    f = &(a->d[nw]);
  203|   253k|    l = f[0];
  204|  2.06M|    for (i = 0; i < top - 1; i++) {
  ------------------
  |  Branch (204:17): [True: 1.81M, False: 253k]
  ------------------
  205|  1.81M|        m = f[i + 1];
  206|  1.81M|        t[i] = (l >> rb) | ((m << lb) & mask);
  207|  1.81M|        l = m;
  208|  1.81M|    }
  209|   253k|    t[i] = l >> rb;
  210|       |
  211|   253k|    r->neg = a->neg;
  212|   253k|    r->top = top;
  213|   253k|    r->flags |= BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|   253k|#  define BN_FLG_FIXED_TOP 0
  ------------------
  214|       |
  215|   253k|    return 1;
  216|   253k|}

BN_sqr:
   18|   125k|{
   19|   125k|    int ret = bn_sqr_fixed_top(r, a, ctx);
   20|       |
   21|   125k|    bn_correct_top(r);
   22|   125k|    bn_check_top(r);
   23|       |
   24|   125k|    return ret;
   25|   125k|}
bn_sqr_fixed_top:
   28|   172k|{
   29|   172k|    int max, al;
   30|   172k|    int ret = 0;
   31|   172k|    BIGNUM *tmp, *rr;
   32|       |
   33|   172k|    bn_check_top(a);
   34|       |
   35|   172k|    al = a->top;
   36|   172k|    if (al <= 0) {
  ------------------
  |  Branch (36:9): [True: 11.1k, False: 161k]
  ------------------
   37|  11.1k|        r->top = 0;
   38|  11.1k|        r->neg = 0;
   39|  11.1k|        return 1;
   40|  11.1k|    }
   41|       |
   42|   161k|    BN_CTX_start(ctx);
   43|   161k|    rr = (a != r) ? r : BN_CTX_get(ctx);
  ------------------
  |  Branch (43:10): [True: 161k, False: 0]
  ------------------
   44|   161k|    tmp = BN_CTX_get(ctx);
   45|   161k|    if (rr == NULL || tmp == NULL)
  ------------------
  |  Branch (45:9): [True: 0, False: 161k]
  |  Branch (45:23): [True: 0, False: 161k]
  ------------------
   46|      0|        goto err;
   47|       |
   48|   161k|    max = 2 * al;               /* Non-zero (from above) */
   49|   161k|    if (bn_wexpand(rr, max) == NULL)
  ------------------
  |  Branch (49:9): [True: 0, False: 161k]
  ------------------
   50|      0|        goto err;
   51|       |
   52|   161k|    if (al == 4) {
  ------------------
  |  Branch (52:9): [True: 2.33k, False: 159k]
  ------------------
   53|       |#ifndef BN_SQR_COMBA
   54|       |        BN_ULONG t[8];
   55|       |        bn_sqr_normal(rr->d, a->d, 4, t);
   56|       |#else
   57|  2.33k|        bn_sqr_comba4(rr->d, a->d);
   58|  2.33k|#endif
   59|   159k|    } else if (al == 8) {
  ------------------
  |  Branch (59:16): [True: 535, False: 158k]
  ------------------
   60|       |#ifndef BN_SQR_COMBA
   61|       |        BN_ULONG t[16];
   62|       |        bn_sqr_normal(rr->d, a->d, 8, t);
   63|       |#else
   64|    535|        bn_sqr_comba8(rr->d, a->d);
   65|    535|#endif
   66|   158k|    } else {
   67|   158k|#if defined(BN_RECURSION)
   68|   158k|        if (al < BN_SQR_RECURSIVE_SIZE_NORMAL) {
  ------------------
  |  |  366|   158k|# define BN_SQR_RECURSIVE_SIZE_NORMAL            (16)/* 32 */
  ------------------
  |  Branch (68:13): [True: 123k, False: 35.1k]
  ------------------
   69|   123k|            BN_ULONG t[BN_SQR_RECURSIVE_SIZE_NORMAL * 2];
  ------------------
  |  |   37|   123k|#  define BN_ULONG        unsigned long
  ------------------
   70|   123k|            bn_sqr_normal(rr->d, a->d, al, t);
   71|   123k|        } else {
   72|  35.1k|            int j, k;
   73|       |
   74|  35.1k|            j = BN_num_bits_word((BN_ULONG)al);
   75|  35.1k|            j = 1 << (j - 1);
   76|  35.1k|            k = j + j;
   77|  35.1k|            if (al == j) {
  ------------------
  |  Branch (77:17): [True: 11.3k, False: 23.8k]
  ------------------
   78|  11.3k|                if (bn_wexpand(tmp, k * 2) == NULL)
  ------------------
  |  Branch (78:21): [True: 0, False: 11.3k]
  ------------------
   79|      0|                    goto err;
   80|  11.3k|                bn_sqr_recursive(rr->d, a->d, al, tmp->d);
   81|  23.8k|            } else {
   82|  23.8k|                if (bn_wexpand(tmp, max) == NULL)
  ------------------
  |  Branch (82:21): [True: 0, False: 23.8k]
  ------------------
   83|      0|                    goto err;
   84|  23.8k|                bn_sqr_normal(rr->d, a->d, al, tmp->d);
   85|  23.8k|            }
   86|  35.1k|        }
   87|       |#else
   88|       |        if (bn_wexpand(tmp, max) == NULL)
   89|       |            goto err;
   90|       |        bn_sqr_normal(rr->d, a->d, al, tmp->d);
   91|       |#endif
   92|   158k|    }
   93|       |
   94|   161k|    rr->neg = 0;
   95|   161k|    rr->top = max;
   96|   161k|    rr->flags |= BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|   161k|#  define BN_FLG_FIXED_TOP 0
  ------------------
   97|   161k|    if (r != rr && BN_copy(r, rr) == NULL)
  ------------------
  |  Branch (97:9): [True: 0, False: 161k]
  |  Branch (97:20): [True: 0, False: 0]
  ------------------
   98|      0|        goto err;
   99|       |
  100|   161k|    ret = 1;
  101|   161k| err:
  102|   161k|    bn_check_top(rr);
  103|   161k|    bn_check_top(tmp);
  104|   161k|    BN_CTX_end(ctx);
  105|   161k|    return ret;
  106|   161k|}
bn_sqr_normal:
  110|   147k|{
  111|   147k|    int i, j, max;
  112|   147k|    const BN_ULONG *ap;
  113|   147k|    BN_ULONG *rp;
  ------------------
  |  |   37|   147k|#  define BN_ULONG        unsigned long
  ------------------
  114|       |
  115|   147k|    max = n * 2;
  116|   147k|    ap = a;
  117|   147k|    rp = r;
  118|   147k|    rp[0] = rp[max - 1] = 0;
  119|   147k|    rp++;
  120|   147k|    j = n;
  121|       |
  122|   147k|    if (--j > 0) {
  ------------------
  |  Branch (122:9): [True: 36.3k, False: 111k]
  ------------------
  123|  36.3k|        ap++;
  124|  36.3k|        rp[j] = bn_mul_words(rp, ap, j, ap[-1]);
  125|  36.3k|        rp += 2;
  126|  36.3k|    }
  127|       |
  128|   837k|    for (i = n - 2; i > 0; i--) {
  ------------------
  |  Branch (128:21): [True: 689k, False: 147k]
  ------------------
  129|   689k|        j--;
  130|   689k|        ap++;
  131|   689k|        rp[j] = bn_mul_add_words(rp, ap, j, ap[-1]);
  132|   689k|        rp += 2;
  133|   689k|    }
  134|       |
  135|   147k|    bn_add_words(r, r, r, max);
  136|       |
  137|       |    /* There will not be a carry */
  138|       |
  139|   147k|    bn_sqr_words(tmp, a, n);
  140|       |
  141|   147k|    bn_add_words(r, r, tmp, max);
  142|   147k|}
bn_sqr_recursive:
  157|  52.0k|{
  158|  52.0k|    int n = n2 / 2;
  159|  52.0k|    int zero, c1;
  160|  52.0k|    BN_ULONG ln, lo, *p;
  ------------------
  |  |   37|  52.0k|#  define BN_ULONG        unsigned long
  ------------------
  161|       |
  162|  52.0k|    if (n2 == 4) {
  ------------------
  |  Branch (162:9): [True: 0, False: 52.0k]
  ------------------
  163|       |# ifndef BN_SQR_COMBA
  164|       |        bn_sqr_normal(r, a, 4, t);
  165|       |# else
  166|      0|        bn_sqr_comba4(r, a);
  167|      0|# endif
  168|      0|        return;
  169|  52.0k|    } else if (n2 == 8) {
  ------------------
  |  Branch (169:16): [True: 38.3k, False: 13.6k]
  ------------------
  170|       |# ifndef BN_SQR_COMBA
  171|       |        bn_sqr_normal(r, a, 8, t);
  172|       |# else
  173|  38.3k|        bn_sqr_comba8(r, a);
  174|  38.3k|# endif
  175|  38.3k|        return;
  176|  38.3k|    }
  177|  13.6k|    if (n2 < BN_SQR_RECURSIVE_SIZE_NORMAL) {
  ------------------
  |  |  366|  13.6k|# define BN_SQR_RECURSIVE_SIZE_NORMAL            (16)/* 32 */
  ------------------
  |  Branch (177:9): [True: 0, False: 13.6k]
  ------------------
  178|      0|        bn_sqr_normal(r, a, n2, t);
  179|      0|        return;
  180|      0|    }
  181|       |    /* r=(a[0]-a[1])*(a[1]-a[0]) */
  182|  13.6k|    c1 = bn_cmp_words(a, &(a[n]), n);
  183|  13.6k|    zero = 0;
  184|  13.6k|    if (c1 > 0)
  ------------------
  |  Branch (184:9): [True: 7.92k, False: 5.74k]
  ------------------
  185|  7.92k|        bn_sub_words(t, a, &(a[n]), n);
  186|  5.74k|    else if (c1 < 0)
  ------------------
  |  Branch (186:14): [True: 5.46k, False: 286]
  ------------------
  187|  5.46k|        bn_sub_words(t, &(a[n]), a, n);
  188|    286|    else
  189|    286|        zero = 1;
  190|       |
  191|       |    /* The result will always be negative unless it is zero */
  192|  13.6k|    p = &(t[n2 * 2]);
  193|       |
  194|  13.6k|    if (!zero)
  ------------------
  |  Branch (194:9): [True: 13.3k, False: 286]
  ------------------
  195|  13.3k|        bn_sqr_recursive(&(t[n2]), t, n, p);
  196|    286|    else
  197|    286|        memset(&t[n2], 0, sizeof(*t) * n2);
  198|  13.6k|    bn_sqr_recursive(r, a, n, p);
  199|  13.6k|    bn_sqr_recursive(&(r[n2]), &(a[n]), n, p);
  200|       |
  201|       |    /*-
  202|       |     * t[32] holds (a[0]-a[1])*(a[1]-a[0]), it is negative or zero
  203|       |     * r[10] holds (a[0]*b[0])
  204|       |     * r[32] holds (b[1]*b[1])
  205|       |     */
  206|       |
  207|  13.6k|    c1 = (int)(bn_add_words(t, r, &(r[n2]), n2));
  208|       |
  209|       |    /* t[32] is negative */
  210|  13.6k|    c1 -= (int)(bn_sub_words(&(t[n2]), t, &(t[n2]), n2));
  211|       |
  212|       |    /*-
  213|       |     * t[32] holds (a[0]-a[1])*(a[1]-a[0])+(a[0]*a[0])+(a[1]*a[1])
  214|       |     * r[10] holds (a[0]*a[0])
  215|       |     * r[32] holds (a[1]*a[1])
  216|       |     * c1 holds the carry bits
  217|       |     */
  218|  13.6k|    c1 += (int)(bn_add_words(&(r[n]), &(r[n]), &(t[n2]), n2));
  219|  13.6k|    if (c1) {
  ------------------
  |  Branch (219:9): [True: 3.61k, False: 10.0k]
  ------------------
  220|  3.61k|        p = &(r[n + n2]);
  221|  3.61k|        lo = *p;
  222|  3.61k|        ln = (lo + c1) & BN_MASK2;
  ------------------
  |  |   94|  3.61k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  223|  3.61k|        *p = ln;
  224|       |
  225|       |        /*
  226|       |         * The overflow will stop before we over write words we should not
  227|       |         * overwrite
  228|       |         */
  229|  3.61k|        if (ln < (BN_ULONG)c1) {
  ------------------
  |  Branch (229:13): [True: 390, False: 3.22k]
  ------------------
  230|    883|            do {
  231|    883|                p++;
  232|    883|                lo = *p;
  233|    883|                ln = (lo + 1) & BN_MASK2;
  ------------------
  |  |   94|    883|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  234|    883|                *p = ln;
  235|    883|            } while (ln == 0);
  ------------------
  |  Branch (235:22): [True: 493, False: 390]
  ------------------
  236|    390|        }
  237|  3.61k|    }
  238|  13.6k|}

BN_add_word:
   99|  31.8k|{
  100|  31.8k|    BN_ULONG l;
  ------------------
  |  |   37|  31.8k|#  define BN_ULONG        unsigned long
  ------------------
  101|  31.8k|    int i;
  102|       |
  103|  31.8k|    bn_check_top(a);
  104|  31.8k|    w &= BN_MASK2;
  ------------------
  |  |   94|  31.8k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  105|       |
  106|       |    /* degenerate case: w is zero */
  107|  31.8k|    if (!w)
  ------------------
  |  Branch (107:9): [True: 0, False: 31.8k]
  ------------------
  108|      0|        return 1;
  109|       |    /* degenerate case: a is zero */
  110|  31.8k|    if (BN_is_zero(a))
  ------------------
  |  Branch (110:9): [True: 1.15k, False: 30.7k]
  ------------------
  111|  1.15k|        return BN_set_word(a, w);
  112|       |    /* handle 'a' when negative */
  113|  30.7k|    if (a->neg) {
  ------------------
  |  Branch (113:9): [True: 0, False: 30.7k]
  ------------------
  114|      0|        a->neg = 0;
  115|      0|        i = BN_sub_word(a, w);
  116|      0|        if (!BN_is_zero(a))
  ------------------
  |  Branch (116:13): [True: 0, False: 0]
  ------------------
  117|      0|            a->neg = !(a->neg);
  118|      0|        return i;
  119|      0|    }
  120|  62.1k|    for (i = 0; w != 0 && i < a->top; i++) {
  ------------------
  |  Branch (120:17): [True: 31.6k, False: 30.5k]
  |  Branch (120:27): [True: 31.4k, False: 195]
  ------------------
  121|  31.4k|        a->d[i] = l = (a->d[i] + w) & BN_MASK2;
  ------------------
  |  |   94|  31.4k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  122|  31.4k|        w = (w > l) ? 1 : 0;
  ------------------
  |  Branch (122:13): [True: 905, False: 30.5k]
  ------------------
  123|  31.4k|    }
  124|  30.7k|    if (w && i == a->top) {
  ------------------
  |  Branch (124:9): [True: 195, False: 30.5k]
  |  Branch (124:14): [True: 195, False: 0]
  ------------------
  125|    195|        if (bn_wexpand(a, a->top + 1) == NULL)
  ------------------
  |  Branch (125:13): [True: 0, False: 195]
  ------------------
  126|      0|            return 0;
  127|    195|        a->top++;
  128|    195|        a->d[i] = w;
  129|    195|    }
  130|  30.7k|    bn_check_top(a);
  131|  30.7k|    return 1;
  132|  30.7k|}
BN_sub_word:
  135|  1.25k|{
  136|  1.25k|    int i;
  137|       |
  138|  1.25k|    bn_check_top(a);
  139|  1.25k|    w &= BN_MASK2;
  ------------------
  |  |   94|  1.25k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  140|       |
  141|       |    /* degenerate case: w is zero */
  142|  1.25k|    if (!w)
  ------------------
  |  Branch (142:9): [True: 0, False: 1.25k]
  ------------------
  143|      0|        return 1;
  144|       |    /* degenerate case: a is zero */
  145|  1.25k|    if (BN_is_zero(a)) {
  ------------------
  |  Branch (145:9): [True: 0, False: 1.25k]
  ------------------
  146|      0|        i = BN_set_word(a, w);
  147|      0|        if (i != 0)
  ------------------
  |  Branch (147:13): [True: 0, False: 0]
  ------------------
  148|      0|            BN_set_negative(a, 1);
  149|      0|        return i;
  150|      0|    }
  151|       |    /* handle 'a' when negative */
  152|  1.25k|    if (a->neg) {
  ------------------
  |  Branch (152:9): [True: 0, False: 1.25k]
  ------------------
  153|      0|        a->neg = 0;
  154|      0|        i = BN_add_word(a, w);
  155|      0|        a->neg = 1;
  156|      0|        return i;
  157|      0|    }
  158|       |
  159|  1.25k|    if ((a->top == 1) && (a->d[0] < w)) {
  ------------------
  |  Branch (159:9): [True: 0, False: 1.25k]
  |  Branch (159:26): [True: 0, False: 0]
  ------------------
  160|      0|        a->d[0] = w - a->d[0];
  161|      0|        a->neg = 1;
  162|      0|        return 1;
  163|      0|    }
  164|  1.25k|    i = 0;
  165|  2.50k|    for (;;) {
  166|  2.50k|        if (a->d[i] >= w) {
  ------------------
  |  Branch (166:13): [True: 1.25k, False: 1.25k]
  ------------------
  167|  1.25k|            a->d[i] -= w;
  168|  1.25k|            break;
  169|  1.25k|        } else {
  170|  1.25k|            a->d[i] = (a->d[i] - w) & BN_MASK2;
  ------------------
  |  |   94|  1.25k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  171|  1.25k|            i++;
  172|  1.25k|            w = 1;
  173|  1.25k|        }
  174|  2.50k|    }
  175|  1.25k|    if ((a->d[i] == 0) && (i == (a->top - 1)))
  ------------------
  |  Branch (175:9): [True: 179, False: 1.07k]
  |  Branch (175:27): [True: 179, False: 0]
  ------------------
  176|    179|        a->top--;
  177|  1.25k|    bn_check_top(a);
  178|  1.25k|    return 1;
  179|  1.25k|}
BN_mul_word:
  182|  4.15k|{
  183|  4.15k|    BN_ULONG ll;
  ------------------
  |  |   37|  4.15k|#  define BN_ULONG        unsigned long
  ------------------
  184|       |
  185|  4.15k|    bn_check_top(a);
  186|  4.15k|    w &= BN_MASK2;
  ------------------
  |  |   94|  4.15k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  187|  4.15k|    if (a->top) {
  ------------------
  |  Branch (187:9): [True: 3.86k, False: 284]
  ------------------
  188|  3.86k|        if (w == 0)
  ------------------
  |  Branch (188:13): [True: 0, False: 3.86k]
  ------------------
  189|      0|            BN_zero(a);
  ------------------
  |  |  202|      0|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  190|  3.86k|        else {
  191|  3.86k|            ll = bn_mul_words(a->d, a->d, a->top, w);
  192|  3.86k|            if (ll) {
  ------------------
  |  Branch (192:17): [True: 1.90k, False: 1.96k]
  ------------------
  193|  1.90k|                if (bn_wexpand(a, a->top + 1) == NULL)
  ------------------
  |  Branch (193:21): [True: 0, False: 1.90k]
  ------------------
  194|      0|                    return 0;
  195|  1.90k|                a->d[a->top++] = ll;
  196|  1.90k|            }
  197|  3.86k|        }
  198|  3.86k|    }
  199|  4.15k|    bn_check_top(a);
  200|  4.15k|    return 1;
  201|  4.15k|}

ossl_err_load_BUF_strings:
   24|      2|{
   25|      2|#ifndef OPENSSL_NO_ERR
   26|      2|    if (ERR_reason_error_string(BUF_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (26:9): [True: 2, False: 0]
  ------------------
   27|      2|        ERR_load_strings_const(BUF_str_reasons);
   28|      2|#endif
   29|      2|    return 1;
   30|      2|}

ossl_err_load_CMP_strings:
  199|      2|{
  200|      2|# ifndef OPENSSL_NO_ERR
  201|      2|    if (ERR_reason_error_string(CMP_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (201:9): [True: 2, False: 0]
  ------------------
  202|      2|        ERR_load_strings_const(CMP_str_reasons);
  203|      2|# endif
  204|      2|    return 1;
  205|      2|}

OSSL_CMP_log_close:
   41|      2|{
   42|      2|    (void)OSSL_trace_set_channel(OSSL_TRACE_CATEGORY_CMP, NULL);
  ------------------
  |  |   53|      2|# define OSSL_TRACE_CATEGORY_CMP                13
  ------------------
   43|      2|}

ossl_err_load_CMS_strings:
  175|      2|{
  176|      2|# ifndef OPENSSL_NO_ERR
  177|      2|    if (ERR_reason_error_string(CMS_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (177:9): [True: 2, False: 0]
  ------------------
  178|      2|        ERR_load_strings_const(CMS_str_reasons);
  179|      2|# endif
  180|      2|    return 1;
  181|      2|}

ossl_comp_brotli_cleanup:
  353|      2|{
  354|       |#ifdef BROTLI_SHARED
  355|       |    DSO_free(brotli_encode_dso);
  356|       |    brotli_encode_dso = NULL;
  357|       |    DSO_free(brotli_decode_dso);
  358|       |    brotli_decode_dso = NULL;
  359|       |    p_encode_init = NULL;
  360|       |    p_encode_stream = NULL;
  361|       |    p_encode_has_more = NULL;
  362|       |    p_encode_end = NULL;
  363|       |    p_encode_oneshot = NULL;
  364|       |    p_decode_init = NULL;
  365|       |    p_decode_stream = NULL;
  366|       |    p_decode_has_more = NULL;
  367|       |    p_decode_end = NULL;
  368|       |    p_decode_error = NULL;
  369|       |    p_decode_error_string = NULL;
  370|       |    p_decode_is_finished = NULL;
  371|       |    p_decode_oneshot = NULL;
  372|       |#endif
  373|      2|}

COMP_zlib:
  311|      2|{
  312|      2|    COMP_METHOD *meth = NULL;
  313|       |
  314|       |#ifndef OPENSSL_NO_ZLIB
  315|       |    if (RUN_ONCE(&zlib_once, ossl_comp_zlib_init))
  316|       |        meth = &zlib_stateful_method;
  317|       |#endif
  318|       |
  319|      2|    return meth;
  320|      2|}
ossl_comp_zlib_cleanup:
  336|      2|{
  337|       |#ifdef ZLIB_SHARED
  338|       |    DSO_free(zlib_dso);
  339|       |    zlib_dso = NULL;
  340|       |#endif
  341|      2|}

ossl_comp_zstd_cleanup:
  428|      2|{
  429|       |#ifdef ZSTD_SHARED
  430|       |    DSO_free(zstd_dso);
  431|       |    zstd_dso = NULL;
  432|       |    p_createCStream = NULL;
  433|       |    p_initCStream = NULL;
  434|       |    p_freeCStream = NULL;
  435|       |    p_compressStream2 = NULL;
  436|       |    p_flushStream = NULL;
  437|       |    p_endStream = NULL;
  438|       |    p_compress = NULL;
  439|       |    p_createDStream = NULL;
  440|       |    p_initDStream = NULL;
  441|       |    p_freeDStream = NULL;
  442|       |    p_decompressStream = NULL;
  443|       |    p_decompress = NULL;
  444|       |    p_isError = NULL;
  445|       |    p_getErrorName = NULL;
  446|       |    p_DStreamInSize = NULL;
  447|       |    p_CStreamInSize = NULL;
  448|       |#endif
  449|      2|}

ossl_err_load_COMP_strings:
   45|      2|{
   46|      2|# ifndef OPENSSL_NO_ERR
   47|      2|    if (ERR_reason_error_string(COMP_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (47:9): [True: 2, False: 0]
  ------------------
   48|      2|        ERR_load_strings_const(COMP_str_reasons);
   49|      2|# endif
   50|      2|    return 1;
   51|      2|}

COMP_get_type:
   41|      2|{
   42|      2|    if (meth == NULL)
  ------------------
  |  Branch (42:9): [True: 2, False: 0]
  ------------------
   43|      2|        return NID_undef;
  ------------------
  |  |   18|      2|#define NID_undef                       0
  ------------------
   44|      0|    return meth->type;
   45|      2|}

ossl_load_builtin_compressions:
   29|      2|{
   30|      2|    STACK_OF(SSL_COMP) *comp_methods = NULL;
  ------------------
  |  |   31|      2|# define STACK_OF(type) struct stack_st_##type
  ------------------
   31|      2|#ifndef OPENSSL_NO_COMP
   32|      2|    SSL_COMP *comp = NULL;
   33|      2|    COMP_METHOD *method = COMP_zlib();
   34|       |
   35|      2|    comp_methods = sk_SSL_COMP_new(sk_comp_cmp);
  ------------------
  |  |   69|      2|#define sk_SSL_COMP_new(cmp) ((STACK_OF(SSL_COMP) *)OPENSSL_sk_new(ossl_check_SSL_COMP_compfunc_type(cmp)))
  ------------------
   36|       |
   37|      2|    if (COMP_get_type(method) != NID_undef && comp_methods != NULL) {
  ------------------
  |  |   18|      4|#define NID_undef                       0
  ------------------
  |  Branch (37:9): [True: 0, False: 2]
  |  Branch (37:47): [True: 0, False: 0]
  ------------------
   38|      0|        comp = OPENSSL_malloc(sizeof(*comp));
  ------------------
  |  |  102|      0|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   39|      0|        if (comp != NULL) {
  ------------------
  |  Branch (39:13): [True: 0, False: 0]
  ------------------
   40|      0|            comp->method = method;
   41|      0|            comp->id = SSL_COMP_ZLIB_IDX;
  ------------------
  |  |   18|      0|#define SSL_COMP_ZLIB_IDX       1
  ------------------
   42|      0|            comp->name = COMP_get_name(method);
   43|      0|            if (!sk_SSL_COMP_push(comp_methods, comp))
  ------------------
  |  |   77|      0|#define sk_SSL_COMP_push(sk, ptr) OPENSSL_sk_push(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_type(ptr))
  ------------------
  |  Branch (43:17): [True: 0, False: 0]
  ------------------
   44|      0|                OPENSSL_free(comp);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   45|      0|        }
   46|      0|    }
   47|      2|#endif
   48|      2|    return comp_methods;
   49|      2|}
ossl_free_compression_methods_int:
   57|      2|{
   58|      2|    sk_SSL_COMP_pop_free(methods, cmeth_free);
  ------------------
  |  |   81|      2|#define sk_SSL_COMP_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_freefunc_type(freefunc))
  ------------------
   59|      2|}

ossl_err_load_CONF_strings:
   68|      2|{
   69|      2|#ifndef OPENSSL_NO_ERR
   70|      2|    if (ERR_reason_error_string(CONF_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (70:9): [True: 2, False: 0]
  ------------------
   71|      2|        ERR_load_strings_const(CONF_str_reasons);
   72|      2|#endif
   73|      2|    return 1;
   74|      2|}

CONF_modules_unload:
  517|      2|{
  518|      2|    int i;
  519|      2|    CONF_MODULE *md;
  520|      2|    STACK_OF(CONF_MODULE) *old_modules;
  ------------------
  |  |   31|      2|# define STACK_OF(type) struct stack_st_##type
  ------------------
  521|      2|    STACK_OF(CONF_MODULE) *new_modules;
  ------------------
  |  |   31|      2|# define STACK_OF(type) struct stack_st_##type
  ------------------
  522|      2|    STACK_OF(CONF_MODULE) *to_delete;
  ------------------
  |  |   31|      2|# define STACK_OF(type) struct stack_st_##type
  ------------------
  523|       |
  524|      2|    if (!conf_modules_finish_int()) /* also inits module list lock */
  ------------------
  |  Branch (524:9): [True: 0, False: 2]
  ------------------
  525|      0|        return;
  526|       |
  527|      2|    ossl_rcu_write_lock(module_list_lock);
  528|       |
  529|      2|    old_modules = ossl_rcu_deref(&supported_modules);
  ------------------
  |  |   30|      2|#define ossl_rcu_deref(p) ossl_rcu_uptr_deref((void **)p)
  ------------------
  530|      2|    new_modules = sk_CONF_MODULE_dup(old_modules);
  531|       |
  532|      2|    if (new_modules == NULL) {
  ------------------
  |  Branch (532:9): [True: 0, False: 2]
  ------------------
  533|      0|        ossl_rcu_write_unlock(module_list_lock);
  534|      0|        return;
  535|      0|    }
  536|       |
  537|      2|    to_delete = sk_CONF_MODULE_new_null();
  538|       |
  539|       |    /* unload modules in reverse order */
  540|      2|    for (i = sk_CONF_MODULE_num(new_modules) - 1; i >= 0; i--) {
  ------------------
  |  Branch (540:51): [True: 0, False: 2]
  ------------------
  541|      0|        md = sk_CONF_MODULE_value(new_modules, i);
  542|       |        /* If static or in use and 'all' not set ignore it */
  543|      0|        if (((md->links > 0) || !md->dso) && !all)
  ------------------
  |  Branch (543:14): [True: 0, False: 0]
  |  Branch (543:33): [True: 0, False: 0]
  |  Branch (543:46): [True: 0, False: 0]
  ------------------
  544|      0|            continue;
  545|       |        /* Since we're working in reverse this is OK */
  546|      0|        (void)sk_CONF_MODULE_delete(new_modules, i);
  547|      0|        sk_CONF_MODULE_push(to_delete, md);
  548|      0|    }
  549|       |
  550|      2|    if (sk_CONF_MODULE_num(new_modules) == 0) {
  ------------------
  |  Branch (550:9): [True: 2, False: 0]
  ------------------
  551|      2|        sk_CONF_MODULE_free(new_modules);
  552|      2|        new_modules = NULL;
  553|      2|    }
  554|       |
  555|      2|    ossl_rcu_assign_ptr(&supported_modules, &new_modules);
  ------------------
  |  |   31|      2|#define ossl_rcu_assign_ptr(p,v) ossl_rcu_assign_uptr((void **)p, (void **)v)
  ------------------
  556|      2|    ossl_rcu_write_unlock(module_list_lock);
  557|      2|    ossl_synchronize_rcu(module_list_lock);
  558|      2|    sk_CONF_MODULE_free(old_modules);
  559|      2|    sk_CONF_MODULE_pop_free(to_delete, module_free);
  560|       |
  561|      2|}
ossl_config_modules_free:
  632|      2|{
  633|      2|    CONF_modules_unload(1); /* calls CONF_modules_finish */
  634|      2|    module_lists_free();
  635|      2|}
conf_mod.c:do_init_module_list_lock:
  101|      2|{
  102|      2|    module_list_lock = ossl_rcu_lock_new(1, NULL);
  103|      2|    if (module_list_lock == NULL) {
  ------------------
  |  Branch (103:9): [True: 0, False: 2]
  ------------------
  104|      0|        ERR_raise(ERR_LIB_CONF, ERR_R_CRYPTO_LIB);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  105|      0|        return 0;
  106|      0|    }
  107|       |
  108|      2|    return 1;
  109|      2|}
conf_mod.c:conf_modules_finish_int:
  574|      2|{
  575|      2|    CONF_IMODULE *imod;
  576|      2|    STACK_OF(CONF_IMODULE) *old_modules;
  ------------------
  |  |   31|      2|# define STACK_OF(type) struct stack_st_##type
  ------------------
  577|      2|    STACK_OF(CONF_IMODULE) *new_modules = NULL;
  ------------------
  |  |   31|      2|# define STACK_OF(type) struct stack_st_##type
  ------------------
  578|       |
  579|      2|    if (!RUN_ONCE(&init_module_list_lock, do_init_module_list_lock))
  ------------------
  |  |  130|      2|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 2, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (579:9): [True: 0, False: 2]
  ------------------
  580|      0|        return 0;
  581|       |
  582|       |    /* If module_list_lock is NULL here it means we were already unloaded */
  583|      2|    if (module_list_lock == NULL)
  ------------------
  |  Branch (583:9): [True: 0, False: 2]
  ------------------
  584|      0|        return 0;
  585|       |
  586|      2|    ossl_rcu_write_lock(module_list_lock);
  587|      2|    old_modules = ossl_rcu_deref(&initialized_modules);
  ------------------
  |  |   30|      2|#define ossl_rcu_deref(p) ossl_rcu_uptr_deref((void **)p)
  ------------------
  588|      2|    ossl_rcu_assign_ptr(&initialized_modules, &new_modules);
  ------------------
  |  |   31|      2|#define ossl_rcu_assign_ptr(p,v) ossl_rcu_assign_uptr((void **)p, (void **)v)
  ------------------
  589|      2|    ossl_rcu_write_unlock(module_list_lock);
  590|      2|    ossl_synchronize_rcu(module_list_lock);
  591|       |
  592|      2|    while (sk_CONF_IMODULE_num(old_modules) > 0) {
  ------------------
  |  Branch (592:12): [True: 0, False: 2]
  ------------------
  593|      0|        imod = sk_CONF_IMODULE_pop(old_modules);
  594|      0|        module_finish(imod);
  595|      0|    }
  596|      2|    sk_CONF_IMODULE_free(old_modules);
  597|       |
  598|      2|    return 1;
  599|      2|}
conf_mod.c:module_lists_free:
   89|      2|{
   90|      2|    ossl_rcu_lock_free(module_list_lock);
   91|      2|    module_list_lock = NULL;
   92|       |
   93|      2|    sk_CONF_MODULE_free(supported_modules);
   94|      2|    supported_modules = NULL;
   95|       |
   96|      2|    sk_CONF_IMODULE_free(initialized_modules);
   97|      2|    initialized_modules = NULL;
   98|      2|}

ossl_lib_ctx_default_deinit:
  412|      2|{
  413|      2|    if (!default_context_inited)
  ------------------
  |  Branch (413:9): [True: 0, False: 2]
  ------------------
  414|      0|        return;
  415|      2|    context_deinit(&default_context_int);
  416|      2|    CRYPTO_THREAD_cleanup_local(&default_context_thread_local);
  417|      2|    default_context_inited = 0;
  418|      2|}
ossl_lib_ctx_get_concrete:
  543|     24|{
  544|     24|#ifndef FIPS_MODULE
  545|     24|    if (ctx == NULL)
  ------------------
  |  Branch (545:9): [True: 2, False: 22]
  ------------------
  546|      2|        return get_default_context();
  547|     22|#endif
  548|     22|    return ctx;
  549|     24|}
ossl_lib_ctx_get_data:
  570|     16|{
  571|     16|    ctx = ossl_lib_ctx_get_concrete(ctx);
  572|     16|    if (ctx == NULL)
  ------------------
  |  Branch (572:9): [True: 0, False: 16]
  ------------------
  573|      0|        return NULL;
  574|       |
  575|     16|    switch (index) {
  576|     16|    case OSSL_LIB_CTX_PROPERTY_STRING_INDEX:
  ------------------
  |  |  101|     16|# define OSSL_LIB_CTX_PROPERTY_STRING_INDEX          3
  ------------------
  |  Branch (576:5): [True: 16, False: 0]
  ------------------
  577|     16|        return ctx->property_string_data;
  578|      0|    case OSSL_LIB_CTX_EVP_METHOD_STORE_INDEX:
  ------------------
  |  |   98|      0|# define OSSL_LIB_CTX_EVP_METHOD_STORE_INDEX         0
  ------------------
  |  Branch (578:5): [True: 0, False: 16]
  ------------------
  579|      0|        return ctx->evp_method_store;
  580|      0|    case OSSL_LIB_CTX_PROVIDER_STORE_INDEX:
  ------------------
  |  |   99|      0|# define OSSL_LIB_CTX_PROVIDER_STORE_INDEX           1
  ------------------
  |  Branch (580:5): [True: 0, False: 16]
  ------------------
  581|      0|        return ctx->provider_store;
  582|      0|    case OSSL_LIB_CTX_NAMEMAP_INDEX:
  ------------------
  |  |  102|      0|# define OSSL_LIB_CTX_NAMEMAP_INDEX                  4
  ------------------
  |  Branch (582:5): [True: 0, False: 16]
  ------------------
  583|      0|        return ctx->namemap;
  584|      0|    case OSSL_LIB_CTX_PROPERTY_DEFN_INDEX:
  ------------------
  |  |  100|      0|# define OSSL_LIB_CTX_PROPERTY_DEFN_INDEX            2
  ------------------
  |  Branch (584:5): [True: 0, False: 16]
  ------------------
  585|      0|        return ctx->property_defns;
  586|      0|    case OSSL_LIB_CTX_GLOBAL_PROPERTIES:
  ------------------
  |  |  114|      0|# define OSSL_LIB_CTX_GLOBAL_PROPERTIES             14
  ------------------
  |  Branch (586:5): [True: 0, False: 16]
  ------------------
  587|      0|        return ctx->global_properties;
  588|      0|    case OSSL_LIB_CTX_DRBG_INDEX:
  ------------------
  |  |  103|      0|# define OSSL_LIB_CTX_DRBG_INDEX                     5
  ------------------
  |  Branch (588:5): [True: 0, False: 16]
  ------------------
  589|      0|        return ctx->drbg;
  590|      0|    case OSSL_LIB_CTX_DRBG_NONCE_INDEX:
  ------------------
  |  |  104|      0|# define OSSL_LIB_CTX_DRBG_NONCE_INDEX               6
  ------------------
  |  Branch (590:5): [True: 0, False: 16]
  ------------------
  591|      0|        return ctx->drbg_nonce;
  592|      0|#ifndef FIPS_MODULE
  593|      0|    case OSSL_LIB_CTX_PROVIDER_CONF_INDEX:
  ------------------
  |  |  116|      0|# define OSSL_LIB_CTX_PROVIDER_CONF_INDEX           16
  ------------------
  |  Branch (593:5): [True: 0, False: 16]
  ------------------
  594|      0|        return ctx->provider_conf;
  595|      0|    case OSSL_LIB_CTX_BIO_CORE_INDEX:
  ------------------
  |  |  117|      0|# define OSSL_LIB_CTX_BIO_CORE_INDEX                17
  ------------------
  |  Branch (595:5): [True: 0, False: 16]
  ------------------
  596|      0|        return ctx->bio_core;
  597|      0|    case OSSL_LIB_CTX_CHILD_PROVIDER_INDEX:
  ------------------
  |  |  118|      0|# define OSSL_LIB_CTX_CHILD_PROVIDER_INDEX          18
  ------------------
  |  Branch (597:5): [True: 0, False: 16]
  ------------------
  598|      0|        return ctx->child_provider;
  599|      0|    case OSSL_LIB_CTX_DECODER_STORE_INDEX:
  ------------------
  |  |  111|      0|# define OSSL_LIB_CTX_DECODER_STORE_INDEX           11
  ------------------
  |  Branch (599:5): [True: 0, False: 16]
  ------------------
  600|      0|        return ctx->decoder_store;
  601|      0|    case OSSL_LIB_CTX_DECODER_CACHE_INDEX:
  ------------------
  |  |  120|      0|# define OSSL_LIB_CTX_DECODER_CACHE_INDEX           20
  ------------------
  |  Branch (601:5): [True: 0, False: 16]
  ------------------
  602|      0|        return ctx->decoder_cache;
  603|      0|    case OSSL_LIB_CTX_ENCODER_STORE_INDEX:
  ------------------
  |  |  110|      0|# define OSSL_LIB_CTX_ENCODER_STORE_INDEX           10
  ------------------
  |  Branch (603:5): [True: 0, False: 16]
  ------------------
  604|      0|        return ctx->encoder_store;
  605|      0|    case OSSL_LIB_CTX_STORE_LOADER_STORE_INDEX:
  ------------------
  |  |  115|      0|# define OSSL_LIB_CTX_STORE_LOADER_STORE_INDEX      15
  ------------------
  |  Branch (605:5): [True: 0, False: 16]
  ------------------
  606|      0|        return ctx->store_loader_store;
  607|      0|    case OSSL_LIB_CTX_SELF_TEST_CB_INDEX:
  ------------------
  |  |  112|      0|# define OSSL_LIB_CTX_SELF_TEST_CB_INDEX            12
  ------------------
  |  Branch (607:5): [True: 0, False: 16]
  ------------------
  608|      0|        return ctx->self_test_cb;
  609|      0|    case OSSL_LIB_CTX_INDICATOR_CB_INDEX:
  ------------------
  |  |  122|      0|# define OSSL_LIB_CTX_INDICATOR_CB_INDEX            22
  ------------------
  |  Branch (609:5): [True: 0, False: 16]
  ------------------
  610|      0|        return ctx->indicator_cb;
  611|      0|#endif
  612|      0|#ifndef OPENSSL_NO_THREAD_POOL
  613|      0|    case OSSL_LIB_CTX_THREAD_INDEX:
  ------------------
  |  |  119|      0|# define OSSL_LIB_CTX_THREAD_INDEX                  19
  ------------------
  |  Branch (613:5): [True: 0, False: 16]
  ------------------
  614|      0|        return ctx->threads;
  615|      0|#endif
  616|       |
  617|       |#ifdef FIPS_MODULE
  618|       |    case OSSL_LIB_CTX_THREAD_EVENT_HANDLER_INDEX:
  619|       |        return ctx->thread_event_handler;
  620|       |
  621|       |    case OSSL_LIB_CTX_FIPS_PROV_INDEX:
  622|       |        return ctx->fips_prov;
  623|       |#endif
  624|       |
  625|      0|    case OSSL_LIB_CTX_COMP_METHODS:
  ------------------
  |  |  121|      0|# define OSSL_LIB_CTX_COMP_METHODS                  21
  ------------------
  |  Branch (625:5): [True: 0, False: 16]
  ------------------
  626|      0|        return (void *)&ctx->comp_methods;
  627|       |
  628|      0|    default:
  ------------------
  |  Branch (628:5): [True: 0, False: 16]
  ------------------
  629|      0|        return NULL;
  630|     16|    }
  631|     16|}
ossl_lib_ctx_get_ex_data_global:
  639|      4|{
  640|      4|    ctx = ossl_lib_ctx_get_concrete(ctx);
  641|      4|    if (ctx == NULL)
  ------------------
  |  Branch (641:9): [True: 0, False: 4]
  ------------------
  642|      0|        return NULL;
  643|      4|    return &ctx->global;
  644|      4|}
context.c:context_deinit:
  370|      2|{
  371|      2|    if (ctx == NULL)
  ------------------
  |  Branch (371:9): [True: 0, False: 2]
  ------------------
  372|      0|        return 1;
  373|       |
  374|      2|    ossl_ctx_thread_stop(ctx);
  375|       |
  376|      2|    context_deinit_objs(ctx);
  377|       |
  378|      2|    ossl_crypto_cleanup_all_ex_data_int(ctx);
  379|       |
  380|      2|    CRYPTO_THREAD_lock_free(ctx->lock);
  381|      2|    ctx->lock = NULL;
  382|      2|    CRYPTO_THREAD_cleanup_local(&ctx->rcu_local_key);
  383|      2|    return 1;
  384|      2|}
context.c:context_deinit_objs:
  235|      2|{
  236|       |    /* P2. We want evp_method_store to be cleaned up before the provider store */
  237|      2|    if (ctx->evp_method_store != NULL) {
  ------------------
  |  Branch (237:9): [True: 2, False: 0]
  ------------------
  238|      2|        ossl_method_store_free(ctx->evp_method_store);
  239|      2|        ctx->evp_method_store = NULL;
  240|      2|    }
  241|       |
  242|       |    /* P2. */
  243|      2|    if (ctx->drbg != NULL) {
  ------------------
  |  Branch (243:9): [True: 2, False: 0]
  ------------------
  244|      2|        ossl_rand_ctx_free(ctx->drbg);
  245|      2|        ctx->drbg = NULL;
  246|      2|    }
  247|       |
  248|      2|#ifndef FIPS_MODULE
  249|       |    /* P2. */
  250|      2|    if (ctx->provider_conf != NULL) {
  ------------------
  |  Branch (250:9): [True: 2, False: 0]
  ------------------
  251|      2|        ossl_prov_conf_ctx_free(ctx->provider_conf);
  252|      2|        ctx->provider_conf = NULL;
  253|      2|    }
  254|       |
  255|       |    /*
  256|       |     * P2. We want decoder_store/decoder_cache to be cleaned up before the
  257|       |     * provider store
  258|       |     */
  259|      2|    if (ctx->decoder_store != NULL) {
  ------------------
  |  Branch (259:9): [True: 2, False: 0]
  ------------------
  260|      2|        ossl_method_store_free(ctx->decoder_store);
  261|      2|        ctx->decoder_store = NULL;
  262|      2|    }
  263|      2|    if (ctx->decoder_cache != NULL) {
  ------------------
  |  Branch (263:9): [True: 2, False: 0]
  ------------------
  264|      2|        ossl_decoder_cache_free(ctx->decoder_cache);
  265|      2|        ctx->decoder_cache = NULL;
  266|      2|    }
  267|       |
  268|       |
  269|       |    /* P2. We want encoder_store to be cleaned up before the provider store */
  270|      2|    if (ctx->encoder_store != NULL) {
  ------------------
  |  Branch (270:9): [True: 2, False: 0]
  ------------------
  271|      2|        ossl_method_store_free(ctx->encoder_store);
  272|      2|        ctx->encoder_store = NULL;
  273|      2|    }
  274|       |
  275|       |    /* P2. We want loader_store to be cleaned up before the provider store */
  276|      2|    if (ctx->store_loader_store != NULL) {
  ------------------
  |  Branch (276:9): [True: 2, False: 0]
  ------------------
  277|      2|        ossl_method_store_free(ctx->store_loader_store);
  278|      2|        ctx->store_loader_store = NULL;
  279|      2|    }
  280|      2|#endif
  281|       |
  282|       |    /* P1. Needs to be freed before the child provider data is freed */
  283|      2|    if (ctx->provider_store != NULL) {
  ------------------
  |  Branch (283:9): [True: 2, False: 0]
  ------------------
  284|      2|        ossl_provider_store_free(ctx->provider_store);
  285|      2|        ctx->provider_store = NULL;
  286|      2|    }
  287|       |
  288|       |    /* Default priority. */
  289|      2|    if (ctx->property_string_data != NULL) {
  ------------------
  |  Branch (289:9): [True: 2, False: 0]
  ------------------
  290|      2|        ossl_property_string_data_free(ctx->property_string_data);
  291|      2|        ctx->property_string_data = NULL;
  292|      2|    }
  293|       |
  294|      2|    if (ctx->namemap != NULL) {
  ------------------
  |  Branch (294:9): [True: 2, False: 0]
  ------------------
  295|      2|        ossl_stored_namemap_free(ctx->namemap);
  296|      2|        ctx->namemap = NULL;
  297|      2|    }
  298|       |
  299|      2|    if (ctx->property_defns != NULL) {
  ------------------
  |  Branch (299:9): [True: 2, False: 0]
  ------------------
  300|      2|        ossl_property_defns_free(ctx->property_defns);
  301|      2|        ctx->property_defns = NULL;
  302|      2|    }
  303|       |
  304|      2|    if (ctx->global_properties != NULL) {
  ------------------
  |  Branch (304:9): [True: 2, False: 0]
  ------------------
  305|      2|        ossl_ctx_global_properties_free(ctx->global_properties);
  306|      2|        ctx->global_properties = NULL;
  307|      2|    }
  308|       |
  309|      2|#ifndef FIPS_MODULE
  310|      2|    if (ctx->bio_core != NULL) {
  ------------------
  |  Branch (310:9): [True: 2, False: 0]
  ------------------
  311|      2|        ossl_bio_core_globals_free(ctx->bio_core);
  312|      2|        ctx->bio_core = NULL;
  313|      2|    }
  314|      2|#endif
  315|       |
  316|      2|    if (ctx->drbg_nonce != NULL) {
  ------------------
  |  Branch (316:9): [True: 2, False: 0]
  ------------------
  317|      2|        ossl_prov_drbg_nonce_ctx_free(ctx->drbg_nonce);
  318|      2|        ctx->drbg_nonce = NULL;
  319|      2|    }
  320|       |
  321|      2|#ifndef FIPS_MODULE
  322|      2|    if (ctx->indicator_cb != NULL) {
  ------------------
  |  Branch (322:9): [True: 2, False: 0]
  ------------------
  323|      2|        ossl_indicator_set_callback_free(ctx->indicator_cb);
  324|      2|        ctx->indicator_cb = NULL;
  325|      2|    }
  326|       |
  327|      2|    if (ctx->self_test_cb != NULL) {
  ------------------
  |  Branch (327:9): [True: 2, False: 0]
  ------------------
  328|      2|        ossl_self_test_set_callback_free(ctx->self_test_cb);
  329|      2|        ctx->self_test_cb = NULL;
  330|      2|    }
  331|      2|#endif
  332|       |
  333|       |#ifdef FIPS_MODULE
  334|       |    if (ctx->thread_event_handler != NULL) {
  335|       |        ossl_thread_event_ctx_free(ctx->thread_event_handler);
  336|       |        ctx->thread_event_handler = NULL;
  337|       |    }
  338|       |
  339|       |    if (ctx->fips_prov != NULL) {
  340|       |        ossl_fips_prov_ossl_ctx_free(ctx->fips_prov);
  341|       |        ctx->fips_prov = NULL;
  342|       |    }
  343|       |#endif
  344|       |
  345|      2|#ifndef OPENSSL_NO_THREAD_POOL
  346|      2|    if (ctx->threads != NULL) {
  ------------------
  |  Branch (346:9): [True: 2, False: 0]
  ------------------
  347|      2|        ossl_threads_ctx_free(ctx->threads);
  348|      2|        ctx->threads = NULL;
  349|      2|    }
  350|      2|#endif
  351|       |
  352|       |    /* Low priority. */
  353|      2|#ifndef FIPS_MODULE
  354|      2|    if (ctx->child_provider != NULL) {
  ------------------
  |  Branch (354:9): [True: 2, False: 0]
  ------------------
  355|      2|        ossl_child_prov_ctx_free(ctx->child_provider);
  356|      2|        ctx->child_provider = NULL;
  357|      2|    }
  358|      2|#endif
  359|       |
  360|      2|#ifndef FIPS_MODULE
  361|      2|    if (ctx->comp_methods != NULL) {
  ------------------
  |  Branch (361:9): [True: 2, False: 0]
  ------------------
  362|      2|        ossl_free_compression_methods_int(ctx->comp_methods);
  363|      2|        ctx->comp_methods = NULL;
  364|      2|    }
  365|      2|#endif
  366|       |
  367|      2|}
context.c:context_init:
   92|      2|{
   93|      2|    int exdata_done = 0;
   94|       |
   95|      2|    if (!CRYPTO_THREAD_init_local(&ctx->rcu_local_key, NULL))
  ------------------
  |  Branch (95:9): [True: 0, False: 2]
  ------------------
   96|      0|        return 0;
   97|       |
   98|      2|    ctx->lock = CRYPTO_THREAD_lock_new();
   99|      2|    if (ctx->lock == NULL)
  ------------------
  |  Branch (99:9): [True: 0, False: 2]
  ------------------
  100|      0|        goto err;
  101|       |
  102|       |    /* Initialize ex_data. */
  103|      2|    if (!ossl_do_ex_data_init(ctx))
  ------------------
  |  Branch (103:9): [True: 0, False: 2]
  ------------------
  104|      0|        goto err;
  105|      2|    exdata_done = 1;
  106|       |
  107|       |    /* P2. We want evp_method_store to be cleaned up before the provider store */
  108|      2|    ctx->evp_method_store = ossl_method_store_new(ctx);
  109|      2|    if (ctx->evp_method_store == NULL)
  ------------------
  |  Branch (109:9): [True: 0, False: 2]
  ------------------
  110|      0|        goto err;
  111|      2|    OSSL_TRACE1(QUERY, "context_init: allocating store %p\n", ctx->evp_method_store);
  ------------------
  |  |  291|      2|    OSSL_TRACEV(category, (trc_out, format, arg1))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  112|       |
  113|      2|#ifndef FIPS_MODULE
  114|       |    /* P2. Must be freed before the provider store is freed */
  115|      2|    ctx->provider_conf = ossl_prov_conf_ctx_new(ctx);
  116|      2|    if (ctx->provider_conf == NULL)
  ------------------
  |  Branch (116:9): [True: 0, False: 2]
  ------------------
  117|      0|        goto err;
  118|      2|#endif
  119|       |
  120|       |    /* P2. */
  121|      2|    ctx->drbg = ossl_rand_ctx_new(ctx);
  122|      2|    if (ctx->drbg == NULL)
  ------------------
  |  Branch (122:9): [True: 0, False: 2]
  ------------------
  123|      0|        goto err;
  124|       |
  125|      2|#ifndef FIPS_MODULE
  126|       |    /*
  127|       |     * P2. We want decoder_store/decoder_cache to be cleaned up before the
  128|       |     * provider store
  129|       |     */
  130|      2|    ctx->decoder_store = ossl_method_store_new(ctx);
  131|      2|    if (ctx->decoder_store == NULL)
  ------------------
  |  Branch (131:9): [True: 0, False: 2]
  ------------------
  132|      0|        goto err;
  133|      2|    ctx->decoder_cache = ossl_decoder_cache_new(ctx);
  134|      2|    if (ctx->decoder_cache == NULL)
  ------------------
  |  Branch (134:9): [True: 0, False: 2]
  ------------------
  135|      0|        goto err;
  136|       |
  137|       |    /* P2. We want encoder_store to be cleaned up before the provider store */
  138|      2|    ctx->encoder_store = ossl_method_store_new(ctx);
  139|      2|    if (ctx->encoder_store == NULL)
  ------------------
  |  Branch (139:9): [True: 0, False: 2]
  ------------------
  140|      0|        goto err;
  141|       |
  142|       |    /* P2. We want loader_store to be cleaned up before the provider store */
  143|      2|    ctx->store_loader_store = ossl_method_store_new(ctx);
  144|      2|    if (ctx->store_loader_store == NULL)
  ------------------
  |  Branch (144:9): [True: 0, False: 2]
  ------------------
  145|      0|        goto err;
  146|      2|#endif
  147|       |
  148|       |    /* P1. Needs to be freed before the child provider data is freed */
  149|      2|    ctx->provider_store = ossl_provider_store_new(ctx);
  150|      2|    if (ctx->provider_store == NULL)
  ------------------
  |  Branch (150:9): [True: 0, False: 2]
  ------------------
  151|      0|        goto err;
  152|       |
  153|       |    /* Default priority. */
  154|      2|    ctx->property_string_data = ossl_property_string_data_new(ctx);
  155|      2|    if (ctx->property_string_data == NULL)
  ------------------
  |  Branch (155:9): [True: 0, False: 2]
  ------------------
  156|      0|        goto err;
  157|       |
  158|      2|    ctx->namemap = ossl_stored_namemap_new(ctx);
  159|      2|    if (ctx->namemap == NULL)
  ------------------
  |  Branch (159:9): [True: 0, False: 2]
  ------------------
  160|      0|        goto err;
  161|       |
  162|      2|    ctx->property_defns = ossl_property_defns_new(ctx);
  163|      2|    if (ctx->property_defns == NULL)
  ------------------
  |  Branch (163:9): [True: 0, False: 2]
  ------------------
  164|      0|        goto err;
  165|       |
  166|      2|    ctx->global_properties = ossl_ctx_global_properties_new(ctx);
  167|      2|    if (ctx->global_properties == NULL)
  ------------------
  |  Branch (167:9): [True: 0, False: 2]
  ------------------
  168|      0|        goto err;
  169|       |
  170|      2|#ifndef FIPS_MODULE
  171|      2|    ctx->bio_core = ossl_bio_core_globals_new(ctx);
  172|      2|    if (ctx->bio_core == NULL)
  ------------------
  |  Branch (172:9): [True: 0, False: 2]
  ------------------
  173|      0|        goto err;
  174|      2|#endif
  175|       |
  176|      2|    ctx->drbg_nonce = ossl_prov_drbg_nonce_ctx_new(ctx);
  177|      2|    if (ctx->drbg_nonce == NULL)
  ------------------
  |  Branch (177:9): [True: 0, False: 2]
  ------------------
  178|      0|        goto err;
  179|       |
  180|      2|#ifndef FIPS_MODULE
  181|      2|    ctx->self_test_cb = ossl_self_test_set_callback_new(ctx);
  182|      2|    if (ctx->self_test_cb == NULL)
  ------------------
  |  Branch (182:9): [True: 0, False: 2]
  ------------------
  183|      0|        goto err;
  184|      2|    ctx->indicator_cb = ossl_indicator_set_callback_new(ctx);
  185|      2|    if (ctx->indicator_cb == NULL)
  ------------------
  |  Branch (185:9): [True: 0, False: 2]
  ------------------
  186|      0|        goto err;
  187|      2|#endif
  188|       |
  189|       |#ifdef FIPS_MODULE
  190|       |    ctx->thread_event_handler = ossl_thread_event_ctx_new(ctx);
  191|       |    if (ctx->thread_event_handler == NULL)
  192|       |        goto err;
  193|       |
  194|       |    ctx->fips_prov = ossl_fips_prov_ossl_ctx_new(ctx);
  195|       |    if (ctx->fips_prov == NULL)
  196|       |        goto err;
  197|       |#endif
  198|       |
  199|      2|#ifndef OPENSSL_NO_THREAD_POOL
  200|      2|    ctx->threads = ossl_threads_ctx_new(ctx);
  201|      2|    if (ctx->threads == NULL)
  ------------------
  |  Branch (201:9): [True: 0, False: 2]
  ------------------
  202|      0|        goto err;
  203|      2|#endif
  204|       |
  205|       |    /* Low priority. */
  206|      2|#ifndef FIPS_MODULE
  207|      2|    ctx->child_provider = ossl_child_prov_ctx_new(ctx);
  208|      2|    if (ctx->child_provider == NULL)
  ------------------
  |  Branch (208:9): [True: 0, False: 2]
  ------------------
  209|      0|        goto err;
  210|      2|#endif
  211|       |
  212|       |    /* Everything depends on properties, so we also pre-initialise that */
  213|      2|    if (!ossl_property_parse_init(ctx))
  ------------------
  |  Branch (213:9): [True: 0, False: 2]
  ------------------
  214|      0|        goto err;
  215|       |
  216|      2|#ifndef FIPS_MODULE
  217|      2|    ctx->comp_methods = ossl_load_builtin_compressions();
  218|      2|#endif
  219|       |
  220|      2|    return 1;
  221|       |
  222|      0| err:
  223|      0|    context_deinit_objs(ctx);
  224|       |
  225|      0|    if (exdata_done)
  ------------------
  |  Branch (225:9): [True: 0, False: 0]
  ------------------
  226|      0|        ossl_crypto_cleanup_all_ex_data_int(ctx);
  227|       |
  228|      0|    CRYPTO_THREAD_lock_free(ctx->lock);
  229|      0|    CRYPTO_THREAD_cleanup_local(&ctx->rcu_local_key);
  230|      0|    memset(ctx, '\0', sizeof(*ctx));
  231|      0|    return 0;
  232|      2|}
context.c:default_context_do_init:
  395|      2|{
  396|      2|    if (!CRYPTO_THREAD_init_local(&default_context_thread_local, NULL))
  ------------------
  |  Branch (396:9): [True: 0, False: 2]
  ------------------
  397|      0|        goto err;
  398|       |
  399|      2|    if (!context_init(&default_context_int))
  ------------------
  |  Branch (399:9): [True: 0, False: 2]
  ------------------
  400|      0|        goto deinit_thread;
  401|       |
  402|      2|    default_context_inited = 1;
  403|      2|    return 1;
  404|       |
  405|      0|deinit_thread:
  406|      0|    CRYPTO_THREAD_cleanup_local(&default_context_thread_local);
  407|      0|err:
  408|      0|    return 0;
  409|      0|}
context.c:get_default_context:
  429|      2|{
  430|      2|    OSSL_LIB_CTX *current_defctx = get_thread_default_context();
  431|       |
  432|      2|    if (current_defctx == NULL && default_context_inited)
  ------------------
  |  Branch (432:9): [True: 2, False: 0]
  |  Branch (432:35): [True: 2, False: 0]
  ------------------
  433|      2|        current_defctx = &default_context_int;
  434|      2|    return current_defctx;
  435|      2|}
context.c:get_thread_default_context:
  421|      2|{
  422|      2|    if (!RUN_ONCE(&default_context_init, default_context_do_init))
  ------------------
  |  |  130|      2|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 2, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (422:9): [True: 0, False: 2]
  ------------------
  423|      0|        return NULL;
  424|       |
  425|      2|    return CRYPTO_THREAD_get_local(&default_context_thread_local);
  426|      2|}

ossl_stored_namemap_new:
   56|      2|{
   57|      2|    OSSL_NAMEMAP *namemap = ossl_namemap_new(libctx);
   58|       |
   59|      2|    if (namemap != NULL)
  ------------------
  |  Branch (59:9): [True: 2, False: 0]
  ------------------
   60|      2|        namemap->stored = 1;
   61|       |
   62|      2|    return namemap;
   63|      2|}
ossl_stored_namemap_free:
   66|      2|{
   67|      2|    OSSL_NAMEMAP *namemap = vnamemap;
   68|       |
   69|      2|    if (namemap != NULL) {
  ------------------
  |  Branch (69:9): [True: 2, False: 0]
  ------------------
   70|       |        /* Pretend it isn't stored, or ossl_namemap_free() will do nothing */
   71|      2|        namemap->stored = 0;
   72|      2|        ossl_namemap_free(namemap);
   73|      2|    }
   74|      2|}
ossl_namemap_new:
  522|      2|{
  523|      2|    OSSL_NAMEMAP *namemap;
  524|      2|    HT_CONFIG htconf = { NULL, NULL, NULL, NAMEMAP_HT_BUCKETS, 1, 1 };
  ------------------
  |  |   16|      2|#define NAMEMAP_HT_BUCKETS 2048
  ------------------
  525|       |
  526|      2|    htconf.ctx = libctx;
  527|       |
  528|      2|    if ((namemap = OPENSSL_zalloc(sizeof(*namemap))) == NULL)
  ------------------
  |  |  104|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (528:9): [True: 0, False: 2]
  ------------------
  529|      0|        goto err;
  530|       |
  531|      2|    if ((namemap->lock = CRYPTO_THREAD_lock_new()) == NULL)
  ------------------
  |  Branch (531:9): [True: 0, False: 2]
  ------------------
  532|      0|        goto err;
  533|       |
  534|      2|    if ((namemap->namenum_ht = ossl_ht_new(&htconf)) == NULL)
  ------------------
  |  Branch (534:9): [True: 0, False: 2]
  ------------------
  535|      0|        goto err;
  536|       |
  537|      2|    if ((namemap->numnames = sk_NAMES_new_null()) == NULL)
  ------------------
  |  Branch (537:9): [True: 0, False: 2]
  ------------------
  538|      0|        goto err;
  539|       |
  540|      2|    return namemap;
  541|       |
  542|      0| err:
  543|      0|    ossl_namemap_free(namemap);
  544|      0|    return NULL;
  545|      2|}
ossl_namemap_free:
  548|      2|{
  549|      2|    if (namemap == NULL || namemap->stored)
  ------------------
  |  Branch (549:9): [True: 0, False: 2]
  |  Branch (549:28): [True: 0, False: 2]
  ------------------
  550|      0|        return;
  551|       |
  552|      2|    sk_NAMES_pop_free(namemap->numnames, names_free);
  553|       |
  554|      2|    ossl_ht_free(namemap->namenum_ht);
  555|       |
  556|      2|    CRYPTO_THREAD_lock_free(namemap->lock);
  557|      2|    OPENSSL_free(namemap);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  558|      2|}

ossl_err_load_CRYPTO_strings:
   83|      2|{
   84|      2|#ifndef OPENSSL_NO_ERR
   85|      2|    if (ERR_reason_error_string(CRYPTO_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (85:9): [True: 2, False: 0]
  ------------------
   86|      2|        ERR_load_strings_const(CRYPTO_str_reasons);
   87|      2|#endif
   88|      2|    return 1;
   89|      2|}

OPENSSL_cpuid_setup:
   96|      2|{
   97|      2|    static int trigger = 0;
   98|      2|    IA32CAP OPENSSL_ia32_cpuid(unsigned int *);
   99|      2|    IA32CAP vec;
  100|      2|    const variant_char *env;
  101|      2|    int index = 2;
  102|       |
  103|      2|    if (trigger)
  ------------------
  |  Branch (103:9): [True: 0, False: 2]
  ------------------
  104|      0|        return;
  105|       |
  106|      2|    trigger = 1;
  107|      2|    if ((env = ossl_getenv("OPENSSL_ia32cap")) != NULL) {
  ------------------
  |  |   47|      2|#   define ossl_getenv getenv
  ------------------
  |  Branch (107:9): [True: 0, False: 2]
  ------------------
  108|      0|        int off = (env[0] == '~') ? 1 : 0;
  ------------------
  |  Branch (108:19): [True: 0, False: 0]
  ------------------
  109|       |
  110|      0|        vec = ossl_strtouint64(env + off);
  111|       |
  112|      0|        if (off) {
  ------------------
  |  Branch (112:13): [True: 0, False: 0]
  ------------------
  113|      0|            IA32CAP mask = vec;
  114|      0|            vec = OPENSSL_ia32_cpuid(OPENSSL_ia32cap_P) & ~mask;
  115|      0|            if (mask & (1<<24)) {
  ------------------
  |  Branch (115:17): [True: 0, False: 0]
  ------------------
  116|       |                /*
  117|       |                 * User disables FXSR bit, mask even other capabilities
  118|       |                 * that operate exclusively on XMM, so we don't have to
  119|       |                 * double-check all the time. We mask PCLMULQDQ, AMD XOP,
  120|       |                 * AES-NI and AVX. Formally speaking we don't have to
  121|       |                 * do it in x86_64 case, but we can safely assume that
  122|       |                 * x86_64 users won't actually flip this flag.
  123|       |                 */
  124|      0|                vec &= ~((IA32CAP)(1<<1|1<<11|1<<25|1<<28) << 32);
  125|      0|            }
  126|      0|        } else if (env[0] == ':') {
  ------------------
  |  Branch (126:20): [True: 0, False: 0]
  ------------------
  127|      0|            vec = OPENSSL_ia32_cpuid(OPENSSL_ia32cap_P);
  128|      0|        }
  129|       |
  130|       |        /* Processed indexes 0, 1 */
  131|      0|        if ((env = ossl_strchr(env, ':')) != NULL)
  ------------------
  |  Branch (131:13): [True: 0, False: 0]
  ------------------
  132|      0|            env++;
  133|      0|        for (; index < OPENSSL_IA32CAP_P_MAX_INDEXES; index += 2) {
  ------------------
  |  |   39|      0|#  define OPENSSL_IA32CAP_P_MAX_INDEXES 10
  ------------------
  |  Branch (133:16): [True: 0, False: 0]
  ------------------
  134|      0|            if ((env != NULL) && (env[0] != '\0')) {
  ------------------
  |  Branch (134:17): [True: 0, False: 0]
  |  Branch (134:34): [True: 0, False: 0]
  ------------------
  135|       |                /* if env[0] == ':' current index is skipped */
  136|      0|                if (env[0] != ':') {
  ------------------
  |  Branch (136:21): [True: 0, False: 0]
  ------------------
  137|      0|                    IA32CAP vecx;
  138|       |
  139|      0|                    off = (env[0] == '~') ? 1 : 0;
  ------------------
  |  Branch (139:27): [True: 0, False: 0]
  ------------------
  140|      0|                    vecx = ossl_strtouint64(env + off);
  141|      0|                    if (off) {
  ------------------
  |  Branch (141:25): [True: 0, False: 0]
  ------------------
  142|      0|                        OPENSSL_ia32cap_P[index] &= ~(unsigned int)vecx;
  143|      0|                        OPENSSL_ia32cap_P[index + 1] &= ~(unsigned int)(vecx >> 32);
  144|      0|                    } else {
  145|      0|                        OPENSSL_ia32cap_P[index] = (unsigned int)vecx;
  146|      0|                        OPENSSL_ia32cap_P[index + 1] = (unsigned int)(vecx >> 32);
  147|      0|                    }
  148|      0|                }
  149|       |                /* skip delimeter */
  150|      0|                if ((env = ossl_strchr(env, ':')) != NULL)
  ------------------
  |  Branch (150:21): [True: 0, False: 0]
  ------------------
  151|      0|                    env++;
  152|      0|            } else { /* zeroize the next two indexes */
  153|      0|                OPENSSL_ia32cap_P[index] = 0;
  154|      0|                OPENSSL_ia32cap_P[index + 1] = 0;
  155|      0|            }
  156|      0|        }
  157|       |
  158|       |        /* If AVX10 is disabled, zero out its detailed cap bits */
  159|      0|        if (!(OPENSSL_ia32cap_P[6] & (1 << 19)))
  ------------------
  |  Branch (159:13): [True: 0, False: 0]
  ------------------
  160|      0|            OPENSSL_ia32cap_P[9] = 0;
  161|      2|    } else {
  162|      2|        vec = OPENSSL_ia32_cpuid(OPENSSL_ia32cap_P);
  163|      2|    }
  164|       |
  165|       |    /*
  166|       |     * |(1<<10) sets a reserved bit to signal that variable
  167|       |     * was initialized already... This is to avoid interference
  168|       |     * with cpuid snippets in ELF .init segment.
  169|       |     */
  170|      2|    OPENSSL_ia32cap_P[0] = (unsigned int)vec | (1 << 10);
  171|      2|    OPENSSL_ia32cap_P[1] = (unsigned int)(vec >> 32);
  172|      2|}

ossl_err_load_CRMF_strings:
   78|      2|{
   79|      2|# ifndef OPENSSL_NO_ERR
   80|      2|    if (ERR_reason_error_string(CRMF_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (80:9): [True: 2, False: 0]
  ------------------
   81|      2|        ERR_load_strings_const(CRMF_str_reasons);
   82|      2|# endif
   83|      2|    return 1;
   84|      2|}

ossl_err_load_CT_strings:
   52|      2|{
   53|      2|# ifndef OPENSSL_NO_ERR
   54|      2|    if (ERR_reason_error_string(CT_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (54:9): [True: 2, False: 0]
  ------------------
   55|      2|        ERR_load_strings_const(CT_str_reasons);
   56|      2|# endif
   57|      2|    return 1;
   58|      2|}

ossl_err_load_DH_strings:
   68|      2|{
   69|      2|# ifndef OPENSSL_NO_ERR
   70|      2|    if (ERR_reason_error_string(DH_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (70:9): [True: 2, False: 0]
  ------------------
   71|      2|        ERR_load_strings_const(DH_str_reasons);
   72|      2|# endif
   73|      2|    return 1;
   74|      2|}

ossl_err_load_DSA_strings:
   46|      2|{
   47|      2|# ifndef OPENSSL_NO_ERR
   48|      2|    if (ERR_reason_error_string(DSA_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (48:9): [True: 2, False: 0]
  ------------------
   49|      2|        ERR_load_strings_const(DSA_str_reasons);
   50|      2|# endif
   51|      2|    return 1;
   52|      2|}

ossl_err_load_DSO_strings:
   50|      2|{
   51|      2|#ifndef OPENSSL_NO_ERR
   52|      2|    if (ERR_reason_error_string(DSO_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (52:9): [True: 2, False: 0]
  ------------------
   53|      2|        ERR_load_strings_const(DSO_str_reasons);
   54|      2|#endif
   55|      2|    return 1;
   56|      2|}

ossl_err_load_EC_strings:
  127|      2|{
  128|      2|# ifndef OPENSSL_NO_ERR
  129|      2|    if (ERR_reason_error_string(EC_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (129:9): [True: 2, False: 0]
  ------------------
  130|      2|        ERR_load_strings_const(EC_str_reasons);
  131|      2|# endif
  132|      2|    return 1;
  133|      2|}

ossl_decoder_cache_new:
  703|      2|{
  704|      2|    DECODER_CACHE *cache = OPENSSL_malloc(sizeof(*cache));
  ------------------
  |  |  102|      2|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  705|       |
  706|      2|    if (cache == NULL)
  ------------------
  |  Branch (706:9): [True: 0, False: 2]
  ------------------
  707|      0|        return NULL;
  708|       |
  709|      2|    cache->lock = CRYPTO_THREAD_lock_new();
  710|      2|    if (cache->lock == NULL) {
  ------------------
  |  Branch (710:9): [True: 0, False: 2]
  ------------------
  711|      0|        OPENSSL_free(cache);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  712|      0|        return NULL;
  713|      0|    }
  714|      2|    cache->hashtable = lh_DECODER_CACHE_ENTRY_new(decoder_cache_entry_hash,
  715|      2|                                                  decoder_cache_entry_cmp);
  716|      2|    if (cache->hashtable == NULL) {
  ------------------
  |  Branch (716:9): [True: 0, False: 2]
  ------------------
  717|      0|        CRYPTO_THREAD_lock_free(cache->lock);
  718|      0|        OPENSSL_free(cache);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  719|      0|        return NULL;
  720|      0|    }
  721|       |
  722|      2|    return cache;
  723|      2|}
ossl_decoder_cache_free:
  726|      2|{
  727|      2|    DECODER_CACHE *cache = (DECODER_CACHE *)vcache;
  728|       |
  729|      2|    lh_DECODER_CACHE_ENTRY_doall(cache->hashtable, decoder_cache_entry_free);
  730|      2|    lh_DECODER_CACHE_ENTRY_free(cache->hashtable);
  731|      2|    CRYPTO_THREAD_lock_free(cache->lock);
  732|      2|    OPENSSL_free(cache);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  733|      2|}

ossl_err_load_ENGINE_strings:
   85|      2|{
   86|      2|# ifndef OPENSSL_NO_ERR
   87|      2|    if (ERR_reason_error_string(ENGINE_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (87:9): [True: 2, False: 0]
  ------------------
   88|      2|        ERR_load_strings_const(ENGINE_str_reasons);
   89|      2|# endif
   90|      2|    return 1;
   91|      2|}

engine_cleanup_int:
  176|      2|{
  177|      2|    if (int_cleanup_check(0)) {
  ------------------
  |  Branch (177:9): [True: 0, False: 2]
  ------------------
  178|      0|        sk_ENGINE_CLEANUP_ITEM_pop_free(cleanup_stack,
  179|      0|                                        engine_cleanup_cb_free);
  180|      0|        cleanup_stack = NULL;
  181|      0|    }
  182|      2|    CRYPTO_THREAD_lock_free(global_engine_lock);
  183|      2|    global_engine_lock = NULL;
  184|      2|}
eng_lib.c:int_cleanup_check:
  119|      2|{
  120|      2|    if (cleanup_stack)
  ------------------
  |  Branch (120:9): [True: 0, False: 2]
  ------------------
  121|      0|        return 1;
  122|      2|    if (!create)
  ------------------
  |  Branch (122:9): [True: 2, False: 0]
  ------------------
  123|      2|        return 0;
  124|      0|    cleanup_stack = sk_ENGINE_CLEANUP_ITEM_new_null();
  125|      0|    return (cleanup_stack ? 1 : 0);
  ------------------
  |  Branch (125:13): [True: 0, False: 0]
  ------------------
  126|      2|}

OSSL_ERR_STATE_free:
  202|      2|{
  203|      2|    int i;
  204|       |
  205|      2|    if (state == NULL)
  ------------------
  |  Branch (205:9): [True: 0, False: 2]
  ------------------
  206|      0|        return;
  207|     34|    for (i = 0; i < ERR_NUM_ERRORS; i++) {
  ------------------
  |  |   55|     34|#  define ERR_NUM_ERRORS  16
  ------------------
  |  Branch (207:17): [True: 32, False: 2]
  ------------------
  208|     32|        err_clear(state, i, 1);
  209|     32|    }
  210|      2|    CRYPTO_free(state, OPENSSL_FILE, OPENSSL_LINE);
  ------------------
  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  ------------------
                  CRYPTO_free(state, OPENSSL_FILE, OPENSSL_LINE);
  ------------------
  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  ------------------
  211|      2|}
err_cleanup:
  233|      2|{
  234|      2|    if (set_err_thread_local != 0)
  ------------------
  |  Branch (234:9): [True: 2, False: 0]
  ------------------
  235|      2|        CRYPTO_THREAD_cleanup_local(&err_thread_local);
  236|      2|    CRYPTO_THREAD_lock_free(err_string_lock);
  237|      2|    err_string_lock = NULL;
  238|      2|#ifndef OPENSSL_NO_ERR
  239|      2|    lh_ERR_STRING_DATA_free(int_error_hash);
  ------------------
  |  |  376|      2|#define lh_ERR_STRING_DATA_free(lh) OPENSSL_LH_free(ossl_check_ERR_STRING_DATA_lh_type(lh))
  ------------------
  240|      2|    int_error_hash = NULL;
  241|      2|#endif
  242|      2|}
ossl_err_load_ERR_strings:
  272|     70|{
  273|     70|#ifndef OPENSSL_NO_ERR
  274|     70|    if (!RUN_ONCE(&err_string_init, do_err_strings_init))
  ------------------
  |  |  130|     70|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 70, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (274:9): [True: 0, False: 70]
  ------------------
  275|      0|        return 0;
  276|       |
  277|     70|    err_load_strings(ERR_str_libraries);
  278|     70|    err_load_strings(ERR_str_reasons);
  279|     70|#endif
  280|     70|    return 1;
  281|     70|}
ERR_load_strings_const:
  297|     68|{
  298|     68|#ifndef OPENSSL_NO_ERR
  299|     68|    if (ossl_err_load_ERR_strings() == 0)
  ------------------
  |  Branch (299:9): [True: 0, False: 68]
  ------------------
  300|      0|        return 0;
  301|     68|    err_load_strings(str);
  302|     68|#endif
  303|       |
  304|     68|    return 1;
  305|     68|}
ERR_clear_error:
  335|  3.02k|{
  336|  3.02k|    int i;
  337|  3.02k|    ERR_STATE *es;
  338|       |
  339|  3.02k|    es = ossl_err_get_state_int();
  340|  3.02k|    if (es == NULL)
  ------------------
  |  Branch (340:9): [True: 0, False: 3.02k]
  ------------------
  341|      0|        return;
  342|       |
  343|  51.4k|    for (i = 0; i < ERR_NUM_ERRORS; i++) {
  ------------------
  |  |   55|  51.4k|#  define ERR_NUM_ERRORS  16
  ------------------
  |  Branch (343:17): [True: 48.4k, False: 3.02k]
  ------------------
  344|  48.4k|        err_clear(es, i, 0);
  345|  48.4k|    }
  346|  3.02k|    es->top = es->bottom = 0;
  347|  3.02k|}
ERR_reason_error_string:
  613|     68|{
  614|     68|#ifndef OPENSSL_NO_ERR
  615|     68|    ERR_STRING_DATA d, *p = NULL;
  616|     68|    unsigned long l, r;
  617|       |
  618|     68|    if (!RUN_ONCE(&err_string_init, do_err_strings_init)) {
  ------------------
  |  |  130|     68|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 68, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (618:9): [True: 0, False: 68]
  ------------------
  619|      0|        return NULL;
  620|      0|    }
  621|       |
  622|       |    /*
  623|       |     * ERR_reason_error_string() can't safely return system error strings,
  624|       |     * since openssl_strerror_r() needs a buffer for thread safety, and we
  625|       |     * haven't got one that would serve any sensible purpose.
  626|       |     */
  627|     68|    if (ERR_SYSTEM_ERROR(e))
  ------------------
  |  |  239|     68|# define ERR_SYSTEM_ERROR(errcode)      (((errcode) & ERR_SYSTEM_FLAG) != 0)
  |  |  ------------------
  |  |  |  |  218|     68|# define ERR_SYSTEM_FLAG                ((unsigned int)INT_MAX + 1)
  |  |  ------------------
  |  |  |  Branch (239:41): [True: 0, False: 68]
  |  |  ------------------
  ------------------
  628|      0|        return NULL;
  629|       |
  630|     68|    l = ERR_GET_LIB(e);
  631|     68|    r = ERR_GET_REASON(e);
  632|     68|    d.error = ERR_PACK(l, 0, r);
  ------------------
  |  |  279|     68|    ( (((unsigned long)(lib)    & ERR_LIB_MASK   ) << ERR_LIB_OFFSET) | \
  |  |  ------------------
  |  |  |  |  227|     68|# define ERR_LIB_MASK                   0xFF
  |  |  ------------------
  |  |                   ( (((unsigned long)(lib)    & ERR_LIB_MASK   ) << ERR_LIB_OFFSET) | \
  |  |  ------------------
  |  |  |  |  226|     68|# define ERR_LIB_OFFSET                 23L
  |  |  ------------------
  |  |  280|     68|      (((unsigned long)(reason) & ERR_REASON_MASK)) )
  |  |  ------------------
  |  |  |  |  230|     68|# define ERR_REASON_MASK                0X7FFFFF
  |  |  ------------------
  ------------------
  633|     68|    p = int_err_get_item(&d);
  634|     68|    if (p == NULL) {
  ------------------
  |  Branch (634:9): [True: 68, False: 0]
  ------------------
  635|     68|        d.error = ERR_PACK(0, 0, r);
  ------------------
  |  |  279|     68|    ( (((unsigned long)(lib)    & ERR_LIB_MASK   ) << ERR_LIB_OFFSET) | \
  |  |  ------------------
  |  |  |  |  227|     68|# define ERR_LIB_MASK                   0xFF
  |  |  ------------------
  |  |                   ( (((unsigned long)(lib)    & ERR_LIB_MASK   ) << ERR_LIB_OFFSET) | \
  |  |  ------------------
  |  |  |  |  226|     68|# define ERR_LIB_OFFSET                 23L
  |  |  ------------------
  |  |  280|     68|      (((unsigned long)(reason) & ERR_REASON_MASK)) )
  |  |  ------------------
  |  |  |  |  230|     68|# define ERR_REASON_MASK                0X7FFFFF
  |  |  ------------------
  ------------------
  636|     68|        p = int_err_get_item(&d);
  637|     68|    }
  638|     68|    return ((p == NULL) ? NULL : p->string);
  ------------------
  |  Branch (638:13): [True: 68, False: 0]
  ------------------
  639|       |#else
  640|       |    return NULL;
  641|       |#endif
  642|     68|}
ossl_err_get_state_int:
  673|  3.02k|{
  674|  3.02k|    ERR_STATE *state;
  675|  3.02k|    int saveerrno = get_last_sys_error();
  ------------------
  |  |   30|  3.02k|# define get_last_sys_error()    errno
  ------------------
  676|       |
  677|  3.02k|    if (!OPENSSL_init_crypto(OPENSSL_INIT_BASE_ONLY, NULL))
  ------------------
  |  |   31|  3.02k|# define OPENSSL_INIT_BASE_ONLY              0x00040000L
  ------------------
  |  Branch (677:9): [True: 0, False: 3.02k]
  ------------------
  678|      0|        return NULL;
  679|       |
  680|  3.02k|    if (!RUN_ONCE(&err_init, err_do_init))
  ------------------
  |  |  130|  3.02k|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 3.02k, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (680:9): [True: 0, False: 3.02k]
  ------------------
  681|      0|        return NULL;
  682|       |
  683|  3.02k|    state = CRYPTO_THREAD_get_local(&err_thread_local);
  684|  3.02k|    if (state == (ERR_STATE*)-1)
  ------------------
  |  Branch (684:9): [True: 0, False: 3.02k]
  ------------------
  685|      0|        return NULL;
  686|       |
  687|  3.02k|    if (state == NULL) {
  ------------------
  |  Branch (687:9): [True: 2, False: 3.02k]
  ------------------
  688|      2|        if (!CRYPTO_THREAD_set_local(&err_thread_local, (ERR_STATE*)-1))
  ------------------
  |  Branch (688:13): [True: 0, False: 2]
  ------------------
  689|      0|            return NULL;
  690|       |
  691|      2|        state = OSSL_ERR_STATE_new();
  692|      2|        if (state == NULL) {
  ------------------
  |  Branch (692:13): [True: 0, False: 2]
  ------------------
  693|      0|            CRYPTO_THREAD_set_local(&err_thread_local, NULL);
  694|      0|            return NULL;
  695|      0|        }
  696|       |
  697|      2|        if (!ossl_init_thread_start(NULL, NULL, err_delete_thread_state)
  ------------------
  |  Branch (697:13): [True: 0, False: 2]
  ------------------
  698|      2|                || !CRYPTO_THREAD_set_local(&err_thread_local, state)) {
  ------------------
  |  Branch (698:20): [True: 0, False: 2]
  ------------------
  699|      0|            OSSL_ERR_STATE_free(state);
  700|      0|            CRYPTO_THREAD_set_local(&err_thread_local, NULL);
  701|      0|            return NULL;
  702|      0|        }
  703|       |
  704|       |        /* Ignore failures from these */
  705|      2|        OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
  ------------------
  |  |  467|      2|# define OPENSSL_INIT_LOAD_CRYPTO_STRINGS    0x00000002L
  ------------------
  706|      2|    }
  707|       |
  708|  3.02k|    set_sys_error(saveerrno);
  ------------------
  |  |   32|  3.02k|# define set_sys_error(e)        errno=(e)
  ------------------
  709|  3.02k|    return state;
  710|  3.02k|}
err_shelve_state:
  725|      2|{
  726|      2|    int saveerrno = get_last_sys_error();
  ------------------
  |  |   30|      2|# define get_last_sys_error()    errno
  ------------------
  727|       |
  728|       |    /*
  729|       |     * Note, at present our only caller is OPENSSL_init_crypto(), indirectly
  730|       |     * via ossl_init_load_crypto_nodelete(), by which point the requested
  731|       |     * "base" initialization has already been performed, so the below call is a
  732|       |     * NOOP, that re-enters OPENSSL_init_crypto() only to quickly return.
  733|       |     *
  734|       |     * If are no other valid callers of this function, the call below can be
  735|       |     * removed, avoiding the re-entry into OPENSSL_init_crypto().  If there are
  736|       |     * potential uses that are not from inside OPENSSL_init_crypto(), then this
  737|       |     * call is needed, but some care is required to make sure that the re-entry
  738|       |     * remains a NOOP.
  739|       |     */
  740|      2|    if (!OPENSSL_init_crypto(OPENSSL_INIT_BASE_ONLY, NULL))
  ------------------
  |  |   31|      2|# define OPENSSL_INIT_BASE_ONLY              0x00040000L
  ------------------
  |  Branch (740:9): [True: 0, False: 2]
  ------------------
  741|      0|        return 0;
  742|       |
  743|      2|    if (!RUN_ONCE(&err_init, err_do_init))
  ------------------
  |  |  130|      2|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 2, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (743:9): [True: 0, False: 2]
  ------------------
  744|      0|        return 0;
  745|       |
  746|      2|    *state = CRYPTO_THREAD_get_local(&err_thread_local);
  747|      2|    if (!CRYPTO_THREAD_set_local(&err_thread_local, (ERR_STATE*)-1))
  ------------------
  |  Branch (747:9): [True: 0, False: 2]
  ------------------
  748|      0|        return 0;
  749|       |
  750|      2|    set_sys_error(saveerrno);
  ------------------
  |  |   32|      2|# define set_sys_error(e)        errno=(e)
  ------------------
  751|      2|    return 1;
  752|      2|}
err_unshelve_state:
  759|      2|{
  760|      2|    if (state != (void*)-1)
  ------------------
  |  Branch (760:9): [True: 2, False: 0]
  ------------------
  761|      2|        CRYPTO_THREAD_set_local(&err_thread_local, (ERR_STATE*)state);
  762|      2|}
err.c:do_err_strings_init:
  214|      2|{
  215|      2|    if (!OPENSSL_init_crypto(OPENSSL_INIT_BASE_ONLY, NULL))
  ------------------
  |  |   31|      2|# define OPENSSL_INIT_BASE_ONLY              0x00040000L
  ------------------
  |  Branch (215:9): [True: 0, False: 2]
  ------------------
  216|      0|        return 0;
  217|      2|    err_string_lock = CRYPTO_THREAD_lock_new();
  218|      2|    if (err_string_lock == NULL)
  ------------------
  |  Branch (218:9): [True: 0, False: 2]
  ------------------
  219|      0|        return 0;
  220|      2|#ifndef OPENSSL_NO_ERR
  221|      2|    int_error_hash = lh_ERR_STRING_DATA_new(err_string_data_hash,
  ------------------
  |  |  375|      2|#define lh_ERR_STRING_DATA_new(hfn, cmp) ((LHASH_OF(ERR_STRING_DATA) *)OPENSSL_LH_set_thunks(OPENSSL_LH_new(ossl_check_ERR_STRING_DATA_lh_hashfunc_type(hfn), ossl_check_ERR_STRING_DATA_lh_compfunc_type(cmp)), lh_ERR_STRING_DATA_hash_thunk, lh_ERR_STRING_DATA_comp_thunk, lh_ERR_STRING_DATA_doall_thunk, lh_ERR_STRING_DATA_doall_arg_thunk))
  ------------------
  222|      2|                                            err_string_data_cmp);
  223|      2|    if (int_error_hash == NULL) {
  ------------------
  |  Branch (223:9): [True: 0, False: 2]
  ------------------
  224|      0|        CRYPTO_THREAD_lock_free(err_string_lock);
  225|      0|        err_string_lock = NULL;
  226|      0|        return 0;
  227|      0|    }
  228|      2|#endif
  229|      2|    return 1;
  230|      2|}
err.c:err_string_data_hash:
  172|  8.75k|{
  173|  8.75k|    unsigned long ret, l;
  174|       |
  175|  8.75k|    l = a->error;
  176|  8.75k|    ret = l ^ ERR_GET_LIB(l);
  177|  8.75k|    return (ret ^ ret % 19 * 13);
  178|  8.75k|}
err.c:err_string_data_cmp:
  182|  5.89k|{
  183|  5.89k|    if (a->error == b->error)
  ------------------
  |  Branch (183:9): [True: 5.57k, False: 316]
  ------------------
  184|  5.57k|        return 0;
  185|    316|    return a->error > b->error ? 1 : -1;
  ------------------
  |  Branch (185:12): [True: 168, False: 148]
  ------------------
  186|  5.89k|}
err.c:err_load_strings:
  260|    208|{
  261|    208|    if (!CRYPTO_THREAD_write_lock(err_string_lock))
  ------------------
  |  Branch (261:9): [True: 0, False: 208]
  ------------------
  262|      0|        return 0;
  263|  8.83k|    for (; str->error; str++)
  ------------------
  |  Branch (263:12): [True: 8.62k, False: 208]
  ------------------
  264|  8.62k|        (void)lh_ERR_STRING_DATA_insert(int_error_hash,
  ------------------
  |  |  378|  8.83k|#define lh_ERR_STRING_DATA_insert(lh, ptr) ((ERR_STRING_DATA *)OPENSSL_LH_insert(ossl_check_ERR_STRING_DATA_lh_type(lh), ossl_check_ERR_STRING_DATA_lh_plain_type(ptr)))
  ------------------
  265|    208|                                       (ERR_STRING_DATA *)str);
  266|    208|    CRYPTO_THREAD_unlock(err_string_lock);
  267|    208|    return 1;
  268|    208|}
err.c:int_err_get_item:
  189|    136|{
  190|    136|    ERR_STRING_DATA *p = NULL;
  191|       |
  192|    136|    if (!CRYPTO_THREAD_read_lock(err_string_lock))
  ------------------
  |  Branch (192:9): [True: 0, False: 136]
  ------------------
  193|      0|        return NULL;
  194|    136|    p = lh_ERR_STRING_DATA_retrieve(int_error_hash, d);
  ------------------
  |  |  380|    136|#define lh_ERR_STRING_DATA_retrieve(lh, ptr) ((ERR_STRING_DATA *)OPENSSL_LH_retrieve(ossl_check_ERR_STRING_DATA_lh_type(lh), ossl_check_const_ERR_STRING_DATA_lh_plain_type(ptr)))
  ------------------
  195|    136|    CRYPTO_THREAD_unlock(err_string_lock);
  196|       |
  197|    136|    return p;
  198|    136|}
err.c:err_do_init:
  667|      2|{
  668|      2|    set_err_thread_local = 1;
  669|      2|    return CRYPTO_THREAD_init_local(&err_thread_local, NULL);
  670|      2|}
err.c:err_delete_thread_state:
  645|      2|{
  646|      2|    ERR_STATE *state = CRYPTO_THREAD_get_local(&err_thread_local);
  647|      2|    if (state == NULL)
  ------------------
  |  Branch (647:9): [True: 0, False: 2]
  ------------------
  648|      0|        return;
  649|       |
  650|      2|    CRYPTO_THREAD_set_local(&err_thread_local, NULL);
  651|      2|    OSSL_ERR_STATE_free(state);
  652|      2|}

ossl_err_load_crypto_strings:
   49|      2|{
   50|      2|    if (0
  ------------------
  |  Branch (50:9): [Folded - Ignored]
  ------------------
   51|      2|#ifndef OPENSSL_NO_ERR
   52|      2|        || ossl_err_load_ERR_strings() == 0 /* include error strings for SYSerr */
  ------------------
  |  Branch (52:12): [True: 0, False: 2]
  ------------------
   53|      2|        || ossl_err_load_BN_strings() == 0
  ------------------
  |  Branch (53:12): [True: 0, False: 2]
  ------------------
   54|      2|        || ossl_err_load_RSA_strings() == 0
  ------------------
  |  Branch (54:12): [True: 0, False: 2]
  ------------------
   55|      2|# ifndef OPENSSL_NO_DH
   56|      2|        || ossl_err_load_DH_strings() == 0
  ------------------
  |  Branch (56:12): [True: 0, False: 2]
  ------------------
   57|      2|# endif
   58|      2|        || ossl_err_load_EVP_strings() == 0
  ------------------
  |  Branch (58:12): [True: 0, False: 2]
  ------------------
   59|      2|        || ossl_err_load_BUF_strings() == 0
  ------------------
  |  Branch (59:12): [True: 0, False: 2]
  ------------------
   60|      2|        || ossl_err_load_OBJ_strings() == 0
  ------------------
  |  Branch (60:12): [True: 0, False: 2]
  ------------------
   61|      2|        || ossl_err_load_PEM_strings() == 0
  ------------------
  |  Branch (61:12): [True: 0, False: 2]
  ------------------
   62|      2|# ifndef OPENSSL_NO_DSA
   63|      2|        || ossl_err_load_DSA_strings() == 0
  ------------------
  |  Branch (63:12): [True: 0, False: 2]
  ------------------
   64|      2|# endif
   65|      2|        || ossl_err_load_X509_strings() == 0
  ------------------
  |  Branch (65:12): [True: 0, False: 2]
  ------------------
   66|      2|        || ossl_err_load_ASN1_strings() == 0
  ------------------
  |  Branch (66:12): [True: 0, False: 2]
  ------------------
   67|      2|        || ossl_err_load_CONF_strings() == 0
  ------------------
  |  Branch (67:12): [True: 0, False: 2]
  ------------------
   68|      2|        || ossl_err_load_CRYPTO_strings() == 0
  ------------------
  |  Branch (68:12): [True: 0, False: 2]
  ------------------
   69|      2|# ifndef OPENSSL_NO_COMP
   70|      2|        || ossl_err_load_COMP_strings() == 0
  ------------------
  |  Branch (70:12): [True: 0, False: 2]
  ------------------
   71|      2|# endif
   72|      2|# ifndef OPENSSL_NO_EC
   73|      2|        || ossl_err_load_EC_strings() == 0
  ------------------
  |  Branch (73:12): [True: 0, False: 2]
  ------------------
   74|      2|# endif
   75|       |        /* skip ossl_err_load_SSL_strings() because it is not in this library */
   76|      2|        || ossl_err_load_BIO_strings() == 0
  ------------------
  |  Branch (76:12): [True: 0, False: 2]
  ------------------
   77|      2|        || ossl_err_load_PKCS7_strings() == 0
  ------------------
  |  Branch (77:12): [True: 0, False: 2]
  ------------------
   78|      2|        || ossl_err_load_X509V3_strings() == 0
  ------------------
  |  Branch (78:12): [True: 0, False: 2]
  ------------------
   79|      2|        || ossl_err_load_PKCS12_strings() == 0
  ------------------
  |  Branch (79:12): [True: 0, False: 2]
  ------------------
   80|      2|        || ossl_err_load_RAND_strings() == 0
  ------------------
  |  Branch (80:12): [True: 0, False: 2]
  ------------------
   81|      2|        || ossl_err_load_DSO_strings() == 0
  ------------------
  |  Branch (81:12): [True: 0, False: 2]
  ------------------
   82|      2|# ifndef OPENSSL_NO_TS
   83|      2|        || ossl_err_load_TS_strings() == 0
  ------------------
  |  Branch (83:12): [True: 0, False: 2]
  ------------------
   84|      2|# endif
   85|      2|# ifndef OPENSSL_NO_ENGINE
   86|      2|        || ossl_err_load_ENGINE_strings() == 0
  ------------------
  |  Branch (86:12): [True: 0, False: 2]
  ------------------
   87|      2|# endif
   88|      2|# ifndef OPENSSL_NO_HTTP
   89|      2|        || ossl_err_load_HTTP_strings() == 0
  ------------------
  |  Branch (89:12): [True: 0, False: 2]
  ------------------
   90|      2|# endif
   91|      2|# ifndef OPENSSL_NO_OCSP
   92|      2|        || ossl_err_load_OCSP_strings() == 0
  ------------------
  |  Branch (92:12): [True: 0, False: 2]
  ------------------
   93|      2|# endif
   94|      2|        || ossl_err_load_UI_strings() == 0
  ------------------
  |  Branch (94:12): [True: 0, False: 2]
  ------------------
   95|      2|# ifndef OPENSSL_NO_CMS
   96|      2|        || ossl_err_load_CMS_strings() == 0
  ------------------
  |  Branch (96:12): [True: 0, False: 2]
  ------------------
   97|      2|# endif
   98|      2|# ifndef OPENSSL_NO_CRMF
   99|      2|        || ossl_err_load_CRMF_strings() == 0
  ------------------
  |  Branch (99:12): [True: 0, False: 2]
  ------------------
  100|      2|        || ossl_err_load_CMP_strings() == 0
  ------------------
  |  Branch (100:12): [True: 0, False: 2]
  ------------------
  101|      2|# endif
  102|      2|# ifndef OPENSSL_NO_CT
  103|      2|        || ossl_err_load_CT_strings() == 0
  ------------------
  |  Branch (103:12): [True: 0, False: 2]
  ------------------
  104|      2|# endif
  105|      2|        || ossl_err_load_ESS_strings() == 0
  ------------------
  |  Branch (105:12): [True: 0, False: 2]
  ------------------
  106|      2|        || ossl_err_load_ASYNC_strings() == 0
  ------------------
  |  Branch (106:12): [True: 0, False: 2]
  ------------------
  107|      2|        || ossl_err_load_OSSL_STORE_strings() == 0
  ------------------
  |  Branch (107:12): [True: 0, False: 2]
  ------------------
  108|      2|        || ossl_err_load_PROP_strings() == 0
  ------------------
  |  Branch (108:12): [True: 0, False: 2]
  ------------------
  109|      2|        || ossl_err_load_PROV_strings() == 0
  ------------------
  |  Branch (109:12): [True: 0, False: 2]
  ------------------
  110|      2|#endif
  111|      2|        )
  112|      0|        return 0;
  113|       |
  114|      2|    return 1;
  115|      2|}

err.c:err_clear:
   85|  48.4k|{
   86|  48.4k|    err_clear_data(es, i, (deall));
   87|  48.4k|    es->err_marks[i] = 0;
   88|  48.4k|    es->err_flags[i] = 0;
   89|  48.4k|    es->err_buffer[i] = 0;
   90|  48.4k|    es->err_line[i] = -1;
   91|  48.4k|    OPENSSL_free(es->err_file[i]);
  ------------------
  |  |  115|  48.4k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|  48.4k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|  48.4k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   92|  48.4k|    es->err_file[i] = NULL;
   93|  48.4k|    OPENSSL_free(es->err_func[i]);
  ------------------
  |  |  115|  48.4k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|  48.4k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|  48.4k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   94|  48.4k|    es->err_func[i] = NULL;
   95|  48.4k|}
err.c:err_clear_data:
   22|  48.4k|{
   23|  48.4k|    if (es->err_data_flags[i] & ERR_TXT_MALLOCED) {
  ------------------
  |  |   48|  48.4k|# define ERR_TXT_MALLOCED        0x01
  ------------------
  |  Branch (23:9): [True: 0, False: 48.4k]
  ------------------
   24|      0|        if (deall) {
  ------------------
  |  Branch (24:13): [True: 0, False: 0]
  ------------------
   25|      0|            OPENSSL_free(es->err_data[i]);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   26|      0|            es->err_data[i] = NULL;
   27|      0|            es->err_data_size[i] = 0;
   28|      0|            es->err_data_flags[i] = 0;
   29|      0|        } else if (es->err_data[i] != NULL) {
  ------------------
  |  Branch (29:20): [True: 0, False: 0]
  ------------------
   30|      0|            es->err_data[i][0] = '\0';
   31|      0|            es->err_data_flags[i] = ERR_TXT_MALLOCED;
  ------------------
  |  |   48|      0|# define ERR_TXT_MALLOCED        0x01
  ------------------
   32|      0|        }
   33|  48.4k|    } else {
   34|  48.4k|        es->err_data[i] = NULL;
   35|  48.4k|        es->err_data_size[i] = 0;
   36|  48.4k|        es->err_data_flags[i] = 0;
   37|  48.4k|    }
   38|  48.4k|}

OSSL_ERR_STATE_new:
   22|      2|{
   23|      2|    return CRYPTO_zalloc(sizeof(ERR_STATE), NULL, 0);
   24|      2|}

ossl_err_load_ESS_strings:
   42|      2|{
   43|      2|#ifndef OPENSSL_NO_ERR
   44|      2|    if (ERR_reason_error_string(ESS_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (44:9): [True: 2, False: 0]
  ------------------
   45|      2|        ERR_load_strings_const(ESS_str_reasons);
   46|      2|#endif
   47|      2|    return 1;
   48|      2|}

ossl_err_load_EVP_strings:
  227|      2|{
  228|      2|#ifndef OPENSSL_NO_ERR
  229|      2|    if (ERR_reason_error_string(EVP_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (229:9): [True: 2, False: 0]
  ------------------
  230|      2|        ERR_load_strings_const(EVP_str_reasons);
  231|      2|#endif
  232|      2|    return 1;
  233|      2|}

EVP_PBE_cleanup:
  296|      2|{
  297|      2|    sk_EVP_PBE_CTL_pop_free(pbe_algs, free_evp_pbe_ctl);
  298|      2|    pbe_algs = NULL;
  299|      2|}

EVP_RAND_CTX_free:
  386|      4|{
  387|      4|    int ref = 0;
  388|      4|    EVP_RAND_CTX *parent;
  389|       |
  390|      4|    if (ctx == NULL)
  ------------------
  |  Branch (390:9): [True: 4, False: 0]
  ------------------
  391|      4|        return;
  392|       |
  393|      0|    CRYPTO_DOWN_REF(&ctx->refcnt, &ref);
  394|      0|    if (ref > 0)
  ------------------
  |  Branch (394:9): [True: 0, False: 0]
  ------------------
  395|      0|        return;
  396|      0|    parent = ctx->parent;
  397|      0|    ctx->meth->freectx(ctx->algctx);
  398|      0|    ctx->algctx = NULL;
  399|      0|    EVP_RAND_free(ctx->meth);
  400|      0|    CRYPTO_FREE_REF(&ctx->refcnt);
  401|      0|    OPENSSL_free(ctx);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  402|      0|    EVP_RAND_CTX_free(parent);
  403|      0|}

evp_cleanup_int:
  180|      2|{
  181|      2|    OBJ_NAME_cleanup(OBJ_NAME_TYPE_KDF_METH);
  ------------------
  |  |   30|      2|# define OBJ_NAME_TYPE_KDF_METH          0x06
  ------------------
  182|      2|    OBJ_NAME_cleanup(OBJ_NAME_TYPE_CIPHER_METH);
  ------------------
  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  ------------------
  183|      2|    OBJ_NAME_cleanup(OBJ_NAME_TYPE_MD_METH);
  ------------------
  |  |   25|      2|# define OBJ_NAME_TYPE_MD_METH           0x01
  ------------------
  184|       |    /*
  185|       |     * The above calls will only clean out the contents of the name hash
  186|       |     * table, but not the hash table itself.  The following line does that
  187|       |     * part.  -- Richard Levitte
  188|       |     */
  189|      2|    OBJ_NAME_cleanup(-1);
  190|       |
  191|      2|    EVP_PBE_cleanup();
  192|      2|    OBJ_sigid_free();
  193|       |
  194|      2|    evp_app_cleanup_int();
  195|      2|}

evp_app_cleanup_int:
  633|      2|{
  634|      2|    if (app_pkey_methods != NULL)
  ------------------
  |  Branch (634:9): [True: 0, False: 2]
  ------------------
  635|      0|        sk_EVP_PKEY_METHOD_pop_free(app_pkey_methods, EVP_PKEY_meth_free);
  636|      2|}

ossl_do_ex_data_init:
   15|      2|{
   16|      2|    OSSL_EX_DATA_GLOBAL *global = ossl_lib_ctx_get_ex_data_global(ctx);
   17|       |
   18|      2|    if (global == NULL)
  ------------------
  |  Branch (18:9): [True: 0, False: 2]
  ------------------
   19|      0|        return 0;
   20|       |
   21|      2|    global->ex_data_lock = CRYPTO_THREAD_lock_new();
   22|      2|    return global->ex_data_lock != NULL;
   23|      2|}
ossl_crypto_cleanup_all_ex_data_int:
   73|      2|{
   74|      2|    int i;
   75|      2|    OSSL_EX_DATA_GLOBAL *global = ossl_lib_ctx_get_ex_data_global(ctx);
   76|       |
   77|      2|    if (global == NULL)
  ------------------
  |  Branch (77:9): [True: 0, False: 2]
  ------------------
   78|      0|        return;
   79|       |
   80|     38|    for (i = 0; i < CRYPTO_EX_INDEX__COUNT; ++i) {
  ------------------
  |  |  248|     38|# define CRYPTO_EX_INDEX__COUNT          18
  ------------------
  |  Branch (80:17): [True: 36, False: 2]
  ------------------
   81|     36|        EX_CALLBACKS *ip = &global->ex_data[i];
   82|       |
   83|     36|        sk_EX_CALLBACK_pop_free(ip->meth, cleanup_cb);
   84|     36|        ip->meth = NULL;
   85|     36|    }
   86|       |
   87|      2|    CRYPTO_THREAD_lock_free(global->ex_data_lock);
   88|      2|    global->ex_data_lock = NULL;
   89|      2|}

ossl_ht_new:
  176|      2|{
  177|      2|    HT *new = OPENSSL_zalloc(sizeof(*new));
  ------------------
  |  |  104|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  178|       |
  179|      2|    if (new == NULL)
  ------------------
  |  Branch (179:9): [True: 0, False: 2]
  ------------------
  180|      0|        return NULL;
  181|       |
  182|      2|    new->atomic_lock = CRYPTO_THREAD_lock_new();
  183|      2|    if (new->atomic_lock == NULL)
  ------------------
  |  Branch (183:9): [True: 0, False: 2]
  ------------------
  184|      0|        goto err;
  185|       |
  186|      2|    memcpy(&new->config, conf, sizeof(*conf));
  187|       |
  188|      2|    if (new->config.init_neighborhoods != 0) {
  ------------------
  |  Branch (188:9): [True: 2, False: 0]
  ------------------
  189|      2|        new->wpd.neighborhood_len = new->config.init_neighborhoods;
  190|       |        /* round up to the next power of 2 */
  191|      2|        new->wpd.neighborhood_len--;
  192|      2|        new->wpd.neighborhood_len |= new->wpd.neighborhood_len >> 1;
  193|      2|        new->wpd.neighborhood_len |= new->wpd.neighborhood_len >> 2;
  194|      2|        new->wpd.neighborhood_len |= new->wpd.neighborhood_len >> 4;
  195|      2|        new->wpd.neighborhood_len |= new->wpd.neighborhood_len >> 8;
  196|      2|        new->wpd.neighborhood_len |= new->wpd.neighborhood_len >> 16;
  197|      2|        new->wpd.neighborhood_len++;
  198|      2|    } else {
  199|      0|        new->wpd.neighborhood_len = DEFAULT_NEIGH_LEN;
  ------------------
  |  |   95|      0|#define DEFAULT_NEIGH_LEN (1 << DEFAULT_NEIGH_LEN_LOG)
  |  |  ------------------
  |  |  |  |   94|      0|#define DEFAULT_NEIGH_LEN_LOG 4
  |  |  ------------------
  ------------------
  200|      0|    }
  201|       |
  202|      2|    if (new->config.ht_free_fn == NULL)
  ------------------
  |  Branch (202:9): [True: 2, False: 0]
  ------------------
  203|      2|        new->config.ht_free_fn = internal_free_nop;
  204|       |
  205|      2|    new->md = OPENSSL_zalloc(sizeof(*new->md));
  ------------------
  |  |  104|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  206|      2|    if (new->md == NULL)
  ------------------
  |  Branch (206:9): [True: 0, False: 2]
  ------------------
  207|      0|        goto err;
  208|       |
  209|      2|    new->md->neighborhoods =
  210|      2|        alloc_new_neighborhood_list(new->wpd.neighborhood_len,
  211|      2|                                    &new->md->neighborhood_ptr_to_free);
  212|      2|    if (new->md->neighborhoods == NULL)
  ------------------
  |  Branch (212:9): [True: 0, False: 2]
  ------------------
  213|      0|        goto err;
  214|      2|    new->md->neighborhood_mask = new->wpd.neighborhood_len - 1;
  215|       |
  216|      2|    new->lock = ossl_rcu_lock_new(1, conf->ctx);
  217|      2|    if (new->lock == NULL)
  ------------------
  |  Branch (217:9): [True: 0, False: 2]
  ------------------
  218|      0|        goto err;
  219|       |
  220|      2|    if (new->config.ht_hash_fn == NULL)
  ------------------
  |  Branch (220:9): [True: 2, False: 0]
  ------------------
  221|      2|        new->config.ht_hash_fn = ossl_fnv1a_hash;
  222|       |
  223|      2|    return new;
  224|       |
  225|      0|err:
  226|      0|    CRYPTO_THREAD_lock_free(new->atomic_lock);
  227|      0|    ossl_rcu_lock_free(new->lock);
  228|      0|    if (new->md != NULL)
  ------------------
  |  Branch (228:9): [True: 0, False: 0]
  ------------------
  229|      0|        OPENSSL_free(new->md->neighborhood_ptr_to_free);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  230|      0|    OPENSSL_free(new->md);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  231|      0|    OPENSSL_free(new);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  232|      0|    return NULL;
  233|      2|}
ossl_ht_write_lock:
  246|      2|{
  247|      2|    ossl_rcu_write_lock(htable->lock);
  248|      2|    htable->wpd.need_sync = 0;
  249|      2|}
ossl_ht_write_unlock:
  252|      2|{
  253|      2|    int need_sync = htable->wpd.need_sync;
  254|       |
  255|      2|    htable->wpd.need_sync = 0;
  256|      2|    ossl_rcu_write_unlock(htable->lock);
  257|      2|    if (need_sync)
  ------------------
  |  Branch (257:9): [True: 2, False: 0]
  ------------------
  258|      2|        ossl_synchronize_rcu(htable->lock);
  259|      2|}
ossl_ht_free:
  320|      2|{
  321|      2|    if (h == NULL)
  ------------------
  |  Branch (321:9): [True: 0, False: 2]
  ------------------
  322|      0|        return;
  323|       |
  324|      2|    ossl_ht_write_lock(h);
  325|      2|    ossl_ht_flush_internal(h);
  326|      2|    ossl_ht_write_unlock(h);
  327|       |    /* Freeing the lock does a final sync for us */
  328|      2|    CRYPTO_THREAD_lock_free(h->atomic_lock);
  329|      2|    ossl_rcu_lock_free(h->lock);
  330|      2|    OPENSSL_free(h->md->neighborhood_ptr_to_free);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  331|      2|    OPENSSL_free(h->md);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  332|      2|    OPENSSL_free(h);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  333|      2|    return;
  334|      2|}
hashtable.c:alloc_new_neighborhood_list:
  154|      4|{
  155|      4|    struct ht_neighborhood_st *ret;
  156|       |
  157|      4|    ret = OPENSSL_aligned_alloc(sizeof(struct ht_neighborhood_st) * len,
  ------------------
  |  |  106|      4|        CRYPTO_aligned_alloc(num, alignment, freeptr, \
  |  |  107|      4|                             OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      4|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                                            OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      4|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  158|      4|                                CACHE_LINE_BYTES, freeptr);
  159|       |
  160|       |    /* fall back to regular malloc */
  161|      4|    if (ret == NULL) {
  ------------------
  |  Branch (161:9): [True: 0, False: 4]
  ------------------
  162|      0|        ret = *freeptr = OPENSSL_malloc(sizeof(struct ht_neighborhood_st) * len);
  ------------------
  |  |  102|      0|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  163|      0|        if (ret == NULL)
  ------------------
  |  Branch (163:13): [True: 0, False: 0]
  ------------------
  164|      0|            return NULL;
  165|      0|    }
  166|      4|    memset(ret, 0, sizeof(struct ht_neighborhood_st) * len);
  167|      4|    return ret;
  168|      4|}
hashtable.c:ossl_ht_flush_internal:
  284|      2|{
  285|      2|    struct ht_mutable_data_st *newmd = NULL;
  286|      2|    struct ht_mutable_data_st *oldmd = NULL;
  287|       |
  288|      2|    newmd = OPENSSL_zalloc(sizeof(*newmd));
  ------------------
  |  |  104|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  289|      2|    if (newmd == NULL)
  ------------------
  |  Branch (289:9): [True: 0, False: 2]
  ------------------
  290|      0|        return 0;
  291|       |
  292|      2|    newmd->neighborhoods = alloc_new_neighborhood_list(DEFAULT_NEIGH_LEN,
  ------------------
  |  |   95|      2|#define DEFAULT_NEIGH_LEN (1 << DEFAULT_NEIGH_LEN_LOG)
  |  |  ------------------
  |  |  |  |   94|      2|#define DEFAULT_NEIGH_LEN_LOG 4
  |  |  ------------------
  ------------------
  293|      2|                                                       &newmd->neighborhood_ptr_to_free);
  294|      2|    if (newmd->neighborhoods == NULL) {
  ------------------
  |  Branch (294:9): [True: 0, False: 2]
  ------------------
  295|      0|        OPENSSL_free(newmd);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  296|      0|        return 0;
  297|      0|    }
  298|       |
  299|      2|    newmd->neighborhood_mask = DEFAULT_NEIGH_LEN - 1;
  ------------------
  |  |   95|      2|#define DEFAULT_NEIGH_LEN (1 << DEFAULT_NEIGH_LEN_LOG)
  |  |  ------------------
  |  |  |  |   94|      2|#define DEFAULT_NEIGH_LEN_LOG 4
  |  |  ------------------
  ------------------
  300|       |
  301|       |    /* Swap the old and new mutable data sets */
  302|      2|    oldmd = ossl_rcu_deref(&h->md);
  ------------------
  |  |   30|      2|#define ossl_rcu_deref(p) ossl_rcu_uptr_deref((void **)p)
  ------------------
  303|      2|    ossl_rcu_assign_ptr(&h->md, &newmd);
  ------------------
  |  |   31|      2|#define ossl_rcu_assign_ptr(p,v) ossl_rcu_assign_uptr((void **)p, (void **)v)
  ------------------
  304|       |
  305|       |    /* Set the number of entries to 0 */
  306|      2|    h->wpd.value_count = 0;
  307|      2|    h->wpd.neighborhood_len = DEFAULT_NEIGH_LEN;
  ------------------
  |  |   95|      2|#define DEFAULT_NEIGH_LEN (1 << DEFAULT_NEIGH_LEN_LOG)
  |  |  ------------------
  |  |  |  |   94|      2|#define DEFAULT_NEIGH_LEN_LOG 4
  |  |  ------------------
  ------------------
  308|       |
  309|      2|    ossl_rcu_call(h->lock, free_oldmd, oldmd);
  310|      2|    h->wpd.need_sync = 1;
  311|      2|    return 1;
  312|      2|}
hashtable.c:free_oldmd:
  262|      2|{
  263|      2|    struct ht_mutable_data_st *oldmd = arg;
  264|      2|    size_t i, j;
  265|      2|    size_t neighborhood_len = (size_t)oldmd->neighborhood_mask + 1;
  266|      2|    struct ht_internal_value_st *v;
  267|       |
  268|  4.09k|    for (i = 0; i < neighborhood_len; i++) {
  ------------------
  |  Branch (268:17): [True: 4.09k, False: 2]
  ------------------
  269|  4.09k|        PREFETCH_NEIGHBORHOOD(oldmd->neighborhoods[i + 1]);
  ------------------
  |  |   83|  4.09k|# define PREFETCH_NEIGHBORHOOD(x) __builtin_prefetch(x.entries)
  ------------------
  270|  20.4k|        for (j = 0; j < NEIGHBORHOOD_LEN; j++) {
  ------------------
  |  |  103|  20.4k|#define NEIGHBORHOOD_LEN (CACHE_LINE_BYTES / sizeof(struct ht_neighborhood_entry_st))
  |  |  ------------------
  |  |  |  |  100|  20.4k|#define CACHE_LINE_BYTES 64
  |  |  ------------------
  ------------------
  |  Branch (270:21): [True: 16.3k, False: 4.09k]
  ------------------
  271|  16.3k|            if (oldmd->neighborhoods[i].entries[j].value != NULL) {
  ------------------
  |  Branch (271:17): [True: 0, False: 16.3k]
  ------------------
  272|      0|                v = oldmd->neighborhoods[i].entries[j].value;
  273|      0|                v->ht->config.ht_free_fn((HT_VALUE *)v);
  274|      0|                free_value(v);
  275|      0|            }
  276|  16.3k|        }
  277|  4.09k|    }
  278|       |
  279|      2|    OPENSSL_free(oldmd->neighborhood_ptr_to_free);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  280|      2|    OPENSSL_free(oldmd);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  281|      2|}

ossl_err_load_HTTP_strings:
   80|      2|{
   81|      2|# ifndef OPENSSL_NO_ERR
   82|      2|    if (ERR_reason_error_string(HTTP_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (82:9): [True: 2, False: 0]
  ------------------
   83|      2|        ERR_load_strings_const(HTTP_str_reasons);
   84|      2|# endif
   85|      2|    return 1;
   86|      2|}

ossl_indicator_set_callback_new:
   22|      2|{
   23|      2|    INDICATOR_CB *cb;
   24|       |
   25|      2|    cb = OPENSSL_zalloc(sizeof(*cb));
  ------------------
  |  |  104|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   26|      2|    return cb;
   27|      2|}
ossl_indicator_set_callback_free:
   30|      2|{
   31|      2|    OPENSSL_free(cb);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   32|      2|}

OPENSSL_cleanup:
  378|      2|{
  379|      2|    OPENSSL_INIT_STOP *currhandler, *lasthandler;
  380|       |
  381|       |    /*
  382|       |     * At some point we should consider looking at this function with a view to
  383|       |     * moving most/all of this into onfree handlers in OSSL_LIB_CTX.
  384|       |     */
  385|       |
  386|       |    /* If we've not been inited then no need to deinit */
  387|      2|    if (!base_inited)
  ------------------
  |  Branch (387:9): [True: 0, False: 2]
  ------------------
  388|      0|        return;
  389|       |
  390|       |    /* Might be explicitly called and also by atexit */
  391|      2|    if (stopped)
  ------------------
  |  Branch (391:9): [True: 0, False: 2]
  ------------------
  392|      0|        return;
  393|      2|    stopped = 1;
  394|       |
  395|       |    /*
  396|       |     * Thread stop may not get automatically called by the thread library for
  397|       |     * the very last thread in some situations, so call it directly.
  398|       |     */
  399|      2|    OPENSSL_thread_stop();
  400|       |
  401|      2|    currhandler = stop_handlers;
  402|      2|    while (currhandler != NULL) {
  ------------------
  |  Branch (402:12): [True: 0, False: 2]
  ------------------
  403|      0|        currhandler->handler();
  404|      0|        lasthandler = currhandler;
  405|      0|        currhandler = currhandler->next;
  406|      0|        OPENSSL_free(lasthandler);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  407|      0|    }
  408|      2|    stop_handlers = NULL;
  409|       |
  410|      2|    CRYPTO_THREAD_lock_free(optsdone_lock);
  411|      2|    optsdone_lock = NULL;
  412|      2|    CRYPTO_THREAD_lock_free(init_lock);
  413|      2|    init_lock = NULL;
  414|       |
  415|      2|    CRYPTO_THREAD_cleanup_local(&in_init_config_local);
  416|       |
  417|       |    /*
  418|       |     * We assume we are single-threaded for this function, i.e. no race
  419|       |     * conditions for the various "*_inited" vars below.
  420|       |     */
  421|       |
  422|      2|#ifndef OPENSSL_NO_COMP
  423|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_comp_zlib_cleanup()\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  424|      2|    ossl_comp_zlib_cleanup();
  425|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_comp_brotli_cleanup()\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  426|      2|    ossl_comp_brotli_cleanup();
  427|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_comp_zstd_cleanup()\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  428|      2|    ossl_comp_zstd_cleanup();
  429|      2|#endif
  430|       |
  431|      2|    if (async_inited) {
  ------------------
  |  Branch (431:9): [True: 0, False: 2]
  ------------------
  432|      0|        OSSL_TRACE(INIT, "OPENSSL_cleanup: async_deinit()\n");
  ------------------
  |  |  288|      0|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      0|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  433|      0|        async_deinit();
  434|      0|    }
  435|       |
  436|       |    /*
  437|       |     * Note that cleanup order is important:
  438|       |     * - ossl_rand_cleanup_int could call an ENGINE's RAND cleanup function so
  439|       |     * must be called before engine_cleanup_int()
  440|       |     * - ENGINEs use CRYPTO_EX_DATA and therefore, must be cleaned up
  441|       |     * before the ex data handlers are wiped during default ossl_lib_ctx deinit.
  442|       |     * - ossl_config_modules_free() can end up in ENGINE code so must be called
  443|       |     * before engine_cleanup_int()
  444|       |     * - ENGINEs and additional EVP algorithms might use added OIDs names so
  445|       |     * ossl_obj_cleanup_int() must be called last
  446|       |     */
  447|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_rand_cleanup_int()\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  448|      2|    ossl_rand_cleanup_int();
  449|       |
  450|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_config_modules_free()\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  451|      2|    ossl_config_modules_free();
  452|       |
  453|      2|#ifndef OPENSSL_NO_ENGINE
  454|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: engine_cleanup_int()\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  455|      2|    engine_cleanup_int();
  456|      2|#endif
  457|       |
  458|      2|#ifndef OPENSSL_NO_DEPRECATED_3_0
  459|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_store_cleanup_int()\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  460|      2|    ossl_store_cleanup_int();
  461|      2|#endif
  462|       |
  463|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_lib_ctx_default_deinit()\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  464|      2|    ossl_lib_ctx_default_deinit();
  465|       |
  466|      2|    ossl_cleanup_thread();
  467|       |
  468|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: bio_cleanup()\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  469|      2|    bio_cleanup();
  470|       |
  471|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: evp_cleanup_int()\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  472|      2|    evp_cleanup_int();
  473|       |
  474|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_obj_cleanup_int()\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  475|      2|    ossl_obj_cleanup_int();
  476|       |
  477|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: err_int()\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  478|      2|    err_cleanup();
  479|       |
  480|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: CRYPTO_secure_malloc_done()\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  481|      2|    CRYPTO_secure_malloc_done();
  482|       |
  483|      2|#ifndef OPENSSL_NO_CMP
  484|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: OSSL_CMP_log_close()\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  485|      2|    OSSL_CMP_log_close();
  486|      2|#endif
  487|       |
  488|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_trace_cleanup()\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  489|      2|    ossl_trace_cleanup();
  490|       |
  491|      2|    base_inited = 0;
  492|      2|}
OPENSSL_init_crypto:
  500|  3.03k|{
  501|  3.03k|    uint64_t tmp;
  502|  3.03k|    int aloaddone = 0;
  503|       |
  504|       |   /* Applications depend on 0 being returned when cleanup was already done */
  505|  3.03k|    if (stopped) {
  ------------------
  |  Branch (505:9): [True: 2, False: 3.03k]
  ------------------
  506|      2|        if (!(opts & OPENSSL_INIT_BASE_ONLY))
  ------------------
  |  |   31|      2|# define OPENSSL_INIT_BASE_ONLY              0x00040000L
  ------------------
  |  Branch (506:13): [True: 0, False: 2]
  ------------------
  507|      2|            ERR_raise(ERR_LIB_CRYPTO, ERR_R_INIT_FAIL);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  508|      2|        return 0;
  509|      2|    }
  510|       |
  511|       |    /*
  512|       |     * We ignore failures from this function. It is probably because we are
  513|       |     * on a platform that doesn't support lockless atomic loads (we may not
  514|       |     * have created optsdone_lock yet so we can't use it). This is just an
  515|       |     * optimisation to skip the full checks in this function if we don't need
  516|       |     * to, so we carry on regardless in the event of failure.
  517|       |     *
  518|       |     * There could be a race here with other threads, so that optsdone has not
  519|       |     * been updated yet, even though the options have in fact been initialised.
  520|       |     * This doesn't matter - it just means we will run the full function
  521|       |     * unnecessarily - but all the critical code is contained in RUN_ONCE
  522|       |     * functions anyway so we are safe.
  523|       |     */
  524|  3.03k|    if (CRYPTO_atomic_load(&optsdone, &tmp, NULL)) {
  ------------------
  |  Branch (524:9): [True: 3.03k, False: 0]
  ------------------
  525|  3.03k|        if ((tmp & opts) == opts)
  ------------------
  |  Branch (525:13): [True: 2, False: 3.03k]
  ------------------
  526|      2|            return 1;
  527|  3.03k|        aloaddone = 1;
  528|  3.03k|    }
  529|       |
  530|       |    /*
  531|       |     * At some point we should look at this function with a view to moving
  532|       |     * most/all of this into OSSL_LIB_CTX.
  533|       |     *
  534|       |     * When the caller specifies OPENSSL_INIT_BASE_ONLY, that should be the
  535|       |     * *only* option specified.  With that option we return immediately after
  536|       |     * doing the requested limited initialization.  Note that
  537|       |     * err_shelve_state() called by us via ossl_init_load_crypto_nodelete()
  538|       |     * re-enters OPENSSL_init_crypto() with OPENSSL_INIT_BASE_ONLY, but with
  539|       |     * base already initialized this is a harmless NOOP.
  540|       |     *
  541|       |     * If we remain the only caller of err_shelve_state() the recursion should
  542|       |     * perhaps be removed, but if in doubt, it can be left in place.
  543|       |     */
  544|  3.03k|    if (!RUN_ONCE(&base, ossl_init_base))
  ------------------
  |  |  130|  3.03k|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 3.03k, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (544:9): [True: 0, False: 3.03k]
  ------------------
  545|      0|        return 0;
  546|       |
  547|  3.03k|    if (opts & OPENSSL_INIT_BASE_ONLY)
  ------------------
  |  |   31|  3.03k|# define OPENSSL_INIT_BASE_ONLY              0x00040000L
  ------------------
  |  Branch (547:9): [True: 3.03k, False: 2]
  ------------------
  548|  3.03k|        return 1;
  549|       |
  550|       |    /*
  551|       |     * optsdone_lock should definitely be set up now, so we can now repeat the
  552|       |     * same check from above but be sure that it will work even on platforms
  553|       |     * without lockless CRYPTO_atomic_load
  554|       |     */
  555|      2|    if (!aloaddone) {
  ------------------
  |  Branch (555:9): [True: 0, False: 2]
  ------------------
  556|      0|        if (!CRYPTO_atomic_load(&optsdone, &tmp, optsdone_lock))
  ------------------
  |  Branch (556:13): [True: 0, False: 0]
  ------------------
  557|      0|            return 0;
  558|      0|        if ((tmp & opts) == opts)
  ------------------
  |  Branch (558:13): [True: 0, False: 0]
  ------------------
  559|      0|            return 1;
  560|      0|    }
  561|       |
  562|       |    /*
  563|       |     * Now we don't always set up exit handlers, the INIT_BASE_ONLY calls
  564|       |     * should not have the side-effect of setting up exit handlers, and
  565|       |     * therefore, this code block is below the INIT_BASE_ONLY-conditioned early
  566|       |     * return above.
  567|       |     */
  568|      2|    if ((opts & OPENSSL_INIT_NO_ATEXIT) != 0) {
  ------------------
  |  |  485|      2|# define OPENSSL_INIT_NO_ATEXIT              0x00080000L
  ------------------
  |  Branch (568:9): [True: 0, False: 2]
  ------------------
  569|      0|        if (!RUN_ONCE_ALT(&register_atexit, ossl_init_no_register_atexit,
  ------------------
  |  |  148|      0|    (CRYPTO_THREAD_run_once(once, initalt##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (148:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (569:13): [True: 0, False: 0]
  ------------------
  570|      0|                          ossl_init_register_atexit))
  571|      0|            return 0;
  572|      2|    } else if (!RUN_ONCE(&register_atexit, ossl_init_register_atexit)) {
  ------------------
  |  |  130|      2|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 2, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (572:16): [True: 0, False: 2]
  ------------------
  573|      0|        return 0;
  574|      0|    }
  575|       |
  576|      2|    if (!RUN_ONCE(&load_crypto_nodelete, ossl_init_load_crypto_nodelete))
  ------------------
  |  |  130|      2|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 2, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (576:9): [True: 0, False: 2]
  ------------------
  577|      0|        return 0;
  578|       |
  579|      2|    if ((opts & OPENSSL_INIT_NO_LOAD_CRYPTO_STRINGS)
  ------------------
  |  |  466|      2|# define OPENSSL_INIT_NO_LOAD_CRYPTO_STRINGS 0x00000001L
  ------------------
  |  Branch (579:9): [True: 0, False: 2]
  ------------------
  580|      2|            && !RUN_ONCE_ALT(&load_crypto_strings,
  ------------------
  |  |  148|      0|    (CRYPTO_THREAD_run_once(once, initalt##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (148:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (580:16): [True: 0, False: 0]
  ------------------
  581|      2|                             ossl_init_no_load_crypto_strings,
  582|      2|                             ossl_init_load_crypto_strings))
  583|      0|        return 0;
  584|       |
  585|      2|    if ((opts & OPENSSL_INIT_LOAD_CRYPTO_STRINGS)
  ------------------
  |  |  467|      2|# define OPENSSL_INIT_LOAD_CRYPTO_STRINGS    0x00000002L
  ------------------
  |  Branch (585:9): [True: 2, False: 0]
  ------------------
  586|      2|            && !RUN_ONCE(&load_crypto_strings, ossl_init_load_crypto_strings))
  ------------------
  |  |  130|      2|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 2, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (586:16): [True: 0, False: 2]
  ------------------
  587|      0|        return 0;
  588|       |
  589|      2|    if ((opts & OPENSSL_INIT_NO_LOAD_SSL_STRINGS)
  ------------------
  |  | 2806|      2|# define OPENSSL_INIT_NO_LOAD_SSL_STRINGS    0x00100000L
  ------------------
  |  Branch (589:9): [True: 0, False: 2]
  ------------------
  590|      2|        && !RUN_ONCE_ALT(&ssl_strings, ossl_init_no_load_ssl_strings,
  ------------------
  |  |  148|      0|    (CRYPTO_THREAD_run_once(once, initalt##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (148:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (590:12): [True: 0, False: 0]
  ------------------
  591|      2|                         ossl_init_load_ssl_strings))
  592|      0|        return 0;
  593|       |
  594|      2|    if ((opts & OPENSSL_INIT_LOAD_SSL_STRINGS)
  ------------------
  |  | 2807|      2|# define OPENSSL_INIT_LOAD_SSL_STRINGS       0x00200000L
  ------------------
  |  Branch (594:9): [True: 0, False: 2]
  ------------------
  595|      2|        && !RUN_ONCE(&ssl_strings, ossl_init_load_ssl_strings))
  ------------------
  |  |  130|      0|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (595:12): [True: 0, False: 0]
  ------------------
  596|      0|        return 0;
  597|       |
  598|      2|    if ((opts & OPENSSL_INIT_NO_ADD_ALL_CIPHERS)
  ------------------
  |  |  470|      2|# define OPENSSL_INIT_NO_ADD_ALL_CIPHERS     0x00000010L
  ------------------
  |  Branch (598:9): [True: 0, False: 2]
  ------------------
  599|      2|            && !RUN_ONCE_ALT(&add_all_ciphers, ossl_init_no_add_all_ciphers,
  ------------------
  |  |  148|      0|    (CRYPTO_THREAD_run_once(once, initalt##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (148:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (599:16): [True: 0, False: 0]
  ------------------
  600|      2|                             ossl_init_add_all_ciphers))
  601|      0|        return 0;
  602|       |
  603|      2|    if ((opts & OPENSSL_INIT_ADD_ALL_CIPHERS)
  ------------------
  |  |  468|      2|# define OPENSSL_INIT_ADD_ALL_CIPHERS        0x00000004L
  ------------------
  |  Branch (603:9): [True: 0, False: 2]
  ------------------
  604|      2|            && !RUN_ONCE(&add_all_ciphers, ossl_init_add_all_ciphers))
  ------------------
  |  |  130|      0|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (604:16): [True: 0, False: 0]
  ------------------
  605|      0|        return 0;
  606|       |
  607|      2|    if ((opts & OPENSSL_INIT_NO_ADD_ALL_DIGESTS)
  ------------------
  |  |  471|      2|# define OPENSSL_INIT_NO_ADD_ALL_DIGESTS     0x00000020L
  ------------------
  |  Branch (607:9): [True: 0, False: 2]
  ------------------
  608|      2|            && !RUN_ONCE_ALT(&add_all_digests, ossl_init_no_add_all_digests,
  ------------------
  |  |  148|      0|    (CRYPTO_THREAD_run_once(once, initalt##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (148:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (608:16): [True: 0, False: 0]
  ------------------
  609|      2|                             ossl_init_add_all_digests))
  610|      0|        return 0;
  611|       |
  612|      2|    if ((opts & OPENSSL_INIT_ADD_ALL_DIGESTS)
  ------------------
  |  |  469|      2|# define OPENSSL_INIT_ADD_ALL_DIGESTS        0x00000008L
  ------------------
  |  Branch (612:9): [True: 0, False: 2]
  ------------------
  613|      2|            && !RUN_ONCE(&add_all_digests, ossl_init_add_all_digests))
  ------------------
  |  |  130|      0|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (613:16): [True: 0, False: 0]
  ------------------
  614|      0|        return 0;
  615|       |
  616|      2|    if ((opts & OPENSSL_INIT_ATFORK)
  ------------------
  |  |  483|      2|# define OPENSSL_INIT_ATFORK                 0x00020000L
  ------------------
  |  Branch (616:9): [True: 0, False: 2]
  ------------------
  617|      2|            && !openssl_init_fork_handlers())
  ------------------
  |  Branch (617:16): [True: 0, False: 0]
  ------------------
  618|      0|        return 0;
  619|       |
  620|      2|    if ((opts & OPENSSL_INIT_NO_LOAD_CONFIG)
  ------------------
  |  |  473|      2|# define OPENSSL_INIT_NO_LOAD_CONFIG         0x00000080L
  ------------------
  |  Branch (620:9): [True: 0, False: 2]
  ------------------
  621|      2|            && !RUN_ONCE_ALT(&config, ossl_init_no_config, ossl_init_config))
  ------------------
  |  |  148|      0|    (CRYPTO_THREAD_run_once(once, initalt##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (148:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (621:16): [True: 0, False: 0]
  ------------------
  622|      0|        return 0;
  623|       |
  624|      2|    if (opts & OPENSSL_INIT_LOAD_CONFIG) {
  ------------------
  |  |  472|      2|# define OPENSSL_INIT_LOAD_CONFIG            0x00000040L
  ------------------
  |  Branch (624:9): [True: 0, False: 2]
  ------------------
  625|      0|        int loading = CRYPTO_THREAD_get_local(&in_init_config_local) != NULL;
  626|       |
  627|       |        /* If called recursively from OBJ_ calls, just skip it. */
  628|      0|        if (!loading) {
  ------------------
  |  Branch (628:13): [True: 0, False: 0]
  ------------------
  629|      0|            int ret;
  630|       |
  631|      0|            if (!CRYPTO_THREAD_set_local(&in_init_config_local, (void *)-1))
  ------------------
  |  Branch (631:17): [True: 0, False: 0]
  ------------------
  632|      0|                return 0;
  633|      0|            if (settings == NULL) {
  ------------------
  |  Branch (633:17): [True: 0, False: 0]
  ------------------
  634|      0|                ret = RUN_ONCE(&config, ossl_init_config);
  ------------------
  |  |  130|      0|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  635|      0|            } else {
  636|      0|                if (!CRYPTO_THREAD_write_lock(init_lock))
  ------------------
  |  Branch (636:21): [True: 0, False: 0]
  ------------------
  637|      0|                    return 0;
  638|      0|                conf_settings = settings;
  639|      0|                ret = RUN_ONCE_ALT(&config, ossl_init_config_settings,
  ------------------
  |  |  148|      0|    (CRYPTO_THREAD_run_once(once, initalt##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (148:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  640|      0|                                   ossl_init_config);
  641|      0|                conf_settings = NULL;
  642|      0|                CRYPTO_THREAD_unlock(init_lock);
  643|      0|            }
  644|       |
  645|      0|            if (ret <= 0)
  ------------------
  |  Branch (645:17): [True: 0, False: 0]
  ------------------
  646|      0|                return 0;
  647|      0|        }
  648|      0|    }
  649|       |
  650|      2|    if ((opts & OPENSSL_INIT_ASYNC)
  ------------------
  |  |  474|      2|# define OPENSSL_INIT_ASYNC                  0x00000100L
  ------------------
  |  Branch (650:9): [True: 0, False: 2]
  ------------------
  651|      2|            && !RUN_ONCE(&async, ossl_init_async))
  ------------------
  |  |  130|      0|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (651:16): [True: 0, False: 0]
  ------------------
  652|      0|        return 0;
  653|       |
  654|      2|#ifndef OPENSSL_NO_ENGINE
  655|      2|    if ((opts & OPENSSL_INIT_ENGINE_OPENSSL)
  ------------------
  |  |  477|      2|# define OPENSSL_INIT_ENGINE_OPENSSL         0x00000800L
  ------------------
  |  Branch (655:9): [True: 0, False: 2]
  ------------------
  656|      2|            && !RUN_ONCE(&engine_openssl, ossl_init_engine_openssl))
  ------------------
  |  |  130|      0|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (656:16): [True: 0, False: 0]
  ------------------
  657|      0|        return 0;
  658|      2|# ifndef OPENSSL_NO_RDRAND
  659|      2|    if ((opts & OPENSSL_INIT_ENGINE_RDRAND)
  ------------------
  |  |  475|      2|# define OPENSSL_INIT_ENGINE_RDRAND          0x00000200L
  ------------------
  |  Branch (659:9): [True: 0, False: 2]
  ------------------
  660|      2|            && !RUN_ONCE(&engine_rdrand, ossl_init_engine_rdrand))
  ------------------
  |  |  130|      0|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (660:16): [True: 0, False: 0]
  ------------------
  661|      0|        return 0;
  662|      2|# endif
  663|      2|    if ((opts & OPENSSL_INIT_ENGINE_DYNAMIC)
  ------------------
  |  |  476|      2|# define OPENSSL_INIT_ENGINE_DYNAMIC         0x00000400L
  ------------------
  |  Branch (663:9): [True: 0, False: 2]
  ------------------
  664|      2|            && !RUN_ONCE(&engine_dynamic, ossl_init_engine_dynamic))
  ------------------
  |  |  130|      0|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (664:16): [True: 0, False: 0]
  ------------------
  665|      0|        return 0;
  666|      2|# ifndef OPENSSL_NO_STATIC_ENGINE
  667|       |#  ifndef OPENSSL_NO_DEVCRYPTOENG
  668|       |    if ((opts & OPENSSL_INIT_ENGINE_CRYPTODEV)
  669|       |            && !RUN_ONCE(&engine_devcrypto, ossl_init_engine_devcrypto))
  670|       |        return 0;
  671|       |#  endif
  672|      2|#  if !defined(OPENSSL_NO_PADLOCKENG)
  673|      2|    if ((opts & OPENSSL_INIT_ENGINE_PADLOCK)
  ------------------
  |  |  480|      2|# define OPENSSL_INIT_ENGINE_PADLOCK         0x00004000L
  ------------------
  |  Branch (673:9): [True: 0, False: 2]
  ------------------
  674|      2|            && !RUN_ONCE(&engine_padlock, ossl_init_engine_padlock))
  ------------------
  |  |  130|      0|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (674:16): [True: 0, False: 0]
  ------------------
  675|      0|        return 0;
  676|      2|#  endif
  677|       |#  if defined(OPENSSL_SYS_WIN32) && !defined(OPENSSL_NO_CAPIENG)
  678|       |    if ((opts & OPENSSL_INIT_ENGINE_CAPI)
  679|       |            && !RUN_ONCE(&engine_capi, ossl_init_engine_capi))
  680|       |        return 0;
  681|       |#  endif
  682|      2|#  if !defined(OPENSSL_NO_AFALGENG)
  683|      2|    if ((opts & OPENSSL_INIT_ENGINE_AFALG)
  ------------------
  |  |  481|      2|# define OPENSSL_INIT_ENGINE_AFALG           0x00008000L
  ------------------
  |  Branch (683:9): [True: 0, False: 2]
  ------------------
  684|      2|            && !RUN_ONCE(&engine_afalg, ossl_init_engine_afalg))
  ------------------
  |  |  130|      0|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (684:16): [True: 0, False: 0]
  ------------------
  685|      0|        return 0;
  686|      2|#  endif
  687|      2|# endif
  688|      2|    if (opts & (OPENSSL_INIT_ENGINE_ALL_BUILTIN
  ------------------
  |  |  497|      2|    (OPENSSL_INIT_ENGINE_RDRAND | OPENSSL_INIT_ENGINE_DYNAMIC \
  |  |  ------------------
  |  |  |  |  475|      2|# define OPENSSL_INIT_ENGINE_RDRAND          0x00000200L
  |  |  ------------------
  |  |                   (OPENSSL_INIT_ENGINE_RDRAND | OPENSSL_INIT_ENGINE_DYNAMIC \
  |  |  ------------------
  |  |  |  |  476|      2|# define OPENSSL_INIT_ENGINE_DYNAMIC         0x00000400L
  |  |  ------------------
  |  |  498|      2|    | OPENSSL_INIT_ENGINE_CRYPTODEV | OPENSSL_INIT_ENGINE_CAPI | \
  |  |  ------------------
  |  |  |  |  478|      2|# define OPENSSL_INIT_ENGINE_CRYPTODEV       0x00001000L
  |  |  ------------------
  |  |                   | OPENSSL_INIT_ENGINE_CRYPTODEV | OPENSSL_INIT_ENGINE_CAPI | \
  |  |  ------------------
  |  |  |  |  479|      2|# define OPENSSL_INIT_ENGINE_CAPI            0x00002000L
  |  |  ------------------
  |  |  499|      2|    OPENSSL_INIT_ENGINE_PADLOCK)
  |  |  ------------------
  |  |  |  |  480|      2|# define OPENSSL_INIT_ENGINE_PADLOCK         0x00004000L
  |  |  ------------------
  ------------------
  |  Branch (688:9): [True: 0, False: 2]
  ------------------
  689|      2|                | OPENSSL_INIT_ENGINE_OPENSSL
  ------------------
  |  |  477|      2|# define OPENSSL_INIT_ENGINE_OPENSSL         0x00000800L
  ------------------
  690|      2|                | OPENSSL_INIT_ENGINE_AFALG)) {
  ------------------
  |  |  481|      2|# define OPENSSL_INIT_ENGINE_AFALG           0x00008000L
  ------------------
  691|      0|        ENGINE_register_all_complete();
  692|      0|    }
  693|      2|#endif
  694|       |
  695|      2|    if (!CRYPTO_atomic_or(&optsdone, opts, &tmp, optsdone_lock))
  ------------------
  |  Branch (695:9): [True: 0, False: 2]
  ------------------
  696|      0|        return 0;
  697|       |
  698|      2|    return 1;
  699|      2|}
init.c:ossl_init_base:
   58|      2|{
   59|       |    /* no need to init trace */
   60|       |
   61|      2|    OSSL_TRACE(INIT, "ossl_init_base: setting up stop handlers\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
   62|       |#ifndef OPENSSL_NO_CRYPTO_MDEBUG
   63|       |    ossl_malloc_setup_failures();
   64|       |#endif
   65|       |
   66|      2|    if ((optsdone_lock = CRYPTO_THREAD_lock_new()) == NULL
  ------------------
  |  Branch (66:9): [True: 0, False: 2]
  ------------------
   67|      2|        || (init_lock = CRYPTO_THREAD_lock_new()) == NULL)
  ------------------
  |  Branch (67:12): [True: 0, False: 2]
  ------------------
   68|      0|        goto err;
   69|       |
   70|      2|    OPENSSL_cpuid_setup();
   71|       |
   72|      2|    if (!ossl_init_thread())
  ------------------
  |  Branch (72:9): [True: 0, False: 2]
  ------------------
   73|      0|        goto err;
   74|       |
   75|      2|    if (!CRYPTO_THREAD_init_local(&in_init_config_local, NULL))
  ------------------
  |  Branch (75:9): [True: 0, False: 2]
  ------------------
   76|      0|        goto err;
   77|       |
   78|      2|    base_inited = 1;
   79|      2|    return 1;
   80|       |
   81|      0|err:
   82|      0|    OSSL_TRACE(INIT, "ossl_init_base failed!\n");
  ------------------
  |  |  288|      0|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      0|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
   83|      0|    CRYPTO_THREAD_lock_free(optsdone_lock);
   84|      0|    optsdone_lock = NULL;
   85|      0|    CRYPTO_THREAD_lock_free(init_lock);
   86|      0|    init_lock = NULL;
   87|       |
   88|      0|    return 0;
   89|      2|}
init.c:ossl_init_register_atexit:
  101|      2|{
  102|      2|#ifndef OPENSSL_NO_ATEXIT
  103|       |# ifdef OPENSSL_INIT_DEBUG
  104|       |    fprintf(stderr, "OPENSSL_INIT: ossl_init_register_atexit()\n");
  105|       |# endif
  106|      2|# ifndef OPENSSL_SYS_UEFI
  107|       |#  if defined(_WIN32) && !defined(__BORLANDC__)
  108|       |    /* We use _onexit() in preference because it gets called on DLL unload */
  109|       |    if (_onexit(win32atexit) == NULL)
  110|       |        return 0;
  111|       |#  else
  112|      2|    if (atexit(OPENSSL_cleanup) != 0)
  ------------------
  |  Branch (112:9): [True: 0, False: 2]
  ------------------
  113|      0|        return 0;
  114|      2|#  endif
  115|      2|# endif
  116|      2|#endif
  117|       |
  118|      2|    return 1;
  119|      2|}
init.c:ossl_init_load_crypto_nodelete:
  133|      2|{
  134|      2|    OSSL_TRACE(INIT, "ossl_init_load_crypto_nodelete()\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  135|       |
  136|       |#if !defined(OPENSSL_USE_NODELETE) \
  137|       |    && !defined(OPENSSL_NO_PINSHARED)
  138|       |# if defined(DSO_WIN32) && !defined(_WIN32_WCE)
  139|       |    {
  140|       |        HMODULE handle = NULL;
  141|       |        BOOL ret;
  142|       |
  143|       |        /* We don't use the DSO route for WIN32 because there is a better way */
  144|       |        ret = GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
  145|       |                                | GET_MODULE_HANDLE_EX_FLAG_PIN,
  146|       |                                (void *)&base_inited, &handle);
  147|       |
  148|       |        OSSL_TRACE1(INIT,
  149|       |                    "ossl_init_load_crypto_nodelete: "
  150|       |                    "obtained DSO reference? %s\n",
  151|       |                    (ret == TRUE ? "No!" : "Yes."));
  152|       |        return (ret == TRUE) ? 1 : 0;
  153|       |    }
  154|       |# elif !defined(DSO_NONE)
  155|       |    /*
  156|       |     * Deliberately leak a reference to ourselves. This will force the library
  157|       |     * to remain loaded until the atexit() handler is run at process exit.
  158|       |     */
  159|       |    {
  160|       |        DSO *dso;
  161|       |        void *err;
  162|       |
  163|       |        if (!err_shelve_state(&err))
  164|       |            return 0;
  165|       |
  166|       |        dso = DSO_dsobyaddr(&base_inited, DSO_FLAG_NO_UNLOAD_ON_FREE);
  167|       |        /*
  168|       |         * In case of No!, it is uncertain our exit()-handlers can still be
  169|       |         * called. After dlclose() the whole library might have been unloaded
  170|       |         * already.
  171|       |         */
  172|       |        OSSL_TRACE1(INIT, "obtained DSO reference? %s\n",
  173|       |                    (dso == NULL ? "No!" : "Yes."));
  174|       |        DSO_free(dso);
  175|       |        err_unshelve_state(err);
  176|       |    }
  177|       |# endif
  178|       |#endif
  179|       |
  180|      2|    return 1;
  181|      2|}
init.c:ossl_init_load_crypto_strings:
  186|      2|{
  187|      2|    int ret = 1;
  188|       |    /*
  189|       |     * OPENSSL_NO_AUTOERRINIT is provided here to prevent at compile time
  190|       |     * pulling in all the error strings during static linking
  191|       |     */
  192|      2|#if !defined(OPENSSL_NO_ERR) && !defined(OPENSSL_NO_AUTOERRINIT)
  193|      2|    void *err;
  194|       |
  195|      2|    if (!err_shelve_state(&err))
  ------------------
  |  Branch (195:9): [True: 0, False: 2]
  ------------------
  196|      0|        return 0;
  197|       |
  198|      2|    OSSL_TRACE(INIT, "ossl_err_load_crypto_strings()\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  199|      2|    ret = ossl_err_load_crypto_strings();
  200|       |
  201|      2|    err_unshelve_state(err);
  202|      2|#endif
  203|      2|    return ret;
  204|      2|}

ossl_init_thread:
  203|      2|{
  204|      2|    if (!CRYPTO_THREAD_init_local(&destructor_key.value,
  ------------------
  |  Branch (204:9): [True: 0, False: 2]
  ------------------
  205|      2|                                  init_thread_destructor))
  206|      0|        return 0;
  207|       |
  208|      2|    return 1;
  209|      2|}
ossl_cleanup_thread:
  212|      2|{
  213|      2|    init_thread_deregister(NULL, 1);
  214|      2|    CRYPTO_THREAD_cleanup_local(&destructor_key.value);
  215|      2|    destructor_key.sane = -1;
  216|      2|}
OPENSSL_thread_stop:
  230|      2|{
  231|      2|    if (destructor_key.sane != -1) {
  ------------------
  |  Branch (231:9): [True: 2, False: 0]
  ------------------
  232|      2|        THREAD_EVENT_HANDLER **hands
  233|      2|            = init_get_thread_local(&destructor_key.value, 0, 0);
  234|      2|        init_thread_stop(NULL, hands);
  235|       |
  236|      2|        init_thread_remove_handlers(hands);
  237|      2|        OPENSSL_free(hands);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  238|      2|    }
  239|      2|}
ossl_ctx_thread_stop:
  242|      2|{
  243|      2|    if (destructor_key.sane != -1) {
  ------------------
  |  Branch (243:9): [True: 2, False: 0]
  ------------------
  244|      2|        THREAD_EVENT_HANDLER **hands
  245|      2|            = init_get_thread_local(&destructor_key.value, 0, 1);
  246|      2|        init_thread_stop(ctx, hands);
  247|      2|    }
  248|      2|}
ossl_init_thread_start:
  369|      2|{
  370|      2|    THREAD_EVENT_HANDLER **hands;
  371|      2|    THREAD_EVENT_HANDLER *hand;
  372|       |#ifdef FIPS_MODULE
  373|       |    OSSL_LIB_CTX *ctx = arg;
  374|       |
  375|       |    /*
  376|       |     * In FIPS mode the list of THREAD_EVENT_HANDLERs is unique per combination
  377|       |     * of OSSL_LIB_CTX and thread. This is because in FIPS mode each
  378|       |     * OSSL_LIB_CTX gets informed about thread stop events individually.
  379|       |     */
  380|       |    CRYPTO_THREAD_LOCAL *local
  381|       |        = ossl_lib_ctx_get_data(ctx, OSSL_LIB_CTX_THREAD_EVENT_HANDLER_INDEX);
  382|       |#else
  383|       |    /*
  384|       |     * Outside of FIPS mode the list of THREAD_EVENT_HANDLERs is unique per
  385|       |     * thread, but may hold multiple OSSL_LIB_CTXs. We only get told about
  386|       |     * thread stop events globally, so we have to ensure all affected
  387|       |     * OSSL_LIB_CTXs are informed.
  388|       |     */
  389|      2|    CRYPTO_THREAD_LOCAL *local = &destructor_key.value;
  390|      2|#endif
  391|       |
  392|      2|    hands = init_get_thread_local(local, 1, 0);
  393|      2|    if (hands == NULL)
  ------------------
  |  Branch (393:9): [True: 0, False: 2]
  ------------------
  394|      0|        return 0;
  395|       |
  396|       |#ifdef FIPS_MODULE
  397|       |    if (*hands == NULL) {
  398|       |        /*
  399|       |         * We've not yet registered any handlers for this thread. We need to get
  400|       |         * libcrypto to tell us about later thread stop events. c_thread_start
  401|       |         * is a callback to libcrypto defined in fipsprov.c
  402|       |         */
  403|       |        if (!ossl_thread_register_fips(ctx))
  404|       |            return 0;
  405|       |    }
  406|       |#endif
  407|       |
  408|      2|    hand = OPENSSL_malloc(sizeof(*hand));
  ------------------
  |  |  102|      2|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  409|      2|    if (hand == NULL)
  ------------------
  |  Branch (409:9): [True: 0, False: 2]
  ------------------
  410|      0|        return 0;
  411|       |
  412|      2|    hand->handfn = handfn;
  413|      2|    hand->arg = arg;
  414|      2|#ifndef FIPS_MODULE
  415|      2|    hand->index = index;
  416|      2|#endif
  417|      2|    hand->next = *hands;
  418|      2|    *hands = hand;
  419|       |
  420|      2|    return 1;
  421|      2|}
initthread.c:init_get_thread_local:
   95|      6|{
   96|      6|    THREAD_EVENT_HANDLER **hands = CRYPTO_THREAD_get_local(local);
   97|       |
   98|      6|    if (alloc) {
  ------------------
  |  Branch (98:9): [True: 2, False: 4]
  ------------------
   99|      2|        if (hands == NULL) {
  ------------------
  |  Branch (99:13): [True: 2, False: 0]
  ------------------
  100|       |
  101|      2|            if ((hands = OPENSSL_zalloc(sizeof(*hands))) == NULL)
  ------------------
  |  |  104|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (101:17): [True: 0, False: 2]
  ------------------
  102|      0|                return NULL;
  103|       |
  104|      2|            if (!CRYPTO_THREAD_set_local(local, hands)) {
  ------------------
  |  Branch (104:17): [True: 0, False: 2]
  ------------------
  105|      0|                OPENSSL_free(hands);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  106|      0|                return NULL;
  107|      0|            }
  108|       |
  109|      2|#ifndef FIPS_MODULE
  110|      2|            if (!init_thread_push_handlers(hands)) {
  ------------------
  |  Branch (110:17): [True: 0, False: 2]
  ------------------
  111|      0|                CRYPTO_THREAD_set_local(local, NULL);
  112|      0|                OPENSSL_free(hands);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  113|      0|                return NULL;
  114|      0|            }
  115|      2|#endif
  116|      2|        }
  117|      4|    } else if (!keep) {
  ------------------
  |  Branch (117:16): [True: 2, False: 2]
  ------------------
  118|      2|        CRYPTO_THREAD_set_local(local, NULL);
  119|      2|    }
  120|       |
  121|      6|    return hands;
  122|      6|}
initthread.c:init_thread_push_handlers:
  155|      2|{
  156|      2|    int ret;
  157|      2|    GLOBAL_TEVENT_REGISTER *gtr;
  158|       |
  159|      2|    gtr = get_global_tevent_register();
  160|      2|    if (gtr == NULL)
  ------------------
  |  Branch (160:9): [True: 0, False: 2]
  ------------------
  161|      0|        return 0;
  162|       |
  163|      2|    if (!CRYPTO_THREAD_write_lock(gtr->lock))
  ------------------
  |  Branch (163:9): [True: 0, False: 2]
  ------------------
  164|      0|        return 0;
  165|      2|    ret = (sk_THREAD_EVENT_HANDLER_PTR_push(gtr->skhands, hands) != 0);
  166|      2|    CRYPTO_THREAD_unlock(gtr->lock);
  167|       |
  168|      2|    return ret;
  169|      2|}
initthread.c:get_global_tevent_register:
   78|      8|{
   79|      8|    if (!RUN_ONCE(&tevent_register_runonce, create_global_tevent_register))
  ------------------
  |  |  130|      8|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 8, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (79:9): [True: 0, False: 8]
  ------------------
   80|      0|        return NULL;
   81|      8|    return glob_tevent_reg;
   82|      8|}
initthread.c:create_global_tevent_register:
   59|      2|{
   60|      2|    glob_tevent_reg = OPENSSL_zalloc(sizeof(*glob_tevent_reg));
  ------------------
  |  |  104|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   61|      2|    if (glob_tevent_reg == NULL)
  ------------------
  |  Branch (61:9): [True: 0, False: 2]
  ------------------
   62|      0|        return 0;
   63|       |
   64|      2|    glob_tevent_reg->skhands = sk_THREAD_EVENT_HANDLER_PTR_new_null();
   65|      2|    glob_tevent_reg->lock = CRYPTO_THREAD_lock_new();
   66|      2|    if (glob_tevent_reg->skhands == NULL || glob_tevent_reg->lock == NULL) {
  ------------------
  |  Branch (66:9): [True: 0, False: 2]
  |  Branch (66:45): [True: 0, False: 2]
  ------------------
   67|      0|        sk_THREAD_EVENT_HANDLER_PTR_free(glob_tevent_reg->skhands);
   68|      0|        CRYPTO_THREAD_lock_free(glob_tevent_reg->lock);
   69|      0|        OPENSSL_free(glob_tevent_reg);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   70|      0|        glob_tevent_reg = NULL;
   71|      0|        return 0;
   72|      0|    }
   73|       |
   74|      2|    return 1;
   75|      2|}
initthread.c:init_thread_remove_handlers:
  172|      2|{
  173|      2|    GLOBAL_TEVENT_REGISTER *gtr;
  174|      2|    int i;
  175|       |
  176|      2|    gtr = get_global_tevent_register();
  177|      2|    if (gtr == NULL)
  ------------------
  |  Branch (177:9): [True: 0, False: 2]
  ------------------
  178|      0|        return;
  179|      2|    if (!CRYPTO_THREAD_write_lock(gtr->lock))
  ------------------
  |  Branch (179:9): [True: 0, False: 2]
  ------------------
  180|      0|        return;
  181|      2|    for (i = 0; i < sk_THREAD_EVENT_HANDLER_PTR_num(gtr->skhands); i++) {
  ------------------
  |  Branch (181:17): [True: 2, False: 0]
  ------------------
  182|      2|        THREAD_EVENT_HANDLER **hands
  183|      2|            = sk_THREAD_EVENT_HANDLER_PTR_value(gtr->skhands, i);
  184|       |
  185|      2|        if (hands == handsin) {
  ------------------
  |  Branch (185:13): [True: 2, False: 0]
  ------------------
  186|      2|            sk_THREAD_EVENT_HANDLER_PTR_delete(gtr->skhands, i);
  187|      2|            CRYPTO_THREAD_unlock(gtr->lock);
  188|      2|            return;
  189|      2|        }
  190|      2|    }
  191|      0|    CRYPTO_THREAD_unlock(gtr->lock);
  192|      0|    return;
  193|      2|}
initthread.c:init_thread_stop:
  325|      4|{
  326|      4|    THREAD_EVENT_HANDLER *curr, *prev = NULL, *tmp;
  327|      4|#ifndef FIPS_MODULE
  328|      4|    GLOBAL_TEVENT_REGISTER *gtr;
  329|      4|#endif
  330|       |
  331|       |    /* Can't do much about this */
  332|      4|    if (hands == NULL)
  ------------------
  |  Branch (332:9): [True: 2, False: 2]
  ------------------
  333|      2|        return;
  334|       |
  335|      2|#ifndef FIPS_MODULE
  336|      2|    gtr = get_global_tevent_register();
  337|      2|    if (gtr == NULL)
  ------------------
  |  Branch (337:9): [True: 0, False: 2]
  ------------------
  338|      0|        return;
  339|       |
  340|      2|    if (!CRYPTO_THREAD_write_lock(gtr->lock))
  ------------------
  |  Branch (340:9): [True: 0, False: 2]
  ------------------
  341|      0|        return;
  342|      2|#endif
  343|       |
  344|      2|    curr = *hands;
  345|      4|    while (curr != NULL) {
  ------------------
  |  Branch (345:12): [True: 2, False: 2]
  ------------------
  346|      2|        if (arg != NULL && curr->arg != arg) {
  ------------------
  |  Branch (346:13): [True: 0, False: 2]
  |  Branch (346:28): [True: 0, False: 0]
  ------------------
  347|      0|            prev = curr;
  348|      0|            curr = curr->next;
  349|      0|            continue;
  350|      0|        }
  351|      2|        curr->handfn(curr->arg);
  352|      2|        if (prev == NULL)
  ------------------
  |  Branch (352:13): [True: 2, False: 0]
  ------------------
  353|      2|            *hands = curr->next;
  354|      0|        else
  355|      0|            prev->next = curr->next;
  356|       |
  357|      2|        tmp = curr;
  358|      2|        curr = curr->next;
  359|       |
  360|      2|        OPENSSL_free(tmp);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  361|      2|    }
  362|      2|#ifndef FIPS_MODULE
  363|      2|    CRYPTO_THREAD_unlock(gtr->lock);
  364|      2|#endif
  365|      2|}
initthread.c:init_thread_deregister:
  425|      2|{
  426|      2|    GLOBAL_TEVENT_REGISTER *gtr;
  427|      2|    int i;
  428|       |
  429|      2|    gtr = get_global_tevent_register();
  430|      2|    if (gtr == NULL)
  ------------------
  |  Branch (430:9): [True: 0, False: 2]
  ------------------
  431|      0|        return 0;
  432|      2|    if (!all) {
  ------------------
  |  Branch (432:9): [True: 0, False: 2]
  ------------------
  433|      0|        if (!CRYPTO_THREAD_write_lock(gtr->lock))
  ------------------
  |  Branch (433:13): [True: 0, False: 0]
  ------------------
  434|      0|            return 0;
  435|      2|    } else {
  436|      2|        glob_tevent_reg = NULL;
  437|      2|    }
  438|      2|    for (i = 0; i < sk_THREAD_EVENT_HANDLER_PTR_num(gtr->skhands); i++) {
  ------------------
  |  Branch (438:17): [True: 0, False: 2]
  ------------------
  439|      0|        THREAD_EVENT_HANDLER **hands
  440|      0|            = sk_THREAD_EVENT_HANDLER_PTR_value(gtr->skhands, i);
  441|      0|        THREAD_EVENT_HANDLER *curr = NULL, *prev = NULL, *tmp;
  442|       |
  443|      0|        if (hands == NULL) {
  ------------------
  |  Branch (443:13): [True: 0, False: 0]
  ------------------
  444|      0|            if (!all)
  ------------------
  |  Branch (444:17): [True: 0, False: 0]
  ------------------
  445|      0|                CRYPTO_THREAD_unlock(gtr->lock);
  446|      0|            return 0;
  447|      0|        }
  448|      0|        curr = *hands;
  449|      0|        while (curr != NULL) {
  ------------------
  |  Branch (449:16): [True: 0, False: 0]
  ------------------
  450|      0|            if (all || curr->index == index) {
  ------------------
  |  Branch (450:17): [True: 0, False: 0]
  |  Branch (450:24): [True: 0, False: 0]
  ------------------
  451|      0|                if (prev != NULL)
  ------------------
  |  Branch (451:21): [True: 0, False: 0]
  ------------------
  452|      0|                    prev->next = curr->next;
  453|      0|                else
  454|      0|                    *hands = curr->next;
  455|      0|                tmp = curr;
  456|      0|                curr = curr->next;
  457|      0|                OPENSSL_free(tmp);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  458|      0|                continue;
  459|      0|            }
  460|      0|            prev = curr;
  461|      0|            curr = curr->next;
  462|      0|        }
  463|      0|        if (all)
  ------------------
  |  Branch (463:13): [True: 0, False: 0]
  ------------------
  464|      0|            OPENSSL_free(hands);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  465|      0|    }
  466|      2|    if (all) {
  ------------------
  |  Branch (466:9): [True: 2, False: 0]
  ------------------
  467|      2|        CRYPTO_THREAD_lock_free(gtr->lock);
  468|      2|        sk_THREAD_EVENT_HANDLER_PTR_free(gtr->skhands);
  469|      2|        OPENSSL_free(gtr);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  470|      2|    } else {
  471|      0|        CRYPTO_THREAD_unlock(gtr->lock);
  472|      0|    }
  473|      2|    return 1;
  474|      2|}

OPENSSL_LH_set_thunks:
   52|     10|{
   53|       |
   54|     10|    if (lh == NULL)
  ------------------
  |  Branch (54:9): [True: 0, False: 10]
  ------------------
   55|      0|        return NULL;
   56|     10|    lh->compw = cw;
   57|     10|    lh->hashw = hw;
   58|     10|    lh->daw = daw;
   59|     10|    lh->daaw = daaw;
   60|     10|    return lh;
   61|     10|}
OPENSSL_LH_new:
   64|     10|{
   65|     10|    OPENSSL_LHASH *ret;
   66|       |
   67|     10|    if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
  ------------------
  |  |  104|     10|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     10|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     10|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (67:9): [True: 0, False: 10]
  ------------------
   68|      0|        return NULL;
   69|     10|    if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)
  ------------------
  |  |  104|     10|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     10|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     10|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (69:9): [True: 0, False: 10]
  ------------------
   70|      0|        goto err;
   71|     10|    ret->comp = ((c == NULL) ? (OPENSSL_LH_COMPFUNC)strcmp : c);
  ------------------
  |  Branch (71:18): [True: 0, False: 10]
  ------------------
   72|     10|    ret->hash = ((h == NULL) ? (OPENSSL_LH_HASHFUNC)OPENSSL_LH_strhash : h);
  ------------------
  |  Branch (72:18): [True: 0, False: 10]
  ------------------
   73|     10|    ret->num_nodes = MIN_NODES / 2;
  ------------------
  |  |   39|     10|#define MIN_NODES       16
  ------------------
   74|     10|    ret->num_alloc_nodes = MIN_NODES;
  ------------------
  |  |   39|     10|#define MIN_NODES       16
  ------------------
   75|     10|    ret->pmax = MIN_NODES / 2;
  ------------------
  |  |   39|     10|#define MIN_NODES       16
  ------------------
   76|     10|    ret->up_load = UP_LOAD;
  ------------------
  |  |   40|     10|#define UP_LOAD         (2*LH_LOAD_MULT) /* load times 256 (default 2) */
  |  |  ------------------
  |  |  |  |   85|     10|# define LH_LOAD_MULT    256
  |  |  ------------------
  ------------------
   77|     10|    ret->down_load = DOWN_LOAD;
  ------------------
  |  |   41|     10|#define DOWN_LOAD       (LH_LOAD_MULT) /* load times 256 (default 1) */
  |  |  ------------------
  |  |  |  |   85|     10|# define LH_LOAD_MULT    256
  |  |  ------------------
  ------------------
   78|     10|    return ret;
   79|       |
   80|      0|err:
   81|      0|    OPENSSL_free(ret->b);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   82|      0|    OPENSSL_free(ret);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   83|      0|    return NULL;
   84|     10|}
OPENSSL_LH_free:
   87|     12|{
   88|     12|    if (lh == NULL)
  ------------------
  |  Branch (88:9): [True: 2, False: 10]
  ------------------
   89|      2|        return;
   90|       |
   91|     10|    OPENSSL_LH_flush(lh);
   92|     10|    OPENSSL_free(lh->b);
  ------------------
  |  |  115|     10|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     10|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     10|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   93|     10|    OPENSSL_free(lh);
  ------------------
  |  |  115|     10|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     10|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     10|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   94|     10|}
OPENSSL_LH_flush:
   97|     10|{
   98|     10|    unsigned int i;
   99|     10|    OPENSSL_LH_NODE *n, *nn;
  100|       |
  101|     10|    if (lh == NULL)
  ------------------
  |  Branch (101:9): [True: 0, False: 10]
  ------------------
  102|      0|        return;
  103|       |
  104|  1.59k|    for (i = 0; i < lh->num_nodes; i++) {
  ------------------
  |  Branch (104:17): [True: 1.58k, False: 10]
  ------------------
  105|  1.58k|        n = lh->b[i];
  106|  4.64k|        while (n != NULL) {
  ------------------
  |  Branch (106:16): [True: 3.06k, False: 1.58k]
  ------------------
  107|  3.06k|            nn = n->next;
  108|  3.06k|            OPENSSL_free(n);
  ------------------
  |  |  115|  3.06k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|  3.06k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|  3.06k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  109|  3.06k|            n = nn;
  110|  3.06k|        }
  111|  1.58k|        lh->b[i] = NULL;
  112|  1.58k|    }
  113|       |
  114|     10|    lh->num_items = 0;
  115|     10|}
OPENSSL_LH_insert:
  118|  8.63k|{
  119|  8.63k|    unsigned long hash;
  120|  8.63k|    OPENSSL_LH_NODE *nn, **rn;
  121|  8.63k|    void *ret;
  122|       |
  123|  8.63k|    lh->error = 0;
  124|  8.63k|    if ((lh->up_load <= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)) && !expand(lh))
  ------------------
  |  |   85|  8.63k|# define LH_LOAD_MULT    256
  ------------------
  |  Branch (124:9): [True: 1.50k, False: 7.13k]
  |  Branch (124:76): [True: 0, False: 1.50k]
  ------------------
  125|      0|        return NULL;        /* 'lh->error++' already done in 'expand' */
  126|       |
  127|  8.63k|    rn = getrn(lh, data, &hash);
  128|       |
  129|  8.63k|    if (*rn == NULL) {
  ------------------
  |  Branch (129:9): [True: 3.06k, False: 5.57k]
  ------------------
  130|  3.06k|        if ((nn = OPENSSL_malloc(sizeof(*nn))) == NULL) {
  ------------------
  |  |  102|  3.06k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|  3.06k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|  3.06k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (130:13): [True: 0, False: 3.06k]
  ------------------
  131|      0|            lh->error++;
  132|      0|            return NULL;
  133|      0|        }
  134|  3.06k|        nn->data = data;
  135|  3.06k|        nn->next = NULL;
  136|  3.06k|        nn->hash = hash;
  137|  3.06k|        *rn = nn;
  138|  3.06k|        ret = NULL;
  139|  3.06k|        lh->num_items++;
  140|  5.57k|    } else {                    /* replace same key */
  141|  5.57k|        ret = (*rn)->data;
  142|  5.57k|        (*rn)->data = data;
  143|  5.57k|    }
  144|  8.63k|    return ret;
  145|  8.63k|}
OPENSSL_LH_retrieve:
  174|    168|{
  175|    168|    unsigned long hash;
  176|    168|    OPENSSL_LH_NODE **rn;
  177|       |
  178|    168|    if (lh->error != 0)
  ------------------
  |  Branch (178:9): [True: 0, False: 168]
  ------------------
  179|      0|        lh->error = 0;
  180|       |
  181|    168|    rn = getrn(lh, data, &hash);
  182|       |
  183|    168|    return *rn == NULL ? NULL : (*rn)->data;
  ------------------
  |  Branch (183:12): [True: 168, False: 0]
  ------------------
  184|    168|}
OPENSSL_LH_doall:
  217|      8|{
  218|      8|    if (lh == NULL)
  ------------------
  |  Branch (218:9): [True: 0, False: 8]
  ------------------
  219|      0|        return;
  220|       |
  221|      8|    doall_util_fn(lh, 0, lh->daw, func, (OPENSSL_LH_DOALL_FUNCARG)NULL,
  222|      8|                  (OPENSSL_LH_DOALL_FUNCARG_THUNK)NULL, NULL);
  223|      8|}
OPENSSL_LH_strhash:
  362|     48|{
  363|     48|    unsigned long ret = 0;
  364|     48|    long n;
  365|     48|    unsigned long v;
  366|     48|    int r;
  367|       |
  368|     48|    if ((c == NULL) || (*c == '\0'))
  ------------------
  |  Branch (368:9): [True: 0, False: 48]
  |  Branch (368:24): [True: 0, False: 48]
  ------------------
  369|      0|        return ret;
  370|       |
  371|     48|    n = 0x100;
  372|    312|    while (*c) {
  ------------------
  |  Branch (372:12): [True: 264, False: 48]
  ------------------
  373|    264|        v = n | (*c);
  374|    264|        n += 0x100;
  375|    264|        r = (int)((v >> 2) ^ v) & 0x0f;
  376|       |        /* cast to uint64_t to avoid 32 bit shift of 32 bit value */
  377|    264|        ret = (ret << r) | (unsigned long)((uint64_t)ret >> (32 - r));
  378|    264|        ret &= 0xFFFFFFFFL;
  379|    264|        ret ^= v * v;
  380|    264|        c++;
  381|    264|    }
  382|     48|    return (ret >> 16) ^ ret;
  383|     48|}
OPENSSL_LH_error:
  442|     16|{
  443|     16|    return lh->error;
  444|     16|}
lhash.c:doall_util_fn:
  192|      8|{
  193|      8|    int i;
  194|      8|    OPENSSL_LH_NODE *a, *n;
  195|       |
  196|      8|    if (lh == NULL)
  ------------------
  |  Branch (196:9): [True: 0, False: 8]
  ------------------
  197|      0|        return;
  198|       |
  199|       |    /*
  200|       |     * reverse the order so we search from 'top to bottom' We were having
  201|       |     * memory leaks otherwise
  202|       |     */
  203|     72|    for (i = lh->num_nodes - 1; i >= 0; i--) {
  ------------------
  |  Branch (203:33): [True: 64, False: 8]
  ------------------
  204|     64|        a = lh->b[i];
  205|     80|        while (a != NULL) {
  ------------------
  |  Branch (205:16): [True: 16, False: 64]
  ------------------
  206|     16|            n = a->next;
  207|     16|            if (use_arg)
  ------------------
  |  Branch (207:17): [True: 0, False: 16]
  ------------------
  208|      0|                wfunc_arg(a->data, arg, func_arg);
  209|     16|            else
  210|     16|                wfunc(a->data, func);
  211|     16|            a = n;
  212|     16|        }
  213|     64|    }
  214|      8|}
lhash.c:expand:
  244|  1.50k|{
  245|  1.50k|    OPENSSL_LH_NODE **n, **n1, **n2, *np;
  246|  1.50k|    unsigned int p, pmax, nni, j;
  247|  1.50k|    unsigned long hash;
  248|       |
  249|  1.50k|    nni = lh->num_alloc_nodes;
  250|  1.50k|    p = lh->p;
  251|  1.50k|    pmax = lh->pmax;
  252|  1.50k|    if (p + 1 >= pmax) {
  ------------------
  |  Branch (252:9): [True: 12, False: 1.49k]
  ------------------
  253|     12|        j = nni * 2;
  254|     12|        n = OPENSSL_realloc(lh->b, sizeof(OPENSSL_LH_NODE *) * j);
  ------------------
  |  |  109|     12|        CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     12|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     12|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  255|     12|        if (n == NULL) {
  ------------------
  |  Branch (255:13): [True: 0, False: 12]
  ------------------
  256|      0|            lh->error++;
  257|      0|            return 0;
  258|      0|        }
  259|     12|        lh->b = n;
  260|     12|        memset(n + nni, 0, sizeof(*n) * (j - nni));
  261|     12|        lh->pmax = nni;
  262|     12|        lh->num_alloc_nodes = j;
  263|     12|        lh->p = 0;
  264|  1.49k|    } else {
  265|  1.49k|        lh->p++;
  266|  1.49k|    }
  267|       |
  268|  1.50k|    lh->num_nodes++;
  269|  1.50k|    n1 = &(lh->b[p]);
  270|  1.50k|    n2 = &(lh->b[p + pmax]);
  271|  1.50k|    *n2 = NULL;
  272|       |
  273|  6.97k|    for (np = *n1; np != NULL;) {
  ------------------
  |  Branch (273:20): [True: 5.47k, False: 1.50k]
  ------------------
  274|  5.47k|        hash = np->hash;
  275|  5.47k|        if ((hash % nni) != p) { /* move it */
  ------------------
  |  Branch (275:13): [True: 786, False: 4.68k]
  ------------------
  276|    786|            *n1 = (*n1)->next;
  277|    786|            np->next = *n2;
  278|    786|            *n2 = np;
  279|    786|        } else
  280|  4.68k|            n1 = &((*n1)->next);
  281|  5.47k|        np = *n1;
  282|  5.47k|    }
  283|       |
  284|  1.50k|    return 1;
  285|  1.50k|}
lhash.c:getrn:
  322|  8.80k|{
  323|  8.80k|    OPENSSL_LH_NODE **ret, *n1;
  324|  8.80k|    unsigned long hash, nn;
  325|       |
  326|  8.80k|    if (lh->hashw != NULL)
  ------------------
  |  Branch (326:9): [True: 8.80k, False: 0]
  ------------------
  327|  8.80k|        hash = lh->hashw(data, lh->hash);
  328|      0|    else
  329|      0|        hash = lh->hash(data);
  330|       |
  331|  8.80k|    *rhash = hash;
  332|       |
  333|  8.80k|    nn = hash % lh->pmax;
  334|  8.80k|    if (nn < lh->p)
  ------------------
  |  Branch (334:9): [True: 4.07k, False: 4.72k]
  ------------------
  335|  4.07k|        nn = hash % lh->num_alloc_nodes;
  336|       |
  337|  8.80k|    ret = &(lh->b[(int)nn]);
  338|  22.5k|    for (n1 = *ret; n1 != NULL; n1 = n1->next) {
  ------------------
  |  Branch (338:21): [True: 19.3k, False: 3.22k]
  ------------------
  339|  19.3k|        if (n1->hash != hash) {
  ------------------
  |  Branch (339:13): [True: 13.4k, False: 5.89k]
  ------------------
  340|  13.4k|            ret = &(n1->next);
  341|  13.4k|            continue;
  342|  13.4k|        }
  343|       |
  344|  5.89k|        if (lh->compw != NULL) {
  ------------------
  |  Branch (344:13): [True: 5.89k, False: 0]
  ------------------
  345|  5.89k|            if (lh->compw(n1->data, data, lh->comp) == 0)
  ------------------
  |  Branch (345:17): [True: 5.57k, False: 316]
  ------------------
  346|  5.57k|                break;
  347|  5.89k|        } else {
  348|      0|            if (lh->comp(n1->data, data) == 0)
  ------------------
  |  Branch (348:17): [True: 0, False: 0]
  ------------------
  349|      0|                break;
  350|      0|        }
  351|    316|        ret = &(n1->next);
  352|    316|    }
  353|  8.80k|    return ret;
  354|  8.80k|}

CRYPTO_malloc:
  187|   103k|{
  188|   103k|    void *ptr;
  189|       |
  190|   103k|    INCREMENT(malloc_count);
  191|   103k|    if (malloc_impl != CRYPTO_malloc) {
  ------------------
  |  Branch (191:9): [True: 0, False: 103k]
  ------------------
  192|      0|        ptr = malloc_impl(num, file, line);
  193|      0|        if (ptr != NULL || num == 0)
  ------------------
  |  Branch (193:13): [True: 0, False: 0]
  |  Branch (193:28): [True: 0, False: 0]
  ------------------
  194|      0|            return ptr;
  195|      0|        goto err;
  196|      0|    }
  197|       |
  198|   103k|    if (num == 0)
  ------------------
  |  Branch (198:9): [True: 0, False: 103k]
  ------------------
  199|      0|        return NULL;
  200|       |
  201|   103k|    FAILTEST();
  202|   103k|    if (allow_customize) {
  ------------------
  |  Branch (202:9): [True: 2, False: 103k]
  ------------------
  203|       |        /*
  204|       |         * Disallow customization after the first allocation. We only set this
  205|       |         * if necessary to avoid a store to the same cache line on every
  206|       |         * allocation.
  207|       |         */
  208|      2|        allow_customize = 0;
  209|      2|    }
  210|       |
  211|   103k|    ptr = malloc(num);
  212|   103k|    if (ptr != NULL)
  ------------------
  |  Branch (212:9): [True: 103k, False: 0]
  ------------------
  213|   103k|        return ptr;
  214|      0| err:
  215|       |    /*
  216|       |     * ossl_err_get_state_int() in err.c uses CRYPTO_zalloc(num, NULL, 0) for
  217|       |     * ERR_STATE allocation. Prevent mem alloc error loop while reporting error.
  218|       |     */
  219|      0|    if (file != NULL || line != 0) {
  ------------------
  |  Branch (219:9): [True: 0, False: 0]
  |  Branch (219:25): [True: 0, False: 0]
  ------------------
  220|      0|        ERR_new();
  221|      0|        ERR_set_debug(file, line, NULL);
  222|      0|        ERR_set_error(ERR_LIB_CRYPTO, ERR_R_MALLOC_FAILURE, NULL);
  ------------------
  |  |   85|      0|# define ERR_LIB_CRYPTO          15
  ------------------
                      ERR_set_error(ERR_LIB_CRYPTO, ERR_R_MALLOC_FAILURE, NULL);
  ------------------
  |  |  351|      0|# define ERR_R_MALLOC_FAILURE                    (256|ERR_R_FATAL)
  |  |  ------------------
  |  |  |  |  350|      0|# define ERR_R_FATAL                             (ERR_RFLAG_FATAL|ERR_RFLAG_COMMON)
  |  |  |  |  ------------------
  |  |  |  |  |  |  236|      0|# define ERR_RFLAG_FATAL                (0x1 << ERR_RFLAGS_OFFSET)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  228|      0|# define ERR_RFLAGS_OFFSET              18L
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               # define ERR_R_FATAL                             (ERR_RFLAG_FATAL|ERR_RFLAG_COMMON)
  |  |  |  |  ------------------
  |  |  |  |  |  |  237|      0|# define ERR_RFLAG_COMMON               (0x2 << ERR_RFLAGS_OFFSET)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  228|      0|# define ERR_RFLAGS_OFFSET              18L
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  223|      0|    }
  224|      0|    return NULL;
  225|   103k|}
CRYPTO_zalloc:
  228|  93.5k|{
  229|  93.5k|    void *ret;
  230|       |
  231|  93.5k|    ret = CRYPTO_malloc(num, file, line);
  232|  93.5k|    if (ret != NULL)
  ------------------
  |  Branch (232:9): [True: 93.5k, False: 0]
  ------------------
  233|  93.5k|        memset(ret, 0, num);
  234|       |
  235|  93.5k|    return ret;
  236|  93.5k|}
CRYPTO_aligned_alloc:
  240|      4|{
  241|      4|    void *ret;
  242|       |
  243|      4|    *freeptr = NULL;
  244|       |
  245|       |#if defined(OPENSSL_SMALL_FOOTPRINT)
  246|       |    ret = freeptr = NULL;
  247|       |    return ret;
  248|       |#endif
  249|       |
  250|       |    /* Allow non-malloc() allocations as long as no malloc_impl is provided. */
  251|      4|    if (malloc_impl == CRYPTO_malloc) {
  ------------------
  |  Branch (251:9): [True: 4, False: 0]
  ------------------
  252|      4|#if defined(_BSD_SOURCE) || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L)
  253|      4|        if (posix_memalign(&ret, alignment, num))
  ------------------
  |  Branch (253:13): [True: 0, False: 4]
  ------------------
  254|      0|            return NULL;
  255|      4|        *freeptr = ret;
  256|      4|        return ret;
  257|       |#elif defined(_ISOC11_SOURCE)
  258|       |        ret = *freeptr = aligned_alloc(alignment, num);
  259|       |        return ret;
  260|       |#endif
  261|      4|    }
  262|       |
  263|       |    /* we have to do this the hard way */
  264|       |
  265|       |    /*
  266|       |     * Note: Windows supports an _aligned_malloc call, but we choose
  267|       |     * not to use it here, because allocations from that function
  268|       |     * require that they be freed via _aligned_free.  Given that
  269|       |     * we can't differentiate plain malloc blocks from blocks obtained
  270|       |     * via _aligned_malloc, just avoid its use entirely
  271|       |     */
  272|       |
  273|       |    /*
  274|       |     * Step 1: Allocate an amount of memory that is <alignment>
  275|       |     * bytes bigger than requested
  276|       |     */
  277|      0|    *freeptr = CRYPTO_malloc(num + alignment, file, line);
  278|      0|    if (*freeptr == NULL)
  ------------------
  |  Branch (278:9): [True: 0, False: 0]
  ------------------
  279|      0|        return NULL;
  280|       |
  281|       |    /*
  282|       |     * Step 2: Add <alignment - 1> bytes to the pointer
  283|       |     * This will cross the alignment boundary that is
  284|       |     * requested
  285|       |     */
  286|      0|    ret = (void *)((char *)*freeptr + (alignment - 1));
  287|       |
  288|       |    /*
  289|       |     * Step 3: Use the alignment as a mask to translate the
  290|       |     * least significant bits of the allocation at the alignment
  291|       |     * boundary to 0.  ret now holds a pointer to the memory
  292|       |     * buffer at the requested alignment
  293|       |     * NOTE: It is a documented requirement that alignment be a
  294|       |     * power of 2, which is what allows this to work
  295|       |     */
  296|      0|    ret = (void *)((uintptr_t)ret & (uintptr_t)(~(alignment - 1)));
  297|      0|    return ret;
  298|      0|}
CRYPTO_realloc:
  301|     14|{
  302|     14|    INCREMENT(realloc_count);
  303|     14|    if (realloc_impl != CRYPTO_realloc)
  ------------------
  |  Branch (303:9): [True: 0, False: 14]
  ------------------
  304|      0|        return realloc_impl(str, num, file, line);
  305|       |
  306|     14|    if (str == NULL)
  ------------------
  |  Branch (306:9): [True: 0, False: 14]
  ------------------
  307|      0|        return CRYPTO_malloc(num, file, line);
  308|       |
  309|     14|    if (num == 0) {
  ------------------
  |  Branch (309:9): [True: 0, False: 14]
  ------------------
  310|      0|        CRYPTO_free(str, file, line);
  311|      0|        return NULL;
  312|      0|    }
  313|       |
  314|     14|    FAILTEST();
  315|     14|    return realloc(str, num);
  316|     14|}
CRYPTO_free:
  346|   205k|{
  347|   205k|    INCREMENT(free_count);
  348|   205k|    if (free_impl != CRYPTO_free) {
  ------------------
  |  Branch (348:9): [True: 0, False: 205k]
  ------------------
  349|      0|        free_impl(str, file, line);
  350|      0|        return;
  351|      0|    }
  352|       |
  353|   205k|    free(str);
  354|   205k|}
CRYPTO_clear_free:
  357|  59.1k|{
  358|  59.1k|    if (str == NULL)
  ------------------
  |  Branch (358:9): [True: 0, False: 59.1k]
  ------------------
  359|      0|        return;
  360|  59.1k|    if (num)
  ------------------
  |  Branch (360:9): [True: 59.1k, False: 0]
  ------------------
  361|  59.1k|        OPENSSL_cleanse(str, num);
  362|  59.1k|    CRYPTO_free(str, file, line);
  363|  59.1k|}

CRYPTO_secure_malloc_done:
  132|      2|{
  133|      2|#ifndef OPENSSL_NO_SECURE_MEMORY
  134|      2|    if (secure_mem_used == 0) {
  ------------------
  |  Branch (134:9): [True: 2, False: 0]
  ------------------
  135|      2|        sh_done();
  136|      2|        secure_mem_initialized = 0;
  137|      2|        CRYPTO_THREAD_lock_free(sec_malloc_lock);
  138|      2|        sec_malloc_lock = NULL;
  139|      2|        return 1;
  140|      2|    }
  141|      0|#endif /* OPENSSL_NO_SECURE_MEMORY */
  142|      0|    return 0;
  143|      2|}
mem_sec.c:sh_done:
  599|      2|{
  600|      2|    OPENSSL_free(sh.freelist);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  601|      2|    OPENSSL_free(sh.bittable);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  602|      2|    OPENSSL_free(sh.bitmalloc);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  603|      2|#if !defined(_WIN32)
  604|      2|    if (sh.map_result != MAP_FAILED && sh.map_size)
  ------------------
  |  Branch (604:9): [True: 2, False: 0]
  |  Branch (604:40): [True: 0, False: 2]
  ------------------
  605|      0|        munmap(sh.map_result, sh.map_size);
  606|       |#else
  607|       |    if (sh.map_result != NULL && sh.map_size)
  608|       |        VirtualFree(sh.map_result, 0, MEM_RELEASE);
  609|       |#endif
  610|      2|    memset(&sh, 0, sizeof(sh));
  611|      2|}

CRYPTO_strdup:
   23|      2|{
   24|      2|    char *ret;
   25|       |
   26|      2|    if (str == NULL)
  ------------------
  |  Branch (26:9): [True: 0, False: 2]
  ------------------
   27|      0|        return NULL;
   28|      2|    ret = CRYPTO_malloc(strlen(str) + 1, file, line);
   29|      2|    if (ret != NULL)
  ------------------
  |  Branch (29:9): [True: 2, False: 0]
  ------------------
   30|      2|        strcpy(ret, str);
   31|      2|    return ret;
   32|      2|}

OBJ_NAME_cleanup:
  368|      8|{
  369|      8|    unsigned long down_load;
  370|       |
  371|      8|    if (names_lh == NULL)
  ------------------
  |  Branch (371:9): [True: 8, False: 0]
  ------------------
  372|      8|        return;
  373|       |
  374|      0|    free_type = type;
  375|      0|    down_load = lh_OBJ_NAME_get_down_load(names_lh);
  376|      0|    lh_OBJ_NAME_set_down_load(names_lh, 0);
  377|       |
  378|      0|    lh_OBJ_NAME_doall(names_lh, names_lh_free_doall);
  379|      0|    if (type < 0) {
  ------------------
  |  Branch (379:9): [True: 0, False: 0]
  ------------------
  380|      0|        lh_OBJ_NAME_free(names_lh);
  381|      0|        sk_NAME_FUNCS_pop_free(name_funcs_stack, name_funcs_free);
  382|      0|        CRYPTO_THREAD_lock_free(obj_lock);
  383|      0|        names_lh = NULL;
  384|      0|        name_funcs_stack = NULL;
  385|      0|        obj_lock = NULL;
  386|      0|    } else
  387|      0|        lh_OBJ_NAME_set_down_load(names_lh, down_load);
  388|      0|}

ossl_obj_cleanup_int:
  212|      2|{
  213|      2|    if (added != NULL) {
  ------------------
  |  Branch (213:9): [True: 0, False: 2]
  ------------------
  214|      0|        lh_ADDED_OBJ_set_down_load(added, 0);
  215|      0|        lh_ADDED_OBJ_doall(added, cleanup1_doall); /* zero counters */
  216|      0|        lh_ADDED_OBJ_doall(added, cleanup2_doall); /* set counters */
  217|      0|        lh_ADDED_OBJ_doall(added, cleanup3_doall); /* free objects */
  218|      0|        lh_ADDED_OBJ_free(added);
  219|      0|        added = NULL;
  220|      0|    }
  221|      2|    objs_free_locks();
  222|      2|}
obj_dat.c:objs_free_locks:
   49|      2|{
   50|      2|    CRYPTO_THREAD_lock_free(ossl_obj_lock);
   51|      2|    ossl_obj_lock = NULL;
   52|       |#ifdef TSAN_REQUIRES_LOCKING
   53|       |    CRYPTO_THREAD_lock_free(ossl_obj_nid_lock);
   54|       |    ossl_obj_nid_lock = NULL;
   55|       |#endif
   56|      2|}

ossl_err_load_OBJ_strings:
   28|      2|{
   29|      2|#ifndef OPENSSL_NO_ERR
   30|      2|    if (ERR_reason_error_string(OBJ_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (30:9): [True: 2, False: 0]
  ------------------
   31|      2|        ERR_load_strings_const(OBJ_str_reasons);
   32|      2|#endif
   33|      2|    return 1;
   34|      2|}

OBJ_sigid_free:
  215|      2|{
  216|      2|    sk_nid_triple_pop_free(sig_app, sid_free);
  217|      2|    sk_nid_triple_free(sigx_app);
  218|      2|    CRYPTO_THREAD_lock_free(sig_lock);
  219|      2|    sig_app = NULL;
  220|      2|    sigx_app = NULL;
  221|      2|    sig_lock = NULL;
  222|      2|}

ossl_err_load_OCSP_strings:
   66|      2|{
   67|      2|# ifndef OPENSSL_NO_ERR
   68|      2|    if (ERR_reason_error_string(OCSP_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (68:9): [True: 2, False: 0]
  ------------------
   69|      2|        ERR_load_strings_const(OCSP_str_reasons);
   70|      2|# endif
   71|      2|    return 1;
   72|      2|}

ossl_err_load_PEM_strings:
   70|      2|{
   71|      2|#ifndef OPENSSL_NO_ERR
   72|      2|    if (ERR_reason_error_string(PEM_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (72:9): [True: 2, False: 0]
  ------------------
   73|      2|        ERR_load_strings_const(PEM_str_reasons);
   74|      2|#endif
   75|      2|    return 1;
   76|      2|}

ossl_err_load_PKCS12_strings:
   56|      2|{
   57|      2|#ifndef OPENSSL_NO_ERR
   58|      2|    if (ERR_reason_error_string(PKCS12_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (58:9): [True: 2, False: 0]
  ------------------
   59|      2|        ERR_load_strings_const(PKCS12_str_reasons);
   60|      2|#endif
   61|      2|    return 1;
   62|      2|}

ossl_err_load_PKCS7_strings:
   92|      2|{
   93|      2|#ifndef OPENSSL_NO_ERR
   94|      2|    if (ERR_reason_error_string(PKCS7_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (94:9): [True: 2, False: 0]
  ------------------
   95|      2|        ERR_load_strings_const(PKCS7_str_reasons);
   96|      2|#endif
   97|      2|    return 1;
   98|      2|}

ossl_property_defns_free:
   52|      2|{
   53|      2|    LHASH_OF(PROPERTY_DEFN_ELEM) *property_defns = vproperty_defns;
  ------------------
  |  |  149|      2|# define LHASH_OF(type) struct lhash_st_##type
  ------------------
   54|       |
   55|      2|    if (property_defns != NULL) {
  ------------------
  |  Branch (55:9): [True: 2, False: 0]
  ------------------
   56|      2|        lh_PROPERTY_DEFN_ELEM_doall(property_defns,
   57|      2|                                    &property_defn_free);
   58|      2|        lh_PROPERTY_DEFN_ELEM_free(property_defns);
   59|      2|    }
   60|      2|}
ossl_property_defns_new:
   62|      2|void *ossl_property_defns_new(OSSL_LIB_CTX *ctx) {
   63|      2|    return lh_PROPERTY_DEFN_ELEM_new(&property_defn_hash, &property_defn_cmp);
   64|      2|}

ossl_ctx_global_properties_free:
  115|      2|{
  116|      2|    OSSL_GLOBAL_PROPERTIES *globp = vglobp;
  117|       |
  118|      2|    if (globp != NULL) {
  ------------------
  |  Branch (118:9): [True: 2, False: 0]
  ------------------
  119|      2|        ossl_property_free(globp->list);
  120|      2|        OPENSSL_free(globp);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  121|      2|    }
  122|      2|}
ossl_ctx_global_properties_new:
  125|      2|{
  126|      2|    return OPENSSL_zalloc(sizeof(OSSL_GLOBAL_PROPERTIES));
  ------------------
  |  |  104|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  127|      2|}
ossl_method_store_new:
  244|      8|{
  245|      8|    OSSL_METHOD_STORE *res;
  246|       |
  247|      8|    res = OPENSSL_zalloc(sizeof(*res));
  ------------------
  |  |  104|      8|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      8|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      8|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  248|      8|    if (res != NULL) {
  ------------------
  |  Branch (248:9): [True: 8, False: 0]
  ------------------
  249|      8|        res->ctx = ctx;
  250|      8|        if ((res->algs = ossl_sa_ALGORITHM_new()) == NULL
  ------------------
  |  Branch (250:13): [True: 0, False: 8]
  ------------------
  251|      8|            || (res->lock = CRYPTO_THREAD_lock_new()) == NULL
  ------------------
  |  Branch (251:16): [True: 0, False: 8]
  ------------------
  252|      8|            || (res->biglock = CRYPTO_THREAD_lock_new()) == NULL) {
  ------------------
  |  Branch (252:16): [True: 0, False: 8]
  ------------------
  253|      0|            ossl_method_store_free(res);
  254|      0|            return NULL;
  255|      0|        }
  256|      8|    }
  257|      8|    return res;
  258|      8|}
ossl_method_store_free:
  261|      8|{
  262|      8|    if (store != NULL) {
  ------------------
  |  Branch (262:9): [True: 8, False: 0]
  ------------------
  263|      8|        if (store->algs != NULL)
  ------------------
  |  Branch (263:13): [True: 8, False: 0]
  ------------------
  264|      8|            ossl_sa_ALGORITHM_doall_arg(store->algs, &alg_cleanup, store);
  265|      8|        ossl_sa_ALGORITHM_free(store->algs);
  266|      8|        CRYPTO_THREAD_lock_free(store->lock);
  267|      8|        CRYPTO_THREAD_lock_free(store->biglock);
  268|      8|        OPENSSL_free(store);
  ------------------
  |  |  115|      8|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      8|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      8|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  269|      8|    }
  270|      8|}

ossl_err_load_PROP_strings:
   40|      2|{
   41|      2|#ifndef OPENSSL_NO_ERR
   42|      2|    if (ERR_reason_error_string(PROP_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (42:9): [True: 2, False: 0]
  ------------------
   43|      2|        ERR_load_strings_const(PROP_str_reasons);
   44|      2|#endif
   45|      2|    return 1;
   46|      2|}

ossl_property_free:
  530|      2|{
  531|      2|    OPENSSL_free(p);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  532|      2|}
ossl_property_parse_init:
  575|      2|{
  576|      2|    static const char *const predefined_names[] = {
  577|      2|        "provider",     /* Name of provider (default, legacy, fips) */
  578|      2|        "version",      /* Version number of this provider */
  579|      2|        "fips",         /* FIPS validated or FIPS supporting algorithm */
  580|      2|        "output",       /* Output type for encoders */
  581|      2|        "input",        /* Input type for decoders */
  582|      2|        "structure",    /* Structure name for encoders and decoders */
  583|      2|    };
  584|      2|    size_t i;
  585|       |
  586|     14|    for (i = 0; i < OSSL_NELEM(predefined_names); i++)
  ------------------
  |  |   14|     14|# define OSSL_NELEM(x)    (sizeof(x)/sizeof((x)[0]))
  ------------------
  |  Branch (586:17): [True: 12, False: 2]
  ------------------
  587|     12|        if (ossl_property_name(ctx, predefined_names[i], 1) == 0)
  ------------------
  |  Branch (587:13): [True: 0, False: 12]
  ------------------
  588|      0|            goto err;
  589|       |
  590|       |    /*
  591|       |     * Pre-populate the two Boolean values. We must do them before any other
  592|       |     * values and in this order so that we get the same index as the global
  593|       |     * OSSL_PROPERTY_TRUE and OSSL_PROPERTY_FALSE values
  594|       |     */
  595|      2|    if ((ossl_property_value(ctx, "yes", 1) != OSSL_PROPERTY_TRUE)
  ------------------
  |  |   37|      2|#define OSSL_PROPERTY_TRUE      1
  ------------------
  |  Branch (595:9): [True: 0, False: 2]
  ------------------
  596|      2|        || (ossl_property_value(ctx, "no", 1) != OSSL_PROPERTY_FALSE))
  ------------------
  |  |   38|      2|#define OSSL_PROPERTY_FALSE     2
  ------------------
  |  Branch (596:12): [True: 0, False: 2]
  ------------------
  597|      0|        goto err;
  598|       |
  599|      2|    return 1;
  600|      0|err:
  601|      0|    return 0;
  602|      2|}

ossl_property_string_data_free:
   77|      2|{
   78|      2|    PROPERTY_STRING_DATA *propdata = vpropdata;
   79|       |
   80|      2|    if (propdata == NULL)
  ------------------
  |  Branch (80:9): [True: 0, False: 2]
  ------------------
   81|      0|        return;
   82|       |
   83|      2|    CRYPTO_THREAD_lock_free(propdata->lock);
   84|      2|    property_table_free(&propdata->prop_names);
   85|      2|    property_table_free(&propdata->prop_values);
   86|      2|#ifndef OPENSSL_SMALL_FOOTPRINT
   87|      2|    sk_OPENSSL_CSTRING_free(propdata->prop_namelist);
  ------------------
  |  |  261|      2|#define sk_OPENSSL_CSTRING_free(sk) OPENSSL_sk_free(ossl_check_OPENSSL_CSTRING_sk_type(sk))
  ------------------
   88|      2|    sk_OPENSSL_CSTRING_free(propdata->prop_valuelist);
  ------------------
  |  |  261|      2|#define sk_OPENSSL_CSTRING_free(sk) OPENSSL_sk_free(ossl_check_OPENSSL_CSTRING_sk_type(sk))
  ------------------
   89|      2|    propdata->prop_namelist = propdata->prop_valuelist = NULL;
   90|      2|#endif
   91|      2|    propdata->prop_name_idx = propdata->prop_value_idx = 0;
   92|       |
   93|      2|    OPENSSL_free(propdata);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   94|      2|}
ossl_property_string_data_new:
   96|      2|void *ossl_property_string_data_new(OSSL_LIB_CTX *ctx) {
   97|      2|    PROPERTY_STRING_DATA *propdata = OPENSSL_zalloc(sizeof(*propdata));
  ------------------
  |  |  104|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   98|       |
   99|      2|    if (propdata == NULL)
  ------------------
  |  Branch (99:9): [True: 0, False: 2]
  ------------------
  100|      0|        return NULL;
  101|       |
  102|      2|    propdata->lock = CRYPTO_THREAD_lock_new();
  103|      2|    propdata->prop_names = lh_PROPERTY_STRING_new(&property_hash,
  104|      2|                                                  &property_cmp);
  105|      2|    propdata->prop_values = lh_PROPERTY_STRING_new(&property_hash,
  106|      2|                                                   &property_cmp);
  107|      2|#ifndef OPENSSL_SMALL_FOOTPRINT
  108|      2|    propdata->prop_namelist = sk_OPENSSL_CSTRING_new_null();
  ------------------
  |  |  258|      2|#define sk_OPENSSL_CSTRING_new_null() ((STACK_OF(OPENSSL_CSTRING) *)OPENSSL_sk_new_null())
  ------------------
  109|      2|    propdata->prop_valuelist = sk_OPENSSL_CSTRING_new_null();
  ------------------
  |  |  258|      2|#define sk_OPENSSL_CSTRING_new_null() ((STACK_OF(OPENSSL_CSTRING) *)OPENSSL_sk_new_null())
  ------------------
  110|      2|#endif
  111|      2|    if (propdata->lock == NULL
  ------------------
  |  Branch (111:9): [True: 0, False: 2]
  ------------------
  112|      2|#ifndef OPENSSL_SMALL_FOOTPRINT
  113|      2|            || propdata->prop_namelist == NULL
  ------------------
  |  Branch (113:16): [True: 0, False: 2]
  ------------------
  114|      2|            || propdata->prop_valuelist == NULL
  ------------------
  |  Branch (114:16): [True: 0, False: 2]
  ------------------
  115|      2|#endif
  116|      2|            || propdata->prop_names == NULL
  ------------------
  |  Branch (116:16): [True: 0, False: 2]
  ------------------
  117|      2|            || propdata->prop_values == NULL) {
  ------------------
  |  Branch (117:16): [True: 0, False: 2]
  ------------------
  118|      0|        ossl_property_string_data_free(propdata);
  119|      0|        return NULL;
  120|      0|    }
  121|      2|    return propdata;
  122|      2|}
ossl_property_name:
  253|     12|{
  254|     12|    return ossl_property_string(ctx, 1, create, s);
  255|     12|}
ossl_property_value:
  264|      4|{
  265|      4|    return ossl_property_string(ctx, 0, create, s);
  266|      4|}
property_string.c:property_table_free:
   66|      4|{
   67|      4|    PROP_TABLE *t = *pt;
   68|       |
   69|      4|    if (t != NULL) {
  ------------------
  |  Branch (69:9): [True: 4, False: 0]
  ------------------
   70|      4|        lh_PROPERTY_STRING_doall(t, &property_free);
   71|      4|        lh_PROPERTY_STRING_free(t);
   72|      4|        *pt = NULL;
   73|      4|    }
   74|      4|}
property_string.c:property_free:
   61|     16|{
   62|     16|    OPENSSL_free(ps);
  ------------------
  |  |  115|     16|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     16|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     16|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   63|     16|}
property_string.c:property_hash:
   51|     48|{
   52|     48|    return OPENSSL_LH_strhash(a->s);
   53|     48|}
property_string.c:ossl_property_string:
  144|     16|{
  145|     16|    PROPERTY_STRING p, *ps, *ps_new;
  146|     16|    PROP_TABLE *t;
  147|     16|    OSSL_PROPERTY_IDX *pidx;
  148|     16|    PROPERTY_STRING_DATA *propdata
  149|     16|        = ossl_lib_ctx_get_data(ctx, OSSL_LIB_CTX_PROPERTY_STRING_INDEX);
  ------------------
  |  |  101|     16|# define OSSL_LIB_CTX_PROPERTY_STRING_INDEX          3
  ------------------
  150|       |
  151|     16|    if (propdata == NULL)
  ------------------
  |  Branch (151:9): [True: 0, False: 16]
  ------------------
  152|      0|        return 0;
  153|       |
  154|     16|    t = name ? propdata->prop_names : propdata->prop_values;
  ------------------
  |  Branch (154:9): [True: 12, False: 4]
  ------------------
  155|     16|    p.s = s;
  156|     16|    if (!CRYPTO_THREAD_read_lock(propdata->lock)) {
  ------------------
  |  Branch (156:9): [True: 0, False: 16]
  ------------------
  157|      0|        ERR_raise(ERR_LIB_CRYPTO, ERR_R_UNABLE_TO_GET_READ_LOCK);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  158|      0|        return 0;
  159|      0|    }
  160|     16|    ps = lh_PROPERTY_STRING_retrieve(t, &p);
  161|     16|    if (ps == NULL && create) {
  ------------------
  |  Branch (161:9): [True: 16, False: 0]
  |  Branch (161:23): [True: 16, False: 0]
  ------------------
  162|     16|        CRYPTO_THREAD_unlock(propdata->lock);
  163|     16|        if (!CRYPTO_THREAD_write_lock(propdata->lock)) {
  ------------------
  |  Branch (163:13): [True: 0, False: 16]
  ------------------
  164|      0|            ERR_raise(ERR_LIB_CRYPTO, ERR_R_UNABLE_TO_GET_WRITE_LOCK);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  165|      0|            return 0;
  166|      0|        }
  167|     16|        pidx = name ? &propdata->prop_name_idx : &propdata->prop_value_idx;
  ------------------
  |  Branch (167:16): [True: 12, False: 4]
  ------------------
  168|     16|        ps = lh_PROPERTY_STRING_retrieve(t, &p);
  169|     16|        if (ps == NULL && (ps_new = new_property_string(s, pidx)) != NULL) {
  ------------------
  |  Branch (169:13): [True: 16, False: 0]
  |  Branch (169:27): [True: 16, False: 0]
  ------------------
  170|     16|#ifndef OPENSSL_SMALL_FOOTPRINT
  171|     16|            STACK_OF(OPENSSL_CSTRING) *slist;
  ------------------
  |  |   31|     16|# define STACK_OF(type) struct stack_st_##type
  ------------------
  172|       |
  173|     16|            slist = name ? propdata->prop_namelist : propdata->prop_valuelist;
  ------------------
  |  Branch (173:21): [True: 12, False: 4]
  ------------------
  174|     16|            if (sk_OPENSSL_CSTRING_push(slist, ps_new->s) <= 0) {
  ------------------
  |  |  265|     16|#define sk_OPENSSL_CSTRING_push(sk, ptr) OPENSSL_sk_push(ossl_check_OPENSSL_CSTRING_sk_type(sk), ossl_check_OPENSSL_CSTRING_type(ptr))
  ------------------
  |  Branch (174:17): [True: 0, False: 16]
  ------------------
  175|      0|                property_free(ps_new);
  176|      0|                CRYPTO_THREAD_unlock(propdata->lock);
  177|      0|                return 0;
  178|      0|            }
  179|     16|#endif
  180|     16|            lh_PROPERTY_STRING_insert(t, ps_new);
  181|     16|            if (lh_PROPERTY_STRING_error(t)) {
  ------------------
  |  Branch (181:17): [True: 0, False: 16]
  ------------------
  182|       |                /*-
  183|       |                 * Undo the previous push which means also decrementing the
  184|       |                 * index and freeing the allocated storage.
  185|       |                 */
  186|      0|#ifndef OPENSSL_SMALL_FOOTPRINT
  187|      0|                sk_OPENSSL_CSTRING_pop(slist);
  ------------------
  |  |  267|      0|#define sk_OPENSSL_CSTRING_pop(sk) ((const char *)OPENSSL_sk_pop(ossl_check_OPENSSL_CSTRING_sk_type(sk)))
  ------------------
  188|      0|#endif
  189|      0|                property_free(ps_new);
  190|      0|                --*pidx;
  191|      0|                CRYPTO_THREAD_unlock(propdata->lock);
  192|      0|                return 0;
  193|      0|            }
  194|     16|            ps = ps_new;
  195|     16|        }
  196|     16|    }
  197|     16|    CRYPTO_THREAD_unlock(propdata->lock);
  198|     16|    return ps != NULL ? ps->idx : 0;
  ------------------
  |  Branch (198:12): [True: 16, False: 0]
  ------------------
  199|     16|}
property_string.c:new_property_string:
  126|     16|{
  127|     16|    const size_t l = strlen(s);
  128|     16|    PROPERTY_STRING *ps = OPENSSL_malloc(sizeof(*ps) + l);
  ------------------
  |  |  102|     16|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     16|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     16|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  129|       |
  130|     16|    if (ps != NULL) {
  ------------------
  |  Branch (130:9): [True: 16, False: 0]
  ------------------
  131|     16|        memcpy(ps->body, s, l + 1);
  132|     16|        ps->s = ps->body;
  133|     16|        ps->idx = ++*pidx;
  134|     16|        if (ps->idx == 0) {
  ------------------
  |  Branch (134:13): [True: 0, False: 16]
  ------------------
  135|      0|            OPENSSL_free(ps);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  136|      0|            return NULL;
  137|      0|        }
  138|     16|    }
  139|     16|    return ps;
  140|     16|}

ossl_child_prov_ctx_new:
   38|      2|{
   39|      2|    return OPENSSL_zalloc(sizeof(struct child_prov_globals));
  ------------------
  |  |  104|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   40|      2|}
ossl_child_prov_ctx_free:
   43|      2|{
   44|      2|    struct child_prov_globals *gbl = vgbl;
   45|       |
   46|      2|    CRYPTO_THREAD_lock_free(gbl->lock);
   47|      2|    OPENSSL_free(gbl);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   48|      2|}

ossl_prov_conf_ctx_new:
   31|      2|{
   32|      2|    PROVIDER_CONF_GLOBAL *pcgbl = OPENSSL_zalloc(sizeof(*pcgbl));
  ------------------
  |  |  104|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   33|       |
   34|      2|    if (pcgbl == NULL)
  ------------------
  |  Branch (34:9): [True: 0, False: 2]
  ------------------
   35|      0|        return NULL;
   36|       |
   37|      2|    pcgbl->lock = CRYPTO_THREAD_lock_new();
   38|      2|    if (pcgbl->lock == NULL) {
  ------------------
  |  Branch (38:9): [True: 0, False: 2]
  ------------------
   39|      0|        OPENSSL_free(pcgbl);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   40|      0|        return NULL;
   41|      0|    }
   42|       |
   43|      2|    return pcgbl;
   44|      2|}
ossl_prov_conf_ctx_free:
   47|      2|{
   48|      2|    PROVIDER_CONF_GLOBAL *pcgbl = vpcgbl;
   49|       |
   50|      2|    sk_OSSL_PROVIDER_pop_free(pcgbl->activated_providers,
   51|      2|                              ossl_provider_free);
   52|       |
   53|      2|    OSSL_TRACE(CONF, "Cleaned up providers\n");
  ------------------
  |  |  288|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  283|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
   54|      2|    CRYPTO_THREAD_lock_free(pcgbl->lock);
   55|      2|    OPENSSL_free(pcgbl);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   56|      2|}

ossl_provider_store_free:
  288|      2|{
  289|      2|    struct provider_store_st *store = vstore;
  290|      2|    size_t i;
  291|       |
  292|      2|    if (store == NULL)
  ------------------
  |  Branch (292:9): [True: 0, False: 2]
  ------------------
  293|      0|        return;
  294|      2|    store->freeing = 1;
  295|      2|    OPENSSL_free(store->default_path);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  296|      2|    sk_OSSL_PROVIDER_pop_free(store->providers, provider_deactivate_free);
  297|      2|#ifndef FIPS_MODULE
  298|      2|    sk_OSSL_PROVIDER_CHILD_CB_pop_free(store->child_cbs,
  299|      2|                                       ossl_provider_child_cb_free);
  300|      2|#endif
  301|      2|    CRYPTO_THREAD_lock_free(store->default_path_lock);
  302|      2|    CRYPTO_THREAD_lock_free(store->lock);
  303|      2|    for (i = 0; i < store->numprovinfo; i++)
  ------------------
  |  Branch (303:17): [True: 0, False: 2]
  ------------------
  304|      0|        ossl_provider_info_clear(&store->provinfo[i]);
  305|      2|    OPENSSL_free(store->provinfo);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  306|      2|    OPENSSL_free(store);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  307|      2|}
ossl_provider_store_new:
  310|      2|{
  311|      2|    struct provider_store_st *store = OPENSSL_zalloc(sizeof(*store));
  ------------------
  |  |  104|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  312|       |
  313|      2|    if (store == NULL
  ------------------
  |  Branch (313:9): [True: 0, False: 2]
  ------------------
  314|      2|        || (store->providers = sk_OSSL_PROVIDER_new(ossl_provider_cmp)) == NULL
  ------------------
  |  Branch (314:12): [True: 0, False: 2]
  ------------------
  315|      2|        || (store->default_path_lock = CRYPTO_THREAD_lock_new()) == NULL
  ------------------
  |  Branch (315:12): [True: 0, False: 2]
  ------------------
  316|      2|#ifndef FIPS_MODULE
  317|      2|        || (store->child_cbs = sk_OSSL_PROVIDER_CHILD_CB_new_null()) == NULL
  ------------------
  |  Branch (317:12): [True: 0, False: 2]
  ------------------
  318|      2|#endif
  319|      2|        || (store->lock = CRYPTO_THREAD_lock_new()) == NULL) {
  ------------------
  |  Branch (319:12): [True: 0, False: 2]
  ------------------
  320|      0|        ossl_provider_store_free(store);
  321|      0|        return NULL;
  322|      0|    }
  323|      2|    store->libctx = ctx;
  324|      2|    store->use_fallbacks = 1;
  325|       |
  326|      2|    return store;
  327|      2|}

ossl_err_load_RAND_strings:
  105|      2|{
  106|      2|#ifndef OPENSSL_NO_ERR
  107|      2|    if (ERR_reason_error_string(RAND_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (107:9): [True: 2, False: 0]
  ------------------
  108|      2|        ERR_load_strings_const(RAND_str_reasons);
  109|      2|#endif
  110|      2|    return 1;
  111|      2|}

ossl_rand_cleanup_int:
  180|      2|{
  181|      2|# ifndef OPENSSL_NO_DEPRECATED_3_0
  182|      2|    const RAND_METHOD *meth = default_RAND_meth;
  183|       |
  184|      2|    if (!rand_inited)
  ------------------
  |  Branch (184:9): [True: 2, False: 0]
  ------------------
  185|      2|        return;
  186|       |
  187|      0|    if (meth != NULL && meth->cleanup != NULL)
  ------------------
  |  Branch (187:9): [True: 0, False: 0]
  |  Branch (187:25): [True: 0, False: 0]
  ------------------
  188|      0|        meth->cleanup();
  189|      0|    RAND_set_rand_method(NULL);
  190|      0|# endif     /* !OPENSSL_NO_DEPRECATED_3_0 */
  191|      0|    ossl_rand_pool_cleanup();
  192|      0|# ifndef OPENSSL_NO_ENGINE
  193|      0|    CRYPTO_THREAD_lock_free(rand_engine_lock);
  194|      0|    rand_engine_lock = NULL;
  195|      0|# endif     /* !OPENSSL_NO_ENGINE */
  196|      0|# ifndef OPENSSL_NO_DEPRECATED_3_0
  197|      0|    CRYPTO_THREAD_lock_free(rand_meth_lock);
  198|      0|    rand_meth_lock = NULL;
  199|      0|# endif     /* !OPENSSL_NO_DEPRECATED_3_0 */
  200|      0|    ossl_release_default_drbg_ctx();
  201|      0|    rand_inited = 0;
  202|      0|}
ossl_rand_ctx_new:
  520|      2|{
  521|      2|    RAND_GLOBAL *dgbl = OPENSSL_zalloc(sizeof(*dgbl));
  ------------------
  |  |  104|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  522|       |
  523|      2|    if (dgbl == NULL)
  ------------------
  |  Branch (523:9): [True: 0, False: 2]
  ------------------
  524|      0|        return NULL;
  525|       |
  526|      2|#ifndef FIPS_MODULE
  527|       |    /*
  528|       |     * We need to ensure that base libcrypto thread handling has been
  529|       |     * initialised.
  530|       |     */
  531|      2|    OPENSSL_init_crypto(OPENSSL_INIT_BASE_ONLY, NULL);
  ------------------
  |  |   31|      2|# define OPENSSL_INIT_BASE_ONLY              0x00040000L
  ------------------
  532|       |
  533|       |    /* Prepopulate the random provider name */
  534|      2|    dgbl->random_provider_name = OPENSSL_strdup(random_provider_fips_name);
  ------------------
  |  |  119|      2|        CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  535|      2|    if (dgbl->random_provider_name == NULL)
  ------------------
  |  Branch (535:9): [True: 0, False: 2]
  ------------------
  536|      0|        goto err0;
  537|      2|#endif
  538|       |
  539|      2|    dgbl->lock = CRYPTO_THREAD_lock_new();
  540|      2|    if (dgbl->lock == NULL)
  ------------------
  |  Branch (540:9): [True: 0, False: 2]
  ------------------
  541|      0|        goto err1;
  542|       |
  543|      2|    if (!CRYPTO_THREAD_init_local(&dgbl->private, NULL))
  ------------------
  |  Branch (543:9): [True: 0, False: 2]
  ------------------
  544|      0|        goto err1;
  545|       |
  546|      2|    if (!CRYPTO_THREAD_init_local(&dgbl->public, NULL))
  ------------------
  |  Branch (546:9): [True: 0, False: 2]
  ------------------
  547|      0|        goto err2;
  548|       |
  549|      2|    return dgbl;
  550|       |
  551|      0| err2:
  552|      0|    CRYPTO_THREAD_cleanup_local(&dgbl->private);
  553|      0| err1:
  554|      0|    CRYPTO_THREAD_lock_free(dgbl->lock);
  555|      0|#ifndef FIPS_MODULE
  556|      0| err0:
  557|      0|    OPENSSL_free(dgbl->random_provider_name);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  558|      0|#endif
  559|      0|    OPENSSL_free(dgbl);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  560|      0|    return NULL;
  561|      0|}
ossl_rand_ctx_free:
  564|      2|{
  565|      2|    RAND_GLOBAL *dgbl = vdgbl;
  566|       |
  567|      2|    if (dgbl == NULL)
  ------------------
  |  Branch (567:9): [True: 0, False: 2]
  ------------------
  568|      0|        return;
  569|       |
  570|      2|    CRYPTO_THREAD_lock_free(dgbl->lock);
  571|      2|    CRYPTO_THREAD_cleanup_local(&dgbl->private);
  572|      2|    CRYPTO_THREAD_cleanup_local(&dgbl->public);
  573|      2|    EVP_RAND_CTX_free(dgbl->primary);
  574|      2|    EVP_RAND_CTX_free(dgbl->seed);
  575|      2|#ifndef FIPS_MODULE
  576|      2|    OPENSSL_free(dgbl->random_provider_name);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  577|      2|#endif      /* !FIPS_MODULE */
  578|      2|    OPENSSL_free(dgbl->rng_name);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  579|      2|    OPENSSL_free(dgbl->rng_cipher);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  580|      2|    OPENSSL_free(dgbl->rng_digest);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  581|      2|    OPENSSL_free(dgbl->rng_propq);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  582|      2|    OPENSSL_free(dgbl->seed_name);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  583|      2|    OPENSSL_free(dgbl->seed_propq);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  584|       |
  585|      2|    OPENSSL_free(dgbl);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  586|      2|}

ossl_err_load_RSA_strings:
  160|      2|{
  161|      2|#ifndef OPENSSL_NO_ERR
  162|      2|    if (ERR_reason_error_string(RSA_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (162:9): [True: 2, False: 0]
  ------------------
  163|      2|        ERR_load_strings_const(RSA_str_reasons);
  164|      2|#endif
  165|      2|    return 1;
  166|      2|}

ossl_self_test_set_callback_new:
   35|      2|{
   36|      2|    SELF_TEST_CB *stcb;
   37|       |
   38|      2|    stcb = OPENSSL_zalloc(sizeof(*stcb));
  ------------------
  |  |  104|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   39|      2|    return stcb;
   40|      2|}
ossl_self_test_set_callback_free:
   43|      2|{
   44|      2|    OPENSSL_free(stcb);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   45|      2|}

ossl_sa_new:
   59|      8|{
   60|      8|    OPENSSL_SA *res = OPENSSL_zalloc(sizeof(*res));
  ------------------
  |  |  104|      8|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      8|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      8|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   61|       |
   62|      8|    return res;
   63|      8|}
ossl_sa_free:
  111|      8|{
  112|      8|    if (sa != NULL) {
  ------------------
  |  Branch (112:9): [True: 8, False: 0]
  ------------------
  113|      8|        sa_doall(sa, &sa_free_node, NULL, NULL);
  114|      8|        OPENSSL_free(sa);
  ------------------
  |  |  115|      8|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      8|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      8|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  115|      8|    }
  116|      8|}
ossl_sa_doall_arg:
  146|      8|{
  147|      8|    if (sa != NULL)
  ------------------
  |  Branch (147:9): [True: 8, False: 0]
  ------------------
  148|      8|        sa_doall(sa, NULL, leaf, arg);
  149|      8|}
sparse_array.c:sa_doall:
   67|     16|{
   68|     16|    int i[SA_BLOCK_MAX_LEVELS];
   69|     16|    void *nodes[SA_BLOCK_MAX_LEVELS];
   70|     16|    ossl_uintmax_t idx = 0;
   71|     16|    int l = 0;
   72|       |
   73|     16|    i[0] = 0;
   74|     16|    nodes[0] = sa->nodes;
   75|    288|    while (l >= 0) {
  ------------------
  |  Branch (75:12): [True: 272, False: 16]
  ------------------
   76|    272|        const int n = i[l];
   77|    272|        void ** const p = nodes[l];
   78|       |
   79|    272|        if (n >= SA_BLOCK_MAX) {
  ------------------
  |  |   45|    272|#define SA_BLOCK_MAX            (1 << OPENSSL_SA_BLOCK_BITS)
  |  |  ------------------
  |  |  |  |   34|    272|# define OPENSSL_SA_BLOCK_BITS           4
  |  |  ------------------
  ------------------
  |  Branch (79:13): [True: 16, False: 256]
  ------------------
   80|     16|            if (p != NULL && node != NULL)
  ------------------
  |  Branch (80:17): [True: 0, False: 16]
  |  Branch (80:30): [True: 0, False: 0]
  ------------------
   81|      0|                (*node)(p);
   82|     16|            l--;
   83|     16|            idx >>= OPENSSL_SA_BLOCK_BITS;
  ------------------
  |  |   34|     16|# define OPENSSL_SA_BLOCK_BITS           4
  ------------------
   84|    256|        } else {
   85|    256|            i[l] = n + 1;
   86|    256|            if (p != NULL && p[n] != NULL) {
  ------------------
  |  Branch (86:17): [True: 0, False: 256]
  |  Branch (86:30): [True: 0, False: 0]
  ------------------
   87|      0|                idx = (idx & ~SA_BLOCK_MASK) | n;
  ------------------
  |  |   46|      0|#define SA_BLOCK_MASK           (SA_BLOCK_MAX - 1)
  |  |  ------------------
  |  |  |  |   45|      0|#define SA_BLOCK_MAX            (1 << OPENSSL_SA_BLOCK_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   34|      0|# define OPENSSL_SA_BLOCK_BITS           4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   88|      0|                if (l < sa->levels - 1) {
  ------------------
  |  Branch (88:21): [True: 0, False: 0]
  ------------------
   89|      0|                    i[++l] = 0;
   90|      0|                    nodes[l] = p[n];
   91|      0|                    idx <<= OPENSSL_SA_BLOCK_BITS;
  ------------------
  |  |   34|      0|# define OPENSSL_SA_BLOCK_BITS           4
  ------------------
   92|      0|                } else if (leaf != NULL) {
  ------------------
  |  Branch (92:28): [True: 0, False: 0]
  ------------------
   93|      0|                    (*leaf)(idx, p[n], arg);
   94|      0|                }
   95|      0|            }
   96|    256|        }
   97|    272|    }
   98|     16|}

OPENSSL_sk_dup:
   49|      2|{
   50|      2|    OPENSSL_STACK *ret;
   51|       |
   52|      2|    if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL)
  ------------------
  |  |  102|      2|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (52:9): [True: 0, False: 2]
  ------------------
   53|      0|        goto err;
   54|       |
   55|      2|    if (sk == NULL) {
  ------------------
  |  Branch (55:9): [True: 2, False: 0]
  ------------------
   56|      2|        ret->num = 0;
   57|      2|        ret->sorted = 0;
   58|      2|        ret->comp = NULL;
   59|      2|    } else {
   60|       |        /* direct structure assignment */
   61|      0|        *ret = *sk;
   62|      0|    }
   63|       |
   64|      2|    if (sk == NULL || sk->num == 0) {
  ------------------
  |  Branch (64:9): [True: 2, False: 0]
  |  Branch (64:23): [True: 0, False: 0]
  ------------------
   65|       |        /* postpone |ret->data| allocation */
   66|      2|        ret->data = NULL;
   67|      2|        ret->num_alloc = 0;
   68|      2|        return ret;
   69|      2|    }
   70|       |
   71|       |    /* duplicate |sk->data| content */
   72|      0|    ret->data = OPENSSL_malloc(sizeof(*ret->data) * sk->num_alloc);
  ------------------
  |  |  102|      0|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   73|      0|    if (ret->data == NULL)
  ------------------
  |  Branch (73:9): [True: 0, False: 0]
  ------------------
   74|      0|        goto err;
   75|      0|    memcpy(ret->data, sk->data, sizeof(void *) * sk->num);
   76|      0|    return ret;
   77|       |
   78|      0| err:
   79|      0|    OPENSSL_sk_free(ret);
   80|      0|    return NULL;
   81|      0|}
OPENSSL_sk_new_null:
  132|     12|{
  133|     12|    return OPENSSL_sk_new_reserve(NULL, 0);
  134|     12|}
OPENSSL_sk_new:
  137|      4|{
  138|      4|    return OPENSSL_sk_new_reserve(c, 0);
  139|      4|}
OPENSSL_sk_new_reserve:
  228|     16|{
  229|     16|    OPENSSL_STACK *st = OPENSSL_zalloc(sizeof(OPENSSL_STACK));
  ------------------
  |  |  104|     16|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     16|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     16|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  230|       |
  231|     16|    if (st == NULL)
  ------------------
  |  Branch (231:9): [True: 0, False: 16]
  ------------------
  232|      0|        return NULL;
  233|       |
  234|     16|    st->comp = c;
  235|       |
  236|     16|    if (n <= 0)
  ------------------
  |  Branch (236:9): [True: 16, False: 0]
  ------------------
  237|     16|        return st;
  238|       |
  239|      0|    if (!sk_reserve(st, n, 1)) {
  ------------------
  |  Branch (239:9): [True: 0, False: 0]
  ------------------
  240|      0|        OPENSSL_sk_free(st);
  241|      0|        return NULL;
  242|      0|    }
  243|       |
  244|      0|    return st;
  245|      0|}
OPENSSL_sk_set_thunks:
  260|     52|{
  261|     52|    if (st != NULL)
  ------------------
  |  Branch (261:9): [True: 10, False: 42]
  ------------------
  262|     10|        st->free_thunk = f_thunk;
  263|       |
  264|     52|    return st;
  265|     52|}
OPENSSL_sk_insert:
  268|     18|{
  269|     18|    if (st == NULL) {
  ------------------
  |  Branch (269:9): [True: 0, False: 18]
  ------------------
  270|      0|        ERR_raise(ERR_LIB_CRYPTO, ERR_R_PASSED_NULL_PARAMETER);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  271|      0|        return 0;
  272|      0|    }
  273|     18|    if (st->num == max_nodes) {
  ------------------
  |  Branch (273:9): [True: 0, False: 18]
  ------------------
  274|      0|        ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_TOO_MANY_RECORDS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  275|      0|        return 0;
  276|      0|    }
  277|       |
  278|     18|    if (!sk_reserve(st, 1, 0))
  ------------------
  |  Branch (278:9): [True: 0, False: 18]
  ------------------
  279|      0|        return 0;
  280|       |
  281|     18|    if ((loc >= st->num) || (loc < 0)) {
  ------------------
  |  Branch (281:9): [True: 18, False: 0]
  |  Branch (281:29): [True: 0, False: 0]
  ------------------
  282|     18|        st->data[st->num] = data;
  283|     18|    } else {
  284|      0|        memmove(&st->data[loc + 1], &st->data[loc],
  285|      0|                sizeof(st->data[0]) * (st->num - loc));
  286|      0|        st->data[loc] = data;
  287|      0|    }
  288|     18|    st->num++;
  289|     18|    st->sorted = 0;
  290|     18|    return st->num;
  291|     18|}
OPENSSL_sk_delete:
  319|      2|{
  320|      2|    if (st == NULL || loc < 0 || loc >= st->num)
  ------------------
  |  Branch (320:9): [True: 0, False: 2]
  |  Branch (320:23): [True: 0, False: 2]
  |  Branch (320:34): [True: 0, False: 2]
  ------------------
  321|      0|        return NULL;
  322|       |
  323|      2|    return internal_delete(st, loc);
  324|      2|}
OPENSSL_sk_push:
  407|     18|{
  408|     18|    if (st == NULL)
  ------------------
  |  Branch (408:9): [True: 0, False: 18]
  ------------------
  409|      0|        return 0;
  410|     18|    return OPENSSL_sk_insert(st, data, st->num);
  411|     18|}
OPENSSL_sk_pop_free:
  441|     52|{
  442|     52|    int i;
  443|       |
  444|     52|    if (st == NULL)
  ------------------
  |  Branch (444:9): [True: 42, False: 10]
  ------------------
  445|     42|        return;
  446|       |
  447|     10|    for (i = 0; i < st->num; i++) {
  ------------------
  |  Branch (447:17): [True: 0, False: 10]
  ------------------
  448|      0|        if (st->data[i] != NULL) {
  ------------------
  |  Branch (448:13): [True: 0, False: 0]
  ------------------
  449|      0|            if (st->free_thunk != NULL)
  ------------------
  |  Branch (449:17): [True: 0, False: 0]
  ------------------
  450|      0|                st->free_thunk(func, (void *)st->data[i]);
  451|      0|            else
  452|      0|                func((void *)st->data[i]);
  453|      0|        }
  454|      0|    }
  455|     10|    OPENSSL_sk_free(st);
  456|     10|}
OPENSSL_sk_free:
  459|     28|{
  460|     28|    if (st == NULL)
  ------------------
  |  Branch (460:9): [True: 10, False: 18]
  ------------------
  461|     10|        return;
  462|     18|    OPENSSL_free(st->data);
  ------------------
  |  |  115|     18|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     18|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     18|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  463|     18|    OPENSSL_free(st);
  ------------------
  |  |  115|     18|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     18|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     18|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  464|     18|}
OPENSSL_sk_num:
  467|     10|{
  468|     10|    return st == NULL ? -1 : st->num;
  ------------------
  |  Branch (468:12): [True: 2, False: 8]
  ------------------
  469|     10|}
OPENSSL_sk_value:
  472|      2|{
  473|      2|    if (st == NULL || i < 0 || i >= st->num)
  ------------------
  |  Branch (473:9): [True: 0, False: 2]
  |  Branch (473:23): [True: 0, False: 2]
  |  Branch (473:32): [True: 0, False: 2]
  ------------------
  474|      0|        return NULL;
  475|      2|    return (void *)st->data[i];
  476|      2|}
stack.c:sk_reserve:
  179|     18|{
  180|     18|    const void **tmpdata;
  181|     18|    int num_alloc;
  182|       |
  183|       |    /* Check to see the reservation isn't exceeding the hard limit */
  184|     18|    if (n > max_nodes - st->num) {
  ------------------
  |  Branch (184:9): [True: 0, False: 18]
  ------------------
  185|      0|        ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_TOO_MANY_RECORDS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  186|      0|        return 0;
  187|      0|    }
  188|       |
  189|       |    /* Figure out the new size */
  190|     18|    num_alloc = st->num + n;
  191|     18|    if (num_alloc < min_nodes)
  ------------------
  |  Branch (191:9): [True: 12, False: 6]
  ------------------
  192|     12|        num_alloc = min_nodes;
  193|       |
  194|       |    /* If |st->data| allocation was postponed */
  195|     18|    if (st->data == NULL) {
  ------------------
  |  Branch (195:9): [True: 6, False: 12]
  ------------------
  196|       |        /*
  197|       |         * At this point, |st->num_alloc| and |st->num| are 0;
  198|       |         * so |num_alloc| value is |n| or |min_nodes| if greater than |n|.
  199|       |         */
  200|      6|        if ((st->data = OPENSSL_zalloc(sizeof(void *) * num_alloc)) == NULL)
  ------------------
  |  |  104|      6|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      6|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      6|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (200:13): [True: 0, False: 6]
  ------------------
  201|      0|            return 0;
  202|      6|        st->num_alloc = num_alloc;
  203|      6|        return 1;
  204|      6|    }
  205|       |
  206|     12|    if (!exact) {
  ------------------
  |  Branch (206:9): [True: 12, False: 0]
  ------------------
  207|     12|        if (num_alloc <= st->num_alloc)
  ------------------
  |  Branch (207:13): [True: 10, False: 2]
  ------------------
  208|     10|            return 1;
  209|      2|        num_alloc = compute_growth(num_alloc, st->num_alloc);
  210|      2|        if (num_alloc == 0) {
  ------------------
  |  Branch (210:13): [True: 0, False: 2]
  ------------------
  211|      0|            ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_TOO_MANY_RECORDS);
  ------------------
  |  |  401|      0|# define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL)
  |  |  ------------------
  |  |  |  |  403|      0|    (ERR_new(),                                                 \
  |  |  |  |  404|      0|     ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  323|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  212|      0|            return 0;
  213|      0|        }
  214|      2|    } else if (num_alloc == st->num_alloc) {
  ------------------
  |  Branch (214:16): [True: 0, False: 0]
  ------------------
  215|      0|        return 1;
  216|      0|    }
  217|       |
  218|      2|    tmpdata = OPENSSL_realloc((void *)st->data, sizeof(void *) * num_alloc);
  ------------------
  |  |  109|      2|        CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  219|      2|    if (tmpdata == NULL)
  ------------------
  |  Branch (219:9): [True: 0, False: 2]
  ------------------
  220|      0|        return 0;
  221|       |
  222|      2|    st->data = tmpdata;
  223|      2|    st->num_alloc = num_alloc;
  224|      2|    return 1;
  225|      2|}
stack.c:compute_growth:
  161|      2|{
  162|      2|    int err = 0;
  163|       |
  164|      4|    while (current < target) {
  ------------------
  |  Branch (164:12): [True: 2, False: 2]
  ------------------
  165|      2|        if (current >= max_nodes)
  ------------------
  |  Branch (165:13): [True: 0, False: 2]
  ------------------
  166|      0|            return 0;
  167|       |
  168|      2|        current = safe_muldiv_int(current, 8, 5, &err);
  169|      2|        if (err != 0)
  ------------------
  |  Branch (169:13): [True: 0, False: 2]
  ------------------
  170|      0|            return 0;
  171|      2|        if (current >= max_nodes)
  ------------------
  |  Branch (171:13): [True: 0, False: 2]
  ------------------
  172|      0|            current = max_nodes;
  173|      2|    }
  174|      2|    return current;
  175|      2|}
stack.c:internal_delete:
  294|      2|{
  295|      2|    const void *ret = st->data[loc];
  296|       |
  297|      2|    if (loc != st->num - 1)
  ------------------
  |  Branch (297:9): [True: 0, False: 2]
  ------------------
  298|      0|        memmove(&st->data[loc], &st->data[loc + 1],
  299|      0|                sizeof(st->data[0]) * (st->num - loc - 1));
  300|      2|    st->num--;
  301|       |
  302|      2|    return (void *)ret;
  303|      2|}

ossl_err_load_OSSL_STORE_strings:
   69|      2|{
   70|      2|#ifndef OPENSSL_NO_ERR
   71|      2|    if (ERR_reason_error_string(OSSL_STORE_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (71:9): [True: 2, False: 0]
  ------------------
   72|      2|        ERR_load_strings_const(OSSL_STORE_str_reasons);
   73|      2|#endif
   74|      2|    return 1;
   75|      2|}

ossl_store_cleanup_int:
   14|      2|{
   15|      2|    ossl_store_destroy_loaders_int();
   16|      2|}

ossl_store_destroy_loaders_int:
  281|      2|{
  282|      2|    lh_OSSL_STORE_LOADER_free(loader_register);
  283|      2|    loader_register = NULL;
  284|      2|    CRYPTO_THREAD_lock_free(registry_lock);
  285|      2|    registry_lock = NULL;
  286|      2|}

ossl_crypto_mutex_new:
   97|      2|{
   98|      2|    pthread_mutex_t *mutex;
   99|       |
  100|      2|    if ((mutex = OPENSSL_zalloc(sizeof(*mutex))) == NULL)
  ------------------
  |  |  104|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (100:9): [True: 0, False: 2]
  ------------------
  101|      0|        return NULL;
  102|      2|    if (pthread_mutex_init(mutex, NULL) != 0) {
  ------------------
  |  Branch (102:9): [True: 0, False: 2]
  ------------------
  103|      0|        OPENSSL_free(mutex);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  104|      0|        return NULL;
  105|      0|    }
  106|      2|    return (CRYPTO_MUTEX *)mutex;
  107|      2|}
ossl_crypto_mutex_free:
  142|      2|{
  143|      2|    pthread_mutex_t **mutex_p;
  144|       |
  145|      2|    if (mutex == NULL)
  ------------------
  |  Branch (145:9): [True: 0, False: 2]
  ------------------
  146|      0|        return;
  147|       |
  148|      2|    mutex_p = (pthread_mutex_t **)mutex;
  149|      2|    if (*mutex_p != NULL)
  ------------------
  |  Branch (149:9): [True: 2, False: 0]
  ------------------
  150|      2|        pthread_mutex_destroy(*mutex_p);
  151|      2|    OPENSSL_free(*mutex_p);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  152|      2|    *mutex = NULL;
  153|      2|}
ossl_crypto_condvar_new:
  156|      2|{
  157|      2|    pthread_cond_t *cv_p;
  158|       |
  159|      2|    if ((cv_p = OPENSSL_zalloc(sizeof(*cv_p))) == NULL)
  ------------------
  |  |  104|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (159:9): [True: 0, False: 2]
  ------------------
  160|      0|        return NULL;
  161|      2|    if (pthread_cond_init(cv_p, NULL) != 0) {
  ------------------
  |  Branch (161:9): [True: 0, False: 2]
  ------------------
  162|      0|        OPENSSL_free(cv_p);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  163|      0|        return NULL;
  164|      0|    }
  165|      2|    return (CRYPTO_CONDVAR *) cv_p;
  166|      2|}
ossl_crypto_condvar_free:
  220|      2|{
  221|      2|    pthread_cond_t **cv_p;
  222|       |
  223|      2|    if (cv == NULL)
  ------------------
  |  Branch (223:9): [True: 0, False: 2]
  ------------------
  224|      0|        return;
  225|       |
  226|      2|    cv_p = (pthread_cond_t **)cv;
  227|      2|    if (*cv_p != NULL)
  ------------------
  |  Branch (227:9): [True: 2, False: 0]
  ------------------
  228|      2|        pthread_cond_destroy(*cv_p);
  229|      2|    OPENSSL_free(*cv_p);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  230|      2|    *cv_p = NULL;
  231|      2|}

ossl_threads_ctx_new:
  128|      2|{
  129|      2|    struct openssl_threads_st *t = OPENSSL_zalloc(sizeof(*t));
  ------------------
  |  |  104|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  130|       |
  131|      2|    if (t == NULL)
  ------------------
  |  Branch (131:9): [True: 0, False: 2]
  ------------------
  132|      0|        return NULL;
  133|       |
  134|      2|    t->lock = ossl_crypto_mutex_new();
  135|      2|    t->cond_finished = ossl_crypto_condvar_new();
  136|       |
  137|      2|    if (t->lock == NULL || t->cond_finished == NULL)
  ------------------
  |  Branch (137:9): [True: 0, False: 2]
  |  Branch (137:28): [True: 0, False: 2]
  ------------------
  138|      0|        goto fail;
  139|       |
  140|      2|    return t;
  141|       |
  142|      0|fail:
  143|      0|    ossl_threads_ctx_free((void *)t);
  144|      0|    return NULL;
  145|      2|}
ossl_threads_ctx_free:
  148|      2|{
  149|      2|    OSSL_LIB_CTX_THREADS *t = (OSSL_LIB_CTX_THREADS *) vdata;
  150|       |
  151|      2|    if (t == NULL)
  ------------------
  |  Branch (151:9): [True: 0, False: 2]
  ------------------
  152|      0|        return;
  153|       |
  154|      2|    ossl_crypto_mutex_free(&t->lock);
  155|      2|    ossl_crypto_condvar_free(&t->cond_finished);
  156|      2|    OPENSSL_free(t);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  157|      2|}

ossl_rcu_write_lock:
  441|      6|{
  442|      6|    pthread_mutex_lock(&lock->write_lock);
  443|      6|    TSAN_FAKE_UNLOCK(&lock->write_lock);
  444|      6|}
ossl_rcu_write_unlock:
  447|      6|{
  448|      6|    TSAN_FAKE_LOCK(&lock->write_lock);
  449|      6|    pthread_mutex_unlock(&lock->write_lock);
  450|      6|}
ossl_synchronize_rcu:
  453|     10|{
  454|     10|    struct rcu_qp *qp;
  455|     10|    uint64_t count;
  456|     10|    uint32_t curr_id;
  457|     10|    struct rcu_cb_item *cb_items, *tmpcb;
  458|       |
  459|     10|    pthread_mutex_lock(&lock->write_lock);
  460|     10|    cb_items = lock->cb_items;
  461|     10|    lock->cb_items = NULL;
  462|     10|    pthread_mutex_unlock(&lock->write_lock);
  463|       |
  464|     10|    qp = update_qp(lock, &curr_id);
  465|       |
  466|       |    /* retire in order */
  467|     10|    pthread_mutex_lock(&lock->prior_lock);
  468|     10|    while (lock->next_to_retire != curr_id)
  ------------------
  |  Branch (468:12): [True: 0, False: 10]
  ------------------
  469|      0|        pthread_cond_wait(&lock->prior_signal, &lock->prior_lock);
  470|       |
  471|       |    /*
  472|       |     * wait for the reader count to reach zero
  473|       |     * Note the use of __ATOMIC_ACQUIRE here to ensure that any
  474|       |     * prior __ATOMIC_RELEASE write operation in ossl_rcu_read_unlock
  475|       |     * is visible prior to our read
  476|       |     * however this is likely just necessary to silence a tsan warning
  477|       |     * because the read side should not do any write operation
  478|       |     * outside the atomic itself
  479|       |     */
  480|     10|    do {
  481|     10|        count = ATOMIC_LOAD_N(uint64_t, &qp->users, __ATOMIC_ACQUIRE);
  ------------------
  |  |   96|     10|#  define ATOMIC_LOAD_N(t, p, o) __atomic_load_n(p, o)
  ------------------
  482|     10|    } while (count != (uint64_t)0);
  ------------------
  |  Branch (482:14): [True: 0, False: 10]
  ------------------
  483|       |
  484|     10|    lock->next_to_retire++;
  485|     10|    pthread_cond_broadcast(&lock->prior_signal);
  486|     10|    pthread_mutex_unlock(&lock->prior_lock);
  487|       |
  488|     10|    retire_qp(lock, qp);
  489|       |
  490|       |    /* handle any callbacks that we have */
  491|     12|    while (cb_items != NULL) {
  ------------------
  |  Branch (491:12): [True: 2, False: 10]
  ------------------
  492|      2|        tmpcb = cb_items;
  493|      2|        cb_items = cb_items->next;
  494|      2|        tmpcb->fn(tmpcb->data);
  495|      2|        OPENSSL_free(tmpcb);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  496|      2|    }
  497|     10|}
ossl_rcu_call:
  504|      2|{
  505|      2|    struct rcu_cb_item *new =
  506|      2|        OPENSSL_zalloc(sizeof(*new));
  ------------------
  |  |  104|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  507|       |
  508|      2|    if (new == NULL)
  ------------------
  |  Branch (508:9): [True: 0, False: 2]
  ------------------
  509|      0|        return 0;
  510|       |
  511|      2|    new->data = data;
  512|      2|    new->fn = cb;
  513|       |
  514|      2|    new->next = lock->cb_items;
  515|      2|    lock->cb_items = new;
  516|       |
  517|      2|    return 1;
  518|      2|}
ossl_rcu_uptr_deref:
  521|      6|{
  522|      6|    return ATOMIC_LOAD_N(pvoid, p, __ATOMIC_ACQUIRE);
  ------------------
  |  |   96|      6|#  define ATOMIC_LOAD_N(t, p, o) __atomic_load_n(p, o)
  ------------------
  523|      6|}
ossl_rcu_assign_uptr:
  526|      6|{
  527|      6|    ATOMIC_STORE(pvoid, p, v, __ATOMIC_RELEASE);
  ------------------
  |  |   98|      6|#  define ATOMIC_STORE(t, p, v, o) __atomic_store(p, v, o)
  ------------------
  528|      6|}
ossl_rcu_lock_new:
  531|      4|{
  532|      4|    struct rcu_lock_st *new;
  533|       |
  534|       |    /*
  535|       |     * We need a minimum of 2 qp's
  536|       |     */
  537|      4|    if (num_writers < 2)
  ------------------
  |  Branch (537:9): [True: 4, False: 0]
  ------------------
  538|      4|        num_writers = 2;
  539|       |
  540|      4|    ctx = ossl_lib_ctx_get_concrete(ctx);
  541|      4|    if (ctx == NULL)
  ------------------
  |  Branch (541:9): [True: 0, False: 4]
  ------------------
  542|      0|        return 0;
  543|       |
  544|      4|    new = OPENSSL_zalloc(sizeof(*new));
  ------------------
  |  |  104|      4|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      4|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      4|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  545|      4|    if (new == NULL)
  ------------------
  |  Branch (545:9): [True: 0, False: 4]
  ------------------
  546|      0|        return NULL;
  547|       |
  548|      4|    new->ctx = ctx;
  549|      4|    pthread_mutex_init(&new->write_lock, NULL);
  550|      4|    pthread_mutex_init(&new->prior_lock, NULL);
  551|      4|    pthread_mutex_init(&new->alloc_lock, NULL);
  552|      4|    pthread_cond_init(&new->prior_signal, NULL);
  553|      4|    pthread_cond_init(&new->alloc_signal, NULL);
  554|       |
  555|      4|    new->qp_group = allocate_new_qp_group(new, num_writers);
  556|      4|    if (new->qp_group == NULL) {
  ------------------
  |  Branch (556:9): [True: 0, False: 4]
  ------------------
  557|      0|        OPENSSL_free(new);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  558|      0|        new = NULL;
  559|      0|    }
  560|       |
  561|      4|    return new;
  562|      4|}
ossl_rcu_lock_free:
  565|      4|{
  566|      4|    struct rcu_lock_st *rlock = (struct rcu_lock_st *)lock;
  567|       |
  568|      4|    if (lock == NULL)
  ------------------
  |  Branch (568:9): [True: 0, False: 4]
  ------------------
  569|      0|        return;
  570|       |
  571|       |    /* make sure we're synchronized */
  572|      4|    ossl_synchronize_rcu(rlock);
  573|       |
  574|      4|    OPENSSL_free(rlock->qp_group);
  ------------------
  |  |  115|      4|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      4|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      4|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  575|       |    /* There should only be a single qp left now */
  576|      4|    OPENSSL_free(rlock);
  ------------------
  |  |  115|      4|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      4|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      4|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  577|      4|}
CRYPTO_THREAD_lock_new:
  580|     46|{
  581|     46|# ifdef USE_RWLOCK
  582|     46|    CRYPTO_RWLOCK *lock;
  583|       |
  584|     46|    if ((lock = OPENSSL_zalloc(sizeof(pthread_rwlock_t))) == NULL)
  ------------------
  |  |  104|     46|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     46|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     46|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (584:9): [True: 0, False: 46]
  ------------------
  585|       |        /* Don't set error, to avoid recursion blowup. */
  586|      0|        return NULL;
  587|       |
  588|     46|    if (pthread_rwlock_init(lock, NULL) != 0) {
  ------------------
  |  Branch (588:9): [True: 0, False: 46]
  ------------------
  589|      0|        OPENSSL_free(lock);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  590|      0|        return NULL;
  591|      0|    }
  592|       |# else
  593|       |    pthread_mutexattr_t attr;
  594|       |    CRYPTO_RWLOCK *lock;
  595|       |
  596|       |    if ((lock = OPENSSL_zalloc(sizeof(pthread_mutex_t))) == NULL)
  597|       |        /* Don't set error, to avoid recursion blowup. */
  598|       |        return NULL;
  599|       |
  600|       |    /*
  601|       |     * We don't use recursive mutexes, but try to catch errors if we do.
  602|       |     */
  603|       |    pthread_mutexattr_init(&attr);
  604|       |#  if !defined (__TANDEM) && !defined (_SPT_MODEL_)
  605|       |#   if !defined(NDEBUG) && !defined(OPENSSL_NO_MUTEX_ERRORCHECK)
  606|       |    pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK);
  607|       |#   endif
  608|       |#  else
  609|       |    /* The SPT Thread Library does not define MUTEX attributes. */
  610|       |#  endif
  611|       |
  612|       |    if (pthread_mutex_init(lock, &attr) != 0) {
  613|       |        pthread_mutexattr_destroy(&attr);
  614|       |        OPENSSL_free(lock);
  615|       |        return NULL;
  616|       |    }
  617|       |
  618|       |    pthread_mutexattr_destroy(&attr);
  619|       |# endif
  620|       |
  621|     46|    return lock;
  622|     46|}
CRYPTO_THREAD_read_lock:
  625|    152|{
  626|    152|# ifdef USE_RWLOCK
  627|    152|    if (!ossl_assert(pthread_rwlock_rdlock(lock) == 0))
  ------------------
  |  |   52|    152|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|    152|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (627:9): [True: 0, False: 152]
  ------------------
  628|      0|        return 0;
  629|       |# else
  630|       |    if (pthread_mutex_lock(lock) != 0) {
  631|       |        assert(errno != EDEADLK && errno != EBUSY);
  632|       |        return 0;
  633|       |    }
  634|       |# endif
  635|       |
  636|    152|    return 1;
  637|    152|}
CRYPTO_THREAD_write_lock:
  640|    230|{
  641|    230|# ifdef USE_RWLOCK
  642|    230|    if (!ossl_assert(pthread_rwlock_wrlock(lock) == 0))
  ------------------
  |  |   52|    230|#  define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  |  |   53|    230|                                         __FILE__, __LINE__)
  ------------------
  |  Branch (642:9): [True: 0, False: 230]
  ------------------
  643|      0|        return 0;
  644|       |# else
  645|       |    if (pthread_mutex_lock(lock) != 0) {
  646|       |        assert(errno != EDEADLK && errno != EBUSY);
  647|       |        return 0;
  648|       |    }
  649|       |# endif
  650|       |
  651|    230|    return 1;
  652|    230|}
CRYPTO_THREAD_unlock:
  655|    382|{
  656|    382|# ifdef USE_RWLOCK
  657|    382|    if (pthread_rwlock_unlock(lock) != 0)
  ------------------
  |  Branch (657:9): [True: 0, False: 382]
  ------------------
  658|      0|        return 0;
  659|       |# else
  660|       |    if (pthread_mutex_unlock(lock) != 0) {
  661|       |        assert(errno != EPERM);
  662|       |        return 0;
  663|       |    }
  664|       |# endif
  665|       |
  666|    382|    return 1;
  667|    382|}
CRYPTO_THREAD_lock_free:
  670|     60|{
  671|     60|    if (lock == NULL)
  ------------------
  |  Branch (671:9): [True: 14, False: 46]
  ------------------
  672|     14|        return;
  673|       |
  674|     46|# ifdef USE_RWLOCK
  675|     46|    pthread_rwlock_destroy(lock);
  676|       |# else
  677|       |    pthread_mutex_destroy(lock);
  678|       |# endif
  679|     46|    OPENSSL_free(lock);
  ------------------
  |  |  115|     46|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|     46|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|     46|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  680|       |
  681|     46|    return;
  682|     60|}
CRYPTO_THREAD_run_once:
  685|  6.21k|{
  686|  6.21k|    if (pthread_once(once, init) != 0)
  ------------------
  |  Branch (686:9): [True: 0, False: 6.21k]
  ------------------
  687|      0|        return 0;
  688|       |
  689|  6.21k|    return 1;
  690|  6.21k|}
CRYPTO_THREAD_init_local:
  693|     14|{
  694|     14|    if (pthread_key_create(key, cleanup) != 0)
  ------------------
  |  Branch (694:9): [True: 0, False: 14]
  ------------------
  695|      0|        return 0;
  696|       |
  697|     14|    return 1;
  698|     14|}
CRYPTO_THREAD_get_local:
  701|  3.03k|{
  702|  3.03k|    return pthread_getspecific(*key);
  703|  3.03k|}
CRYPTO_THREAD_set_local:
  706|     14|{
  707|     14|    if (pthread_setspecific(*key, val) != 0)
  ------------------
  |  Branch (707:9): [True: 0, False: 14]
  ------------------
  708|      0|        return 0;
  709|       |
  710|     14|    return 1;
  711|     14|}
CRYPTO_THREAD_cleanup_local:
  714|     14|{
  715|     14|    if (pthread_key_delete(*key) != 0)
  ------------------
  |  Branch (715:9): [True: 0, False: 14]
  ------------------
  716|      0|        return 0;
  717|       |
  718|     14|    return 1;
  719|     14|}
CRYPTO_atomic_or:
  811|      2|{
  812|      2|# if defined(__GNUC__) && defined(__ATOMIC_ACQ_REL) && !defined(BROKEN_CLANG_ATOMICS)
  813|      2|    if (__atomic_is_lock_free(sizeof(*val), val)) {
  ------------------
  |  Branch (813:9): [Folded - Ignored]
  ------------------
  814|      2|        *ret = __atomic_or_fetch(val, op, __ATOMIC_ACQ_REL);
  815|      2|        return 1;
  816|      2|    }
  817|       |# elif defined(__sun) && (defined(__SunOS_5_10) || defined(__SunOS_5_11))
  818|       |    /* This will work for all future Solaris versions. */
  819|       |    if (ret != NULL) {
  820|       |        *ret = atomic_or_64_nv(val, op);
  821|       |        return 1;
  822|       |    }
  823|       |# endif
  824|      0|    if (lock == NULL || !CRYPTO_THREAD_write_lock(lock))
  ------------------
  |  Branch (824:9): [True: 0, False: 0]
  |  Branch (824:25): [True: 0, False: 0]
  ------------------
  825|      0|        return 0;
  826|      0|    *val |= op;
  827|      0|    *ret  = *val;
  828|       |
  829|      0|    if (!CRYPTO_THREAD_unlock(lock))
  ------------------
  |  Branch (829:9): [True: 0, False: 0]
  ------------------
  830|      0|        return 0;
  831|       |
  832|      0|    return 1;
  833|      0|}
CRYPTO_atomic_load:
  836|  3.03k|{
  837|  3.03k|# if defined(__GNUC__) && defined(__ATOMIC_ACQ_REL) && !defined(BROKEN_CLANG_ATOMICS)
  838|  3.03k|    if (__atomic_is_lock_free(sizeof(*val), val)) {
  ------------------
  |  Branch (838:9): [Folded - Ignored]
  ------------------
  839|  3.03k|        __atomic_load(val, ret, __ATOMIC_ACQUIRE);
  840|  3.03k|        return 1;
  841|  3.03k|    }
  842|       |# elif defined(__sun) && (defined(__SunOS_5_10) || defined(__SunOS_5_11))
  843|       |    /* This will work for all future Solaris versions. */
  844|       |    if (ret != NULL) {
  845|       |        *ret = atomic_or_64_nv(val, 0);
  846|       |        return 1;
  847|       |    }
  848|       |# endif
  849|      0|    if (lock == NULL || !CRYPTO_THREAD_read_lock(lock))
  ------------------
  |  Branch (849:9): [True: 0, False: 0]
  |  Branch (849:25): [True: 0, False: 0]
  ------------------
  850|      0|        return 0;
  851|      0|    *ret  = *val;
  852|      0|    if (!CRYPTO_THREAD_unlock(lock))
  ------------------
  |  Branch (852:9): [True: 0, False: 0]
  ------------------
  853|      0|        return 0;
  854|       |
  855|      0|    return 1;
  856|      0|}
threads_pthread.c:update_qp:
  380|     10|{
  381|     10|    uint32_t current_idx;
  382|       |
  383|     10|    pthread_mutex_lock(&lock->alloc_lock);
  384|       |
  385|       |    /*
  386|       |     * we need at least one qp to be available with one
  387|       |     * left over, so that readers can start working on
  388|       |     * one that isn't yet being waited on
  389|       |     */
  390|     10|    while (lock->group_count - lock->writers_alloced < 2)
  ------------------
  |  Branch (390:12): [True: 0, False: 10]
  ------------------
  391|       |        /* we have to wait for one to be free */
  392|      0|        pthread_cond_wait(&lock->alloc_signal, &lock->alloc_lock);
  393|       |
  394|     10|    current_idx = lock->current_alloc_idx;
  395|       |
  396|       |    /* Allocate the qp */
  397|     10|    lock->writers_alloced++;
  398|       |
  399|       |    /* increment the allocation index */
  400|     10|    lock->current_alloc_idx =
  401|     10|        (lock->current_alloc_idx + 1) % lock->group_count;
  402|       |
  403|     10|    *curr_id = lock->id_ctr;
  404|     10|    lock->id_ctr++;
  405|       |
  406|     10|    ATOMIC_STORE_N(uint32_t, &lock->reader_idx, lock->current_alloc_idx,
  ------------------
  |  |   97|     10|#  define ATOMIC_STORE_N(t, p, v, o) __atomic_store_n(p, v, o)
  ------------------
  407|     10|                   __ATOMIC_RELAXED);
  408|       |
  409|       |    /*
  410|       |     * this should make sure that the new value of reader_idx is visible in
  411|       |     * get_hold_current_qp, directly after incrementing the users count
  412|       |     */
  413|     10|    ATOMIC_ADD_FETCH(&lock->qp_group[current_idx].users, (uint64_t)0,
  ------------------
  |  |   99|     10|#  define ATOMIC_ADD_FETCH(p, v, o) __atomic_add_fetch(p, v, o)
  ------------------
  414|     10|                     __ATOMIC_RELEASE);
  415|       |
  416|       |    /* wake up any waiters */
  417|     10|    pthread_cond_signal(&lock->alloc_signal);
  418|     10|    pthread_mutex_unlock(&lock->alloc_lock);
  419|     10|    return &lock->qp_group[current_idx];
  420|     10|}
threads_pthread.c:retire_qp:
  423|     10|{
  424|     10|    pthread_mutex_lock(&lock->alloc_lock);
  425|     10|    lock->writers_alloced--;
  426|     10|    pthread_cond_signal(&lock->alloc_signal);
  427|     10|    pthread_mutex_unlock(&lock->alloc_lock);
  428|     10|}
threads_pthread.c:allocate_new_qp_group:
  432|      4|{
  433|      4|    struct rcu_qp *new =
  434|      4|        OPENSSL_zalloc(sizeof(*new) * count);
  ------------------
  |  |  104|      4|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      4|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      4|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  435|       |
  436|      4|    lock->group_count = count;
  437|      4|    return new;
  438|      4|}

ossl_trace_cleanup:
  340|      2|{
  341|       |#ifndef OPENSSL_NO_TRACE
  342|       |    int category;
  343|       |    BIO *channel = NULL;
  344|       |    const char *prefix = NULL;
  345|       |    const char *suffix = NULL;
  346|       |
  347|       |    for (category = 0; category < OSSL_TRACE_CATEGORY_NUM; category++) {
  348|       |        /* We force the TRACE category to be treated last */
  349|       |        if (category == OSSL_TRACE_CATEGORY_TRACE)
  350|       |            continue;
  351|       |        set_trace_data(category, 0, &channel, &prefix, &suffix,
  352|       |                       trace_attach_cb, trace_detach_cb);
  353|       |    }
  354|       |    set_trace_data(OSSL_TRACE_CATEGORY_TRACE, 0, &channel,
  355|       |                   &prefix, &suffix,
  356|       |                   trace_attach_cb, trace_detach_cb);
  357|       |    CRYPTO_THREAD_lock_free(trace_lock);
  358|       |#endif
  359|      2|}
OSSL_trace_set_channel:
  362|      2|{
  363|       |#ifndef OPENSSL_NO_TRACE
  364|       |    if (category >= 0 && category < OSSL_TRACE_CATEGORY_NUM)
  365|       |        return set_trace_data(category, SIMPLE_CHANNEL, &channel, NULL, NULL,
  366|       |                              trace_attach_cb, trace_detach_cb);
  367|       |#endif
  368|      2|    return 0;
  369|      2|}

ossl_err_load_TS_strings:
   82|      2|{
   83|      2|# ifndef OPENSSL_NO_ERR
   84|      2|    if (ERR_reason_error_string(TS_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (84:9): [True: 2, False: 0]
  ------------------
   85|      2|        ERR_load_strings_const(TS_str_reasons);
   86|      2|# endif
   87|      2|    return 1;
   88|      2|}

ossl_err_load_UI_strings:
   41|      2|{
   42|      2|#ifndef OPENSSL_NO_ERR
   43|      2|    if (ERR_reason_error_string(UI_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (43:9): [True: 2, False: 0]
  ------------------
   44|      2|        ERR_load_strings_const(UI_str_reasons);
   45|      2|#endif
   46|      2|    return 1;
   47|      2|}

ossl_err_load_X509V3_strings:
  146|      2|{
  147|      2|#ifndef OPENSSL_NO_ERR
  148|      2|    if (ERR_reason_error_string(X509V3_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (148:9): [True: 2, False: 0]
  ------------------
  149|      2|        ERR_load_strings_const(X509V3_str_reasons);
  150|      2|#endif
  151|      2|    return 1;
  152|      2|}

ossl_err_load_X509_strings:
   92|      2|{
   93|      2|#ifndef OPENSSL_NO_ERR
   94|      2|    if (ERR_reason_error_string(X509_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (94:9): [True: 2, False: 0]
  ------------------
   95|      2|        ERR_load_strings_const(X509_str_reasons);
   96|      2|#endif
   97|      2|    return 1;
   98|      2|}

FuzzerInitialize:
   23|      2|{
   24|      2|    OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
  ------------------
  |  |  467|      2|# define OPENSSL_INIT_LOAD_CRYPTO_STRINGS    0x00000002L
  ------------------
   25|      2|    ERR_clear_error();
   26|       |
   27|      2|    return 1;
   28|      2|}
FuzzerTestOneInput:
   31|  3.02k|{
   32|  3.02k|    int success = 0;
   33|  3.02k|    size_t l1 = 0, l2 = 0, l3 = 0;
   34|  3.02k|    int s1 = 0, s3 = 0;
   35|  3.02k|    BN_CTX *ctx;
   36|  3.02k|    BIGNUM *b1;
   37|  3.02k|    BIGNUM *b2;
   38|  3.02k|    BIGNUM *b3;
   39|  3.02k|    BIGNUM *b4;
   40|  3.02k|    BIGNUM *b5;
   41|       |
   42|  3.02k|    b1 = BN_new();
   43|  3.02k|    b2 = BN_new();
   44|  3.02k|    b3 = BN_new();
   45|  3.02k|    b4 = BN_new();
   46|  3.02k|    b5 = BN_new();
   47|  3.02k|    ctx = BN_CTX_new();
   48|       |
   49|       |    /* Divide the input into three parts, using the values of the first two
   50|       |     * bytes to choose lengths, which generate b1, b2 and b3. Use three bits
   51|       |     * of the third byte to choose signs for the three numbers.
   52|       |     */
   53|  3.02k|    if (len > 2) {
  ------------------
  |  Branch (53:9): [True: 3.02k, False: 2]
  ------------------
   54|  3.02k|        len -= 3;
   55|       |        /* limit l1, l2, and l3 to be no more than 512 bytes */
   56|  3.02k|        l1 = ((buf[0] * len) / 255) % 512;
   57|  3.02k|        ++buf;
   58|  3.02k|        l2 = ((buf[0] * (len - l1)) / 255) % 512;
   59|  3.02k|        ++buf;
   60|  3.02k|        l3 = (len - l1 - l2) % 512;
   61|       |
   62|  3.02k|        s1 = buf[0] & 1;
   63|  3.02k|        s3 = buf[0] & 4;
   64|  3.02k|        ++buf;
   65|  3.02k|    }
   66|  3.02k|    OPENSSL_assert(BN_bin2bn(buf, l1, b1) == b1);
  ------------------
  |  |  438|  3.02k|    (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1))
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                   (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1))
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |  |  Branch (438:12): [True: 3.02k, False: 0]
  |  |  ------------------
  ------------------
   67|  3.02k|    BN_set_negative(b1, s1);
   68|  3.02k|    OPENSSL_assert(BN_bin2bn(buf + l1, l2, b2) == b2);
  ------------------
  |  |  438|  3.02k|    (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1))
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                   (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1))
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |  |  Branch (438:12): [True: 3.02k, False: 0]
  |  |  ------------------
  ------------------
   69|  3.02k|    OPENSSL_assert(BN_bin2bn(buf + l1 + l2, l3, b3) == b3);
  ------------------
  |  |  438|  3.02k|    (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1))
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                   (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1))
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |  |  Branch (438:12): [True: 3.02k, False: 0]
  |  |  ------------------
  ------------------
   70|  3.02k|    BN_set_negative(b3, s3);
   71|       |
   72|       |    /* mod 0 is undefined */
   73|  3.02k|    if (BN_is_zero(b3)) {
  ------------------
  |  Branch (73:9): [True: 34, False: 2.99k]
  ------------------
   74|     34|        success = 1;
   75|     34|        goto done;
   76|     34|    }
   77|       |
   78|  2.99k|    OPENSSL_assert(BN_mod_exp(b4, b1, b2, b3, ctx));
  ------------------
  |  |  438|  2.99k|    (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1))
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                   (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1))
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |  |  Branch (438:12): [True: 2.99k, False: 0]
  |  |  ------------------
  ------------------
   79|  2.99k|    OPENSSL_assert(BN_mod_exp_simple(b5, b1, b2, b3, ctx));
  ------------------
  |  |  438|  2.99k|    (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1))
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                   (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1))
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |  |  Branch (438:12): [True: 2.99k, False: 0]
  |  |  ------------------
  ------------------
   80|       |
   81|  2.99k|    success = BN_cmp(b4, b5) == 0;
   82|  2.99k|    if (!success) {
  ------------------
  |  Branch (82:9): [True: 0, False: 2.99k]
  ------------------
   83|      0|        BN_print_fp(stdout, b1);
   84|      0|        putchar('\n');
   85|      0|        BN_print_fp(stdout, b2);
   86|      0|        putchar('\n');
   87|      0|        BN_print_fp(stdout, b3);
   88|      0|        putchar('\n');
   89|      0|        BN_print_fp(stdout, b4);
   90|      0|        putchar('\n');
   91|      0|        BN_print_fp(stdout, b5);
   92|      0|        putchar('\n');
   93|      0|    }
   94|       |
   95|  3.02k| done:
   96|  3.02k|    OPENSSL_assert(success);
  ------------------
  |  |  438|  3.02k|    (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1))
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                   (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1))
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |  |  Branch (438:12): [True: 3.02k, False: 0]
  |  |  ------------------
  ------------------
   97|  3.02k|    BN_free(b1);
   98|  3.02k|    BN_free(b2);
   99|  3.02k|    BN_free(b3);
  100|  3.02k|    BN_free(b4);
  101|  3.02k|    BN_free(b5);
  102|  3.02k|    BN_CTX_free(ctx);
  103|  3.02k|    ERR_clear_error();
  104|       |
  105|  3.02k|    return 0;
  106|  2.99k|}

LLVMFuzzerInitialize:
   22|      2|{
   23|      2|    return FuzzerInitialize(argc, argv);
   24|      2|}
LLVMFuzzerTestOneInput:
   27|  3.02k|{
   28|  3.02k|    return FuzzerTestOneInput(buf, len);
   29|  3.02k|}

property.c:ossl_sa_ALGORITHM_new:
   27|      8|    { \
   28|      8|        return (SPARSE_ARRAY_OF(type) *)ossl_sa_new(); \
   29|      8|    } \
property.c:ossl_sa_ALGORITHM_doall_arg:
   56|      8|    { \
   57|      8|        ossl_sa_doall_arg((OPENSSL_SA *)sa, \
   58|      8|                          (void (*)(ossl_uintmax_t, void *, void *))leaf, arg); \
   59|      8|    } \
property.c:ossl_sa_ALGORITHM_free:
   32|      8|    { \
   33|      8|        ossl_sa_free((OPENSSL_SA *)sa); \
   34|      8|    } \

threads_pthread.c:ossl_assert_int:
   45|    382|{
   46|    382|    if (!expr)
  ------------------
  |  Branch (46:9): [True: 0, False: 382]
  ------------------
   47|      0|        OPENSSL_die(exprstr, file, line);
   48|       |
   49|    382|    return expr;
   50|    382|}

bio_lib.c:CRYPTO_FREE_REF:
  285|      2|static ossl_unused ossl_inline void CRYPTO_FREE_REF(CRYPTO_REF_COUNT *refcnt)                                  \
  286|      2|{
  287|      2|}

stack.c:safe_muldiv_int:
  324|      2|    {                                                                        \
  325|      2|        int e2 = 0;                                                          \
  326|      2|        type q, r, x, y;                                                     \
  327|      2|                                                                             \
  328|      2|        if (c == 0) {                                                        \
  ------------------
  |  Branch (328:13): [True: 0, False: 2]
  ------------------
  329|      0|            *err |= 1;                                                       \
  330|      0|            return a == 0 || b == 0 ? 0 : max;                               \
  ------------------
  |  Branch (330:20): [True: 0, False: 0]
  |  Branch (330:30): [True: 0, False: 0]
  ------------------
  331|      0|        }                                                                    \
  332|      2|        x = safe_mul_ ## type_name(a, b, &e2);                               \
  333|      2|        if (!e2)                                                             \
  ------------------
  |  Branch (333:13): [True: 2, False: 0]
  ------------------
  334|      2|            return safe_div_ ## type_name(x, c, err);                        \
  335|      2|        if (b > a) {                                                         \
  ------------------
  |  Branch (335:13): [True: 0, False: 0]
  ------------------
  336|      0|            x = b;                                                           \
  337|      0|            b = a;                                                           \
  338|      0|            a = x;                                                           \
  339|      0|        }                                                                    \
  340|      0|        q = safe_div_ ## type_name(a, c, err);                               \
  341|      0|        r = safe_mod_ ## type_name(a, c, err);                               \
  342|      0|        x = safe_mul_ ## type_name(r, b, err);                               \
  343|      0|        y = safe_mul_ ## type_name(q, b, err);                               \
  344|      0|        q = safe_div_ ## type_name(x, c, err);                               \
  345|      0|        return safe_add_ ## type_name(y, q, err);                            \
  346|      2|    }
stack.c:safe_mul_int:
  138|      2|    {                                                                        \
  139|      2|        type r;                                                              \
  140|      2|                                                                             \
  141|      2|        if (!__builtin_mul_overflow(a, b, &r))                               \
  ------------------
  |  Branch (141:13): [True: 2, False: 0]
  ------------------
  142|      2|            return r;                                                        \
  143|      2|        *err |= 1;                                                           \
  144|      0|        return (a < 0) ^ (b < 0) ? min : max;                                \
  ------------------
  |  Branch (144:16): [True: 0, False: 0]
  ------------------
  145|      2|    }
stack.c:safe_div_int:
  201|      2|    {                                                                        \
  202|      2|        if (b == 0) {                                                        \
  ------------------
  |  Branch (202:13): [True: 0, False: 2]
  ------------------
  203|      0|            *err |= 1;                                                       \
  204|      0|            return a < 0 ? min : max;                                        \
  ------------------
  |  Branch (204:20): [True: 0, False: 0]
  ------------------
  205|      0|        }                                                                    \
  206|      2|        if (b == -1 && a == min) {                                           \
  ------------------
  |  Branch (206:13): [True: 0, False: 2]
  |  Branch (206:24): [True: 0, False: 0]
  ------------------
  207|      0|            *err |= 1;                                                       \
  208|      0|            return max;                                                      \
  209|      0|        }                                                                    \
  210|      2|        return a / b;                                                        \
  211|      2|    }

err.c:do_err_strings_init_ossl_:
   73|      2|    {                                           \
   74|      2|        init##_ossl_ret_ = init();              \
   75|      2|    }                                           \
err.c:err_do_init_ossl_:
   73|      2|    {                                           \
   74|      2|        init##_ossl_ret_ = init();              \
   75|      2|    }                                           \
init.c:ossl_init_base_ossl_:
   73|      2|    {                                           \
   74|      2|        init##_ossl_ret_ = init();              \
   75|      2|    }                                           \
init.c:ossl_init_register_atexit_ossl_:
   73|      2|    {                                           \
   74|      2|        init##_ossl_ret_ = init();              \
   75|      2|    }                                           \
init.c:ossl_init_load_crypto_nodelete_ossl_:
   73|      2|    {                                           \
   74|      2|        init##_ossl_ret_ = init();              \
   75|      2|    }                                           \
init.c:ossl_init_load_crypto_strings_ossl_:
   73|      2|    {                                           \
   74|      2|        init##_ossl_ret_ = init();              \
   75|      2|    }                                           \
initthread.c:create_global_tevent_register_ossl_:
   73|      2|    {                                           \
   74|      2|        init##_ossl_ret_ = init();              \
   75|      2|    }                                           \
conf_mod.c:do_init_module_list_lock_ossl_:
   73|      2|    {                                           \
   74|      2|        init##_ossl_ret_ = init();              \
   75|      2|    }                                           \
context.c:default_context_do_init_ossl_:
   73|      2|    {                                           \
   74|      2|        init##_ossl_ret_ = init();              \
   75|      2|    }                                           \

err.c:ERR_GET_LIB:
  242|  8.82k|{
  243|  8.82k|    if (ERR_SYSTEM_ERROR(errcode))
  ------------------
  |  |  239|  8.82k|# define ERR_SYSTEM_ERROR(errcode)      (((errcode) & ERR_SYSTEM_FLAG) != 0)
  |  |  ------------------
  |  |  |  |  218|  8.82k|# define ERR_SYSTEM_FLAG                ((unsigned int)INT_MAX + 1)
  |  |  ------------------
  |  |  |  Branch (239:41): [True: 0, False: 8.82k]
  |  |  ------------------
  ------------------
  244|      0|        return ERR_LIB_SYS;
  ------------------
  |  |   72|      0|# define ERR_LIB_SYS             2
  ------------------
  245|  8.82k|    return (errcode >> ERR_LIB_OFFSET) & ERR_LIB_MASK;
  ------------------
  |  |  226|  8.82k|# define ERR_LIB_OFFSET                 23L
  ------------------
                  return (errcode >> ERR_LIB_OFFSET) & ERR_LIB_MASK;
  ------------------
  |  |  227|  8.82k|# define ERR_LIB_MASK                   0xFF
  ------------------
  246|  8.82k|}
err.c:ERR_GET_REASON:
  256|     68|{
  257|     68|    if (ERR_SYSTEM_ERROR(errcode))
  ------------------
  |  |  239|     68|# define ERR_SYSTEM_ERROR(errcode)      (((errcode) & ERR_SYSTEM_FLAG) != 0)
  |  |  ------------------
  |  |  |  |  218|     68|# define ERR_SYSTEM_FLAG                ((unsigned int)INT_MAX + 1)
  |  |  ------------------
  |  |  |  Branch (239:41): [True: 0, False: 68]
  |  |  ------------------
  ------------------
  258|      0|        return errcode & ERR_SYSTEM_MASK;
  ------------------
  |  |  219|      0|# define ERR_SYSTEM_MASK                ((unsigned int)INT_MAX)
  ------------------
  259|     68|    return errcode & ERR_REASON_MASK;
  ------------------
  |  |  230|     68|# define ERR_REASON_MASK                0X7FFFFF
  ------------------
  260|     68|}

err.c:ossl_check_ERR_STRING_DATA_lh_type:
  196|  8.76k|    { \
  197|  8.76k|        return (OPENSSL_LHASH *)lh; \
  198|  8.76k|    } \
err.c:ossl_check_ERR_STRING_DATA_lh_hashfunc_type:
  206|      2|    { \
  207|      2|        return (OPENSSL_LH_HASHFUNC)hfn; \
  208|      2|    } \
err.c:ossl_check_ERR_STRING_DATA_lh_compfunc_type:
  201|      2|    { \
  202|      2|        return (OPENSSL_LH_COMPFUNC)cmp; \
  203|      2|    } \
err.c:lh_ERR_STRING_DATA_hash_thunk:
  160|  8.75k|    { \
  161|  8.75k|        unsigned long (*hfn_conv)(const type *) = (unsigned long (*)(const type *))hfn; \
  162|  8.75k|        return hfn_conv((const type *)data); \
  163|  8.75k|    } \
err.c:lh_ERR_STRING_DATA_comp_thunk:
  165|  5.89k|    { \
  166|  5.89k|        int (*cfn_conv)(const type *, const type *) = (int (*)(const type *, const type *))cfn; \
  167|  5.89k|        return cfn_conv((const type *)da, (const type *)db); \
  168|  5.89k|    } \
err.c:ossl_check_ERR_STRING_DATA_lh_plain_type:
  181|  8.62k|    { \
  182|  8.62k|        return ptr; \
  183|  8.62k|    } \
err.c:ossl_check_const_ERR_STRING_DATA_lh_plain_type:
  186|    136|    { \
  187|    136|        return ptr; \
  188|    136|    } \
store_register.c:lh_OSSL_STORE_LOADER_free:
  254|      2|    { \
  255|      2|        OPENSSL_LH_free((OPENSSL_LHASH *)lh); \
  256|      2|    } \
defn_cache.c:lh_PROPERTY_DEFN_ELEM_doall:
  311|      2|    { \
  312|      2|        OPENSSL_LH_doall((OPENSSL_LHASH *)lh, (OPENSSL_LH_DOALL_FUNC)doall); \
  313|      2|    } \
defn_cache.c:lh_PROPERTY_DEFN_ELEM_free:
  254|      2|    { \
  255|      2|        OPENSSL_LH_free((OPENSSL_LHASH *)lh); \
  256|      2|    } \
defn_cache.c:lh_PROPERTY_DEFN_ELEM_new:
  317|      2|    { \
  318|      2|        return (LHASH_OF(type) *)OPENSSL_LH_set_thunks(OPENSSL_LH_new((OPENSSL_LH_HASHFUNC)hfn, (OPENSSL_LH_COMPFUNC)cfn), \
  319|      2|                                lh_##type##_hfn_thunk, lh_##type##_cfn_thunk, \
  320|      2|                                lh_##type##_doall_thunk, \
  321|      2|                                lh_##type##_doall_arg_thunk); \
  322|      2|    } \
property_string.c:lh_PROPERTY_STRING_doall:
  311|      4|    { \
  312|      4|        OPENSSL_LH_doall((OPENSSL_LHASH *)lh, (OPENSSL_LH_DOALL_FUNC)doall); \
  313|      4|    } \
property_string.c:lh_PROPERTY_STRING_free:
  254|      4|    { \
  255|      4|        OPENSSL_LH_free((OPENSSL_LHASH *)lh); \
  256|      4|    } \
property_string.c:lh_PROPERTY_STRING_new:
  317|      4|    { \
  318|      4|        return (LHASH_OF(type) *)OPENSSL_LH_set_thunks(OPENSSL_LH_new((OPENSSL_LH_HASHFUNC)hfn, (OPENSSL_LH_COMPFUNC)cfn), \
  319|      4|                                lh_##type##_hfn_thunk, lh_##type##_cfn_thunk, \
  320|      4|                                lh_##type##_doall_thunk, \
  321|      4|                                lh_##type##_doall_arg_thunk); \
  322|      4|    } \
property_string.c:lh_PROPERTY_STRING_hfn_thunk:
  243|     48|    { \
  244|     48|        unsigned long (*hfn_conv)(const type *) = (unsigned long (*)(const type *))hfn; \
  245|     48|        return hfn_conv((const type *)data); \
  246|     48|    } \
property_string.c:lh_PROPERTY_STRING_doall_thunk:
  299|     16|    { \
  300|     16|        void (*doall_conv)(type *) = (void (*)(type *))doall; \
  301|     16|        doall_conv((type *)node); \
  302|     16|    } \
property_string.c:lh_PROPERTY_STRING_retrieve:
  274|     32|    { \
  275|     32|        return (type *)OPENSSL_LH_retrieve((OPENSSL_LHASH *)lh, d); \
  276|     32|    } \
property_string.c:lh_PROPERTY_STRING_insert:
  264|     16|    { \
  265|     16|        return (type *)OPENSSL_LH_insert((OPENSSL_LHASH *)lh, d); \
  266|     16|    } \
property_string.c:lh_PROPERTY_STRING_error:
  279|     16|    { \
  280|     16|        return OPENSSL_LH_error((OPENSSL_LHASH *)lh); \
  281|     16|    } \
decoder_pkey.c:lh_DECODER_CACHE_ENTRY_new:
  317|      2|    { \
  318|      2|        return (LHASH_OF(type) *)OPENSSL_LH_set_thunks(OPENSSL_LH_new((OPENSSL_LH_HASHFUNC)hfn, (OPENSSL_LH_COMPFUNC)cfn), \
  319|      2|                                lh_##type##_hfn_thunk, lh_##type##_cfn_thunk, \
  320|      2|                                lh_##type##_doall_thunk, \
  321|      2|                                lh_##type##_doall_arg_thunk); \
  322|      2|    } \
decoder_pkey.c:lh_DECODER_CACHE_ENTRY_doall:
  311|      2|    { \
  312|      2|        OPENSSL_LH_doall((OPENSSL_LHASH *)lh, (OPENSSL_LH_DOALL_FUNC)doall); \
  313|      2|    } \
decoder_pkey.c:lh_DECODER_CACHE_ENTRY_free:
  254|      2|    { \
  255|      2|        OPENSSL_LH_free((OPENSSL_LHASH *)lh); \
  256|      2|    } \

initthread.c:sk_THREAD_EVENT_HANDLER_PTR_new_null:
   96|      2|    { \
   97|      2|        return (STACK_OF(t1) *)OPENSSL_sk_new_null(); \
   98|      2|    } \
initthread.c:sk_THREAD_EVENT_HANDLER_PTR_free:
  112|      2|    { \
  113|      2|        OPENSSL_sk_free((OPENSSL_STACK *)sk); \
  114|      2|    } \
initthread.c:sk_THREAD_EVENT_HANDLER_PTR_push:
  129|      2|    { \
  130|      2|        return OPENSSL_sk_push((OPENSSL_STACK *)sk, (const void *)ptr); \
  131|      2|    } \
initthread.c:sk_THREAD_EVENT_HANDLER_PTR_num:
   80|      4|    { \
   81|      4|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   82|      4|    } \
initthread.c:sk_THREAD_EVENT_HANDLER_PTR_value:
   84|      2|    { \
   85|      2|        return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \
   86|      2|    } \
initthread.c:sk_THREAD_EVENT_HANDLER_PTR_delete:
  120|      2|    { \
  121|      2|        return (t2 *)OPENSSL_sk_delete((OPENSSL_STACK *)sk, i); \
  122|      2|    } \
conf_mod.c:sk_CONF_IMODULE_free:
  112|      4|    { \
  113|      4|        OPENSSL_sk_free((OPENSSL_STACK *)sk); \
  114|      4|    } \
conf_mod.c:sk_CONF_MODULE_dup:
  182|      2|    { \
  183|      2|        return (STACK_OF(t1) *)OPENSSL_sk_dup((const OPENSSL_STACK *)sk); \
  184|      2|    } \
conf_mod.c:sk_CONF_MODULE_new_null:
   96|      2|    { \
   97|      2|        return (STACK_OF(t1) *)OPENSSL_sk_new_null(); \
   98|      2|    } \
conf_mod.c:sk_CONF_MODULE_num:
   80|      4|    { \
   81|      4|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   82|      4|    } \
conf_mod.c:sk_CONF_MODULE_free:
  112|      6|    { \
  113|      6|        OPENSSL_sk_free((OPENSSL_STACK *)sk); \
  114|      6|    } \
conf_mod.c:sk_CONF_MODULE_pop_free:
  145|      2|    { \
  146|      2|        OPENSSL_sk_freefunc_thunk f_thunk; \
  147|      2|        \
  148|      2|        f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk; \
  149|      2|        sk = (STACK_OF(t1) *)OPENSSL_sk_set_thunks((OPENSSL_STACK *)sk, f_thunk); \
  150|      2|        \
  151|      2|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  152|      2|    } \
conf_mod.c:sk_CONF_IMODULE_num:
   80|      2|    { \
   81|      2|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   82|      2|    } \
core_namemap.c:sk_NAMES_new_null:
   96|      2|    { \
   97|      2|        return (STACK_OF(t1) *)OPENSSL_sk_new_null(); \
   98|      2|    } \
core_namemap.c:sk_NAMES_pop_free:
  145|      2|    { \
  146|      2|        OPENSSL_sk_freefunc_thunk f_thunk; \
  147|      2|        \
  148|      2|        f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk; \
  149|      2|        sk = (STACK_OF(t1) *)OPENSSL_sk_set_thunks((OPENSSL_STACK *)sk, f_thunk); \
  150|      2|        \
  151|      2|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  152|      2|    } \
ex_data.c:sk_EX_CALLBACK_pop_free:
  145|     36|    { \
  146|     36|        OPENSSL_sk_freefunc_thunk f_thunk; \
  147|     36|        \
  148|     36|        f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk; \
  149|     36|        sk = (STACK_OF(t1) *)OPENSSL_sk_set_thunks((OPENSSL_STACK *)sk, f_thunk); \
  150|     36|        \
  151|     36|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  152|     36|    } \
provider_conf.c:sk_OSSL_PROVIDER_pop_free:
  145|      2|    { \
  146|      2|        OPENSSL_sk_freefunc_thunk f_thunk; \
  147|      2|        \
  148|      2|        f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk; \
  149|      2|        sk = (STACK_OF(t1) *)OPENSSL_sk_set_thunks((OPENSSL_STACK *)sk, f_thunk); \
  150|      2|        \
  151|      2|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  152|      2|    } \
provider_core.c:sk_OSSL_PROVIDER_pop_free:
  145|      2|    { \
  146|      2|        OPENSSL_sk_freefunc_thunk f_thunk; \
  147|      2|        \
  148|      2|        f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk; \
  149|      2|        sk = (STACK_OF(t1) *)OPENSSL_sk_set_thunks((OPENSSL_STACK *)sk, f_thunk); \
  150|      2|        \
  151|      2|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  152|      2|    } \
provider_core.c:sk_OSSL_PROVIDER_CHILD_CB_pop_free:
  145|      2|    { \
  146|      2|        OPENSSL_sk_freefunc_thunk f_thunk; \
  147|      2|        \
  148|      2|        f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk; \
  149|      2|        sk = (STACK_OF(t1) *)OPENSSL_sk_set_thunks((OPENSSL_STACK *)sk, f_thunk); \
  150|      2|        \
  151|      2|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  152|      2|    } \
provider_core.c:sk_OSSL_PROVIDER_new:
   88|      2|    { \
   89|      2|        OPENSSL_STACK *ret = OPENSSL_sk_new((OPENSSL_sk_compfunc)compare); \
   90|      2|        OPENSSL_sk_freefunc_thunk f_thunk; \
   91|      2|        \
   92|      2|        f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk; \
   93|      2|        return (STACK_OF(t1) *)OPENSSL_sk_set_thunks(ret, f_thunk); \
   94|      2|    } \
provider_core.c:sk_OSSL_PROVIDER_CHILD_CB_new_null:
   96|      2|    { \
   97|      2|        return (STACK_OF(t1) *)OPENSSL_sk_new_null(); \
   98|      2|    } \
obj_xref.c:sk_nid_triple_pop_free:
  145|      2|    { \
  146|      2|        OPENSSL_sk_freefunc_thunk f_thunk; \
  147|      2|        \
  148|      2|        f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk; \
  149|      2|        sk = (STACK_OF(t1) *)OPENSSL_sk_set_thunks((OPENSSL_STACK *)sk, f_thunk); \
  150|      2|        \
  151|      2|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  152|      2|    } \
obj_xref.c:sk_nid_triple_free:
  112|      2|    { \
  113|      2|        OPENSSL_sk_free((OPENSSL_STACK *)sk); \
  114|      2|    } \
property_string.c:ossl_check_OPENSSL_CSTRING_sk_type:
   53|     20|    { \
   54|     20|        return (OPENSSL_STACK *)sk; \
   55|     20|    } \
property_string.c:ossl_check_OPENSSL_CSTRING_type:
   45|     16|    { \
   46|     16|        return ptr; \
   47|     16|    } \
evp_pbe.c:sk_EVP_PBE_CTL_pop_free:
  145|      2|    { \
  146|      2|        OPENSSL_sk_freefunc_thunk f_thunk; \
  147|      2|        \
  148|      2|        f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk; \
  149|      2|        sk = (STACK_OF(t1) *)OPENSSL_sk_set_thunks((OPENSSL_STACK *)sk, f_thunk); \
  150|      2|        \
  151|      2|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  152|      2|    } \
comp_methods.c:ossl_check_SSL_COMP_compfunc_type:
   57|      2|    { \
   58|      2|        return (OPENSSL_sk_compfunc)cmp; \
   59|      2|    } \
comp_methods.c:ossl_check_SSL_COMP_sk_type:
   53|      2|    { \
   54|      2|        return (OPENSSL_STACK *)sk; \
   55|      2|    } \
comp_methods.c:ossl_check_SSL_COMP_freefunc_type:
   65|      2|    { \
   66|      2|        return (OPENSSL_sk_freefunc)fr; \
   67|      2|    }

ossl_err_load_PROV_strings:
  259|      2|{
  260|      2|#ifndef OPENSSL_NO_ERR
  261|      2|    if (ERR_reason_error_string(PROV_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (261:9): [True: 2, False: 0]
  ------------------
  262|      2|        ERR_load_strings_const(PROV_str_reasons);
  263|      2|#endif
  264|      2|    return 1;
  265|      2|}

ossl_prov_drbg_nonce_ctx_new:
  272|      2|{
  273|      2|    PROV_DRBG_NONCE_GLOBAL *dngbl = OPENSSL_zalloc(sizeof(*dngbl));
  ------------------
  |  |  104|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  274|       |
  275|      2|    if (dngbl == NULL)
  ------------------
  |  Branch (275:9): [True: 0, False: 2]
  ------------------
  276|      0|        return NULL;
  277|       |
  278|      2|    dngbl->rand_nonce_lock = CRYPTO_THREAD_lock_new();
  279|      2|    if (dngbl->rand_nonce_lock == NULL) {
  ------------------
  |  Branch (279:9): [True: 0, False: 2]
  ------------------
  280|      0|        OPENSSL_free(dngbl);
  ------------------
  |  |  115|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  281|      0|        return NULL;
  282|      0|    }
  283|       |
  284|      2|    return dngbl;
  285|      2|}
ossl_prov_drbg_nonce_ctx_free:
  288|      2|{
  289|      2|    PROV_DRBG_NONCE_GLOBAL *dngbl = vdngbl;
  290|       |
  291|      2|    if (dngbl == NULL)
  ------------------
  |  Branch (291:9): [True: 0, False: 2]
  ------------------
  292|      0|        return;
  293|       |
  294|      2|    CRYPTO_THREAD_lock_free(dngbl->rand_nonce_lock);
  295|       |
  296|      2|    OPENSSL_free(dngbl);
  ------------------
  |  |  115|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  302|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  303|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  297|      2|}

