test/ectest.c:950: error: MEMORY_LEAK
  memory dynamically allocated by call to `BN_new()` at line 943, column 9 is not reachable after line 950, column 10.
Showing all 107 steps of the trace


test/ectest.c:923:1: start of procedure char2_field_tests()
921.   # ifndef OPENSSL_NO_EC2M
922.   
923. > static void char2_field_tests(void)
924.   {
925.       BN_CTX *ctx = NULL;

test/ectest.c:925:5: 
923.   static void char2_field_tests(void)
924.   {
925. >     BN_CTX *ctx = NULL;
926.       BIGNUM *p, *a, *b;
927.       EC_GROUP *group;

test/ectest.c:928:5: 
926.       BIGNUM *p, *a, *b;
927.       EC_GROUP *group;
928. >     EC_GROUP *C2_K163 = NULL, *C2_K233 = NULL, *C2_K283 = NULL, *C2_K409 =
929.           NULL, *C2_K571 = NULL;
930.       EC_GROUP *C2_B163 = NULL, *C2_B233 = NULL, *C2_B283 = NULL, *C2_B409 =

test/ectest.c:930:5: 
928.       EC_GROUP *C2_K163 = NULL, *C2_K233 = NULL, *C2_K283 = NULL, *C2_K409 =
929.           NULL, *C2_K571 = NULL;
930. >     EC_GROUP *C2_B163 = NULL, *C2_B233 = NULL, *C2_B283 = NULL, *C2_B409 =
931.           NULL, *C2_B571 = NULL;
932.       EC_POINT *P, *Q, *R;

test/ectest.c:938:5: 
936.       int k;
937.   
938. >     ctx = BN_CTX_new();
939.       if (!ctx)
940.           ABORT;

crypto/bn/bn_ctx.c:188:1: start of procedure BN_CTX_new()
  186.   
  187.   
  188. > BN_CTX *BN_CTX_new(void)
  189.   {
  190.       BN_CTX *ret;

crypto/bn/bn_ctx.c:192:9: 
  190.       BN_CTX *ret;
  191.   
  192. >     if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
  193.           BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE);
  194.           return NULL;

crypto/mem.c:156:1: start of procedure CRYPTO_zalloc()
    154.   }
    155.   
    156. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    157.   {
    158.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:158:5: 
    156.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    157.   {
    158. >     void *ret = CRYPTO_malloc(num, file, line);
    159.   
    160.       if (ret != NULL)

crypto/mem.c:119:1: start of procedure CRYPTO_malloc()
      117.   }
      118.   
      119. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      120.   {
      121.       void *ret = NULL;

crypto/mem.c:121:5: 
      119.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      120.   {
      121. >     void *ret = NULL;
      122.   
      123.       if (num <= 0)

crypto/mem.c:123:9: Taking false branch
      121.       void *ret = NULL;
      122.   
      123.       if (num <= 0)
                     ^
      124.           return NULL;
      125.   

crypto/mem.c:126:5: 
      124.           return NULL;
      125.   
      126. >     allow_customize = 0;
      127.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      128.       if (call_malloc_debug) {

crypto/mem.c:136:5: 
      134.       }
      135.   #else
      136. >     (void)file;
      137.       (void)line;
      138.       ret = malloc(num);

crypto/mem.c:137:5: 
      135.   #else
      136.       (void)file;
      137. >     (void)line;
      138.       ret = malloc(num);
      139.   #endif

crypto/mem.c:138:5: 
      136.       (void)file;
      137.       (void)line;
      138. >     ret = malloc(num);
      139.   #endif
      140.   

crypto/mem.c:153:5: 
      151.   #endif
      152.   
      153. >     return ret;
      154.   }
      155.   

crypto/mem.c:154:1: return from a call to CRYPTO_malloc
      152.   
      153.       return ret;
      154. > }
      155.   
      156.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:160:9: Taking true branch
    158.       void *ret = CRYPTO_malloc(num, file, line);
    159.   
    160.       if (ret != NULL)
                   ^
    161.           memset(ret, 0, num);
    162.       return ret;

crypto/mem.c:161:9: 
    159.   
    160.       if (ret != NULL)
    161. >         memset(ret, 0, num);
    162.       return ret;
    163.   }

crypto/mem.c:162:5: 
    160.       if (ret != NULL)
    161.           memset(ret, 0, num);
    162. >     return ret;
    163.   }
    164.   

crypto/mem.c:163:1: return from a call to CRYPTO_zalloc
    161.           memset(ret, 0, num);
    162.       return ret;
    163. > }
    164.   
    165.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/bn/bn_ctx.c:192:9: Taking false branch
  190.       BN_CTX *ret;
  191.   
  192.       if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
                 ^
  193.           BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE);
  194.           return NULL;

crypto/bn/bn_ctx.c:197:5: 
  195.       }
  196.       /* Initialise the structure */
  197. >     BN_POOL_init(&ret->pool);
  198.       BN_STACK_init(&ret->stack);
  199.       return ret;

crypto/bn/bn_ctx.c:334:1: start of procedure BN_POOL_init()
    332.   /***********/
    333.   
    334. > static void BN_POOL_init(BN_POOL *p)
    335.   {
    336.       p->head = p->current = p->tail = NULL;

crypto/bn/bn_ctx.c:336:5: 
    334.   static void BN_POOL_init(BN_POOL *p)
    335.   {
    336. >     p->head = p->current = p->tail = NULL;
    337.       p->used = p->size = 0;
    338.   }

crypto/bn/bn_ctx.c:337:5: 
    335.   {
    336.       p->head = p->current = p->tail = NULL;
    337. >     p->used = p->size = 0;
    338.   }
    339.   

crypto/bn/bn_ctx.c:338:1: return from a call to BN_POOL_init
    336.       p->head = p->current = p->tail = NULL;
    337.       p->used = p->size = 0;
    338. > }
    339.   
    340.   static void BN_POOL_finish(BN_POOL *p)

crypto/bn/bn_ctx.c:198:5: 
  196.       /* Initialise the structure */
  197.       BN_POOL_init(&ret->pool);
  198. >     BN_STACK_init(&ret->stack);
  199.       return ret;
  200.   }

crypto/bn/bn_ctx.c:293:1: start of procedure BN_STACK_init()
    291.   /************/
    292.   
    293. > static void BN_STACK_init(BN_STACK *st)
    294.   {
    295.       st->indexes = NULL;

crypto/bn/bn_ctx.c:295:5: 
    293.   static void BN_STACK_init(BN_STACK *st)
    294.   {
    295. >     st->indexes = NULL;
    296.       st->depth = st->size = 0;
    297.   }

crypto/bn/bn_ctx.c:296:5: 
    294.   {
    295.       st->indexes = NULL;
    296. >     st->depth = st->size = 0;
    297.   }
    298.   

crypto/bn/bn_ctx.c:297:1: return from a call to BN_STACK_init
    295.       st->indexes = NULL;
    296.       st->depth = st->size = 0;
    297. > }
    298.   
    299.   static void BN_STACK_finish(BN_STACK *st)

