From 53082e7ca1e0fdb413fb221141191659734ab75f Mon Sep 17 00:00:00 2001 From: jsing Date: Thu, 8 May 2014 16:01:06 +0000 Subject: [PATCH] KNF. --- lib/libcrypto/evp/m_dss.c | 44 +++++---- lib/libcrypto/evp/m_dss1.c | 44 +++++---- lib/libcrypto/evp/m_ecdsa.c | 46 +++++---- lib/libcrypto/evp/m_md4.c | 44 +++++---- lib/libcrypto/evp/m_md5.c | 44 +++++---- lib/libcrypto/evp/m_mdc2.c | 44 +++++---- lib/libcrypto/evp/m_null.c | 44 +++++---- lib/libcrypto/evp/m_ripemd.c | 44 +++++---- lib/libcrypto/evp/m_sha.c | 44 +++++---- lib/libcrypto/evp/m_sha1.c | 134 ++++++++++++++++----------- lib/libcrypto/evp/m_sigver.c | 125 ++++++++++++------------- lib/libcrypto/evp/m_wp.c | 34 ++++--- lib/libssl/src/crypto/evp/m_dss.c | 44 +++++---- lib/libssl/src/crypto/evp/m_dss1.c | 44 +++++---- lib/libssl/src/crypto/evp/m_ecdsa.c | 46 +++++---- lib/libssl/src/crypto/evp/m_md4.c | 44 +++++---- lib/libssl/src/crypto/evp/m_md5.c | 44 +++++---- lib/libssl/src/crypto/evp/m_mdc2.c | 44 +++++---- lib/libssl/src/crypto/evp/m_null.c | 44 +++++---- lib/libssl/src/crypto/evp/m_ripemd.c | 44 +++++---- lib/libssl/src/crypto/evp/m_sha.c | 44 +++++---- lib/libssl/src/crypto/evp/m_sha1.c | 134 ++++++++++++++++----------- lib/libssl/src/crypto/evp/m_sigver.c | 125 ++++++++++++------------- lib/libssl/src/crypto/evp/m_wp.c | 34 ++++--- 24 files changed, 766 insertions(+), 616 deletions(-) diff --git a/lib/libcrypto/evp/m_dss.c b/lib/libcrypto/evp/m_dss.c index 89ea5b7a6d6..1516b9da3f8 100644 --- a/lib/libcrypto/evp/m_dss.c +++ b/lib/libcrypto/evp/m_dss.c @@ -5,21 +5,21 @@ * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -68,16 +68,21 @@ #ifndef OPENSSL_NO_SHA static int init(EVP_MD_CTX *ctx) - { return SHA1_Init(ctx->md_data); } +{ + return SHA1_Init(ctx->md_data); +} -static int update(EVP_MD_CTX *ctx,const void *data,size_t count) - { return SHA1_Update(ctx->md_data,data,count); } +static int update(EVP_MD_CTX *ctx, const void *data, size_t count) +{ + return SHA1_Update(ctx->md_data, data, count); +} -static int final(EVP_MD_CTX *ctx,unsigned char *md) - { return SHA1_Final(md,ctx->md_data); } +static int final(EVP_MD_CTX *ctx, unsigned char *md) +{ + return SHA1_Final(md, ctx->md_data); +} -static const EVP_MD dsa_md= - { +static const EVP_MD dsa_md = { NID_dsaWithSHA, NID_dsaWithSHA, SHA_DIGEST_LENGTH, @@ -89,11 +94,12 @@ static const EVP_MD dsa_md= NULL, EVP_PKEY_DSA_method, SHA_CBLOCK, - sizeof(EVP_MD *)+sizeof(SHA_CTX), - }; + sizeof(EVP_MD *) + sizeof(SHA_CTX), +}; -const EVP_MD *EVP_dss(void) - { - return(&dsa_md); - } +const EVP_MD * +EVP_dss(void) +{ + return (&dsa_md); +} #endif diff --git a/lib/libcrypto/evp/m_dss1.c b/lib/libcrypto/evp/m_dss1.c index a010103b7a1..2d9feff0959 100644 --- a/lib/libcrypto/evp/m_dss1.c +++ b/lib/libcrypto/evp/m_dss1.c @@ -5,21 +5,21 @@ * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -69,16 +69,21 @@ #endif static int init(EVP_MD_CTX *ctx) - { return SHA1_Init(ctx->md_data); } +{ + return SHA1_Init(ctx->md_data); +} -static int update(EVP_MD_CTX *ctx,const void *data,size_t count) - { return SHA1_Update(ctx->md_data,data,count); } +static int update(EVP_MD_CTX *ctx, const void *data, size_t count) +{ + return SHA1_Update(ctx->md_data, data, count); +} -static int final(EVP_MD_CTX *ctx,unsigned char *md) - { return SHA1_Final(md,ctx->md_data); } +static int final(EVP_MD_CTX *ctx, unsigned char *md) +{ + return SHA1_Final(md, ctx->md_data); +} -static const EVP_MD dss1_md= - { +static const EVP_MD dss1_md = { NID_dsa, NID_dsaWithSHA1, SHA_DIGEST_LENGTH, @@ -90,11 +95,12 @@ static const EVP_MD dss1_md= NULL, EVP_PKEY_DSA_method, SHA_CBLOCK, - sizeof(EVP_MD *)+sizeof(SHA_CTX), - }; + sizeof(EVP_MD *) + sizeof(SHA_CTX), +}; -const EVP_MD *EVP_dss1(void) - { - return(&dss1_md); - } +const EVP_MD * +EVP_dss1(void) +{ + return (&dss1_md); +} #endif diff --git a/lib/libcrypto/evp/m_ecdsa.c b/lib/libcrypto/evp/m_ecdsa.c index a6ed24b0b68..1d7714571c5 100644 --- a/lib/libcrypto/evp/m_ecdsa.c +++ b/lib/libcrypto/evp/m_ecdsa.c @@ -7,7 +7,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,21 +58,21 @@ * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -87,10 +87,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -102,7 +102,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -118,16 +118,21 @@ #ifndef OPENSSL_NO_SHA static int init(EVP_MD_CTX *ctx) - { return SHA1_Init(ctx->md_data); } +{ + return SHA1_Init(ctx->md_data); +} -static int update(EVP_MD_CTX *ctx,const void *data,size_t count) - { return SHA1_Update(ctx->md_data,data,count); } +static int update(EVP_MD_CTX *ctx, const void *data, size_t count) +{ + return SHA1_Update(ctx->md_data, data, count); +} -static int final(EVP_MD_CTX *ctx,unsigned char *md) - { return SHA1_Final(md,ctx->md_data); } +static int final(EVP_MD_CTX *ctx, unsigned char *md) +{ + return SHA1_Final(md, ctx->md_data); +} -static const EVP_MD ecdsa_md= - { +static const EVP_MD ecdsa_md = { NID_ecdsa_with_SHA1, NID_ecdsa_with_SHA1, SHA_DIGEST_LENGTH, @@ -139,11 +144,12 @@ static const EVP_MD ecdsa_md= NULL, EVP_PKEY_ECDSA_method, SHA_CBLOCK, - sizeof(EVP_MD *)+sizeof(SHA_CTX), - }; + sizeof(EVP_MD *) + sizeof(SHA_CTX), +}; -const EVP_MD *EVP_ecdsa(void) - { - return(&ecdsa_md); - } +const EVP_MD * +EVP_ecdsa(void) +{ + return (&ecdsa_md); +} #endif diff --git a/lib/libcrypto/evp/m_md4.c b/lib/libcrypto/evp/m_md4.c index 6d47f61b274..5a944e3c16b 100644 --- a/lib/libcrypto/evp/m_md4.c +++ b/lib/libcrypto/evp/m_md4.c @@ -5,21 +5,21 @@ * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -72,16 +72,21 @@ #include "evp_locl.h" static int init(EVP_MD_CTX *ctx) - { return MD4_Init(ctx->md_data); } +{ + return MD4_Init(ctx->md_data); +} -static int update(EVP_MD_CTX *ctx,const void *data,size_t count) - { return MD4_Update(ctx->md_data,data,count); } +static int update(EVP_MD_CTX *ctx, const void *data, size_t count) +{ + return MD4_Update(ctx->md_data, data, count); +} -static int final(EVP_MD_CTX *ctx,unsigned char *md) - { return MD4_Final(md,ctx->md_data); } +static int final(EVP_MD_CTX *ctx, unsigned char *md) +{ + return MD4_Final(md, ctx->md_data); +} -static const EVP_MD md4_md= - { +static const EVP_MD md4_md = { NID_md4, NID_md4WithRSAEncryption, MD4_DIGEST_LENGTH, @@ -93,11 +98,12 @@ static const EVP_MD md4_md= NULL, EVP_PKEY_RSA_method, MD4_CBLOCK, - sizeof(EVP_MD *)+sizeof(MD4_CTX), - }; + sizeof(EVP_MD *) + sizeof(MD4_CTX), +}; -const EVP_MD *EVP_md4(void) - { - return(&md4_md); - } +const EVP_MD * +EVP_md4(void) +{ + return (&md4_md); +} #endif diff --git a/lib/libcrypto/evp/m_md5.c b/lib/libcrypto/evp/m_md5.c index 9a8bae02580..4ac9829886f 100644 --- a/lib/libcrypto/evp/m_md5.c +++ b/lib/libcrypto/evp/m_md5.c @@ -5,21 +5,21 @@ * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -71,16 +71,21 @@ #include "evp_locl.h" static int init(EVP_MD_CTX *ctx) - { return MD5_Init(ctx->md_data); } +{ + return MD5_Init(ctx->md_data); +} -static int update(EVP_MD_CTX *ctx,const void *data,size_t count) - { return MD5_Update(ctx->md_data,data,count); } +static int update(EVP_MD_CTX *ctx, const void *data, size_t count) +{ + return MD5_Update(ctx->md_data, data, count); +} -static int final(EVP_MD_CTX *ctx,unsigned char *md) - { return MD5_Final(md,ctx->md_data); } +static int final(EVP_MD_CTX *ctx, unsigned char *md) +{ + return MD5_Final(md, ctx->md_data); +} -static const EVP_MD md5_md= - { +static const EVP_MD md5_md = { NID_md5, NID_md5WithRSAEncryption, MD5_DIGEST_LENGTH, @@ -92,11 +97,12 @@ static const EVP_MD md5_md= NULL, EVP_PKEY_RSA_method, MD5_CBLOCK, - sizeof(EVP_MD *)+sizeof(MD5_CTX), - }; + sizeof(EVP_MD *) + sizeof(MD5_CTX), +}; -const EVP_MD *EVP_md5(void) - { - return(&md5_md); - } +const EVP_MD * +EVP_md5(void) +{ + return (&md5_md); +} #endif diff --git a/lib/libcrypto/evp/m_mdc2.c b/lib/libcrypto/evp/m_mdc2.c index 3602bed316a..70ce53bee80 100644 --- a/lib/libcrypto/evp/m_mdc2.c +++ b/lib/libcrypto/evp/m_mdc2.c @@ -5,21 +5,21 @@ * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -72,16 +72,21 @@ #include "evp_locl.h" static int init(EVP_MD_CTX *ctx) - { return MDC2_Init(ctx->md_data); } +{ + return MDC2_Init(ctx->md_data); +} -static int update(EVP_MD_CTX *ctx,const void *data,size_t count) - { return MDC2_Update(ctx->md_data,data,count); } +static int update(EVP_MD_CTX *ctx, const void *data, size_t count) +{ + return MDC2_Update(ctx->md_data, data, count); +} -static int final(EVP_MD_CTX *ctx,unsigned char *md) - { return MDC2_Final(md,ctx->md_data); } +static int final(EVP_MD_CTX *ctx, unsigned char *md) +{ + return MDC2_Final(md, ctx->md_data); +} -static const EVP_MD mdc2_md= - { +static const EVP_MD mdc2_md = { NID_mdc2, NID_mdc2WithRSA, MDC2_DIGEST_LENGTH, @@ -93,11 +98,12 @@ static const EVP_MD mdc2_md= NULL, EVP_PKEY_RSA_ASN1_OCTET_STRING_method, MDC2_BLOCK, - sizeof(EVP_MD *)+sizeof(MDC2_CTX), - }; + sizeof(EVP_MD *) + sizeof(MDC2_CTX), +}; -const EVP_MD *EVP_mdc2(void) - { - return(&mdc2_md); - } +const EVP_MD * +EVP_mdc2(void) +{ + return (&mdc2_md); +} #endif diff --git a/lib/libcrypto/evp/m_null.c b/lib/libcrypto/evp/m_null.c index cb0721699db..f3c00ad5c8f 100644 --- a/lib/libcrypto/evp/m_null.c +++ b/lib/libcrypto/evp/m_null.c @@ -5,21 +5,21 @@ * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -63,16 +63,21 @@ #include static int init(EVP_MD_CTX *ctx) - { return 1; } +{ + return 1; +} -static int update(EVP_MD_CTX *ctx,const void *data,size_t count) - { return 1; } +static int update(EVP_MD_CTX *ctx, const void *data, size_t count) +{ + return 1; +} -static int final(EVP_MD_CTX *ctx,unsigned char *md) - { return 1; } +static int final(EVP_MD_CTX *ctx, unsigned char *md) +{ + return 1; +} -static const EVP_MD null_md= - { +static const EVP_MD null_md = { NID_undef, NID_undef, 0, @@ -85,11 +90,10 @@ static const EVP_MD null_md= EVP_PKEY_NULL_method, 0, sizeof(EVP_MD *), - }; - -const EVP_MD *EVP_md_null(void) - { - return(&null_md); - } - +}; +const EVP_MD * +EVP_md_null(void) +{ + return (&null_md); +} diff --git a/lib/libcrypto/evp/m_ripemd.c b/lib/libcrypto/evp/m_ripemd.c index 7bf4804cf88..69f30eb9831 100644 --- a/lib/libcrypto/evp/m_ripemd.c +++ b/lib/libcrypto/evp/m_ripemd.c @@ -5,21 +5,21 @@ * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -71,16 +71,21 @@ #include "evp_locl.h" static int init(EVP_MD_CTX *ctx) - { return RIPEMD160_Init(ctx->md_data); } +{ + return RIPEMD160_Init(ctx->md_data); +} -static int update(EVP_MD_CTX *ctx,const void *data,size_t count) - { return RIPEMD160_Update(ctx->md_data,data,count); } +static int update(EVP_MD_CTX *ctx, const void *data, size_t count) +{ + return RIPEMD160_Update(ctx->md_data, data, count); +} -static int final(EVP_MD_CTX *ctx,unsigned char *md) - { return RIPEMD160_Final(md,ctx->md_data); } +static int final(EVP_MD_CTX *ctx, unsigned char *md) +{ + return RIPEMD160_Final(md, ctx->md_data); +} -static const EVP_MD ripemd160_md= - { +static const EVP_MD ripemd160_md = { NID_ripemd160, NID_ripemd160WithRSA, RIPEMD160_DIGEST_LENGTH, @@ -92,11 +97,12 @@ static const EVP_MD ripemd160_md= NULL, EVP_PKEY_RSA_method, RIPEMD160_CBLOCK, - sizeof(EVP_MD *)+sizeof(RIPEMD160_CTX), - }; + sizeof(EVP_MD *) + sizeof(RIPEMD160_CTX), +}; -const EVP_MD *EVP_ripemd160(void) - { - return(&ripemd160_md); - } +const EVP_MD * +EVP_ripemd160(void) +{ + return (&ripemd160_md); +} #endif diff --git a/lib/libcrypto/evp/m_sha.c b/lib/libcrypto/evp/m_sha.c index 8769cdd42fd..d2d275f8331 100644 --- a/lib/libcrypto/evp/m_sha.c +++ b/lib/libcrypto/evp/m_sha.c @@ -5,21 +5,21 @@ * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -70,16 +70,21 @@ #include "evp_locl.h" static int init(EVP_MD_CTX *ctx) - { return SHA_Init(ctx->md_data); } +{ + return SHA_Init(ctx->md_data); +} -static int update(EVP_MD_CTX *ctx,const void *data,size_t count) - { return SHA_Update(ctx->md_data,data,count); } +static int update(EVP_MD_CTX *ctx, const void *data, size_t count) +{ + return SHA_Update(ctx->md_data, data, count); +} -static int final(EVP_MD_CTX *ctx,unsigned char *md) - { return SHA_Final(md,ctx->md_data); } +static int final(EVP_MD_CTX *ctx, unsigned char *md) +{ + return SHA_Final(md, ctx->md_data); +} -static const EVP_MD sha_md= - { +static const EVP_MD sha_md = { NID_sha, NID_shaWithRSAEncryption, SHA_DIGEST_LENGTH, @@ -91,11 +96,12 @@ static const EVP_MD sha_md= NULL, EVP_PKEY_RSA_method, SHA_CBLOCK, - sizeof(EVP_MD *)+sizeof(SHA_CTX), - }; + sizeof(EVP_MD *) + sizeof(SHA_CTX), +}; -const EVP_MD *EVP_sha(void) - { - return(&sha_md); - } +const EVP_MD * +EVP_sha(void) +{ + return (&sha_md); +} #endif diff --git a/lib/libcrypto/evp/m_sha1.c b/lib/libcrypto/evp/m_sha1.c index f39ae779259..8c7e4eb2224 100644 --- a/lib/libcrypto/evp/m_sha1.c +++ b/lib/libcrypto/evp/m_sha1.c @@ -5,21 +5,21 @@ * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -70,16 +70,21 @@ static int init(EVP_MD_CTX *ctx) - { return SHA1_Init(ctx->md_data); } +{ + return SHA1_Init(ctx->md_data); +} -static int update(EVP_MD_CTX *ctx,const void *data,size_t count) - { return SHA1_Update(ctx->md_data,data,count); } +static int update(EVP_MD_CTX *ctx, const void *data, size_t count) +{ + return SHA1_Update(ctx->md_data, data, count); +} -static int final(EVP_MD_CTX *ctx,unsigned char *md) - { return SHA1_Final(md,ctx->md_data); } +static int final(EVP_MD_CTX *ctx, unsigned char *md) +{ + return SHA1_Final(md, ctx->md_data); +} -static const EVP_MD sha1_md= - { +static const EVP_MD sha1_md = { NID_sha1, NID_sha1WithRSAEncryption, SHA_DIGEST_LENGTH, @@ -91,32 +96,40 @@ static const EVP_MD sha1_md= NULL, EVP_PKEY_RSA_method, SHA_CBLOCK, - sizeof(EVP_MD *)+sizeof(SHA_CTX), - }; - -const EVP_MD *EVP_sha1(void) - { - return(&sha1_md); - } + sizeof(EVP_MD *) + sizeof(SHA_CTX), +}; + +const EVP_MD * +EVP_sha1(void) +{ + return (&sha1_md); +} #endif #ifndef OPENSSL_NO_SHA256 static int init224(EVP_MD_CTX *ctx) - { return SHA224_Init(ctx->md_data); } +{ + return SHA224_Init(ctx->md_data); +} static int init256(EVP_MD_CTX *ctx) - { return SHA256_Init(ctx->md_data); } +{ + return SHA256_Init(ctx->md_data); +} /* * Even though there're separate SHA224_[Update|Final], we call * SHA256 functions even in SHA224 context. This is what happens * there anyway, so we can spare few CPU cycles:-) */ -static int update256(EVP_MD_CTX *ctx,const void *data,size_t count) - { return SHA256_Update(ctx->md_data,data,count); } -static int final256(EVP_MD_CTX *ctx,unsigned char *md) - { return SHA256_Final(md,ctx->md_data); } - -static const EVP_MD sha224_md= - { +static int update256(EVP_MD_CTX *ctx, const void *data, size_t count) +{ + return SHA256_Update(ctx->md_data, data, count); +} +static int final256(EVP_MD_CTX *ctx, unsigned char *md) +{ + return SHA256_Final(md, ctx->md_data); +} + +static const EVP_MD sha224_md = { NID_sha224, NID_sha224WithRSAEncryption, SHA224_DIGEST_LENGTH, @@ -128,14 +141,15 @@ static const EVP_MD sha224_md= NULL, EVP_PKEY_RSA_method, SHA256_CBLOCK, - sizeof(EVP_MD *)+sizeof(SHA256_CTX), - }; + sizeof(EVP_MD *) + sizeof(SHA256_CTX), +}; const EVP_MD *EVP_sha224(void) - { return(&sha224_md); } +{ + return (&sha224_md); +} -static const EVP_MD sha256_md= - { +static const EVP_MD sha256_md = { NID_sha256, NID_sha256WithRSAEncryption, SHA256_DIGEST_LENGTH, @@ -147,26 +161,35 @@ static const EVP_MD sha256_md= NULL, EVP_PKEY_RSA_method, SHA256_CBLOCK, - sizeof(EVP_MD *)+sizeof(SHA256_CTX), - }; + sizeof(EVP_MD *) + sizeof(SHA256_CTX), +}; const EVP_MD *EVP_sha256(void) - { return(&sha256_md); } +{ + return (&sha256_md); +} #endif /* ifndef OPENSSL_NO_SHA256 */ #ifndef OPENSSL_NO_SHA512 static int init384(EVP_MD_CTX *ctx) - { return SHA384_Init(ctx->md_data); } +{ + return SHA384_Init(ctx->md_data); +} static int init512(EVP_MD_CTX *ctx) - { return SHA512_Init(ctx->md_data); } +{ + return SHA512_Init(ctx->md_data); +} /* See comment in SHA224/256 section */ -static int update512(EVP_MD_CTX *ctx,const void *data,size_t count) - { return SHA512_Update(ctx->md_data,data,count); } -static int final512(EVP_MD_CTX *ctx,unsigned char *md) - { return SHA512_Final(md,ctx->md_data); } - -static const EVP_MD sha384_md= - { +static int update512(EVP_MD_CTX *ctx, const void *data, size_t count) +{ + return SHA512_Update(ctx->md_data, data, count); +} +static int final512(EVP_MD_CTX *ctx, unsigned char *md) +{ + return SHA512_Final(md, ctx->md_data); +} + +static const EVP_MD sha384_md = { NID_sha384, NID_sha384WithRSAEncryption, SHA384_DIGEST_LENGTH, @@ -178,14 +201,15 @@ static const EVP_MD sha384_md= NULL, EVP_PKEY_RSA_method, SHA512_CBLOCK, - sizeof(EVP_MD *)+sizeof(SHA512_CTX), - }; + sizeof(EVP_MD *) + sizeof(SHA512_CTX), +}; const EVP_MD *EVP_sha384(void) - { return(&sha384_md); } +{ + return (&sha384_md); +} -static const EVP_MD sha512_md= - { +static const EVP_MD sha512_md = { NID_sha512, NID_sha512WithRSAEncryption, SHA512_DIGEST_LENGTH, @@ -197,9 +221,11 @@ static const EVP_MD sha512_md= NULL, EVP_PKEY_RSA_method, SHA512_CBLOCK, - sizeof(EVP_MD *)+sizeof(SHA512_CTX), - }; + sizeof(EVP_MD *) + sizeof(SHA512_CTX), +}; const EVP_MD *EVP_sha512(void) - { return(&sha512_md); } +{ + return (&sha512_md); +} #endif /* ifndef OPENSSL_NO_SHA512 */ diff --git a/lib/libcrypto/evp/m_sigver.c b/lib/libcrypto/evp/m_sigver.c index 7e2731f4a4e..0274a72c1c2 100644 --- a/lib/libcrypto/evp/m_sigver.c +++ b/lib/libcrypto/evp/m_sigver.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 @@ -63,50 +63,42 @@ #include #include "evp_locl.h" -static int do_sigver_init(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, - const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey, - int ver) - { +static int +do_sigver_init(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, const EVP_MD *type, + ENGINE *e, EVP_PKEY *pkey, int ver) +{ if (ctx->pctx == NULL) ctx->pctx = EVP_PKEY_CTX_new(pkey, e); if (ctx->pctx == NULL) return 0; - if (type == NULL) - { + if (type == NULL) { int def_nid; if (EVP_PKEY_get_default_digest_nid(pkey, &def_nid) > 0) type = EVP_get_digestbynid(def_nid); - } + } - if (type == NULL) - { + if (type == NULL) { EVPerr(EVP_F_DO_SIGVER_INIT, EVP_R_NO_DEFAULT_DIGEST); return 0; - } + } - if (ver) - { - if (ctx->pctx->pmeth->verifyctx_init) - { - if (ctx->pctx->pmeth->verifyctx_init(ctx->pctx, ctx) <=0) + if (ver) { + if (ctx->pctx->pmeth->verifyctx_init) { + if (ctx->pctx->pmeth->verifyctx_init(ctx->pctx, + ctx) <=0) return 0; ctx->pctx->operation = EVP_PKEY_OP_VERIFYCTX; - } - else if (EVP_PKEY_verify_init(ctx->pctx) <= 0) + } else if (EVP_PKEY_verify_init(ctx->pctx) <= 0) return 0; - } - else - { - if (ctx->pctx->pmeth->signctx_init) - { + } else { + if (ctx->pctx->pmeth->signctx_init) { if (ctx->pctx->pmeth->signctx_init(ctx->pctx, ctx) <= 0) return 0; ctx->pctx->operation = EVP_PKEY_OP_SIGNCTX; - } - else if (EVP_PKEY_sign_init(ctx->pctx) <= 0) + } else if (EVP_PKEY_sign_init(ctx->pctx) <= 0) return 0; - } + } if (EVP_PKEY_CTX_set_signature_md(ctx->pctx, type) <= 0) return 0; if (pctx) @@ -114,65 +106,66 @@ static int do_sigver_init(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, if (!EVP_DigestInit_ex(ctx, type, e)) return 0; return 1; - } +} -int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, - const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey) - { +int +EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, const EVP_MD *type, + ENGINE *e, EVP_PKEY *pkey) +{ return do_sigver_init(ctx, pctx, type, e, pkey, 0); - } +} -int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, - const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey) - { +int +EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, const EVP_MD *type, + ENGINE *e, EVP_PKEY *pkey) +{ return do_sigver_init(ctx, pctx, type, e, pkey, 1); - } +} -int EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, size_t *siglen) - { +int +EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, size_t *siglen) +{ int sctx, r = 0; + if (ctx->pctx->pmeth->signctx) sctx = 1; else sctx = 0; - if (sigret) - { + if (sigret) { EVP_MD_CTX tmp_ctx; unsigned char md[EVP_MAX_MD_SIZE]; unsigned int mdlen; EVP_MD_CTX_init(&tmp_ctx); - if (!EVP_MD_CTX_copy_ex(&tmp_ctx,ctx)) - return 0; + if (!EVP_MD_CTX_copy_ex(&tmp_ctx, ctx)) + return 0; if (sctx) r = tmp_ctx.pctx->pmeth->signctx(tmp_ctx.pctx, - sigret, siglen, &tmp_ctx); + sigret, siglen, &tmp_ctx); else - r = EVP_DigestFinal_ex(&tmp_ctx,md,&mdlen); + r = EVP_DigestFinal_ex(&tmp_ctx, md, &mdlen); EVP_MD_CTX_cleanup(&tmp_ctx); if (sctx || !r) return r; if (EVP_PKEY_sign(ctx->pctx, sigret, siglen, md, mdlen) <= 0) return 0; - } - else - { - if (sctx) - { - if (ctx->pctx->pmeth->signctx(ctx->pctx, sigret, siglen, ctx) <= 0) + } else { + if (sctx) { + if (ctx->pctx->pmeth->signctx(ctx->pctx, sigret, + siglen, ctx) <= 0) return 0; - } - else - { + } else { int s = EVP_MD_size(ctx->digest); - if (s < 0 || EVP_PKEY_sign(ctx->pctx, sigret, siglen, NULL, s) <= 0) + if (s < 0 || EVP_PKEY_sign(ctx->pctx, sigret, siglen, + NULL, s) <= 0) return 0; - } } - return 1; } + return 1; +} -int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, unsigned char *sig, size_t siglen) - { +int +EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, unsigned char *sig, size_t siglen) +{ EVP_MD_CTX tmp_ctx; unsigned char md[EVP_MAX_MD_SIZE]; int r; @@ -184,17 +177,15 @@ int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, unsigned char *sig, size_t siglen) else vctx = 0; EVP_MD_CTX_init(&tmp_ctx); - if (!EVP_MD_CTX_copy_ex(&tmp_ctx,ctx)) - return -1; - if (vctx) - { - r = tmp_ctx.pctx->pmeth->verifyctx(tmp_ctx.pctx, - sig, siglen, &tmp_ctx); - } - else - r = EVP_DigestFinal_ex(&tmp_ctx,md,&mdlen); + if (!EVP_MD_CTX_copy_ex(&tmp_ctx, ctx)) + return -1; + if (vctx) { + r = tmp_ctx.pctx->pmeth->verifyctx(tmp_ctx.pctx, sig, + siglen, &tmp_ctx); + } else + r = EVP_DigestFinal_ex(&tmp_ctx, md, &mdlen); EVP_MD_CTX_cleanup(&tmp_ctx); if (vctx || !r) return r; return EVP_PKEY_verify(ctx->pctx, sig, siglen, md, mdlen); - } +} diff --git a/lib/libcrypto/evp/m_wp.c b/lib/libcrypto/evp/m_wp.c index c51bc2d5d1e..3991a71c177 100644 --- a/lib/libcrypto/evp/m_wp.c +++ b/lib/libcrypto/evp/m_wp.c @@ -12,16 +12,21 @@ #include "evp_locl.h" static int init(EVP_MD_CTX *ctx) - { return WHIRLPOOL_Init(ctx->md_data); } +{ + return WHIRLPOOL_Init(ctx->md_data); +} -static int update(EVP_MD_CTX *ctx,const void *data,size_t count) - { return WHIRLPOOL_Update(ctx->md_data,data,count); } +static int update(EVP_MD_CTX *ctx, const void *data, size_t count) +{ + return WHIRLPOOL_Update(ctx->md_data, data, count); +} -static int final(EVP_MD_CTX *ctx,unsigned char *md) - { return WHIRLPOOL_Final(md,ctx->md_data); } +static int final(EVP_MD_CTX *ctx, unsigned char *md) +{ + return WHIRLPOOL_Final(md, ctx->md_data); +} -static const EVP_MD whirlpool_md= - { +static const EVP_MD whirlpool_md = { NID_whirlpool, 0, WHIRLPOOL_DIGEST_LENGTH, @@ -33,11 +38,12 @@ static const EVP_MD whirlpool_md= NULL, EVP_PKEY_NULL_method, WHIRLPOOL_BBLOCK/8, - sizeof(EVP_MD *)+sizeof(WHIRLPOOL_CTX), - }; - -const EVP_MD *EVP_whirlpool(void) - { - return(&whirlpool_md); - } + sizeof(EVP_MD *) + sizeof(WHIRLPOOL_CTX), +}; + +const EVP_MD * +EVP_whirlpool(void) +{ + return (&whirlpool_md); +} #endif diff --git a/lib/libssl/src/crypto/evp/m_dss.c b/lib/libssl/src/crypto/evp/m_dss.c index 89ea5b7a6d6..1516b9da3f8 100644 --- a/lib/libssl/src/crypto/evp/m_dss.c +++ b/lib/libssl/src/crypto/evp/m_dss.c @@ -5,21 +5,21 @@ * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -68,16 +68,21 @@ #ifndef OPENSSL_NO_SHA static int init(EVP_MD_CTX *ctx) - { return SHA1_Init(ctx->md_data); } +{ + return SHA1_Init(ctx->md_data); +} -static int update(EVP_MD_CTX *ctx,const void *data,size_t count) - { return SHA1_Update(ctx->md_data,data,count); } +static int update(EVP_MD_CTX *ctx, const void *data, size_t count) +{ + return SHA1_Update(ctx->md_data, data, count); +} -static int final(EVP_MD_CTX *ctx,unsigned char *md) - { return SHA1_Final(md,ctx->md_data); } +static int final(EVP_MD_CTX *ctx, unsigned char *md) +{ + return SHA1_Final(md, ctx->md_data); +} -static const EVP_MD dsa_md= - { +static const EVP_MD dsa_md = { NID_dsaWithSHA, NID_dsaWithSHA, SHA_DIGEST_LENGTH, @@ -89,11 +94,12 @@ static const EVP_MD dsa_md= NULL, EVP_PKEY_DSA_method, SHA_CBLOCK, - sizeof(EVP_MD *)+sizeof(SHA_CTX), - }; + sizeof(EVP_MD *) + sizeof(SHA_CTX), +}; -const EVP_MD *EVP_dss(void) - { - return(&dsa_md); - } +const EVP_MD * +EVP_dss(void) +{ + return (&dsa_md); +} #endif diff --git a/lib/libssl/src/crypto/evp/m_dss1.c b/lib/libssl/src/crypto/evp/m_dss1.c index a010103b7a1..2d9feff0959 100644 --- a/lib/libssl/src/crypto/evp/m_dss1.c +++ b/lib/libssl/src/crypto/evp/m_dss1.c @@ -5,21 +5,21 @@ * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -69,16 +69,21 @@ #endif static int init(EVP_MD_CTX *ctx) - { return SHA1_Init(ctx->md_data); } +{ + return SHA1_Init(ctx->md_data); +} -static int update(EVP_MD_CTX *ctx,const void *data,size_t count) - { return SHA1_Update(ctx->md_data,data,count); } +static int update(EVP_MD_CTX *ctx, const void *data, size_t count) +{ + return SHA1_Update(ctx->md_data, data, count); +} -static int final(EVP_MD_CTX *ctx,unsigned char *md) - { return SHA1_Final(md,ctx->md_data); } +static int final(EVP_MD_CTX *ctx, unsigned char *md) +{ + return SHA1_Final(md, ctx->md_data); +} -static const EVP_MD dss1_md= - { +static const EVP_MD dss1_md = { NID_dsa, NID_dsaWithSHA1, SHA_DIGEST_LENGTH, @@ -90,11 +95,12 @@ static const EVP_MD dss1_md= NULL, EVP_PKEY_DSA_method, SHA_CBLOCK, - sizeof(EVP_MD *)+sizeof(SHA_CTX), - }; + sizeof(EVP_MD *) + sizeof(SHA_CTX), +}; -const EVP_MD *EVP_dss1(void) - { - return(&dss1_md); - } +const EVP_MD * +EVP_dss1(void) +{ + return (&dss1_md); +} #endif diff --git a/lib/libssl/src/crypto/evp/m_ecdsa.c b/lib/libssl/src/crypto/evp/m_ecdsa.c index a6ed24b0b68..1d7714571c5 100644 --- a/lib/libssl/src/crypto/evp/m_ecdsa.c +++ b/lib/libssl/src/crypto/evp/m_ecdsa.c @@ -7,7 +7,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,21 +58,21 @@ * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -87,10 +87,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -102,7 +102,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -118,16 +118,21 @@ #ifndef OPENSSL_NO_SHA static int init(EVP_MD_CTX *ctx) - { return SHA1_Init(ctx->md_data); } +{ + return SHA1_Init(ctx->md_data); +} -static int update(EVP_MD_CTX *ctx,const void *data,size_t count) - { return SHA1_Update(ctx->md_data,data,count); } +static int update(EVP_MD_CTX *ctx, const void *data, size_t count) +{ + return SHA1_Update(ctx->md_data, data, count); +} -static int final(EVP_MD_CTX *ctx,unsigned char *md) - { return SHA1_Final(md,ctx->md_data); } +static int final(EVP_MD_CTX *ctx, unsigned char *md) +{ + return SHA1_Final(md, ctx->md_data); +} -static const EVP_MD ecdsa_md= - { +static const EVP_MD ecdsa_md = { NID_ecdsa_with_SHA1, NID_ecdsa_with_SHA1, SHA_DIGEST_LENGTH, @@ -139,11 +144,12 @@ static const EVP_MD ecdsa_md= NULL, EVP_PKEY_ECDSA_method, SHA_CBLOCK, - sizeof(EVP_MD *)+sizeof(SHA_CTX), - }; + sizeof(EVP_MD *) + sizeof(SHA_CTX), +}; -const EVP_MD *EVP_ecdsa(void) - { - return(&ecdsa_md); - } +const EVP_MD * +EVP_ecdsa(void) +{ + return (&ecdsa_md); +} #endif diff --git a/lib/libssl/src/crypto/evp/m_md4.c b/lib/libssl/src/crypto/evp/m_md4.c index 6d47f61b274..5a944e3c16b 100644 --- a/lib/libssl/src/crypto/evp/m_md4.c +++ b/lib/libssl/src/crypto/evp/m_md4.c @@ -5,21 +5,21 @@ * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -72,16 +72,21 @@ #include "evp_locl.h" static int init(EVP_MD_CTX *ctx) - { return MD4_Init(ctx->md_data); } +{ + return MD4_Init(ctx->md_data); +} -static int update(EVP_MD_CTX *ctx,const void *data,size_t count) - { return MD4_Update(ctx->md_data,data,count); } +static int update(EVP_MD_CTX *ctx, const void *data, size_t count) +{ + return MD4_Update(ctx->md_data, data, count); +} -static int final(EVP_MD_CTX *ctx,unsigned char *md) - { return MD4_Final(md,ctx->md_data); } +static int final(EVP_MD_CTX *ctx, unsigned char *md) +{ + return MD4_Final(md, ctx->md_data); +} -static const EVP_MD md4_md= - { +static const EVP_MD md4_md = { NID_md4, NID_md4WithRSAEncryption, MD4_DIGEST_LENGTH, @@ -93,11 +98,12 @@ static const EVP_MD md4_md= NULL, EVP_PKEY_RSA_method, MD4_CBLOCK, - sizeof(EVP_MD *)+sizeof(MD4_CTX), - }; + sizeof(EVP_MD *) + sizeof(MD4_CTX), +}; -const EVP_MD *EVP_md4(void) - { - return(&md4_md); - } +const EVP_MD * +EVP_md4(void) +{ + return (&md4_md); +} #endif diff --git a/lib/libssl/src/crypto/evp/m_md5.c b/lib/libssl/src/crypto/evp/m_md5.c index 9a8bae02580..4ac9829886f 100644 --- a/lib/libssl/src/crypto/evp/m_md5.c +++ b/lib/libssl/src/crypto/evp/m_md5.c @@ -5,21 +5,21 @@ * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -71,16 +71,21 @@ #include "evp_locl.h" static int init(EVP_MD_CTX *ctx) - { return MD5_Init(ctx->md_data); } +{ + return MD5_Init(ctx->md_data); +} -static int update(EVP_MD_CTX *ctx,const void *data,size_t count) - { return MD5_Update(ctx->md_data,data,count); } +static int update(EVP_MD_CTX *ctx, const void *data, size_t count) +{ + return MD5_Update(ctx->md_data, data, count); +} -static int final(EVP_MD_CTX *ctx,unsigned char *md) - { return MD5_Final(md,ctx->md_data); } +static int final(EVP_MD_CTX *ctx, unsigned char *md) +{ + return MD5_Final(md, ctx->md_data); +} -static const EVP_MD md5_md= - { +static const EVP_MD md5_md = { NID_md5, NID_md5WithRSAEncryption, MD5_DIGEST_LENGTH, @@ -92,11 +97,12 @@ static const EVP_MD md5_md= NULL, EVP_PKEY_RSA_method, MD5_CBLOCK, - sizeof(EVP_MD *)+sizeof(MD5_CTX), - }; + sizeof(EVP_MD *) + sizeof(MD5_CTX), +}; -const EVP_MD *EVP_md5(void) - { - return(&md5_md); - } +const EVP_MD * +EVP_md5(void) +{ + return (&md5_md); +} #endif diff --git a/lib/libssl/src/crypto/evp/m_mdc2.c b/lib/libssl/src/crypto/evp/m_mdc2.c index 3602bed316a..70ce53bee80 100644 --- a/lib/libssl/src/crypto/evp/m_mdc2.c +++ b/lib/libssl/src/crypto/evp/m_mdc2.c @@ -5,21 +5,21 @@ * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -72,16 +72,21 @@ #include "evp_locl.h" static int init(EVP_MD_CTX *ctx) - { return MDC2_Init(ctx->md_data); } +{ + return MDC2_Init(ctx->md_data); +} -static int update(EVP_MD_CTX *ctx,const void *data,size_t count) - { return MDC2_Update(ctx->md_data,data,count); } +static int update(EVP_MD_CTX *ctx, const void *data, size_t count) +{ + return MDC2_Update(ctx->md_data, data, count); +} -static int final(EVP_MD_CTX *ctx,unsigned char *md) - { return MDC2_Final(md,ctx->md_data); } +static int final(EVP_MD_CTX *ctx, unsigned char *md) +{ + return MDC2_Final(md, ctx->md_data); +} -static const EVP_MD mdc2_md= - { +static const EVP_MD mdc2_md = { NID_mdc2, NID_mdc2WithRSA, MDC2_DIGEST_LENGTH, @@ -93,11 +98,12 @@ static const EVP_MD mdc2_md= NULL, EVP_PKEY_RSA_ASN1_OCTET_STRING_method, MDC2_BLOCK, - sizeof(EVP_MD *)+sizeof(MDC2_CTX), - }; + sizeof(EVP_MD *) + sizeof(MDC2_CTX), +}; -const EVP_MD *EVP_mdc2(void) - { - return(&mdc2_md); - } +const EVP_MD * +EVP_mdc2(void) +{ + return (&mdc2_md); +} #endif diff --git a/lib/libssl/src/crypto/evp/m_null.c b/lib/libssl/src/crypto/evp/m_null.c index cb0721699db..f3c00ad5c8f 100644 --- a/lib/libssl/src/crypto/evp/m_null.c +++ b/lib/libssl/src/crypto/evp/m_null.c @@ -5,21 +5,21 @@ * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -63,16 +63,21 @@ #include static int init(EVP_MD_CTX *ctx) - { return 1; } +{ + return 1; +} -static int update(EVP_MD_CTX *ctx,const void *data,size_t count) - { return 1; } +static int update(EVP_MD_CTX *ctx, const void *data, size_t count) +{ + return 1; +} -static int final(EVP_MD_CTX *ctx,unsigned char *md) - { return 1; } +static int final(EVP_MD_CTX *ctx, unsigned char *md) +{ + return 1; +} -static const EVP_MD null_md= - { +static const EVP_MD null_md = { NID_undef, NID_undef, 0, @@ -85,11 +90,10 @@ static const EVP_MD null_md= EVP_PKEY_NULL_method, 0, sizeof(EVP_MD *), - }; - -const EVP_MD *EVP_md_null(void) - { - return(&null_md); - } - +}; +const EVP_MD * +EVP_md_null(void) +{ + return (&null_md); +} diff --git a/lib/libssl/src/crypto/evp/m_ripemd.c b/lib/libssl/src/crypto/evp/m_ripemd.c index 7bf4804cf88..69f30eb9831 100644 --- a/lib/libssl/src/crypto/evp/m_ripemd.c +++ b/lib/libssl/src/crypto/evp/m_ripemd.c @@ -5,21 +5,21 @@ * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -71,16 +71,21 @@ #include "evp_locl.h" static int init(EVP_MD_CTX *ctx) - { return RIPEMD160_Init(ctx->md_data); } +{ + return RIPEMD160_Init(ctx->md_data); +} -static int update(EVP_MD_CTX *ctx,const void *data,size_t count) - { return RIPEMD160_Update(ctx->md_data,data,count); } +static int update(EVP_MD_CTX *ctx, const void *data, size_t count) +{ + return RIPEMD160_Update(ctx->md_data, data, count); +} -static int final(EVP_MD_CTX *ctx,unsigned char *md) - { return RIPEMD160_Final(md,ctx->md_data); } +static int final(EVP_MD_CTX *ctx, unsigned char *md) +{ + return RIPEMD160_Final(md, ctx->md_data); +} -static const EVP_MD ripemd160_md= - { +static const EVP_MD ripemd160_md = { NID_ripemd160, NID_ripemd160WithRSA, RIPEMD160_DIGEST_LENGTH, @@ -92,11 +97,12 @@ static const EVP_MD ripemd160_md= NULL, EVP_PKEY_RSA_method, RIPEMD160_CBLOCK, - sizeof(EVP_MD *)+sizeof(RIPEMD160_CTX), - }; + sizeof(EVP_MD *) + sizeof(RIPEMD160_CTX), +}; -const EVP_MD *EVP_ripemd160(void) - { - return(&ripemd160_md); - } +const EVP_MD * +EVP_ripemd160(void) +{ + return (&ripemd160_md); +} #endif diff --git a/lib/libssl/src/crypto/evp/m_sha.c b/lib/libssl/src/crypto/evp/m_sha.c index 8769cdd42fd..d2d275f8331 100644 --- a/lib/libssl/src/crypto/evp/m_sha.c +++ b/lib/libssl/src/crypto/evp/m_sha.c @@ -5,21 +5,21 @@ * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -70,16 +70,21 @@ #include "evp_locl.h" static int init(EVP_MD_CTX *ctx) - { return SHA_Init(ctx->md_data); } +{ + return SHA_Init(ctx->md_data); +} -static int update(EVP_MD_CTX *ctx,const void *data,size_t count) - { return SHA_Update(ctx->md_data,data,count); } +static int update(EVP_MD_CTX *ctx, const void *data, size_t count) +{ + return SHA_Update(ctx->md_data, data, count); +} -static int final(EVP_MD_CTX *ctx,unsigned char *md) - { return SHA_Final(md,ctx->md_data); } +static int final(EVP_MD_CTX *ctx, unsigned char *md) +{ + return SHA_Final(md, ctx->md_data); +} -static const EVP_MD sha_md= - { +static const EVP_MD sha_md = { NID_sha, NID_shaWithRSAEncryption, SHA_DIGEST_LENGTH, @@ -91,11 +96,12 @@ static const EVP_MD sha_md= NULL, EVP_PKEY_RSA_method, SHA_CBLOCK, - sizeof(EVP_MD *)+sizeof(SHA_CTX), - }; + sizeof(EVP_MD *) + sizeof(SHA_CTX), +}; -const EVP_MD *EVP_sha(void) - { - return(&sha_md); - } +const EVP_MD * +EVP_sha(void) +{ + return (&sha_md); +} #endif diff --git a/lib/libssl/src/crypto/evp/m_sha1.c b/lib/libssl/src/crypto/evp/m_sha1.c index f39ae779259..8c7e4eb2224 100644 --- a/lib/libssl/src/crypto/evp/m_sha1.c +++ b/lib/libssl/src/crypto/evp/m_sha1.c @@ -5,21 +5,21 @@ * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -49,7 +49,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence @@ -70,16 +70,21 @@ static int init(EVP_MD_CTX *ctx) - { return SHA1_Init(ctx->md_data); } +{ + return SHA1_Init(ctx->md_data); +} -static int update(EVP_MD_CTX *ctx,const void *data,size_t count) - { return SHA1_Update(ctx->md_data,data,count); } +static int update(EVP_MD_CTX *ctx, const void *data, size_t count) +{ + return SHA1_Update(ctx->md_data, data, count); +} -static int final(EVP_MD_CTX *ctx,unsigned char *md) - { return SHA1_Final(md,ctx->md_data); } +static int final(EVP_MD_CTX *ctx, unsigned char *md) +{ + return SHA1_Final(md, ctx->md_data); +} -static const EVP_MD sha1_md= - { +static const EVP_MD sha1_md = { NID_sha1, NID_sha1WithRSAEncryption, SHA_DIGEST_LENGTH, @@ -91,32 +96,40 @@ static const EVP_MD sha1_md= NULL, EVP_PKEY_RSA_method, SHA_CBLOCK, - sizeof(EVP_MD *)+sizeof(SHA_CTX), - }; - -const EVP_MD *EVP_sha1(void) - { - return(&sha1_md); - } + sizeof(EVP_MD *) + sizeof(SHA_CTX), +}; + +const EVP_MD * +EVP_sha1(void) +{ + return (&sha1_md); +} #endif #ifndef OPENSSL_NO_SHA256 static int init224(EVP_MD_CTX *ctx) - { return SHA224_Init(ctx->md_data); } +{ + return SHA224_Init(ctx->md_data); +} static int init256(EVP_MD_CTX *ctx) - { return SHA256_Init(ctx->md_data); } +{ + return SHA256_Init(ctx->md_data); +} /* * Even though there're separate SHA224_[Update|Final], we call * SHA256 functions even in SHA224 context. This is what happens * there anyway, so we can spare few CPU cycles:-) */ -static int update256(EVP_MD_CTX *ctx,const void *data,size_t count) - { return SHA256_Update(ctx->md_data,data,count); } -static int final256(EVP_MD_CTX *ctx,unsigned char *md) - { return SHA256_Final(md,ctx->md_data); } - -static const EVP_MD sha224_md= - { +static int update256(EVP_MD_CTX *ctx, const void *data, size_t count) +{ + return SHA256_Update(ctx->md_data, data, count); +} +static int final256(EVP_MD_CTX *ctx, unsigned char *md) +{ + return SHA256_Final(md, ctx->md_data); +} + +static const EVP_MD sha224_md = { NID_sha224, NID_sha224WithRSAEncryption, SHA224_DIGEST_LENGTH, @@ -128,14 +141,15 @@ static const EVP_MD sha224_md= NULL, EVP_PKEY_RSA_method, SHA256_CBLOCK, - sizeof(EVP_MD *)+sizeof(SHA256_CTX), - }; + sizeof(EVP_MD *) + sizeof(SHA256_CTX), +}; const EVP_MD *EVP_sha224(void) - { return(&sha224_md); } +{ + return (&sha224_md); +} -static const EVP_MD sha256_md= - { +static const EVP_MD sha256_md = { NID_sha256, NID_sha256WithRSAEncryption, SHA256_DIGEST_LENGTH, @@ -147,26 +161,35 @@ static const EVP_MD sha256_md= NULL, EVP_PKEY_RSA_method, SHA256_CBLOCK, - sizeof(EVP_MD *)+sizeof(SHA256_CTX), - }; + sizeof(EVP_MD *) + sizeof(SHA256_CTX), +}; const EVP_MD *EVP_sha256(void) - { return(&sha256_md); } +{ + return (&sha256_md); +} #endif /* ifndef OPENSSL_NO_SHA256 */ #ifndef OPENSSL_NO_SHA512 static int init384(EVP_MD_CTX *ctx) - { return SHA384_Init(ctx->md_data); } +{ + return SHA384_Init(ctx->md_data); +} static int init512(EVP_MD_CTX *ctx) - { return SHA512_Init(ctx->md_data); } +{ + return SHA512_Init(ctx->md_data); +} /* See comment in SHA224/256 section */ -static int update512(EVP_MD_CTX *ctx,const void *data,size_t count) - { return SHA512_Update(ctx->md_data,data,count); } -static int final512(EVP_MD_CTX *ctx,unsigned char *md) - { return SHA512_Final(md,ctx->md_data); } - -static const EVP_MD sha384_md= - { +static int update512(EVP_MD_CTX *ctx, const void *data, size_t count) +{ + return SHA512_Update(ctx->md_data, data, count); +} +static int final512(EVP_MD_CTX *ctx, unsigned char *md) +{ + return SHA512_Final(md, ctx->md_data); +} + +static const EVP_MD sha384_md = { NID_sha384, NID_sha384WithRSAEncryption, SHA384_DIGEST_LENGTH, @@ -178,14 +201,15 @@ static const EVP_MD sha384_md= NULL, EVP_PKEY_RSA_method, SHA512_CBLOCK, - sizeof(EVP_MD *)+sizeof(SHA512_CTX), - }; + sizeof(EVP_MD *) + sizeof(SHA512_CTX), +}; const EVP_MD *EVP_sha384(void) - { return(&sha384_md); } +{ + return (&sha384_md); +} -static const EVP_MD sha512_md= - { +static const EVP_MD sha512_md = { NID_sha512, NID_sha512WithRSAEncryption, SHA512_DIGEST_LENGTH, @@ -197,9 +221,11 @@ static const EVP_MD sha512_md= NULL, EVP_PKEY_RSA_method, SHA512_CBLOCK, - sizeof(EVP_MD *)+sizeof(SHA512_CTX), - }; + sizeof(EVP_MD *) + sizeof(SHA512_CTX), +}; const EVP_MD *EVP_sha512(void) - { return(&sha512_md); } +{ + return (&sha512_md); +} #endif /* ifndef OPENSSL_NO_SHA512 */ diff --git a/lib/libssl/src/crypto/evp/m_sigver.c b/lib/libssl/src/crypto/evp/m_sigver.c index 7e2731f4a4e..0274a72c1c2 100644 --- a/lib/libssl/src/crypto/evp/m_sigver.c +++ b/lib/libssl/src/crypto/evp/m_sigver.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 @@ -63,50 +63,42 @@ #include #include "evp_locl.h" -static int do_sigver_init(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, - const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey, - int ver) - { +static int +do_sigver_init(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, const EVP_MD *type, + ENGINE *e, EVP_PKEY *pkey, int ver) +{ if (ctx->pctx == NULL) ctx->pctx = EVP_PKEY_CTX_new(pkey, e); if (ctx->pctx == NULL) return 0; - if (type == NULL) - { + if (type == NULL) { int def_nid; if (EVP_PKEY_get_default_digest_nid(pkey, &def_nid) > 0) type = EVP_get_digestbynid(def_nid); - } + } - if (type == NULL) - { + if (type == NULL) { EVPerr(EVP_F_DO_SIGVER_INIT, EVP_R_NO_DEFAULT_DIGEST); return 0; - } + } - if (ver) - { - if (ctx->pctx->pmeth->verifyctx_init) - { - if (ctx->pctx->pmeth->verifyctx_init(ctx->pctx, ctx) <=0) + if (ver) { + if (ctx->pctx->pmeth->verifyctx_init) { + if (ctx->pctx->pmeth->verifyctx_init(ctx->pctx, + ctx) <=0) return 0; ctx->pctx->operation = EVP_PKEY_OP_VERIFYCTX; - } - else if (EVP_PKEY_verify_init(ctx->pctx) <= 0) + } else if (EVP_PKEY_verify_init(ctx->pctx) <= 0) return 0; - } - else - { - if (ctx->pctx->pmeth->signctx_init) - { + } else { + if (ctx->pctx->pmeth->signctx_init) { if (ctx->pctx->pmeth->signctx_init(ctx->pctx, ctx) <= 0) return 0; ctx->pctx->operation = EVP_PKEY_OP_SIGNCTX; - } - else if (EVP_PKEY_sign_init(ctx->pctx) <= 0) + } else if (EVP_PKEY_sign_init(ctx->pctx) <= 0) return 0; - } + } if (EVP_PKEY_CTX_set_signature_md(ctx->pctx, type) <= 0) return 0; if (pctx) @@ -114,65 +106,66 @@ static int do_sigver_init(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, if (!EVP_DigestInit_ex(ctx, type, e)) return 0; return 1; - } +} -int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, - const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey) - { +int +EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, const EVP_MD *type, + ENGINE *e, EVP_PKEY *pkey) +{ return do_sigver_init(ctx, pctx, type, e, pkey, 0); - } +} -int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, - const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey) - { +int +EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, const EVP_MD *type, + ENGINE *e, EVP_PKEY *pkey) +{ return do_sigver_init(ctx, pctx, type, e, pkey, 1); - } +} -int EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, size_t *siglen) - { +int +EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, size_t *siglen) +{ int sctx, r = 0; + if (ctx->pctx->pmeth->signctx) sctx = 1; else sctx = 0; - if (sigret) - { + if (sigret) { EVP_MD_CTX tmp_ctx; unsigned char md[EVP_MAX_MD_SIZE]; unsigned int mdlen; EVP_MD_CTX_init(&tmp_ctx); - if (!EVP_MD_CTX_copy_ex(&tmp_ctx,ctx)) - return 0; + if (!EVP_MD_CTX_copy_ex(&tmp_ctx, ctx)) + return 0; if (sctx) r = tmp_ctx.pctx->pmeth->signctx(tmp_ctx.pctx, - sigret, siglen, &tmp_ctx); + sigret, siglen, &tmp_ctx); else - r = EVP_DigestFinal_ex(&tmp_ctx,md,&mdlen); + r = EVP_DigestFinal_ex(&tmp_ctx, md, &mdlen); EVP_MD_CTX_cleanup(&tmp_ctx); if (sctx || !r) return r; if (EVP_PKEY_sign(ctx->pctx, sigret, siglen, md, mdlen) <= 0) return 0; - } - else - { - if (sctx) - { - if (ctx->pctx->pmeth->signctx(ctx->pctx, sigret, siglen, ctx) <= 0) + } else { + if (sctx) { + if (ctx->pctx->pmeth->signctx(ctx->pctx, sigret, + siglen, ctx) <= 0) return 0; - } - else - { + } else { int s = EVP_MD_size(ctx->digest); - if (s < 0 || EVP_PKEY_sign(ctx->pctx, sigret, siglen, NULL, s) <= 0) + if (s < 0 || EVP_PKEY_sign(ctx->pctx, sigret, siglen, + NULL, s) <= 0) return 0; - } } - return 1; } + return 1; +} -int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, unsigned char *sig, size_t siglen) - { +int +EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, unsigned char *sig, size_t siglen) +{ EVP_MD_CTX tmp_ctx; unsigned char md[EVP_MAX_MD_SIZE]; int r; @@ -184,17 +177,15 @@ int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, unsigned char *sig, size_t siglen) else vctx = 0; EVP_MD_CTX_init(&tmp_ctx); - if (!EVP_MD_CTX_copy_ex(&tmp_ctx,ctx)) - return -1; - if (vctx) - { - r = tmp_ctx.pctx->pmeth->verifyctx(tmp_ctx.pctx, - sig, siglen, &tmp_ctx); - } - else - r = EVP_DigestFinal_ex(&tmp_ctx,md,&mdlen); + if (!EVP_MD_CTX_copy_ex(&tmp_ctx, ctx)) + return -1; + if (vctx) { + r = tmp_ctx.pctx->pmeth->verifyctx(tmp_ctx.pctx, sig, + siglen, &tmp_ctx); + } else + r = EVP_DigestFinal_ex(&tmp_ctx, md, &mdlen); EVP_MD_CTX_cleanup(&tmp_ctx); if (vctx || !r) return r; return EVP_PKEY_verify(ctx->pctx, sig, siglen, md, mdlen); - } +} diff --git a/lib/libssl/src/crypto/evp/m_wp.c b/lib/libssl/src/crypto/evp/m_wp.c index c51bc2d5d1e..3991a71c177 100644 --- a/lib/libssl/src/crypto/evp/m_wp.c +++ b/lib/libssl/src/crypto/evp/m_wp.c @@ -12,16 +12,21 @@ #include "evp_locl.h" static int init(EVP_MD_CTX *ctx) - { return WHIRLPOOL_Init(ctx->md_data); } +{ + return WHIRLPOOL_Init(ctx->md_data); +} -static int update(EVP_MD_CTX *ctx,const void *data,size_t count) - { return WHIRLPOOL_Update(ctx->md_data,data,count); } +static int update(EVP_MD_CTX *ctx, const void *data, size_t count) +{ + return WHIRLPOOL_Update(ctx->md_data, data, count); +} -static int final(EVP_MD_CTX *ctx,unsigned char *md) - { return WHIRLPOOL_Final(md,ctx->md_data); } +static int final(EVP_MD_CTX *ctx, unsigned char *md) +{ + return WHIRLPOOL_Final(md, ctx->md_data); +} -static const EVP_MD whirlpool_md= - { +static const EVP_MD whirlpool_md = { NID_whirlpool, 0, WHIRLPOOL_DIGEST_LENGTH, @@ -33,11 +38,12 @@ static const EVP_MD whirlpool_md= NULL, EVP_PKEY_NULL_method, WHIRLPOOL_BBLOCK/8, - sizeof(EVP_MD *)+sizeof(WHIRLPOOL_CTX), - }; - -const EVP_MD *EVP_whirlpool(void) - { - return(&whirlpool_md); - } + sizeof(EVP_MD *) + sizeof(WHIRLPOOL_CTX), +}; + +const EVP_MD * +EVP_whirlpool(void) +{ + return (&whirlpool_md); +} #endif -- 2.20.1