ossl_err_load_ASN1_strings:
  206|      2|{
  207|      2|#ifndef OPENSSL_NO_ERR
  208|      2|    if (ERR_reason_error_string(ASN1_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (208:9): [True: 2, False: 0]
  ------------------
  209|      2|        ERR_load_strings_const(ASN1_str_reasons);
  210|      2|#endif
  211|      2|    return 1;
  212|      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:
  204|      2|{
  205|       |# ifdef OPENSSL_SYS_WINDOWS
  206|       |    if (wsa_init_done) {
  207|       |        wsa_init_done = 0;
  208|       |        WSACleanup();
  209|       |    }
  210|       |# endif
  211|      2|}

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

BN_add:
   15|  2.45k|{
   16|  2.45k|    int ret, r_neg, cmp_res;
   17|       |
   18|  2.45k|    bn_check_top(a);
   19|  2.45k|    bn_check_top(b);
   20|       |
   21|  2.45k|    if (a->neg == b->neg) {
  ------------------
  |  Branch (21:9): [True: 0, False: 2.45k]
  ------------------
   22|      0|        r_neg = a->neg;
   23|      0|        ret = BN_uadd(r, a, b);
   24|  2.45k|    } else {
   25|  2.45k|        cmp_res = BN_ucmp(a, b);
   26|  2.45k|        if (cmp_res > 0) {
  ------------------
  |  Branch (26:13): [True: 0, False: 2.45k]
  ------------------
   27|      0|            r_neg = a->neg;
   28|      0|            ret = BN_usub(r, a, b);
   29|  2.45k|        } else if (cmp_res < 0) {
  ------------------
  |  Branch (29:20): [True: 2.45k, False: 0]
  ------------------
   30|  2.45k|            r_neg = b->neg;
   31|  2.45k|            ret = BN_usub(r, b, a);
   32|  2.45k|        } 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.45k|    }
   38|       |
   39|  2.45k|    r->neg = r_neg;
   40|  2.45k|    bn_check_top(r);
   41|  2.45k|    return ret;
   42|  2.45k|}
BN_sub:
   46|  2.44k|{
   47|  2.44k|    int ret, r_neg, cmp_res;
   48|       |
   49|  2.44k|    bn_check_top(a);
   50|  2.44k|    bn_check_top(b);
   51|       |
   52|  2.44k|    if (a->neg != b->neg) {
  ------------------
  |  Branch (52:9): [True: 0, False: 2.44k]
  ------------------
   53|      0|        r_neg = a->neg;
   54|      0|        ret = BN_uadd(r, a, b);
   55|  2.44k|    } else {
   56|  2.44k|        cmp_res = BN_ucmp(a, b);
   57|  2.44k|        if (cmp_res > 0) {
  ------------------
  |  Branch (57:13): [True: 764, False: 1.68k]
  ------------------
   58|    764|            r_neg = a->neg;
   59|    764|            ret = BN_usub(r, a, b);
   60|  1.68k|        } else if (cmp_res < 0) {
  ------------------
  |  Branch (60:20): [True: 1.68k, False: 0]
  ------------------
   61|  1.68k|            r_neg = !b->neg;
   62|  1.68k|            ret = BN_usub(r, b, a);
   63|  1.68k|        } 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.44k|    }
   69|       |
   70|  2.44k|    r->neg = r_neg;
   71|  2.44k|    bn_check_top(r);
   72|  2.44k|    return ret;
   73|  2.44k|}
BN_uadd:
   77|  82.1k|{
   78|  82.1k|    int max, min, dif;
   79|  82.1k|    const BN_ULONG *ap, *bp;
   80|  82.1k|    BN_ULONG *rp, carry, t1, t2;
  ------------------
  |  |   37|  82.1k|#  define BN_ULONG        unsigned long
  ------------------
   81|       |
   82|  82.1k|    bn_check_top(a);
   83|  82.1k|    bn_check_top(b);
   84|       |
   85|  82.1k|    if (a->top < b->top) {
  ------------------
  |  Branch (85:9): [True: 1.70k, False: 80.4k]
  ------------------
   86|  1.70k|        const BIGNUM *tmp;
   87|       |
   88|  1.70k|        tmp = a;
   89|  1.70k|        a = b;
   90|  1.70k|        b = tmp;
   91|  1.70k|    }
   92|  82.1k|    max = a->top;
   93|  82.1k|    min = b->top;
   94|  82.1k|    dif = max - min;
   95|       |
   96|  82.1k|    if (bn_wexpand(r, max + 1) == NULL)
  ------------------
  |  Branch (96:9): [True: 0, False: 82.1k]
  ------------------
   97|      0|        return 0;
   98|       |
   99|  82.1k|    r->top = max;
  100|       |
  101|  82.1k|    ap = a->d;
  102|  82.1k|    bp = b->d;
  103|  82.1k|    rp = r->d;
  104|       |
  105|  82.1k|    carry = bn_add_words(rp, ap, bp, min);
  106|  82.1k|    rp += min;
  107|  82.1k|    ap += min;
  108|       |
  109|  91.6k|    while (dif) {
  ------------------
  |  Branch (109:12): [True: 9.48k, False: 82.1k]
  ------------------
  110|  9.48k|        dif--;
  111|  9.48k|        t1 = *(ap++);
  112|  9.48k|        t2 = (t1 + carry) & BN_MASK2;
  ------------------
  |  |   94|  9.48k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  113|  9.48k|        *(rp++) = t2;
  114|  9.48k|        carry &= (t2 == 0);
  115|  9.48k|    }
  116|  82.1k|    *rp = carry;
  117|  82.1k|    r->top += carry;
  118|       |
  119|  82.1k|    r->neg = 0;
  120|  82.1k|    bn_check_top(r);
  121|  82.1k|    return 1;
  122|  82.1k|}
BN_usub:
  126|   220k|{
  127|   220k|    int max, min, dif;
  128|   220k|    BN_ULONG t1, t2, borrow, *rp;
  ------------------
  |  |   37|   220k|#  define BN_ULONG        unsigned long
  ------------------
  129|   220k|    const BN_ULONG *ap, *bp;
  130|       |
  131|   220k|    bn_check_top(a);
  132|   220k|    bn_check_top(b);
  133|       |
  134|   220k|    max = a->top;
  135|   220k|    min = b->top;
  136|   220k|    dif = max - min;
  137|       |
  138|   220k|    if (dif < 0) {              /* hmm... should not be happening */
  ------------------
  |  Branch (138:9): [True: 0, False: 220k]
  ------------------
  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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  140|      0|        return 0;
  141|      0|    }
  142|       |
  143|   220k|    if (bn_wexpand(r, max) == NULL)
  ------------------
  |  Branch (143:9): [True: 0, False: 220k]
  ------------------
  144|      0|        return 0;
  145|       |
  146|   220k|    ap = a->d;
  147|   220k|    bp = b->d;
  148|   220k|    rp = r->d;
  149|       |
  150|   220k|    borrow = bn_sub_words(rp, ap, bp, min);
  151|   220k|    ap += min;
  152|   220k|    rp += min;
  153|       |
  154|   294k|    while (dif) {
  ------------------
  |  Branch (154:12): [True: 73.2k, False: 220k]
  ------------------
  155|  73.2k|        dif--;
  156|  73.2k|        t1 = *(ap++);
  157|  73.2k|        t2 = (t1 - borrow) & BN_MASK2;
  ------------------
  |  |   94|  73.2k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  158|  73.2k|        *(rp++) = t2;
  159|  73.2k|        borrow &= (t1 == 0);
  160|  73.2k|    }
  161|       |
  162|  1.02M|    while (max && *--rp == 0)
  ------------------
  |  Branch (162:12): [True: 1.02M, False: 1.39k]
  |  Branch (162:19): [True: 807k, False: 219k]
  ------------------
  163|   807k|        max--;
  164|       |
  165|   220k|    r->top = max;
  166|   220k|    r->neg = 0;
  167|   220k|    bn_pollute(r);
  168|       |
  169|   220k|    return 1;
  170|   220k|}

BN_CTX_new_ex:
  119|  3.14k|{
  120|  3.14k|    BN_CTX *ret;
  121|       |
  122|  3.14k|    if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
  ------------------
  |  |   99|  3.14k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  3.14k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  3.14k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (122:9): [True: 0, False: 3.14k]
  ------------------
  123|      0|        return NULL;
  124|       |    /* Initialise the structure */
  125|  3.14k|    BN_POOL_init(&ret->pool);
  126|  3.14k|    BN_STACK_init(&ret->stack);
  127|  3.14k|    ret->libctx = ctx;
  128|  3.14k|    return ret;
  129|  3.14k|}
BN_CTX_new:
  133|  3.14k|{
  134|  3.14k|    return BN_CTX_new_ex(NULL);
  135|  3.14k|}
BN_CTX_free:
  155|  4.48k|{
  156|  4.48k|    if (ctx == NULL)
  ------------------
  |  Branch (156:9): [True: 1.34k, False: 3.14k]
  ------------------
  157|  1.34k|        return;
  158|  3.14k|#ifndef FIPS_MODULE
  159|  3.14k|    OSSL_TRACE_BEGIN(BN_CTX) {
  ------------------
  |  |  219|  3.14k|    do {                                        \
  |  |  220|  3.14k|        BIO *trc_out = NULL;                    \
  |  |  221|  3.14k|        if (0)
  |  |  ------------------
  |  |  |  Branch (221: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.14k|    } OSSL_TRACE_END(BN_CTX);
  ------------------
  |  |  224|  3.14k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  173|  3.14k|#endif
  174|  3.14k|    BN_STACK_finish(&ctx->stack);
  175|  3.14k|    BN_POOL_finish(&ctx->pool);
  176|  3.14k|    OPENSSL_free(ctx);
  ------------------
  |  |  107|  3.14k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  3.14k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  3.14k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  177|  3.14k|}
BN_CTX_start:
  180|  1.29M|{
  181|  1.29M|    CTXDBG("ENTER BN_CTX_start()", ctx);
  ------------------
  |  |  110|  1.29M|    OSSL_TRACE_BEGIN(BN_CTX) {      \
  |  |  ------------------
  |  |  |  |  219|  1.29M|    do {                                        \
  |  |  |  |  220|  1.29M|        BIO *trc_out = NULL;                    \
  |  |  |  |  221|  1.29M|        if (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  111|      0|        ctxdbg(trc_out, str, ctx);  \
  |  |  112|  1.29M|    } OSSL_TRACE_END(BN_CTX)
  |  |  ------------------
  |  |  |  |  224|  1.29M|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  182|       |    /* If we're already overflowing ... */
  183|  1.29M|    if (ctx->err_stack || ctx->too_many)
  ------------------
  |  Branch (183:9): [True: 0, False: 1.29M]
  |  Branch (183:27): [True: 0, False: 1.29M]
  ------------------
  184|      0|        ctx->err_stack++;
  185|       |    /* (Try to) get a new frame pointer */
  186|  1.29M|    else if (!BN_STACK_push(&ctx->stack, ctx->used)) {
  ------------------
  |  Branch (186:14): [True: 0, False: 1.29M]
  ------------------
  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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  188|      0|        ctx->err_stack++;
  189|      0|    }
  190|  1.29M|    CTXDBG("LEAVE BN_CTX_start()", ctx);
  ------------------
  |  |  110|  1.29M|    OSSL_TRACE_BEGIN(BN_CTX) {      \
  |  |  ------------------
  |  |  |  |  219|  1.29M|    do {                                        \
  |  |  |  |  220|  1.29M|        BIO *trc_out = NULL;                    \
  |  |  |  |  221|  1.29M|        if (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  111|      0|        ctxdbg(trc_out, str, ctx);  \
  |  |  112|  1.29M|    } OSSL_TRACE_END(BN_CTX)
  |  |  ------------------
  |  |  |  |  224|  1.29M|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  191|  1.29M|}
BN_CTX_end:
  194|  1.29M|{
  195|  1.29M|    if (ctx == NULL)
  ------------------
  |  Branch (195:9): [True: 0, False: 1.29M]
  ------------------
  196|      0|        return;
  197|  1.29M|    CTXDBG("ENTER BN_CTX_end()", ctx);
  ------------------
  |  |  110|  1.29M|    OSSL_TRACE_BEGIN(BN_CTX) {      \
  |  |  ------------------
  |  |  |  |  219|  1.29M|    do {                                        \
  |  |  |  |  220|  1.29M|        BIO *trc_out = NULL;                    \
  |  |  |  |  221|  1.29M|        if (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  111|      0|        ctxdbg(trc_out, str, ctx);  \
  |  |  112|  1.29M|    } OSSL_TRACE_END(BN_CTX)
  |  |  ------------------
  |  |  |  |  224|  1.29M|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  198|  1.29M|    if (ctx->err_stack)
  ------------------
  |  Branch (198:9): [True: 0, False: 1.29M]
  ------------------
  199|      0|        ctx->err_stack--;
  200|  1.29M|    else {
  201|  1.29M|        unsigned int fp = BN_STACK_pop(&ctx->stack);
  202|       |        /* Does this stack frame have anything to release? */
  203|  1.29M|        if (fp < ctx->used)
  ------------------
  |  Branch (203:13): [True: 1.06M, False: 225k]
  ------------------
  204|  1.06M|            BN_POOL_release(&ctx->pool, ctx->used - fp);
  205|  1.29M|        ctx->used = fp;
  206|       |        /* Unjam "too_many" in case "get" had failed */
  207|  1.29M|        ctx->too_many = 0;
  208|  1.29M|    }
  209|  1.29M|    CTXDBG("LEAVE BN_CTX_end()", ctx);
  ------------------
  |  |  110|  1.29M|    OSSL_TRACE_BEGIN(BN_CTX) {      \
  |  |  ------------------
  |  |  |  |  219|  1.29M|    do {                                        \
  |  |  |  |  220|  1.29M|        BIO *trc_out = NULL;                    \
  |  |  |  |  221|  1.29M|        if (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  111|      0|        ctxdbg(trc_out, str, ctx);  \
  |  |  112|  1.29M|    } OSSL_TRACE_END(BN_CTX)
  |  |  ------------------
  |  |  |  |  224|  1.29M|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  210|  1.29M|}
BN_CTX_get:
  213|  1.88M|{
  214|  1.88M|    BIGNUM *ret;
  215|       |
  216|  1.88M|    CTXDBG("ENTER BN_CTX_get()", ctx);
  ------------------
  |  |  110|  1.88M|    OSSL_TRACE_BEGIN(BN_CTX) {      \
  |  |  ------------------
  |  |  |  |  219|  1.88M|    do {                                        \
  |  |  |  |  220|  1.88M|        BIO *trc_out = NULL;                    \
  |  |  |  |  221|  1.88M|        if (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  111|      0|        ctxdbg(trc_out, str, ctx);  \
  |  |  112|  1.88M|    } OSSL_TRACE_END(BN_CTX)
  |  |  ------------------
  |  |  |  |  224|  1.88M|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  217|  1.88M|    if (ctx->err_stack || ctx->too_many)
  ------------------
  |  Branch (217:9): [True: 0, False: 1.88M]
  |  Branch (217:27): [True: 0, False: 1.88M]
  ------------------
  218|      0|        return NULL;
  219|  1.88M|    if ((ret = BN_POOL_get(&ctx->pool, ctx->flags)) == NULL) {
  ------------------
  |  Branch (219:9): [True: 0, False: 1.88M]
  ------------------
  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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      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.88M|    BN_zero(ret);
  ------------------
  |  |  202|  1.88M|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  230|       |    /* clear BN_FLG_CONSTTIME if leaked from previous frames */
  231|  1.88M|    ret->flags &= (~BN_FLG_CONSTTIME);
  ------------------
  |  |   67|  1.88M|# define BN_FLG_CONSTTIME        0x04
  ------------------
  232|  1.88M|    ctx->used++;
  233|  1.88M|    CTXDBG("LEAVE BN_CTX_get()", ctx);
  ------------------
  |  |  110|  1.88M|    OSSL_TRACE_BEGIN(BN_CTX) {      \
  |  |  ------------------
  |  |  |  |  219|  1.88M|    do {                                        \
  |  |  |  |  220|  1.88M|        BIO *trc_out = NULL;                    \
  |  |  |  |  221|  1.88M|        if (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (221:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  111|      0|        ctxdbg(trc_out, str, ctx);  \
  |  |  112|  1.88M|    } OSSL_TRACE_END(BN_CTX)
  |  |  ------------------
  |  |  |  |  224|  1.88M|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:13): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  234|  1.88M|    return ret;
  235|  1.88M|}
bn_ctx.c:BN_STACK_init:
  249|  3.14k|{
  250|  3.14k|    st->indexes = NULL;
  251|  3.14k|    st->depth = st->size = 0;
  252|  3.14k|}
bn_ctx.c:BN_STACK_finish:
  255|  3.14k|{
  256|  3.14k|    OPENSSL_free(st->indexes);
  ------------------
  |  |  107|  3.14k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  3.14k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  3.14k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  257|  3.14k|    st->indexes = NULL;
  258|  3.14k|}
bn_ctx.c:BN_STACK_push:
  262|  1.29M|{
  263|  1.29M|    if (st->depth == st->size) {
  ------------------
  |  Branch (263:9): [True: 2.93k, False: 1.29M]
  ------------------
  264|       |        /* Need to expand */
  265|  2.93k|        unsigned int newsize =
  266|  2.93k|            st->size ? (st->size * 3 / 2) : BN_CTX_START_FRAMES;
  ------------------
  |  |   17|  2.93k|#define BN_CTX_START_FRAMES     32
  ------------------
  |  Branch (266:13): [True: 0, False: 2.93k]
  ------------------
  267|  2.93k|        unsigned int *newitems;
  268|       |
  269|  2.93k|        if ((newitems = OPENSSL_malloc(sizeof(*newitems) * newsize)) == NULL)
  ------------------
  |  |   97|  2.93k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  2.93k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  2.93k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (269:13): [True: 0, False: 2.93k]
  ------------------
  270|      0|            return 0;
  271|  2.93k|        if (st->depth)
  ------------------
  |  Branch (271:13): [True: 0, False: 2.93k]
  ------------------
  272|      0|            memcpy(newitems, st->indexes, sizeof(*newitems) * st->depth);
  273|  2.93k|        OPENSSL_free(st->indexes);
  ------------------
  |  |  107|  2.93k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  2.93k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  2.93k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  274|  2.93k|        st->indexes = newitems;
  275|  2.93k|        st->size = newsize;
  276|  2.93k|    }
  277|  1.29M|    st->indexes[(st->depth)++] = idx;
  278|  1.29M|    return 1;
  279|  1.29M|}
bn_ctx.c:BN_STACK_pop:
  282|  1.29M|{
  283|  1.29M|    return st->indexes[--(st->depth)];
  284|  1.29M|}
bn_ctx.c:BN_POOL_init:
  291|  3.14k|{
  292|  3.14k|    p->head = p->current = p->tail = NULL;
  293|  3.14k|    p->used = p->size = 0;
  294|  3.14k|}
bn_ctx.c:BN_POOL_finish:
  297|  3.14k|{
  298|  3.14k|    unsigned int loop;
  299|  3.14k|    BIGNUM *bn;
  300|       |
  301|  6.23k|    while (p->head) {
  ------------------
  |  Branch (301:12): [True: 3.08k, False: 3.14k]
  ------------------
  302|  52.4k|        for (loop = 0, bn = p->head->vals; loop++ < BN_CTX_POOL_SIZE; bn++)
  ------------------
  |  |   15|  52.4k|#define BN_CTX_POOL_SIZE        16
  ------------------
  |  Branch (302:44): [True: 49.3k, False: 3.08k]
  ------------------
  303|  49.3k|            if (bn->d)
  ------------------
  |  Branch (303:17): [True: 33.1k, False: 16.1k]
  ------------------
  304|  33.1k|                BN_clear_free(bn);
  305|  3.08k|        p->current = p->head->next;
  306|  3.08k|        OPENSSL_free(p->head);
  ------------------
  |  |  107|  3.08k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  3.08k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  3.08k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  307|  3.08k|        p->head = p->current;
  308|  3.08k|    }
  309|  3.14k|}
bn_ctx.c:BN_POOL_get:
  313|  1.88M|{
  314|  1.88M|    BIGNUM *bn;
  315|  1.88M|    unsigned int loop;
  316|       |
  317|       |    /* Full; allocate a new pool item and link it in. */
  318|  1.88M|    if (p->used == p->size) {
  ------------------
  |  Branch (318:9): [True: 3.08k, False: 1.87M]
  ------------------
  319|  3.08k|        BN_POOL_ITEM *item;
  320|       |
  321|  3.08k|        if ((item = OPENSSL_malloc(sizeof(*item))) == NULL)
  ------------------
  |  |   97|  3.08k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  3.08k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  3.08k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (321:13): [True: 0, False: 3.08k]
  ------------------
  322|      0|            return NULL;
  323|  52.4k|        for (loop = 0, bn = item->vals; loop++ < BN_CTX_POOL_SIZE; bn++) {
  ------------------
  |  |   15|  52.4k|#define BN_CTX_POOL_SIZE        16
  ------------------
  |  Branch (323:41): [True: 49.3k, False: 3.08k]
  ------------------
  324|  49.3k|            bn_init(bn);
  325|  49.3k|            if ((flag & BN_FLG_SECURE) != 0)
  ------------------
  |  |   68|  49.3k|# define BN_FLG_SECURE           0x08
  ------------------
  |  Branch (325:17): [True: 0, False: 49.3k]
  ------------------
  326|      0|                BN_set_flags(bn, BN_FLG_SECURE);
  ------------------
  |  |   68|      0|# define BN_FLG_SECURE           0x08
  ------------------
  327|  49.3k|        }
  328|  3.08k|        item->prev = p->tail;
  329|  3.08k|        item->next = NULL;
  330|       |
  331|  3.08k|        if (p->head == NULL)
  ------------------
  |  Branch (331:13): [True: 2.93k, False: 146]
  ------------------
  332|  2.93k|            p->head = p->current = p->tail = item;
  333|    146|        else {
  334|    146|            p->tail->next = item;
  335|    146|            p->tail = item;
  336|    146|            p->current = item;
  337|    146|        }
  338|  3.08k|        p->size += BN_CTX_POOL_SIZE;
  ------------------
  |  |   15|  3.08k|#define BN_CTX_POOL_SIZE        16
  ------------------
  339|  3.08k|        p->used++;
  340|       |        /* Return the first bignum from the new pool */
  341|  3.08k|        return item->vals;
  342|  3.08k|    }
  343|       |
  344|  1.87M|    if (!p->used)
  ------------------
  |  Branch (344:9): [True: 2.93k, False: 1.87M]
  ------------------
  345|  2.93k|        p->current = p->head;
  346|  1.87M|    else if ((p->used % BN_CTX_POOL_SIZE) == 0)
  ------------------
  |  |   15|  1.87M|#define BN_CTX_POOL_SIZE        16
  ------------------
  |  Branch (346:14): [True: 792, False: 1.87M]
  ------------------
  347|    792|        p->current = p->current->next;
  348|  1.87M|    return p->current->vals + ((p->used++) % BN_CTX_POOL_SIZE);
  ------------------
  |  |   15|  1.87M|#define BN_CTX_POOL_SIZE        16
  ------------------
  349|  1.88M|}
bn_ctx.c:BN_POOL_release:
  352|  1.06M|{
  353|  1.06M|    unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;
  ------------------
  |  |   15|  1.06M|#define BN_CTX_POOL_SIZE        16
  ------------------
  354|       |
  355|  1.06M|    p->used -= num;
  356|  2.95M|    while (num--) {
  ------------------
  |  Branch (356:12): [True: 1.88M, False: 1.06M]
  ------------------
  357|  1.88M|        bn_check_top(p->current->vals + offset);
  358|  1.88M|        if (offset == 0) {
  ------------------
  |  Branch (358:13): [True: 6.81k, False: 1.87M]
  ------------------
  359|  6.81k|            offset = BN_CTX_POOL_SIZE - 1;
  ------------------
  |  |   15|  6.81k|#define BN_CTX_POOL_SIZE        16
  ------------------
  360|  6.81k|            p->current = p->current->prev;
  361|  6.81k|        } else
  362|  1.87M|            offset--;
  363|  1.88M|    }
  364|  1.06M|}

BN_div:
  211|   186k|{
  212|   186k|    int ret;
  213|       |
  214|   186k|    if (BN_is_zero(divisor)) {
  ------------------
  |  Branch (214:9): [True: 0, False: 186k]
  ------------------
  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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      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|   186k|    if (divisor->d[divisor->top - 1] == 0) {
  ------------------
  |  Branch (224:9): [True: 0, False: 186k]
  ------------------
  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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  226|      0|        return 0;
  227|      0|    }
  228|       |
  229|   186k|    ret = bn_div_fixed_top(dv, rm, num, divisor, ctx);
  230|       |
  231|   186k|    if (ret) {
  ------------------
  |  Branch (231:9): [True: 186k, False: 0]
  ------------------
  232|   186k|        if (dv != NULL)
  ------------------
  |  Branch (232:13): [True: 2.88k, False: 184k]
  ------------------
  233|  2.88k|            bn_correct_top(dv);
  234|   186k|        if (rm != NULL)
  ------------------
  |  Branch (234:13): [True: 184k, False: 2.88k]
  ------------------
  235|   184k|            bn_correct_top(rm);
  236|   186k|    }
  237|       |
  238|   186k|    return ret;
  239|   186k|}
bn_div_fixed_top:
  266|   186k|{
  267|   186k|    int norm_shift, i, j, loop;
  268|   186k|    BIGNUM *tmp, *snum, *sdiv, *res;
  269|   186k|    BN_ULONG *resp, *wnum, *wnumtop;
  ------------------
  |  |   37|   186k|#  define BN_ULONG        unsigned long
  ------------------
  270|   186k|    BN_ULONG d0, d1;
  ------------------
  |  |   37|   186k|#  define BN_ULONG        unsigned long
  ------------------
  271|   186k|    int num_n, div_n, num_neg;
  272|       |
  273|   186k|    assert(divisor->top > 0 && divisor->d[divisor->top - 1] != 0);
  274|       |
  275|   186k|    bn_check_top(num);
  276|   186k|    bn_check_top(divisor);
  277|   186k|    bn_check_top(dv);
  278|   186k|    bn_check_top(rm);
  279|       |
  280|   186k|    BN_CTX_start(ctx);
  281|   186k|    res = (dv == NULL) ? BN_CTX_get(ctx) : dv;
  ------------------
  |  Branch (281:11): [True: 184k, False: 2.88k]
  ------------------
  282|   186k|    tmp = BN_CTX_get(ctx);
  283|   186k|    snum = BN_CTX_get(ctx);
  284|   186k|    sdiv = BN_CTX_get(ctx);
  285|   186k|    if (sdiv == NULL)
  ------------------
  |  Branch (285:9): [True: 0, False: 186k]
  ------------------
  286|      0|        goto err;
  287|       |
  288|       |    /* First we normalise the numbers */
  289|   186k|    if (!BN_copy(sdiv, divisor))
  ------------------
  |  Branch (289:9): [True: 0, False: 186k]
  ------------------
  290|      0|        goto err;
  291|   186k|    norm_shift = bn_left_align(sdiv);
  292|   186k|    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|   186k|    if (!(bn_lshift_fixed_top(snum, num, norm_shift)))
  ------------------
  |  Branch (300:9): [True: 0, False: 186k]
  ------------------
  301|      0|        goto err;
  302|       |
  303|   186k|    div_n = sdiv->top;
  304|   186k|    num_n = snum->top;
  305|       |
  306|   186k|    if (num_n <= div_n) {
  ------------------
  |  Branch (306:9): [True: 20.5k, False: 166k]
  ------------------
  307|       |        /* caller didn't pad dividend -> no constant-time guarantee... */
  308|  20.5k|        if (bn_wexpand(snum, div_n + 1) == NULL)
  ------------------
  |  Branch (308:13): [True: 0, False: 20.5k]
  ------------------
  309|      0|            goto err;
  310|  20.5k|        memset(&(snum->d[num_n]), 0, (div_n - num_n + 1) * sizeof(BN_ULONG));
  311|  20.5k|        snum->top = num_n = div_n + 1;
  312|  20.5k|    }
  313|       |
  314|   186k|    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|   186k|    wnum = &(snum->d[loop]);
  320|   186k|    wnumtop = &(snum->d[num_n - 1]);
  321|       |
  322|       |    /* Get the top 2 words of sdiv */
  323|   186k|    d0 = sdiv->d[div_n - 1];
  324|   186k|    d1 = (div_n == 1) ? 0 : sdiv->d[div_n - 2];
  ------------------
  |  Branch (324:10): [True: 125k, False: 61.6k]
  ------------------
  325|       |
  326|       |    /* Setup quotient */
  327|   186k|    if (!bn_wexpand(res, loop))
  ------------------
  |  Branch (327:9): [True: 0, False: 186k]
  ------------------
  328|      0|        goto err;
  329|   186k|    num_neg = num->neg;
  330|   186k|    res->neg = (num_neg ^ divisor->neg);
  331|   186k|    res->top = loop;
  332|   186k|    res->flags |= BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|   186k|#  define BN_FLG_FIXED_TOP 0
  ------------------
  333|   186k|    resp = &(res->d[loop]);
  334|       |
  335|       |    /* space for temp */
  336|   186k|    if (!bn_wexpand(tmp, (div_n + 1)))
  ------------------
  |  Branch (336:9): [True: 0, False: 186k]
  ------------------
  337|      0|        goto err;
  338|       |
  339|  1.26M|    for (i = 0; i < loop; i++, wnumtop--) {
  ------------------
  |  Branch (339:17): [True: 1.07M, False: 186k]
  ------------------
  340|  1.07M|        BN_ULONG q, l0;
  ------------------
  |  |   37|  1.07M|#  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|  1.07M|        BN_ULONG n0, n1, rem = 0;
  ------------------
  |  |   37|  1.07M|#  define BN_ULONG        unsigned long
  ------------------
  349|       |
  350|  1.07M|        n0 = wnumtop[0];
  351|  1.07M|        n1 = wnumtop[-1];
  352|  1.07M|        if (n0 == d0)
  ------------------
  |  Branch (352:13): [True: 35.1k, False: 1.04M]
  ------------------
  353|  35.1k|            q = BN_MASK2;
  ------------------
  |  |   94|  35.1k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  354|  1.04M|        else {                  /* n0 < d0 */
  355|  1.04M|            BN_ULONG n2 = (wnumtop == wnum) ? 0 : wnumtop[-2];
  ------------------
  |  |   37|  1.04M|#  define BN_ULONG        unsigned long
  ------------------
  |  Branch (355:27): [True: 177k, False: 863k]
  ------------------
  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|  1.04M|            BN_ULONG t2l, t2h;
  ------------------
  |  |   37|  1.04M|#  define BN_ULONG        unsigned long
  ------------------
  385|       |
  386|  1.04M|            q = bn_div_words(n0, n1, d0);
  387|  1.04M|#   ifndef REMAINDER_IS_ALREADY_CALCULATED
  388|  1.04M|            rem = (n1 - q * d0) & BN_MASK2;
  ------------------
  |  |   94|  1.04M|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  389|  1.04M|#   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|  1.04M|            {
  398|  1.04M|                BN_ULONG ql, qh;
  ------------------
  |  |   37|  1.04M|#  define BN_ULONG        unsigned long
  ------------------
  399|  1.04M|                t2l = LBITS(d1);
  ------------------
  |  |  566|  1.04M|#  define LBITS(a)        ((a)&BN_MASK2l)
  |  |  ------------------
  |  |  |  |   95|  1.04M|#  define BN_MASK2l       (0xffffffffL)
  |  |  ------------------
  ------------------
  400|  1.04M|                t2h = HBITS(d1);
  ------------------
  |  |  567|  1.04M|#  define HBITS(a)        (((a)>>BN_BITS4)&BN_MASK2l)
  |  |  ------------------
  |  |  |  |   93|  1.04M|#  define BN_BITS4        32
  |  |  ------------------
  |  |               #  define HBITS(a)        (((a)>>BN_BITS4)&BN_MASK2l)
  |  |  ------------------
  |  |  |  |   95|  1.04M|#  define BN_MASK2l       (0xffffffffL)
  |  |  ------------------
  ------------------
  401|  1.04M|                ql = LBITS(q);
  ------------------
  |  |  566|  1.04M|#  define LBITS(a)        ((a)&BN_MASK2l)
  |  |  ------------------
  |  |  |  |   95|  1.04M|#  define BN_MASK2l       (0xffffffffL)
  |  |  ------------------
  ------------------
  402|  1.04M|                qh = HBITS(q);
  ------------------
  |  |  567|  1.04M|#  define HBITS(a)        (((a)>>BN_BITS4)&BN_MASK2l)
  |  |  ------------------
  |  |  |  |   93|  1.04M|#  define BN_BITS4        32
  |  |  ------------------
  |  |               #  define HBITS(a)        (((a)>>BN_BITS4)&BN_MASK2l)
  |  |  ------------------
  |  |  |  |   95|  1.04M|#  define BN_MASK2l       (0xffffffffL)
  |  |  ------------------
  ------------------
  403|  1.04M|                mul64(t2l, t2h, ql, qh); /* t2=(BN_ULLONG)d1*q; */
  ------------------
  |  |  575|  1.04M|        { \
  |  |  576|  1.04M|        BN_ULONG m,m1,lt,ht; \
  |  |  ------------------
  |  |  |  |   37|  1.04M|#  define BN_ULONG        unsigned long
  |  |  ------------------
  |  |  577|  1.04M| \
  |  |  578|  1.04M|        lt=l; \
  |  |  579|  1.04M|        ht=h; \
  |  |  580|  1.04M|        m =(bh)*(lt); \
  |  |  581|  1.04M|        lt=(bl)*(lt); \
  |  |  582|  1.04M|        m1=(bl)*(ht); \
  |  |  583|  1.04M|        ht =(bh)*(ht); \
  |  |  584|  1.04M|        m=(m+m1)&BN_MASK2; ht += L2HBITS((BN_ULONG)(m < m1)); \
  |  |  ------------------
  |  |  |  |   94|  1.04M|#  define BN_MASK2        (0xffffffffffffffffL)
  |  |  ------------------
  |  |                       m=(m+m1)&BN_MASK2; ht += L2HBITS((BN_ULONG)(m < m1)); \
  |  |  ------------------
  |  |  |  |  568|  1.04M|#  define L2HBITS(a)      (((a)<<BN_BITS4)&BN_MASK2)
  |  |  |  |  ------------------
  |  |  |  |  |  |   93|  1.04M|#  define BN_BITS4        32
  |  |  |  |  ------------------
  |  |  |  |               #  define L2HBITS(a)      (((a)<<BN_BITS4)&BN_MASK2)
  |  |  |  |  ------------------
  |  |  |  |  |  |   94|  1.04M|#  define BN_MASK2        (0xffffffffffffffffL)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  585|  1.04M|        ht+=HBITS(m); \
  |  |  ------------------
  |  |  |  |  567|  1.04M|#  define HBITS(a)        (((a)>>BN_BITS4)&BN_MASK2l)
  |  |  |  |  ------------------
  |  |  |  |  |  |   93|  1.04M|#  define BN_BITS4        32
  |  |  |  |  ------------------
  |  |  |  |               #  define HBITS(a)        (((a)>>BN_BITS4)&BN_MASK2l)
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  1.04M|#  define BN_MASK2l       (0xffffffffL)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  586|  1.04M|        m1=L2HBITS(m); \
  |  |  ------------------
  |  |  |  |  568|  1.04M|#  define L2HBITS(a)      (((a)<<BN_BITS4)&BN_MASK2)
  |  |  |  |  ------------------
  |  |  |  |  |  |   93|  1.04M|#  define BN_BITS4        32
  |  |  |  |  ------------------
  |  |  |  |               #  define L2HBITS(a)      (((a)<<BN_BITS4)&BN_MASK2)
  |  |  |  |  ------------------
  |  |  |  |  |  |   94|  1.04M|#  define BN_MASK2        (0xffffffffffffffffL)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  587|  1.04M|        lt=(lt+m1)&BN_MASK2; ht += (lt < m1); \
  |  |  ------------------
  |  |  |  |   94|  1.04M|#  define BN_MASK2        (0xffffffffffffffffL)
  |  |  ------------------
  |  |  588|  1.04M|        (l)=lt; \
  |  |  589|  1.04M|        (h)=ht; \
  |  |  590|  1.04M|        }
  ------------------
  404|  1.04M|            }
  405|  1.04M|#   endif
  406|       |
  407|  1.08M|            for (;;) {
  408|  1.08M|                if ((t2h < rem) || ((t2h == rem) && (t2l <= n2)))
  ------------------
  |  Branch (408:21): [True: 764k, False: 316k]
  |  Branch (408:37): [True: 109k, False: 207k]
  |  Branch (408:53): [True: 107k, False: 1.78k]
  ------------------
  409|   872k|                    break;
  410|   208k|                q--;
  411|   208k|                rem += d0;
  412|   208k|                if (rem < d0)
  ------------------
  |  Branch (412:21): [True: 168k, False: 40.8k]
  ------------------
  413|   168k|                    break;      /* don't let rem overflow */
  414|  40.8k|                if (t2l < d1)
  ------------------
  |  Branch (414:21): [True: 28.1k, False: 12.6k]
  ------------------
  415|  28.1k|                    t2h--;
  416|  40.8k|                t2l -= d1;
  417|  40.8k|            }
  418|  1.04M|#  endif                        /* !BN_LLONG */
  419|  1.04M|        }
  420|  1.07M|# endif                         /* !BN_DIV3W */
  421|       |
  422|  1.07M|        l0 = bn_mul_words(tmp->d, sdiv->d, div_n, q);
  423|  1.07M|        tmp->d[div_n] = l0;
  424|  1.07M|        wnum--;
  425|       |        /*
  426|       |         * ignore top values of the bignums just sub the two BN_ULONG arrays
  427|       |         * with bn_sub_words
  428|       |         */
  429|  1.07M|        l0 = bn_sub_words(wnum, wnum, tmp->d, div_n + 1);
  430|  1.07M|        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|  72.4M|        for (l0 = 0 - l0, j = 0; j < div_n; j++)
  ------------------
  |  Branch (436:34): [True: 71.3M, False: 1.07M]
  ------------------
  437|  71.3M|            tmp->d[j] = sdiv->d[j] & l0;
  438|  1.07M|        l0 = bn_add_words(wnum, wnum, tmp->d, div_n);
  439|  1.07M|        (*wnumtop) += l0;
  440|  1.07M|        assert((*wnumtop) == 0);
  441|       |
  442|       |        /* store part of the result */
  443|  1.07M|        *--resp = q;
  444|  1.07M|    }
  445|       |    /* snum holds remainder, it's as wide as divisor */
  446|   186k|    snum->neg = num_neg;
  447|   186k|    snum->top = div_n;
  448|   186k|    snum->flags |= BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|   186k|#  define BN_FLG_FIXED_TOP 0
  ------------------
  449|       |
  450|   186k|    if (rm != NULL && bn_rshift_fixed_top(rm, snum, norm_shift) == 0)
  ------------------
  |  Branch (450:9): [True: 184k, False: 2.88k]
  |  Branch (450:23): [True: 0, False: 184k]
  ------------------
  451|      0|        goto err;
  452|       |
  453|   186k|    BN_CTX_end(ctx);
  454|   186k|    return 1;
  455|      0| err:
  456|      0|    bn_check_top(rm);
  457|      0|    BN_CTX_end(ctx);
  458|      0|    return 0;
  459|   186k|}
bn_div.c:bn_left_align:
  142|   186k|{
  143|   186k|    BN_ULONG *d = num->d, n, m, rmask;
  ------------------
  |  |   37|   186k|#  define BN_ULONG        unsigned long
  ------------------
  144|   186k|    int top = num->top;
  145|   186k|    int rshift = BN_num_bits_word(d[top - 1]), lshift, i;
  146|       |
  147|   186k|    lshift = BN_BITS2 - rshift;
  ------------------
  |  |   54|   186k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   186k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  148|   186k|    rshift %= BN_BITS2;            /* say no to undefined behaviour */
  ------------------
  |  |   54|   186k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   186k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  149|   186k|    rmask = (BN_ULONG)0 - rshift;  /* rmask = 0 - (rshift != 0) */
  150|   186k|    rmask |= rmask >> 8;
  151|       |
  152|  1.62M|    for (i = 0, m = 0; i < top; i++) {
  ------------------
  |  Branch (152:24): [True: 1.43M, False: 186k]
  ------------------
  153|  1.43M|        n = d[i];
  154|  1.43M|        d[i] = ((n << lshift) | m) & BN_MASK2;
  ------------------
  |  |   94|  1.43M|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  155|  1.43M|        m = (n >> rshift) & rmask;
  156|  1.43M|    }
  157|       |
  158|   186k|    return lshift;
  159|   186k|}

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|  3.08k|{
  100|  3.08k|    int ret;
  101|       |
  102|  3.08k|    bn_check_top(a);
  103|  3.08k|    bn_check_top(p);
  104|  3.08k|    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|  3.08k|#define MONT_MUL_MOD
  138|  3.08k|#define MONT_EXP_WORD
  139|  3.08k|#define RECP_MUL_MOD
  140|       |
  141|  3.08k|#ifdef MONT_MUL_MOD
  142|  3.08k|    if (BN_is_odd(m)) {
  ------------------
  |  Branch (142:9): [True: 1.45k, False: 1.62k]
  ------------------
  143|  1.45k|# ifdef MONT_EXP_WORD
  144|  1.45k|        if (a->top == 1 && !a->neg
  ------------------
  |  Branch (144:13): [True: 630, False: 829]
  |  Branch (144:28): [True: 418, False: 212]
  ------------------
  145|  1.45k|            && (BN_get_flags(p, BN_FLG_CONSTTIME) == 0)
  ------------------
  |  |   67|    418|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (145:16): [True: 418, False: 0]
  ------------------
  146|  1.45k|            && (BN_get_flags(a, BN_FLG_CONSTTIME) == 0)
  ------------------
  |  |   67|    418|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (146:16): [True: 418, False: 0]
  ------------------
  147|  1.45k|            && (BN_get_flags(m, BN_FLG_CONSTTIME) == 0)) {
  ------------------
  |  |   67|    418|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (147:16): [True: 418, False: 0]
  ------------------
  148|    418|            BN_ULONG A = a->d[0];
  ------------------
  |  |   37|    418|#  define BN_ULONG        unsigned long
  ------------------
  149|    418|            ret = BN_mod_exp_mont_word(r, A, p, m, ctx, NULL);
  150|    418|        } else
  151|  1.04k|# endif
  152|  1.04k|            ret = BN_mod_exp_mont(r, a, p, m, ctx, NULL);
  153|  1.45k|    } else
  154|  1.62k|#endif
  155|  1.62k|#ifdef RECP_MUL_MOD
  156|  1.62k|    {
  157|  1.62k|        ret = BN_mod_exp_recp(r, a, p, m, ctx);
  158|  1.62k|    }
  159|       |#else
  160|       |    {
  161|       |        ret = BN_mod_exp_simple(r, a, p, m, ctx);
  162|       |    }
  163|       |#endif
  164|       |
  165|  3.08k|    bn_check_top(r);
  166|  3.08k|    return ret;
  167|  3.08k|}
BN_mod_exp_recp:
  171|  1.62k|{
  172|  1.62k|    int i, j, bits, ret = 0, wstart, wend, window;
  173|  1.62k|    int start = 1;
  174|  1.62k|    BIGNUM *aa;
  175|       |    /* Table of variables obtained from 'ctx' */
  176|  1.62k|    BIGNUM *val[TABLE_SIZE];
  177|  1.62k|    BN_RECP_CTX recp;
  178|       |
  179|  1.62k|    if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0
  ------------------
  |  |   67|  1.62k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (179:9): [True: 0, False: 1.62k]
  ------------------
  180|  1.62k|            || BN_get_flags(a, BN_FLG_CONSTTIME) != 0
  ------------------
  |  |   67|  1.62k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (180:16): [True: 0, False: 1.62k]
  ------------------
  181|  1.62k|            || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) {
  ------------------
  |  |   67|  1.62k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (181:16): [True: 0, False: 1.62k]
  ------------------
  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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  184|      0|        return 0;
  185|      0|    }
  186|       |
  187|  1.62k|    bits = BN_num_bits(p);
  188|  1.62k|    if (bits == 0) {
  ------------------
  |  Branch (188:9): [True: 53, False: 1.57k]
  ------------------
  189|       |        /* x**0 mod 1, or x**0 mod -1 is still zero. */
  190|     53|        if (BN_abs_is_word(m, 1)) {
  ------------------
  |  Branch (190:13): [True: 0, False: 53]
  ------------------
  191|      0|            ret = 1;
  192|      0|            BN_zero(r);
  ------------------
  |  |  202|      0|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  193|     53|        } else {
  194|     53|            ret = BN_one(r);
  ------------------
  |  |  197|     53|# define BN_one(a)       (BN_set_word((a),1))
  ------------------
  195|     53|        }
  196|     53|        return ret;
  197|     53|    }
  198|       |
  199|  1.57k|    BN_RECP_CTX_init(&recp);
  200|       |
  201|  1.57k|    BN_CTX_start(ctx);
  202|  1.57k|    aa = BN_CTX_get(ctx);
  203|  1.57k|    val[0] = BN_CTX_get(ctx);
  204|  1.57k|    if (val[0] == NULL)
  ------------------
  |  Branch (204:9): [True: 0, False: 1.57k]
  ------------------
  205|      0|        goto err;
  206|       |
  207|  1.57k|    if (m->neg) {
  ------------------
  |  Branch (207:9): [True: 585, False: 987]
  ------------------
  208|       |        /* ignore sign of 'm' */
  209|    585|        if (!BN_copy(aa, m))
  ------------------
  |  Branch (209:13): [True: 0, False: 585]
  ------------------
  210|      0|            goto err;
  211|    585|        aa->neg = 0;
  212|    585|        if (BN_RECP_CTX_set(&recp, aa, ctx) <= 0)
  ------------------
  |  Branch (212:13): [True: 0, False: 585]
  ------------------
  213|      0|            goto err;
  214|    987|    } else {
  215|    987|        if (BN_RECP_CTX_set(&recp, m, ctx) <= 0)
  ------------------
  |  Branch (215:13): [True: 0, False: 987]
  ------------------
  216|      0|            goto err;
  217|    987|    }
  218|       |
  219|  1.57k|    if (!BN_nnmod(val[0], a, m, ctx))
  ------------------
  |  Branch (219:9): [True: 0, False: 1.57k]
  ------------------
  220|      0|        goto err;               /* 1 */
  221|  1.57k|    if (BN_is_zero(val[0])) {
  ------------------
  |  Branch (221:9): [True: 38, False: 1.53k]
  ------------------
  222|     38|        BN_zero(r);
  ------------------
  |  |  202|     38|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  223|     38|        ret = 1;
  224|     38|        goto err;
  225|     38|    }
  226|       |
  227|  1.53k|    window = BN_window_bits_for_exponent_size(bits);
  ------------------
  |  |  322|  1.53k|                ((b) > 671 ? 6 : \
  |  |  ------------------
  |  |  |  Branch (322:18): [True: 20, False: 1.51k]
  |  |  ------------------
  |  |  323|  1.53k|                 (b) > 239 ? 5 : \
  |  |  ------------------
  |  |  |  Branch (323:18): [True: 20, False: 1.49k]
  |  |  ------------------
  |  |  324|  1.51k|                 (b) >  79 ? 4 : \
  |  |  ------------------
  |  |  |  Branch (324:18): [True: 62, False: 1.43k]
  |  |  ------------------
  |  |  325|  1.49k|                 (b) >  23 ? 3 : 1)
  |  |  ------------------
  |  |  |  Branch (325:18): [True: 174, False: 1.25k]
  |  |  ------------------
  ------------------
  228|  1.53k|    if (window > 1) {
  ------------------
  |  Branch (228:9): [True: 276, False: 1.25k]
  ------------------
  229|    276|        if (!BN_mod_mul_reciprocal(aa, val[0], val[0], &recp, ctx))
  ------------------
  |  Branch (229:13): [True: 0, False: 276]
  ------------------
  230|      0|            goto err;           /* 2 */
  231|    276|        j = 1 << (window - 1);
  232|  2.15k|        for (i = 1; i < j; i++) {
  ------------------
  |  Branch (232:21): [True: 1.87k, False: 276]
  ------------------
  233|  1.87k|            if (((val[i] = BN_CTX_get(ctx)) == NULL) ||
  ------------------
  |  Branch (233:17): [True: 0, False: 1.87k]
  ------------------
  234|  1.87k|                !BN_mod_mul_reciprocal(val[i], val[i - 1], aa, &recp, ctx))
  ------------------
  |  Branch (234:17): [True: 0, False: 1.87k]
  ------------------
  235|      0|                goto err;
  236|  1.87k|        }
  237|    276|    }
  238|       |
  239|  1.53k|    start = 1;                  /* This is used to avoid multiplication etc
  240|       |                                 * when there is only the value '1' in the
  241|       |                                 * buffer. */
  242|  1.53k|    wstart = bits - 1;          /* The top bit of the window */
  243|  1.53k|    wend = 0;                   /* The bottom bit of the window */
  244|       |
  245|  1.53k|    if (!BN_one(r))
  ------------------
  |  |  197|  1.53k|# define BN_one(a)       (BN_set_word((a),1))
  ------------------
  |  Branch (245:9): [True: 0, False: 1.53k]
  ------------------
  246|      0|        goto err;
  247|       |
  248|  53.4k|    for (;;) {
  249|  53.4k|        int wvalue;             /* The 'value' of the window */
  250|       |
  251|  53.4k|        if (BN_is_bit_set(p, wstart) == 0) {
  ------------------
  |  Branch (251:13): [True: 32.8k, False: 20.6k]
  ------------------
  252|  32.8k|            if (!start)
  ------------------
  |  Branch (252:17): [True: 32.8k, False: 0]
  ------------------
  253|  32.8k|                if (!BN_mod_mul_reciprocal(r, r, r, &recp, ctx))
  ------------------
  |  Branch (253:21): [True: 0, False: 32.8k]
  ------------------
  254|      0|                    goto err;
  255|  32.8k|            if (wstart == 0)
  ------------------
  |  Branch (255:17): [True: 458, False: 32.3k]
  ------------------
  256|    458|                break;
  257|  32.3k|            wstart--;
  258|  32.3k|            continue;
  259|  32.8k|        }
  260|       |        /*
  261|       |         * We now have wstart on a 'set' bit, we now need to work out how bit
  262|       |         * a window to do.  To do this we need to scan forward until the last
  263|       |         * set bit before the end of the window
  264|       |         */
  265|  20.6k|        wvalue = 1;
  266|  20.6k|        wend = 0;
  267|  70.7k|        for (i = 1; i < window; i++) {
  ------------------
  |  Branch (267:21): [True: 50.2k, False: 20.4k]
  ------------------
  268|  50.2k|            if (wstart - i < 0)
  ------------------
  |  Branch (268:17): [True: 138, False: 50.1k]
  ------------------
  269|    138|                break;
  270|  50.1k|            if (BN_is_bit_set(p, wstart - i)) {
  ------------------
  |  Branch (270:17): [True: 36.9k, False: 13.1k]
  ------------------
  271|  36.9k|                wvalue <<= (i - wend);
  272|  36.9k|                wvalue |= 1;
  273|  36.9k|                wend = i;
  274|  36.9k|            }
  275|  50.1k|        }
  276|       |
  277|       |        /* wend is the size of the current window */
  278|  20.6k|        j = wend + 1;
  279|       |        /* add the 'bytes above' */
  280|  20.6k|        if (!start)
  ------------------
  |  Branch (280:13): [True: 19.0k, False: 1.53k]
  ------------------
  281|  80.4k|            for (i = 0; i < j; i++) {
  ------------------
  |  Branch (281:25): [True: 61.4k, False: 19.0k]
  ------------------
  282|  61.4k|                if (!BN_mod_mul_reciprocal(r, r, r, &recp, ctx))
  ------------------
  |  Branch (282:21): [True: 0, False: 61.4k]
  ------------------
  283|      0|                    goto err;
  284|  61.4k|            }
  285|       |
  286|       |        /* wvalue will be an odd number < 2^window */
  287|  20.6k|        if (!BN_mod_mul_reciprocal(r, r, val[wvalue >> 1], &recp, ctx))
  ------------------
  |  Branch (287:13): [True: 0, False: 20.6k]
  ------------------
  288|      0|            goto err;
  289|       |
  290|       |        /* move the 'window' down further */
  291|  20.6k|        wstart -= wend + 1;
  292|  20.6k|        start = 0;
  293|  20.6k|        if (wstart < 0)
  ------------------
  |  Branch (293:13): [True: 1.07k, False: 19.5k]
  ------------------
  294|  1.07k|            break;
  295|  20.6k|    }
  296|  1.53k|    ret = 1;
  297|  1.57k| err:
  298|  1.57k|    BN_CTX_end(ctx);
  299|  1.57k|    BN_RECP_CTX_free(&recp);
  300|  1.57k|    bn_check_top(r);
  301|  1.57k|    return ret;
  302|  1.53k|}
BN_mod_exp_mont:
  306|  1.04k|{
  307|  1.04k|    int i, j, bits, ret = 0, wstart, wend, window;
  308|  1.04k|    int start = 1;
  309|  1.04k|    BIGNUM *d, *r;
  310|  1.04k|    const BIGNUM *aa;
  311|       |    /* Table of variables obtained from 'ctx' */
  312|  1.04k|    BIGNUM *val[TABLE_SIZE];
  313|  1.04k|    BN_MONT_CTX *mont = NULL;
  314|       |
  315|  1.04k|    bn_check_top(a);
  316|  1.04k|    bn_check_top(p);
  317|  1.04k|    bn_check_top(m);
  318|       |
  319|  1.04k|    if (!BN_is_odd(m)) {
  ------------------
  |  Branch (319:9): [True: 0, False: 1.04k]
  ------------------
  320|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  321|      0|        return 0;
  322|      0|    }
  323|       |
  324|  1.04k|    if (m->top <= BN_CONSTTIME_SIZE_LIMIT
  ------------------
  |  |   46|  2.08k|#define BN_CONSTTIME_SIZE_LIMIT (INT_MAX / BN_BYTES / 256)
  |  |  ------------------
  |  |  |  |   38|  1.04k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  |  Branch (324:9): [True: 1.04k, False: 0]
  ------------------
  325|  1.04k|        && (BN_get_flags(p, BN_FLG_CONSTTIME) != 0
  ------------------
  |  |   67|  1.04k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (325:13): [True: 0, False: 1.04k]
  ------------------
  326|  1.04k|            || BN_get_flags(a, BN_FLG_CONSTTIME) != 0
  ------------------
  |  |   67|  1.04k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (326:16): [True: 0, False: 1.04k]
  ------------------
  327|  1.04k|            || BN_get_flags(m, BN_FLG_CONSTTIME) != 0)) {
  ------------------
  |  |   67|  1.04k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (327:16): [True: 0, False: 1.04k]
  ------------------
  328|      0|        return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont);
  329|      0|    }
  330|       |
  331|  1.04k|    bits = BN_num_bits(p);
  332|  1.04k|    if (bits == 0) {
  ------------------
  |  Branch (332:9): [True: 85, False: 956]
  ------------------
  333|       |        /* x**0 mod 1, or x**0 mod -1 is still zero. */
  334|     85|        if (BN_abs_is_word(m, 1)) {
  ------------------
  |  Branch (334:13): [True: 1, False: 84]
  ------------------
  335|      1|            ret = 1;
  336|      1|            BN_zero(rr);
  ------------------
  |  |  202|      1|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  337|     84|        } else {
  338|     84|            ret = BN_one(rr);
  ------------------
  |  |  197|     84|# define BN_one(a)       (BN_set_word((a),1))
  ------------------
  339|     84|        }
  340|     85|        return ret;
  341|     85|    }
  342|       |
  343|    956|    BN_CTX_start(ctx);
  344|    956|    d = BN_CTX_get(ctx);
  345|    956|    r = BN_CTX_get(ctx);
  346|    956|    val[0] = BN_CTX_get(ctx);
  347|    956|    if (val[0] == NULL)
  ------------------
  |  Branch (347:9): [True: 0, False: 956]
  ------------------
  348|      0|        goto err;
  349|       |
  350|       |    /*
  351|       |     * If this is not done, things will break in the montgomery part
  352|       |     */
  353|       |
  354|    956|    if (in_mont != NULL)
  ------------------
  |  Branch (354:9): [True: 0, False: 956]
  ------------------
  355|      0|        mont = in_mont;
  356|    956|    else {
  357|    956|        if ((mont = BN_MONT_CTX_new()) == NULL)
  ------------------
  |  Branch (357:13): [True: 0, False: 956]
  ------------------
  358|      0|            goto err;
  359|    956|        if (!BN_MONT_CTX_set(mont, m, ctx))
  ------------------
  |  Branch (359:13): [True: 0, False: 956]
  ------------------
  360|      0|            goto err;
  361|    956|    }
  362|       |
  363|    956|    if (a->neg || BN_ucmp(a, m) >= 0) {
  ------------------
  |  Branch (363:9): [True: 214, False: 742]
  |  Branch (363:19): [True: 9, False: 733]
  ------------------
  364|    223|        if (!BN_nnmod(val[0], a, m, ctx))
  ------------------
  |  Branch (364:13): [True: 0, False: 223]
  ------------------
  365|      0|            goto err;
  366|    223|        aa = val[0];
  367|    223|    } else
  368|    733|        aa = a;
  369|    956|    if (!bn_to_mont_fixed_top(val[0], aa, mont, ctx))
  ------------------
  |  Branch (369:9): [True: 0, False: 956]
  ------------------
  370|      0|        goto err;               /* 1 */
  371|       |
  372|    956|    window = BN_window_bits_for_exponent_size(bits);
  ------------------
  |  |  322|    956|                ((b) > 671 ? 6 : \
  |  |  ------------------
  |  |  |  Branch (322:18): [True: 20, False: 936]
  |  |  ------------------
  |  |  323|    956|                 (b) > 239 ? 5 : \
  |  |  ------------------
  |  |  |  Branch (323:18): [True: 22, False: 914]
  |  |  ------------------
  |  |  324|    936|                 (b) >  79 ? 4 : \
  |  |  ------------------
  |  |  |  Branch (324:18): [True: 25, False: 889]
  |  |  ------------------
  |  |  325|    914|                 (b) >  23 ? 3 : 1)
  |  |  ------------------
  |  |  |  Branch (325:18): [True: 60, False: 829]
  |  |  ------------------
  ------------------
  373|    956|    if (window > 1) {
  ------------------
  |  Branch (373:9): [True: 127, False: 829]
  ------------------
  374|    127|        if (!bn_mul_mont_fixed_top(d, val[0], val[0], mont, ctx))
  ------------------
  |  Branch (374:13): [True: 0, False: 127]
  ------------------
  375|      0|            goto err;           /* 2 */
  376|    127|        j = 1 << (window - 1);
  377|  1.43k|        for (i = 1; i < j; i++) {
  ------------------
  |  Branch (377:21): [True: 1.30k, False: 127]
  ------------------
  378|  1.30k|            if (((val[i] = BN_CTX_get(ctx)) == NULL) ||
  ------------------
  |  Branch (378:17): [True: 0, False: 1.30k]
  ------------------
  379|  1.30k|                !bn_mul_mont_fixed_top(val[i], val[i - 1], d, mont, ctx))
  ------------------
  |  Branch (379:17): [True: 0, False: 1.30k]
  ------------------
  380|      0|                goto err;
  381|  1.30k|        }
  382|    127|    }
  383|       |
  384|    956|    start = 1;                  /* This is used to avoid multiplication etc
  385|       |                                 * when there is only the value '1' in the
  386|       |                                 * buffer. */
  387|    956|    wstart = bits - 1;          /* The top bit of the window */
  388|    956|    wend = 0;                   /* The bottom bit of the window */
  389|       |
  390|    956|#if 1                           /* by Shay Gueron's suggestion */
  391|    956|    j = m->top;                 /* borrow j */
  392|    956|    if (m->d[j - 1] & (((BN_ULONG)1) << (BN_BITS2 - 1))) {
  ------------------
  |  |   54|    956|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|    956|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  |  Branch (392:9): [True: 149, False: 807]
  ------------------
  393|    149|        if (bn_wexpand(r, j) == NULL)
  ------------------
  |  Branch (393:13): [True: 0, False: 149]
  ------------------
  394|      0|            goto err;
  395|       |        /* 2^(top*BN_BITS2) - m */
  396|    149|        r->d[0] = (0 - m->d[0]) & BN_MASK2;
  ------------------
  |  |   94|    149|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  397|    379|        for (i = 1; i < j; i++)
  ------------------
  |  Branch (397:21): [True: 230, False: 149]
  ------------------
  398|    230|            r->d[i] = (~m->d[i]) & BN_MASK2;
  ------------------
  |  |   94|    379|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  399|    149|        r->top = j;
  400|    149|        r->flags |= BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|    149|#  define BN_FLG_FIXED_TOP 0
  ------------------
  401|    149|    } else
  402|    807|#endif
  403|    807|    if (!bn_to_mont_fixed_top(r, BN_value_one(), mont, ctx))
  ------------------
  |  Branch (403:9): [True: 0, False: 807]
  ------------------
  404|      0|        goto err;
  405|  51.4k|    for (;;) {
  406|  51.4k|        int wvalue;             /* The 'value' of the window */
  407|       |
  408|  51.4k|        if (BN_is_bit_set(p, wstart) == 0) {
  ------------------
  |  Branch (408:13): [True: 35.2k, False: 16.1k]
  ------------------
  409|  35.2k|            if (!start) {
  ------------------
  |  Branch (409:17): [True: 35.2k, False: 0]
  ------------------
  410|  35.2k|                if (!bn_mul_mont_fixed_top(r, r, r, mont, ctx))
  ------------------
  |  Branch (410:21): [True: 0, False: 35.2k]
  ------------------
  411|      0|                    goto err;
  412|  35.2k|            }
  413|  35.2k|            if (wstart == 0)
  ------------------
  |  Branch (413:17): [True: 342, False: 34.8k]
  ------------------
  414|    342|                break;
  415|  34.8k|            wstart--;
  416|  34.8k|            continue;
  417|  35.2k|        }
  418|       |        /*
  419|       |         * We now have wstart on a 'set' bit, we now need to work out how bit
  420|       |         * a window to do.  To do this we need to scan forward until the last
  421|       |         * set bit before the end of the window
  422|       |         */
  423|  16.1k|        wvalue = 1;
  424|  16.1k|        wend = 0;
  425|  70.2k|        for (i = 1; i < window; i++) {
  ------------------
  |  Branch (425:21): [True: 54.1k, False: 16.1k]
  ------------------
  426|  54.1k|            if (wstart - i < 0)
  ------------------
  |  Branch (426:17): [True: 68, False: 54.0k]
  ------------------
  427|     68|                break;
  428|  54.0k|            if (BN_is_bit_set(p, wstart - i)) {
  ------------------
  |  Branch (428:17): [True: 40.2k, False: 13.7k]
  ------------------
  429|  40.2k|                wvalue <<= (i - wend);
  430|  40.2k|                wvalue |= 1;
  431|  40.2k|                wend = i;
  432|  40.2k|            }
  433|  54.0k|        }
  434|       |
  435|       |        /* wend is the size of the current window */
  436|  16.1k|        j = wend + 1;
  437|       |        /* add the 'bytes above' */
  438|  16.1k|        if (!start)
  ------------------
  |  Branch (438:13): [True: 15.2k, False: 956]
  ------------------
  439|  78.4k|            for (i = 0; i < j; i++) {
  ------------------
  |  Branch (439:25): [True: 63.2k, False: 15.2k]
  ------------------
  440|  63.2k|                if (!bn_mul_mont_fixed_top(r, r, r, mont, ctx))
  ------------------
  |  Branch (440:21): [True: 0, False: 63.2k]
  ------------------
  441|      0|                    goto err;
  442|  63.2k|            }
  443|       |
  444|       |        /* wvalue will be an odd number < 2^window */
  445|  16.1k|        if (!bn_mul_mont_fixed_top(r, r, val[wvalue >> 1], mont, ctx))
  ------------------
  |  Branch (445:13): [True: 0, False: 16.1k]
  ------------------
  446|      0|            goto err;
  447|       |
  448|       |        /* move the 'window' down further */
  449|  16.1k|        wstart -= wend + 1;
  450|  16.1k|        start = 0;
  451|  16.1k|        if (wstart < 0)
  ------------------
  |  Branch (451:13): [True: 614, False: 15.5k]
  ------------------
  452|    614|            break;
  453|  16.1k|    }
  454|       |    /*
  455|       |     * Done with zero-padded intermediate BIGNUMs. Final BN_from_montgomery
  456|       |     * removes padding [if any] and makes return value suitable for public
  457|       |     * API consumer.
  458|       |     */
  459|       |#if defined(SPARC_T4_MONT)
  460|       |    if (OPENSSL_sparcv9cap_P[0] & (SPARCV9_VIS3 | SPARCV9_PREFER_FPU)) {
  461|       |        j = mont->N.top;        /* borrow j */
  462|       |        val[0]->d[0] = 1;       /* borrow val[0] */
  463|       |        for (i = 1; i < j; i++)
  464|       |            val[0]->d[i] = 0;
  465|       |        val[0]->top = j;
  466|       |        if (!BN_mod_mul_montgomery(rr, r, val[0], mont, ctx))
  467|       |            goto err;
  468|       |    } else
  469|       |#endif
  470|    956|    if (!BN_from_montgomery(rr, r, mont, ctx))
  ------------------
  |  Branch (470:9): [True: 0, False: 956]
  ------------------
  471|      0|        goto err;
  472|    956|    ret = 1;
  473|    956| err:
  474|    956|    if (in_mont == NULL)
  ------------------
  |  Branch (474:9): [True: 956, False: 0]
  ------------------
  475|    956|        BN_MONT_CTX_free(mont);
  476|    956|    BN_CTX_end(ctx);
  477|    956|    bn_check_top(rr);
  478|    956|    return ret;
  479|    956|}
BN_mod_exp_mont_word:
 1157|    418|{
 1158|    418|    BN_MONT_CTX *mont = NULL;
 1159|    418|    int b, bits, ret = 0;
 1160|    418|    int r_is_one;
 1161|    418|    BN_ULONG w, next_w;
  ------------------
  |  |   37|    418|#  define BN_ULONG        unsigned long
  ------------------
 1162|    418|    BIGNUM *r, *t;
 1163|    418|    BIGNUM *swap_tmp;
 1164|    418|#define BN_MOD_MUL_WORD(r, w, m) \
 1165|    418|                (BN_mul_word(r, (w)) && \
 1166|    418|                (/* BN_ucmp(r, (m)) < 0 ? 1 :*/  \
 1167|    418|                        (BN_mod(t, r, m, ctx) && (swap_tmp = r, r = t, t = swap_tmp, 1))))
 1168|       |    /*
 1169|       |     * BN_MOD_MUL_WORD is only used with 'w' large, so the BN_ucmp test is
 1170|       |     * probably more overhead than always using BN_mod (which uses BN_copy if
 1171|       |     * a similar test returns true).
 1172|       |     */
 1173|       |    /*
 1174|       |     * We can use BN_mod and do not need BN_nnmod because our accumulator is
 1175|       |     * never negative (the result of BN_mod does not depend on the sign of
 1176|       |     * the modulus).
 1177|       |     */
 1178|    418|#define BN_TO_MONTGOMERY_WORD(r, w, mont) \
 1179|    418|                (BN_set_word(r, (w)) && BN_to_montgomery(r, r, (mont), ctx))
 1180|       |
 1181|    418|    if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0
  ------------------
  |  |   67|    418|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (1181:9): [True: 0, False: 418]
  ------------------
 1182|    418|            || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) {
  ------------------
  |  |   67|    418|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (1182:16): [True: 0, False: 418]
  ------------------
 1183|       |        /* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */
 1184|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1185|      0|        return 0;
 1186|      0|    }
 1187|       |
 1188|    418|    bn_check_top(p);
 1189|    418|    bn_check_top(m);
 1190|       |
 1191|    418|    if (!BN_is_odd(m)) {
  ------------------
  |  Branch (1191:9): [True: 0, False: 418]
  ------------------
 1192|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1193|      0|        return 0;
 1194|      0|    }
 1195|    418|    if (m->top == 1)
  ------------------
  |  Branch (1195:9): [True: 350, False: 68]
  ------------------
 1196|    350|        a %= m->d[0];           /* make sure that 'a' is reduced */
 1197|       |
 1198|    418|    bits = BN_num_bits(p);
 1199|    418|    if (bits == 0) {
  ------------------
  |  Branch (1199:9): [True: 7, False: 411]
  ------------------
 1200|       |        /* x**0 mod 1, or x**0 mod -1 is still zero. */
 1201|      7|        if (BN_abs_is_word(m, 1)) {
  ------------------
  |  Branch (1201:13): [True: 2, False: 5]
  ------------------
 1202|      2|            ret = 1;
 1203|      2|            BN_zero(rr);
  ------------------
  |  |  202|      2|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
 1204|      5|        } else {
 1205|      5|            ret = BN_one(rr);
  ------------------
  |  |  197|      5|# define BN_one(a)       (BN_set_word((a),1))
  ------------------
 1206|      5|        }
 1207|      7|        return ret;
 1208|      7|    }
 1209|    411|    if (a == 0) {
  ------------------
  |  Branch (1209:9): [True: 1, False: 410]
  ------------------
 1210|      1|        BN_zero(rr);
  ------------------
  |  |  202|      1|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
 1211|      1|        ret = 1;
 1212|      1|        return ret;
 1213|      1|    }
 1214|       |
 1215|    410|    BN_CTX_start(ctx);
 1216|    410|    r = BN_CTX_get(ctx);
 1217|    410|    t = BN_CTX_get(ctx);
 1218|    410|    if (t == NULL)
  ------------------
  |  Branch (1218:9): [True: 0, False: 410]
  ------------------
 1219|      0|        goto err;
 1220|       |
 1221|    410|    if (in_mont != NULL)
  ------------------
  |  Branch (1221:9): [True: 0, False: 410]
  ------------------
 1222|      0|        mont = in_mont;
 1223|    410|    else {
 1224|    410|        if ((mont = BN_MONT_CTX_new()) == NULL)
  ------------------
  |  Branch (1224:13): [True: 0, False: 410]
  ------------------
 1225|      0|            goto err;
 1226|    410|        if (!BN_MONT_CTX_set(mont, m, ctx))
  ------------------
  |  Branch (1226:13): [True: 0, False: 410]
  ------------------
 1227|      0|            goto err;
 1228|    410|    }
 1229|       |
 1230|    410|    r_is_one = 1;               /* except for Montgomery factor */
 1231|       |
 1232|       |    /* bits-1 >= 0 */
 1233|       |
 1234|       |    /* The result is accumulated in the product r*w. */
 1235|    410|    w = a;                      /* bit 'bits-1' of 'p' is always set */
 1236|  23.3k|    for (b = bits - 2; b >= 0; b--) {
  ------------------
  |  Branch (1236:24): [True: 22.9k, False: 410]
  ------------------
 1237|       |        /* First, square r*w. */
 1238|  22.9k|        next_w = w * w;
 1239|  22.9k|        if ((next_w / w) != w) { /* overflow */
  ------------------
  |  Branch (1239:13): [True: 3.86k, False: 19.0k]
  ------------------
 1240|  3.86k|            if (r_is_one) {
  ------------------
  |  Branch (1240:17): [True: 302, False: 3.56k]
  ------------------
 1241|    302|                if (!BN_TO_MONTGOMERY_WORD(r, w, mont))
  ------------------
  |  | 1179|    302|                (BN_set_word(r, (w)) && BN_to_montgomery(r, r, (mont), ctx))
  |  |  ------------------
  |  |  |  Branch (1179:18): [True: 302, False: 0]
  |  |  |  Branch (1179:41): [True: 302, False: 0]
  |  |  ------------------
  ------------------
 1242|      0|                    goto err;
 1243|    302|                r_is_one = 0;
 1244|  3.56k|            } else {
 1245|  3.56k|                if (!BN_MOD_MUL_WORD(r, w, m))
  ------------------
  |  | 1165|  3.56k|                (BN_mul_word(r, (w)) && \
  |  |  ------------------
  |  |  |  Branch (1165:18): [True: 3.56k, False: 0]
  |  |  ------------------
  |  | 1166|  3.56k|                (/* BN_ucmp(r, (m)) < 0 ? 1 :*/  \
  |  | 1167|  3.56k|                        (BN_mod(t, r, m, ctx) && (swap_tmp = r, r = t, t = swap_tmp, 1))))
  |  |  ------------------
  |  |  |  |  277|  7.12k|# define BN_mod(rem,m,d,ctx) BN_div(NULL,(rem),(m),(d),(ctx))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (277:30): [True: 3.56k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1167:50): [True: 3.56k, False: 0]
  |  |  ------------------
  ------------------
 1246|      0|                    goto err;
 1247|  3.56k|            }
 1248|  3.86k|            next_w = 1;
 1249|  3.86k|        }
 1250|  22.9k|        w = next_w;
 1251|  22.9k|        if (!r_is_one) {
  ------------------
  |  Branch (1251:13): [True: 20.7k, False: 2.18k]
  ------------------
 1252|  20.7k|            if (!BN_mod_mul_montgomery(r, r, r, mont, ctx))
  ------------------
  |  Branch (1252:17): [True: 0, False: 20.7k]
  ------------------
 1253|      0|                goto err;
 1254|  20.7k|        }
 1255|       |
 1256|       |        /* Second, multiply r*w by 'a' if exponent bit is set. */
 1257|  22.9k|        if (BN_is_bit_set(p, b)) {
  ------------------
  |  Branch (1257:13): [True: 14.2k, False: 8.74k]
  ------------------
 1258|  14.2k|            next_w = w * a;
 1259|  14.2k|            if ((next_w / a) != w) { /* overflow */
  ------------------
  |  Branch (1259:17): [True: 5.68k, False: 8.52k]
  ------------------
 1260|  5.68k|                if (r_is_one) {
  ------------------
  |  Branch (1260:21): [True: 83, False: 5.60k]
  ------------------
 1261|     83|                    if (!BN_TO_MONTGOMERY_WORD(r, w, mont))
  ------------------
  |  | 1179|     83|                (BN_set_word(r, (w)) && BN_to_montgomery(r, r, (mont), ctx))
  |  |  ------------------
  |  |  |  Branch (1179:18): [True: 83, False: 0]
  |  |  |  Branch (1179:41): [True: 83, False: 0]
  |  |  ------------------
  ------------------
 1262|      0|                        goto err;
 1263|     83|                    r_is_one = 0;
 1264|  5.60k|                } else {
 1265|  5.60k|                    if (!BN_MOD_MUL_WORD(r, w, m))
  ------------------
  |  | 1165|  5.60k|                (BN_mul_word(r, (w)) && \
  |  |  ------------------
  |  |  |  Branch (1165:18): [True: 5.60k, False: 0]
  |  |  ------------------
  |  | 1166|  5.60k|                (/* BN_ucmp(r, (m)) < 0 ? 1 :*/  \
  |  | 1167|  5.60k|                        (BN_mod(t, r, m, ctx) && (swap_tmp = r, r = t, t = swap_tmp, 1))))
  |  |  ------------------
  |  |  |  |  277|  11.2k|# define BN_mod(rem,m,d,ctx) BN_div(NULL,(rem),(m),(d),(ctx))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (277:30): [True: 5.60k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1167:50): [True: 5.60k, False: 0]
  |  |  ------------------
  ------------------
 1266|      0|                        goto err;
 1267|  5.60k|                }
 1268|  5.68k|                next_w = a;
 1269|  5.68k|            }
 1270|  14.2k|            w = next_w;
 1271|  14.2k|        }
 1272|  22.9k|    }
 1273|       |
 1274|       |    /* Finally, set r:=r*w. */
 1275|    410|    if (w != 1) {
  ------------------
  |  Branch (1275:9): [True: 371, False: 39]
  ------------------
 1276|    371|        if (r_is_one) {
  ------------------
  |  Branch (1276:13): [True: 16, False: 355]
  ------------------
 1277|     16|            if (!BN_TO_MONTGOMERY_WORD(r, w, mont))
  ------------------
  |  | 1179|     16|                (BN_set_word(r, (w)) && BN_to_montgomery(r, r, (mont), ctx))
  |  |  ------------------
  |  |  |  Branch (1179:18): [True: 16, False: 0]
  |  |  |  Branch (1179:41): [True: 16, False: 0]
  |  |  ------------------
  ------------------
 1278|      0|                goto err;
 1279|     16|            r_is_one = 0;
 1280|    355|        } else {
 1281|    355|            if (!BN_MOD_MUL_WORD(r, w, m))
  ------------------
  |  | 1165|    355|                (BN_mul_word(r, (w)) && \
  |  |  ------------------
  |  |  |  Branch (1165:18): [True: 355, False: 0]
  |  |  ------------------
  |  | 1166|    355|                (/* BN_ucmp(r, (m)) < 0 ? 1 :*/  \
  |  | 1167|    355|                        (BN_mod(t, r, m, ctx) && (swap_tmp = r, r = t, t = swap_tmp, 1))))
  |  |  ------------------
  |  |  |  |  277|    710|# define BN_mod(rem,m,d,ctx) BN_div(NULL,(rem),(m),(d),(ctx))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (277:30): [True: 355, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1167:50): [True: 355, False: 0]
  |  |  ------------------
  ------------------
 1282|      0|                goto err;
 1283|    355|        }
 1284|    371|    }
 1285|       |
 1286|    410|    if (r_is_one) {             /* can happen only if a == 1 */
  ------------------
  |  Branch (1286:9): [True: 9, False: 401]
  ------------------
 1287|      9|        if (!BN_one(rr))
  ------------------
  |  |  197|      9|# define BN_one(a)       (BN_set_word((a),1))
  ------------------
  |  Branch (1287:13): [True: 0, False: 9]
  ------------------
 1288|      0|            goto err;
 1289|    401|    } else {
 1290|    401|        if (!BN_from_montgomery(rr, r, mont, ctx))
  ------------------
  |  Branch (1290:13): [True: 0, False: 401]
  ------------------
 1291|      0|            goto err;
 1292|    401|    }
 1293|    410|    ret = 1;
 1294|    410| err:
 1295|    410|    if (in_mont == NULL)
  ------------------
  |  Branch (1295:9): [True: 410, False: 0]
  ------------------
 1296|    410|        BN_MONT_CTX_free(mont);
 1297|    410|    BN_CTX_end(ctx);
 1298|    410|    bn_check_top(rr);
 1299|    410|    return ret;
 1300|    410|}
BN_mod_exp_simple:
 1305|  3.08k|{
 1306|  3.08k|    int i, j, bits, ret = 0, wstart, wend, window;
 1307|  3.08k|    int start = 1;
 1308|  3.08k|    BIGNUM *d;
 1309|       |    /* Table of variables obtained from 'ctx' */
 1310|  3.08k|    BIGNUM *val[TABLE_SIZE];
 1311|       |
 1312|  3.08k|    if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0
  ------------------
  |  |   67|  3.08k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (1312:9): [True: 0, False: 3.08k]
  ------------------
 1313|  3.08k|            || BN_get_flags(a, BN_FLG_CONSTTIME) != 0
  ------------------
  |  |   67|  3.08k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (1313:16): [True: 0, False: 3.08k]
  ------------------
 1314|  3.08k|            || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) {
  ------------------
  |  |   67|  3.08k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (1314:16): [True: 0, False: 3.08k]
  ------------------
 1315|       |        /* BN_FLG_CONSTTIME only supported by BN_mod_exp_mont() */
 1316|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
 1317|      0|        return 0;
 1318|      0|    }
 1319|       |
 1320|  3.08k|    bits = BN_num_bits(p);
 1321|  3.08k|    if (bits == 0) {
  ------------------
  |  Branch (1321:9): [True: 145, False: 2.93k]
  ------------------
 1322|       |        /* x**0 mod 1, or x**0 mod -1 is still zero. */
 1323|    145|        if (BN_abs_is_word(m, 1)) {
  ------------------
  |  Branch (1323:13): [True: 3, False: 142]
  ------------------
 1324|      3|            ret = 1;
 1325|      3|            BN_zero(r);
  ------------------
  |  |  202|      3|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
 1326|    142|        } else {
 1327|    142|            ret = BN_one(r);
  ------------------
  |  |  197|    142|# define BN_one(a)       (BN_set_word((a),1))
  ------------------
 1328|    142|        }
 1329|    145|        return ret;
 1330|    145|    }
 1331|       |
 1332|  2.93k|    BN_CTX_start(ctx);
 1333|  2.93k|    d = BN_CTX_get(ctx);
 1334|  2.93k|    val[0] = BN_CTX_get(ctx);
 1335|  2.93k|    if (val[0] == NULL)
  ------------------
  |  Branch (1335:9): [True: 0, False: 2.93k]
  ------------------
 1336|      0|        goto err;
 1337|       |
 1338|  2.93k|    if (!BN_nnmod(val[0], a, m, ctx))
  ------------------
  |  Branch (1338:9): [True: 0, False: 2.93k]
  ------------------
 1339|      0|        goto err;               /* 1 */
 1340|  2.93k|    if (BN_is_zero(val[0])) {
  ------------------
  |  Branch (1340:9): [True: 773, False: 2.16k]
  ------------------
 1341|    773|        BN_zero(r);
  ------------------
  |  |  202|    773|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
 1342|    773|        ret = 1;
 1343|    773|        goto err;
 1344|    773|    }
 1345|       |
 1346|  2.16k|    window = BN_window_bits_for_exponent_size(bits);
  ------------------
  |  |  322|  2.16k|                ((b) > 671 ? 6 : \
  |  |  ------------------
  |  |  |  Branch (322:18): [True: 29, False: 2.13k]
  |  |  ------------------
  |  |  323|  2.16k|                 (b) > 239 ? 5 : \
  |  |  ------------------
  |  |  |  Branch (323:18): [True: 25, False: 2.11k]
  |  |  ------------------
  |  |  324|  2.13k|                 (b) >  79 ? 4 : \
  |  |  ------------------
  |  |  |  Branch (324:18): [True: 86, False: 2.02k]
  |  |  ------------------
  |  |  325|  2.11k|                 (b) >  23 ? 3 : 1)
  |  |  ------------------
  |  |  |  Branch (325:18): [True: 230, False: 1.79k]
  |  |  ------------------
  ------------------
 1347|  2.16k|    if (window > 1) {
  ------------------
  |  Branch (1347:9): [True: 370, False: 1.79k]
  ------------------
 1348|    370|        if (!BN_mod_mul(d, val[0], val[0], m, ctx))
  ------------------
  |  Branch (1348:13): [True: 0, False: 370]
  ------------------
 1349|      0|            goto err;           /* 2 */
 1350|    370|        j = 1 << (window - 1);
 1351|  2.93k|        for (i = 1; i < j; i++) {
  ------------------
  |  Branch (1351:21): [True: 2.56k, False: 370]
  ------------------
 1352|  2.56k|            if (((val[i] = BN_CTX_get(ctx)) == NULL) ||
  ------------------
  |  Branch (1352:17): [True: 0, False: 2.56k]
  ------------------
 1353|  2.56k|                !BN_mod_mul(val[i], val[i - 1], d, m, ctx))
  ------------------
  |  Branch (1353:17): [True: 0, False: 2.56k]
  ------------------
 1354|      0|                goto err;
 1355|  2.56k|        }
 1356|    370|    }
 1357|       |
 1358|  2.16k|    start = 1;                  /* This is used to avoid multiplication etc
 1359|       |                                 * when there is only the value '1' in the
 1360|       |                                 * buffer. */
 1361|  2.16k|    wstart = bits - 1;          /* The top bit of the window */
 1362|  2.16k|    wend = 0;                   /* The bottom bit of the window */
 1363|       |
 1364|  2.16k|    if (!BN_one(r))
  ------------------
  |  |  197|  2.16k|# define BN_one(a)       (BN_set_word((a),1))
  ------------------
  |  Branch (1364:9): [True: 0, False: 2.16k]
  ------------------
 1365|      0|        goto err;
 1366|       |
 1367|  75.3k|    for (;;) {
 1368|  75.3k|        int wvalue;             /* The 'value' of the window */
 1369|       |
 1370|  75.3k|        if (BN_is_bit_set(p, wstart) == 0) {
  ------------------
  |  Branch (1370:13): [True: 46.3k, False: 29.0k]
  ------------------
 1371|  46.3k|            if (!start)
  ------------------
  |  Branch (1371:17): [True: 46.3k, False: 0]
  ------------------
 1372|  46.3k|                if (!BN_mod_mul(r, r, r, m, ctx))
  ------------------
  |  Branch (1372:21): [True: 0, False: 46.3k]
  ------------------
 1373|      0|                    goto err;
 1374|  46.3k|            if (wstart == 0)
  ------------------
  |  Branch (1374:17): [True: 642, False: 45.6k]
  ------------------
 1375|    642|                break;
 1376|  45.6k|            wstart--;
 1377|  45.6k|            continue;
 1378|  46.3k|        }
 1379|       |        /*
 1380|       |         * We now have wstart on a 'set' bit, we now need to work out how bit
 1381|       |         * a window to do.  To do this we need to scan forward until the last
 1382|       |         * set bit before the end of the window
 1383|       |         */
 1384|  29.0k|        wvalue = 1;
 1385|  29.0k|        wend = 0;
 1386|   101k|        for (i = 1; i < window; i++) {
  ------------------
  |  Branch (1386:21): [True: 72.1k, False: 28.8k]
  ------------------
 1387|  72.1k|            if (wstart - i < 0)
  ------------------
  |  Branch (1387:17): [True: 193, False: 71.9k]
  ------------------
 1388|    193|                break;
 1389|  71.9k|            if (BN_is_bit_set(p, wstart - i)) {
  ------------------
  |  Branch (1389:17): [True: 53.5k, False: 18.4k]
  ------------------
 1390|  53.5k|                wvalue <<= (i - wend);
 1391|  53.5k|                wvalue |= 1;
 1392|  53.5k|                wend = i;
 1393|  53.5k|            }
 1394|  71.9k|        }
 1395|       |
 1396|       |        /* wend is the size of the current window */
 1397|  29.0k|        j = wend + 1;
 1398|       |        /* add the 'bytes above' */
 1399|  29.0k|        if (!start)
  ------------------
  |  Branch (1399:13): [True: 26.8k, False: 2.16k]
  ------------------
 1400|   115k|            for (i = 0; i < j; i++) {
  ------------------
  |  Branch (1400:25): [True: 88.2k, False: 26.8k]
  ------------------
 1401|  88.2k|                if (!BN_mod_mul(r, r, r, m, ctx))
  ------------------
  |  Branch (1401:21): [True: 0, False: 88.2k]
  ------------------
 1402|      0|                    goto err;
 1403|  88.2k|            }
 1404|       |
 1405|       |        /* wvalue will be an odd number < 2^window */
 1406|  29.0k|        if (!BN_mod_mul(r, r, val[wvalue >> 1], m, ctx))
  ------------------
  |  Branch (1406:13): [True: 0, False: 29.0k]
  ------------------
 1407|      0|            goto err;
 1408|       |
 1409|       |        /* move the 'window' down further */
 1410|  29.0k|        wstart -= wend + 1;
 1411|  29.0k|        start = 0;
 1412|  29.0k|        if (wstart < 0)
  ------------------
  |  Branch (1412:13): [True: 1.52k, False: 27.5k]
  ------------------
 1413|  1.52k|            break;
 1414|  29.0k|    }
 1415|  2.16k|    ret = 1;
 1416|  2.93k| err:
 1417|  2.93k|    BN_CTX_end(ctx);
 1418|  2.93k|    bn_check_top(r);
 1419|  2.93k|    return ret;
 1420|  2.16k|}

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

BN_value_one:
   83|    807|{
   84|    807|    static const BN_ULONG data_one = 1L;
   85|    807|    static const BIGNUM const_one =
   86|    807|        { (BN_ULONG *)&data_one, 1, 1, 0, BN_FLG_STATIC_DATA };
  ------------------
  |  |   59|    807|# define BN_FLG_STATIC_DATA      0x02
  ------------------
   87|       |
   88|    807|    return &const_one;
   89|    807|}
BN_num_bits_word:
  101|   363k|{
  102|   363k|    BN_ULONG x, mask;
  ------------------
  |  |   37|   363k|#  define BN_ULONG        unsigned long
  ------------------
  103|   363k|    int bits = (l != 0);
  104|       |
  105|   363k|#if BN_BITS2 > 32
  106|   363k|    x = l >> 32;
  107|   363k|    mask = (0 - x) & BN_MASK2;
  ------------------
  |  |   94|   363k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  108|   363k|    mask = (0 - (mask >> (BN_BITS2 - 1)));
  ------------------
  |  |   54|   363k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   363k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  109|   363k|    bits += 32 & mask;
  110|   363k|    l ^= (x ^ l) & mask;
  111|   363k|#endif
  112|       |
  113|   363k|    x = l >> 16;
  114|   363k|    mask = (0 - x) & BN_MASK2;
  ------------------
  |  |   94|   363k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  115|   363k|    mask = (0 - (mask >> (BN_BITS2 - 1)));
  ------------------
  |  |   54|   363k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   363k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  116|   363k|    bits += 16 & mask;
  117|   363k|    l ^= (x ^ l) & mask;
  118|       |
  119|   363k|    x = l >> 8;
  120|   363k|    mask = (0 - x) & BN_MASK2;
  ------------------
  |  |   94|   363k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  121|   363k|    mask = (0 - (mask >> (BN_BITS2 - 1)));
  ------------------
  |  |   54|   363k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   363k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  122|   363k|    bits += 8 & mask;
  123|   363k|    l ^= (x ^ l) & mask;
  124|       |
  125|   363k|    x = l >> 4;
  126|   363k|    mask = (0 - x) & BN_MASK2;
  ------------------
  |  |   94|   363k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  127|   363k|    mask = (0 - (mask >> (BN_BITS2 - 1)));
  ------------------
  |  |   54|   363k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   363k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  128|   363k|    bits += 4 & mask;
  129|   363k|    l ^= (x ^ l) & mask;
  130|       |
  131|   363k|    x = l >> 2;
  132|   363k|    mask = (0 - x) & BN_MASK2;
  ------------------
  |  |   94|   363k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  133|   363k|    mask = (0 - (mask >> (BN_BITS2 - 1)));
  ------------------
  |  |   54|   363k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   363k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  134|   363k|    bits += 2 & mask;
  135|   363k|    l ^= (x ^ l) & mask;
  136|       |
  137|   363k|    x = l >> 1;
  138|   363k|    mask = (0 - x) & BN_MASK2;
  ------------------
  |  |   94|   363k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  139|   363k|    mask = (0 - (mask >> (BN_BITS2 - 1)));
  ------------------
  |  |   54|   363k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   363k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  140|   363k|    bits += 1 & mask;
  141|       |
  142|   363k|    return bits;
  143|   363k|}
BN_num_bits:
  179|   109k|{
  180|   109k|    int i = a->top - 1;
  181|   109k|    bn_check_top(a);
  182|       |
  183|   109k|    if (a->flags & BN_FLG_CONSTTIME) {
  ------------------
  |  |   67|   109k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (183:9): [True: 0, False: 109k]
  ------------------
  184|       |        /*
  185|       |         * We assume that BIGNUMs flagged as CONSTTIME have also been expanded
  186|       |         * so that a->dmax is not leaking secret information.
  187|       |         *
  188|       |         * In other words, it's the caller's responsibility to ensure `a` has
  189|       |         * been preallocated in advance to a public length if we hit this
  190|       |         * branch.
  191|       |         *
  192|       |         */
  193|      0|        return bn_num_bits_consttime(a);
  194|      0|    }
  195|       |
  196|   109k|    if (BN_is_zero(a))
  ------------------
  |  Branch (196:9): [True: 290, False: 109k]
  ------------------
  197|    290|        return 0;
  198|       |
  199|   109k|    return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
  ------------------
  |  |   54|   109k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   109k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  200|   109k|}
BN_clear_free:
  214|  37.2k|{
  215|  37.2k|    if (a == NULL)
  ------------------
  |  Branch (215:9): [True: 0, False: 37.2k]
  ------------------
  216|      0|        return;
  217|  37.2k|    if (a->d != NULL && !BN_get_flags(a, BN_FLG_STATIC_DATA))
  ------------------
  |  |   59|  35.9k|# define BN_FLG_STATIC_DATA      0x02
  ------------------
  |  Branch (217:9): [True: 35.9k, False: 1.36k]
  |  Branch (217:25): [True: 35.9k, False: 0]
  ------------------
  218|  35.9k|        bn_free_d(a, 1);
  219|  37.2k|    if (BN_get_flags(a, BN_FLG_MALLOCED)) {
  ------------------
  |  |   58|  37.2k|# define BN_FLG_MALLOCED         0x01
  ------------------
  |  Branch (219:9): [True: 0, False: 37.2k]
  ------------------
  220|      0|        OPENSSL_cleanse(a, sizeof(*a));
  221|      0|        OPENSSL_free(a);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  222|      0|    }
  223|  37.2k|}
BN_free:
  226|  18.8k|{
  227|  18.8k|    if (a == NULL)
  ------------------
  |  Branch (227:9): [True: 0, False: 18.8k]
  ------------------
  228|      0|        return;
  229|  18.8k|    if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
  ------------------
  |  |   59|  18.8k|# define BN_FLG_STATIC_DATA      0x02
  ------------------
  |  Branch (229:9): [True: 18.8k, False: 0]
  ------------------
  230|  18.8k|        bn_free_d(a, 0);
  231|  18.8k|    if (a->flags & BN_FLG_MALLOCED)
  ------------------
  |  |   58|  18.8k|# define BN_FLG_MALLOCED         0x01
  ------------------
  |  Branch (231:9): [True: 15.7k, False: 3.14k]
  ------------------
  232|  15.7k|        OPENSSL_free(a);
  ------------------
  |  |  107|  15.7k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  15.7k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  15.7k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  233|  18.8k|}
bn_init:
  236|  57.9k|{
  237|  57.9k|    static BIGNUM nilbn;
  238|       |
  239|  57.9k|    *a = nilbn;
  240|  57.9k|    bn_check_top(a);
  241|  57.9k|}
BN_new:
  244|  15.7k|{
  245|  15.7k|    BIGNUM *ret;
  246|       |
  247|  15.7k|    if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
  ------------------
  |  |   99|  15.7k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  15.7k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  15.7k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (247:9): [True: 0, False: 15.7k]
  ------------------
  248|      0|        return NULL;
  249|  15.7k|    ret->flags = BN_FLG_MALLOCED;
  ------------------
  |  |   58|  15.7k|# define BN_FLG_MALLOCED         0x01
  ------------------
  250|  15.7k|    bn_check_top(ret);
  251|  15.7k|    return ret;
  252|  15.7k|}
bn_expand2:
  299|  79.3k|{
  300|  79.3k|    if (words > b->dmax) {
  ------------------
  |  Branch (300:9): [True: 79.3k, False: 0]
  ------------------
  301|  79.3k|        BN_ULONG *a = bn_expand_internal(b, words);
  ------------------
  |  |   37|  79.3k|#  define BN_ULONG        unsigned long
  ------------------
  302|  79.3k|        if (!a)
  ------------------
  |  Branch (302:13): [True: 0, False: 79.3k]
  ------------------
  303|      0|            return NULL;
  304|  79.3k|        if (b->d != NULL)
  ------------------
  |  Branch (304:13): [True: 26.7k, False: 52.6k]
  ------------------
  305|  26.7k|            bn_free_d(b, 1);
  306|  79.3k|        b->d = a;
  307|  79.3k|        b->dmax = words;
  308|  79.3k|    }
  309|       |
  310|  79.3k|    return b;
  311|  79.3k|}
BN_copy:
  333|   213k|{
  334|   213k|    int bn_words;
  335|       |
  336|   213k|    bn_check_top(b);
  337|       |
  338|   213k|    bn_words = BN_get_flags(b, BN_FLG_CONSTTIME) ? b->dmax : b->top;
  ------------------
  |  |   67|   213k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (338:16): [True: 0, False: 213k]
  ------------------
  339|       |
  340|   213k|    if (a == b)
  ------------------
  |  Branch (340:9): [True: 0, False: 213k]
  ------------------
  341|      0|        return a;
  342|   213k|    if (bn_wexpand(a, bn_words) == NULL)
  ------------------
  |  Branch (342:9): [True: 0, False: 213k]
  ------------------
  343|      0|        return NULL;
  344|       |
  345|   213k|    if (b->top > 0)
  ------------------
  |  Branch (345:9): [True: 210k, False: 2.63k]
  ------------------
  346|   210k|        memcpy(a->d, b->d, sizeof(b->d[0]) * bn_words);
  347|       |
  348|   213k|    a->neg = b->neg;
  349|   213k|    a->top = b->top;
  350|   213k|    a->flags |= b->flags & BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|   213k|#  define BN_FLG_FIXED_TOP 0
  ------------------
  351|   213k|    bn_check_top(a);
  352|   213k|    return a;
  353|   213k|}
BN_clear:
  395|  1.16k|{
  396|  1.16k|    if (a == NULL)
  ------------------
  |  Branch (396:9): [True: 0, False: 1.16k]
  ------------------
  397|      0|        return;
  398|  1.16k|    bn_check_top(a);
  399|  1.16k|    if (a->d != NULL)
  ------------------
  |  Branch (399:9): [True: 0, False: 1.16k]
  ------------------
  400|      0|        OPENSSL_cleanse(a->d, sizeof(*a->d) * a->dmax);
  401|  1.16k|    a->neg = 0;
  402|  1.16k|    a->top = 0;
  403|  1.16k|    a->flags &= ~BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|  1.16k|#  define BN_FLG_FIXED_TOP 0
  ------------------
  404|  1.16k|}
BN_set_word:
  417|  6.91k|{
  418|  6.91k|    bn_check_top(a);
  419|  6.91k|    if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
  ------------------
  |  Branch (419:9): [True: 0, False: 6.91k]
  ------------------
  420|      0|        return 0;
  421|  6.91k|    a->neg = 0;
  422|  6.91k|    a->d[0] = w;
  423|  6.91k|    a->top = (w ? 1 : 0);
  ------------------
  |  Branch (423:15): [True: 6.91k, False: 0]
  ------------------
  424|  6.91k|    a->flags &= ~BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|  6.91k|#  define BN_FLG_FIXED_TOP 0
  ------------------
  425|  6.91k|    bn_check_top(a);
  426|  6.91k|    return 1;
  427|  6.91k|}
BN_bin2bn:
  535|  9.43k|{
  536|  9.43k|    return bin2bn(s, len, ret, BIG, UNSIGNED);
  537|  9.43k|}
BN_ucmp:
  707|   340k|{
  708|   340k|    int i;
  709|   340k|    BN_ULONG t1, t2, *ap, *bp;
  ------------------
  |  |   37|   340k|#  define BN_ULONG        unsigned long
  ------------------
  710|       |
  711|   340k|    bn_check_top(a);
  712|   340k|    bn_check_top(b);
  713|       |
  714|   340k|    i = a->top - b->top;
  715|   340k|    if (i != 0)
  ------------------
  |  Branch (715:9): [True: 88.2k, False: 252k]
  ------------------
  716|  88.2k|        return i;
  717|   252k|    ap = a->d;
  718|   252k|    bp = b->d;
  719|   493k|    for (i = a->top - 1; i >= 0; i--) {
  ------------------
  |  Branch (719:26): [True: 491k, False: 1.38k]
  ------------------
  720|   491k|        t1 = ap[i];
  721|   491k|        t2 = bp[i];
  722|   491k|        if (t1 != t2)
  ------------------
  |  Branch (722:13): [True: 251k, False: 240k]
  ------------------
  723|   251k|            return ((t1 > t2) ? 1 : -1);
  ------------------
  |  Branch (723:21): [True: 109k, False: 141k]
  ------------------
  724|   491k|    }
  725|  1.38k|    return 0;
  726|   252k|}
BN_cmp:
  729|  3.08k|{
  730|  3.08k|    int i;
  731|  3.08k|    int gt, lt;
  732|  3.08k|    BN_ULONG t1, t2;
  ------------------
  |  |   37|  3.08k|#  define BN_ULONG        unsigned long
  ------------------
  733|       |
  734|  3.08k|    if ((a == NULL) || (b == NULL)) {
  ------------------
  |  Branch (734:9): [True: 0, False: 3.08k]
  |  Branch (734:24): [True: 0, False: 3.08k]
  ------------------
  735|      0|        if (a != NULL)
  ------------------
  |  Branch (735:13): [True: 0, False: 0]
  ------------------
  736|      0|            return -1;
  737|      0|        else if (b != NULL)
  ------------------
  |  Branch (737:18): [True: 0, False: 0]
  ------------------
  738|      0|            return 1;
  739|      0|        else
  740|      0|            return 0;
  741|      0|    }
  742|       |
  743|  3.08k|    bn_check_top(a);
  744|  3.08k|    bn_check_top(b);
  745|       |
  746|  3.08k|    if (a->neg != b->neg) {
  ------------------
  |  Branch (746:9): [True: 0, False: 3.08k]
  ------------------
  747|      0|        if (a->neg)
  ------------------
  |  Branch (747:13): [True: 0, False: 0]
  ------------------
  748|      0|            return -1;
  749|      0|        else
  750|      0|            return 1;
  751|      0|    }
  752|  3.08k|    if (a->neg == 0) {
  ------------------
  |  Branch (752:9): [True: 3.08k, False: 0]
  ------------------
  753|  3.08k|        gt = 1;
  754|  3.08k|        lt = -1;
  755|  3.08k|    } else {
  756|      0|        gt = -1;
  757|      0|        lt = 1;
  758|      0|    }
  759|       |
  760|  3.08k|    if (a->top > b->top)
  ------------------
  |  Branch (760:9): [True: 0, False: 3.08k]
  ------------------
  761|      0|        return gt;
  762|  3.08k|    if (a->top < b->top)
  ------------------
  |  Branch (762:9): [True: 0, False: 3.08k]
  ------------------
  763|      0|        return lt;
  764|  34.8k|    for (i = a->top - 1; i >= 0; i--) {
  ------------------
  |  Branch (764:26): [True: 31.7k, False: 3.08k]
  ------------------
  765|  31.7k|        t1 = a->d[i];
  766|  31.7k|        t2 = b->d[i];
  767|  31.7k|        if (t1 > t2)
  ------------------
  |  Branch (767:13): [True: 0, False: 31.7k]
  ------------------
  768|      0|            return gt;
  769|  31.7k|        if (t1 < t2)
  ------------------
  |  Branch (769:13): [True: 0, False: 31.7k]
  ------------------
  770|      0|            return lt;
  771|  31.7k|    }
  772|  3.08k|    return 0;
  773|  3.08k|}
BN_set_bit:
  776|  4.25k|{
  777|  4.25k|    int i, j, k;
  778|       |
  779|  4.25k|    if (n < 0)
  ------------------
  |  Branch (779:9): [True: 0, False: 4.25k]
  ------------------
  780|      0|        return 0;
  781|       |
  782|  4.25k|    i = n / BN_BITS2;
  ------------------
  |  |   54|  4.25k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  4.25k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  783|  4.25k|    j = n % BN_BITS2;
  ------------------
  |  |   54|  4.25k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  4.25k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  784|  4.25k|    if (a->top <= i) {
  ------------------
  |  Branch (784:9): [True: 4.25k, False: 0]
  ------------------
  785|  4.25k|        if (bn_wexpand(a, i + 1) == NULL)
  ------------------
  |  Branch (785:13): [True: 0, False: 4.25k]
  ------------------
  786|      0|            return 0;
  787|  84.6k|        for (k = a->top; k < i + 1; k++)
  ------------------
  |  Branch (787:26): [True: 80.3k, False: 4.25k]
  ------------------
  788|  80.3k|            a->d[k] = 0;
  789|  4.25k|        a->top = i + 1;
  790|  4.25k|        a->flags &= ~BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|  4.25k|#  define BN_FLG_FIXED_TOP 0
  ------------------
  791|  4.25k|    }
  792|       |
  793|  4.25k|    a->d[i] |= (((BN_ULONG)1) << j);
  794|  4.25k|    bn_check_top(a);
  795|  4.25k|    return 1;
  796|  4.25k|}
BN_is_bit_set:
  817|   544k|{
  818|   544k|    int i, j;
  819|       |
  820|   544k|    bn_check_top(a);
  821|   544k|    if (n < 0)
  ------------------
  |  Branch (821:9): [True: 0, False: 544k]
  ------------------
  822|      0|        return 0;
  823|   544k|    i = n / BN_BITS2;
  ------------------
  |  |   54|   544k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   544k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  824|   544k|    j = n % BN_BITS2;
  ------------------
  |  |   54|   544k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   544k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  825|   544k|    if (a->top <= i)
  ------------------
  |  Branch (825:9): [True: 0, False: 544k]
  ------------------
  826|      0|        return 0;
  827|   544k|    return (int)(((a->d[i]) >> j) & ((BN_ULONG)1));
  828|   544k|}
BN_set_negative:
  853|  6.29k|{
  854|  6.29k|    if (b && !BN_is_zero(a))
  ------------------
  |  Branch (854:9): [True: 3.37k, False: 2.91k]
  |  Branch (854:14): [True: 2.79k, False: 585]
  ------------------
  855|  2.79k|        a->neg = 1;
  856|  3.49k|    else
  857|  3.49k|        a->neg = 0;
  858|  6.29k|}
bn_cmp_words:
  861|   889k|{
  862|   889k|    int i;
  863|   889k|    BN_ULONG aa, bb;
  ------------------
  |  |   37|   889k|#  define BN_ULONG        unsigned long
  ------------------
  864|       |
  865|   889k|    if (n == 0)
  ------------------
  |  Branch (865:9): [True: 0, False: 889k]
  ------------------
  866|      0|        return 0;
  867|       |
  868|   889k|    aa = a[n - 1];
  869|   889k|    bb = b[n - 1];
  870|   889k|    if (aa != bb)
  ------------------
  |  Branch (870:9): [True: 795k, False: 93.2k]
  ------------------
  871|   795k|        return ((aa > bb) ? 1 : -1);
  ------------------
  |  Branch (871:17): [True: 395k, False: 400k]
  ------------------
  872|   553k|    for (i = n - 2; i >= 0; i--) {
  ------------------
  |  Branch (872:21): [True: 529k, False: 23.4k]
  ------------------
  873|   529k|        aa = a[i];
  874|   529k|        bb = b[i];
  875|   529k|        if (aa != bb)
  ------------------
  |  Branch (875:13): [True: 69.7k, False: 460k]
  ------------------
  876|  69.7k|            return ((aa > bb) ? 1 : -1);
  ------------------
  |  Branch (876:21): [True: 35.2k, False: 34.4k]
  ------------------
  877|   529k|    }
  878|  23.4k|    return 0;
  879|  93.2k|}
bn_cmp_part_words:
  891|   918k|{
  892|   918k|    int n, i;
  893|   918k|    n = cl - 1;
  894|       |
  895|   918k|    if (dl < 0) {
  ------------------
  |  Branch (895:9): [True: 36.3k, False: 882k]
  ------------------
  896|  95.2k|        for (i = dl; i < 0; i++) {
  ------------------
  |  Branch (896:22): [True: 90.5k, False: 4.66k]
  ------------------
  897|  90.5k|            if (b[n - i] != 0)
  ------------------
  |  Branch (897:17): [True: 31.6k, False: 58.8k]
  ------------------
  898|  31.6k|                return -1;      /* a < b */
  899|  90.5k|        }
  900|  36.3k|    }
  901|   887k|    if (dl > 0) {
  ------------------
  |  Branch (901:9): [True: 37.8k, False: 849k]
  ------------------
  902|   123k|        for (i = dl; i > 0; i--) {
  ------------------
  |  Branch (902:22): [True: 115k, False: 8.13k]
  ------------------
  903|   115k|            if (a[n + i] != 0)
  ------------------
  |  Branch (903:17): [True: 29.6k, False: 85.8k]
  ------------------
  904|  29.6k|                return 1;       /* a > b */
  905|   115k|        }
  906|  37.8k|    }
  907|   857k|    return bn_cmp_words(a, b, cl);
  908|   887k|}
BN_zero_ex:
  999|  1.91M|{
 1000|  1.91M|    a->neg = 0;
 1001|  1.91M|    a->top = 0;
 1002|  1.91M|    a->flags &= ~BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|  1.91M|#  define BN_FLG_FIXED_TOP 0
  ------------------
 1003|  1.91M|}
BN_abs_is_word:
 1006|  4.34k|{
 1007|  4.34k|    return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));
  ------------------
  |  Branch (1007:13): [True: 4.27k, False: 70]
  |  Branch (1007:30): [True: 1.37k, False: 2.90k]
  |  Branch (1007:50): [True: 0, False: 2.97k]
  |  Branch (1007:62): [True: 0, False: 0]
  ------------------
 1008|  4.34k|}
BN_is_zero:
 1011|   592k|{
 1012|   592k|    return a->top == 0;
 1013|   592k|}
BN_is_one:
 1016|  2.71k|{
 1017|  2.71k|    return BN_abs_is_word(a, 1) && !a->neg;
  ------------------
  |  Branch (1017:12): [True: 1.36k, False: 1.34k]
  |  Branch (1017:36): [True: 1.36k, False: 0]
  ------------------
 1018|  2.71k|}
BN_is_odd:
 1026|  66.2k|{
 1027|  66.2k|    return (a->top > 0) && (a->d[0] & 1);
  ------------------
  |  Branch (1027:12): [True: 66.2k, False: 0]
  |  Branch (1027:28): [True: 33.9k, False: 32.3k]
  ------------------
 1028|  66.2k|}
BN_to_montgomery:
 1037|    401|{
 1038|    401|    return BN_mod_mul_montgomery(r, a, &(mont->RR), mont, ctx);
 1039|    401|}
BN_get_flags:
 1075|   570k|{
 1076|   570k|    return b->flags & n;
 1077|   570k|}
bn_wexpand:
 1105|  2.40M|{
 1106|  2.40M|    return (words <= a->dmax) ? a : bn_expand2(a, words);
  ------------------
  |  Branch (1106:12): [True: 2.33M, False: 73.5k]
  ------------------
 1107|  2.40M|}
bn_correct_top:
 1132|   950k|{
 1133|   950k|    BN_ULONG *ftl;
  ------------------
  |  |   37|   950k|#  define BN_ULONG        unsigned long
  ------------------
 1134|   950k|    int tmp_top = a->top;
 1135|       |
 1136|   950k|    if (tmp_top > 0) {
  ------------------
  |  Branch (1136:9): [True: 935k, False: 15.4k]
  ------------------
 1137|  1.64M|        for (ftl = &(a->d[tmp_top]); tmp_top > 0; tmp_top--) {
  ------------------
  |  Branch (1137:38): [True: 1.62M, False: 18.8k]
  ------------------
 1138|  1.62M|            ftl--;
 1139|  1.62M|            if (*ftl != 0)
  ------------------
  |  Branch (1139:17): [True: 916k, False: 708k]
  ------------------
 1140|   916k|                break;
 1141|  1.62M|        }
 1142|   935k|        a->top = tmp_top;
 1143|   935k|    }
 1144|   950k|    if (a->top == 0)
  ------------------
  |  Branch (1144:9): [True: 34.3k, False: 916k]
  ------------------
 1145|  34.3k|        a->neg = 0;
 1146|   950k|    a->flags &= ~BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|   950k|#  define BN_FLG_FIXED_TOP 0
  ------------------
 1147|   950k|    bn_pollute(a);
 1148|   950k|}
bn_lib.c:bn_free_d:
  203|  81.5k|{
  204|  81.5k|    if (BN_get_flags(a, BN_FLG_SECURE))
  ------------------
  |  |   68|  81.5k|# define BN_FLG_SECURE           0x08
  ------------------
  |  Branch (204:9): [True: 0, False: 81.5k]
  ------------------
  205|      0|        OPENSSL_secure_clear_free(a->d, a->dmax * sizeof(a->d[0]));
  ------------------
  |  |  121|      0|        CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  206|  81.5k|    else if (clear != 0)
  ------------------
  |  Branch (206:14): [True: 62.6k, False: 18.8k]
  ------------------
  207|  62.6k|        OPENSSL_clear_free(a->d, a->dmax * sizeof(a->d[0]));
  ------------------
  |  |  105|  62.6k|        CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  62.6k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  62.6k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  208|  18.8k|    else
  209|  18.8k|        OPENSSL_free(a->d);
  ------------------
  |  |  107|  18.8k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  18.8k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  18.8k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  210|  81.5k|}
bn_lib.c:bn_expand_internal:
  265|  79.3k|{
  266|  79.3k|    BN_ULONG *a = NULL;
  ------------------
  |  |   37|  79.3k|#  define BN_ULONG        unsigned long
  ------------------
  267|       |
  268|  79.3k|    if (words > (INT_MAX / (4 * BN_BITS2))) {
  ------------------
  |  |   54|  79.3k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  79.3k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  |  Branch (268:9): [True: 0, False: 79.3k]
  ------------------
  269|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  270|      0|        return NULL;
  271|      0|    }
  272|  79.3k|    if (BN_get_flags(b, BN_FLG_STATIC_DATA)) {
  ------------------
  |  |   59|  79.3k|# define BN_FLG_STATIC_DATA      0x02
  ------------------
  |  Branch (272:9): [True: 0, False: 79.3k]
  ------------------
  273|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  274|      0|        return NULL;
  275|      0|    }
  276|  79.3k|    if (BN_get_flags(b, BN_FLG_SECURE))
  ------------------
  |  |   68|  79.3k|# define BN_FLG_SECURE           0x08
  ------------------
  |  Branch (276:9): [True: 0, False: 79.3k]
  ------------------
  277|      0|        a = OPENSSL_secure_zalloc(words * sizeof(*a));
  ------------------
  |  |  117|      0|        CRYPTO_secure_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_secure_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  278|  79.3k|    else
  279|  79.3k|        a = OPENSSL_zalloc(words * sizeof(*a));
  ------------------
  |  |   99|  79.3k|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  79.3k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  79.3k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  280|  79.3k|    if (a == NULL)
  ------------------
  |  Branch (280:9): [True: 0, False: 79.3k]
  ------------------
  281|      0|        return NULL;
  282|       |
  283|  79.3k|    assert(b->top <= words);
  284|  79.3k|    if (b->top > 0)
  ------------------
  |  Branch (284:9): [True: 9.96k, False: 69.3k]
  ------------------
  285|  9.96k|        memcpy(a, b->d, sizeof(*a) * b->top);
  286|       |
  287|  79.3k|    return a;
  288|  79.3k|}
bn_lib.c:bin2bn:
  434|  9.43k|{
  435|  9.43k|    int inc;
  436|  9.43k|    const unsigned char *s2;
  437|  9.43k|    int inc2;
  438|  9.43k|    int neg = 0, xor = 0, carry = 0;
  439|  9.43k|    unsigned int i;
  440|  9.43k|    unsigned int n;
  441|  9.43k|    BIGNUM *bn = NULL;
  442|       |
  443|       |    /* Negative length is not acceptable */
  444|  9.43k|    if (len < 0)
  ------------------
  |  Branch (444:9): [True: 0, False: 9.43k]
  ------------------
  445|      0|        return NULL;
  446|       |
  447|  9.43k|    if (ret == NULL)
  ------------------
  |  Branch (447:9): [True: 0, False: 9.43k]
  ------------------
  448|      0|        ret = bn = BN_new();
  449|  9.43k|    if (ret == NULL)
  ------------------
  |  Branch (449:9): [True: 0, False: 9.43k]
  ------------------
  450|      0|        return NULL;
  451|  9.43k|    bn_check_top(ret);
  452|       |
  453|       |    /*
  454|       |     * If the input has no bits, the number is considered zero.
  455|       |     * This makes calls with s==NULL and len==0 safe.
  456|       |     */
  457|  9.43k|    if (len == 0) {
  ------------------
  |  Branch (457:9): [True: 1.16k, False: 8.26k]
  ------------------
  458|  1.16k|        BN_clear(ret);
  459|  1.16k|        return ret;
  460|  1.16k|    }
  461|       |
  462|       |    /*
  463|       |     * The loop that does the work iterates from least to most
  464|       |     * significant BIGNUM chunk, so we adapt parameters to transfer
  465|       |     * input bytes accordingly.
  466|       |     */
  467|  8.26k|    if (endianness == LITTLE) {
  ------------------
  |  Branch (467:9): [True: 0, False: 8.26k]
  ------------------
  468|      0|        s2 = s + len - 1;
  469|      0|        inc2 = -1;
  470|      0|        inc = 1;
  471|  8.26k|    } else {
  472|  8.26k|        s2 = s;
  473|  8.26k|        inc2 = 1;
  474|  8.26k|        inc = -1;
  475|  8.26k|        s += len - 1;
  476|  8.26k|    }
  477|       |
  478|       |    /* Take note of the signedness of the input bytes*/
  479|  8.26k|    if (signedness == SIGNED) {
  ------------------
  |  Branch (479:9): [True: 0, False: 8.26k]
  ------------------
  480|      0|        neg = !!(*s2 & 0x80);
  481|      0|        xor = neg ? 0xff : 0x00;
  ------------------
  |  Branch (481:15): [True: 0, False: 0]
  ------------------
  482|      0|        carry = neg;
  483|      0|    }
  484|       |
  485|       |    /*
  486|       |     * Skip leading sign extensions (the value of |xor|).
  487|       |     * This is the only spot where |s2| and |inc2| are used.
  488|       |     */
  489|  8.58k|    for ( ; len > 0 && *s2 == xor; s2 += inc2, len--)
  ------------------
  |  Branch (489:13): [True: 8.56k, False: 17]
  |  Branch (489:24): [True: 315, False: 8.24k]
  ------------------
  490|    315|        continue;
  491|       |
  492|       |    /*
  493|       |     * If there was a set of 0xff, we backtrack one byte unless the next
  494|       |     * one has a sign bit, as the last 0xff is then part of the actual
  495|       |     * number, rather then a mere sign extension.
  496|       |     */
  497|  8.26k|    if (xor == 0xff) {
  ------------------
  |  Branch (497:9): [True: 0, False: 8.26k]
  ------------------
  498|      0|        if (len == 0 || !(*s2 & 0x80))
  ------------------
  |  Branch (498:13): [True: 0, False: 0]
  |  Branch (498:25): [True: 0, False: 0]
  ------------------
  499|      0|            len++;
  500|      0|    }
  501|       |    /* If it was all zeros, we're done */
  502|  8.26k|    if (len == 0) {
  ------------------
  |  Branch (502:9): [True: 17, False: 8.24k]
  ------------------
  503|     17|        ret->top = 0;
  504|     17|        return ret;
  505|     17|    }
  506|  8.24k|    n = ((len - 1) / BN_BYTES) + 1; /* Number of resulting bignum chunks */
  ------------------
  |  |   38|  8.24k|#  define BN_BYTES        8
  ------------------
  507|  8.24k|    if (bn_wexpand(ret, (int)n) == NULL) {
  ------------------
  |  Branch (507:9): [True: 0, False: 8.24k]
  ------------------
  508|      0|        BN_free(bn);
  509|      0|        return NULL;
  510|      0|    }
  511|  8.24k|    ret->top = n;
  512|  8.24k|    ret->neg = neg;
  513|  57.7k|    for (i = 0; n-- > 0; i++) {
  ------------------
  |  Branch (513:17): [True: 49.4k, False: 8.24k]
  ------------------
  514|  49.4k|        BN_ULONG l = 0;        /* Accumulator */
  ------------------
  |  |   37|  49.4k|#  define BN_ULONG        unsigned long
  ------------------
  515|  49.4k|        unsigned int m = 0;    /* Offset in a bignum chunk, in bits */
  516|       |
  517|   399k|        for (; len > 0 && m < BN_BYTES * 8; len--, s += inc, m += 8) {
  ------------------
  |  |   38|   391k|#  define BN_BYTES        8
  ------------------
  |  Branch (517:16): [True: 391k, False: 8.24k]
  |  Branch (517:27): [True: 350k, False: 41.2k]
  ------------------
  518|   350k|            BN_ULONG byte_xored = *s ^ xor;
  ------------------
  |  |   37|   350k|#  define BN_ULONG        unsigned long
  ------------------
  519|   350k|            BN_ULONG byte = (byte_xored + carry) & 0xff;
  ------------------
  |  |   37|   350k|#  define BN_ULONG        unsigned long
  ------------------
  520|       |
  521|   350k|            carry = byte_xored > byte; /* Implicit 1 or 0 */
  522|   350k|            l |= (byte << m);
  523|   350k|        }
  524|  49.4k|        ret->d[i] = l;
  525|  49.4k|    }
  526|       |    /*
  527|       |     * need to call this due to clear byte at top if avoiding having the top
  528|       |     * bit set (-ve number)
  529|       |     */
  530|  8.24k|    bn_correct_top(ret);
  531|  8.24k|    return ret;
  532|  8.24k|}

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

BN_nnmod:
   14|   173k|{
   15|       |    /*
   16|       |     * like BN_mod, but returns non-negative remainder (i.e., 0 <= r < |d|
   17|       |     * always holds)
   18|       |     */
   19|       |
   20|   173k|    if (!(BN_mod(r, m, d, ctx)))
  ------------------
  |  |  277|   173k|# define BN_mod(rem,m,d,ctx) BN_div(NULL,(rem),(m),(d),(ctx))
  ------------------
  |  Branch (20:9): [True: 0, False: 173k]
  ------------------
   21|      0|        return 0;
   22|   173k|    if (!r->neg)
  ------------------
  |  Branch (22:9): [True: 169k, False: 3.55k]
  ------------------
   23|   169k|        return 1;
   24|       |    /* now   -|d| < r < 0,  so we have to set  r := r + |d| */
   25|  3.55k|    return (d->neg ? BN_sub : BN_add) (r, r, d);
  ------------------
  |  Branch (25:13): [True: 1.10k, False: 2.45k]
  ------------------
   26|   173k|}
BN_mod_mul:
  197|   166k|{
  198|   166k|    BIGNUM *t;
  199|   166k|    int ret = 0;
  200|       |
  201|   166k|    bn_check_top(a);
  202|   166k|    bn_check_top(b);
  203|   166k|    bn_check_top(m);
  204|       |
  205|   166k|    BN_CTX_start(ctx);
  206|   166k|    if ((t = BN_CTX_get(ctx)) == NULL)
  ------------------
  |  Branch (206:9): [True: 0, False: 166k]
  ------------------
  207|      0|        goto err;
  208|   166k|    if (a == b) {
  ------------------
  |  Branch (208:9): [True: 134k, False: 31.6k]
  ------------------
  209|   134k|        if (!BN_sqr(t, a, ctx))
  ------------------
  |  Branch (209:13): [True: 0, False: 134k]
  ------------------
  210|      0|            goto err;
  211|   134k|    } else {
  212|  31.6k|        if (!BN_mul(t, a, b, ctx))
  ------------------
  |  Branch (212:13): [True: 0, False: 31.6k]
  ------------------
  213|      0|            goto err;
  214|  31.6k|    }
  215|   166k|    if (!BN_nnmod(r, t, m, ctx))
  ------------------
  |  Branch (215:9): [True: 0, False: 166k]
  ------------------
  216|      0|        goto err;
  217|   166k|    bn_check_top(r);
  218|   166k|    ret = 1;
  219|   166k| err:
  220|   166k|    BN_CTX_end(ctx);
  221|   166k|    return ret;
  222|   166k|}

BN_mod_mul_montgomery:
   28|  21.1k|{
   29|  21.1k|    int ret = bn_mul_mont_fixed_top(r, a, b, mont, ctx);
   30|       |
   31|  21.1k|    bn_correct_top(r);
   32|  21.1k|    bn_check_top(r);
   33|       |
   34|  21.1k|    return ret;
   35|  21.1k|}
bn_mul_mont_fixed_top:
   39|   139k|{
   40|   139k|    BIGNUM *tmp;
   41|   139k|    int ret = 0;
   42|   139k|    int num = mont->N.top;
   43|       |
   44|   139k|#if defined(OPENSSL_BN_ASM_MONT) && defined(MONT_WORD)
   45|   139k|    if (num > 1 && num <= BN_SOFT_LIMIT && a->top == num && b->top == num) {
  ------------------
  |  |   62|   161k|#  define BN_SOFT_LIMIT         (4096 / BN_BYTES)
  |  |  ------------------
  |  |  |  |   38|  22.8k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  |  Branch (45:9): [True: 22.8k, False: 116k]
  |  Branch (45:20): [True: 22.8k, False: 0]
  |  Branch (45:44): [True: 21.7k, False: 1.07k]
  |  Branch (45:61): [True: 21.7k, False: 0]
  ------------------
   46|  21.7k|        if (bn_wexpand(r, num) == NULL)
  ------------------
  |  Branch (46:13): [True: 0, False: 21.7k]
  ------------------
   47|      0|            return 0;
   48|  21.7k|        if (bn_mul_mont(r->d, a->d, b->d, mont->N.d, mont->n0, num)) {
  ------------------
  |  Branch (48:13): [True: 21.7k, False: 0]
  ------------------
   49|  21.7k|            r->neg = a->neg ^ b->neg;
   50|  21.7k|            r->top = num;
   51|  21.7k|            r->flags |= BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|  21.7k|#  define BN_FLG_FIXED_TOP 0
  ------------------
   52|  21.7k|            return 1;
   53|  21.7k|        }
   54|  21.7k|    }
   55|   117k|#endif
   56|       |
   57|   117k|    if ((a->top + b->top) > 2 * num)
  ------------------
  |  Branch (57:9): [True: 0, False: 117k]
  ------------------
   58|      0|        return 0;
   59|       |
   60|   117k|    BN_CTX_start(ctx);
   61|   117k|    tmp = BN_CTX_get(ctx);
   62|   117k|    if (tmp == NULL)
  ------------------
  |  Branch (62:9): [True: 0, False: 117k]
  ------------------
   63|      0|        goto err;
   64|       |
   65|   117k|    bn_check_top(tmp);
   66|   117k|    if (a == b) {
  ------------------
  |  Branch (66:9): [True: 101k, False: 15.3k]
  ------------------
   67|   101k|        if (!bn_sqr_fixed_top(tmp, a, ctx))
  ------------------
  |  Branch (67:13): [True: 0, False: 101k]
  ------------------
   68|      0|            goto err;
   69|   101k|    } else {
   70|  15.3k|        if (!bn_mul_fixed_top(tmp, a, b, ctx))
  ------------------
  |  Branch (70:13): [True: 0, False: 15.3k]
  ------------------
   71|      0|            goto err;
   72|  15.3k|    }
   73|       |    /* reduce from aRR to aR */
   74|   117k|#ifdef MONT_WORD
   75|   117k|    if (!bn_from_montgomery_word(r, tmp, mont))
  ------------------
  |  Branch (75:9): [True: 0, False: 117k]
  ------------------
   76|      0|        goto err;
   77|       |#else
   78|       |    if (!BN_from_montgomery(r, tmp, mont, ctx))
   79|       |        goto err;
   80|       |#endif
   81|   117k|    ret = 1;
   82|   117k| err:
   83|   117k|    BN_CTX_end(ctx);
   84|   117k|    return ret;
   85|   117k|}
BN_from_montgomery:
  164|  1.35k|{
  165|  1.35k|    int retn;
  166|       |
  167|  1.35k|    retn = bn_from_mont_fixed_top(ret, a, mont, ctx);
  168|  1.35k|    bn_correct_top(ret);
  169|  1.35k|    bn_check_top(ret);
  170|       |
  171|  1.35k|    return retn;
  172|  1.35k|}
bn_from_mont_fixed_top:
  176|  1.35k|{
  177|  1.35k|    int retn = 0;
  178|  1.35k|#ifdef MONT_WORD
  179|  1.35k|    BIGNUM *t;
  180|       |
  181|  1.35k|    BN_CTX_start(ctx);
  182|  1.35k|    if ((t = BN_CTX_get(ctx)) && BN_copy(t, a)) {
  ------------------
  |  Branch (182:9): [True: 1.35k, False: 0]
  |  Branch (182:34): [True: 1.35k, False: 0]
  ------------------
  183|  1.35k|        retn = bn_from_montgomery_word(ret, t, mont);
  184|  1.35k|    }
  185|  1.35k|    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.35k|    return retn;
  220|  1.35k|}
bn_to_mont_fixed_top:
  224|  1.76k|{
  225|  1.76k|    return bn_mul_mont_fixed_top(r, a, &(mont->RR), mont, ctx);
  226|  1.76k|}
BN_MONT_CTX_new:
  229|  1.36k|{
  230|  1.36k|    BN_MONT_CTX *ret;
  231|       |
  232|  1.36k|    if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL)
  ------------------
  |  |   97|  1.36k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  1.36k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  1.36k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (232:9): [True: 0, False: 1.36k]
  ------------------
  233|      0|        return NULL;
  234|       |
  235|  1.36k|    BN_MONT_CTX_init(ret);
  236|  1.36k|    ret->flags = BN_FLG_MALLOCED;
  ------------------
  |  |   58|  1.36k|# define BN_FLG_MALLOCED         0x01
  ------------------
  237|  1.36k|    return ret;
  238|  1.36k|}
BN_MONT_CTX_init:
  241|  1.36k|{
  242|  1.36k|    ctx->ri = 0;
  243|  1.36k|    bn_init(&ctx->RR);
  244|  1.36k|    bn_init(&ctx->N);
  245|  1.36k|    bn_init(&ctx->Ni);
  246|  1.36k|    ctx->n0[0] = ctx->n0[1] = 0;
  247|  1.36k|    ctx->flags = 0;
  248|  1.36k|}
BN_MONT_CTX_free:
  251|  1.36k|{
  252|  1.36k|    if (mont == NULL)
  ------------------
  |  Branch (252:9): [True: 0, False: 1.36k]
  ------------------
  253|      0|        return;
  254|  1.36k|    BN_clear_free(&mont->RR);
  255|  1.36k|    BN_clear_free(&mont->N);
  256|  1.36k|    BN_clear_free(&mont->Ni);
  257|  1.36k|    if (mont->flags & BN_FLG_MALLOCED)
  ------------------
  |  |   58|  1.36k|# define BN_FLG_MALLOCED         0x01
  ------------------
  |  Branch (257:9): [True: 1.36k, False: 0]
  ------------------
  258|  1.36k|        OPENSSL_free(mont);
  ------------------
  |  |  107|  1.36k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  1.36k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  1.36k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  259|  1.36k|}
BN_MONT_CTX_set:
  262|  1.36k|{
  263|  1.36k|    int i, ret = 0;
  264|  1.36k|    BIGNUM *Ri, *R;
  265|       |
  266|  1.36k|    if (BN_is_zero(mod))
  ------------------
  |  Branch (266:9): [True: 0, False: 1.36k]
  ------------------
  267|      0|        return 0;
  268|       |
  269|  1.36k|    BN_CTX_start(ctx);
  270|  1.36k|    if ((Ri = BN_CTX_get(ctx)) == NULL)
  ------------------
  |  Branch (270:9): [True: 0, False: 1.36k]
  ------------------
  271|      0|        goto err;
  272|  1.36k|    R = &(mont->RR);            /* grab RR as a temp */
  273|  1.36k|    if (!BN_copy(&(mont->N), mod))
  ------------------
  |  Branch (273:9): [True: 0, False: 1.36k]
  ------------------
  274|      0|        goto err;               /* Set N */
  275|  1.36k|    if (BN_get_flags(mod, BN_FLG_CONSTTIME) != 0)
  ------------------
  |  |   67|  1.36k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (275:9): [True: 0, False: 1.36k]
  ------------------
  276|      0|        BN_set_flags(&(mont->N), BN_FLG_CONSTTIME);
  ------------------
  |  |   67|      0|# define BN_FLG_CONSTTIME        0x04
  ------------------
  277|  1.36k|    mont->N.neg = 0;
  278|       |
  279|  1.36k|#ifdef MONT_WORD
  280|  1.36k|    {
  281|  1.36k|        BIGNUM tmod;
  282|  1.36k|        BN_ULONG buf[2];
  ------------------
  |  |   37|  1.36k|#  define BN_ULONG        unsigned long
  ------------------
  283|       |
  284|  1.36k|        bn_init(&tmod);
  285|  1.36k|        tmod.d = buf;
  286|  1.36k|        tmod.dmax = 2;
  287|  1.36k|        tmod.neg = 0;
  288|       |
  289|  1.36k|        if (BN_get_flags(mod, BN_FLG_CONSTTIME) != 0)
  ------------------
  |  |   67|  1.36k|# define BN_FLG_CONSTTIME        0x04
  ------------------
  |  Branch (289:13): [True: 0, False: 1.36k]
  ------------------
  290|      0|            BN_set_flags(&tmod, BN_FLG_CONSTTIME);
  ------------------
  |  |   67|      0|# define BN_FLG_CONSTTIME        0x04
  ------------------
  291|       |
  292|  1.36k|        mont->ri = (BN_num_bits(mod) + (BN_BITS2 - 1)) / BN_BITS2 * BN_BITS2;
  ------------------
  |  |   54|  1.36k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  1.36k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
                      mont->ri = (BN_num_bits(mod) + (BN_BITS2 - 1)) / BN_BITS2 * BN_BITS2;
  ------------------
  |  |   54|  1.36k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  1.36k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
                      mont->ri = (BN_num_bits(mod) + (BN_BITS2 - 1)) / BN_BITS2 * BN_BITS2;
  ------------------
  |  |   54|  1.36k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  1.36k|#  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.36k|        BN_zero(R);
  ------------------
  |  |  202|  1.36k|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  340|  1.36k|        if (!(BN_set_bit(R, BN_BITS2)))
  ------------------
  |  |   54|  1.36k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  1.36k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  |  Branch (340:13): [True: 0, False: 1.36k]
  ------------------
  341|      0|            goto err;           /* R */
  342|       |
  343|  1.36k|        buf[0] = mod->d[0];     /* tmod = N mod word size */
  344|  1.36k|        buf[1] = 0;
  345|  1.36k|        tmod.top = buf[0] != 0 ? 1 : 0;
  ------------------
  |  Branch (345:20): [True: 1.36k, False: 0]
  ------------------
  346|       |        /* Ri = R^-1 mod N */
  347|  1.36k|        if (BN_is_one(&tmod))
  ------------------
  |  Branch (347:13): [True: 22, False: 1.34k]
  ------------------
  348|     22|            BN_zero(Ri);
  ------------------
  |  |  202|     22|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  349|  1.34k|        else if ((BN_mod_inverse(Ri, R, &tmod, ctx)) == NULL)
  ------------------
  |  Branch (349:18): [True: 0, False: 1.34k]
  ------------------
  350|      0|            goto err;
  351|  1.36k|        if (!BN_lshift(Ri, Ri, BN_BITS2))
  ------------------
  |  |   54|  1.36k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  1.36k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  |  Branch (351:13): [True: 0, False: 1.36k]
  ------------------
  352|      0|            goto err;           /* R*Ri */
  353|  1.36k|        if (!BN_is_zero(Ri)) {
  ------------------
  |  Branch (353:13): [True: 1.34k, False: 22]
  ------------------
  354|  1.34k|            if (!BN_sub_word(Ri, 1))
  ------------------
  |  Branch (354:17): [True: 0, False: 1.34k]
  ------------------
  355|      0|                goto err;
  356|  1.34k|        } else {                /* if N mod word size == 1 */
  357|       |
  358|     22|            if (!BN_set_word(Ri, BN_MASK2))
  ------------------
  |  |   94|     22|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  |  Branch (358:17): [True: 0, False: 22]
  ------------------
  359|      0|                goto err;       /* Ri-- (mod word size) */
  360|     22|        }
  361|  1.36k|        if (!BN_div(Ri, NULL, Ri, &tmod, ctx))
  ------------------
  |  Branch (361:13): [True: 0, False: 1.36k]
  ------------------
  362|      0|            goto err;
  363|       |        /*
  364|       |         * Ni = (R*Ri-1)/N, keep only least significant word:
  365|       |         */
  366|  1.36k|        mont->n0[0] = (Ri->top > 0) ? Ri->d[0] : 0;
  ------------------
  |  Branch (366:23): [True: 1.36k, False: 0]
  ------------------
  367|  1.36k|        mont->n0[1] = 0;
  368|  1.36k|# endif
  369|  1.36k|    }
  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.36k|    BN_zero(&(mont->RR));
  ------------------
  |  |  202|  1.36k|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  393|  1.36k|    if (!BN_set_bit(&(mont->RR), mont->ri * 2))
  ------------------
  |  Branch (393:9): [True: 0, False: 1.36k]
  ------------------
  394|      0|        goto err;
  395|  1.36k|    if (!BN_mod(&(mont->RR), &(mont->RR), &(mont->N), ctx))
  ------------------
  |  |  277|  1.36k|# define BN_mod(rem,m,d,ctx) BN_div(NULL,(rem),(m),(d),(ctx))
  ------------------
  |  Branch (395:9): [True: 0, False: 1.36k]
  ------------------
  396|      0|        goto err;
  397|       |
  398|  1.47k|    for (i = mont->RR.top, ret = mont->N.top; i < ret; i++)
  ------------------
  |  Branch (398:47): [True: 111, False: 1.36k]
  ------------------
  399|    111|        mont->RR.d[i] = 0;
  400|  1.36k|    mont->RR.top = ret;
  401|  1.36k|    mont->RR.flags |= BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|  1.36k|#  define BN_FLG_FIXED_TOP 0
  ------------------
  402|       |
  403|  1.36k|    ret = 1;
  404|  1.36k| err:
  405|  1.36k|    BN_CTX_end(ctx);
  406|  1.36k|    return ret;
  407|  1.36k|}
bn_mont.c:bn_from_montgomery_word:
   89|   118k|{
   90|   118k|    BIGNUM *n;
   91|   118k|    BN_ULONG *ap, *np, *rp, n0, v, carry;
  ------------------
  |  |   37|   118k|#  define BN_ULONG        unsigned long
  ------------------
   92|   118k|    int nl, max, i;
   93|   118k|    unsigned int rtop;
   94|       |
   95|   118k|    n = &(mont->N);
   96|   118k|    nl = n->top;
   97|   118k|    if (nl == 0) {
  ------------------
  |  Branch (97:9): [True: 0, False: 118k]
  ------------------
   98|      0|        ret->top = 0;
   99|      0|        return 1;
  100|      0|    }
  101|       |
  102|   118k|    max = (2 * nl);             /* carry is stored separately */
  103|   118k|    if (bn_wexpand(r, max) == NULL)
  ------------------
  |  Branch (103:9): [True: 0, False: 118k]
  ------------------
  104|      0|        return 0;
  105|       |
  106|   118k|    r->neg ^= n->neg;
  107|   118k|    np = n->d;
  108|   118k|    rp = r->d;
  109|       |
  110|       |    /* clear the top words of T */
  111|   386k|    for (rtop = r->top, i = 0; i < max; i++) {
  ------------------
  |  Branch (111:32): [True: 268k, False: 118k]
  ------------------
  112|   268k|        v = (BN_ULONG)0 - ((i - rtop) >> (8 * sizeof(rtop) - 1));
  113|   268k|        rp[i] &= v;
  114|   268k|    }
  115|       |
  116|   118k|    r->top = max;
  117|   118k|    r->flags |= BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|   118k|#  define BN_FLG_FIXED_TOP 0
  ------------------
  118|   118k|    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|   252k|    for (carry = 0, i = 0; i < nl; i++, rp++) {
  ------------------
  |  Branch (125:28): [True: 134k, False: 118k]
  ------------------
  126|   134k|        v = bn_mul_add_words(rp, np, nl, (rp[0] * n0) & BN_MASK2);
  ------------------
  |  |   94|   134k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  127|   134k|        v = (v + carry + rp[nl]) & BN_MASK2;
  ------------------
  |  |   94|   134k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  128|   134k|        carry |= (v != rp[nl]);
  129|   134k|        carry &= (v <= rp[nl]);
  130|   134k|        rp[nl] = v;
  131|   134k|    }
  132|       |
  133|   118k|    if (bn_wexpand(ret, nl) == NULL)
  ------------------
  |  Branch (133:9): [True: 0, False: 118k]
  ------------------
  134|      0|        return 0;
  135|   118k|    ret->top = nl;
  136|   118k|    ret->flags |= BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|   118k|#  define BN_FLG_FIXED_TOP 0
  ------------------
  137|   118k|    ret->neg = r->neg;
  138|       |
  139|   118k|    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|   118k|    ap = &(r->d[nl]);
  146|       |
  147|   118k|    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|   252k|    for (i = 0; i < nl; i++) {
  ------------------
  |  Branch (153:17): [True: 134k, False: 118k]
  ------------------
  154|   134k|        rp[i] = (carry & ap[i]) | (~carry & rp[i]);
  155|   134k|        ap[i] = 0;
  156|   134k|    }
  157|       |
  158|   118k|    return 1;
  159|   118k|}

bn_sub_part_words:
   30|   881k|{
   31|   881k|    BN_ULONG c, t;
  ------------------
  |  |   37|   881k|#  define BN_ULONG        unsigned long
  ------------------
   32|       |
   33|   881k|    assert(cl >= 0);
   34|   881k|    c = bn_sub_words(r, a, b, cl);
   35|       |
   36|   881k|    if (dl == 0)
  ------------------
  |  Branch (36:9): [True: 807k, False: 73.9k]
  ------------------
   37|   807k|        return c;
   38|       |
   39|  73.9k|    r += cl;
   40|  73.9k|    a += cl;
   41|  73.9k|    b += cl;
   42|       |
   43|  73.9k|    if (dl < 0) {
  ------------------
  |  Branch (43:9): [True: 10.4k, False: 63.5k]
  ------------------
   44|  27.6k|        for (;;) {
   45|  27.6k|            t = b[0];
   46|  27.6k|            r[0] = (0 - t - c) & BN_MASK2;
  ------------------
  |  |   94|  27.6k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
   47|  27.6k|            if (t != 0)
  ------------------
  |  Branch (47:17): [True: 0, False: 27.6k]
  ------------------
   48|      0|                c = 1;
   49|  27.6k|            if (++dl >= 0)
  ------------------
  |  Branch (49:17): [True: 2.05k, False: 25.5k]
  ------------------
   50|  2.05k|                break;
   51|       |
   52|  25.5k|            t = b[1];
   53|  25.5k|            r[1] = (0 - t - c) & BN_MASK2;
  ------------------
  |  |   94|  25.5k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
   54|  25.5k|            if (t != 0)
  ------------------
  |  Branch (54:17): [True: 0, False: 25.5k]
  ------------------
   55|      0|                c = 1;
   56|  25.5k|            if (++dl >= 0)
  ------------------
  |  Branch (56:17): [True: 1.29k, False: 24.2k]
  ------------------
   57|  1.29k|                break;
   58|       |
   59|  24.2k|            t = b[2];
   60|  24.2k|            r[2] = (0 - t - c) & BN_MASK2;
  ------------------
  |  |   94|  24.2k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
   61|  24.2k|            if (t != 0)
  ------------------
  |  Branch (61:17): [True: 0, False: 24.2k]
  ------------------
   62|      0|                c = 1;
   63|  24.2k|            if (++dl >= 0)
  ------------------
  |  Branch (63:17): [True: 6.19k, False: 18.0k]
  ------------------
   64|  6.19k|                break;
   65|       |
   66|  18.0k|            t = b[3];
   67|  18.0k|            r[3] = (0 - t - c) & BN_MASK2;
  ------------------
  |  |   94|  18.0k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
   68|  18.0k|            if (t != 0)
  ------------------
  |  Branch (68:17): [True: 0, False: 18.0k]
  ------------------
   69|      0|                c = 1;
   70|  18.0k|            if (++dl >= 0)
  ------------------
  |  Branch (70:17): [True: 865, False: 17.2k]
  ------------------
   71|    865|                break;
   72|       |
   73|  17.2k|            b += 4;
   74|  17.2k|            r += 4;
   75|  17.2k|        }
   76|  63.5k|    } else {
   77|  63.5k|        int save_dl = dl;
   78|  79.2k|        while (c) {
  ------------------
  |  Branch (78:16): [True: 22.1k, False: 57.1k]
  ------------------
   79|  22.1k|            t = a[0];
   80|  22.1k|            r[0] = (t - c) & BN_MASK2;
  ------------------
  |  |   94|  22.1k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
   81|  22.1k|            if (t != 0)
  ------------------
  |  Branch (81:17): [True: 9.58k, False: 12.5k]
  ------------------
   82|  9.58k|                c = 0;
   83|  22.1k|            if (--dl <= 0)
  ------------------
  |  Branch (83:17): [True: 2.30k, False: 19.7k]
  ------------------
   84|  2.30k|                break;
   85|       |
   86|  19.7k|            t = a[1];
   87|  19.7k|            r[1] = (t - c) & BN_MASK2;
  ------------------
  |  |   94|  19.7k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
   88|  19.7k|            if (t != 0)
  ------------------
  |  Branch (88:17): [True: 8.05k, False: 11.7k]
  ------------------
   89|  8.05k|                c = 0;
   90|  19.7k|            if (--dl <= 0)
  ------------------
  |  Branch (90:17): [True: 713, False: 19.0k]
  ------------------
   91|    713|                break;
   92|       |
   93|  19.0k|            t = a[2];
   94|  19.0k|            r[2] = (t - c) & BN_MASK2;
  ------------------
  |  |   94|  19.0k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
   95|  19.0k|            if (t != 0)
  ------------------
  |  Branch (95:17): [True: 9.17k, False: 9.90k]
  ------------------
   96|  9.17k|                c = 0;
   97|  19.0k|            if (--dl <= 0)
  ------------------
  |  Branch (97:17): [True: 2.49k, False: 16.5k]
  ------------------
   98|  2.49k|                break;
   99|       |
  100|  16.5k|            t = a[3];
  101|  16.5k|            r[3] = (t - c) & BN_MASK2;
  ------------------
  |  |   94|  16.5k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  102|  16.5k|            if (t != 0)
  ------------------
  |  Branch (102:17): [True: 7.64k, False: 8.94k]
  ------------------
  103|  7.64k|                c = 0;
  104|  16.5k|            if (--dl <= 0)
  ------------------
  |  Branch (104:17): [True: 812, False: 15.7k]
  ------------------
  105|    812|                break;
  106|       |
  107|  15.7k|            save_dl = dl;
  108|  15.7k|            a += 4;
  109|  15.7k|            r += 4;
  110|  15.7k|        }
  111|  63.5k|        if (dl > 0) {
  ------------------
  |  Branch (111:13): [True: 57.1k, False: 6.32k]
  ------------------
  112|  57.1k|            if (save_dl > dl) {
  ------------------
  |  Branch (112:17): [True: 0, False: 57.1k]
  ------------------
  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|  57.1k|        }
  133|  63.5k|        if (dl > 0) {
  ------------------
  |  Branch (133:13): [True: 57.1k, False: 6.32k]
  ------------------
  134|   287k|            for (;;) {
  135|   287k|                r[0] = a[0];
  136|   287k|                if (--dl <= 0)
  ------------------
  |  Branch (136:21): [True: 14.1k, False: 273k]
  ------------------
  137|  14.1k|                    break;
  138|   273k|                r[1] = a[1];
  139|   273k|                if (--dl <= 0)
  ------------------
  |  Branch (139:21): [True: 7.08k, False: 266k]
  ------------------
  140|  7.08k|                    break;
  141|   266k|                r[2] = a[2];
  142|   266k|                if (--dl <= 0)
  ------------------
  |  Branch (142:21): [True: 25.0k, False: 241k]
  ------------------
  143|  25.0k|                    break;
  144|   241k|                r[3] = a[3];
  145|   241k|                if (--dl <= 0)
  ------------------
  |  Branch (145:21): [True: 10.9k, False: 230k]
  ------------------
  146|  10.9k|                    break;
  147|       |
  148|   230k|                a += 4;
  149|   230k|                r += 4;
  150|   230k|            }
  151|  57.1k|        }
  152|  63.5k|    }
  153|  73.9k|    return c;
  154|  73.9k|}
bn_mul_recursive:
  177|   429k|{
  178|   429k|    int n = n2 / 2, c1, c2;
  179|   429k|    int tna = n + dna, tnb = n + dnb;
  180|   429k|    unsigned int neg, zero;
  181|   429k|    BN_ULONG ln, lo, *p;
  ------------------
  |  |   37|   429k|#  define BN_ULONG        unsigned long
  ------------------
  182|       |
  183|   429k|# 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|   429k|    if (n2 == 8 && dna == 0 && dnb == 0) {
  ------------------
  |  Branch (194:9): [True: 6.01k, False: 423k]
  |  Branch (194:20): [True: 4.21k, False: 1.80k]
  |  Branch (194:32): [True: 3.42k, False: 785]
  ------------------
  195|  3.42k|        bn_mul_comba8(r, a, b);
  196|  3.42k|        return;
  197|  3.42k|    }
  198|   426k|# endif                         /* BN_MUL_COMBA */
  199|       |    /* Else do normal multiply */
  200|   426k|    if (n2 < BN_MUL_RECURSIVE_SIZE_NORMAL) {
  ------------------
  |  |  365|   426k|# define BN_MUL_RECURSIVE_SIZE_NORMAL            (16)/* 32 less than */
  ------------------
  |  Branch (200:9): [True: 2.58k, False: 423k]
  ------------------
  201|  2.58k|        bn_mul_normal(r, a, n2 + dna, b, n2 + dnb);
  202|  2.58k|        if ((dna + dnb) < 0)
  ------------------
  |  Branch (202:13): [True: 2.58k, False: 0]
  ------------------
  203|  2.58k|            memset(&r[2 * n2 + dna + dnb], 0,
  204|  2.58k|                   sizeof(BN_ULONG) * -(dna + dnb));
  205|  2.58k|        return;
  206|  2.58k|    }
  207|       |    /* r=(a[0]-a[1])*(b[1]-b[0]) */
  208|   423k|    c1 = bn_cmp_part_words(a, &(a[n]), tna, n - tna);
  209|   423k|    c2 = bn_cmp_part_words(&(b[n]), b, tnb, tnb - n);
  210|   423k|    zero = neg = 0;
  211|   423k|    switch (c1 * 3 + c2) {
  ------------------
  |  Branch (211:13): [True: 0, False: 423k]
  ------------------
  212|  93.5k|    case -4:
  ------------------
  |  Branch (212:5): [True: 93.5k, False: 330k]
  ------------------
  213|  93.5k|        bn_sub_part_words(t, &(a[n]), a, tna, tna - n); /* - */
  214|  93.5k|        bn_sub_part_words(&(t[n]), b, &(b[n]), tnb, n - tnb); /* - */
  215|  93.5k|        break;
  216|  3.81k|    case -3:
  ------------------
  |  Branch (216:5): [True: 3.81k, False: 420k]
  ------------------
  217|  3.81k|        zero = 1;
  218|  3.81k|        break;
  219|  82.3k|    case -2:
  ------------------
  |  Branch (219:5): [True: 82.3k, False: 341k]
  ------------------
  220|  82.3k|        bn_sub_part_words(t, &(a[n]), a, tna, tna - n); /* - */
  221|  82.3k|        bn_sub_part_words(&(t[n]), &(b[n]), b, tnb, tnb - n); /* + */
  222|  82.3k|        neg = 1;
  223|  82.3k|        break;
  224|  3.96k|    case -1:
  ------------------
  |  Branch (224:5): [True: 3.96k, False: 419k]
  ------------------
  225|  6.12k|    case 0:
  ------------------
  |  Branch (225:5): [True: 2.15k, False: 421k]
  ------------------
  226|  10.7k|    case 1:
  ------------------
  |  Branch (226:5): [True: 4.67k, False: 419k]
  ------------------
  227|  10.7k|        zero = 1;
  228|  10.7k|        break;
  229|   138k|    case 2:
  ------------------
  |  Branch (229:5): [True: 138k, False: 285k]
  ------------------
  230|   138k|        bn_sub_part_words(t, a, &(a[n]), tna, n - tna); /* + */
  231|   138k|        bn_sub_part_words(&(t[n]), b, &(b[n]), tnb, n - tnb); /* - */
  232|   138k|        neg = 1;
  233|   138k|        break;
  234|  4.24k|    case 3:
  ------------------
  |  Branch (234:5): [True: 4.24k, False: 419k]
  ------------------
  235|  4.24k|        zero = 1;
  236|  4.24k|        break;
  237|  90.4k|    case 4:
  ------------------
  |  Branch (237:5): [True: 90.4k, False: 333k]
  ------------------
  238|  90.4k|        bn_sub_part_words(t, a, &(a[n]), tna, n - tna);
  239|  90.4k|        bn_sub_part_words(&(t[n]), &(b[n]), b, tnb, tnb - n);
  240|  90.4k|        break;
  241|   423k|    }
  242|       |
  243|   423k|# ifdef BN_MUL_COMBA
  244|   423k|    if (n == 4 && dna == 0 && dnb == 0) { /* XXX: bn_mul_comba4 could take
  ------------------
  |  Branch (244:9): [True: 0, False: 423k]
  |  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|   423k|    } else if (n == 8 && dna == 0 && dnb == 0) { /* XXX: bn_mul_comba8 could
  ------------------
  |  Branch (253:16): [True: 305k, False: 117k]
  |  Branch (253:26): [True: 304k, False: 1.22k]
  |  Branch (253:38): [True: 304k, False: 449]
  ------------------
  254|       |                                                  * take extra args to do
  255|       |                                                  * this well */
  256|   304k|        if (!zero)
  ------------------
  |  Branch (256:13): [True: 288k, False: 15.4k]
  ------------------
  257|   288k|            bn_mul_comba8(&(t[n2]), t, &(t[n]));
  258|  15.4k|        else
  259|  15.4k|            memset(&t[n2], 0, sizeof(*t) * 16);
  260|       |
  261|   304k|        bn_mul_comba8(r, a, b);
  262|   304k|        bn_mul_comba8(&(r[n2]), &(a[n]), &(b[n]));
  263|   304k|    } else
  264|   119k|# endif                         /* BN_MUL_COMBA */
  265|   119k|    {
  266|   119k|        p = &(t[n2 * 2]);
  267|   119k|        if (!zero)
  ------------------
  |  Branch (267:13): [True: 116k, False: 3.43k]
  ------------------
  268|   116k|            bn_mul_recursive(&(t[n2]), t, &(t[n]), n, 0, 0, p);
  269|  3.43k|        else
  270|  3.43k|            memset(&t[n2], 0, sizeof(*t) * n2);
  271|   119k|        bn_mul_recursive(r, a, b, n, 0, 0, p);
  272|   119k|        bn_mul_recursive(&(r[n2]), &(a[n]), &(b[n]), n, dna, dnb, p);
  273|   119k|    }
  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|   423k|    c1 = (int)(bn_add_words(t, r, &(r[n2]), n2));
  282|       |
  283|   423k|    if (neg) {                  /* if t[32] is negative */
  ------------------
  |  Branch (283:9): [True: 220k, False: 202k]
  ------------------
  284|   220k|        c1 -= (int)(bn_sub_words(&(t[n2]), t, &(t[n2]), n2));
  285|   220k|    } else {
  286|       |        /* Might have a carry */
  287|   202k|        c1 += (int)(bn_add_words(&(t[n2]), &(t[n2]), t, n2));
  288|   202k|    }
  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|   423k|    c1 += (int)(bn_add_words(&(r[n]), &(r[n]), &(t[n2]), n2));
  297|   423k|    if (c1) {
  ------------------
  |  Branch (297:9): [True: 158k, False: 265k]
  ------------------
  298|   158k|        p = &(r[n + n2]);
  299|   158k|        lo = *p;
  300|   158k|        ln = (lo + c1) & BN_MASK2;
  ------------------
  |  |   94|   158k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  301|   158k|        *p = ln;
  302|       |
  303|       |        /*
  304|       |         * The overflow will stop before we over write words we should not
  305|       |         * overwrite
  306|       |         */
  307|   158k|        if (ln < (BN_ULONG)c1) {
  ------------------
  |  Branch (307:13): [True: 1.49k, False: 156k]
  ------------------
  308|  3.69k|            do {
  309|  3.69k|                p++;
  310|  3.69k|                lo = *p;
  311|  3.69k|                ln = (lo + 1) & BN_MASK2;
  ------------------
  |  |   94|  3.69k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  312|  3.69k|                *p = ln;
  313|  3.69k|            } while (ln == 0);
  ------------------
  |  Branch (313:22): [True: 2.20k, False: 1.49k]
  ------------------
  314|  1.49k|        }
  315|   158k|    }
  316|   423k|}
bn_mul_part_recursive:
  324|  35.5k|{
  325|  35.5k|    int i, j, n2 = n * 2;
  326|  35.5k|    int c1, c2, neg;
  327|  35.5k|    BN_ULONG ln, lo, *p;
  ------------------
  |  |   37|  35.5k|#  define BN_ULONG        unsigned long
  ------------------
  328|       |
  329|  35.5k|    if (n < 8) {
  ------------------
  |  Branch (329:9): [True: 0, False: 35.5k]
  ------------------
  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|  35.5k|    c1 = bn_cmp_part_words(a, &(a[n]), tna, n - tna);
  336|  35.5k|    c2 = bn_cmp_part_words(&(b[n]), b, tnb, tnb - n);
  337|  35.5k|    neg = 0;
  338|  35.5k|    switch (c1 * 3 + c2) {
  ------------------
  |  Branch (338:13): [True: 0, False: 35.5k]
  ------------------
  339|  4.92k|    case -4:
  ------------------
  |  Branch (339:5): [True: 4.92k, False: 30.6k]
  ------------------
  340|  4.92k|        bn_sub_part_words(t, &(a[n]), a, tna, tna - n); /* - */
  341|  4.92k|        bn_sub_part_words(&(t[n]), b, &(b[n]), tnb, n - tnb); /* - */
  342|  4.92k|        break;
  343|    219|    case -3:
  ------------------
  |  Branch (343:5): [True: 219, False: 35.3k]
  ------------------
  344|  1.57k|    case -2:
  ------------------
  |  Branch (344:5): [True: 1.35k, False: 34.1k]
  ------------------
  345|  1.57k|        bn_sub_part_words(t, &(a[n]), a, tna, tna - n); /* - */
  346|  1.57k|        bn_sub_part_words(&(t[n]), &(b[n]), b, tnb, tnb - n); /* + */
  347|  1.57k|        neg = 1;
  348|  1.57k|        break;
  349|    480|    case -1:
  ------------------
  |  Branch (349:5): [True: 480, False: 35.0k]
  ------------------
  350|    688|    case 0:
  ------------------
  |  Branch (350:5): [True: 208, False: 35.3k]
  ------------------
  351|    925|    case 1:
  ------------------
  |  Branch (351:5): [True: 237, False: 35.2k]
  ------------------
  352|  26.7k|    case 2:
  ------------------
  |  Branch (352:5): [True: 25.8k, False: 9.70k]
  ------------------
  353|  26.7k|        bn_sub_part_words(t, a, &(a[n]), tna, n - tna); /* + */
  354|  26.7k|        bn_sub_part_words(&(t[n]), b, &(b[n]), tnb, n - tnb); /* - */
  355|  26.7k|        neg = 1;
  356|  26.7k|        break;
  357|    592|    case 3:
  ------------------
  |  Branch (357:5): [True: 592, False: 34.9k]
  ------------------
  358|  2.28k|    case 4:
  ------------------
  |  Branch (358:5): [True: 1.68k, False: 33.8k]
  ------------------
  359|  2.28k|        bn_sub_part_words(t, a, &(a[n]), tna, n - tna);
  360|  2.28k|        bn_sub_part_words(&(t[n]), &(b[n]), b, tnb, tnb - n);
  361|  2.28k|        break;
  362|  35.5k|    }
  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|  35.5k|    if (n == 8) {
  ------------------
  |  Branch (375:9): [True: 6.25k, False: 29.2k]
  ------------------
  376|  6.25k|        bn_mul_comba8(&(t[n2]), t, &(t[n]));
  377|  6.25k|        bn_mul_comba8(r, a, b);
  378|  6.25k|        bn_mul_normal(&(r[n2]), &(a[n]), tna, &(b[n]), tnb);
  379|  6.25k|        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.85k, False: 27.4k]
  ------------------
  389|  1.85k|            j = tna - i;
  390|  27.4k|        else
  391|  27.4k|            j = tnb - i;
  392|  29.2k|        if (j == 0) {
  ------------------
  |  Branch (392:13): [True: 1.59k, False: 27.6k]
  ------------------
  393|  1.59k|            bn_mul_recursive(&(r[n2]), &(a[n]), &(b[n]),
  394|  1.59k|                             i, tna - i, tnb - i, p);
  395|  1.59k|            memset(&r[n2 + i * 2], 0, sizeof(*r) * (n2 - i * 2));
  396|  27.6k|        } else if (j > 0) {     /* eg, n == 16, i == 8 and tn == 11 */
  ------------------
  |  Branch (396:20): [True: 10.1k, False: 17.4k]
  ------------------
  397|  10.1k|            bn_mul_part_recursive(&(r[n2]), &(a[n]), &(b[n]),
  398|  10.1k|                                  i, tna - i, tnb - i, p);
  399|  10.1k|            memset(&(r[n2 + tna + tnb]), 0,
  400|  10.1k|                   sizeof(BN_ULONG) * (n2 - tna - tnb));
  401|  17.4k|        } else {                /* (j < 0) eg, n == 16, i == 8 and tn == 5 */
  402|       |
  403|  17.4k|            memset(&r[n2], 0, sizeof(*r) * n2);
  404|  17.4k|            if (tna < BN_MUL_RECURSIVE_SIZE_NORMAL
  ------------------
  |  |  365|  34.9k|# define BN_MUL_RECURSIVE_SIZE_NORMAL            (16)/* 32 less than */
  ------------------
  |  Branch (404:17): [True: 15.2k, False: 2.27k]
  ------------------
  405|  17.4k|                && tnb < BN_MUL_RECURSIVE_SIZE_NORMAL) {
  ------------------
  |  |  365|  15.2k|# define BN_MUL_RECURSIVE_SIZE_NORMAL            (16)/* 32 less than */
  ------------------
  |  Branch (405:20): [True: 14.9k, False: 317]
  ------------------
  406|  14.9k|                bn_mul_normal(&(r[n2]), &(a[n]), tna, &(b[n]), tnb);
  407|  14.9k|            } else {
  408|  3.54k|                for (;;) {
  409|  3.54k|                    i /= 2;
  410|       |                    /*
  411|       |                     * these simplified conditions work exclusively because
  412|       |                     * difference between tna and tnb is 1 or 0
  413|       |                     */
  414|  3.54k|                    if (i < tna || i < tnb) {
  ------------------
  |  Branch (414:25): [True: 1.39k, False: 2.15k]
  |  Branch (414:36): [True: 232, False: 1.92k]
  ------------------
  415|  1.62k|                        bn_mul_part_recursive(&(r[n2]),
  416|  1.62k|                                              &(a[n]), &(b[n]),
  417|  1.62k|                                              i, tna - i, tnb - i, p);
  418|  1.62k|                        break;
  419|  1.92k|                    } else if (i == tna || i == tnb) {
  ------------------
  |  Branch (419:32): [True: 649, False: 1.27k]
  |  Branch (419:44): [True: 317, False: 954]
  ------------------
  420|    966|                        bn_mul_recursive(&(r[n2]),
  421|    966|                                         &(a[n]), &(b[n]),
  422|    966|                                         i, tna - i, tnb - i, p);
  423|    966|                        break;
  424|    966|                    }
  425|  3.54k|                }
  426|  2.58k|            }
  427|  17.4k|        }
  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|  35.5k|    c1 = (int)(bn_add_words(t, r, &(r[n2]), n2));
  437|       |
  438|  35.5k|    if (neg) {                  /* if t[32] is negative */
  ------------------
  |  Branch (438:9): [True: 28.3k, False: 7.20k]
  ------------------
  439|  28.3k|        c1 -= (int)(bn_sub_words(&(t[n2]), t, &(t[n2]), n2));
  440|  28.3k|    } else {
  441|       |        /* Might have a carry */
  442|  7.20k|        c1 += (int)(bn_add_words(&(t[n2]), &(t[n2]), t, n2));
  443|  7.20k|    }
  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|  35.5k|    c1 += (int)(bn_add_words(&(r[n]), &(r[n]), &(t[n2]), n2));
  452|  35.5k|    if (c1) {
  ------------------
  |  Branch (452:9): [True: 1.17k, False: 34.3k]
  ------------------
  453|  1.17k|        p = &(r[n + n2]);
  454|  1.17k|        lo = *p;
  455|  1.17k|        ln = (lo + c1) & BN_MASK2;
  ------------------
  |  |   94|  1.17k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  456|  1.17k|        *p = ln;
  457|       |
  458|       |        /*
  459|       |         * The overflow will stop before we over write words we should not
  460|       |         * overwrite
  461|       |         */
  462|  1.17k|        if (ln < (BN_ULONG)c1) {
  ------------------
  |  Branch (462:13): [True: 369, False: 810]
  ------------------
  463|  1.25k|            do {
  464|  1.25k|                p++;
  465|  1.25k|                lo = *p;
  466|  1.25k|                ln = (lo + 1) & BN_MASK2;
  ------------------
  |  |   94|  1.25k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  467|  1.25k|                *p = ln;
  468|  1.25k|            } while (ln == 0);
  ------------------
  |  Branch (468:22): [True: 886, False: 369]
  ------------------
  469|    369|        }
  470|  1.17k|    }
  471|  35.5k|}
BN_mul:
  498|   252k|{
  499|   252k|    int ret = bn_mul_fixed_top(r, a, b, ctx);
  500|       |
  501|   252k|    bn_correct_top(r);
  502|   252k|    bn_check_top(r);
  503|       |
  504|   252k|    return ret;
  505|   252k|}
bn_mul_fixed_top:
  508|   267k|{
  509|   267k|    int ret = 0;
  510|   267k|    int top, al, bl;
  511|   267k|    BIGNUM *rr;
  512|   267k|#if defined(BN_MUL_COMBA) || defined(BN_RECURSION)
  513|   267k|    int i;
  514|   267k|#endif
  515|   267k|#ifdef BN_RECURSION
  516|   267k|    BIGNUM *t = NULL;
  517|   267k|    int j = 0, k;
  518|   267k|#endif
  519|       |
  520|   267k|    bn_check_top(a);
  521|   267k|    bn_check_top(b);
  522|   267k|    bn_check_top(r);
  523|       |
  524|   267k|    al = a->top;
  525|   267k|    bl = b->top;
  526|       |
  527|   267k|    if ((al == 0) || (bl == 0)) {
  ------------------
  |  Branch (527:9): [True: 3.63k, False: 264k]
  |  Branch (527:22): [True: 1.20k, False: 262k]
  ------------------
  528|  4.83k|        BN_zero(r);
  ------------------
  |  |  202|  4.83k|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  529|  4.83k|        return 1;
  530|  4.83k|    }
  531|   262k|    top = al + bl;
  532|       |
  533|   262k|    BN_CTX_start(ctx);
  534|   262k|    if ((r == a) || (r == b)) {
  ------------------
  |  Branch (534:9): [True: 0, False: 262k]
  |  Branch (534:21): [True: 0, False: 262k]
  ------------------
  535|      0|        if ((rr = BN_CTX_get(ctx)) == NULL)
  ------------------
  |  Branch (535:13): [True: 0, False: 0]
  ------------------
  536|      0|            goto err;
  537|      0|    } else
  538|   262k|        rr = r;
  539|       |
  540|   262k|#if defined(BN_MUL_COMBA) || defined(BN_RECURSION)
  541|   262k|    i = al - bl;
  542|   262k|#endif
  543|   262k|#ifdef BN_MUL_COMBA
  544|   262k|    if (i == 0) {
  ------------------
  |  Branch (544:9): [True: 203k, False: 59.1k]
  ------------------
  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|   203k|        if (al == 8) {
  ------------------
  |  Branch (554:13): [True: 507, False: 203k]
  ------------------
  555|    507|            if (bn_wexpand(rr, 16) == NULL)
  ------------------
  |  Branch (555:17): [True: 0, False: 507]
  ------------------
  556|      0|                goto err;
  557|    507|            rr->top = 16;
  558|    507|            bn_mul_comba8(rr->d, a->d, b->d);
  559|    507|            goto end;
  560|    507|        }
  561|   203k|    }
  562|   262k|#endif                          /* BN_MUL_COMBA */
  563|   262k|#ifdef BN_RECURSION
  564|   262k|    if ((al >= BN_MULL_SIZE_NORMAL) && (bl >= BN_MULL_SIZE_NORMAL)) {
  ------------------
  |  |  364|   262k|# define BN_MULL_SIZE_NORMAL                     (16)/* 32 */
  ------------------
                  if ((al >= BN_MULL_SIZE_NORMAL) && (bl >= BN_MULL_SIZE_NORMAL)) {
  ------------------
  |  |  364|  45.6k|# define BN_MULL_SIZE_NORMAL                     (16)/* 32 */
  ------------------
  |  Branch (564:9): [True: 45.6k, False: 216k]
  |  Branch (564:40): [True: 39.2k, False: 6.40k]
  ------------------
  565|  39.2k|        if (i >= -1 && i <= 1) {
  ------------------
  |  Branch (565:13): [True: 37.7k, False: 1.51k]
  |  Branch (565:24): [True: 36.9k, False: 777]
  ------------------
  566|       |            /*
  567|       |             * Find out the power of two lower or equal to the longest of the
  568|       |             * two numbers
  569|       |             */
  570|  36.9k|            if (i >= 0) {
  ------------------
  |  Branch (570:17): [True: 30.7k, False: 6.17k]
  ------------------
  571|  30.7k|                j = BN_num_bits_word((BN_ULONG)al);
  572|  30.7k|            }
  573|  36.9k|            if (i == -1) {
  ------------------
  |  Branch (573:17): [True: 6.17k, False: 30.7k]
  ------------------
  574|  6.17k|                j = BN_num_bits_word((BN_ULONG)bl);
  575|  6.17k|            }
  576|  36.9k|            j = 1 << (j - 1);
  577|  36.9k|            assert(j <= al || j <= bl);
  578|  36.9k|            k = j + j;
  579|  36.9k|            t = BN_CTX_get(ctx);
  580|  36.9k|            if (t == NULL)
  ------------------
  |  Branch (580:17): [True: 0, False: 36.9k]
  ------------------
  581|      0|                goto err;
  582|  36.9k|            if (al > j || bl > j) {
  ------------------
  |  Branch (582:17): [True: 21.2k, False: 15.7k]
  |  Branch (582:27): [True: 2.47k, False: 13.2k]
  ------------------
  583|  23.7k|                if (bn_wexpand(t, k * 4) == NULL)
  ------------------
  |  Branch (583:21): [True: 0, False: 23.7k]
  ------------------
  584|      0|                    goto err;
  585|  23.7k|                if (bn_wexpand(rr, k * 4) == NULL)
  ------------------
  |  Branch (585:21): [True: 0, False: 23.7k]
  ------------------
  586|      0|                    goto err;
  587|  23.7k|                bn_mul_part_recursive(rr->d, a->d, b->d,
  588|  23.7k|                                      j, al - j, bl - j, t->d);
  589|  23.7k|            } else {            /* al <= j || bl <= j */
  590|       |
  591|  13.2k|                if (bn_wexpand(t, k * 2) == NULL)
  ------------------
  |  Branch (591:21): [True: 0, False: 13.2k]
  ------------------
  592|      0|                    goto err;
  593|  13.2k|                if (bn_wexpand(rr, k * 2) == NULL)
  ------------------
  |  Branch (593:21): [True: 0, False: 13.2k]
  ------------------
  594|      0|                    goto err;
  595|  13.2k|                bn_mul_recursive(rr->d, a->d, b->d, j, al - j, bl - j, t->d);
  596|  13.2k|            }
  597|  36.9k|            rr->top = top;
  598|  36.9k|            goto end;
  599|  36.9k|        }
  600|  39.2k|    }
  601|   225k|#endif                          /* BN_RECURSION */
  602|   225k|    if (bn_wexpand(rr, top) == NULL)
  ------------------
  |  Branch (602:9): [True: 0, False: 225k]
  ------------------
  603|      0|        goto err;
  604|   225k|    rr->top = top;
  605|   225k|    bn_mul_normal(rr->d, a->d, al, b->d, bl);
  606|       |
  607|   225k|#if defined(BN_MUL_COMBA) || defined(BN_RECURSION)
  608|   262k| end:
  609|   262k|#endif
  610|   262k|    rr->neg = a->neg ^ b->neg;
  611|   262k|    rr->flags |= BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|   262k|#  define BN_FLG_FIXED_TOP 0
  ------------------
  612|   262k|    if (r != rr && BN_copy(r, rr) == NULL)
  ------------------
  |  Branch (612:9): [True: 0, False: 262k]
  |  Branch (612:20): [True: 0, False: 0]
  ------------------
  613|      0|        goto err;
  614|       |
  615|   262k|    ret = 1;
  616|   262k| err:
  617|   262k|    bn_check_top(r);
  618|   262k|    BN_CTX_end(ctx);
  619|   262k|    return ret;
  620|   262k|}
bn_mul_normal:
  623|   249k|{
  624|   249k|    BN_ULONG *rr;
  ------------------
  |  |   37|   249k|#  define BN_ULONG        unsigned long
  ------------------
  625|       |
  626|   249k|    if (na < nb) {
  ------------------
  |  Branch (626:9): [True: 46.2k, False: 202k]
  ------------------
  627|  46.2k|        int itmp;
  628|  46.2k|        BN_ULONG *ltmp;
  ------------------
  |  |   37|  46.2k|#  define BN_ULONG        unsigned long
  ------------------
  629|       |
  630|  46.2k|        itmp = na;
  631|  46.2k|        na = nb;
  632|  46.2k|        nb = itmp;
  633|  46.2k|        ltmp = a;
  634|  46.2k|        a = b;
  635|  46.2k|        b = ltmp;
  636|       |
  637|  46.2k|    }
  638|   249k|    rr = &(r[na]);
  639|   249k|    if (nb <= 0) {
  ------------------
  |  Branch (639:9): [True: 3.94k, False: 245k]
  ------------------
  640|  3.94k|        (void)bn_mul_words(r, a, na, 0);
  641|  3.94k|        return;
  642|  3.94k|    } else
  643|   245k|        rr[0] = bn_mul_words(r, a, na, b[0]);
  644|       |
  645|   281k|    for (;;) {
  646|   281k|        if (--nb <= 0)
  ------------------
  |  Branch (646:13): [True: 209k, False: 71.5k]
  ------------------
  647|   209k|            return;
  648|  71.5k|        rr[1] = bn_mul_add_words(&(r[1]), a, na, b[1]);
  649|  71.5k|        if (--nb <= 0)
  ------------------
  |  Branch (649:13): [True: 14.4k, False: 57.1k]
  ------------------
  650|  14.4k|            return;
  651|  57.1k|        rr[2] = bn_mul_add_words(&(r[2]), a, na, b[2]);
  652|  57.1k|        if (--nb <= 0)
  ------------------
  |  Branch (652:13): [True: 12.2k, False: 44.9k]
  ------------------
  653|  12.2k|            return;
  654|  44.9k|        rr[3] = bn_mul_add_words(&(r[3]), a, na, b[3]);
  655|  44.9k|        if (--nb <= 0)
  ------------------
  |  Branch (655:13): [True: 8.90k, False: 36.0k]
  ------------------
  656|  8.90k|            return;
  657|  36.0k|        rr[4] = bn_mul_add_words(&(r[4]), a, na, b[4]);
  658|  36.0k|        rr += 4;
  659|  36.0k|        r += 4;
  660|  36.0k|        b += 4;
  661|  36.0k|    }
  662|   245k|}

BN_RECP_CTX_init:
   14|  1.57k|{
   15|  1.57k|    memset(recp, 0, sizeof(*recp));
   16|  1.57k|    bn_init(&(recp->N));
   17|  1.57k|    bn_init(&(recp->Nr));
   18|  1.57k|}
BN_RECP_CTX_free:
   34|  1.57k|{
   35|  1.57k|    if (recp == NULL)
  ------------------
  |  Branch (35:9): [True: 0, False: 1.57k]
  ------------------
   36|      0|        return;
   37|  1.57k|    BN_free(&recp->N);
   38|  1.57k|    BN_free(&recp->Nr);
   39|  1.57k|    if (recp->flags & BN_FLG_MALLOCED)
  ------------------
  |  |   58|  1.57k|# define BN_FLG_MALLOCED         0x01
  ------------------
  |  Branch (39:9): [True: 0, False: 1.57k]
  ------------------
   40|      0|        OPENSSL_free(recp);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   41|  1.57k|}
BN_RECP_CTX_set:
   44|  1.57k|{
   45|  1.57k|    if (BN_is_zero(d) || !BN_copy(&(recp->N), d))
  ------------------
  |  Branch (45:9): [True: 0, False: 1.57k]
  |  Branch (45:26): [True: 0, False: 1.57k]
  ------------------
   46|      0|        return 0;
   47|  1.57k|    BN_zero(&(recp->Nr));
  ------------------
  |  |  202|  1.57k|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
   48|  1.57k|    recp->num_bits = BN_num_bits(d);
   49|  1.57k|    recp->shift = 0;
   50|  1.57k|    return 1;
   51|  1.57k|}
BN_mod_mul_reciprocal:
   55|   117k|{
   56|   117k|    int ret = 0;
   57|   117k|    BIGNUM *a;
   58|   117k|    const BIGNUM *ca;
   59|       |
   60|   117k|    BN_CTX_start(ctx);
   61|   117k|    if ((a = BN_CTX_get(ctx)) == NULL)
  ------------------
  |  Branch (61:9): [True: 0, False: 117k]
  ------------------
   62|      0|        goto err;
   63|   117k|    if (y != NULL) {
  ------------------
  |  Branch (63:9): [True: 117k, False: 0]
  ------------------
   64|   117k|        if (x == y) {
  ------------------
  |  Branch (64:13): [True: 94.5k, False: 22.4k]
  ------------------
   65|  94.5k|            if (!BN_sqr(a, x, ctx))
  ------------------
  |  Branch (65:17): [True: 0, False: 94.5k]
  ------------------
   66|      0|                goto err;
   67|  94.5k|        } else {
   68|  22.4k|            if (!BN_mul(a, x, y, ctx))
  ------------------
  |  Branch (68:17): [True: 0, False: 22.4k]
  ------------------
   69|      0|                goto err;
   70|  22.4k|        }
   71|   117k|        ca = a;
   72|   117k|    } else
   73|      0|        ca = x;                 /* Just do the mod */
   74|       |
   75|   117k|    ret = BN_div_recp(NULL, r, ca, recp, ctx);
   76|   117k| err:
   77|   117k|    BN_CTX_end(ctx);
   78|   117k|    bn_check_top(r);
   79|   117k|    return ret;
   80|   117k|}
BN_div_recp:
   84|   117k|{
   85|   117k|    int i, j, ret = 0;
   86|   117k|    BIGNUM *a, *b, *d, *r;
   87|       |
   88|   117k|    BN_CTX_start(ctx);
   89|   117k|    d = (dv != NULL) ? dv : BN_CTX_get(ctx);
  ------------------
  |  Branch (89:9): [True: 0, False: 117k]
  ------------------
   90|   117k|    r = (rem != NULL) ? rem : BN_CTX_get(ctx);
  ------------------
  |  Branch (90:9): [True: 117k, False: 0]
  ------------------
   91|   117k|    a = BN_CTX_get(ctx);
   92|   117k|    b = BN_CTX_get(ctx);
   93|   117k|    if (b == NULL)
  ------------------
  |  Branch (93:9): [True: 0, False: 117k]
  ------------------
   94|      0|        goto err;
   95|       |
   96|   117k|    if (BN_ucmp(m, &(recp->N)) < 0) {
  ------------------
  |  Branch (96:9): [True: 17.8k, False: 99.1k]
  ------------------
   97|  17.8k|        BN_zero(d);
  ------------------
  |  |  202|  17.8k|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
   98|  17.8k|        if (!BN_copy(r, m)) {
  ------------------
  |  Branch (98:13): [True: 0, False: 17.8k]
  ------------------
   99|      0|            BN_CTX_end(ctx);
  100|      0|            return 0;
  101|      0|        }
  102|  17.8k|        BN_CTX_end(ctx);
  103|  17.8k|        return 1;
  104|  17.8k|    }
  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|  99.1k|    i = BN_num_bits(m);
  113|  99.1k|    j = recp->num_bits << 1;
  114|  99.1k|    if (j > i)
  ------------------
  |  Branch (114:9): [True: 83.4k, False: 15.7k]
  ------------------
  115|  83.4k|        i = j;
  116|       |
  117|       |    /* Nr := round(2^i / N) */
  118|  99.1k|    if (i != recp->shift)
  ------------------
  |  Branch (118:9): [True: 1.52k, False: 97.6k]
  ------------------
  119|  1.52k|        recp->shift = BN_reciprocal(&(recp->Nr), &(recp->N), i, ctx);
  120|       |    /* BN_reciprocal could have returned -1 for an error */
  121|  99.1k|    if (recp->shift == -1)
  ------------------
  |  Branch (121:9): [True: 0, False: 99.1k]
  ------------------
  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|  99.1k|    if (!BN_rshift(a, m, recp->num_bits))
  ------------------
  |  Branch (130:9): [True: 0, False: 99.1k]
  ------------------
  131|      0|        goto err;
  132|  99.1k|    if (!BN_mul(b, a, &(recp->Nr), ctx))
  ------------------
  |  Branch (132:9): [True: 0, False: 99.1k]
  ------------------
  133|      0|        goto err;
  134|  99.1k|    if (!BN_rshift(d, b, i - recp->num_bits))
  ------------------
  |  Branch (134:9): [True: 0, False: 99.1k]
  ------------------
  135|      0|        goto err;
  136|  99.1k|    d->neg = 0;
  137|       |
  138|  99.1k|    if (!BN_mul(b, &(recp->N), d, ctx))
  ------------------
  |  Branch (138:9): [True: 0, False: 99.1k]
  ------------------
  139|      0|        goto err;
  140|  99.1k|    if (!BN_usub(r, m, b))
  ------------------
  |  Branch (140:9): [True: 0, False: 99.1k]
  ------------------
  141|      0|        goto err;
  142|  99.1k|    r->neg = 0;
  143|       |
  144|  99.1k|    j = 0;
  145|   163k|    while (BN_ucmp(r, &(recp->N)) >= 0) {
  ------------------
  |  Branch (145:12): [True: 64.1k, False: 99.1k]
  ------------------
  146|  64.1k|        if (j++ > 2) {
  ------------------
  |  Branch (146:13): [True: 0, False: 64.1k]
  ------------------
  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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  148|      0|            goto err;
  149|      0|        }
  150|  64.1k|        if (!BN_usub(r, r, &(recp->N)))
  ------------------
  |  Branch (150:13): [True: 0, False: 64.1k]
  ------------------
  151|      0|            goto err;
  152|  64.1k|        if (!BN_add_word(d, 1))
  ------------------
  |  Branch (152:13): [True: 0, False: 64.1k]
  ------------------
  153|      0|            goto err;
  154|  64.1k|    }
  155|       |
  156|  99.1k|    r->neg = BN_is_zero(r) ? 0 : m->neg;
  ------------------
  |  Branch (156:14): [True: 50, False: 99.1k]
  ------------------
  157|  99.1k|    d->neg = m->neg ^ recp->N.neg;
  158|  99.1k|    ret = 1;
  159|  99.1k| err:
  160|  99.1k|    BN_CTX_end(ctx);
  161|  99.1k|    bn_check_top(dv);
  162|  99.1k|    bn_check_top(rem);
  163|  99.1k|    return ret;
  164|  99.1k|}
BN_reciprocal:
  173|  1.52k|{
  174|  1.52k|    int ret = -1;
  175|  1.52k|    BIGNUM *t;
  176|       |
  177|  1.52k|    BN_CTX_start(ctx);
  178|  1.52k|    if ((t = BN_CTX_get(ctx)) == NULL)
  ------------------
  |  Branch (178:9): [True: 0, False: 1.52k]
  ------------------
  179|      0|        goto err;
  180|       |
  181|  1.52k|    if (!BN_set_bit(t, len))
  ------------------
  |  Branch (181:9): [True: 0, False: 1.52k]
  ------------------
  182|      0|        goto err;
  183|       |
  184|  1.52k|    if (!BN_div(r, NULL, t, m, ctx))
  ------------------
  |  Branch (184:9): [True: 0, False: 1.52k]
  ------------------
  185|      0|        goto err;
  186|       |
  187|  1.52k|    ret = len;
  188|  1.52k| err:
  189|  1.52k|    bn_check_top(r);
  190|  1.52k|    BN_CTX_end(ctx);
  191|  1.52k|    return ret;
  192|  1.52k|}

BN_rshift1:
   46|  60.3k|{
   47|  60.3k|    BN_ULONG *ap, *rp, t, c;
  ------------------
  |  |   37|  60.3k|#  define BN_ULONG        unsigned long
  ------------------
   48|  60.3k|    int i;
   49|       |
   50|  60.3k|    bn_check_top(r);
   51|  60.3k|    bn_check_top(a);
   52|       |
   53|  60.3k|    if (BN_is_zero(a)) {
  ------------------
  |  Branch (53:9): [True: 0, False: 60.3k]
  ------------------
   54|      0|        BN_zero(r);
  ------------------
  |  |  202|      0|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
   55|      0|        return 1;
   56|      0|    }
   57|  60.3k|    i = a->top;
   58|  60.3k|    ap = a->d;
   59|  60.3k|    if (a != r) {
  ------------------
  |  Branch (59:9): [True: 0, False: 60.3k]
  ------------------
   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|  60.3k|    rp = r->d;
   65|  60.3k|    r->top = i;
   66|  60.3k|    t = ap[--i];
   67|  60.3k|    rp[i] = t >> 1;
   68|  60.3k|    c = t << (BN_BITS2 - 1);
  ------------------
  |  |   54|  60.3k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  60.3k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
   69|  60.3k|    r->top -= (t == 1);
   70|  85.4k|    while (i > 0) {
  ------------------
  |  Branch (70:12): [True: 25.0k, False: 60.3k]
  ------------------
   71|  25.0k|        t = ap[--i];
   72|  25.0k|        rp[i] = ((t >> 1) & BN_MASK2) | c;
  ------------------
  |  |   94|  25.0k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
   73|  25.0k|        c = t << (BN_BITS2 - 1);
  ------------------
  |  |   54|  25.0k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|  25.0k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
   74|  25.0k|    }
   75|  60.3k|    if (!r->top)
  ------------------
  |  Branch (75:9): [True: 0, False: 60.3k]
  ------------------
   76|      0|        r->neg = 0; /* don't allow negative zero */
   77|  60.3k|    bn_check_top(r);
   78|  60.3k|    return 1;
   79|  60.3k|}
BN_lshift:
   82|  1.36k|{
   83|  1.36k|    int ret;
   84|       |
   85|  1.36k|    if (n < 0) {
  ------------------
  |  Branch (85:9): [True: 0, False: 1.36k]
  ------------------
   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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
   87|      0|        return 0;
   88|      0|    }
   89|       |
   90|  1.36k|    ret = bn_lshift_fixed_top(r, a, n);
   91|       |
   92|  1.36k|    bn_correct_top(r);
   93|  1.36k|    bn_check_top(r);
   94|       |
   95|  1.36k|    return ret;
   96|  1.36k|}
bn_lshift_fixed_top:
  105|   188k|{
  106|   188k|    int i, nw;
  107|   188k|    unsigned int lb, rb;
  108|   188k|    BN_ULONG *t, *f;
  ------------------
  |  |   37|   188k|#  define BN_ULONG        unsigned long
  ------------------
  109|   188k|    BN_ULONG l, m, rmask = 0;
  ------------------
  |  |   37|   188k|#  define BN_ULONG        unsigned long
  ------------------
  110|       |
  111|   188k|    assert(n >= 0);
  112|       |
  113|   188k|    bn_check_top(r);
  114|   188k|    bn_check_top(a);
  115|       |
  116|   188k|    nw = n / BN_BITS2;
  ------------------
  |  |   54|   188k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   188k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  117|   188k|    if (bn_wexpand(r, a->top + nw + 1) == NULL)
  ------------------
  |  Branch (117:9): [True: 0, False: 188k]
  ------------------
  118|      0|        return 0;
  119|       |
  120|   188k|    if (a->top != 0) {
  ------------------
  |  Branch (120:9): [True: 176k, False: 11.4k]
  ------------------
  121|   176k|        lb = (unsigned int)n % BN_BITS2;
  ------------------
  |  |   54|   176k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   176k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  122|   176k|        rb = BN_BITS2 - lb;
  ------------------
  |  |   54|   176k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   176k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  123|   176k|        rb %= BN_BITS2;            /* say no to undefined behaviour */
  ------------------
  |  |   54|   176k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   176k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  124|   176k|        rmask = (BN_ULONG)0 - rb;  /* rmask = 0 - (rb != 0) */
  125|   176k|        rmask |= rmask >> 8;
  126|   176k|        f = &(a->d[0]);
  127|   176k|        t = &(r->d[nw]);
  128|   176k|        l = f[a->top - 1];
  129|   176k|        t[a->top] = (l >> rb) & rmask;
  130|  2.10M|        for (i = a->top - 1; i > 0; i--) {
  ------------------
  |  Branch (130:30): [True: 1.93M, False: 176k]
  ------------------
  131|  1.93M|            m = l << lb;
  132|  1.93M|            l = f[i - 1];
  133|  1.93M|            t[i] = (m | ((l >> rb) & rmask)) & BN_MASK2;
  ------------------
  |  |   94|  1.93M|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  134|  1.93M|        }
  135|   176k|        t[0] = (l << lb) & BN_MASK2;
  ------------------
  |  |   94|   176k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  136|   176k|    } else {
  137|       |        /* shouldn't happen, but formally required */
  138|  11.4k|        r->d[nw] = 0;
  139|  11.4k|    }
  140|   188k|    if (nw != 0)
  ------------------
  |  Branch (140:9): [True: 1.36k, False: 186k]
  ------------------
  141|  1.36k|        memset(r->d, 0, sizeof(*t) * nw);
  142|       |
  143|   188k|    r->neg = a->neg;
  144|   188k|    r->top = a->top + nw + 1;
  145|   188k|    r->flags |= BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|   188k|#  define BN_FLG_FIXED_TOP 0
  ------------------
  146|       |
  147|   188k|    return 1;
  148|   188k|}
BN_rshift:
  151|   249k|{
  152|   249k|    int ret = 0;
  153|       |
  154|   249k|    if (n < 0) {
  ------------------
  |  Branch (154:9): [True: 0, False: 249k]
  ------------------
  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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  156|      0|        return 0;
  157|      0|    }
  158|       |
  159|   249k|    ret = bn_rshift_fixed_top(r, a, n);
  160|       |
  161|   249k|    bn_correct_top(r);
  162|   249k|    bn_check_top(r);
  163|       |
  164|   249k|    return ret;
  165|   249k|}
bn_rshift_fixed_top:
  174|   434k|{
  175|   434k|    int i, top, nw;
  176|   434k|    unsigned int lb, rb;
  177|   434k|    BN_ULONG *t, *f;
  ------------------
  |  |   37|   434k|#  define BN_ULONG        unsigned long
  ------------------
  178|   434k|    BN_ULONG l, m, mask;
  ------------------
  |  |   37|   434k|#  define BN_ULONG        unsigned long
  ------------------
  179|       |
  180|   434k|    bn_check_top(r);
  181|   434k|    bn_check_top(a);
  182|       |
  183|   434k|    assert(n >= 0);
  184|       |
  185|   434k|    nw = n / BN_BITS2;
  ------------------
  |  |   54|   434k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   434k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  186|   434k|    if (nw >= a->top) {
  ------------------
  |  Branch (186:9): [True: 1.23k, False: 432k]
  ------------------
  187|       |        /* shouldn't happen, but formally required */
  188|  1.23k|        BN_zero(r);
  ------------------
  |  |  202|  1.23k|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  189|  1.23k|        return 1;
  190|  1.23k|    }
  191|       |
  192|   432k|    rb = (unsigned int)n % BN_BITS2;
  ------------------
  |  |   54|   432k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   432k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  193|   432k|    lb = BN_BITS2 - rb;
  ------------------
  |  |   54|   432k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   432k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  194|   432k|    lb %= BN_BITS2;            /* say no to undefined behaviour */
  ------------------
  |  |   54|   432k|# define BN_BITS2       (BN_BYTES * 8)
  |  |  ------------------
  |  |  |  |   38|   432k|#  define BN_BYTES        8
  |  |  ------------------
  ------------------
  195|   432k|    mask = (BN_ULONG)0 - lb;   /* mask = 0 - (lb != 0) */
  196|   432k|    mask |= mask >> 8;
  197|   432k|    top = a->top - nw;
  198|   432k|    if (r != a && bn_wexpand(r, top) == NULL)
  ------------------
  |  Branch (198:9): [True: 381k, False: 51.6k]
  |  Branch (198:19): [True: 0, False: 381k]
  ------------------
  199|      0|        return 0;
  200|       |
  201|   432k|    t = &(r->d[0]);
  202|   432k|    f = &(a->d[nw]);
  203|   432k|    l = f[0];
  204|  2.97M|    for (i = 0; i < top - 1; i++) {
  ------------------
  |  Branch (204:17): [True: 2.53M, False: 432k]
  ------------------
  205|  2.53M|        m = f[i + 1];
  206|  2.53M|        t[i] = (l >> rb) | ((m << lb) & mask);
  207|  2.53M|        l = m;
  208|  2.53M|    }
  209|   432k|    t[i] = l >> rb;
  210|       |
  211|   432k|    r->neg = a->neg;
  212|   432k|    r->top = top;
  213|   432k|    r->flags |= BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|   432k|#  define BN_FLG_FIXED_TOP 0
  ------------------
  214|       |
  215|   432k|    return 1;
  216|   432k|}

BN_sqr:
   18|   229k|{
   19|   229k|    int ret = bn_sqr_fixed_top(r, a, ctx);
   20|       |
   21|   229k|    bn_correct_top(r);
   22|   229k|    bn_check_top(r);
   23|       |
   24|   229k|    return ret;
   25|   229k|}
bn_sqr_fixed_top:
   28|   331k|{
   29|   331k|    int max, al;
   30|   331k|    int ret = 0;
   31|   331k|    BIGNUM *tmp, *rr;
   32|       |
   33|   331k|    bn_check_top(a);
   34|       |
   35|   331k|    al = a->top;
   36|   331k|    if (al <= 0) {
  ------------------
  |  Branch (36:9): [True: 15.5k, False: 315k]
  ------------------
   37|  15.5k|        r->top = 0;
   38|  15.5k|        r->neg = 0;
   39|  15.5k|        return 1;
   40|  15.5k|    }
   41|       |
   42|   315k|    BN_CTX_start(ctx);
   43|   315k|    rr = (a != r) ? r : BN_CTX_get(ctx);
  ------------------
  |  Branch (43:10): [True: 315k, False: 0]
  ------------------
   44|   315k|    tmp = BN_CTX_get(ctx);
   45|   315k|    if (rr == NULL || tmp == NULL)
  ------------------
  |  Branch (45:9): [True: 0, False: 315k]
  |  Branch (45:23): [True: 0, False: 315k]
  ------------------
   46|      0|        goto err;
   47|       |
   48|   315k|    max = 2 * al;               /* Non-zero (from above) */
   49|   315k|    if (bn_wexpand(rr, max) == NULL)
  ------------------
  |  Branch (49:9): [True: 0, False: 315k]
  ------------------
   50|      0|        goto err;
   51|       |
   52|   315k|    if (al == 4) {
  ------------------
  |  Branch (52:9): [True: 2.50k, False: 313k]
  ------------------
   53|       |#ifndef BN_SQR_COMBA
   54|       |        BN_ULONG t[8];
   55|       |        bn_sqr_normal(rr->d, a->d, 4, t);
   56|       |#else
   57|  2.50k|        bn_sqr_comba4(rr->d, a->d);
   58|  2.50k|#endif
   59|   313k|    } else if (al == 8) {
  ------------------
  |  Branch (59:16): [True: 598, False: 312k]
  ------------------
   60|       |#ifndef BN_SQR_COMBA
   61|       |        BN_ULONG t[16];
   62|       |        bn_sqr_normal(rr->d, a->d, 8, t);
   63|       |#else
   64|    598|        bn_sqr_comba8(rr->d, a->d);
   65|    598|#endif
   66|   312k|    } else {
   67|   312k|#if defined(BN_RECURSION)
   68|   312k|        if (al < BN_SQR_RECURSIVE_SIZE_NORMAL) {
  ------------------
  |  |  366|   312k|# define BN_SQR_RECURSIVE_SIZE_NORMAL            (16)/* 32 */
  ------------------
  |  Branch (68:13): [True: 282k, False: 30.1k]
  ------------------
   69|   282k|            BN_ULONG t[BN_SQR_RECURSIVE_SIZE_NORMAL * 2];
  ------------------
  |  |   37|   282k|#  define BN_ULONG        unsigned long
  ------------------
   70|   282k|            bn_sqr_normal(rr->d, a->d, al, t);
   71|   282k|        } else {
   72|  30.1k|            int j, k;
   73|       |
   74|  30.1k|            j = BN_num_bits_word((BN_ULONG)al);
   75|  30.1k|            j = 1 << (j - 1);
   76|  30.1k|            k = j + j;
   77|  30.1k|            if (al == j) {
  ------------------
  |  Branch (77:17): [True: 12.1k, False: 18.0k]
  ------------------
   78|  12.1k|                if (bn_wexpand(tmp, k * 2) == NULL)
  ------------------
  |  Branch (78:21): [True: 0, False: 12.1k]
  ------------------
   79|      0|                    goto err;
   80|  12.1k|                bn_sqr_recursive(rr->d, a->d, al, tmp->d);
   81|  18.0k|            } else {
   82|  18.0k|                if (bn_wexpand(tmp, max) == NULL)
  ------------------
  |  Branch (82:21): [True: 0, False: 18.0k]
  ------------------
   83|      0|                    goto err;
   84|  18.0k|                bn_sqr_normal(rr->d, a->d, al, tmp->d);
   85|  18.0k|            }
   86|  30.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|   312k|    }
   93|       |
   94|   315k|    rr->neg = 0;
   95|   315k|    rr->top = max;
   96|   315k|    rr->flags |= BN_FLG_FIXED_TOP;
  ------------------
  |  |  226|   315k|#  define BN_FLG_FIXED_TOP 0
  ------------------
   97|   315k|    if (r != rr && BN_copy(r, rr) == NULL)
  ------------------
  |  Branch (97:9): [True: 0, False: 315k]
  |  Branch (97:20): [True: 0, False: 0]
  ------------------
   98|      0|        goto err;
   99|       |
  100|   315k|    ret = 1;
  101|   315k| err:
  102|   315k|    bn_check_top(rr);
  103|   315k|    bn_check_top(tmp);
  104|   315k|    BN_CTX_end(ctx);
  105|   315k|    return ret;
  106|   315k|}
bn_sqr_normal:
  110|   300k|{
  111|   300k|    int i, j, max;
  112|   300k|    const BN_ULONG *ap;
  113|   300k|    BN_ULONG *rp;
  ------------------
  |  |   37|   300k|#  define BN_ULONG        unsigned long
  ------------------
  114|       |
  115|   300k|    max = n * 2;
  116|   300k|    ap = a;
  117|   300k|    rp = r;
  118|   300k|    rp[0] = rp[max - 1] = 0;
  119|   300k|    rp++;
  120|   300k|    j = n;
  121|       |
  122|   300k|    if (--j > 0) {
  ------------------
  |  Branch (122:9): [True: 43.6k, False: 256k]
  ------------------
  123|  43.6k|        ap++;
  124|  43.6k|        rp[j] = bn_mul_words(rp, ap, j, ap[-1]);
  125|  43.6k|        rp += 2;
  126|  43.6k|    }
  127|       |
  128|  1.18M|    for (i = n - 2; i > 0; i--) {
  ------------------
  |  Branch (128:21): [True: 888k, False: 300k]
  ------------------
  129|   888k|        j--;
  130|   888k|        ap++;
  131|   888k|        rp[j] = bn_mul_add_words(rp, ap, j, ap[-1]);
  132|   888k|        rp += 2;
  133|   888k|    }
  134|       |
  135|   300k|    bn_add_words(r, r, r, max);
  136|       |
  137|       |    /* There will not be a carry */
  138|       |
  139|   300k|    bn_sqr_words(tmp, a, n);
  140|       |
  141|   300k|    bn_add_words(r, r, tmp, max);
  142|   300k|}
bn_sqr_recursive:
  157|   106k|{
  158|   106k|    int n = n2 / 2;
  159|   106k|    int zero, c1;
  160|   106k|    BN_ULONG ln, lo, *p;
  ------------------
  |  |   37|   106k|#  define BN_ULONG        unsigned long
  ------------------
  161|       |
  162|   106k|    if (n2 == 4) {
  ------------------
  |  Branch (162:9): [True: 0, False: 106k]
  ------------------
  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|   106k|    } else if (n2 == 8) {
  ------------------
  |  Branch (169:16): [True: 74.8k, False: 31.6k]
  ------------------
  170|       |# ifndef BN_SQR_COMBA
  171|       |        bn_sqr_normal(r, a, 8, t);
  172|       |# else
  173|  74.8k|        bn_sqr_comba8(r, a);
  174|  74.8k|# endif
  175|  74.8k|        return;
  176|  74.8k|    }
  177|  31.6k|    if (n2 < BN_SQR_RECURSIVE_SIZE_NORMAL) {
  ------------------
  |  |  366|  31.6k|# define BN_SQR_RECURSIVE_SIZE_NORMAL            (16)/* 32 */
  ------------------
  |  Branch (177:9): [True: 0, False: 31.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|  31.6k|    c1 = bn_cmp_words(a, &(a[n]), n);
  183|  31.6k|    zero = 0;
  184|  31.6k|    if (c1 > 0)
  ------------------
  |  Branch (184:9): [True: 18.3k, False: 13.3k]
  ------------------
  185|  18.3k|        bn_sub_words(t, a, &(a[n]), n);
  186|  13.3k|    else if (c1 < 0)
  ------------------
  |  Branch (186:14): [True: 12.7k, False: 544]
  ------------------
  187|  12.7k|        bn_sub_words(t, &(a[n]), a, n);
  188|    544|    else
  189|    544|        zero = 1;
  190|       |
  191|       |    /* The result will always be negative unless it is zero */
  192|  31.6k|    p = &(t[n2 * 2]);
  193|       |
  194|  31.6k|    if (!zero)
  ------------------
  |  Branch (194:9): [True: 31.1k, False: 544]
  ------------------
  195|  31.1k|        bn_sqr_recursive(&(t[n2]), t, n, p);
  196|    544|    else
  197|    544|        memset(&t[n2], 0, sizeof(*t) * n2);
  198|  31.6k|    bn_sqr_recursive(r, a, n, p);
  199|  31.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|  31.6k|    c1 = (int)(bn_add_words(t, r, &(r[n2]), n2));
  208|       |
  209|       |    /* t[32] is negative */
  210|  31.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|  31.6k|    c1 += (int)(bn_add_words(&(r[n]), &(r[n]), &(t[n2]), n2));
  219|  31.6k|    if (c1) {
  ------------------
  |  Branch (219:9): [True: 10.1k, False: 21.5k]
  ------------------
  220|  10.1k|        p = &(r[n + n2]);
  221|  10.1k|        lo = *p;
  222|  10.1k|        ln = (lo + c1) & BN_MASK2;
  ------------------
  |  |   94|  10.1k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  223|  10.1k|        *p = ln;
  224|       |
  225|       |        /*
  226|       |         * The overflow will stop before we over write words we should not
  227|       |         * overwrite
  228|       |         */
  229|  10.1k|        if (ln < (BN_ULONG)c1) {
  ------------------
  |  Branch (229:13): [True: 532, False: 9.59k]
  ------------------
  230|  1.17k|            do {
  231|  1.17k|                p++;
  232|  1.17k|                lo = *p;
  233|  1.17k|                ln = (lo + 1) & BN_MASK2;
  ------------------
  |  |   94|  1.17k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  234|  1.17k|                *p = ln;
  235|  1.17k|            } while (ln == 0);
  ------------------
  |  Branch (235:22): [True: 646, False: 532]
  ------------------
  236|    532|        }
  237|  10.1k|    }
  238|  31.6k|}

BN_add_word:
   99|  64.1k|{
  100|  64.1k|    BN_ULONG l;
  ------------------
  |  |   37|  64.1k|#  define BN_ULONG        unsigned long
  ------------------
  101|  64.1k|    int i;
  102|       |
  103|  64.1k|    bn_check_top(a);
  104|  64.1k|    w &= BN_MASK2;
  ------------------
  |  |   94|  64.1k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  105|       |
  106|       |    /* degenerate case: w is zero */
  107|  64.1k|    if (!w)
  ------------------
  |  Branch (107:9): [True: 0, False: 64.1k]
  ------------------
  108|      0|        return 1;
  109|       |    /* degenerate case: a is zero */
  110|  64.1k|    if (BN_is_zero(a))
  ------------------
  |  Branch (110:9): [True: 1.15k, False: 63.0k]
  ------------------
  111|  1.15k|        return BN_set_word(a, w);
  112|       |    /* handle 'a' when negative */
  113|  63.0k|    if (a->neg) {
  ------------------
  |  Branch (113:9): [True: 0, False: 63.0k]
  ------------------
  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|   126k|    for (i = 0; w != 0 && i < a->top; i++) {
  ------------------
  |  Branch (120:17): [True: 64.0k, False: 62.8k]
  |  Branch (120:27): [True: 63.8k, False: 194]
  ------------------
  121|  63.8k|        a->d[i] = l = (a->d[i] + w) & BN_MASK2;
  ------------------
  |  |   94|  63.8k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  122|  63.8k|        w = (w > l) ? 1 : 0;
  ------------------
  |  Branch (122:13): [True: 1.01k, False: 62.8k]
  ------------------
  123|  63.8k|    }
  124|  63.0k|    if (w && i == a->top) {
  ------------------
  |  Branch (124:9): [True: 194, False: 62.8k]
  |  Branch (124:14): [True: 194, False: 0]
  ------------------
  125|    194|        if (bn_wexpand(a, a->top + 1) == NULL)
  ------------------
  |  Branch (125:13): [True: 0, False: 194]
  ------------------
  126|      0|            return 0;
  127|    194|        a->top++;
  128|    194|        a->d[i] = w;
  129|    194|    }
  130|  63.0k|    bn_check_top(a);
  131|  63.0k|    return 1;
  132|  63.0k|}
BN_sub_word:
  135|  1.34k|{
  136|  1.34k|    int i;
  137|       |
  138|  1.34k|    bn_check_top(a);
  139|  1.34k|    w &= BN_MASK2;
  ------------------
  |  |   94|  1.34k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  140|       |
  141|       |    /* degenerate case: w is zero */
  142|  1.34k|    if (!w)
  ------------------
  |  Branch (142:9): [True: 0, False: 1.34k]
  ------------------
  143|      0|        return 1;
  144|       |    /* degenerate case: a is zero */
  145|  1.34k|    if (BN_is_zero(a)) {
  ------------------
  |  Branch (145:9): [True: 0, False: 1.34k]
  ------------------
  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.34k|    if (a->neg) {
  ------------------
  |  Branch (152:9): [True: 0, False: 1.34k]
  ------------------
  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.34k|    if ((a->top == 1) && (a->d[0] < w)) {
  ------------------
  |  Branch (159:9): [True: 0, False: 1.34k]
  |  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.34k|    i = 0;
  165|  2.68k|    for (;;) {
  166|  2.68k|        if (a->d[i] >= w) {
  ------------------
  |  Branch (166:13): [True: 1.34k, False: 1.34k]
  ------------------
  167|  1.34k|            a->d[i] -= w;
  168|  1.34k|            break;
  169|  1.34k|        } else {
  170|  1.34k|            a->d[i] = (a->d[i] - w) & BN_MASK2;
  ------------------
  |  |   94|  1.34k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  171|  1.34k|            i++;
  172|  1.34k|            w = 1;
  173|  1.34k|        }
  174|  2.68k|    }
  175|  1.34k|    if ((a->d[i] == 0) && (i == (a->top - 1)))
  ------------------
  |  Branch (175:9): [True: 177, False: 1.16k]
  |  Branch (175:27): [True: 177, False: 0]
  ------------------
  176|    177|        a->top--;
  177|  1.34k|    bn_check_top(a);
  178|  1.34k|    return 1;
  179|  1.34k|}
BN_mul_word:
  182|  9.52k|{
  183|  9.52k|    BN_ULONG ll;
  ------------------
  |  |   37|  9.52k|#  define BN_ULONG        unsigned long
  ------------------
  184|       |
  185|  9.52k|    bn_check_top(a);
  186|  9.52k|    w &= BN_MASK2;
  ------------------
  |  |   94|  9.52k|#  define BN_MASK2        (0xffffffffffffffffL)
  ------------------
  187|  9.52k|    if (a->top) {
  ------------------
  |  Branch (187:9): [True: 8.20k, False: 1.31k]
  ------------------
  188|  8.20k|        if (w == 0)
  ------------------
  |  Branch (188:13): [True: 0, False: 8.20k]
  ------------------
  189|      0|            BN_zero(a);
  ------------------
  |  |  202|      0|#  define BN_zero(a)      BN_zero_ex(a)
  ------------------
  190|  8.20k|        else {
  191|  8.20k|            ll = bn_mul_words(a->d, a->d, a->top, w);
  192|  8.20k|            if (ll) {
  ------------------
  |  Branch (192:17): [True: 7.26k, False: 945]
  ------------------
  193|  7.26k|                if (bn_wexpand(a, a->top + 1) == NULL)
  ------------------
  |  Branch (193:21): [True: 0, False: 7.26k]
  ------------------
  194|      0|                    return 0;
  195|  7.26k|                a->d[a->top++] = ll;
  196|  7.26k|            }
  197|  8.20k|        }
  198|  8.20k|    }
  199|  9.52k|    bn_check_top(a);
  200|  9.52k|    return 1;
  201|  9.52k|}

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:
  177|      2|{
  178|      2|# ifndef OPENSSL_NO_ERR
  179|      2|    if (ERR_reason_error_string(CMP_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (179:9): [True: 2, False: 0]
  ------------------
  180|      2|        ERR_load_strings_const(CMP_str_reasons);
  181|      2|# endif
  182|      2|    return 1;
  183|      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:
  171|      2|{
  172|      2|# ifndef OPENSSL_NO_ERR
  173|      2|    if (ERR_reason_error_string(CMS_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (173:9): [True: 2, False: 0]
  ------------------
  174|      2|        ERR_load_strings_const(CMS_str_reasons);
  175|      2|# endif
  176|      2|    return 1;
  177|      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|}

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|}

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

CONF_modules_unload:
  482|      2|{
  483|      2|    int i;
  484|      2|    CONF_MODULE *md;
  485|       |
  486|      2|    if (!conf_modules_finish_int()) /* also inits module list lock */
  ------------------
  |  Branch (486:9): [True: 0, False: 2]
  ------------------
  487|      0|        return;
  488|       |
  489|      2|    if (!CRYPTO_THREAD_write_lock(module_list_lock))
  ------------------
  |  Branch (489:9): [True: 0, False: 2]
  ------------------
  490|      0|        return;
  491|       |
  492|       |    /* unload modules in reverse order */
  493|      2|    for (i = sk_CONF_MODULE_num(supported_modules) - 1; i >= 0; i--) {
  ------------------
  |  Branch (493:57): [True: 0, False: 2]
  ------------------
  494|      0|        md = sk_CONF_MODULE_value(supported_modules, i);
  495|       |        /* If static or in use and 'all' not set ignore it */
  496|      0|        if (((md->links > 0) || !md->dso) && !all)
  ------------------
  |  Branch (496:14): [True: 0, False: 0]
  |  Branch (496:33): [True: 0, False: 0]
  |  Branch (496:46): [True: 0, False: 0]
  ------------------
  497|      0|            continue;
  498|       |        /* Since we're working in reverse this is OK */
  499|      0|        (void)sk_CONF_MODULE_delete(supported_modules, i);
  500|      0|        module_free(md);
  501|      0|    }
  502|       |
  503|      2|    if (sk_CONF_MODULE_num(supported_modules) == 0) {
  ------------------
  |  Branch (503:9): [True: 0, False: 2]
  ------------------
  504|      0|        sk_CONF_MODULE_free(supported_modules);
  505|      0|        supported_modules = NULL;
  506|      0|    }
  507|       |
  508|      2|    CRYPTO_THREAD_unlock(module_list_lock);
  509|      2|}
ossl_config_modules_free:
  576|      2|{
  577|      2|    CONF_modules_unload(1); /* calls CONF_modules_finish */
  578|      2|    module_lists_free();
  579|      2|}
conf_mod.c:do_init_module_list_lock:
  100|      2|{
  101|      2|    module_list_lock = CRYPTO_THREAD_lock_new();
  102|      2|    if (module_list_lock == NULL) {
  ------------------
  |  Branch (102:9): [True: 0, False: 2]
  ------------------
  103|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  104|      0|        return 0;
  105|      0|    }
  106|       |
  107|      2|    return 1;
  108|      2|}
conf_mod.c:conf_modules_finish_int:
  522|      2|{
  523|      2|    CONF_IMODULE *imod;
  524|       |
  525|      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 (525:9): [True: 0, False: 2]
  ------------------
  526|      0|        return 0;
  527|       |
  528|       |    /* If module_list_lock is NULL here it means we were already unloaded */
  529|      2|    if (module_list_lock == NULL
  ------------------
  |  Branch (529:9): [True: 0, False: 2]
  ------------------
  530|      2|        || !CRYPTO_THREAD_write_lock(module_list_lock))
  ------------------
  |  Branch (530:12): [True: 0, False: 2]
  ------------------
  531|      0|        return 0;
  532|       |
  533|      2|    while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
  ------------------
  |  Branch (533:12): [True: 0, False: 2]
  ------------------
  534|      0|        imod = sk_CONF_IMODULE_pop(initialized_modules);
  535|      0|        module_finish(imod);
  536|      0|    }
  537|      2|    sk_CONF_IMODULE_free(initialized_modules);
  538|      2|    initialized_modules = NULL;
  539|       |
  540|      2|    CRYPTO_THREAD_unlock(module_list_lock);
  541|       |
  542|      2|    return 1;
  543|      2|}
conf_mod.c:module_lists_free:
   88|      2|{
   89|      2|    CRYPTO_THREAD_lock_free(module_list_lock);
   90|      2|    module_list_lock = NULL;
   91|       |
   92|      2|    sk_CONF_MODULE_free(supported_modules);
   93|      2|    supported_modules = NULL;
   94|       |
   95|      2|    sk_CONF_IMODULE_free(initialized_modules);
   96|      2|    initialized_modules = NULL;
   97|      2|}

ossl_lib_ctx_default_deinit:
  387|      2|{
  388|      2|    if (!default_context_inited)
  ------------------
  |  Branch (388:9): [True: 2, False: 0]
  ------------------
  389|      2|        return;
  390|      0|    context_deinit(&default_context_int);
  391|      0|    CRYPTO_THREAD_cleanup_local(&default_context_thread_local);
  392|      0|    default_context_inited = 0;
  393|      0|}

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

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

ossl_err_load_CRMF_strings:
   65|      2|{
   66|      2|# ifndef OPENSSL_NO_ERR
   67|      2|    if (ERR_reason_error_string(CRMF_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (67:9): [True: 2, False: 0]
  ------------------
   68|      2|        ERR_load_strings_const(CRMF_str_reasons);
   69|      2|# endif
   70|      2|    return 1;
   71|      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:
   67|      2|{
   68|      2|# ifndef OPENSSL_NO_ERR
   69|      2|    if (ERR_reason_error_string(DH_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (69:9): [True: 2, False: 0]
  ------------------
   70|      2|        ERR_load_strings_const(DH_str_reasons);
   71|      2|# endif
   72|      2|    return 1;
   73|      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_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);
  ------------------
  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  ------------------
                  CRYPTO_free(state, OPENSSL_FILE, OPENSSL_LINE);
  ------------------
  |  |  280|      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.14k|{
  336|  3.14k|    int i;
  337|  3.14k|    ERR_STATE *es;
  338|       |
  339|  3.14k|    es = ossl_err_get_state_int();
  340|  3.14k|    if (es == NULL)
  ------------------
  |  Branch (340:9): [True: 0, False: 3.14k]
  ------------------
  341|      0|        return;
  342|       |
  343|  53.4k|    for (i = 0; i < ERR_NUM_ERRORS; i++) {
  ------------------
  |  |   55|  53.4k|#  define ERR_NUM_ERRORS  16
  ------------------
  |  Branch (343:17): [True: 50.3k, False: 3.14k]
  ------------------
  344|  50.3k|        err_clear(es, i, 0);
  345|  50.3k|    }
  346|  3.14k|    es->top = es->bottom = 0;
  347|  3.14k|}
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.14k|{
  674|  3.14k|    ERR_STATE *state;
  675|  3.14k|    int saveerrno = get_last_sys_error();
  ------------------
  |  |   30|  3.14k|# define get_last_sys_error()    errno
  ------------------
  676|       |
  677|  3.14k|    if (!OPENSSL_init_crypto(OPENSSL_INIT_BASE_ONLY, NULL))
  ------------------
  |  |   31|  3.14k|# define OPENSSL_INIT_BASE_ONLY              0x00040000L
  ------------------
  |  Branch (677:9): [True: 0, False: 3.14k]
  ------------------
  678|      0|        return NULL;
  679|       |
  680|  3.14k|    if (!RUN_ONCE(&err_init, err_do_init))
  ------------------
  |  |  130|  3.14k|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 3.14k, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (680:9): [True: 0, False: 3.14k]
  ------------------
  681|      0|        return NULL;
  682|       |
  683|  3.14k|    state = CRYPTO_THREAD_get_local(&err_thread_local);
  684|  3.14k|    if (state == (ERR_STATE*)-1)
  ------------------
  |  Branch (684:9): [True: 0, False: 3.14k]
  ------------------
  685|      0|        return NULL;
  686|       |
  687|  3.14k|    if (state == NULL) {
  ------------------
  |  Branch (687:9): [True: 2, False: 3.14k]
  ------------------
  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);
  ------------------
  |  |  450|      2|# define OPENSSL_INIT_LOAD_CRYPTO_STRINGS    0x00000002L
  ------------------
  706|      2|    }
  707|       |
  708|  3.14k|    set_sys_error(saveerrno);
  ------------------
  |  |   32|  3.14k|# define set_sys_error(e)        errno=(e)
  ------------------
  709|  3.14k|    return state;
  710|  3.14k|}
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_new(ossl_check_ERR_STRING_DATA_lh_hashfunc_type(hfn), ossl_check_ERR_STRING_DATA_lh_compfunc_type(cmp)))
  ------------------
  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.63k|{
  173|  8.63k|    unsigned long ret, l;
  174|       |
  175|  8.63k|    l = a->error;
  176|  8.63k|    ret = l ^ ERR_GET_LIB(l);
  177|  8.63k|    return (ret ^ ret % 19 * 13);
  178|  8.63k|}
err.c:err_string_data_cmp:
  182|  5.87k|{
  183|  5.87k|    if (a->error == b->error)
  ------------------
  |  Branch (183:9): [True: 5.57k, False: 292]
  ------------------
  184|  5.57k|        return 0;
  185|    292|    return a->error > b->error ? 1 : -1;
  ------------------
  |  Branch (185:12): [True: 160, False: 132]
  ------------------
  186|  5.87k|}
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.70k|    for (; str->error; str++)
  ------------------
  |  Branch (263:12): [True: 8.49k, False: 208]
  ------------------
  264|  8.49k|        (void)lh_ERR_STRING_DATA_insert(int_error_hash,
  ------------------
  |  |  378|  8.70k|#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|  50.3k|{
   86|  50.3k|    err_clear_data(es, i, (deall));
   87|  50.3k|    es->err_marks[i] = 0;
   88|  50.3k|    es->err_flags[i] = 0;
   89|  50.3k|    es->err_buffer[i] = 0;
   90|  50.3k|    es->err_line[i] = -1;
   91|  50.3k|    OPENSSL_free(es->err_file[i]);
  ------------------
  |  |  107|  50.3k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  50.3k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  50.3k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   92|  50.3k|    es->err_file[i] = NULL;
   93|  50.3k|    OPENSSL_free(es->err_func[i]);
  ------------------
  |  |  107|  50.3k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  50.3k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  50.3k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   94|  50.3k|    es->err_func[i] = NULL;
   95|  50.3k|}
err.c:err_clear_data:
   22|  50.3k|{
   23|  50.3k|    if (es->err_data_flags[i] & ERR_TXT_MALLOCED) {
  ------------------
  |  |   48|  50.3k|# define ERR_TXT_MALLOCED        0x01
  ------------------
  |  Branch (23:9): [True: 0, False: 50.3k]
  ------------------
   24|      0|        if (deall) {
  ------------------
  |  Branch (24:13): [True: 0, False: 0]
  ------------------
   25|      0|            OPENSSL_free(es->err_data[i]);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      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|  50.3k|    } else {
   34|  50.3k|        es->err_data[i] = NULL;
   35|  50.3k|        es->err_data_size[i] = 0;
   36|  50.3k|        es->err_data_flags[i] = 0;
   37|  50.3k|    }
   38|  50.3k|}

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:
  202|      2|{
  203|      2|#ifndef OPENSSL_NO_ERR
  204|      2|    if (ERR_reason_error_string(EVP_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (204:9): [True: 2, False: 0]
  ------------------
  205|      2|        ERR_load_strings_const(EVP_str_reasons);
  206|      2|#endif
  207|      2|    return 1;
  208|      2|}

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

evp_cleanup_int:
  154|      2|{
  155|      2|    OBJ_NAME_cleanup(OBJ_NAME_TYPE_KDF_METH);
  ------------------
  |  |   30|      2|# define OBJ_NAME_TYPE_KDF_METH          0x06
  ------------------
  156|      2|    OBJ_NAME_cleanup(OBJ_NAME_TYPE_CIPHER_METH);
  ------------------
  |  |   26|      2|# define OBJ_NAME_TYPE_CIPHER_METH       0x02
  ------------------
  157|      2|    OBJ_NAME_cleanup(OBJ_NAME_TYPE_MD_METH);
  ------------------
  |  |   25|      2|# define OBJ_NAME_TYPE_MD_METH           0x01
  ------------------
  158|       |    /*
  159|       |     * The above calls will only clean out the contents of the name hash
  160|       |     * table, but not the hash table itself.  The following line does that
  161|       |     * part.  -- Richard Levitte
  162|       |     */
  163|      2|    OBJ_NAME_cleanup(-1);
  164|       |
  165|      2|    EVP_PBE_cleanup();
  166|      2|    OBJ_sigid_free();
  167|       |
  168|      2|    evp_app_cleanup_int();
  169|      2|}

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

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

OPENSSL_cleanup:
  352|      2|{
  353|      2|    OPENSSL_INIT_STOP *currhandler, *lasthandler;
  354|       |
  355|       |    /*
  356|       |     * At some point we should consider looking at this function with a view to
  357|       |     * moving most/all of this into onfree handlers in OSSL_LIB_CTX.
  358|       |     */
  359|       |
  360|       |    /* If we've not been inited then no need to deinit */
  361|      2|    if (!base_inited)
  ------------------
  |  Branch (361:9): [True: 0, False: 2]
  ------------------
  362|      0|        return;
  363|       |
  364|       |    /* Might be explicitly called and also by atexit */
  365|      2|    if (stopped)
  ------------------
  |  Branch (365:9): [True: 0, False: 2]
  ------------------
  366|      0|        return;
  367|      2|    stopped = 1;
  368|       |
  369|       |    /*
  370|       |     * Thread stop may not get automatically called by the thread library for
  371|       |     * the very last thread in some situations, so call it directly.
  372|       |     */
  373|      2|    OPENSSL_thread_stop();
  374|       |
  375|      2|    currhandler = stop_handlers;
  376|      2|    while (currhandler != NULL) {
  ------------------
  |  Branch (376:12): [True: 0, False: 2]
  ------------------
  377|      0|        currhandler->handler();
  378|      0|        lasthandler = currhandler;
  379|      0|        currhandler = currhandler->next;
  380|      0|        OPENSSL_free(lasthandler);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  381|      0|    }
  382|      2|    stop_handlers = NULL;
  383|       |
  384|      2|    CRYPTO_THREAD_lock_free(optsdone_lock);
  385|      2|    optsdone_lock = NULL;
  386|      2|    CRYPTO_THREAD_lock_free(init_lock);
  387|      2|    init_lock = NULL;
  388|       |
  389|      2|    CRYPTO_THREAD_cleanup_local(&in_init_config_local);
  390|       |
  391|       |    /*
  392|       |     * We assume we are single-threaded for this function, i.e. no race
  393|       |     * conditions for the various "*_inited" vars below.
  394|       |     */
  395|       |
  396|      2|#ifndef OPENSSL_NO_COMP
  397|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_comp_zlib_cleanup()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  398|      2|    ossl_comp_zlib_cleanup();
  399|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_comp_brotli_cleanup()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  400|      2|    ossl_comp_brotli_cleanup();
  401|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_comp_zstd_cleanup()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  402|      2|    ossl_comp_zstd_cleanup();
  403|      2|#endif
  404|       |
  405|      2|    if (async_inited) {
  ------------------
  |  Branch (405:9): [True: 0, False: 2]
  ------------------
  406|      0|        OSSL_TRACE(INIT, "OPENSSL_cleanup: async_deinit()\n");
  ------------------
  |  |  287|      0|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      0|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  407|      0|        async_deinit();
  408|      0|    }
  409|       |
  410|       |    /*
  411|       |     * Note that cleanup order is important:
  412|       |     * - ossl_rand_cleanup_int could call an ENGINE's RAND cleanup function so
  413|       |     * must be called before engine_cleanup_int()
  414|       |     * - ENGINEs use CRYPTO_EX_DATA and therefore, must be cleaned up
  415|       |     * before the ex data handlers are wiped during default ossl_lib_ctx deinit.
  416|       |     * - ossl_config_modules_free() can end up in ENGINE code so must be called
  417|       |     * before engine_cleanup_int()
  418|       |     * - ENGINEs and additional EVP algorithms might use added OIDs names so
  419|       |     * ossl_obj_cleanup_int() must be called last
  420|       |     */
  421|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_rand_cleanup_int()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  422|      2|    ossl_rand_cleanup_int();
  423|       |
  424|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_config_modules_free()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  425|      2|    ossl_config_modules_free();
  426|       |
  427|      2|#ifndef OPENSSL_NO_ENGINE
  428|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: engine_cleanup_int()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  429|      2|    engine_cleanup_int();
  430|      2|#endif
  431|       |
  432|      2|#ifndef OPENSSL_NO_DEPRECATED_3_0
  433|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_store_cleanup_int()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  434|      2|    ossl_store_cleanup_int();
  435|      2|#endif
  436|       |
  437|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_lib_ctx_default_deinit()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  438|      2|    ossl_lib_ctx_default_deinit();
  439|       |
  440|      2|    ossl_cleanup_thread();
  441|       |
  442|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: bio_cleanup()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  443|      2|    bio_cleanup();
  444|       |
  445|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: evp_cleanup_int()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  446|      2|    evp_cleanup_int();
  447|       |
  448|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_obj_cleanup_int()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  449|      2|    ossl_obj_cleanup_int();
  450|       |
  451|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: err_int()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  452|      2|    err_cleanup();
  453|       |
  454|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: CRYPTO_secure_malloc_done()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  455|      2|    CRYPTO_secure_malloc_done();
  456|       |
  457|      2|#ifndef OPENSSL_NO_CMP
  458|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: OSSL_CMP_log_close()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  459|      2|    OSSL_CMP_log_close();
  460|      2|#endif
  461|       |
  462|      2|    OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_trace_cleanup()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  463|      2|    ossl_trace_cleanup();
  464|       |
  465|      2|    base_inited = 0;
  466|      2|}
OPENSSL_init_crypto:
  474|  3.15k|{
  475|  3.15k|    uint64_t tmp;
  476|  3.15k|    int aloaddone = 0;
  477|       |
  478|       |   /* Applications depend on 0 being returned when cleanup was already done */
  479|  3.15k|    if (stopped) {
  ------------------
  |  Branch (479:9): [True: 0, False: 3.15k]
  ------------------
  480|      0|        if (!(opts & OPENSSL_INIT_BASE_ONLY))
  ------------------
  |  |   31|      0|# define OPENSSL_INIT_BASE_ONLY              0x00040000L
  ------------------
  |  Branch (480:13): [True: 0, False: 0]
  ------------------
  481|      0|            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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  482|      0|        return 0;
  483|      0|    }
  484|       |
  485|       |    /*
  486|       |     * We ignore failures from this function. It is probably because we are
  487|       |     * on a platform that doesn't support lockless atomic loads (we may not
  488|       |     * have created optsdone_lock yet so we can't use it). This is just an
  489|       |     * optimisation to skip the full checks in this function if we don't need
  490|       |     * to, so we carry on regardless in the event of failure.
  491|       |     *
  492|       |     * There could be a race here with other threads, so that optsdone has not
  493|       |     * been updated yet, even though the options have in fact been initialised.
  494|       |     * This doesn't matter - it just means we will run the full function
  495|       |     * unnecessarily - but all the critical code is contained in RUN_ONCE
  496|       |     * functions anyway so we are safe.
  497|       |     */
  498|  3.15k|    if (CRYPTO_atomic_load(&optsdone, &tmp, NULL)) {
  ------------------
  |  Branch (498:9): [True: 3.15k, False: 0]
  ------------------
  499|  3.15k|        if ((tmp & opts) == opts)
  ------------------
  |  Branch (499:13): [True: 2, False: 3.15k]
  ------------------
  500|      2|            return 1;
  501|  3.15k|        aloaddone = 1;
  502|  3.15k|    }
  503|       |
  504|       |    /*
  505|       |     * At some point we should look at this function with a view to moving
  506|       |     * most/all of this into OSSL_LIB_CTX.
  507|       |     *
  508|       |     * When the caller specifies OPENSSL_INIT_BASE_ONLY, that should be the
  509|       |     * *only* option specified.  With that option we return immediately after
  510|       |     * doing the requested limited initialization.  Note that
  511|       |     * err_shelve_state() called by us via ossl_init_load_crypto_nodelete()
  512|       |     * re-enters OPENSSL_init_crypto() with OPENSSL_INIT_BASE_ONLY, but with
  513|       |     * base already initialized this is a harmless NOOP.
  514|       |     *
  515|       |     * If we remain the only caller of err_shelve_state() the recursion should
  516|       |     * perhaps be removed, but if in doubt, it can be left in place.
  517|       |     */
  518|  3.15k|    if (!RUN_ONCE(&base, ossl_init_base))
  ------------------
  |  |  130|  3.15k|    (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0)
  |  |  ------------------
  |  |  |  Branch (130:6): [True: 3.15k, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (518:9): [True: 0, False: 3.15k]
  ------------------
  519|      0|        return 0;
  520|       |
  521|  3.15k|    if (opts & OPENSSL_INIT_BASE_ONLY)
  ------------------
  |  |   31|  3.15k|# define OPENSSL_INIT_BASE_ONLY              0x00040000L
  ------------------
  |  Branch (521:9): [True: 3.15k, False: 2]
  ------------------
  522|  3.15k|        return 1;
  523|       |
  524|       |    /*
  525|       |     * optsdone_lock should definitely be set up now, so we can now repeat the
  526|       |     * same check from above but be sure that it will work even on platforms
  527|       |     * without lockless CRYPTO_atomic_load
  528|       |     */
  529|      2|    if (!aloaddone) {
  ------------------
  |  Branch (529:9): [True: 0, False: 2]
  ------------------
  530|      0|        if (!CRYPTO_atomic_load(&optsdone, &tmp, optsdone_lock))
  ------------------
  |  Branch (530:13): [True: 0, False: 0]
  ------------------
  531|      0|            return 0;
  532|      0|        if ((tmp & opts) == opts)
  ------------------
  |  Branch (532:13): [True: 0, False: 0]
  ------------------
  533|      0|            return 1;
  534|      0|    }
  535|       |
  536|       |    /*
  537|       |     * Now we don't always set up exit handlers, the INIT_BASE_ONLY calls
  538|       |     * should not have the side-effect of setting up exit handlers, and
  539|       |     * therefore, this code block is below the INIT_BASE_ONLY-conditioned early
  540|       |     * return above.
  541|       |     */
  542|      2|    if ((opts & OPENSSL_INIT_NO_ATEXIT) != 0) {
  ------------------
  |  |  468|      2|# define OPENSSL_INIT_NO_ATEXIT              0x00080000L
  ------------------
  |  Branch (542:9): [True: 0, False: 2]
  ------------------
  543|      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 (543:13): [True: 0, False: 0]
  ------------------
  544|      0|                          ossl_init_register_atexit))
  545|      0|            return 0;
  546|      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 (546:16): [True: 0, False: 2]
  ------------------
  547|      0|        return 0;
  548|      0|    }
  549|       |
  550|      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 (550:9): [True: 0, False: 2]
  ------------------
  551|      0|        return 0;
  552|       |
  553|      2|    if ((opts & OPENSSL_INIT_NO_LOAD_CRYPTO_STRINGS)
  ------------------
  |  |  449|      2|# define OPENSSL_INIT_NO_LOAD_CRYPTO_STRINGS 0x00000001L
  ------------------
  |  Branch (553:9): [True: 0, False: 2]
  ------------------
  554|      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 (554:16): [True: 0, False: 0]
  ------------------
  555|      2|                             ossl_init_no_load_crypto_strings,
  556|      2|                             ossl_init_load_crypto_strings))
  557|      0|        return 0;
  558|       |
  559|      2|    if ((opts & OPENSSL_INIT_LOAD_CRYPTO_STRINGS)
  ------------------
  |  |  450|      2|# define OPENSSL_INIT_LOAD_CRYPTO_STRINGS    0x00000002L
  ------------------
  |  Branch (559:9): [True: 2, False: 0]
  ------------------
  560|      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 (560:16): [True: 0, False: 2]
  ------------------
  561|      0|        return 0;
  562|       |
  563|      2|    if ((opts & OPENSSL_INIT_NO_ADD_ALL_CIPHERS)
  ------------------
  |  |  453|      2|# define OPENSSL_INIT_NO_ADD_ALL_CIPHERS     0x00000010L
  ------------------
  |  Branch (563:9): [True: 0, False: 2]
  ------------------
  564|      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 (564:16): [True: 0, False: 0]
  ------------------
  565|      2|                             ossl_init_add_all_ciphers))
  566|      0|        return 0;
  567|       |
  568|      2|    if ((opts & OPENSSL_INIT_ADD_ALL_CIPHERS)
  ------------------
  |  |  451|      2|# define OPENSSL_INIT_ADD_ALL_CIPHERS        0x00000004L
  ------------------
  |  Branch (568:9): [True: 0, False: 2]
  ------------------
  569|      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 (569:16): [True: 0, False: 0]
  ------------------
  570|      0|        return 0;
  571|       |
  572|      2|    if ((opts & OPENSSL_INIT_NO_ADD_ALL_DIGESTS)
  ------------------
  |  |  454|      2|# define OPENSSL_INIT_NO_ADD_ALL_DIGESTS     0x00000020L
  ------------------
  |  Branch (572:9): [True: 0, False: 2]
  ------------------
  573|      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 (573:16): [True: 0, False: 0]
  ------------------
  574|      2|                             ossl_init_add_all_digests))
  575|      0|        return 0;
  576|       |
  577|      2|    if ((opts & OPENSSL_INIT_ADD_ALL_DIGESTS)
  ------------------
  |  |  452|      2|# define OPENSSL_INIT_ADD_ALL_DIGESTS        0x00000008L
  ------------------
  |  Branch (577:9): [True: 0, False: 2]
  ------------------
  578|      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 (578:16): [True: 0, False: 0]
  ------------------
  579|      0|        return 0;
  580|       |
  581|      2|    if ((opts & OPENSSL_INIT_ATFORK)
  ------------------
  |  |  466|      2|# define OPENSSL_INIT_ATFORK                 0x00020000L
  ------------------
  |  Branch (581:9): [True: 0, False: 2]
  ------------------
  582|      2|            && !openssl_init_fork_handlers())
  ------------------
  |  Branch (582:16): [True: 0, False: 0]
  ------------------
  583|      0|        return 0;
  584|       |
  585|      2|    if ((opts & OPENSSL_INIT_NO_LOAD_CONFIG)
  ------------------
  |  |  456|      2|# define OPENSSL_INIT_NO_LOAD_CONFIG         0x00000080L
  ------------------
  |  Branch (585:9): [True: 0, False: 2]
  ------------------
  586|      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 (586:16): [True: 0, False: 0]
  ------------------
  587|      0|        return 0;
  588|       |
  589|      2|    if (opts & OPENSSL_INIT_LOAD_CONFIG) {
  ------------------
  |  |  455|      2|# define OPENSSL_INIT_LOAD_CONFIG            0x00000040L
  ------------------
  |  Branch (589:9): [True: 0, False: 2]
  ------------------
  590|      0|        int loading = CRYPTO_THREAD_get_local(&in_init_config_local) != NULL;
  591|       |
  592|       |        /* If called recursively from OBJ_ calls, just skip it. */
  593|      0|        if (!loading) {
  ------------------
  |  Branch (593:13): [True: 0, False: 0]
  ------------------
  594|      0|            int ret;
  595|       |
  596|      0|            if (!CRYPTO_THREAD_set_local(&in_init_config_local, (void *)-1))
  ------------------
  |  Branch (596:17): [True: 0, False: 0]
  ------------------
  597|      0|                return 0;
  598|      0|            if (settings == NULL) {
  ------------------
  |  Branch (598:17): [True: 0, False: 0]
  ------------------
  599|      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]
  |  |  ------------------
  ------------------
  600|      0|            } else {
  601|      0|                if (!CRYPTO_THREAD_write_lock(init_lock))
  ------------------
  |  Branch (601:21): [True: 0, False: 0]
  ------------------
  602|      0|                    return 0;
  603|      0|                conf_settings = settings;
  604|      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]
  |  |  ------------------
  ------------------
  605|      0|                                   ossl_init_config);
  606|      0|                conf_settings = NULL;
  607|      0|                CRYPTO_THREAD_unlock(init_lock);
  608|      0|            }
  609|       |
  610|      0|            if (ret <= 0)
  ------------------
  |  Branch (610:17): [True: 0, False: 0]
  ------------------
  611|      0|                return 0;
  612|      0|        }
  613|      0|    }
  614|       |
  615|      2|    if ((opts & OPENSSL_INIT_ASYNC)
  ------------------
  |  |  457|      2|# define OPENSSL_INIT_ASYNC                  0x00000100L
  ------------------
  |  Branch (615:9): [True: 0, False: 2]
  ------------------
  616|      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 (616:16): [True: 0, False: 0]
  ------------------
  617|      0|        return 0;
  618|       |
  619|      2|#ifndef OPENSSL_NO_ENGINE
  620|      2|    if ((opts & OPENSSL_INIT_ENGINE_OPENSSL)
  ------------------
  |  |  460|      2|# define OPENSSL_INIT_ENGINE_OPENSSL         0x00000800L
  ------------------
  |  Branch (620:9): [True: 0, False: 2]
  ------------------
  621|      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 (621:16): [True: 0, False: 0]
  ------------------
  622|      0|        return 0;
  623|      2|# ifndef OPENSSL_NO_RDRAND
  624|      2|    if ((opts & OPENSSL_INIT_ENGINE_RDRAND)
  ------------------
  |  |  458|      2|# define OPENSSL_INIT_ENGINE_RDRAND          0x00000200L
  ------------------
  |  Branch (624:9): [True: 0, False: 2]
  ------------------
  625|      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 (625:16): [True: 0, False: 0]
  ------------------
  626|      0|        return 0;
  627|      2|# endif
  628|      2|    if ((opts & OPENSSL_INIT_ENGINE_DYNAMIC)
  ------------------
  |  |  459|      2|# define OPENSSL_INIT_ENGINE_DYNAMIC         0x00000400L
  ------------------
  |  Branch (628:9): [True: 0, False: 2]
  ------------------
  629|      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 (629:16): [True: 0, False: 0]
  ------------------
  630|      0|        return 0;
  631|      2|# ifndef OPENSSL_NO_STATIC_ENGINE
  632|       |#  ifndef OPENSSL_NO_DEVCRYPTOENG
  633|       |    if ((opts & OPENSSL_INIT_ENGINE_CRYPTODEV)
  634|       |            && !RUN_ONCE(&engine_devcrypto, ossl_init_engine_devcrypto))
  635|       |        return 0;
  636|       |#  endif
  637|      2|#  if !defined(OPENSSL_NO_PADLOCKENG)
  638|      2|    if ((opts & OPENSSL_INIT_ENGINE_PADLOCK)
  ------------------
  |  |  463|      2|# define OPENSSL_INIT_ENGINE_PADLOCK         0x00004000L
  ------------------
  |  Branch (638:9): [True: 0, False: 2]
  ------------------
  639|      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 (639:16): [True: 0, False: 0]
  ------------------
  640|      0|        return 0;
  641|      2|#  endif
  642|       |#  if defined(OPENSSL_SYS_WIN32) && !defined(OPENSSL_NO_CAPIENG)
  643|       |    if ((opts & OPENSSL_INIT_ENGINE_CAPI)
  644|       |            && !RUN_ONCE(&engine_capi, ossl_init_engine_capi))
  645|       |        return 0;
  646|       |#  endif
  647|      2|#  if !defined(OPENSSL_NO_AFALGENG)
  648|      2|    if ((opts & OPENSSL_INIT_ENGINE_AFALG)
  ------------------
  |  |  464|      2|# define OPENSSL_INIT_ENGINE_AFALG           0x00008000L
  ------------------
  |  Branch (648:9): [True: 0, False: 2]
  ------------------
  649|      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 (649:16): [True: 0, False: 0]
  ------------------
  650|      0|        return 0;
  651|      2|#  endif
  652|      2|# endif
  653|      2|    if (opts & (OPENSSL_INIT_ENGINE_ALL_BUILTIN
  ------------------
  |  |  480|      2|    (OPENSSL_INIT_ENGINE_RDRAND | OPENSSL_INIT_ENGINE_DYNAMIC \
  |  |  ------------------
  |  |  |  |  458|      2|# define OPENSSL_INIT_ENGINE_RDRAND          0x00000200L
  |  |  ------------------
  |  |                   (OPENSSL_INIT_ENGINE_RDRAND | OPENSSL_INIT_ENGINE_DYNAMIC \
  |  |  ------------------
  |  |  |  |  459|      2|# define OPENSSL_INIT_ENGINE_DYNAMIC         0x00000400L
  |  |  ------------------
  |  |  481|      2|    | OPENSSL_INIT_ENGINE_CRYPTODEV | OPENSSL_INIT_ENGINE_CAPI | \
  |  |  ------------------
  |  |  |  |  461|      2|# define OPENSSL_INIT_ENGINE_CRYPTODEV       0x00001000L
  |  |  ------------------
  |  |                   | OPENSSL_INIT_ENGINE_CRYPTODEV | OPENSSL_INIT_ENGINE_CAPI | \
  |  |  ------------------
  |  |  |  |  462|      2|# define OPENSSL_INIT_ENGINE_CAPI            0x00002000L
  |  |  ------------------
  |  |  482|      2|    OPENSSL_INIT_ENGINE_PADLOCK)
  |  |  ------------------
  |  |  |  |  463|      2|# define OPENSSL_INIT_ENGINE_PADLOCK         0x00004000L
  |  |  ------------------
  ------------------
  |  Branch (653:9): [True: 0, False: 2]
  ------------------
  654|      2|                | OPENSSL_INIT_ENGINE_OPENSSL
  ------------------
  |  |  460|      2|# define OPENSSL_INIT_ENGINE_OPENSSL         0x00000800L
  ------------------
  655|      2|                | OPENSSL_INIT_ENGINE_AFALG)) {
  ------------------
  |  |  464|      2|# define OPENSSL_INIT_ENGINE_AFALG           0x00008000L
  ------------------
  656|      0|        ENGINE_register_all_complete();
  657|      0|    }
  658|      2|#endif
  659|       |
  660|      2|    if (!CRYPTO_atomic_or(&optsdone, opts, &tmp, optsdone_lock))
  ------------------
  |  Branch (660:9): [True: 0, False: 2]
  ------------------
  661|      0|        return 0;
  662|       |
  663|      2|    return 1;
  664|      2|}
init.c:ossl_init_base:
   56|      2|{
   57|       |    /* no need to init trace */
   58|       |
   59|      2|    OSSL_TRACE(INIT, "ossl_init_base: setting up stop handlers\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
   60|       |#ifndef OPENSSL_NO_CRYPTO_MDEBUG
   61|       |    ossl_malloc_setup_failures();
   62|       |#endif
   63|       |
   64|      2|    if ((optsdone_lock = CRYPTO_THREAD_lock_new()) == NULL
  ------------------
  |  Branch (64:9): [True: 0, False: 2]
  ------------------
   65|      2|        || (init_lock = CRYPTO_THREAD_lock_new()) == NULL)
  ------------------
  |  Branch (65:12): [True: 0, False: 2]
  ------------------
   66|      0|        goto err;
   67|       |
   68|      2|    OPENSSL_cpuid_setup();
   69|       |
   70|      2|    if (!ossl_init_thread())
  ------------------
  |  Branch (70:9): [True: 0, False: 2]
  ------------------
   71|      0|        goto err;
   72|       |
   73|      2|    if (!CRYPTO_THREAD_init_local(&in_init_config_local, NULL))
  ------------------
  |  Branch (73:9): [True: 0, False: 2]
  ------------------
   74|      0|        goto err;
   75|       |
   76|      2|    base_inited = 1;
   77|      2|    return 1;
   78|       |
   79|      0|err:
   80|      0|    OSSL_TRACE(INIT, "ossl_init_base failed!\n");
  ------------------
  |  |  287|      0|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      0|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
   81|      0|    CRYPTO_THREAD_lock_free(optsdone_lock);
   82|      0|    optsdone_lock = NULL;
   83|      0|    CRYPTO_THREAD_lock_free(init_lock);
   84|      0|    init_lock = NULL;
   85|       |
   86|      0|    return 0;
   87|      2|}
init.c:ossl_init_register_atexit:
   99|      2|{
  100|       |#ifdef OPENSSL_INIT_DEBUG
  101|       |    fprintf(stderr, "OPENSSL_INIT: ossl_init_register_atexit()\n");
  102|       |#endif
  103|      2|#ifndef OPENSSL_SYS_UEFI
  104|       |# if defined(_WIN32) && !defined(__BORLANDC__)
  105|       |    /* We use _onexit() in preference because it gets called on DLL unload */
  106|       |    if (_onexit(win32atexit) == NULL)
  107|       |        return 0;
  108|       |# else
  109|      2|    if (atexit(OPENSSL_cleanup) != 0)
  ------------------
  |  Branch (109:9): [True: 0, False: 2]
  ------------------
  110|      0|        return 0;
  111|      2|# endif
  112|      2|#endif
  113|       |
  114|      2|    return 1;
  115|      2|}
init.c:ossl_init_load_crypto_nodelete:
  129|      2|{
  130|      2|    OSSL_TRACE(INIT, "ossl_init_load_crypto_nodelete()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  131|       |
  132|       |#if !defined(OPENSSL_USE_NODELETE) \
  133|       |    && !defined(OPENSSL_NO_PINSHARED)
  134|       |# if defined(DSO_WIN32) && !defined(_WIN32_WCE)
  135|       |    {
  136|       |        HMODULE handle = NULL;
  137|       |        BOOL ret;
  138|       |
  139|       |        /* We don't use the DSO route for WIN32 because there is a better way */
  140|       |        ret = GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
  141|       |                                | GET_MODULE_HANDLE_EX_FLAG_PIN,
  142|       |                                (void *)&base_inited, &handle);
  143|       |
  144|       |        OSSL_TRACE1(INIT,
  145|       |                    "ossl_init_load_crypto_nodelete: "
  146|       |                    "obtained DSO reference? %s\n",
  147|       |                    (ret == TRUE ? "No!" : "Yes."));
  148|       |        return (ret == TRUE) ? 1 : 0;
  149|       |    }
  150|       |# elif !defined(DSO_NONE)
  151|       |    /*
  152|       |     * Deliberately leak a reference to ourselves. This will force the library
  153|       |     * to remain loaded until the atexit() handler is run at process exit.
  154|       |     */
  155|       |    {
  156|       |        DSO *dso;
  157|       |        void *err;
  158|       |
  159|       |        if (!err_shelve_state(&err))
  160|       |            return 0;
  161|       |
  162|       |        dso = DSO_dsobyaddr(&base_inited, DSO_FLAG_NO_UNLOAD_ON_FREE);
  163|       |        /*
  164|       |         * In case of No!, it is uncertain our exit()-handlers can still be
  165|       |         * called. After dlclose() the whole library might have been unloaded
  166|       |         * already.
  167|       |         */
  168|       |        OSSL_TRACE1(INIT, "obtained DSO reference? %s\n",
  169|       |                    (dso == NULL ? "No!" : "Yes."));
  170|       |        DSO_free(dso);
  171|       |        err_unshelve_state(err);
  172|       |    }
  173|       |# endif
  174|       |#endif
  175|       |
  176|      2|    return 1;
  177|      2|}
init.c:ossl_init_load_crypto_strings:
  182|      2|{
  183|      2|    int ret = 1;
  184|       |    /*
  185|       |     * OPENSSL_NO_AUTOERRINIT is provided here to prevent at compile time
  186|       |     * pulling in all the error strings during static linking
  187|       |     */
  188|      2|#if !defined(OPENSSL_NO_ERR) && !defined(OPENSSL_NO_AUTOERRINIT)
  189|      2|    void *err;
  190|       |
  191|      2|    if (!err_shelve_state(&err))
  ------------------
  |  Branch (191:9): [True: 0, False: 2]
  ------------------
  192|      0|        return 0;
  193|       |
  194|      2|    OSSL_TRACE(INIT, "ossl_err_load_crypto_strings()\n");
  ------------------
  |  |  287|      2|    OSSL_TRACEV(category, (trc_out, "%s", text))
  |  |  ------------------
  |  |  |  |  282|      2|#  define OSSL_TRACEV(category, args) ((void)0)
  |  |  ------------------
  ------------------
  195|      2|    ret = ossl_err_load_crypto_strings();
  196|       |
  197|      2|    err_unshelve_state(err);
  198|      2|#endif
  199|      2|    return ret;
  200|      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);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  238|      2|    }
  239|      2|}
ossl_init_thread_start:
  348|      2|{
  349|      2|    THREAD_EVENT_HANDLER **hands;
  350|      2|    THREAD_EVENT_HANDLER *hand;
  351|       |#ifdef FIPS_MODULE
  352|       |    OSSL_LIB_CTX *ctx = arg;
  353|       |
  354|       |    /*
  355|       |     * In FIPS mode the list of THREAD_EVENT_HANDLERs is unique per combination
  356|       |     * of OSSL_LIB_CTX and thread. This is because in FIPS mode each
  357|       |     * OSSL_LIB_CTX gets informed about thread stop events individually.
  358|       |     */
  359|       |    CRYPTO_THREAD_LOCAL *local
  360|       |        = ossl_lib_ctx_get_data(ctx, OSSL_LIB_CTX_THREAD_EVENT_HANDLER_INDEX);
  361|       |#else
  362|       |    /*
  363|       |     * Outside of FIPS mode the list of THREAD_EVENT_HANDLERs is unique per
  364|       |     * thread, but may hold multiple OSSL_LIB_CTXs. We only get told about
  365|       |     * thread stop events globally, so we have to ensure all affected
  366|       |     * OSSL_LIB_CTXs are informed.
  367|       |     */
  368|      2|    CRYPTO_THREAD_LOCAL *local = &destructor_key.value;
  369|      2|#endif
  370|       |
  371|      2|    hands = init_get_thread_local(local, 1, 0);
  372|      2|    if (hands == NULL)
  ------------------
  |  Branch (372:9): [True: 0, False: 2]
  ------------------
  373|      0|        return 0;
  374|       |
  375|       |#ifdef FIPS_MODULE
  376|       |    if (*hands == NULL) {
  377|       |        /*
  378|       |         * We've not yet registered any handlers for this thread. We need to get
  379|       |         * libcrypto to tell us about later thread stop events. c_thread_start
  380|       |         * is a callback to libcrypto defined in fipsprov.c
  381|       |         */
  382|       |        if (!c_thread_start(FIPS_get_core_handle(ctx), ossl_arg_thread_stop,
  383|       |                            ctx))
  384|       |            return 0;
  385|       |    }
  386|       |#endif
  387|       |
  388|      2|    hand = OPENSSL_malloc(sizeof(*hand));
  ------------------
  |  |   97|      2|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  389|      2|    if (hand == NULL)
  ------------------
  |  Branch (389:9): [True: 0, False: 2]
  ------------------
  390|      0|        return 0;
  391|       |
  392|      2|    hand->handfn = handfn;
  393|      2|    hand->arg = arg;
  394|      2|#ifndef FIPS_MODULE
  395|      2|    hand->index = index;
  396|      2|#endif
  397|      2|    hand->next = *hands;
  398|      2|    *hands = hand;
  399|       |
  400|      2|    return 1;
  401|      2|}
initthread.c:init_get_thread_local:
   95|      4|{
   96|      4|    THREAD_EVENT_HANDLER **hands = CRYPTO_THREAD_get_local(local);
   97|       |
   98|      4|    if (alloc) {
  ------------------
  |  Branch (98:9): [True: 2, False: 2]
  ------------------
   99|      2|        if (hands == NULL) {
  ------------------
  |  Branch (99:13): [True: 2, False: 0]
  ------------------
  100|       |
  101|      2|            if ((hands = OPENSSL_zalloc(sizeof(*hands))) == NULL)
  ------------------
  |  |   99|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      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);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      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);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  113|      0|                return NULL;
  114|      0|            }
  115|      2|#endif
  116|      2|        }
  117|      2|    } else if (!keep) {
  ------------------
  |  Branch (117:16): [True: 2, False: 0]
  ------------------
  118|      2|        CRYPTO_THREAD_set_local(local, NULL);
  119|      2|    }
  120|       |
  121|      4|    return hands;
  122|      4|}
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));
  ------------------
  |  |   99|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      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);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      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:
  304|      2|{
  305|      2|    THREAD_EVENT_HANDLER *curr, *prev = NULL, *tmp;
  306|      2|#ifndef FIPS_MODULE
  307|      2|    GLOBAL_TEVENT_REGISTER *gtr;
  308|      2|#endif
  309|       |
  310|       |    /* Can't do much about this */
  311|      2|    if (hands == NULL)
  ------------------
  |  Branch (311:9): [True: 0, False: 2]
  ------------------
  312|      0|        return;
  313|       |
  314|      2|#ifndef FIPS_MODULE
  315|      2|    gtr = get_global_tevent_register();
  316|      2|    if (gtr == NULL)
  ------------------
  |  Branch (316:9): [True: 0, False: 2]
  ------------------
  317|      0|        return;
  318|       |
  319|      2|    if (!CRYPTO_THREAD_write_lock(gtr->lock))
  ------------------
  |  Branch (319:9): [True: 0, False: 2]
  ------------------
  320|      0|        return;
  321|      2|#endif
  322|       |
  323|      2|    curr = *hands;
  324|      4|    while (curr != NULL) {
  ------------------
  |  Branch (324:12): [True: 2, False: 2]
  ------------------
  325|      2|        if (arg != NULL && curr->arg != arg) {
  ------------------
  |  Branch (325:13): [True: 0, False: 2]
  |  Branch (325:28): [True: 0, False: 0]
  ------------------
  326|      0|            prev = curr;
  327|      0|            curr = curr->next;
  328|      0|            continue;
  329|      0|        }
  330|      2|        curr->handfn(curr->arg);
  331|      2|        if (prev == NULL)
  ------------------
  |  Branch (331:13): [True: 2, False: 0]
  ------------------
  332|      2|            *hands = curr->next;
  333|      0|        else
  334|      0|            prev->next = curr->next;
  335|       |
  336|      2|        tmp = curr;
  337|      2|        curr = curr->next;
  338|       |
  339|      2|        OPENSSL_free(tmp);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  340|      2|    }
  341|      2|#ifndef FIPS_MODULE
  342|      2|    CRYPTO_THREAD_unlock(gtr->lock);
  343|      2|#endif
  344|      2|}
initthread.c:init_thread_deregister:
  405|      2|{
  406|      2|    GLOBAL_TEVENT_REGISTER *gtr;
  407|      2|    int i;
  408|       |
  409|      2|    gtr = get_global_tevent_register();
  410|      2|    if (gtr == NULL)
  ------------------
  |  Branch (410:9): [True: 0, False: 2]
  ------------------
  411|      0|        return 0;
  412|      2|    if (!all) {
  ------------------
  |  Branch (412:9): [True: 0, False: 2]
  ------------------
  413|      0|        if (!CRYPTO_THREAD_write_lock(gtr->lock))
  ------------------
  |  Branch (413:13): [True: 0, False: 0]
  ------------------
  414|      0|            return 0;
  415|      2|    } else {
  416|      2|        glob_tevent_reg = NULL;
  417|      2|    }
  418|      2|    for (i = 0; i < sk_THREAD_EVENT_HANDLER_PTR_num(gtr->skhands); i++) {
  ------------------
  |  Branch (418:17): [True: 0, False: 2]
  ------------------
  419|      0|        THREAD_EVENT_HANDLER **hands
  420|      0|            = sk_THREAD_EVENT_HANDLER_PTR_value(gtr->skhands, i);
  421|      0|        THREAD_EVENT_HANDLER *curr = NULL, *prev = NULL, *tmp;
  422|       |
  423|      0|        if (hands == NULL) {
  ------------------
  |  Branch (423:13): [True: 0, False: 0]
  ------------------
  424|      0|            if (!all)
  ------------------
  |  Branch (424:17): [True: 0, False: 0]
  ------------------
  425|      0|                CRYPTO_THREAD_unlock(gtr->lock);
  426|      0|            return 0;
  427|      0|        }
  428|      0|        curr = *hands;
  429|      0|        while (curr != NULL) {
  ------------------
  |  Branch (429:16): [True: 0, False: 0]
  ------------------
  430|      0|            if (all || curr->index == index) {
  ------------------
  |  Branch (430:17): [True: 0, False: 0]
  |  Branch (430:24): [True: 0, False: 0]
  ------------------
  431|      0|                if (prev != NULL)
  ------------------
  |  Branch (431:21): [True: 0, False: 0]
  ------------------
  432|      0|                    prev->next = curr->next;
  433|      0|                else
  434|      0|                    *hands = curr->next;
  435|      0|                tmp = curr;
  436|      0|                curr = curr->next;
  437|      0|                OPENSSL_free(tmp);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  438|      0|                continue;
  439|      0|            }
  440|      0|            prev = curr;
  441|      0|            curr = curr->next;
  442|      0|        }
  443|      0|        if (all)
  ------------------
  |  Branch (443:13): [True: 0, False: 0]
  ------------------
  444|      0|            OPENSSL_free(hands);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  445|      0|    }
  446|      2|    if (all) {
  ------------------
  |  Branch (446:9): [True: 2, False: 0]
  ------------------
  447|      2|        CRYPTO_THREAD_lock_free(gtr->lock);
  448|      2|        sk_THREAD_EVENT_HANDLER_PTR_free(gtr->skhands);
  449|      2|        OPENSSL_free(gtr);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  450|      2|    } else {
  451|      0|        CRYPTO_THREAD_unlock(gtr->lock);
  452|      0|    }
  453|      2|    return 1;
  454|      2|}

OPENSSL_LH_new:
   48|      2|{
   49|      2|    OPENSSL_LHASH *ret;
   50|       |
   51|      2|    if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
  ------------------
  |  |   99|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (51:9): [True: 0, False: 2]
  ------------------
   52|      0|        return NULL;
   53|      2|    if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)
  ------------------
  |  |   99|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (53:9): [True: 0, False: 2]
  ------------------
   54|      0|        goto err;
   55|      2|    ret->comp = ((c == NULL) ? (OPENSSL_LH_COMPFUNC)strcmp : c);
  ------------------
  |  Branch (55:18): [True: 0, False: 2]
  ------------------
   56|      2|    ret->hash = ((h == NULL) ? (OPENSSL_LH_HASHFUNC)OPENSSL_LH_strhash : h);
  ------------------
  |  Branch (56:18): [True: 0, False: 2]
  ------------------
   57|      2|    ret->num_nodes = MIN_NODES / 2;
  ------------------
  |  |   39|      2|#define MIN_NODES       16
  ------------------
   58|      2|    ret->num_alloc_nodes = MIN_NODES;
  ------------------
  |  |   39|      2|#define MIN_NODES       16
  ------------------
   59|      2|    ret->pmax = MIN_NODES / 2;
  ------------------
  |  |   39|      2|#define MIN_NODES       16
  ------------------
   60|      2|    ret->up_load = UP_LOAD;
  ------------------
  |  |   40|      2|#define UP_LOAD         (2*LH_LOAD_MULT) /* load times 256 (default 2) */
  |  |  ------------------
  |  |  |  |   81|      2|# define LH_LOAD_MULT    256
  |  |  ------------------
  ------------------
   61|      2|    ret->down_load = DOWN_LOAD;
  ------------------
  |  |   41|      2|#define DOWN_LOAD       (LH_LOAD_MULT) /* load times 256 (default 1) */
  |  |  ------------------
  |  |  |  |   81|      2|# define LH_LOAD_MULT    256
  |  |  ------------------
  ------------------
   62|      2|    return ret;
   63|       |
   64|      0|err:
   65|      0|    OPENSSL_free(ret->b);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   66|      0|    OPENSSL_free(ret);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   67|      0|    return NULL;
   68|      2|}
OPENSSL_LH_free:
   71|      4|{
   72|      4|    if (lh == NULL)
  ------------------
  |  Branch (72:9): [True: 2, False: 2]
  ------------------
   73|      2|        return;
   74|       |
   75|      2|    OPENSSL_LH_flush(lh);
   76|      2|    OPENSSL_free(lh->b);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   77|      2|    OPENSSL_free(lh);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   78|      2|}
OPENSSL_LH_flush:
   81|      2|{
   82|      2|    unsigned int i;
   83|      2|    OPENSSL_LH_NODE *n, *nn;
   84|       |
   85|      2|    if (lh == NULL)
  ------------------
  |  Branch (85:9): [True: 0, False: 2]
  ------------------
   86|      0|        return;
   87|       |
   88|  1.46k|    for (i = 0; i < lh->num_nodes; i++) {
  ------------------
  |  Branch (88:17): [True: 1.45k, False: 2]
  ------------------
   89|  1.45k|        n = lh->b[i];
   90|  4.37k|        while (n != NULL) {
  ------------------
  |  Branch (90:16): [True: 2.91k, False: 1.45k]
  ------------------
   91|  2.91k|            nn = n->next;
   92|  2.91k|            OPENSSL_free(n);
  ------------------
  |  |  107|  2.91k|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  2.91k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  2.91k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   93|  2.91k|            n = nn;
   94|  2.91k|        }
   95|  1.45k|        lh->b[i] = NULL;
   96|  1.45k|    }
   97|       |
   98|      2|    lh->num_items = 0;
   99|      2|}
OPENSSL_LH_insert:
  102|  8.49k|{
  103|  8.49k|    unsigned long hash;
  104|  8.49k|    OPENSSL_LH_NODE *nn, **rn;
  105|  8.49k|    void *ret;
  106|       |
  107|  8.49k|    lh->error = 0;
  108|  8.49k|    if ((lh->up_load <= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)) && !expand(lh))
  ------------------
  |  |   81|  8.49k|# define LH_LOAD_MULT    256
  ------------------
  |  Branch (108:9): [True: 1.44k, False: 7.05k]
  |  Branch (108:76): [True: 0, False: 1.44k]
  ------------------
  109|      0|        return NULL;        /* 'lh->error++' already done in 'expand' */
  110|       |
  111|  8.49k|    rn = getrn(lh, data, &hash);
  112|       |
  113|  8.49k|    if (*rn == NULL) {
  ------------------
  |  Branch (113:9): [True: 2.91k, False: 5.57k]
  ------------------
  114|  2.91k|        if ((nn = OPENSSL_malloc(sizeof(*nn))) == NULL) {
  ------------------
  |  |   97|  2.91k|        CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|  2.91k|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|  2.91k|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (114:13): [True: 0, False: 2.91k]
  ------------------
  115|      0|            lh->error++;
  116|      0|            return NULL;
  117|      0|        }
  118|  2.91k|        nn->data = data;
  119|  2.91k|        nn->next = NULL;
  120|  2.91k|        nn->hash = hash;
  121|  2.91k|        *rn = nn;
  122|  2.91k|        ret = NULL;
  123|  2.91k|        lh->num_items++;
  124|  5.57k|    } else {                    /* replace same key */
  125|  5.57k|        ret = (*rn)->data;
  126|  5.57k|        (*rn)->data = data;
  127|  5.57k|    }
  128|  8.49k|    return ret;
  129|  8.49k|}
OPENSSL_LH_retrieve:
  158|    136|{
  159|    136|    unsigned long hash;
  160|    136|    OPENSSL_LH_NODE **rn;
  161|       |
  162|    136|    if (lh->error != 0)
  ------------------
  |  Branch (162:9): [True: 0, False: 136]
  ------------------
  163|      0|        lh->error = 0;
  164|       |
  165|    136|    rn = getrn(lh, data, &hash);
  166|       |
  167|    136|    return *rn == NULL ? NULL : (*rn)->data;
  ------------------
  |  Branch (167:12): [True: 136, False: 0]
  ------------------
  168|    136|}
lhash.c:expand:
  208|  1.44k|{
  209|  1.44k|    OPENSSL_LH_NODE **n, **n1, **n2, *np;
  210|  1.44k|    unsigned int p, pmax, nni, j;
  211|  1.44k|    unsigned long hash;
  212|       |
  213|  1.44k|    nni = lh->num_alloc_nodes;
  214|  1.44k|    p = lh->p;
  215|  1.44k|    pmax = lh->pmax;
  216|  1.44k|    if (p + 1 >= pmax) {
  ------------------
  |  Branch (216:9): [True: 12, False: 1.43k]
  ------------------
  217|     12|        j = nni * 2;
  218|     12|        n = OPENSSL_realloc(lh->b, sizeof(OPENSSL_LH_NODE *) * j);
  ------------------
  |  |  101|     12|        CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     12|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     12|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  219|     12|        if (n == NULL) {
  ------------------
  |  Branch (219:13): [True: 0, False: 12]
  ------------------
  220|      0|            lh->error++;
  221|      0|            return 0;
  222|      0|        }
  223|     12|        lh->b = n;
  224|     12|        memset(n + nni, 0, sizeof(*n) * (j - nni));
  225|     12|        lh->pmax = nni;
  226|     12|        lh->num_alloc_nodes = j;
  227|     12|        lh->p = 0;
  228|  1.43k|    } else {
  229|  1.43k|        lh->p++;
  230|  1.43k|    }
  231|       |
  232|  1.44k|    lh->num_nodes++;
  233|  1.44k|    n1 = &(lh->b[p]);
  234|  1.44k|    n2 = &(lh->b[p + pmax]);
  235|  1.44k|    *n2 = NULL;
  236|       |
  237|  6.54k|    for (np = *n1; np != NULL;) {
  ------------------
  |  Branch (237:20): [True: 5.10k, False: 1.44k]
  ------------------
  238|  5.10k|        hash = np->hash;
  239|  5.10k|        if ((hash % nni) != p) { /* move it */
  ------------------
  |  Branch (239:13): [True: 794, False: 4.31k]
  ------------------
  240|    794|            *n1 = (*n1)->next;
  241|    794|            np->next = *n2;
  242|    794|            *n2 = np;
  243|    794|        } else
  244|  4.31k|            n1 = &((*n1)->next);
  245|  5.10k|        np = *n1;
  246|  5.10k|    }
  247|       |
  248|  1.44k|    return 1;
  249|  1.44k|}
lhash.c:getrn:
  286|  8.63k|{
  287|  8.63k|    OPENSSL_LH_NODE **ret, *n1;
  288|  8.63k|    unsigned long hash, nn;
  289|  8.63k|    OPENSSL_LH_COMPFUNC cf;
  290|       |
  291|  8.63k|    hash = (*(lh->hash)) (data);
  292|  8.63k|    *rhash = hash;
  293|       |
  294|  8.63k|    nn = hash % lh->pmax;
  295|  8.63k|    if (nn < lh->p)
  ------------------
  |  Branch (295:9): [True: 3.85k, False: 4.77k]
  ------------------
  296|  3.85k|        nn = hash % lh->num_alloc_nodes;
  297|       |
  298|  8.63k|    cf = lh->comp;
  299|  8.63k|    ret = &(lh->b[(int)nn]);
  300|  21.6k|    for (n1 = *ret; n1 != NULL; n1 = n1->next) {
  ------------------
  |  Branch (300:21): [True: 18.5k, False: 3.05k]
  ------------------
  301|  18.5k|        if (n1->hash != hash) {
  ------------------
  |  Branch (301:13): [True: 12.6k, False: 5.87k]
  ------------------
  302|  12.6k|            ret = &(n1->next);
  303|  12.6k|            continue;
  304|  12.6k|        }
  305|  5.87k|        if (cf(n1->data, data) == 0)
  ------------------
  |  Branch (305:13): [True: 5.57k, False: 292]
  ------------------
  306|  5.57k|            break;
  307|    292|        ret = &(n1->next);
  308|    292|    }
  309|  8.63k|    return ret;
  310|  8.63k|}

CRYPTO_malloc:
  172|   108k|{
  173|   108k|    void *ptr;
  174|       |
  175|   108k|    INCREMENT(malloc_count);
  176|   108k|    if (malloc_impl != CRYPTO_malloc) {
  ------------------
  |  Branch (176:9): [True: 0, False: 108k]
  ------------------
  177|      0|        ptr = malloc_impl(num, file, line);
  178|      0|        if (ptr != NULL || num == 0)
  ------------------
  |  Branch (178:13): [True: 0, False: 0]
  |  Branch (178:28): [True: 0, False: 0]
  ------------------
  179|      0|            return ptr;
  180|      0|        goto err;
  181|      0|    }
  182|       |
  183|   108k|    if (num == 0)
  ------------------
  |  Branch (183:9): [True: 0, False: 108k]
  ------------------
  184|      0|        return NULL;
  185|       |
  186|   108k|    FAILTEST();
  187|   108k|    if (allow_customize) {
  ------------------
  |  Branch (187:9): [True: 2, False: 108k]
  ------------------
  188|       |        /*
  189|       |         * Disallow customization after the first allocation. We only set this
  190|       |         * if necessary to avoid a store to the same cache line on every
  191|       |         * allocation.
  192|       |         */
  193|      2|        allow_customize = 0;
  194|      2|    }
  195|       |
  196|   108k|    ptr = malloc(num);
  197|   108k|    if (ptr != NULL)
  ------------------
  |  Branch (197:9): [True: 108k, False: 0]
  ------------------
  198|   108k|        return ptr;
  199|      0| err:
  200|       |    /*
  201|       |     * ossl_err_get_state_int() in err.c uses CRYPTO_zalloc(num, NULL, 0) for
  202|       |     * ERR_STATE allocation. Prevent mem alloc error loop while reporting error.
  203|       |     */
  204|      0|    if (file != NULL || line != 0) {
  ------------------
  |  Branch (204:9): [True: 0, False: 0]
  |  Branch (204:25): [True: 0, False: 0]
  ------------------
  205|      0|        ERR_new();
  206|      0|        ERR_set_debug(file, line, NULL);
  207|      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
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  208|      0|    }
  209|      0|    return NULL;
  210|   108k|}
CRYPTO_zalloc:
  213|  98.2k|{
  214|  98.2k|    void *ret;
  215|       |
  216|  98.2k|    ret = CRYPTO_malloc(num, file, line);
  217|  98.2k|    if (ret != NULL)
  ------------------
  |  Branch (217:9): [True: 98.2k, False: 0]
  ------------------
  218|  98.2k|        memset(ret, 0, num);
  219|       |
  220|  98.2k|    return ret;
  221|  98.2k|}
CRYPTO_realloc:
  224|     12|{
  225|     12|    INCREMENT(realloc_count);
  226|     12|    if (realloc_impl != CRYPTO_realloc)
  ------------------
  |  Branch (226:9): [True: 0, False: 12]
  ------------------
  227|      0|        return realloc_impl(str, num, file, line);
  228|       |
  229|     12|    if (str == NULL)
  ------------------
  |  Branch (229:9): [True: 0, False: 12]
  ------------------
  230|      0|        return CRYPTO_malloc(num, file, line);
  231|       |
  232|     12|    if (num == 0) {
  ------------------
  |  Branch (232:9): [True: 0, False: 12]
  ------------------
  233|      0|        CRYPTO_free(str, file, line);
  234|      0|        return NULL;
  235|      0|    }
  236|       |
  237|     12|    FAILTEST();
  238|     12|    return realloc(str, num);
  239|     12|}
CRYPTO_free:
  269|   214k|{
  270|   214k|    INCREMENT(free_count);
  271|   214k|    if (free_impl != CRYPTO_free) {
  ------------------
  |  Branch (271:9): [True: 0, False: 214k]
  ------------------
  272|      0|        free_impl(str, file, line);
  273|      0|        return;
  274|      0|    }
  275|       |
  276|   214k|    free(str);
  277|   214k|}
CRYPTO_clear_free:
  280|  62.6k|{
  281|  62.6k|    if (str == NULL)
  ------------------
  |  Branch (281:9): [True: 0, False: 62.6k]
  ------------------
  282|      0|        return;
  283|  62.6k|    if (num)
  ------------------
  |  Branch (283:9): [True: 62.6k, False: 0]
  ------------------
  284|  62.6k|        OPENSSL_cleanse(str, num);
  285|  62.6k|    CRYPTO_free(str, file, line);
  286|  62.6k|}

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:
  595|      2|{
  596|      2|    OPENSSL_free(sh.freelist);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  597|      2|    OPENSSL_free(sh.bittable);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  598|      2|    OPENSSL_free(sh.bitmalloc);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  599|      2|#if !defined(_WIN32)
  600|      2|    if (sh.map_result != MAP_FAILED && sh.map_size)
  ------------------
  |  Branch (600:9): [True: 2, False: 0]
  |  Branch (600:40): [True: 0, False: 2]
  ------------------
  601|      0|        munmap(sh.map_result, sh.map_size);
  602|       |#else
  603|       |    if (sh.map_result != NULL && sh.map_size)
  604|       |        VirtualFree(sh.map_result, 0, MEM_RELEASE);
  605|       |#endif
  606|      2|    memset(&sh, 0, sizeof(sh));
  607|      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:
   68|      2|{
   69|      2|#ifndef OPENSSL_NO_ERR
   70|      2|    if (ERR_reason_error_string(PEM_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (70:9): [True: 2, False: 0]
  ------------------
   71|      2|        ERR_load_strings_const(PEM_str_reasons);
   72|      2|#endif
   73|      2|    return 1;
   74|      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_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_err_load_RAND_strings:
  101|      2|{
  102|      2|#ifndef OPENSSL_NO_ERR
  103|      2|    if (ERR_reason_error_string(RAND_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (103:9): [True: 2, False: 0]
  ------------------
  104|      2|        ERR_load_strings_const(RAND_str_reasons);
  105|      2|#endif
  106|      2|    return 1;
  107|      2|}

ossl_rand_cleanup_int:
   80|      2|{
   81|      2|# ifndef OPENSSL_NO_DEPRECATED_3_0
   82|      2|    const RAND_METHOD *meth = default_RAND_meth;
   83|       |
   84|      2|    if (!rand_inited)
  ------------------
  |  Branch (84:9): [True: 2, False: 0]
  ------------------
   85|      2|        return;
   86|       |
   87|      0|    if (meth != NULL && meth->cleanup != NULL)
  ------------------
  |  Branch (87:9): [True: 0, False: 0]
  |  Branch (87:25): [True: 0, False: 0]
  ------------------
   88|      0|        meth->cleanup();
   89|      0|    RAND_set_rand_method(NULL);
   90|      0|# endif
   91|      0|    ossl_rand_pool_cleanup();
   92|      0|# ifndef OPENSSL_NO_ENGINE
   93|      0|    CRYPTO_THREAD_lock_free(rand_engine_lock);
   94|      0|    rand_engine_lock = NULL;
   95|      0|# endif
   96|      0|# ifndef OPENSSL_NO_DEPRECATED_3_0
   97|      0|    CRYPTO_THREAD_lock_free(rand_meth_lock);
   98|      0|    rand_meth_lock = NULL;
   99|      0|# endif
  100|      0|    ossl_release_default_drbg_ctx();
  101|      0|    rand_inited = 0;
  102|      0|}

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|}

OPENSSL_sk_new_null:
  131|      2|{
  132|      2|    return OPENSSL_sk_new_reserve(NULL, 0);
  133|      2|}
OPENSSL_sk_new_reserve:
  227|      2|{
  228|      2|    OPENSSL_STACK *st = OPENSSL_zalloc(sizeof(OPENSSL_STACK));
  ------------------
  |  |   99|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  229|       |
  230|      2|    if (st == NULL)
  ------------------
  |  Branch (230:9): [True: 0, False: 2]
  ------------------
  231|      0|        return NULL;
  232|       |
  233|      2|    st->comp = c;
  234|       |
  235|      2|    if (n <= 0)
  ------------------
  |  Branch (235:9): [True: 2, False: 0]
  ------------------
  236|      2|        return st;
  237|       |
  238|      0|    if (!sk_reserve(st, n, 1)) {
  ------------------
  |  Branch (238:9): [True: 0, False: 0]
  ------------------
  239|      0|        OPENSSL_sk_free(st);
  240|      0|        return NULL;
  241|      0|    }
  242|       |
  243|      0|    return st;
  244|      0|}
OPENSSL_sk_insert:
  259|      2|{
  260|      2|    if (st == NULL) {
  ------------------
  |  Branch (260:9): [True: 0, False: 2]
  ------------------
  261|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  262|      0|        return 0;
  263|      0|    }
  264|      2|    if (st->num == max_nodes) {
  ------------------
  |  Branch (264:9): [True: 0, False: 2]
  ------------------
  265|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  266|      0|        return 0;
  267|      0|    }
  268|       |
  269|      2|    if (!sk_reserve(st, 1, 0))
  ------------------
  |  Branch (269:9): [True: 0, False: 2]
  ------------------
  270|      0|        return 0;
  271|       |
  272|      2|    if ((loc >= st->num) || (loc < 0)) {
  ------------------
  |  Branch (272:9): [True: 2, False: 0]
  |  Branch (272:29): [True: 0, False: 0]
  ------------------
  273|      2|        st->data[st->num] = data;
  274|      2|    } else {
  275|      0|        memmove(&st->data[loc + 1], &st->data[loc],
  276|      0|                sizeof(st->data[0]) * (st->num - loc));
  277|      0|        st->data[loc] = data;
  278|      0|    }
  279|      2|    st->num++;
  280|      2|    st->sorted = 0;
  281|      2|    return st->num;
  282|      2|}
OPENSSL_sk_delete:
  310|      2|{
  311|      2|    if (st == NULL || loc < 0 || loc >= st->num)
  ------------------
  |  Branch (311:9): [True: 0, False: 2]
  |  Branch (311:23): [True: 0, False: 2]
  |  Branch (311:34): [True: 0, False: 2]
  ------------------
  312|      0|        return NULL;
  313|       |
  314|      2|    return internal_delete(st, loc);
  315|      2|}
OPENSSL_sk_push:
  398|      2|{
  399|      2|    if (st == NULL)
  ------------------
  |  Branch (399:9): [True: 0, False: 2]
  ------------------
  400|      0|        return -1;
  401|      2|    return OPENSSL_sk_insert(st, data, st->num);
  402|      2|}
OPENSSL_sk_pop_free:
  432|      4|{
  433|      4|    int i;
  434|       |
  435|      4|    if (st == NULL)
  ------------------
  |  Branch (435:9): [True: 4, False: 0]
  ------------------
  436|      4|        return;
  437|      0|    for (i = 0; i < st->num; i++)
  ------------------
  |  Branch (437:17): [True: 0, False: 0]
  ------------------
  438|      0|        if (st->data[i] != NULL)
  ------------------
  |  Branch (438:13): [True: 0, False: 0]
  ------------------
  439|      0|            func((char *)st->data[i]);
  440|      0|    OPENSSL_sk_free(st);
  441|      0|}
OPENSSL_sk_free:
  444|     10|{
  445|     10|    if (st == NULL)
  ------------------
  |  Branch (445:9): [True: 8, False: 2]
  ------------------
  446|      8|        return;
  447|      2|    OPENSSL_free(st->data);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  448|      2|    OPENSSL_free(st);
  ------------------
  |  |  107|      2|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  449|      2|}
OPENSSL_sk_num:
  452|     10|{
  453|     10|    return st == NULL ? -1 : st->num;
  ------------------
  |  Branch (453:12): [True: 6, False: 4]
  ------------------
  454|     10|}
OPENSSL_sk_value:
  457|      2|{
  458|      2|    if (st == NULL || i < 0 || i >= st->num)
  ------------------
  |  Branch (458:9): [True: 0, False: 2]
  |  Branch (458:23): [True: 0, False: 2]
  |  Branch (458:32): [True: 0, False: 2]
  ------------------
  459|      0|        return NULL;
  460|      2|    return (void *)st->data[i];
  461|      2|}
stack.c:sk_reserve:
  178|      2|{
  179|      2|    const void **tmpdata;
  180|      2|    int num_alloc;
  181|       |
  182|       |    /* Check to see the reservation isn't exceeding the hard limit */
  183|      2|    if (n > max_nodes - st->num) {
  ------------------
  |  Branch (183:9): [True: 0, False: 2]
  ------------------
  184|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  185|      0|        return 0;
  186|      0|    }
  187|       |
  188|       |    /* Figure out the new size */
  189|      2|    num_alloc = st->num + n;
  190|      2|    if (num_alloc < min_nodes)
  ------------------
  |  Branch (190:9): [True: 2, False: 0]
  ------------------
  191|      2|        num_alloc = min_nodes;
  192|       |
  193|       |    /* If |st->data| allocation was postponed */
  194|      2|    if (st->data == NULL) {
  ------------------
  |  Branch (194:9): [True: 2, False: 0]
  ------------------
  195|       |        /*
  196|       |         * At this point, |st->num_alloc| and |st->num| are 0;
  197|       |         * so |num_alloc| value is |n| or |min_nodes| if greater than |n|.
  198|       |         */
  199|      2|        if ((st->data = OPENSSL_zalloc(sizeof(void *) * num_alloc)) == NULL)
  ------------------
  |  |   99|      2|        CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      2|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      2|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  |  Branch (199:13): [True: 0, False: 2]
  ------------------
  200|      0|            return 0;
  201|      2|        st->num_alloc = num_alloc;
  202|      2|        return 1;
  203|      2|    }
  204|       |
  205|      0|    if (!exact) {
  ------------------
  |  Branch (205:9): [True: 0, False: 0]
  ------------------
  206|      0|        if (num_alloc <= st->num_alloc)
  ------------------
  |  Branch (206:13): [True: 0, False: 0]
  ------------------
  207|      0|            return 1;
  208|      0|        num_alloc = compute_growth(num_alloc, st->num_alloc);
  209|      0|        if (num_alloc == 0) {
  ------------------
  |  Branch (209:13): [True: 0, False: 0]
  ------------------
  210|      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),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  |  |  ------------------
  |  |  |  |                    ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC),     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  300|      0|#    define OPENSSL_FUNC __func__
  |  |  |  |  ------------------
  |  |  |  |  405|      0|     ERR_set_error)
  |  |  ------------------
  ------------------
  211|      0|            return 0;
  212|      0|        }
  213|      0|    } else if (num_alloc == st->num_alloc) {
  ------------------
  |  Branch (213:16): [True: 0, False: 0]
  ------------------
  214|      0|        return 1;
  215|      0|    }
  216|       |
  217|      0|    tmpdata = OPENSSL_realloc((void *)st->data, sizeof(void *) * num_alloc);
  ------------------
  |  |  101|      0|        CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  218|      0|    if (tmpdata == NULL)
  ------------------
  |  Branch (218:9): [True: 0, False: 0]
  ------------------
  219|      0|        return 0;
  220|       |
  221|      0|    st->data = tmpdata;
  222|      0|    st->num_alloc = num_alloc;
  223|      0|    return 1;
  224|      0|}
stack.c:internal_delete:
  285|      2|{
  286|      2|    const void *ret = st->data[loc];
  287|       |
  288|      2|    if (loc != st->num - 1)
  ------------------
  |  Branch (288:9): [True: 0, False: 2]
  ------------------
  289|      0|        memmove(&st->data[loc], &st->data[loc + 1],
  290|      0|                sizeof(st->data[0]) * (st->num - loc - 1));
  291|      2|    st->num--;
  292|       |
  293|      2|    return (void *)ret;
  294|      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|}

CRYPTO_THREAD_lock_new:
   46|     10|{
   47|     10|# ifdef USE_RWLOCK
   48|     10|    CRYPTO_RWLOCK *lock;
   49|       |
   50|     10|    if ((lock = CRYPTO_zalloc(sizeof(pthread_rwlock_t), NULL, 0)) == NULL)
  ------------------
  |  Branch (50:9): [True: 0, False: 10]
  ------------------
   51|       |        /* Don't set error, to avoid recursion blowup. */
   52|      0|        return NULL;
   53|       |
   54|     10|    if (pthread_rwlock_init(lock, NULL) != 0) {
  ------------------
  |  Branch (54:9): [True: 0, False: 10]
  ------------------
   55|      0|        OPENSSL_free(lock);
  ------------------
  |  |  107|      0|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
   56|      0|        return NULL;
   57|      0|    }
   58|       |# else
   59|       |    pthread_mutexattr_t attr;
   60|       |    CRYPTO_RWLOCK *lock;
   61|       |
   62|       |    if ((lock = CRYPTO_zalloc(sizeof(pthread_mutex_t), NULL, 0)) == NULL)
   63|       |        /* Don't set error, to avoid recursion blowup. */
   64|       |        return NULL;
   65|       |
   66|       |    /*
   67|       |     * We don't use recursive mutexes, but try to catch errors if we do.
   68|       |     */
   69|       |    pthread_mutexattr_init(&attr);
   70|       |#  if !defined (__TANDEM) && !defined (_SPT_MODEL_)
   71|       |#   if !defined(NDEBUG) && !defined(OPENSSL_NO_MUTEX_ERRORCHECK)
   72|       |    pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK);
   73|       |#   endif
   74|       |#  else
   75|       |    /* The SPT Thread Library does not define MUTEX attributes. */
   76|       |#  endif
   77|       |
   78|       |    if (pthread_mutex_init(lock, &attr) != 0) {
   79|       |        pthread_mutexattr_destroy(&attr);
   80|       |        OPENSSL_free(lock);
   81|       |        return NULL;
   82|       |    }
   83|       |
   84|       |    pthread_mutexattr_destroy(&attr);
   85|       |# endif
   86|       |
   87|     10|    return lock;
   88|     10|}
CRYPTO_THREAD_read_lock:
   91|    136|{
   92|    136|# ifdef USE_RWLOCK
   93|    136|    if (pthread_rwlock_rdlock(lock) != 0)
  ------------------
  |  Branch (93:9): [True: 0, False: 136]
  ------------------
   94|      0|        return 0;
   95|       |# else
   96|       |    if (pthread_mutex_lock(lock) != 0) {
   97|       |        assert(errno != EDEADLK && errno != EBUSY);
   98|       |        return 0;
   99|       |    }
  100|       |# endif
  101|       |
  102|    136|    return 1;
  103|    136|}
CRYPTO_THREAD_write_lock:
  106|    218|{
  107|    218|# ifdef USE_RWLOCK
  108|    218|    if (pthread_rwlock_wrlock(lock) != 0)
  ------------------
  |  Branch (108:9): [True: 0, False: 218]
  ------------------
  109|      0|        return 0;
  110|       |# else
  111|       |    if (pthread_mutex_lock(lock) != 0) {
  112|       |        assert(errno != EDEADLK && errno != EBUSY);
  113|       |        return 0;
  114|       |    }
  115|       |# endif
  116|       |
  117|    218|    return 1;
  118|    218|}
CRYPTO_THREAD_unlock:
  121|    354|{
  122|    354|# ifdef USE_RWLOCK
  123|    354|    if (pthread_rwlock_unlock(lock) != 0)
  ------------------
  |  Branch (123:9): [True: 0, False: 354]
  ------------------
  124|      0|        return 0;
  125|       |# else
  126|       |    if (pthread_mutex_unlock(lock) != 0) {
  127|       |        assert(errno != EPERM);
  128|       |        return 0;
  129|       |    }
  130|       |# endif
  131|       |
  132|    354|    return 1;
  133|    354|}
CRYPTO_THREAD_lock_free:
  136|     22|{
  137|     22|    if (lock == NULL)
  ------------------
  |  Branch (137:9): [True: 12, False: 10]
  ------------------
  138|     12|        return;
  139|       |
  140|     10|# ifdef USE_RWLOCK
  141|     10|    pthread_rwlock_destroy(lock);
  142|       |# else
  143|       |    pthread_mutex_destroy(lock);
  144|       |# endif
  145|     10|    OPENSSL_free(lock);
  ------------------
  |  |  107|     10|        CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  279|     10|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                       CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
  |  |  ------------------
  |  |  |  |  280|     10|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  ------------------
  146|       |
  147|     10|    return;
  148|     22|}
CRYPTO_THREAD_run_once:
  151|  6.45k|{
  152|  6.45k|    if (pthread_once(once, init) != 0)
  ------------------
  |  Branch (152:9): [True: 0, False: 6.45k]
  ------------------
  153|      0|        return 0;
  154|       |
  155|  6.45k|    return 1;
  156|  6.45k|}
CRYPTO_THREAD_init_local:
  159|      6|{
  160|      6|    if (pthread_key_create(key, cleanup) != 0)
  ------------------
  |  Branch (160:9): [True: 0, False: 6]
  ------------------
  161|      0|        return 0;
  162|       |
  163|      6|    return 1;
  164|      6|}
CRYPTO_THREAD_get_local:
  167|  3.15k|{
  168|  3.15k|    return pthread_getspecific(*key);
  169|  3.15k|}
CRYPTO_THREAD_set_local:
  172|     14|{
  173|     14|    if (pthread_setspecific(*key, val) != 0)
  ------------------
  |  Branch (173:9): [True: 0, False: 14]
  ------------------
  174|      0|        return 0;
  175|       |
  176|     14|    return 1;
  177|     14|}
CRYPTO_THREAD_cleanup_local:
  180|      6|{
  181|      6|    if (pthread_key_delete(*key) != 0)
  ------------------
  |  Branch (181:9): [True: 0, False: 6]
  ------------------
  182|      0|        return 0;
  183|       |
  184|      6|    return 1;
  185|      6|}
CRYPTO_atomic_or:
  225|      2|{
  226|      2|# if defined(__GNUC__) && defined(__ATOMIC_ACQ_REL) && !defined(BROKEN_CLANG_ATOMICS)
  227|      2|    if (__atomic_is_lock_free(sizeof(*val), val)) {
  ------------------
  |  Branch (227:9): [Folded - Ignored]
  ------------------
  228|      2|        *ret = __atomic_or_fetch(val, op, __ATOMIC_ACQ_REL);
  229|      2|        return 1;
  230|      2|    }
  231|       |# elif defined(__sun) && (defined(__SunOS_5_10) || defined(__SunOS_5_11))
  232|       |    /* This will work for all future Solaris versions. */
  233|       |    if (ret != NULL) {
  234|       |        *ret = atomic_or_64_nv(val, op);
  235|       |        return 1;
  236|       |    }
  237|       |# endif
  238|      0|    if (lock == NULL || !CRYPTO_THREAD_write_lock(lock))
  ------------------
  |  Branch (238:9): [True: 0, False: 0]
  |  Branch (238:25): [True: 0, False: 0]
  ------------------
  239|      0|        return 0;
  240|      0|    *val |= op;
  241|      0|    *ret  = *val;
  242|       |
  243|      0|    if (!CRYPTO_THREAD_unlock(lock))
  ------------------
  |  Branch (243:9): [True: 0, False: 0]
  ------------------
  244|      0|        return 0;
  245|       |
  246|      0|    return 1;
  247|      0|}
CRYPTO_atomic_load:
  250|  3.15k|{
  251|  3.15k|# if defined(__GNUC__) && defined(__ATOMIC_ACQUIRE) && !defined(BROKEN_CLANG_ATOMICS)
  252|  3.15k|    if (__atomic_is_lock_free(sizeof(*val), val)) {
  ------------------
  |  Branch (252:9): [Folded - Ignored]
  ------------------
  253|  3.15k|        __atomic_load(val, ret, __ATOMIC_ACQUIRE);
  254|  3.15k|        return 1;
  255|  3.15k|    }
  256|       |# elif defined(__sun) && (defined(__SunOS_5_10) || defined(__SunOS_5_11))
  257|       |    /* This will work for all future Solaris versions. */
  258|       |    if (ret != NULL) {
  259|       |        *ret = atomic_or_64_nv(val, 0);
  260|       |        return 1;
  261|       |    }
  262|       |# endif
  263|      0|    if (lock == NULL || !CRYPTO_THREAD_read_lock(lock))
  ------------------
  |  Branch (263:9): [True: 0, False: 0]
  |  Branch (263:25): [True: 0, False: 0]
  ------------------
  264|      0|        return 0;
  265|      0|    *ret  = *val;
  266|      0|    if (!CRYPTO_THREAD_unlock(lock))
  ------------------
  |  Branch (266:9): [True: 0, False: 0]
  ------------------
  267|      0|        return 0;
  268|       |
  269|      0|    return 1;
  270|      0|}

ossl_trace_cleanup:
  338|      2|{
  339|       |#ifndef OPENSSL_NO_TRACE
  340|       |    int category;
  341|       |    BIO *channel = NULL;
  342|       |    const char *prefix = NULL;
  343|       |    const char *suffix = NULL;
  344|       |
  345|       |    for (category = 0; category < OSSL_TRACE_CATEGORY_NUM; category++) {
  346|       |        /* We force the TRACE category to be treated last */
  347|       |        if (category == OSSL_TRACE_CATEGORY_TRACE)
  348|       |            continue;
  349|       |        set_trace_data(category, 0, &channel, &prefix, &suffix,
  350|       |                       trace_attach_cb, trace_detach_cb);
  351|       |    }
  352|       |    set_trace_data(OSSL_TRACE_CATEGORY_TRACE, 0, &channel,
  353|       |                   &prefix, &suffix,
  354|       |                   trace_attach_cb, trace_detach_cb);
  355|       |    CRYPTO_THREAD_lock_free(trace_lock);
  356|       |#endif
  357|      2|}
OSSL_trace_set_channel:
  360|      2|{
  361|       |#ifndef OPENSSL_NO_TRACE
  362|       |    if (category >= 0 && category < OSSL_TRACE_CATEGORY_NUM)
  363|       |        return set_trace_data(category, SIMPLE_CHANNEL, &channel, NULL, NULL,
  364|       |                              trace_attach_cb, trace_detach_cb);
  365|       |#endif
  366|      2|    return 0;
  367|      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:
  144|      2|{
  145|      2|#ifndef OPENSSL_NO_ERR
  146|      2|    if (ERR_reason_error_string(X509V3_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (146:9): [True: 2, False: 0]
  ------------------
  147|      2|        ERR_load_strings_const(X509V3_str_reasons);
  148|      2|#endif
  149|      2|    return 1;
  150|      2|}

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

FuzzerInitialize:
   23|      2|{
   24|      2|    OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
  ------------------
  |  |  450|      2|# define OPENSSL_INIT_LOAD_CRYPTO_STRINGS    0x00000002L
  ------------------
   25|      2|    ERR_clear_error();
   26|       |
   27|      2|    return 1;
   28|      2|}
FuzzerTestOneInput:
   31|  3.14k|{
   32|  3.14k|    int success = 0;
   33|  3.14k|    size_t l1 = 0, l2 = 0, l3 = 0;
   34|  3.14k|    int s1 = 0, s3 = 0;
   35|  3.14k|    BN_CTX *ctx;
   36|  3.14k|    BIGNUM *b1;
   37|  3.14k|    BIGNUM *b2;
   38|  3.14k|    BIGNUM *b3;
   39|  3.14k|    BIGNUM *b4;
   40|  3.14k|    BIGNUM *b5;
   41|       |
   42|  3.14k|    b1 = BN_new();
   43|  3.14k|    b2 = BN_new();
   44|  3.14k|    b3 = BN_new();
   45|  3.14k|    b4 = BN_new();
   46|  3.14k|    b5 = BN_new();
   47|  3.14k|    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.14k|    if (len > 2) {
  ------------------
  |  Branch (53:9): [True: 3.14k, False: 2]
  ------------------
   54|  3.14k|        len -= 3;
   55|  3.14k|        l1 = (buf[0] * len) / 255;
   56|  3.14k|        ++buf;
   57|  3.14k|        l2 = (buf[0] * (len - l1)) / 255;
   58|  3.14k|        ++buf;
   59|  3.14k|        l3 = len - l1 - l2;
   60|       |
   61|  3.14k|        s1 = buf[0] & 1;
   62|  3.14k|        s3 = buf[0] & 4;
   63|  3.14k|        ++buf;
   64|  3.14k|    }
   65|  3.14k|    OPENSSL_assert(BN_bin2bn(buf, l1, b1) == b1);
  ------------------
  |  |  421|  3.14k|    (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1))
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                   (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1))
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |  |  Branch (421:12): [True: 3.14k, False: 0]
  |  |  ------------------
  ------------------
   66|  3.14k|    BN_set_negative(b1, s1);
   67|  3.14k|    OPENSSL_assert(BN_bin2bn(buf + l1, l2, b2) == b2);
  ------------------
  |  |  421|  3.14k|    (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1))
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                   (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1))
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |  |  Branch (421:12): [True: 3.14k, False: 0]
  |  |  ------------------
  ------------------
   68|  3.14k|    OPENSSL_assert(BN_bin2bn(buf + l1 + l2, l3, b3) == b3);
  ------------------
  |  |  421|  3.14k|    (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1))
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                   (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1))
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |  |  Branch (421:12): [True: 3.14k, False: 0]
  |  |  ------------------
  ------------------
   69|  3.14k|    BN_set_negative(b3, s3);
   70|       |
   71|       |    /* mod 0 is undefined */
   72|  3.14k|    if (BN_is_zero(b3)) {
  ------------------
  |  Branch (72:9): [True: 61, False: 3.08k]
  ------------------
   73|     61|        success = 1;
   74|     61|        goto done;
   75|     61|    }
   76|       |
   77|  3.08k|    OPENSSL_assert(BN_mod_exp(b4, b1, b2, b3, ctx));
  ------------------
  |  |  421|  3.08k|    (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1))
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                   (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1))
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |  |  Branch (421:12): [True: 3.08k, False: 0]
  |  |  ------------------
  ------------------
   78|  3.08k|    OPENSSL_assert(BN_mod_exp_simple(b5, b1, b2, b3, ctx));
  ------------------
  |  |  421|  3.08k|    (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1))
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                   (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1))
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |  |  Branch (421:12): [True: 3.08k, False: 0]
  |  |  ------------------
  ------------------
   79|       |
   80|  3.08k|    success = BN_cmp(b4, b5) == 0;
   81|  3.08k|    if (!success) {
  ------------------
  |  Branch (81:9): [True: 0, False: 3.08k]
  ------------------
   82|      0|        BN_print_fp(stdout, b1);
   83|      0|        putchar('\n');
   84|      0|        BN_print_fp(stdout, b2);
   85|      0|        putchar('\n');
   86|      0|        BN_print_fp(stdout, b3);
   87|      0|        putchar('\n');
   88|      0|        BN_print_fp(stdout, b4);
   89|      0|        putchar('\n');
   90|      0|        BN_print_fp(stdout, b5);
   91|      0|        putchar('\n');
   92|      0|    }
   93|       |
   94|  3.14k| done:
   95|  3.14k|    OPENSSL_assert(success);
  ------------------
  |  |  421|  3.14k|    (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1))
  |  |  ------------------
  |  |  |  |  279|      0|#   define OPENSSL_FILE __FILE__
  |  |  ------------------
  |  |                   (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1))
  |  |  ------------------
  |  |  |  |  280|      0|#   define OPENSSL_LINE __LINE__
  |  |  ------------------
  |  |  |  Branch (421:12): [True: 3.14k, False: 0]
  |  |  ------------------
  ------------------
   96|  3.14k|    BN_free(b1);
   97|  3.14k|    BN_free(b2);
   98|  3.14k|    BN_free(b3);
   99|  3.14k|    BN_free(b4);
  100|  3.14k|    BN_free(b5);
  101|  3.14k|    BN_CTX_free(ctx);
  102|  3.14k|    ERR_clear_error();
  103|       |
  104|  3.14k|    return 0;
  105|  3.08k|}

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

bio_lib.c:CRYPTO_FREE_REF:
  273|      2|static ossl_unused ossl_inline void CRYPTO_FREE_REF(CRYPTO_REF_COUNT *refcnt)                                  \
  274|      2|{
  275|      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|    }                                           \

err.c:ERR_GET_LIB:
  242|  8.69k|{
  243|  8.69k|    if (ERR_SYSTEM_ERROR(errcode))
  ------------------
  |  |  239|  8.69k|# define ERR_SYSTEM_ERROR(errcode)      (((errcode) & ERR_SYSTEM_FLAG) != 0)
  |  |  ------------------
  |  |  |  |  218|  8.69k|# define ERR_SYSTEM_FLAG                ((unsigned int)INT_MAX + 1)
  |  |  ------------------
  |  |  |  Branch (239:41): [True: 0, False: 8.69k]
  |  |  ------------------
  ------------------
  244|      0|        return ERR_LIB_SYS;
  ------------------
  |  |   72|      0|# define ERR_LIB_SYS             2
  ------------------
  245|  8.69k|    return (errcode >> ERR_LIB_OFFSET) & ERR_LIB_MASK;
  ------------------
  |  |  226|  8.69k|# define ERR_LIB_OFFSET                 23L
  ------------------
                  return (errcode >> ERR_LIB_OFFSET) & ERR_LIB_MASK;
  ------------------
  |  |  227|  8.69k|# define ERR_LIB_MASK                   0xFF
  ------------------
  246|  8.69k|}
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:
  162|  8.63k|    { \
  163|  8.63k|        return (OPENSSL_LHASH *)lh; \
  164|  8.63k|    } \
err.c:ossl_check_ERR_STRING_DATA_lh_hashfunc_type:
  172|      2|    { \
  173|      2|        return (OPENSSL_LH_HASHFUNC)hfn; \
  174|      2|    } \
err.c:ossl_check_ERR_STRING_DATA_lh_compfunc_type:
  167|      2|    { \
  168|      2|        return (OPENSSL_LH_COMPFUNC)cmp; \
  169|      2|    } \
err.c:ossl_check_ERR_STRING_DATA_lh_plain_type:
  147|  8.49k|    { \
  148|  8.49k|        return ptr; \
  149|  8.49k|    } \
err.c:ossl_check_const_ERR_STRING_DATA_lh_plain_type:
  152|    136|    { \
  153|    136|        return ptr; \
  154|    136|    } \
store_register.c:lh_OSSL_STORE_LOADER_free:
  216|      2|    { \
  217|      2|        OPENSSL_LH_free((OPENSSL_LHASH *)lh); \
  218|      2|    } \

initthread.c:sk_THREAD_EVENT_HANDLER_PTR_new_null:
   82|      2|    { \
   83|      2|        return (STACK_OF(t1) *)OPENSSL_sk_new_null(); \
   84|      2|    } \
initthread.c:sk_THREAD_EVENT_HANDLER_PTR_free:
   94|      2|    { \
   95|      2|        OPENSSL_sk_free((OPENSSL_STACK *)sk); \
   96|      2|    } \
initthread.c:sk_THREAD_EVENT_HANDLER_PTR_push:
  111|      2|    { \
  112|      2|        return OPENSSL_sk_push((OPENSSL_STACK *)sk, (const void *)ptr); \
  113|      2|    } \
initthread.c:sk_THREAD_EVENT_HANDLER_PTR_num:
   70|      4|    { \
   71|      4|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   72|      4|    } \
initthread.c:sk_THREAD_EVENT_HANDLER_PTR_value:
   74|      2|    { \
   75|      2|        return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \
   76|      2|    } \
initthread.c:sk_THREAD_EVENT_HANDLER_PTR_delete:
  102|      2|    { \
  103|      2|        return (t2 *)OPENSSL_sk_delete((OPENSSL_STACK *)sk, i); \
  104|      2|    } \
conf_mod.c:sk_CONF_MODULE_num:
   70|      4|    { \
   71|      4|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   72|      4|    } \
conf_mod.c:sk_CONF_MODULE_free:
   94|      2|    { \
   95|      2|        OPENSSL_sk_free((OPENSSL_STACK *)sk); \
   96|      2|    } \
conf_mod.c:sk_CONF_IMODULE_num:
   70|      2|    { \
   71|      2|        return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
   72|      2|    } \
conf_mod.c:sk_CONF_IMODULE_free:
   94|      4|    { \
   95|      4|        OPENSSL_sk_free((OPENSSL_STACK *)sk); \
   96|      4|    } \
obj_xref.c:sk_nid_triple_pop_free:
  127|      2|    { \
  128|      2|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  129|      2|    } \
obj_xref.c:sk_nid_triple_free:
   94|      2|    { \
   95|      2|        OPENSSL_sk_free((OPENSSL_STACK *)sk); \
   96|      2|    } \
evp_pbe.c:sk_EVP_PBE_CTL_pop_free:
  127|      2|    { \
  128|      2|        OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
  129|      2|    } \

ossl_err_load_PROV_strings:
  230|      2|{
  231|      2|#ifndef OPENSSL_NO_ERR
  232|      2|    if (ERR_reason_error_string(PROV_str_reasons[0].error) == NULL)
  ------------------
  |  Branch (232:9): [True: 2, False: 0]
  ------------------
  233|      2|        ERR_load_strings_const(PROV_str_reasons);
  234|      2|#endif
  235|      2|    return 1;
  236|      2|}

