projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Check return codes properly.
[openssl.git]
/
fips
/
rand
/
fips_drbg_ec.c
diff --git
a/fips/rand/fips_drbg_ec.c
b/fips/rand/fips_drbg_ec.c
index ccdab03cf97687cb5c53c0db2853015435f6d748..c4d7612d6c43b6467c2919e9760eb5698d5fb0eb 100644
(file)
--- a/
fips/rand/fips_drbg_ec.c
+++ b/
fips/rand/fips_drbg_ec.c
@@
-218,7
+218,7
@@
static int drbg_ec_mul(DRBG_EC_CTX *ectx, BIGNUM *r, const BIGNUM *s, int use_q)
if (!EC_POINT_get_affine_coordinates_GFp(ectx->curve, ectx->ptmp, r,
NULL, ectx->bctx))
return 0;
if (!EC_POINT_get_affine_coordinates_GFp(ectx->curve, ectx->ptmp, r,
NULL, ectx->bctx))
return 0;
- return
0
;
+ return
1
;
}
static int drbg_ec_instantiate(DRBG_CTX *dctx,
}
static int drbg_ec_instantiate(DRBG_CTX *dctx,
@@
-244,7
+244,7
@@
static int drbg_ec_reseed(DRBG_CTX *dctx,
/* Check if we have a deferred s = s * P */
if (ectx->sp_defer)
{
/* Check if we have a deferred s = s * P */
if (ectx->sp_defer)
{
- if (drbg_ec_mul(ectx, ectx->s, ectx->s, 0))
+ if (
!
drbg_ec_mul(ectx, ectx->s, ectx->s, 0))
return 0;
ectx->sp_defer = 0;
}
return 0;
ectx->sp_defer = 0;
}
@@
-281,7
+281,7
@@
static int drbg_ec_generate(DRBG_CTX *dctx,
/* Check if we have a deferred s = s * P */
if (ectx->sp_defer)
{
/* Check if we have a deferred s = s * P */
if (ectx->sp_defer)
{
- if (drbg_ec_mul(ectx, s, s, 0))
+ if (
!
drbg_ec_mul(ectx, s, s, 0))
goto err;
ectx->sp_defer = 0;
}
goto err;
ectx->sp_defer = 0;
}
@@
-311,7
+311,7
@@
static int drbg_ec_generate(DRBG_CTX *dctx,
return 0;
}
else
return 0;
}
else
- /* Note if no additional input t
and s t
he algorithm never
+ /* Note if no additional input the algorithm never
* needs separate values for t and s.
*/
t = s;
* needs separate values for t and s.
*/
t = s;
@@
-323,13
+323,13
@@
static int drbg_ec_generate(DRBG_CTX *dctx,
for (;;)
{
/* Step #6, calculate s = t * P */
for (;;)
{
/* Step #6, calculate s = t * P */
- if (drbg_ec_mul(ectx, s, t, 0))
+ if (
!
drbg_ec_mul(ectx, s, t, 0))
goto err;
#ifdef EC_DRBG_TRACE
bnprint(stderr, "s in generate: ", ectx->s);
#endif
/* Step #7, calculate r = s * Q */
goto err;
#ifdef EC_DRBG_TRACE
bnprint(stderr, "s in generate: ", ectx->s);
#endif
/* Step #7, calculate r = s * Q */
- if (drbg_ec_mul(ectx, r, s, 1))
+ if (
!
drbg_ec_mul(ectx, r, s, 1))
goto err;
#ifdef EC_DRBG_TRACE
bnprint(stderr, "r in generate is: ", r);
goto err;
#ifdef EC_DRBG_TRACE
bnprint(stderr, "r in generate is: ", r);
@@
-337,7
+337,7
@@
static int drbg_ec_generate(DRBG_CTX *dctx,
dctx->reseed_counter++;
/* Get rightmost bits of r to output buffer */
dctx->reseed_counter++;
/* Get rightmost bits of r to output buffer */
- if (!(dctx->flags & DRBG_FLAG_TEST) && !dctx->lb_valid)
+ if (!(dctx->
x
flags & DRBG_FLAG_TEST) && !dctx->lb_valid)
{
if (!bn2binpad(dctx->lb, dctx->blocklength, r))
goto err;
{
if (!bn2binpad(dctx->lb, dctx->blocklength, r))
goto err;
@@
-499,7
+499,7
@@
int fips_drbg_ec_init(DRBG_CTX *dctx)
return -2;
}
return -2;
}
- dctx->flags |= DRBG_CUSTOM_RESEED;
+ dctx->
i
flags |= DRBG_CUSTOM_RESEED;
dctx->reseed_counter = 0;
dctx->instantiate = drbg_ec_instantiate;
dctx->reseed = drbg_ec_reseed;
dctx->reseed_counter = 0;
dctx->instantiate = drbg_ec_instantiate;
dctx->reseed = drbg_ec_reseed;