crypto/rsa/rsa_sp800_56b_gen.c:125: error: NULL_DEREFERENCE
  pointer `Xpo` last assigned on line 60 could be null and is dereferenced by call to `BN_clear()` at line 125, column 9.
Showing all 68 steps of the trace


crypto/rsa/rsa_sp800_56b_gen.c:51:1: start of procedure rsa_fips186_4_gen_prob_primes()
49.    *     (Required for CAVS testing).
50.    */
51. > int rsa_fips186_4_gen_prob_primes(RSA *rsa, BIGNUM *p1, BIGNUM *p2,
52.                                     BIGNUM *Xpout, const BIGNUM *Xp,
53.                                     const BIGNUM *Xp1, const BIGNUM *Xp2,

crypto/rsa/rsa_sp800_56b_gen.c:59:5: 
57.                                     const BIGNUM *e, BN_CTX *ctx, BN_GENCB *cb)
58.   {
59. >     int ret = 0, ok;
60.       BIGNUM *Xpo = NULL, *Xqo = NULL, *tmp = NULL;
61.   

crypto/rsa/rsa_sp800_56b_gen.c:60:5: 
58.   {
59.       int ret = 0, ok;
60. >     BIGNUM *Xpo = NULL, *Xqo = NULL, *tmp = NULL;
61.   
62.       /* (Step 1) Check key length

crypto/rsa/rsa_sp800_56b_gen.c:66:9: Taking false branch
64.        * Signature Generation and Key Agree/Transport.
65.        */
66.       if (nbits < RSA_FIPS1864_MIN_KEYGEN_KEYSIZE) {
              ^
67.           RSAerr(RSA_F_RSA_FIPS186_4_GEN_PROB_PRIMES, RSA_R_INVALID_KEY_LENGTH);
68.           return 0;

crypto/rsa/rsa_sp800_56b_gen.c:71:10: 
69.       }
70.   
71. >     if (!rsa_check_public_exponent(e)) {
72.           RSAerr(RSA_F_RSA_FIPS186_4_GEN_PROB_PRIMES,
73.                  RSA_R_PUB_EXPONENT_OUT_OF_RANGE);

crypto/rsa/rsa_sp800_56b_check.c:191:1: start of procedure rsa_check_public_exponent()
  189.   
  190.   /* Check exponent is odd, and has a bitlen ranging from [17..256] */
  191. > int rsa_check_public_exponent(const BIGNUM *e)
  192.   {
  193.       int bitlen = BN_num_bits(e);

crypto/rsa/rsa_sp800_56b_check.c:193:5: 
  191.   int rsa_check_public_exponent(const BIGNUM *e)
  192.   {
  193. >     int bitlen = BN_num_bits(e);
  194.   
  195.       return (BN_is_odd(e) &&  bitlen > 16 && bitlen < 257);

crypto/bn/bn_lib.c:135:1: start of procedure BN_num_bits()
    133.   }
    134.   
    135. > int BN_num_bits(const BIGNUM *a)
    136.   {
    137.       int i = a->top - 1;

crypto/bn/bn_lib.c:137:5: 
    135.   int BN_num_bits(const BIGNUM *a)
    136.   {
    137. >     int i = a->top - 1;
    138.       bn_check_top(a);
    139.   

crypto/bn/bn_lib.c:140:9: 
    138.       bn_check_top(a);
    139.   
    140. >     if (BN_is_zero(a))
    141.           return 0;
    142.       return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));

crypto/bn/bn_lib.c:864:1: start of procedure BN_is_zero()
      862.   }
      863.   
      864. > int BN_is_zero(const BIGNUM *a)
      865.   {
      866.       return a->top == 0;

crypto/bn/bn_lib.c:866:12: Condition is false
      864.   int BN_is_zero(const BIGNUM *a)
      865.   {
      866.       return a->top == 0;
                        ^
      867.   }
      868.   

crypto/bn/bn_lib.c:866:5: 
      864.   int BN_is_zero(const BIGNUM *a)
      865.   {
      866. >     return a->top == 0;
      867.   }
      868.   

crypto/bn/bn_lib.c:867:1: return from a call to BN_is_zero
      865.   {
      866.       return a->top == 0;
      867. > }
      868.   
      869.   int BN_is_one(const BIGNUM *a)

crypto/bn/bn_lib.c:140:9: Taking false branch
    138.       bn_check_top(a);
    139.   
    140.       if (BN_is_zero(a))
                   ^
    141.           return 0;
    142.       return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));

crypto/bn/bn_lib.c:142:5: 
    140.       if (BN_is_zero(a))
    141.           return 0;
    142. >     return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
    143.   }
    144.   

crypto/bn/bn_lib.c:90:1: start of procedure BN_num_bits_word()
      88.   }
      89.   
      90. > int BN_num_bits_word(BN_ULONG l)
      91.   {
      92.       BN_ULONG x, mask;

crypto/bn/bn_lib.c:93:17: Condition is true
      91.   {
      92.       BN_ULONG x, mask;
      93.       int bits = (l != 0);
                            ^
      94.   
      95.   #if BN_BITS2 > 32

crypto/bn/bn_lib.c:93:5: 
      91.   {
      92.       BN_ULONG x, mask;
      93. >     int bits = (l != 0);
      94.   
      95.   #if BN_BITS2 > 32

crypto/bn/bn_lib.c:96:5: 
      94.   
      95.   #if BN_BITS2 > 32
      96. >     x = l >> 32;
      97.       mask = (0 - x) & BN_MASK2;
      98.       mask = (0 - (mask >> (BN_BITS2 - 1)));

crypto/bn/bn_lib.c:97:5: 
      95.   #if BN_BITS2 > 32
      96.       x = l >> 32;
      97. >     mask = (0 - x) & BN_MASK2;
      98.       mask = (0 - (mask >> (BN_BITS2 - 1)));
      99.       bits += 32 & mask;

crypto/bn/bn_lib.c:98:5: 
      96.       x = l >> 32;
      97.       mask = (0 - x) & BN_MASK2;
      98. >     mask = (0 - (mask >> (BN_BITS2 - 1)));
      99.       bits += 32 & mask;
      100.       l ^= (x ^ l) & mask;

crypto/bn/bn_lib.c:99:5: 
      97.       mask = (0 - x) & BN_MASK2;
      98.       mask = (0 - (mask >> (BN_BITS2 - 1)));
      99. >     bits += 32 & mask;
      100.       l ^= (x ^ l) & mask;
      101.   #endif

crypto/bn/bn_lib.c:100:5: 
      98.       mask = (0 - (mask >> (BN_BITS2 - 1)));
      99.       bits += 32 & mask;
      100. >     l ^= (x ^ l) & mask;
      101.   #endif
      102.   

crypto/bn/bn_lib.c:103:5: 
      101.   #endif
      102.   
      103. >     x = l >> 16;
      104.       mask = (0 - x) & BN_MASK2;
      105.       mask = (0 - (mask >> (BN_BITS2 - 1)));

crypto/bn/bn_lib.c:104:5: 
      102.   
      103.       x = l >> 16;
      104. >     mask = (0 - x) & BN_MASK2;
      105.       mask = (0 - (mask >> (BN_BITS2 - 1)));
      106.       bits += 16 & mask;

crypto/bn/bn_lib.c:105:5: 
      103.       x = l >> 16;
      104.       mask = (0 - x) & BN_MASK2;
      105. >     mask = (0 - (mask >> (BN_BITS2 - 1)));
      106.       bits += 16 & mask;
      107.       l ^= (x ^ l) & mask;

crypto/bn/bn_lib.c:106:5: 
      104.       mask = (0 - x) & BN_MASK2;
      105.       mask = (0 - (mask >> (BN_BITS2 - 1)));
      106. >     bits += 16 & mask;
      107.       l ^= (x ^ l) & mask;
      108.   

crypto/bn/bn_lib.c:107:5: 
      105.       mask = (0 - (mask >> (BN_BITS2 - 1)));
      106.       bits += 16 & mask;
      107. >     l ^= (x ^ l) & mask;
      108.   
      109.       x = l >> 8;

crypto/bn/bn_lib.c:109:5: 
      107.       l ^= (x ^ l) & mask;
      108.   
      109. >     x = l >> 8;
      110.       mask = (0 - x) & BN_MASK2;
      111.       mask = (0 - (mask >> (BN_BITS2 - 1)));

crypto/bn/bn_lib.c:110:5: 
      108.   
      109.       x = l >> 8;
      110. >     mask = (0 - x) & BN_MASK2;
      111.       mask = (0 - (mask >> (BN_BITS2 - 1)));
      112.       bits += 8 & mask;

crypto/bn/bn_lib.c:111:5: 
      109.       x = l >> 8;
      110.       mask = (0 - x) & BN_MASK2;
      111. >     mask = (0 - (mask >> (BN_BITS2 - 1)));
      112.       bits += 8 & mask;
      113.       l ^= (x ^ l) & mask;

crypto/bn/bn_lib.c:112:5: 
      110.       mask = (0 - x) & BN_MASK2;
      111.       mask = (0 - (mask >> (BN_BITS2 - 1)));
      112. >     bits += 8 & mask;
      113.       l ^= (x ^ l) & mask;
      114.   

crypto/bn/bn_lib.c:113:5: 
      111.       mask = (0 - (mask >> (BN_BITS2 - 1)));
      112.       bits += 8 & mask;
      113. >     l ^= (x ^ l) & mask;
      114.   
      115.       x = l >> 4;

crypto/bn/bn_lib.c:115:5: 
      113.       l ^= (x ^ l) & mask;
      114.   
      115. >     x = l >> 4;
      116.       mask = (0 - x) & BN_MASK2;
      117.       mask = (0 - (mask >> (BN_BITS2 - 1)));

crypto/bn/bn_lib.c:116:5: 
      114.   
      115.       x = l >> 4;
      116. >     mask = (0 - x) & BN_MASK2;
      117.       mask = (0 - (mask >> (BN_BITS2 - 1)));
      118.       bits += 4 & mask;

crypto/bn/bn_lib.c:117:5: 
      115.       x = l >> 4;
      116.       mask = (0 - x) & BN_MASK2;
      117. >     mask = (0 - (mask >> (BN_BITS2 - 1)));
      118.       bits += 4 & mask;
      119.       l ^= (x ^ l) & mask;

crypto/bn/bn_lib.c:118:5: 
      116.       mask = (0 - x) & BN_MASK2;
      117.       mask = (0 - (mask >> (BN_BITS2 - 1)));
      118. >     bits += 4 & mask;
      119.       l ^= (x ^ l) & mask;
      120.   

crypto/bn/bn_lib.c:119:5: 
      117.       mask = (0 - (mask >> (BN_BITS2 - 1)));
      118.       bits += 4 & mask;
      119. >     l ^= (x ^ l) & mask;
      120.   
      121.       x = l >> 2;

crypto/bn/bn_lib.c:121:5: 
      119.       l ^= (x ^ l) & mask;
      120.   
      121. >     x = l >> 2;
      122.       mask = (0 - x) & BN_MASK2;
      123.       mask = (0 - (mask >> (BN_BITS2 - 1)));

crypto/bn/bn_lib.c:122:5: 
      120.   
      121.       x = l >> 2;
      122. >     mask = (0 - x) & BN_MASK2;
      123.       mask = (0 - (mask >> (BN_BITS2 - 1)));
      124.       bits += 2 & mask;

crypto/bn/bn_lib.c:123:5: 
      121.       x = l >> 2;
      122.       mask = (0 - x) & BN_MASK2;
      123. >     mask = (0 - (mask >> (BN_BITS2 - 1)));
      124.       bits += 2 & mask;
      125.       l ^= (x ^ l) & mask;

crypto/bn/bn_lib.c:124:5: 
      122.       mask = (0 - x) & BN_MASK2;
      123.       mask = (0 - (mask >> (BN_BITS2 - 1)));
      124. >     bits += 2 & mask;
      125.       l ^= (x ^ l) & mask;
      126.   

crypto/bn/bn_lib.c:125:5: 
      123.       mask = (0 - (mask >> (BN_BITS2 - 1)));
      124.       bits += 2 & mask;
      125. >     l ^= (x ^ l) & mask;
      126.   
      127.       x = l >> 1;

crypto/bn/bn_lib.c:127:5: 
      125.       l ^= (x ^ l) & mask;
      126.   
      127. >     x = l >> 1;
      128.       mask = (0 - x) & BN_MASK2;
      129.       mask = (0 - (mask >> (BN_BITS2 - 1)));

crypto/bn/bn_lib.c:128:5: 
      126.   
      127.       x = l >> 1;
      128. >     mask = (0 - x) & BN_MASK2;
      129.       mask = (0 - (mask >> (BN_BITS2 - 1)));
      130.       bits += 1 & mask;

crypto/bn/bn_lib.c:129:5: 
      127.       x = l >> 1;
      128.       mask = (0 - x) & BN_MASK2;
      129. >     mask = (0 - (mask >> (BN_BITS2 - 1)));
      130.       bits += 1 & mask;
      131.   

crypto/bn/bn_lib.c:130:5: 
      128.       mask = (0 - x) & BN_MASK2;
      129.       mask = (0 - (mask >> (BN_BITS2 - 1)));
      130. >     bits += 1 & mask;
      131.   
      132.       return bits;

crypto/bn/bn_lib.c:132:5: 
      130.       bits += 1 & mask;
      131.   
      132. >     return bits;
      133.   }
      134.   

crypto/bn/bn_lib.c:133:1: return from a call to BN_num_bits_word
      131.   
      132.       return bits;
      133. > }
      134.   
      135.   int BN_num_bits(const BIGNUM *a)

crypto/bn/bn_lib.c:143:1: return from a call to BN_num_bits
    141.           return 0;
    142.       return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
    143. > }
    144.   
    145.   static void bn_free_d(BIGNUM *a)

