X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=crypto%2Fbn%2Fbn_depr.c;h=debed8dc83e8fb679fa8dcc60c7a1406ec64a1c5;hp=09ad52e7c63546cd0798c4210af4bfe0afec40cf;hb=3fb2cf1ad19feaf6f7c571b49bd9e320eb4daf31;hpb=9d473aa2e4076beb959bc9701786a0860877ee12 diff --git a/crypto/bn/bn_depr.c b/crypto/bn/bn_depr.c index 09ad52e7c6..debed8dc83 100644 --- a/crypto/bn/bn_depr.c +++ b/crypto/bn/bn_depr.c @@ -1,4 +1,3 @@ -/* crypto/bn/bn_depr.c */ /* ==================================================================== * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. * @@ -7,7 +6,7 @@ * are met: * * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in @@ -53,62 +52,63 @@ * */ -/* Support for deprecated functions goes here - static linkage will only slurp - * this code if applications are using them directly. */ +/* + * Support for deprecated functions goes here - static linkage will only + * slurp this code if applications are using them directly. + */ -#include -#include -#include "cryptlib.h" -#include "bn_lcl.h" -#include +#include +#if OPENSSL_API_COMPAT >= 0x00908000L +NON_EMPTY_TRANSLATION_UNIT +#else -static void *dummy=&dummy; +# include +# include +# include "internal/cryptlib.h" +# include "bn_lcl.h" +# include -#ifndef OPENSSL_NO_DEPRECATED BIGNUM *BN_generate_prime(BIGNUM *ret, int bits, int safe, - const BIGNUM *add, const BIGNUM *rem, - void (*callback)(int,int,void *), void *cb_arg) - { - BN_GENCB cb; - BIGNUM *rnd=NULL; - int found = 0; + const BIGNUM *add, const BIGNUM *rem, + void (*callback) (int, int, void *), void *cb_arg) +{ + BN_GENCB cb; + BIGNUM *rnd = NULL; - BN_GENCB_set_old(&cb, callback, cb_arg); + BN_GENCB_set_old(&cb, callback, cb_arg); - if (ret == NULL) - { - if ((rnd=BN_new()) == NULL) goto err; - } - else - rnd=ret; - bn_verify(rnd); - if(!BN_generate_prime_ex(rnd, bits, safe, add, rem, &cb)) - goto err; + if (ret == NULL) { + if ((rnd = BN_new()) == NULL) + goto err; + } else + rnd = ret; + if (!BN_generate_prime_ex(rnd, bits, safe, add, rem, &cb)) + goto err; - /* we have a prime :-) */ - found = 1; -err: - if (!found && (ret == NULL) && (rnd != NULL)) BN_free(rnd); - if(found) bn_verify(rnd); - return(found ? rnd : NULL); - } + /* we have a prime :-) */ + return ret; + err: + BN_free(rnd); + return NULL; +} -int BN_is_prime(const BIGNUM *a, int checks, void (*callback)(int,int,void *), - BN_CTX *ctx_passed, void *cb_arg) - { - BN_GENCB cb; - BN_GENCB_set_old(&cb, callback, cb_arg); - return BN_is_prime_ex(a, checks, ctx_passed, &cb); - } +int BN_is_prime(const BIGNUM *a, int checks, + void (*callback) (int, int, void *), BN_CTX *ctx_passed, + void *cb_arg) +{ + BN_GENCB cb; + BN_GENCB_set_old(&cb, callback, cb_arg); + return BN_is_prime_ex(a, checks, ctx_passed, &cb); +} int BN_is_prime_fasttest(const BIGNUM *a, int checks, - void (*callback)(int,int,void *), - BN_CTX *ctx_passed, void *cb_arg, - int do_trial_division) - { - BN_GENCB cb; - BN_GENCB_set_old(&cb, callback, cb_arg); - return BN_is_prime_fasttest_ex(a, checks, ctx_passed, - do_trial_division, &cb); - } + void (*callback) (int, int, void *), + BN_CTX *ctx_passed, void *cb_arg, + int do_trial_division) +{ + BN_GENCB cb; + BN_GENCB_set_old(&cb, callback, cb_arg); + return BN_is_prime_fasttest_ex(a, checks, ctx_passed, + do_trial_division, &cb); +} #endif