OpenCoverage

ec_check.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/ec/ec_check.c
Source codeSwitch to Preprocessed file
LineSourceCount
1/*-
2 * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.-
3 *-
4 * Licensed under the OpenSSL license (the "License"). You may not use-
5 * this file except in compliance with the License. You can obtain a copy-
6 * in the file LICENSE in the source distribution or at-
7 * https://www.openssl.org/source/license.html-
8 */-
9-
10#include "ec_lcl.h"-
11#include <openssl/err.h>-
12-
13int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx)-
14{-
15 int ret = 0;-
16 const BIGNUM *order;-
17 BN_CTX *new_ctx = NULL;-
18 EC_POINT *point = NULL;-
19-
20 /* Custom curves assumed to be correct */-
21 if ((group->meth->flags & EC_FLAGS_CUSTOM_CURVE) != 0)
(group->meth->...gs & 0x2) != 0Description
TRUEnever evaluated
FALSEevaluated 216 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-216
22 return 1;
never executed: return 1;
0
23-
24 if (ctx == NULL) {
ctx == ((void *)0)Description
TRUEevaluated 216 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-216
25 ctx = new_ctx = BN_CTX_new();-
26 if (ctx == NULL) {
ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 216 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-216
27 ECerr(EC_F_EC_GROUP_CHECK, ERR_R_MALLOC_FAILURE);-
28 goto err;
never executed: goto err;
0
29 }-
30 }
executed 216 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
216
31-
32 /* check the discriminant */-
33 if (!EC_GROUP_check_discriminant(group, ctx)) {
!EC_GROUP_chec...nt(group, ctx)Description
TRUEnever evaluated
FALSEevaluated 216 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-216
34 ECerr(EC_F_EC_GROUP_CHECK, EC_R_DISCRIMINANT_IS_ZERO);-
35 goto err;
never executed: goto err;
0
36 }-
37-
38 /* check the generator */-
39 if (group->generator == NULL) {
group->generat...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 216 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-216
40 ECerr(EC_F_EC_GROUP_CHECK, EC_R_UNDEFINED_GENERATOR);-
41 goto err;
never executed: goto err;
0
42 }-
43 if (EC_POINT_is_on_curve(group, group->generator, ctx) <= 0) {
EC_POINT_is_on...tor, ctx) <= 0Description
TRUEnever evaluated
FALSEevaluated 216 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-216
44 ECerr(EC_F_EC_GROUP_CHECK, EC_R_POINT_IS_NOT_ON_CURVE);-
45 goto err;
never executed: goto err;
0
46 }-
47-
48 /* check the order of the generator */-
49 if ((point = EC_POINT_new(group)) == NULL)
(point = EC_PO...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 216 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-216
50 goto err;
never executed: goto err;
0
51 order = EC_GROUP_get0_order(group);-
52 if (order == NULL)
order == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 216 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-216
53 goto err;
never executed: goto err;
0
54 if (BN_is_zero(order)) {
BN_is_zero(order)Description
TRUEnever evaluated
FALSEevaluated 216 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-216
55 ECerr(EC_F_EC_GROUP_CHECK, EC_R_UNDEFINED_ORDER);-
56 goto err;
never executed: goto err;
0
57 }-
58-
59 if (!EC_POINT_mul(group, point, order, NULL, NULL, ctx))
!EC_POINT_mul(...id *)0) , ctx)Description
TRUEnever evaluated
FALSEevaluated 216 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-216
60 goto err;
never executed: goto err;
0
61 if (!EC_POINT_is_at_infinity(group, point)) {
!EC_POINT_is_a...(group, point)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 215 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
1-215
62 ECerr(EC_F_EC_GROUP_CHECK, EC_R_INVALID_GROUP_ORDER);-
63 goto err;
executed 1 time by 1 test: goto err;
Executed by:
  • libcrypto.so.1.1
1
64 }-
65-
66 ret = 1;-
67-
68 err:
code before this statement executed 215 times by 1 test: err:
Executed by:
  • libcrypto.so.1.1
215
69 BN_CTX_free(new_ctx);-
70 EC_POINT_free(point);-
71 return ret;
executed 216 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
216
72}-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.2