crypto/rsa/rsa_sp800_56b_check.c:195:13: 
  193.       int bitlen = BN_num_bits(e);
  194.   
  195. >     return (BN_is_odd(e) &&  bitlen > 16 && bitlen < 257);
  196.   }
  197.   

crypto/bn/bn_lib.c:879:1: start of procedure BN_is_odd()
    877.   }
    878.   
    879. > int BN_is_odd(const BIGNUM *a)
    880.   {
    881.       return (a->top > 0) && (a->d[0] & 1);

crypto/bn/bn_lib.c:881:13: Condition is true
    879.   int BN_is_odd(const BIGNUM *a)
    880.   {
    881.       return (a->top > 0) && (a->d[0] & 1);
                       ^
    882.   }
    883.   

crypto/bn/bn_lib.c:881:29: Condition is false
    879.   int BN_is_odd(const BIGNUM *a)
    880.   {
    881.       return (a->top > 0) && (a->d[0] & 1);
                                       ^
    882.   }
    883.   

crypto/bn/bn_lib.c:881:12: 
    879.   int BN_is_odd(const BIGNUM *a)
    880.   {
    881. >     return (a->top > 0) && (a->d[0] & 1);
    882.   }
    883.   

crypto/bn/bn_lib.c:881:5: 
    879.   int BN_is_odd(const BIGNUM *a)
    880.   {
    881. >     return (a->top > 0) && (a->d[0] & 1);
    882.   }
    883.   

crypto/bn/bn_lib.c:882:1: return from a call to BN_is_odd
    880.   {
    881.       return (a->top > 0) && (a->d[0] & 1);
    882. > }
    883.   
    884.   int BN_is_negative(const BIGNUM *a)

crypto/rsa/rsa_sp800_56b_check.c:195:13: Condition is false
  193.       int bitlen = BN_num_bits(e);
  194.   
  195.       return (BN_is_odd(e) &&  bitlen > 16 && bitlen < 257);
                     ^
  196.   }
  197.   

