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


test/ectest.c:229:1: start of procedure prime_field_tests()
227.   }
228.   
229. > static void prime_field_tests(void)
230.   {
231.       BN_CTX *ctx = NULL;

test/ectest.c:231:5: 
229.   static void prime_field_tests(void)
230.   {
231. >     BN_CTX *ctx = NULL;
232.       BIGNUM *p, *a, *b;
233.       EC_GROUP *group;

test/ectest.c:234:5: 
232.       BIGNUM *p, *a, *b;
233.       EC_GROUP *group;
234. >     EC_GROUP *P_160 = NULL, *P_192 = NULL, *P_224 = NULL, *P_256 =
235.           NULL, *P_384 = NULL, *P_521 = NULL;
236.       EC_POINT *P, *Q, *R;

test/ectest.c:242:5: 
240.       int k;
241.   
242. >     ctx = BN_CTX_new();
243.       if (!ctx)
244.           ABORT;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

test/ectest.c:243:10: Taking false branch
241.   
242.       ctx = BN_CTX_new();
243.       if (!ctx)
                ^
244.           ABORT;
245.   

test/ectest.c:246:5: 
244.           ABORT;
245.   
246. >     p = BN_new();
247.       a = BN_new();
248.       b = BN_new();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

test/ectest.c:247:5: 
245.   
246.       p = BN_new();
247. >     a = BN_new();
248.       b = BN_new();
249.       if (!p || !a || !b)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

test/ectest.c:248:5: 
246.       p = BN_new();
247.       a = BN_new();
248. >     b = BN_new();
249.       if (!p || !a || !b)
250.           ABORT;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

test/ectest.c:249:10: Taking false branch
247.       a = BN_new();
248.       b = BN_new();
249.       if (!p || !a || !b)
                ^
250.           ABORT;
251.   

test/ectest.c:249:16: Taking false branch
247.       a = BN_new();
248.       b = BN_new();
249.       if (!p || !a || !b)
                      ^
250.           ABORT;
251.   

test/ectest.c:249:22: Taking false branch
247.       a = BN_new();
248.       b = BN_new();
249.       if (!p || !a || !b)
                            ^
250.           ABORT;
251.   

test/ectest.c:252:10: Taking false branch
250.           ABORT;
251.   
252.       if (!BN_hex2bn(&p, "17"))
                ^
253.           ABORT;
254.       if (!BN_hex2bn(&a, "1"))

test/ectest.c:254:10: Taking false branch
252.       if (!BN_hex2bn(&p, "17"))
253.           ABORT;
254.       if (!BN_hex2bn(&a, "1"))
                ^
255.           ABORT;
256.       if (!BN_hex2bn(&b, "1"))

test/ectest.c:256:10: Skipping BN_hex2bn(): empty list of specs
254.       if (!BN_hex2bn(&a, "1"))
255.           ABORT;
256.       if (!BN_hex2bn(&b, "1"))
                ^
257.           ABORT;
258.   

static void prime_field_tests(void)
{
    BN_CTX *ctx = NULL;
    BIGNUM *p, *a, *b;
    EC_GROUP *group;
    EC_GROUP *P_160 = NULL, *P_192 = NULL, *P_224 = NULL, *P_256 =
        NULL, *P_384 = NULL, *P_521 = NULL;
    EC_POINT *P, *Q, *R;
    BIGNUM *x, *y, *z;
    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, "17"))
        ABORT;
    if (!BN_hex2bn(&a, "1"))
        ABORT;
    if (!BN_hex2bn(&b, "1"))
        ABORT;
    group = EC_GROUP_new(EC_GFp_mont_method());
    if (!group)
        ABORT;
    if (!EC_GROUP_set_curve_GFp(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_GFp(group, p, a, b, ctx))
        ABORT;
    fprintf(stdout,
            "Curve defined by Weierstrass equation\n     y^2 = x^3 + a*x + 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");
    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();
    if (!x || !y || !z)
        ABORT;
    if (!BN_hex2bn(&x, "D"))
        ABORT;
    if (!EC_POINT_set_compressed_coordinates_GFp(group, Q, x, 1, ctx))
        ABORT;
    if (EC_POINT_is_on_curve(group, Q, ctx) <= 0) {
        if (!EC_POINT_get_affine_coordinates_GFp(group, Q, x, y, ctx))
            ABORT;
        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_GFp(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;
    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]);
    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]);
    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]);
    if (!EC_POINT_get_Jprojective_coordinates_GFp(group, R, x, y, z, ctx))
        ABORT;
    fprintf(stdout,
            "\nA representation of the inverse of that generator in\nJacobian projective coordinates:\n     X = 0x");
    BN_print_fp(stdout, x);
    fprintf(stdout, ", Y = 0x");
    BN_print_fp(stdout, y);
    fprintf(stdout, ", Z = 0x");
    BN_print_fp(stdout, z);
    fprintf(stdout, "\n");
    if (!EC_POINT_invert(group, P, ctx))
        ABORT;
    if (0 != EC_POINT_cmp(group, P, R, ctx))
        ABORT;
    if (!BN_hex2bn(&p, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF"))
        ABORT;
    if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL))
        ABORT;
    if (!BN_hex2bn(&a, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC"))
        ABORT;
    if (!BN_hex2bn(&b, "1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45"))
        ABORT;
    if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx))
        ABORT;
    if (!BN_hex2bn(&x, "4A96B5688EF573284664698968C38BB913CBFC82"))
        ABORT;
    if (!BN_hex2bn(&y, "23a628553168947d59dcc912042351377ac5fb32"))
        ABORT;
    if (!EC_POINT_set_affine_coordinates_GFp(group, P, x, y, ctx))
        ABORT;
    if (EC_POINT_is_on_curve(group, P, ctx) <= 0)
        ABORT;
    if (!BN_hex2bn(&z, "0100000000000000000001F4C8F927AED3CA752257"))
        ABORT;
    if (!EC_GROUP_set_generator(group, P, z, BN_value_one()))
        ABORT;
    if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx))
        ABORT;
    fprintf(stdout, "\nSEC2 curve secp160r1 -- Generator:\n     x = 0x");
    BN_print_fp(stdout, x);
    fprintf(stdout, "\n     y = 0x");
    BN_print_fp(stdout, y);
    fprintf(stdout, "\n");
    if (!BN_hex2bn(&z, "23a628553168947d59dcc912042351377ac5fb32"))
        ABORT;
    if (0 != BN_cmp(y, z))
        ABORT;
    fprintf(stdout, "verify degree ...");
    if (EC_GROUP_get_degree(group) != 160)
        ABORT;
    fprintf(stdout, " ok\n");
    group_order_tests(group);
    if ((P_160 = EC_GROUP_new(EC_GROUP_method_of(group))) == NULL)
        ABORT;
    if (!EC_GROUP_copy(P_160, group))
        ABORT;
    if (!BN_hex2bn(&p, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF"))
        ABORT;
    if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL))
        ABORT;
    if (!BN_hex2bn(&a, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC"))
        ABORT;
    if (!BN_hex2bn(&b, "64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1"))
        ABORT;
    if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx))
        ABORT;
    if (!BN_hex2bn(&x, "188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012"))
        ABORT;
    if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 1, ctx))
        ABORT;
    if (EC_POINT_is_on_curve(group, P, ctx) <= 0)
        ABORT;
    if (!BN_hex2bn(&z, "FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831"))
        ABORT;
    if (!EC_GROUP_set_generator(group, P, z, BN_value_one()))
        ABORT;
    if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx))
        ABORT;
    fprintf(stdout, "\nNIST curve P-192 -- Generator:\n     x = 0x");
    BN_print_fp(stdout, x);
    fprintf(stdout, "\n     y = 0x");
    BN_print_fp(stdout, y);
    fprintf(stdout, "\n");
    if (!BN_hex2bn(&z, "07192B95FFC8DA78631011ED6B24CDD573F977A11E794811"))
        ABORT;
    if (0 != BN_cmp(y, z))
        ABORT;
    fprintf(stdout, "verify degree ...");
    if (EC_GROUP_get_degree(group) != 192)
        ABORT;
    fprintf(stdout, " ok\n");
    group_order_tests(group);
    if ((P_192 = EC_GROUP_new(EC_GROUP_method_of(group))) == NULL)
        ABORT;
    if (!EC_GROUP_copy(P_192, group))
        ABORT;
    if (!BN_hex2bn
        (&p, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001"))
        ABORT;
    if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL))
        ABORT;
    if (!BN_hex2bn
        (&a, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE"))
        ABORT;
    if (!BN_hex2bn
        (&b, "B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4"))
        ABORT;
    if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx))
        ABORT;
    if (!BN_hex2bn
        (&x, "B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21"))
        ABORT;
    if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 0, ctx))
        ABORT;
    if (EC_POINT_is_on_curve(group, P, ctx) <= 0)
        ABORT;
    if (!BN_hex2bn
        (&z, "FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D"))
        ABORT;
    if (!EC_GROUP_set_generator(group, P, z, BN_value_one()))
        ABORT;
    if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx))
        ABORT;
    fprintf(stdout, "\nNIST curve P-224 -- Generator:\n     x = 0x");
    BN_print_fp(stdout, x);
    fprintf(stdout, "\n     y = 0x");
    BN_print_fp(stdout, y);
    fprintf(stdout, "\n");
    if (!BN_hex2bn
        (&z, "BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34"))
        ABORT;
    if (0 != BN_cmp(y, z))
        ABORT;
    fprintf(stdout, "verify degree ...");
    if (EC_GROUP_get_degree(group) != 224)
        ABORT;
    fprintf(stdout, " ok\n");
    group_order_tests(group);
    if ((P_224 = EC_GROUP_new(EC_GROUP_method_of(group))) == NULL)
        ABORT;
    if (!EC_GROUP_copy(P_224, group))
        ABORT;
    if (!BN_hex2bn
        (&p,
         "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF"))
        ABORT;
    if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL))
        ABORT;
    if (!BN_hex2bn
        (&a,
         "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC"))
        ABORT;
    if (!BN_hex2bn
        (&b,
         "5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B"))
        ABORT;
    if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx))
        ABORT;
    if (!BN_hex2bn
        (&x,
         "6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296"))
        ABORT;
    if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 1, ctx))
        ABORT;
    if (EC_POINT_is_on_curve(group, P, ctx) <= 0)
        ABORT;
    if (!BN_hex2bn(&z, "FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E"
                   "84F3B9CAC2FC632551"))
        ABORT;
    if (!EC_GROUP_set_generator(group, P, z, BN_value_one()))
        ABORT;
    if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx))
        ABORT;
    fprintf(stdout, "\nNIST curve P-256 -- Generator:\n     x = 0x");
    BN_print_fp(stdout, x);
    fprintf(stdout, "\n     y = 0x");
    BN_print_fp(stdout, y);
    fprintf(stdout, "\n");
    if (!BN_hex2bn
        (&z,
         "4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5"))
        ABORT;
    if (0 != BN_cmp(y, z))
        ABORT;
    fprintf(stdout, "verify degree ...");
    if (EC_GROUP_get_degree(group) != 256)
        ABORT;
    fprintf(stdout, " ok\n");
    group_order_tests(group);
    if ((P_256 = EC_GROUP_new(EC_GROUP_method_of(group))) == NULL)
        ABORT;
    if (!EC_GROUP_copy(P_256, group))
        ABORT;
    if (!BN_hex2bn(&p, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
                   "FFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF"))
        ABORT;
    if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL))
        ABORT;
    if (!BN_hex2bn(&a, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
                   "FFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC"))
        ABORT;
    if (!BN_hex2bn(&b, "B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141"
                   "120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF"))
        ABORT;
    if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx))
        ABORT;
    if (!BN_hex2bn(&x, "AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B"
                   "9859F741E082542A385502F25DBF55296C3A545E3872760AB7"))
        ABORT;
    if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 1, ctx))
        ABORT;
    if (EC_POINT_is_on_curve(group, P, ctx) <= 0)
        ABORT;
    if (!BN_hex2bn(&z, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
                   "FFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973"))
        ABORT;
    if (!EC_GROUP_set_generator(group, P, z, BN_value_one()))
        ABORT;
    if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx))
        ABORT;
    fprintf(stdout, "\nNIST curve P-384 -- Generator:\n     x = 0x");
    BN_print_fp(stdout, x);
    fprintf(stdout, "\n     y = 0x");
    BN_print_fp(stdout, y);
    fprintf(stdout, "\n");
    if (!BN_hex2bn(&z, "3617DE4A96262C6F5D9E98BF9292DC29F8F41DBD289A14"
                   "7CE9DA3113B5F0B8C00A60B1CE1D7E819D7A431D7C90EA0E5F"))
        ABORT;
    if (0 != BN_cmp(y, z))
        ABORT;
    fprintf(stdout, "verify degree ...");
    if (EC_GROUP_get_degree(group) != 384)
        ABORT;
    fprintf(stdout, " ok\n");
    group_order_tests(group);
    if ((P_384 = EC_GROUP_new(EC_GROUP_method_of(group))) == NULL)
        ABORT;
    if (!EC_GROUP_copy(P_384, group))
        ABORT;
    if (!BN_hex2bn(&p, "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
                   "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
                   "FFFFFFFFFFFFFFFFFFFFFFFFFFFF"))
        ABORT;
    if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL))
        ABORT;
    if (!BN_hex2bn(&a, "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
                   "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
                   "FFFFFFFFFFFFFFFFFFFFFFFFFFFC"))
        ABORT;
    if (!BN_hex2bn(&b, "051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B"
                   "315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573"
                   "DF883D2C34F1EF451FD46B503F00"))
        ABORT;
    if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx))
        ABORT;
    if (!BN_hex2bn(&x, "C6858E06B70404E9CD9E3ECB662395B4429C648139053F"
                   "B521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B"
                   "3C1856A429BF97E7E31C2E5BD66"))
        ABORT;
    if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 0, ctx))
        ABORT;
    if (EC_POINT_is_on_curve(group, P, ctx) <= 0)
        ABORT;
    if (!BN_hex2bn(&z, "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
                   "FFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5"
                   "C9B8899C47AEBB6FB71E91386409"))
        ABORT;
    if (!EC_GROUP_set_generator(group, P, z, BN_value_one()))
        ABORT;
    if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx))
        ABORT;
    fprintf(stdout, "\nNIST curve P-521 -- Generator:\n     x = 0x");
    BN_print_fp(stdout, x);
    fprintf(stdout, "\n     y = 0x");
    BN_print_fp(stdout, y);
    fprintf(stdout, "\n");
    if (!BN_hex2bn(&z, "11839296A789A3BC0045C8A5FB42C7D1BD998F54449579"
                   "B446817AFBD17273E662C97EE72995EF42640C550B9013FAD0761353C"
                   "7086A272C24088BE94769FD16650"))
        ABORT;
    if (0 != BN_cmp(y, z))
        ABORT;
    fprintf(stdout, "verify degree ...");
    if (EC_GROUP_get_degree(group) != 521)
        ABORT;
    fprintf(stdout, " ok\n");
    group_order_tests(group);
    if ((P_521 = EC_GROUP_new(EC_GROUP_method_of(group))) == NULL)
        ABORT;
    if (!EC_GROUP_copy(P_521, group))
        ABORT;
    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[4];
        const BIGNUM *scalars[4];
        BIGNUM *scalar3;
        if (EC_POINT_is_at_infinity(group, Q))
            ABORT;
        points[0] = Q;
        points[1] = Q;
        points[2] = Q;
        points[3] = Q;
        if (!EC_GROUP_get_order(group, z, ctx))
            ABORT;
        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;
        scalar3 = BN_new();
        if (!scalar3)
            ABORT;
        BN_zero(scalar3);
        scalars[3] = scalar3;
        if (!EC_POINTs_mul(group, P, NULL, 4, points, scalars, ctx))
            ABORT;
        if (!EC_POINT_is_at_infinity(group, P))
            ABORT;
        fprintf(stdout, " ok\n\n");
        BN_free(scalar3);
    }
    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);
    EC_GROUP_free(P_160);
    EC_GROUP_free(P_192);
    EC_GROUP_free(P_224);
    EC_GROUP_free(P_256);
    EC_GROUP_free(P_384);
    EC_GROUP_free(P_521);
}
['static void prime_field_tests(void)\n{\n    BN_CTX *ctx = NULL;\n    BIGNUM *p, *a, *b;\n    EC_GROUP *group;\n    EC_GROUP *P_160 = NULL, *P_192 = NULL, *P_224 = NULL, *P_256 =\n        NULL, *P_384 = NULL, *P_521 = NULL;\n    EC_POINT *P, *Q, *R;\n    BIGNUM *x, *y, *z;\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, "17"))\n        ABORT;\n    if (!BN_hex2bn(&a, "1"))\n        ABORT;\n    if (!BN_hex2bn(&b, "1"))\n        ABORT;\n    group = EC_GROUP_new(EC_GFp_mont_method());\n    if (!group)\n        ABORT;\n    if (!EC_GROUP_set_curve_GFp(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_GFp(group, p, a, b, ctx))\n        ABORT;\n    fprintf(stdout,\n            "Curve defined by Weierstrass equation\\n     y^2 = x^3 + a*x + 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");\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    if (!x || !y || !z)\n        ABORT;\n    if (!BN_hex2bn(&x, "D"))\n        ABORT;\n    if (!EC_POINT_set_compressed_coordinates_GFp(group, Q, x, 1, ctx))\n        ABORT;\n    if (EC_POINT_is_on_curve(group, Q, ctx) <= 0) {\n        if (!EC_POINT_get_affine_coordinates_GFp(group, Q, x, y, ctx))\n            ABORT;\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_GFp(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    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    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    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    if (!EC_POINT_get_Jprojective_coordinates_GFp(group, R, x, y, z, ctx))\n        ABORT;\n    fprintf(stdout,\n            "\\nA representation of the inverse of that generator in\\nJacobian projective coordinates:\\n     X = 0x");\n    BN_print_fp(stdout, x);\n    fprintf(stdout, ", Y = 0x");\n    BN_print_fp(stdout, y);\n    fprintf(stdout, ", Z = 0x");\n    BN_print_fp(stdout, z);\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    if (!BN_hex2bn(&p, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF"))\n        ABORT;\n    if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL))\n        ABORT;\n    if (!BN_hex2bn(&a, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC"))\n        ABORT;\n    if (!BN_hex2bn(&b, "1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45"))\n        ABORT;\n    if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx))\n        ABORT;\n    if (!BN_hex2bn(&x, "4A96B5688EF573284664698968C38BB913CBFC82"))\n        ABORT;\n    if (!BN_hex2bn(&y, "23a628553168947d59dcc912042351377ac5fb32"))\n        ABORT;\n    if (!EC_POINT_set_affine_coordinates_GFp(group, P, x, y, ctx))\n        ABORT;\n    if (EC_POINT_is_on_curve(group, P, ctx) <= 0)\n        ABORT;\n    if (!BN_hex2bn(&z, "0100000000000000000001F4C8F927AED3CA752257"))\n        ABORT;\n    if (!EC_GROUP_set_generator(group, P, z, BN_value_one()))\n        ABORT;\n    if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx))\n        ABORT;\n    fprintf(stdout, "\\nSEC2 curve secp160r1 -- Generator:\\n     x = 0x");\n    BN_print_fp(stdout, x);\n    fprintf(stdout, "\\n     y = 0x");\n    BN_print_fp(stdout, y);\n    fprintf(stdout, "\\n");\n    if (!BN_hex2bn(&z, "23a628553168947d59dcc912042351377ac5fb32"))\n        ABORT;\n    if (0 != BN_cmp(y, z))\n        ABORT;\n    fprintf(stdout, "verify degree ...");\n    if (EC_GROUP_get_degree(group) != 160)\n        ABORT;\n    fprintf(stdout, " ok\\n");\n    group_order_tests(group);\n    if ((P_160 = EC_GROUP_new(EC_GROUP_method_of(group))) == NULL)\n        ABORT;\n    if (!EC_GROUP_copy(P_160, group))\n        ABORT;\n    if (!BN_hex2bn(&p, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF"))\n        ABORT;\n    if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL))\n        ABORT;\n    if (!BN_hex2bn(&a, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC"))\n        ABORT;\n    if (!BN_hex2bn(&b, "64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1"))\n        ABORT;\n    if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx))\n        ABORT;\n    if (!BN_hex2bn(&x, "188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012"))\n        ABORT;\n    if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 1, ctx))\n        ABORT;\n    if (EC_POINT_is_on_curve(group, P, ctx) <= 0)\n        ABORT;\n    if (!BN_hex2bn(&z, "FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831"))\n        ABORT;\n    if (!EC_GROUP_set_generator(group, P, z, BN_value_one()))\n        ABORT;\n    if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx))\n        ABORT;\n    fprintf(stdout, "\\nNIST curve P-192 -- Generator:\\n     x = 0x");\n    BN_print_fp(stdout, x);\n    fprintf(stdout, "\\n     y = 0x");\n    BN_print_fp(stdout, y);\n    fprintf(stdout, "\\n");\n    if (!BN_hex2bn(&z, "07192B95FFC8DA78631011ED6B24CDD573F977A11E794811"))\n        ABORT;\n    if (0 != BN_cmp(y, z))\n        ABORT;\n    fprintf(stdout, "verify degree ...");\n    if (EC_GROUP_get_degree(group) != 192)\n        ABORT;\n    fprintf(stdout, " ok\\n");\n    group_order_tests(group);\n    if ((P_192 = EC_GROUP_new(EC_GROUP_method_of(group))) == NULL)\n        ABORT;\n    if (!EC_GROUP_copy(P_192, group))\n        ABORT;\n    if (!BN_hex2bn\n        (&p, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001"))\n        ABORT;\n    if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL))\n        ABORT;\n    if (!BN_hex2bn\n        (&a, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE"))\n        ABORT;\n    if (!BN_hex2bn\n        (&b, "B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4"))\n        ABORT;\n    if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx))\n        ABORT;\n    if (!BN_hex2bn\n        (&x, "B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21"))\n        ABORT;\n    if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 0, ctx))\n        ABORT;\n    if (EC_POINT_is_on_curve(group, P, ctx) <= 0)\n        ABORT;\n    if (!BN_hex2bn\n        (&z, "FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D"))\n        ABORT;\n    if (!EC_GROUP_set_generator(group, P, z, BN_value_one()))\n        ABORT;\n    if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx))\n        ABORT;\n    fprintf(stdout, "\\nNIST curve P-224 -- Generator:\\n     x = 0x");\n    BN_print_fp(stdout, x);\n    fprintf(stdout, "\\n     y = 0x");\n    BN_print_fp(stdout, y);\n    fprintf(stdout, "\\n");\n    if (!BN_hex2bn\n        (&z, "BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34"))\n        ABORT;\n    if (0 != BN_cmp(y, z))\n        ABORT;\n    fprintf(stdout, "verify degree ...");\n    if (EC_GROUP_get_degree(group) != 224)\n        ABORT;\n    fprintf(stdout, " ok\\n");\n    group_order_tests(group);\n    if ((P_224 = EC_GROUP_new(EC_GROUP_method_of(group))) == NULL)\n        ABORT;\n    if (!EC_GROUP_copy(P_224, group))\n        ABORT;\n    if (!BN_hex2bn\n        (&p,\n         "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF"))\n        ABORT;\n    if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL))\n        ABORT;\n    if (!BN_hex2bn\n        (&a,\n         "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC"))\n        ABORT;\n    if (!BN_hex2bn\n        (&b,\n         "5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B"))\n        ABORT;\n    if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx))\n        ABORT;\n    if (!BN_hex2bn\n        (&x,\n         "6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296"))\n        ABORT;\n    if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 1, ctx))\n        ABORT;\n    if (EC_POINT_is_on_curve(group, P, ctx) <= 0)\n        ABORT;\n    if (!BN_hex2bn(&z, "FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E"\n                   "84F3B9CAC2FC632551"))\n        ABORT;\n    if (!EC_GROUP_set_generator(group, P, z, BN_value_one()))\n        ABORT;\n    if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx))\n        ABORT;\n    fprintf(stdout, "\\nNIST curve P-256 -- Generator:\\n     x = 0x");\n    BN_print_fp(stdout, x);\n    fprintf(stdout, "\\n     y = 0x");\n    BN_print_fp(stdout, y);\n    fprintf(stdout, "\\n");\n    if (!BN_hex2bn\n        (&z,\n         "4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5"))\n        ABORT;\n    if (0 != BN_cmp(y, z))\n        ABORT;\n    fprintf(stdout, "verify degree ...");\n    if (EC_GROUP_get_degree(group) != 256)\n        ABORT;\n    fprintf(stdout, " ok\\n");\n    group_order_tests(group);\n    if ((P_256 = EC_GROUP_new(EC_GROUP_method_of(group))) == NULL)\n        ABORT;\n    if (!EC_GROUP_copy(P_256, group))\n        ABORT;\n    if (!BN_hex2bn(&p, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"\n                   "FFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF"))\n        ABORT;\n    if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL))\n        ABORT;\n    if (!BN_hex2bn(&a, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"\n                   "FFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC"))\n        ABORT;\n    if (!BN_hex2bn(&b, "B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141"\n                   "120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF"))\n        ABORT;\n    if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx))\n        ABORT;\n    if (!BN_hex2bn(&x, "AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B"\n                   "9859F741E082542A385502F25DBF55296C3A545E3872760AB7"))\n        ABORT;\n    if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 1, ctx))\n        ABORT;\n    if (EC_POINT_is_on_curve(group, P, ctx) <= 0)\n        ABORT;\n    if (!BN_hex2bn(&z, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"\n                   "FFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973"))\n        ABORT;\n    if (!EC_GROUP_set_generator(group, P, z, BN_value_one()))\n        ABORT;\n    if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx))\n        ABORT;\n    fprintf(stdout, "\\nNIST curve P-384 -- Generator:\\n     x = 0x");\n    BN_print_fp(stdout, x);\n    fprintf(stdout, "\\n     y = 0x");\n    BN_print_fp(stdout, y);\n    fprintf(stdout, "\\n");\n    if (!BN_hex2bn(&z, "3617DE4A96262C6F5D9E98BF9292DC29F8F41DBD289A14"\n                   "7CE9DA3113B5F0B8C00A60B1CE1D7E819D7A431D7C90EA0E5F"))\n        ABORT;\n    if (0 != BN_cmp(y, z))\n        ABORT;\n    fprintf(stdout, "verify degree ...");\n    if (EC_GROUP_get_degree(group) != 384)\n        ABORT;\n    fprintf(stdout, " ok\\n");\n    group_order_tests(group);\n    if ((P_384 = EC_GROUP_new(EC_GROUP_method_of(group))) == NULL)\n        ABORT;\n    if (!EC_GROUP_copy(P_384, group))\n        ABORT;\n    if (!BN_hex2bn(&p, "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"\n                   "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"\n                   "FFFFFFFFFFFFFFFFFFFFFFFFFFFF"))\n        ABORT;\n    if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL))\n        ABORT;\n    if (!BN_hex2bn(&a, "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"\n                   "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"\n                   "FFFFFFFFFFFFFFFFFFFFFFFFFFFC"))\n        ABORT;\n    if (!BN_hex2bn(&b, "051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B"\n                   "315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573"\n                   "DF883D2C34F1EF451FD46B503F00"))\n        ABORT;\n    if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx))\n        ABORT;\n    if (!BN_hex2bn(&x, "C6858E06B70404E9CD9E3ECB662395B4429C648139053F"\n                   "B521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B"\n                   "3C1856A429BF97E7E31C2E5BD66"))\n        ABORT;\n    if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 0, ctx))\n        ABORT;\n    if (EC_POINT_is_on_curve(group, P, ctx) <= 0)\n        ABORT;\n    if (!BN_hex2bn(&z, "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"\n                   "FFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5"\n                   "C9B8899C47AEBB6FB71E91386409"))\n        ABORT;\n    if (!EC_GROUP_set_generator(group, P, z, BN_value_one()))\n        ABORT;\n    if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx))\n        ABORT;\n    fprintf(stdout, "\\nNIST curve P-521 -- Generator:\\n     x = 0x");\n    BN_print_fp(stdout, x);\n    fprintf(stdout, "\\n     y = 0x");\n    BN_print_fp(stdout, y);\n    fprintf(stdout, "\\n");\n    if (!BN_hex2bn(&z, "11839296A789A3BC0045C8A5FB42C7D1BD998F54449579"\n                   "B446817AFBD17273E662C97EE72995EF42640C550B9013FAD0761353C"\n                   "7086A272C24088BE94769FD16650"))\n        ABORT;\n    if (0 != BN_cmp(y, z))\n        ABORT;\n    fprintf(stdout, "verify degree ...");\n    if (EC_GROUP_get_degree(group) != 521)\n        ABORT;\n    fprintf(stdout, " ok\\n");\n    group_order_tests(group);\n    if ((P_521 = EC_GROUP_new(EC_GROUP_method_of(group))) == NULL)\n        ABORT;\n    if (!EC_GROUP_copy(P_521, group))\n        ABORT;\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[4];\n        const BIGNUM *scalars[4];\n        BIGNUM *scalar3;\n        if (EC_POINT_is_at_infinity(group, Q))\n            ABORT;\n        points[0] = Q;\n        points[1] = Q;\n        points[2] = Q;\n        points[3] = Q;\n        if (!EC_GROUP_get_order(group, z, ctx))\n            ABORT;\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        scalar3 = BN_new();\n        if (!scalar3)\n            ABORT;\n        BN_zero(scalar3);\n        scalars[3] = scalar3;\n        if (!EC_POINTs_mul(group, P, NULL, 4, points, scalars, ctx))\n            ABORT;\n        if (!EC_POINT_is_at_infinity(group, P))\n            ABORT;\n        fprintf(stdout, " ok\\n\\n");\n        BN_free(scalar3);\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    EC_GROUP_free(P_160);\n    EC_GROUP_free(P_192);\n    EC_GROUP_free(P_224);\n    EC_GROUP_free(P_256);\n    EC_GROUP_free(P_384);\n    EC_GROUP_free(P_521);\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#ifdef 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}']