crypto/bn/bn_ctx.c:199:5: 
  197.       BN_POOL_init(&ret->pool);
  198.       BN_STACK_init(&ret->stack);
  199. >     return ret;
  200.   }
  201.   

crypto/bn/bn_ctx.c:200:1: return from a call to BN_CTX_new
  198.       BN_STACK_init(&ret->stack);
  199.       return ret;
  200. > }
  201.   
  202.   BN_CTX *BN_CTX_secure_new(void)

test/ectest.c:939:10: Taking false branch
937.   
938.       ctx = BN_CTX_new();
939.       if (!ctx)
                ^
940.           ABORT;
941.   

test/ectest.c:942:5: 
940.           ABORT;
941.   
942. >     p = BN_new();
943.       a = BN_new();
944.       b = BN_new();

crypto/bn/bn_lib.c:276:1: start of procedure BN_new()
  274.   }
  275.   
  276. > BIGNUM *BN_new(void)
  277.   {
  278.       BIGNUM *ret;

crypto/bn/bn_lib.c:280:9: 
  278.       BIGNUM *ret;
  279.   
  280. >     if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
  281.           BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
  282.           return (NULL);

crypto/mem.c:156:1: start of procedure CRYPTO_zalloc()
    154.   }
    155.   
    156. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    157.   {
    158.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:158:5: 
    156.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    157.   {
    158. >     void *ret = CRYPTO_malloc(num, file, line);
    159.   
    160.       if (ret != NULL)

crypto/mem.c:119:1: start of procedure CRYPTO_malloc()
      117.   }
      118.   
      119. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      120.   {
      121.       void *ret = NULL;

crypto/mem.c:121:5: 
      119.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      120.   {
      121. >     void *ret = NULL;
      122.   
      123.       if (num <= 0)

crypto/mem.c:123:9: Taking false branch
      121.       void *ret = NULL;
      122.   
      123.       if (num <= 0)
                     ^
      124.           return NULL;
      125.   

crypto/mem.c:126:5: 
      124.           return NULL;
      125.   
      126. >     allow_customize = 0;
      127.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      128.       if (call_malloc_debug) {

crypto/mem.c:136:5: 
      134.       }
      135.   #else
      136. >     (void)file;
      137.       (void)line;
      138.       ret = malloc(num);

crypto/mem.c:137:5: 
      135.   #else
      136.       (void)file;
      137. >     (void)line;
      138.       ret = malloc(num);
      139.   #endif

crypto/mem.c:138:5: 
      136.       (void)file;
      137.       (void)line;
      138. >     ret = malloc(num);
      139.   #endif
      140.   

crypto/mem.c:153:5: 
      151.   #endif
      152.   
      153. >     return ret;
      154.   }
      155.   

crypto/mem.c:154:1: return from a call to CRYPTO_malloc
      152.   
      153.       return ret;
      154. > }
      155.   
      156.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:160:9: Taking true branch
    158.       void *ret = CRYPTO_malloc(num, file, line);
    159.   
    160.       if (ret != NULL)
                   ^
    161.           memset(ret, 0, num);
    162.       return ret;

crypto/mem.c:161:9: 
    159.   
    160.       if (ret != NULL)
    161. >         memset(ret, 0, num);
    162.       return ret;
    163.   }

crypto/mem.c:162:5: 
    160.       if (ret != NULL)
    161.           memset(ret, 0, num);
    162. >     return ret;
    163.   }
    164.   

crypto/mem.c:163:1: return from a call to CRYPTO_zalloc
    161.           memset(ret, 0, num);
    162.       return ret;
    163. > }
    164.   
    165.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/bn/bn_lib.c:280:9: Taking false branch
  278.       BIGNUM *ret;
  279.   
  280.       if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
                 ^
  281.           BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
  282.           return (NULL);

crypto/bn/bn_lib.c:284:5: 
  282.           return (NULL);
  283.       }
  284. >     ret->flags = BN_FLG_MALLOCED;
  285.       bn_check_top(ret);
  286.       return (ret);

crypto/bn/bn_lib.c:286:5: 
  284.       ret->flags = BN_FLG_MALLOCED;
  285.       bn_check_top(ret);
  286. >     return (ret);
  287.   }
  288.   

crypto/bn/bn_lib.c:287:1: return from a call to BN_new
  285.       bn_check_top(ret);
  286.       return (ret);
  287. > }
  288.   
  289.    BIGNUM *BN_secure_new(void)

test/ectest.c:943:5: 
941.   
942.       p = BN_new();
943. >     a = BN_new();
944.       b = BN_new();
945.       if (!p || !a || !b)

crypto/bn/bn_lib.c:276:1: start of procedure BN_new()
  274.   }
  275.   
  276. > BIGNUM *BN_new(void)
  277.   {
  278.       BIGNUM *ret;

crypto/bn/bn_lib.c:280:9: 
  278.       BIGNUM *ret;
  279.   
  280. >     if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
  281.           BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
  282.           return (NULL);

crypto/mem.c:156:1: start of procedure CRYPTO_zalloc()
    154.   }
    155.   
    156. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    157.   {
    158.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:158:5: 
    156.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    157.   {
    158. >     void *ret = CRYPTO_malloc(num, file, line);
    159.   
    160.       if (ret != NULL)

crypto/mem.c:119:1: start of procedure CRYPTO_malloc()
      117.   }
      118.   
      119. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      120.   {
      121.       void *ret = NULL;

crypto/mem.c:121:5: 
      119.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      120.   {
      121. >     void *ret = NULL;
      122.   
      123.       if (num <= 0)

crypto/mem.c:123:9: Taking false branch
      121.       void *ret = NULL;
      122.   
      123.       if (num <= 0)
                     ^
      124.           return NULL;
      125.   

crypto/mem.c:126:5: 
      124.           return NULL;
      125.   
      126. >     allow_customize = 0;
      127.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      128.       if (call_malloc_debug) {

crypto/mem.c:136:5: 
      134.       }
      135.   #else
      136. >     (void)file;
      137.       (void)line;
      138.       ret = malloc(num);

crypto/mem.c:137:5: 
      135.   #else
      136.       (void)file;
      137. >     (void)line;
      138.       ret = malloc(num);
      139.   #endif

crypto/mem.c:138:5: 
      136.       (void)file;
      137.       (void)line;
      138. >     ret = malloc(num);
      139.   #endif
      140.   

crypto/mem.c:153:5: 
      151.   #endif
      152.   
      153. >     return ret;
      154.   }
      155.   

crypto/mem.c:154:1: return from a call to CRYPTO_malloc
      152.   
      153.       return ret;
      154. > }
      155.   
      156.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:160:9: Taking true branch
    158.       void *ret = CRYPTO_malloc(num, file, line);
    159.   
    160.       if (ret != NULL)
                   ^
    161.           memset(ret, 0, num);
    162.       return ret;

crypto/mem.c:161:9: 
    159.   
    160.       if (ret != NULL)
    161. >         memset(ret, 0, num);
    162.       return ret;
    163.   }

crypto/mem.c:162:5: 
    160.       if (ret != NULL)
    161.           memset(ret, 0, num);
    162. >     return ret;
    163.   }
    164.   