crypto/rsa/rsa_sp800_56b_check.c:195:5: 
  193.       int bitlen = BN_num_bits(e);
  194.   
  195. >     return (BN_is_odd(e) &&  bitlen > 16 && bitlen < 257);
  196.   }
  197.   

crypto/rsa/rsa_sp800_56b_check.c:196:1: return from a call to rsa_check_public_exponent
  194.   
  195.       return (BN_is_odd(e) &&  bitlen > 16 && bitlen < 257);
  196. > }
  197.   
  198.   /*

crypto/rsa/rsa_sp800_56b_gen.c:71:10: Taking true branch
69.       }
70.   
71.       if (!rsa_check_public_exponent(e)) {
               ^
72.           RSAerr(RSA_F_RSA_FIPS186_4_GEN_PROB_PRIMES,
73.                  RSA_R_PUB_EXPONENT_OUT_OF_RANGE);

crypto/rsa/rsa_sp800_56b_gen.c:72:9: Skipping ERR_put_error(): empty list of specs
70.   
71.       if (!rsa_check_public_exponent(e)) {
72.           RSAerr(RSA_F_RSA_FIPS186_4_GEN_PROB_PRIMES,
              ^
73.                  RSA_R_PUB_EXPONENT_OUT_OF_RANGE);
74.           goto err;

crypto/rsa/rsa_sp800_56b_gen.c:122:1: 
120.       }
121.       ret = 1;
122. > err:
123.       /* Zeroize any internally generated values that are not returned */
124.       if (Xpo != Xpout)

