X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=crypto%2Frsa%2Frsa_x931g.c;h=1e164e86e14580eb89876d75dcca8205c345d604;hp=e158c6d443c478334a3c8ef577c4833110ea2f12;hb=9862e9aa98ee1e38fbcef8d1dd5db0e750eb5e8d;hpb=23a1d5e97cd543d2b8e1b01dbf0f619b2e5ce540 diff --git a/crypto/rsa/rsa_x931g.c b/crypto/rsa/rsa_x931g.c index e158c6d443..1e164e86e1 100644 --- a/crypto/rsa/rsa_x931g.c +++ b/crypto/rsa/rsa_x931g.c @@ -1,4 +1,3 @@ -/* crypto/rsa/rsa_gen.c */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -61,7 +60,7 @@ #include #include #include -#include +#include "rsa_locl.h" /* X9.31 RSA key derivation and generation */ @@ -78,7 +77,7 @@ int RSA_X931_derive_ex(RSA *rsa, BIGNUM *p1, BIGNUM *p2, BIGNUM *q1, goto err; ctx = BN_CTX_new(); - if (!ctx) + if (ctx == NULL) goto err; BN_CTX_start(ctx); @@ -101,9 +100,9 @@ int RSA_X931_derive_ex(RSA *rsa, BIGNUM *p1, BIGNUM *p2, BIGNUM *q1, * test programs to output selective parameters. */ - if (Xp && !rsa->p) { + if (Xp && rsa->p == NULL) { rsa->p = BN_new(); - if (!rsa->p) + if (rsa->p == NULL) goto err; if (!BN_X931_derive_prime_ex(rsa->p, p1, p2, @@ -111,16 +110,16 @@ int RSA_X931_derive_ex(RSA *rsa, BIGNUM *p1, BIGNUM *p2, BIGNUM *q1, goto err; } - if (Xq && !rsa->q) { + if (Xq && rsa->q == NULL) { rsa->q = BN_new(); - if (!rsa->q) + if (rsa->q == NULL) goto err; if (!BN_X931_derive_prime_ex(rsa->q, q1, q2, Xq, Xq1, Xq2, e, ctx, cb)) goto err; } - if (!rsa->p || !rsa->q) { + if (rsa->p == NULL || rsa->q == NULL) { BN_CTX_end(ctx); BN_CTX_free(ctx); return 2; @@ -153,7 +152,7 @@ int RSA_X931_derive_ex(RSA *rsa, BIGNUM *p1, BIGNUM *p2, BIGNUM *q1, goto err; /* LCM((p-1)(q-1)) */ ctx2 = BN_CTX_new(); - if (!ctx2) + if (ctx2 == NULL) goto err; rsa->d = BN_mod_inverse(NULL, rsa->e, r0, ctx2); /* d */ @@ -196,7 +195,7 @@ int RSA_X931_generate_key_ex(RSA *rsa, int bits, const BIGNUM *e, BN_CTX *ctx = NULL; ctx = BN_CTX_new(); - if (!ctx) + if (ctx == NULL) goto error; BN_CTX_start(ctx); @@ -207,7 +206,7 @@ int RSA_X931_generate_key_ex(RSA *rsa, int bits, const BIGNUM *e, rsa->p = BN_new(); rsa->q = BN_new(); - if (!rsa->p || !rsa->q) + if (rsa->p == NULL || rsa->q == NULL) goto error; /* Generate two primes from Xp, Xq */