From 5c47e7825ba6f9524c1642675aa9fe70cd102b2c Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 15 Apr 2020 22:23:10 +0200 Subject: [PATCH] indent: Some typo and indentation changes for gpg. -- --- doc/HACKING | 7 ++----- g10/decrypt-data.c | 24 +++++++++++++----------- g10/mainproc.c | 2 +- g10/misc.c | 2 +- g10/parse-packet.c | 2 +- 5 files changed, 18 insertions(+), 19 deletions(-) diff --git a/doc/HACKING b/doc/HACKING index 4781bf62c..0f8f84e5c 100644 --- a/doc/HACKING +++ b/doc/HACKING @@ -182,12 +182,11 @@ Note that such a comment will be removed if the git commit option ** Variable names Follow the GNU standards. Here are some conventions you may want to - stick to (do not rename existing "wrong" uses without a goog - reason). + stick to (do not rename existing "wrong" uses without a good reason). - err :: This conveys an error code of type =gpg_error_t= which is compatible to an =int=. To compare such a variable to a - GPG_ERR_ constant, it is necessary to map the value like + GPG_ERR_ constant, it is necessary to access the value like this: =gpg_err_code(err)=. - ec :: This is used for a gpg-error code which has no source part (=gpg_err_code_t=) and will eventually be used as input to @@ -425,5 +424,3 @@ plaintext packets and so on. The file g10/encode.c might be a good starting point to see how it is used - actually this is the other way: constructing messages using pushed filters but it may be easier to understand. - - diff --git a/g10/decrypt-data.c b/g10/decrypt-data.c index 5fd458845..86a16a718 100644 --- a/g10/decrypt-data.c +++ b/g10/decrypt-data.c @@ -16,6 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, see . + * SPDX-License-Identifier: GPL-3.0-or-later */ #include @@ -42,7 +43,7 @@ static int decode_filter ( void *opaque, int control, IOBUF a, /* Our context object. */ struct decode_filter_context_s { - /* Recounter (max value is 2). We need it because we do not know + /* Redcounter (max value is 2). We need it because we do not know * whether the iobuf or the outer control code frees this object * first. */ int refcount; @@ -57,7 +58,8 @@ struct decode_filter_context_s byte startiv[16]; /* The holdback buffer and its used length. For AEAD we need 32+1 - * bytes but we use 48 byte. For MDC we need 22 bytes. */ + * bytes but we use 48 byte. For MDC we need 22 bytes; here + * holdbacklen will either 0 or 22. */ char holdback[48]; unsigned int holdbacklen; @@ -66,7 +68,7 @@ struct decode_filter_context_s /* EOF indicator with these true values: * 1 = normal EOF - * 2 = premature EOF (tag incomplete) + * 2 = premature EOF (tag or hash incomplete) * 3 = premature EOF (general) */ unsigned int eof_seen : 2; @@ -118,7 +120,7 @@ release_dfx_context (decode_filter_ctx_t dfx) /* Set the nonce and the additional data for the current chunk. This - * also reset the decryption machinery * so that the handle can be + * also reset the decryption machinery so that the handle can be * used for a new chunk. If FINAL is set the final AEAD chunk is * processed. */ static gpg_error_t @@ -281,6 +283,7 @@ decrypt_data (ctrl_t ctrl, void *procctx, PKT_encrypted *ed, DEK *dek) blocksize = openpgp_cipher_get_algo_blklen (dek->algo); if ( !blocksize || blocksize > 16 ) log_fatal ("unsupported blocksize %u\n", blocksize ); + if (ed->aead_algo) { enum gcry_cipher_modes ciphermode; @@ -375,7 +378,7 @@ decrypt_data (ctrl_t ctrl, void *procctx, PKT_encrypted *ed, DEK *dek) if ( ed->len && ed->len < (nprefix+2) ) { /* An invalid message. We can't check that during parsing - because we may not know the used cipher then. */ + * because we may not know the used cipher then. */ rc = gpg_error (GPG_ERR_INV_PACKET); goto leave; } @@ -405,19 +408,19 @@ decrypt_data (ctrl_t ctrl, void *procctx, PKT_encrypted *ed, DEK *dek) rc = gcry_cipher_setkey (dfx->cipher_hd, dek->key, dek->keylen); if ( gpg_err_code (rc) == GPG_ERR_WEAK_KEY ) { - log_info(_("WARNING: message was encrypted with" - " a weak key in the symmetric cipher.\n")); + log_info (_("WARNING: message was encrypted with" + " a weak key in the symmetric cipher.\n")); rc=0; } - else if( rc ) + else if (rc) { - log_error("key setup failed: %s\n", gpg_strerror (rc) ); + log_error ("key setup failed: %s\n", gpg_strerror (rc) ); goto leave; } if (!ed->buf) { - log_error(_("problem handling encrypted packet\n")); + log_error (_("problem handling encrypted packet\n")); goto leave; } @@ -535,7 +538,6 @@ decrypt_data (ctrl_t ctrl, void *procctx, PKT_encrypted *ed, DEK *dek) /* log_printhex("MDC calc:", gcry_md_read (dfx->mdc_hash,0), datalen); */ } - leave: release_dfx_context (dfx); return rc; diff --git a/g10/mainproc.c b/g10/mainproc.c index 941ffaa76..03573c921 100644 --- a/g10/mainproc.c +++ b/g10/mainproc.c @@ -956,7 +956,7 @@ proc_plaintext( CTX c, PACKET *pkt ) /* We add a marker control packet instead of the plaintext packet. * This is so that we can later detect invalid packet sequences. - * The apcket is further used to convey extra data from the + * The packet is further used to convey extra data from the * plaintext packet to the signature verification. */ extrahash = xtrymalloc (6 + pt->namelen); if (!extrahash) diff --git a/g10/misc.c b/g10/misc.c index 8ace21f09..32a5e22b3 100644 --- a/g10/misc.c +++ b/g10/misc.c @@ -71,7 +71,7 @@ #include "../common/zb32.h" -/* FIXME: Libgcrypt 1.9 will support EAX. Until we kame this a +/* FIXME: Libgcrypt 1.9 will support EAX. Until we name this a * requirement we hardwire the enum used for EAX. */ #define MY_GCRY_CIPHER_MODE_EAX 14 diff --git a/g10/parse-packet.c b/g10/parse-packet.c index 36ce15229..fc37c095d 100644 --- a/g10/parse-packet.c +++ b/g10/parse-packet.c @@ -1243,7 +1243,7 @@ parse_symkeyenc (IOBUF inp, int pkttype, unsigned long pktlen, { /* To compute the size of the session key we need to know * the size of the AEAD nonce which we may not know. Thus - * we show only the seize of the entire encrypted session + * we show only the size of the entire encrypted session * key. */ if (aead_algo) es_fprintf (listfp, ", encrypted seskey %d bytes", seskeylen);