crypto/rsa/rsa_sp800_56b_gen.c:124:9: Taking true branch
122.   err:
123.       /* Zeroize any internally generated values that are not returned */
124.       if (Xpo != Xpout)
               ^
125.           BN_clear(Xpo);
126.       if (Xqo != Xqout)

crypto/rsa/rsa_sp800_56b_gen.c:125:9: 
123.       /* Zeroize any internally generated values that are not returned */
124.       if (Xpo != Xpout)
125. >         BN_clear(Xpo);
126.       if (Xqo != Xqout)
127.           BN_clear(Xqo);

crypto/bn/bn_lib.c:339:1: start of procedure BN_clear()
  337.   }
  338.   
  339. > void BN_clear(BIGNUM *a)
  340.   {
  341.       bn_check_top(a);

crypto/bn/bn_lib.c:342:9: 
  340.   {
  341.       bn_check_top(a);
  342. >     if (a->d != NULL)
  343.           OPENSSL_cleanse(a->d, sizeof(*a->d) * a->dmax);
  344.       a->neg = 0;

int rsa_fips186_4_gen_prob_primes(RSA *rsa, BIGNUM *p1, BIGNUM *p2,
                                  BIGNUM *Xpout, const BIGNUM *Xp,
                                  const BIGNUM *Xp1, const BIGNUM *Xp2,
                                  BIGNUM *q1, BIGNUM *q2, BIGNUM *Xqout,
                                  const BIGNUM *Xq, const BIGNUM *Xq1,
                                  const BIGNUM *Xq2, int nbits,
                                  const BIGNUM *e, BN_CTX *ctx, BN_GENCB *cb)
{
    int ret = 0, ok;
    BIGNUM *Xpo = NULL, *Xqo = NULL, *tmp = NULL;
    if (nbits < RSA_FIPS1864_MIN_KEYGEN_KEYSIZE) {
        RSAerr(RSA_F_RSA_FIPS186_4_GEN_PROB_PRIMES, RSA_R_INVALID_KEY_LENGTH);
        return 0;
    }
    if (!rsa_check_public_exponent(e)) {
        RSAerr(RSA_F_RSA_FIPS186_4_GEN_PROB_PRIMES,
               RSA_R_PUB_EXPONENT_OUT_OF_RANGE);
        goto err;
    }
    BN_CTX_start(ctx);
    tmp = BN_CTX_get(ctx);
    Xpo = (Xpout != NULL) ? Xpout : BN_CTX_get(ctx);
    Xqo = (Xqout != NULL) ? Xqout : BN_CTX_get(ctx);
    if (tmp == NULL || Xpo == NULL || Xqo == NULL)
        goto err;
    if (rsa->p == NULL)
        rsa->p = BN_secure_new();
    if (rsa->q == NULL)
        rsa->q = BN_secure_new();
    if (rsa->p == NULL || rsa->q == NULL)
        goto err;
    if (!bn_rsa_fips186_4_gen_prob_primes(rsa->p, Xpo, p1, p2, Xp, Xp1, Xp2,
                                          nbits, e, ctx, cb))
        goto err;
    for(;;) {
        if (!bn_rsa_fips186_4_gen_prob_primes(rsa->q, Xqo, q1, q2, Xq, Xq1,
                                              Xq2, nbits, e, ctx, cb))
            goto err;
        ok = rsa_check_pminusq_diff(tmp, Xpo, Xqo, nbits);
        if (ok < 0)
            goto err;
        if (ok == 0)
            continue;
        ok = rsa_check_pminusq_diff(tmp, rsa->p, rsa->q, nbits);
        if (ok < 0)
            goto err;
        if (ok == 0)
            continue;
        break;
    }
    ret = 1;
err:
    if (Xpo != Xpout)
        BN_clear(Xpo);
    if (Xqo != Xqout)
        BN_clear(Xqo);
    BN_clear(tmp);
    BN_CTX_end(ctx);
    return ret;
}
['int rsa_fips186_4_gen_prob_primes(RSA *rsa, BIGNUM *p1, BIGNUM *p2,\n                                  BIGNUM *Xpout, const BIGNUM *Xp,\n                                  const BIGNUM *Xp1, const BIGNUM *Xp2,\n                                  BIGNUM *q1, BIGNUM *q2, BIGNUM *Xqout,\n                                  const BIGNUM *Xq, const BIGNUM *Xq1,\n                                  const BIGNUM *Xq2, int nbits,\n                                  const BIGNUM *e, BN_CTX *ctx, BN_GENCB *cb)\n{\n    int ret = 0, ok;\n    BIGNUM *Xpo = NULL, *Xqo = NULL, *tmp = NULL;\n    if (nbits < RSA_FIPS1864_MIN_KEYGEN_KEYSIZE) {\n        RSAerr(RSA_F_RSA_FIPS186_4_GEN_PROB_PRIMES, RSA_R_INVALID_KEY_LENGTH);\n        return 0;\n    }\n    if (!rsa_check_public_exponent(e)) {\n        RSAerr(RSA_F_RSA_FIPS186_4_GEN_PROB_PRIMES,\n               RSA_R_PUB_EXPONENT_OUT_OF_RANGE);\n        goto err;\n    }\n    BN_CTX_start(ctx);\n    tmp = BN_CTX_get(ctx);\n    Xpo = (Xpout != NULL) ? Xpout : BN_CTX_get(ctx);\n    Xqo = (Xqout != NULL) ? Xqout : BN_CTX_get(ctx);\n    if (tmp == NULL || Xpo == NULL || Xqo == NULL)\n        goto err;\n    if (rsa->p == NULL)\n        rsa->p = BN_secure_new();\n    if (rsa->q == NULL)\n        rsa->q = BN_secure_new();\n    if (rsa->p == NULL || rsa->q == NULL)\n        goto err;\n    if (!bn_rsa_fips186_4_gen_prob_primes(rsa->p, Xpo, p1, p2, Xp, Xp1, Xp2,\n                                          nbits, e, ctx, cb))\n        goto err;\n    for(;;) {\n        if (!bn_rsa_fips186_4_gen_prob_primes(rsa->q, Xqo, q1, q2, Xq, Xq1,\n                                              Xq2, nbits, e, ctx, cb))\n            goto err;\n        ok = rsa_check_pminusq_diff(tmp, Xpo, Xqo, nbits);\n        if (ok < 0)\n            goto err;\n        if (ok == 0)\n            continue;\n        ok = rsa_check_pminusq_diff(tmp, rsa->p, rsa->q, nbits);\n        if (ok < 0)\n            goto err;\n        if (ok == 0)\n            continue;\n        break;\n    }\n    ret = 1;\nerr:\n    if (Xpo != Xpout)\n        BN_clear(Xpo);\n    if (Xqo != Xqout)\n        BN_clear(Xqo);\n    BN_clear(tmp);\n    BN_CTX_end(ctx);\n    return ret;\n}', 'int rsa_check_public_exponent(const BIGNUM *e)\n{\n    int bitlen = BN_num_bits(e);\n    return (BN_is_odd(e) &&  bitlen > 16 && bitlen < 257);\n}', 'int BN_num_bits(const BIGNUM *a)\n{\n    int i = a->top - 1;\n    bn_check_top(a);\n    if (BN_is_zero(a))\n        return 0;\n    return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));\n}', 'int BN_is_zero(const BIGNUM *a)\n{\n    return a->top == 0;\n}', 'int BN_num_bits_word(BN_ULONG l)\n{\n    BN_ULONG x, mask;\n    int bits = (l != 0);\n#if BN_BITS2 > 32\n    x = l >> 32;\n    mask = (0 - x) & BN_MASK2;\n    mask = (0 - (mask >> (BN_BITS2 - 1)));\n    bits += 32 & mask;\n    l ^= (x ^ l) & mask;\n#endif\n    x = l >> 16;\n    mask = (0 - x) & BN_MASK2;\n    mask = (0 - (mask >> (BN_BITS2 - 1)));\n    bits += 16 & mask;\n    l ^= (x ^ l) & mask;\n    x = l >> 8;\n    mask = (0 - x) & BN_MASK2;\n    mask = (0 - (mask >> (BN_BITS2 - 1)));\n    bits += 8 & mask;\n    l ^= (x ^ l) & mask;\n    x = l >> 4;\n    mask = (0 - x) & BN_MASK2;\n    mask = (0 - (mask >> (BN_BITS2 - 1)));\n    bits += 4 & mask;\n    l ^= (x ^ l) & mask;\n    x = l >> 2;\n    mask = (0 - x) & BN_MASK2;\n    mask = (0 - (mask >> (BN_BITS2 - 1)));\n    bits += 2 & mask;\n    l ^= (x ^ l) & mask;\n    x = l >> 1;\n    mask = (0 - x) & BN_MASK2;\n    mask = (0 - (mask >> (BN_BITS2 - 1)));\n    bits += 1 & mask;\n    return bits;\n}', 'int BN_is_odd(const BIGNUM *a)\n{\n    return (a->top > 0) && (a->d[0] & 1);\n}', 'void BN_clear(BIGNUM *a)\n{\n    bn_check_top(a);\n    if (a->d != NULL)\n        OPENSSL_cleanse(a->d, sizeof(*a->d) * a->dmax);\n    a->neg = 0;\n    a->top = 0;\n    a->flags &= ~BN_FLG_FIXED_TOP;\n}']