From 07f5c09b19f56c323fa22ebd5efb5a4df9f5dc4d Mon Sep 17 00:00:00 2001 From: tedu <> Date: Fri, 18 Apr 2014 00:10:08 +0000 Subject: putting most of the braces in the right column is the very least we can do. --- src/lib/libcrypto/asn1/a_sign.c | 42 ++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'src/lib/libcrypto/asn1/a_sign.c') diff --git a/src/lib/libcrypto/asn1/a_sign.c b/src/lib/libcrypto/asn1/a_sign.c index 0433b49a64..349422fe9a 100644 --- a/src/lib/libcrypto/asn1/a_sign.c +++ b/src/lib/libcrypto/asn1/a_sign.c @@ -128,22 +128,22 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2, ASN1_BIT_STRING *signature, void *asn, EVP_PKEY *pkey, const EVP_MD *type) - { +{ EVP_MD_CTX ctx; EVP_MD_CTX_init(&ctx); if (!EVP_DigestSignInit(&ctx, NULL, type, NULL, pkey)) - { + { EVP_MD_CTX_cleanup(&ctx); return 0; - } - return ASN1_item_sign_ctx(it, algor1, algor2, signature, asn, &ctx); } + return ASN1_item_sign_ctx(it, algor1, algor2, signature, asn, &ctx); +} int ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2, ASN1_BIT_STRING *signature, void *asn, EVP_MD_CTX *ctx) - { +{ const EVP_MD *type; EVP_PKEY *pkey; unsigned char *buf_in=NULL,*buf_out=NULL; @@ -155,13 +155,13 @@ int ASN1_item_sign_ctx(const ASN1_ITEM *it, pkey = EVP_PKEY_CTX_get0_pkey(ctx->pctx); if (!type || !pkey) - { + { ASN1err(ASN1_F_ASN1_ITEM_SIGN_CTX, ASN1_R_CONTEXT_NOT_INITIALISED); return 0; - } + } if (pkey->ameth->item_sign) - { + { rv = pkey->ameth->item_sign(ctx, it, asn, algor1, algor2, signature); if (rv == 1) @@ -176,24 +176,24 @@ int ASN1_item_sign_ctx(const ASN1_ITEM *it, ASN1err(ASN1_F_ASN1_ITEM_SIGN_CTX, ERR_R_EVP_LIB); if (rv <= 1) goto err; - } + } else rv = 2; if (rv == 2) - { + { if (type->flags & EVP_MD_FLAG_PKEY_METHOD_SIGNATURE) - { + { if (!pkey->ameth || !OBJ_find_sigid_by_algs(&signid, EVP_MD_nid(type), pkey->ameth->pkey_id)) - { + { ASN1err(ASN1_F_ASN1_ITEM_SIGN_CTX, ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED); return 0; - } } + } else signid = type->pkey_type; @@ -207,25 +207,25 @@ int ASN1_item_sign_ctx(const ASN1_ITEM *it, if (algor2) X509_ALGOR_set0(algor2, OBJ_nid2obj(signid), paramtype, NULL); - } + } inl=ASN1_item_i2d(asn,&buf_in, it); outll=outl=EVP_PKEY_size(pkey); buf_out=malloc((unsigned int)outl); if ((buf_in == NULL) || (buf_out == NULL)) - { + { outl=0; ASN1err(ASN1_F_ASN1_ITEM_SIGN_CTX,ERR_R_MALLOC_FAILURE); goto err; - } + } if (!EVP_DigestSignUpdate(ctx, buf_in, inl) || !EVP_DigestSignFinal(ctx, buf_out, &outl)) - { + { outl=0; ASN1err(ASN1_F_ASN1_ITEM_SIGN_CTX,ERR_R_EVP_LIB); goto err; - } + } if (signature->data != NULL) free(signature->data); signature->data=buf_out; buf_out=NULL; @@ -238,8 +238,8 @@ int ASN1_item_sign_ctx(const ASN1_ITEM *it, err: EVP_MD_CTX_cleanup(ctx); if (buf_in != NULL) - { OPENSSL_cleanse((char *)buf_in,(unsigned int)inl); free(buf_in); } + { OPENSSL_cleanse((char *)buf_in,(unsigned int)inl); free(buf_in); } if (buf_out != NULL) - { OPENSSL_cleanse((char *)buf_out,outll); free(buf_out); } + { OPENSSL_cleanse((char *)buf_out,outll); free(buf_out); } return(outl); - } +} -- cgit v1.2.3-55-g6feb