From 2518b24aa4315d557b967bff48dfc9efed909569 Mon Sep 17 00:00:00 2001 From: tedu <> Date: Tue, 6 May 2014 03:56:27 +0000 Subject: knf approximation --- src/lib/libcrypto/ec/ec_cvt.c | 54 ++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 29 deletions(-) (limited to 'src/lib/libcrypto/ec/ec_cvt.c') diff --git a/src/lib/libcrypto/ec/ec_cvt.c b/src/lib/libcrypto/ec/ec_cvt.c index bfcbab35fe..2f755fefaf 100644 --- a/src/lib/libcrypto/ec/ec_cvt.c +++ b/src/lib/libcrypto/ec/ec_cvt.c @@ -10,7 +10,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 @@ -58,7 +58,7 @@ /* ==================================================================== * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. * - * Portions of the attached software ("Contribution") are developed by + * Portions of the attached software ("Contribution") are developed by * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project. * * The Contribution is licensed pursuant to the OpenSSL open source @@ -73,8 +73,10 @@ #include "ec_lcl.h" -EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) - { +EC_GROUP * +EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, + BN_CTX *ctx) +{ const EC_METHOD *meth; EC_GROUP *ret; @@ -104,28 +106,24 @@ EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, const BIGNUM #else meth = EC_GFp_nist_method(); #endif - + ret = EC_GROUP_new(meth); if (ret == NULL) return NULL; - if (!EC_GROUP_set_curve_GFp(ret, p, a, b, ctx)) - { + if (!EC_GROUP_set_curve_GFp(ret, p, a, b, ctx)) { unsigned long err; - + err = ERR_peek_last_error(); if (!(ERR_GET_LIB(err) == ERR_LIB_EC && - ((ERR_GET_REASON(err) == EC_R_NOT_A_NIST_PRIME) || - (ERR_GET_REASON(err) == EC_R_NOT_A_SUPPORTED_NIST_PRIME)))) - { + ((ERR_GET_REASON(err) == EC_R_NOT_A_NIST_PRIME) || + (ERR_GET_REASON(err) == EC_R_NOT_A_SUPPORTED_NIST_PRIME)))) { /* real error */ - + EC_GROUP_clear_free(ret); return NULL; - } - - + } /* not an actual error, we just cannot use EC_GFp_nist_method */ ERR_clear_error(); @@ -137,34 +135,32 @@ EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, const BIGNUM if (ret == NULL) return NULL; - if (!EC_GROUP_set_curve_GFp(ret, p, a, b, ctx)) - { + if (!EC_GROUP_set_curve_GFp(ret, p, a, b, ctx)) { EC_GROUP_clear_free(ret); return NULL; - } } - - return ret; } + return ret; +} #ifndef OPENSSL_NO_EC2M -EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) - { +EC_GROUP * +EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, + BN_CTX *ctx) +{ const EC_METHOD *meth; EC_GROUP *ret; - + meth = EC_GF2m_simple_method(); - + ret = EC_GROUP_new(meth); if (ret == NULL) return NULL; - if (!EC_GROUP_set_curve_GF2m(ret, p, a, b, ctx)) - { + if (!EC_GROUP_set_curve_GF2m(ret, p, a, b, ctx)) { EC_GROUP_clear_free(ret); return NULL; - } - - return ret; } + return ret; +} #endif -- cgit v1.2.3-55-g6feb