crypto/mem.c:163:1: return from a call to CRYPTO_zalloc
    161.           memset(ret, 0, num);
    162.       return ret;
    163. > }
    164.   
    165.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/bn/bn_lib.c:280:9: Taking false branch
  278.       BIGNUM *ret;
  279.   
  280.       if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
                 ^
  281.           BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
  282.           return (NULL);

crypto/bn/bn_lib.c:284:5: 
  282.           return (NULL);
  283.       }
  284. >     ret->flags = BN_FLG_MALLOCED;
  285.       bn_check_top(ret);
  286.       return (ret);

crypto/bn/bn_lib.c:286:5: 
  284.       ret->flags = BN_FLG_MALLOCED;
  285.       bn_check_top(ret);
  286. >     return (ret);
  287.   }
  288.   

crypto/bn/bn_lib.c:287:1: return from a call to BN_new
  285.       bn_check_top(ret);
  286.       return (ret);
  287. > }
  288.   
  289.    BIGNUM *BN_secure_new(void)

test/ectest.c:944:5: 
942.       p = BN_new();
943.       a = BN_new();
944. >     b = BN_new();
945.       if (!p || !a || !b)
946.           ABORT;

crypto/bn/bn_lib.c:276:1: start of procedure BN_new()
  274.   }
  275.   
  276. > BIGNUM *BN_new(void)
  277.   {
  278.       BIGNUM *ret;

crypto/bn/bn_lib.c:280:9: 
  278.       BIGNUM *ret;
  279.   
  280. >     if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
  281.           BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
  282.           return (NULL);

crypto/mem.c:156:1: start of procedure CRYPTO_zalloc()
    154.   }
    155.   
    156. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    157.   {
    158.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:158:5: 
    156.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    157.   {
    158. >     void *ret = CRYPTO_malloc(num, file, line);
    159.   
    160.       if (ret != NULL)

crypto/mem.c:119:1: start of procedure CRYPTO_malloc()
      117.   }
      118.   
      119. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      120.   {
      121.       void *ret = NULL;

crypto/mem.c:121:5: 
      119.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      120.   {
      121. >     void *ret = NULL;
      122.   
      123.       if (num <= 0)

crypto/mem.c:123:9: Taking false branch
      121.       void *ret = NULL;
      122.   
      123.       if (num <= 0)
                     ^
      124.           return NULL;
      125.   

crypto/mem.c:126:5: 
      124.           return NULL;
      125.   
      126. >     allow_customize = 0;
      127.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      128.       if (call_malloc_debug) {

crypto/mem.c:136:5: 
      134.       }
      135.   #else
      136. >     (void)file;
      137.       (void)line;
      138.       ret = malloc(num);

crypto/mem.c:137:5: 
      135.   #else
      136.       (void)file;
      137. >     (void)line;
      138.       ret = malloc(num);
      139.   #endif

crypto/mem.c:138:5: 
      136.       (void)file;
      137.       (void)line;
      138. >     ret = malloc(num);
      139.   #endif
      140.   

crypto/mem.c:153:5: 
      151.   #endif
      152.   
      153. >     return ret;
      154.   }
      155.   

crypto/mem.c:154:1: return from a call to CRYPTO_malloc
      152.   
      153.       return ret;
      154. > }
      155.   
      156.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:160:9: Taking true branch
    158.       void *ret = CRYPTO_malloc(num, file, line);
    159.   
    160.       if (ret != NULL)
                   ^
    161.           memset(ret, 0, num);
    162.       return ret;

crypto/mem.c:161:9: 
    159.   
    160.       if (ret != NULL)
    161. >         memset(ret, 0, num);
    162.       return ret;
    163.   }

crypto/mem.c:162:5: 
    160.       if (ret != NULL)
    161.           memset(ret, 0, num);
    162. >     return ret;
    163.   }
    164.   

crypto/mem.c:163:1: return from a call to CRYPTO_zalloc
    161.           memset(ret, 0, num);
    162.       return ret;
    163. > }
    164.   
    165.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/bn/bn_lib.c:280:9: Taking false branch
  278.       BIGNUM *ret;
  279.   
  280.       if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
                 ^
  281.           BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
  282.           return (NULL);

crypto/bn/bn_lib.c:284:5: 
  282.           return (NULL);
  283.       }
  284. >     ret->flags = BN_FLG_MALLOCED;
  285.       bn_check_top(ret);
  286.       return (ret);

crypto/bn/bn_lib.c:286:5: 
  284.       ret->flags = BN_FLG_MALLOCED;
  285.       bn_check_top(ret);
  286. >     return (ret);
  287.   }
  288.   

crypto/bn/bn_lib.c:287:1: return from a call to BN_new
  285.       bn_check_top(ret);
  286.       return (ret);
  287. > }
  288.   
  289.    BIGNUM *BN_secure_new(void)

test/ectest.c:945:10: Taking false branch
943.       a = BN_new();
944.       b = BN_new();
945.       if (!p || !a || !b)
                ^
946.           ABORT;
947.   

test/ectest.c:945:16: Taking false branch
943.       a = BN_new();
944.       b = BN_new();
945.       if (!p || !a || !b)
                      ^
946.           ABORT;
947.   

test/ectest.c:945:22: Taking false branch
943.       a = BN_new();
944.       b = BN_new();
945.       if (!p || !a || !b)
                            ^
946.           ABORT;
947.   

test/ectest.c:948:10: Taking false branch
946.           ABORT;
947.   
948.       if (!BN_hex2bn(&p, "13"))
                ^
949.           ABORT;
950.       if (!BN_hex2bn(&a, "3"))

test/ectest.c:950:10: Skipping BN_hex2bn(): empty list of specs
948.       if (!BN_hex2bn(&p, "13"))
949.           ABORT;
950.       if (!BN_hex2bn(&a, "3"))
                ^
951.           ABORT;
952.       if (!BN_hex2bn(&b, "1"))

static void char2_field_tests(void)
{
    BN_CTX *ctx = NULL;
    BIGNUM *p, *a, *b;
    EC_GROUP *group;
    EC_GROUP *C2_K163 = NULL, *C2_K233 = NULL, *C2_K283 = NULL, *C2_K409 =
        NULL, *C2_K571 = NULL;
    EC_GROUP *C2_B163 = NULL, *C2_B233 = NULL, *C2_B283 = NULL, *C2_B409 =
        NULL, *C2_B571 = NULL;
    EC_POINT *P, *Q, *R;
    BIGNUM *x, *y, *z, *cof;
    unsigned char buf[100];
    size_t i, len;
    int k;
    ctx = BN_CTX_new();
    if (!ctx)
        ABORT;
    p = BN_new();
    a = BN_new();
    b = BN_new();
    if (!p || !a || !b)
        ABORT;
    if (!BN_hex2bn(&p, "13"))
        ABORT;
    if (!BN_hex2bn(&a, "3"))
        ABORT;
    if (!BN_hex2bn(&b, "1"))
        ABORT;
    group = EC_GROUP_new(EC_GF2m_simple_method());
    if (!group)
        ABORT;
    if (!EC_GROUP_set_curve_GF2m(group, p, a, b, ctx))
        ABORT;
    {
        EC_GROUP *tmp;
        tmp = EC_GROUP_new(EC_GROUP_method_of(group));
        if (!tmp)
            ABORT;
        if (!EC_GROUP_copy(tmp, group))
            ABORT;
        EC_GROUP_free(group);
        group = tmp;
    }
    if (!EC_GROUP_get_curve_GF2m(group, p, a, b, ctx))
        ABORT;
    fprintf(stdout,
            "Curve defined by Weierstrass equation\n     y^2 + x*y = x^3 + a*x^2 + b  (mod 0x");
    BN_print_fp(stdout, p);
    fprintf(stdout, ")\n     a = 0x");
    BN_print_fp(stdout, a);
    fprintf(stdout, "\n     b = 0x");
    BN_print_fp(stdout, b);
    fprintf(stdout, "\n(0x... means binary polynomial)\n");
    P = EC_POINT_new(group);
    Q = EC_POINT_new(group);
    R = EC_POINT_new(group);
    if (!P || !Q || !R)
        ABORT;
    if (!EC_POINT_set_to_infinity(group, P))
        ABORT;
    if (!EC_POINT_is_at_infinity(group, P))
        ABORT;
    buf[0] = 0;
    if (!EC_POINT_oct2point(group, Q, buf, 1, ctx))
        ABORT;
    if (!EC_POINT_add(group, P, P, Q, ctx))
        ABORT;
    if (!EC_POINT_is_at_infinity(group, P))
        ABORT;
    x = BN_new();
    y = BN_new();
    z = BN_new();
    cof = BN_new();
    if (!x || !y || !z || !cof)
        ABORT;
    if (!BN_hex2bn(&x, "6"))
        ABORT;
#  ifdef OPENSSL_EC_BIN_PT_COMP
    if (!EC_POINT_set_compressed_coordinates_GF2m(group, Q, x, 1, ctx))
        ABORT;
#  else
    if (!BN_hex2bn(&y, "8"))
        ABORT;
    if (!EC_POINT_set_affine_coordinates_GF2m(group, Q, x, y, ctx))
        ABORT;
#  endif
    if (EC_POINT_is_on_curve(group, Q, ctx) <= 0) {
#  ifdef OPENSSL_EC_BIN_PT_COMP
        if (!EC_POINT_get_affine_coordinates_GF2m(group, Q, x, y, ctx))
            ABORT;
#  endif
        fprintf(stderr, "Point is not on curve: x = 0x");
        BN_print_fp(stderr, x);
        fprintf(stderr, ", y = 0x");
        BN_print_fp(stderr, y);
        fprintf(stderr, "\n");
        ABORT;
    }
    fprintf(stdout, "A cyclic subgroup:\n");
    k = 100;
    do {
        if (k-- == 0)
            ABORT;
        if (EC_POINT_is_at_infinity(group, P))
            fprintf(stdout, "     point at infinity\n");
        else {
            if (!EC_POINT_get_affine_coordinates_GF2m(group, P, x, y, ctx))
                ABORT;
            fprintf(stdout, "     x = 0x");
            BN_print_fp(stdout, x);
            fprintf(stdout, ", y = 0x");
            BN_print_fp(stdout, y);
            fprintf(stdout, "\n");
        }
        if (!EC_POINT_copy(R, P))
            ABORT;
        if (!EC_POINT_add(group, P, P, Q, ctx))
            ABORT;
    }
    while (!EC_POINT_is_at_infinity(group, P));
    if (!EC_POINT_add(group, P, Q, R, ctx))
        ABORT;
    if (!EC_POINT_is_at_infinity(group, P))
        ABORT;
#  ifdef OPENSSL_EC_BIN_PT_COMP
    len =
        EC_POINT_point2oct(group, Q, POINT_CONVERSION_COMPRESSED, buf,
                           sizeof buf, ctx);
    if (len == 0)
        ABORT;
    if (!EC_POINT_oct2point(group, P, buf, len, ctx))
        ABORT;
    if (0 != EC_POINT_cmp(group, P, Q, ctx))
        ABORT;
    fprintf(stdout, "Generator as octet string, compressed form:\n     ");
    for (i = 0; i < len; i++)
        fprintf(stdout, "%02X", buf[i]);
#  endif
    len =
        EC_POINT_point2oct(group, Q, POINT_CONVERSION_UNCOMPRESSED, buf,
                           sizeof buf, ctx);
    if (len == 0)
        ABORT;
    if (!EC_POINT_oct2point(group, P, buf, len, ctx))
        ABORT;
    if (0 != EC_POINT_cmp(group, P, Q, ctx))
        ABORT;
    fprintf(stdout, "\nGenerator as octet string, uncompressed form:\n     ");
    for (i = 0; i < len; i++)
        fprintf(stdout, "%02X", buf[i]);
#  ifdef OPENSSL_EC_BIN_PT_COMP
    len =
        EC_POINT_point2oct(group, Q, POINT_CONVERSION_HYBRID, buf, sizeof buf,
                           ctx);
    if (len == 0)
        ABORT;
    if (!EC_POINT_oct2point(group, P, buf, len, ctx))
        ABORT;
    if (0 != EC_POINT_cmp(group, P, Q, ctx))
        ABORT;
    fprintf(stdout, "\nGenerator as octet string, hybrid form:\n     ");
    for (i = 0; i < len; i++)
        fprintf(stdout, "%02X", buf[i]);
#  endif
    fprintf(stdout, "\n");
    if (!EC_POINT_invert(group, P, ctx))
        ABORT;
    if (0 != EC_POINT_cmp(group, P, R, ctx))
        ABORT;
    CHAR2_CURVE_TEST
        ("NIST curve K-163",
         "0800000000000000000000000000000000000000C9",
         "1",
         "1",
         "02FE13C0537BBC11ACAA07D793DE4E6D5E5C94EEE8",
         "0289070FB05D38FF58321F2E800536D538CCDAA3D9",
         1, "04000000000000000000020108A2E0CC0D99F8A5EF", "2", 163, C2_K163);
    CHAR2_CURVE_TEST
        ("NIST curve B-163",
         "0800000000000000000000000000000000000000C9",
         "1",
         "020A601907B8C953CA1481EB10512F78744A3205FD",
         "03F0EBA16286A2D57EA0991168D4994637E8343E36",
         "00D51FBC6C71A0094FA2CDD545B11C5C0C797324F1",
         1, "040000000000000000000292FE77E70C12A4234C33", "2", 163, C2_B163);
    CHAR2_CURVE_TEST
        ("NIST curve K-233",
         "020000000000000000000000000000000000000004000000000000000001",
         "0",
         "1",
         "017232BA853A7E731AF129F22FF4149563A419C26BF50A4C9D6EEFAD6126",
         "01DB537DECE819B7F70F555A67C427A8CD9BF18AEB9B56E0C11056FAE6A3",
         0,
         "008000000000000000000000000000069D5BB915BCD46EFB1AD5F173ABDF",
         "4", 233, C2_K233);
    CHAR2_CURVE_TEST
        ("NIST curve B-233",
         "020000000000000000000000000000000000000004000000000000000001",
         "000000000000000000000000000000000000000000000000000000000001",
         "0066647EDE6C332C7F8C0923BB58213B333B20E9CE4281FE115F7D8F90AD",
         "00FAC9DFCBAC8313BB2139F1BB755FEF65BC391F8B36F8F8EB7371FD558B",
         "01006A08A41903350678E58528BEBF8A0BEFF867A7CA36716F7E01F81052",
         1,
         "01000000000000000000000000000013E974E72F8A6922031D2603CFE0D7",
         "2", 233, C2_B233);
    CHAR2_CURVE_TEST
        ("NIST curve K-283",
         "0800000000000000000000000000000000000000000000000000000000000000000010A1",
         "0",
         "1",
         "0503213F78CA44883F1A3B8162F188E553CD265F23C1567A16876913B0C2AC2458492836",
         "01CCDA380F1C9E318D90F95D07E5426FE87E45C0E8184698E45962364E34116177DD2259",
         0,
         "01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE9AE2ED07577265DFF7F94451E061E163C61",
         "4", 283, C2_K283);
    CHAR2_CURVE_TEST
        ("NIST curve B-283",
         "0800000000000000000000000000000000000000000000000000000000000000000010A1",
         "000000000000000000000000000000000000000000000000000000000000000000000001",
         "027B680AC8B8596DA5A4AF8A19A0303FCA97FD7645309FA2A581485AF6263E313B79A2F5",
         "05F939258DB7DD90E1934F8C70B0DFEC2EED25B8557EAC9C80E2E198F8CDBECD86B12053",
         "03676854FE24141CB98FE6D4B20D02B4516FF702350EDDB0826779C813F0DF45BE8112F4",
         1,
         "03FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEF90399660FC938A90165B042A7CEFADB307",
         "2", 283, C2_B283);
    CHAR2_CURVE_TEST
        ("NIST curve K-409",
         "02000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000001",
         "0",
         "1",
         "0060F05F658F49C1AD3AB1890F7184210EFD0987E307C84C27ACCFB8F9F67CC2C460189EB5AAAA62EE222EB1B35540CFE9023746",
         "01E369050B7C4E42ACBA1DACBF04299C3460782F918EA427E6325165E9EA10E3DA5F6C42E9C55215AA9CA27A5863EC48D8E0286B",
         1,
         "007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE5F83B2D4EA20400EC4557D5ED3E3E7CA5B4B5C83B8E01E5FCF",
         "4", 409, C2_K409);
    CHAR2_CURVE_TEST
        ("NIST curve B-409",
         "02000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000001",
         "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
         "0021A5C2C8EE9FEB5C4B9A753B7B476B7FD6422EF1F3DD674761FA99D6AC27C8A9A197B272822F6CD57A55AA4F50AE317B13545F",
         "015D4860D088DDB3496B0C6064756260441CDE4AF1771D4DB01FFE5B34E59703DC255A868A1180515603AEAB60794E54BB7996A7",
         "0061B1CFAB6BE5F32BBFA78324ED106A7636B9C5A7BD198D0158AA4F5488D08F38514F1FDF4B4F40D2181B3681C364BA0273C706",
         1,
         "010000000000000000000000000000000000000000000000000001E2AAD6A612F33307BE5FA47C3C9E052F838164CD37D9A21173",
         "2", 409, C2_B409);
    CHAR2_CURVE_TEST
        ("NIST curve K-571",
         "80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000425",
         "0",
         "1",
         "026EB7A859923FBC82189631F8103FE4AC9CA2970012D5D46024804801841CA44370958493B205E647DA304DB4CEB08CBBD1BA39494776FB988B47174DCA88C7E2945283A01C8972",
         "0349DC807F4FBF374F4AEADE3BCA95314DD58CEC9F307A54FFC61EFC006D8A2C9D4979C0AC44AEA74FBEBBB9F772AEDCB620B01A7BA7AF1B320430C8591984F601CD4C143EF1C7A3",
         0,
         "020000000000000000000000000000000000000000000000000000000000000000000000131850E1F19A63E4B391A8DB917F4138B630D84BE5D639381E91DEB45CFE778F637C1001",
         "4", 571, C2_K571);
    CHAR2_CURVE_TEST
        ("NIST curve B-571",
         "80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000425",
         "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
         "02F40E7E2221F295DE297117B7F3D62F5C6A97FFCB8CEFF1CD6BA8CE4A9A18AD84FFABBD8EFA59332BE7AD6756A66E294AFD185A78FF12AA520E4DE739BACA0C7FFEFF7F2955727A",
         "0303001D34B856296C16C0D40D3CD7750A93D1D2955FA80AA5F40FC8DB7B2ABDBDE53950F4C0D293CDD711A35B67FB1499AE60038614F1394ABFA3B4C850D927E1E7769C8EEC2D19",
         "037BF27342DA639B6DCCFFFEB73D69D78C6C27A6009CBBCA1980F8533921E8A684423E43BAB08A576291AF8F461BB2A8B3531D2F0485C19B16E2F1516E23DD3C1A4827AF1B8AC15B",
         1,
         "03FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE661CE18FF55987308059B186823851EC7DD9CA1161DE93D5174D66E8382E9BB2FE84E47",
         "2", 571, C2_B571);
    if (!EC_POINT_copy(Q, P))
        ABORT;
    if (EC_POINT_is_at_infinity(group, Q))
        ABORT;
    if (!EC_POINT_dbl(group, P, P, ctx))
        ABORT;
    if (EC_POINT_is_on_curve(group, P, ctx) <= 0)
        ABORT;
    if (!EC_POINT_invert(group, Q, ctx))
        ABORT;
    if (!EC_POINT_add(group, R, P, Q, ctx))
        ABORT;
    if (!EC_POINT_add(group, R, R, Q, ctx))
        ABORT;
    if (!EC_POINT_is_at_infinity(group, R))
        ABORT;
    {
        const EC_POINT *points[3];
        const BIGNUM *scalars[3];
        if (EC_POINT_is_at_infinity(group, Q))
            ABORT;
        points[0] = Q;
        points[1] = Q;
        points[2] = Q;
        if (!BN_add(y, z, BN_value_one()))
            ABORT;
        if (BN_is_odd(y))
            ABORT;
        if (!BN_rshift1(y, y))
            ABORT;
        scalars[0] = y;
        scalars[1] = y;
        fprintf(stdout, "combined multiplication ...");
        fflush(stdout);
        if (!EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx))
            ABORT;
        if (!EC_POINTs_mul(group, R, z, 2, points, scalars, ctx))
            ABORT;
        if (0 != EC_POINT_cmp(group, P, R, ctx))
            ABORT;
        if (0 != EC_POINT_cmp(group, R, Q, ctx))
            ABORT;
        fprintf(stdout, ".");
        fflush(stdout);
        if (!BN_pseudo_rand(y, BN_num_bits(y), 0, 0))
            ABORT;
        if (!BN_add(z, z, y))
            ABORT;
        BN_set_negative(z, 1);
        scalars[0] = y;
        scalars[1] = z;
        if (!EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx))
            ABORT;
        if (!EC_POINT_is_at_infinity(group, P))
            ABORT;
        fprintf(stdout, ".");
        fflush(stdout);
        if (!BN_pseudo_rand(x, BN_num_bits(y) - 1, 0, 0))
            ABORT;
        if (!BN_add(z, x, y))
            ABORT;
        BN_set_negative(z, 1);
        scalars[0] = x;
        scalars[1] = y;
        scalars[2] = z;
        if (!EC_POINTs_mul(group, P, NULL, 3, points, scalars, ctx))
            ABORT;
        if (!EC_POINT_is_at_infinity(group, P))
            ABORT;
        fprintf(stdout, " ok\n\n");
    }
    BN_CTX_free(ctx);
    BN_free(p);
    BN_free(a);
    BN_free(b);
    EC_GROUP_free(group);
    EC_POINT_free(P);
    EC_POINT_free(Q);
    EC_POINT_free(R);
    BN_free(x);
    BN_free(y);
    BN_free(z);
    BN_free(cof);
    EC_GROUP_free(C2_K163);
    EC_GROUP_free(C2_B163);
    EC_GROUP_free(C2_K233);
    EC_GROUP_free(C2_B233);
    EC_GROUP_free(C2_K283);
    EC_GROUP_free(C2_B283);
    EC_GROUP_free(C2_K409);
    EC_GROUP_free(C2_B409);
    EC_GROUP_free(C2_K571);
    EC_GROUP_free(C2_B571);
}
['static void char2_field_tests(void)\n{\n    BN_CTX *ctx = NULL;\n    BIGNUM *p, *a, *b;\n    EC_GROUP *group;\n    EC_GROUP *C2_K163 = NULL, *C2_K233 = NULL, *C2_K283 = NULL, *C2_K409 =\n        NULL, *C2_K571 = NULL;\n    EC_GROUP *C2_B163 = NULL, *C2_B233 = NULL, *C2_B283 = NULL, *C2_B409 =\n        NULL, *C2_B571 = NULL;\n    EC_POINT *P, *Q, *R;\n    BIGNUM *x, *y, *z, *cof;\n    unsigned char buf[100];\n    size_t i, len;\n    int k;\n    ctx = BN_CTX_new();\n    if (!ctx)\n        ABORT;\n    p = BN_new();\n    a = BN_new();\n    b = BN_new();\n    if (!p || !a || !b)\n        ABORT;\n    if (!BN_hex2bn(&p, "13"))\n        ABORT;\n    if (!BN_hex2bn(&a, "3"))\n        ABORT;\n    if (!BN_hex2bn(&b, "1"))\n        ABORT;\n    group = EC_GROUP_new(EC_GF2m_simple_method());\n    if (!group)\n        ABORT;\n    if (!EC_GROUP_set_curve_GF2m(group, p, a, b, ctx))\n        ABORT;\n    {\n        EC_GROUP *tmp;\n        tmp = EC_GROUP_new(EC_GROUP_method_of(group));\n        if (!tmp)\n            ABORT;\n        if (!EC_GROUP_copy(tmp, group))\n            ABORT;\n        EC_GROUP_free(group);\n        group = tmp;\n    }\n    if (!EC_GROUP_get_curve_GF2m(group, p, a, b, ctx))\n        ABORT;\n    fprintf(stdout,\n            "Curve defined by Weierstrass equation\\n     y^2 + x*y = x^3 + a*x^2 + b  (mod 0x");\n    BN_print_fp(stdout, p);\n    fprintf(stdout, ")\\n     a = 0x");\n    BN_print_fp(stdout, a);\n    fprintf(stdout, "\\n     b = 0x");\n    BN_print_fp(stdout, b);\n    fprintf(stdout, "\\n(0x... means binary polynomial)\\n");\n    P = EC_POINT_new(group);\n    Q = EC_POINT_new(group);\n    R = EC_POINT_new(group);\n    if (!P || !Q || !R)\n        ABORT;\n    if (!EC_POINT_set_to_infinity(group, P))\n        ABORT;\n    if (!EC_POINT_is_at_infinity(group, P))\n        ABORT;\n    buf[0] = 0;\n    if (!EC_POINT_oct2point(group, Q, buf, 1, ctx))\n        ABORT;\n    if (!EC_POINT_add(group, P, P, Q, ctx))\n        ABORT;\n    if (!EC_POINT_is_at_infinity(group, P))\n        ABORT;\n    x = BN_new();\n    y = BN_new();\n    z = BN_new();\n    cof = BN_new();\n    if (!x || !y || !z || !cof)\n        ABORT;\n    if (!BN_hex2bn(&x, "6"))\n        ABORT;\n#  ifdef OPENSSL_EC_BIN_PT_COMP\n    if (!EC_POINT_set_compressed_coordinates_GF2m(group, Q, x, 1, ctx))\n        ABORT;\n#  else\n    if (!BN_hex2bn(&y, "8"))\n        ABORT;\n    if (!EC_POINT_set_affine_coordinates_GF2m(group, Q, x, y, ctx))\n        ABORT;\n#  endif\n    if (EC_POINT_is_on_curve(group, Q, ctx) <= 0) {\n#  ifdef OPENSSL_EC_BIN_PT_COMP\n        if (!EC_POINT_get_affine_coordinates_GF2m(group, Q, x, y, ctx))\n            ABORT;\n#  endif\n        fprintf(stderr, "Point is not on curve: x = 0x");\n        BN_print_fp(stderr, x);\n        fprintf(stderr, ", y = 0x");\n        BN_print_fp(stderr, y);\n        fprintf(stderr, "\\n");\n        ABORT;\n    }\n    fprintf(stdout, "A cyclic subgroup:\\n");\n    k = 100;\n    do {\n        if (k-- == 0)\n            ABORT;\n        if (EC_POINT_is_at_infinity(group, P))\n            fprintf(stdout, "     point at infinity\\n");\n        else {\n            if (!EC_POINT_get_affine_coordinates_GF2m(group, P, x, y, ctx))\n                ABORT;\n            fprintf(stdout, "     x = 0x");\n            BN_print_fp(stdout, x);\n            fprintf(stdout, ", y = 0x");\n            BN_print_fp(stdout, y);\n            fprintf(stdout, "\\n");\n        }\n        if (!EC_POINT_copy(R, P))\n            ABORT;\n        if (!EC_POINT_add(group, P, P, Q, ctx))\n            ABORT;\n    }\n    while (!EC_POINT_is_at_infinity(group, P));\n    if (!EC_POINT_add(group, P, Q, R, ctx))\n        ABORT;\n    if (!EC_POINT_is_at_infinity(group, P))\n        ABORT;\n#  ifdef OPENSSL_EC_BIN_PT_COMP\n    len =\n        EC_POINT_point2oct(group, Q, POINT_CONVERSION_COMPRESSED, buf,\n                           sizeof buf, ctx);\n    if (len == 0)\n        ABORT;\n    if (!EC_POINT_oct2point(group, P, buf, len, ctx))\n        ABORT;\n    if (0 != EC_POINT_cmp(group, P, Q, ctx))\n        ABORT;\n    fprintf(stdout, "Generator as octet string, compressed form:\\n     ");\n    for (i = 0; i < len; i++)\n        fprintf(stdout, "%02X", buf[i]);\n#  endif\n    len =\n        EC_POINT_point2oct(group, Q, POINT_CONVERSION_UNCOMPRESSED, buf,\n                           sizeof buf, ctx);\n    if (len == 0)\n        ABORT;\n    if (!EC_POINT_oct2point(group, P, buf, len, ctx))\n        ABORT;\n    if (0 != EC_POINT_cmp(group, P, Q, ctx))\n        ABORT;\n    fprintf(stdout, "\\nGenerator as octet string, uncompressed form:\\n     ");\n    for (i = 0; i < len; i++)\n        fprintf(stdout, "%02X", buf[i]);\n#  ifdef OPENSSL_EC_BIN_PT_COMP\n    len =\n        EC_POINT_point2oct(group, Q, POINT_CONVERSION_HYBRID, buf, sizeof buf,\n                           ctx);\n    if (len == 0)\n        ABORT;\n    if (!EC_POINT_oct2point(group, P, buf, len, ctx))\n        ABORT;\n    if (0 != EC_POINT_cmp(group, P, Q, ctx))\n        ABORT;\n    fprintf(stdout, "\\nGenerator as octet string, hybrid form:\\n     ");\n    for (i = 0; i < len; i++)\n        fprintf(stdout, "%02X", buf[i]);\n#  endif\n    fprintf(stdout, "\\n");\n    if (!EC_POINT_invert(group, P, ctx))\n        ABORT;\n    if (0 != EC_POINT_cmp(group, P, R, ctx))\n        ABORT;\n    CHAR2_CURVE_TEST\n        ("NIST curve K-163",\n         "0800000000000000000000000000000000000000C9",\n         "1",\n         "1",\n         "02FE13C0537BBC11ACAA07D793DE4E6D5E5C94EEE8",\n         "0289070FB05D38FF58321F2E800536D538CCDAA3D9",\n         1, "04000000000000000000020108A2E0CC0D99F8A5EF", "2", 163, C2_K163);\n    CHAR2_CURVE_TEST\n        ("NIST curve B-163",\n         "0800000000000000000000000000000000000000C9",\n         "1",\n         "020A601907B8C953CA1481EB10512F78744A3205FD",\n         "03F0EBA16286A2D57EA0991168D4994637E8343E36",\n         "00D51FBC6C71A0094FA2CDD545B11C5C0C797324F1",\n         1, "040000000000000000000292FE77E70C12A4234C33", "2", 163, C2_B163);\n    CHAR2_CURVE_TEST\n        ("NIST curve K-233",\n         "020000000000000000000000000000000000000004000000000000000001",\n         "0",\n         "1",\n         "017232BA853A7E731AF129F22FF4149563A419C26BF50A4C9D6EEFAD6126",\n         "01DB537DECE819B7F70F555A67C427A8CD9BF18AEB9B56E0C11056FAE6A3",\n         0,\n         "008000000000000000000000000000069D5BB915BCD46EFB1AD5F173ABDF",\n         "4", 233, C2_K233);\n    CHAR2_CURVE_TEST\n        ("NIST curve B-233",\n         "020000000000000000000000000000000000000004000000000000000001",\n         "000000000000000000000000000000000000000000000000000000000001",\n         "0066647EDE6C332C7F8C0923BB58213B333B20E9CE4281FE115F7D8F90AD",\n         "00FAC9DFCBAC8313BB2139F1BB755FEF65BC391F8B36F8F8EB7371FD558B",\n         "01006A08A41903350678E58528BEBF8A0BEFF867A7CA36716F7E01F81052",\n         1,\n         "01000000000000000000000000000013E974E72F8A6922031D2603CFE0D7",\n         "2", 233, C2_B233);\n    CHAR2_CURVE_TEST\n        ("NIST curve K-283",\n         "0800000000000000000000000000000000000000000000000000000000000000000010A1",\n         "0",\n         "1",\n         "0503213F78CA44883F1A3B8162F188E553CD265F23C1567A16876913B0C2AC2458492836",\n         "01CCDA380F1C9E318D90F95D07E5426FE87E45C0E8184698E45962364E34116177DD2259",\n         0,\n         "01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE9AE2ED07577265DFF7F94451E061E163C61",\n         "4", 283, C2_K283);\n    CHAR2_CURVE_TEST\n        ("NIST curve B-283",\n         "0800000000000000000000000000000000000000000000000000000000000000000010A1",\n         "000000000000000000000000000000000000000000000000000000000000000000000001",\n         "027B680AC8B8596DA5A4AF8A19A0303FCA97FD7645309FA2A581485AF6263E313B79A2F5",\n         "05F939258DB7DD90E1934F8C70B0DFEC2EED25B8557EAC9C80E2E198F8CDBECD86B12053",\n         "03676854FE24141CB98FE6D4B20D02B4516FF702350EDDB0826779C813F0DF45BE8112F4",\n         1,\n         "03FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEF90399660FC938A90165B042A7CEFADB307",\n         "2", 283, C2_B283);\n    CHAR2_CURVE_TEST\n        ("NIST curve K-409",\n         "02000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000001",\n         "0",\n         "1",\n         "0060F05F658F49C1AD3AB1890F7184210EFD0987E307C84C27ACCFB8F9F67CC2C460189EB5AAAA62EE222EB1B35540CFE9023746",\n         "01E369050B7C4E42ACBA1DACBF04299C3460782F918EA427E6325165E9EA10E3DA5F6C42E9C55215AA9CA27A5863EC48D8E0286B",\n         1,\n         "007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE5F83B2D4EA20400EC4557D5ED3E3E7CA5B4B5C83B8E01E5FCF",\n         "4", 409, C2_K409);\n    CHAR2_CURVE_TEST\n        ("NIST curve B-409",\n         "02000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000001",\n         "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",\n         "0021A5C2C8EE9FEB5C4B9A753B7B476B7FD6422EF1F3DD674761FA99D6AC27C8A9A197B272822F6CD57A55AA4F50AE317B13545F",\n         "015D4860D088DDB3496B0C6064756260441CDE4AF1771D4DB01FFE5B34E59703DC255A868A1180515603AEAB60794E54BB7996A7",\n         "0061B1CFAB6BE5F32BBFA78324ED106A7636B9C5A7BD198D0158AA4F5488D08F38514F1FDF4B4F40D2181B3681C364BA0273C706",\n         1,\n         "010000000000000000000000000000000000000000000000000001E2AAD6A612F33307BE5FA47C3C9E052F838164CD37D9A21173",\n         "2", 409, C2_B409);\n    CHAR2_CURVE_TEST\n        ("NIST curve K-571",\n         "80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000425",\n         "0",\n         "1",\n         "026EB7A859923FBC82189631F8103FE4AC9CA2970012D5D46024804801841CA44370958493B205E647DA304DB4CEB08CBBD1BA39494776FB988B47174DCA88C7E2945283A01C8972",\n         "0349DC807F4FBF374F4AEADE3BCA95314DD58CEC9F307A54FFC61EFC006D8A2C9D4979C0AC44AEA74FBEBBB9F772AEDCB620B01A7BA7AF1B320430C8591984F601CD4C143EF1C7A3",\n         0,\n         "020000000000000000000000000000000000000000000000000000000000000000000000131850E1F19A63E4B391A8DB917F4138B630D84BE5D639381E91DEB45CFE778F637C1001",\n         "4", 571, C2_K571);\n    CHAR2_CURVE_TEST\n        ("NIST curve B-571",\n         "80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000425",\n         "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",\n         "02F40E7E2221F295DE297117B7F3D62F5C6A97FFCB8CEFF1CD6BA8CE4A9A18AD84FFABBD8EFA59332BE7AD6756A66E294AFD185A78FF12AA520E4DE739BACA0C7FFEFF7F2955727A",\n         "0303001D34B856296C16C0D40D3CD7750A93D1D2955FA80AA5F40FC8DB7B2ABDBDE53950F4C0D293CDD711A35B67FB1499AE60038614F1394ABFA3B4C850D927E1E7769C8EEC2D19",\n         "037BF27342DA639B6DCCFFFEB73D69D78C6C27A6009CBBCA1980F8533921E8A684423E43BAB08A576291AF8F461BB2A8B3531D2F0485C19B16E2F1516E23DD3C1A4827AF1B8AC15B",\n         1,\n         "03FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE661CE18FF55987308059B186823851EC7DD9CA1161DE93D5174D66E8382E9BB2FE84E47",\n         "2", 571, C2_B571);\n    if (!EC_POINT_copy(Q, P))\n        ABORT;\n    if (EC_POINT_is_at_infinity(group, Q))\n        ABORT;\n    if (!EC_POINT_dbl(group, P, P, ctx))\n        ABORT;\n    if (EC_POINT_is_on_curve(group, P, ctx) <= 0)\n        ABORT;\n    if (!EC_POINT_invert(group, Q, ctx))\n        ABORT;\n    if (!EC_POINT_add(group, R, P, Q, ctx))\n        ABORT;\n    if (!EC_POINT_add(group, R, R, Q, ctx))\n        ABORT;\n    if (!EC_POINT_is_at_infinity(group, R))\n        ABORT;\n    {\n        const EC_POINT *points[3];\n        const BIGNUM *scalars[3];\n        if (EC_POINT_is_at_infinity(group, Q))\n            ABORT;\n        points[0] = Q;\n        points[1] = Q;\n        points[2] = Q;\n        if (!BN_add(y, z, BN_value_one()))\n            ABORT;\n        if (BN_is_odd(y))\n            ABORT;\n        if (!BN_rshift1(y, y))\n            ABORT;\n        scalars[0] = y;\n        scalars[1] = y;\n        fprintf(stdout, "combined multiplication ...");\n        fflush(stdout);\n        if (!EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx))\n            ABORT;\n        if (!EC_POINTs_mul(group, R, z, 2, points, scalars, ctx))\n            ABORT;\n        if (0 != EC_POINT_cmp(group, P, R, ctx))\n            ABORT;\n        if (0 != EC_POINT_cmp(group, R, Q, ctx))\n            ABORT;\n        fprintf(stdout, ".");\n        fflush(stdout);\n        if (!BN_pseudo_rand(y, BN_num_bits(y), 0, 0))\n            ABORT;\n        if (!BN_add(z, z, y))\n            ABORT;\n        BN_set_negative(z, 1);\n        scalars[0] = y;\n        scalars[1] = z;\n        if (!EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx))\n            ABORT;\n        if (!EC_POINT_is_at_infinity(group, P))\n            ABORT;\n        fprintf(stdout, ".");\n        fflush(stdout);\n        if (!BN_pseudo_rand(x, BN_num_bits(y) - 1, 0, 0))\n            ABORT;\n        if (!BN_add(z, x, y))\n            ABORT;\n        BN_set_negative(z, 1);\n        scalars[0] = x;\n        scalars[1] = y;\n        scalars[2] = z;\n        if (!EC_POINTs_mul(group, P, NULL, 3, points, scalars, ctx))\n            ABORT;\n        if (!EC_POINT_is_at_infinity(group, P))\n            ABORT;\n        fprintf(stdout, " ok\\n\\n");\n    }\n    BN_CTX_free(ctx);\n    BN_free(p);\n    BN_free(a);\n    BN_free(b);\n    EC_GROUP_free(group);\n    EC_POINT_free(P);\n    EC_POINT_free(Q);\n    EC_POINT_free(R);\n    BN_free(x);\n    BN_free(y);\n    BN_free(z);\n    BN_free(cof);\n    EC_GROUP_free(C2_K163);\n    EC_GROUP_free(C2_B163);\n    EC_GROUP_free(C2_K233);\n    EC_GROUP_free(C2_B233);\n    EC_GROUP_free(C2_K283);\n    EC_GROUP_free(C2_B283);\n    EC_GROUP_free(C2_K409);\n    EC_GROUP_free(C2_B409);\n    EC_GROUP_free(C2_K571);\n    EC_GROUP_free(C2_B571);\n}', 'BN_CTX *BN_CTX_new(void)\n{\n    BN_CTX *ret;\n    if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {\n        BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE);\n        return NULL;\n    }\n    BN_POOL_init(&ret->pool);\n    BN_STACK_init(&ret->stack);\n    return ret;\n}', 'void *CRYPTO_zalloc(size_t num, const char *file, int line)\n{\n    void *ret = CRYPTO_malloc(num, file, line);\n    if (ret != NULL)\n        memset(ret, 0, num);\n    return ret;\n}', 'void *CRYPTO_malloc(size_t num, const char *file, int line)\n{\n    void *ret = NULL;\n    if (num <= 0)\n        return NULL;\n    allow_customize = 0;\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_malloc(NULL, num, 0, file, line);\n        ret = malloc(num);\n        CRYPTO_mem_debug_malloc(ret, num, 1, file, line);\n    } else {\n        ret = malloc(num);\n    }\n#else\n    (void)file;\n    (void)line;\n    ret = malloc(num);\n#endif\n#ifndef OPENSSL_CPUID_OBJ\n    if (ret && (num > 2048)) {\n        extern unsigned char cleanse_ctr;\n        ((unsigned char *)ret)[0] = cleanse_ctr;\n    }\n#endif\n    return ret;\n}', 'static void BN_POOL_init(BN_POOL *p)\n{\n    p->head = p->current = p->tail = NULL;\n    p->used = p->size = 0;\n}', 'static void BN_STACK_init(BN_STACK *st)\n{\n    st->indexes = NULL;\n    st->depth = st->size = 0;\n}', 'BIGNUM *BN_new(void)\n{\n    BIGNUM *ret;\n    if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {\n        BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);\n        return (NULL);\n    }\n    ret->flags = BN_FLG_MALLOCED;\n    bn_check_top(ret);\n    return (ret);\n}']