Home GnuPG
Diffusion GnuPG ad989373f1a4

gpg: Factor common code out of the AEAD decryption function.

Description

gpg: Factor common code out of the AEAD decryption function.

* g10/decrypt-data.c (aead_underflow): Factor reading and checking
code code out to ...
(fill_buffer, aead_checktag): new functions.

Here is a simple test script to check against a set of encrypted files
with naming convention like "symenc-aead-eax-c6-56.asc"

------------------------ >8 ------------------------

set -e
GPG=../g10/gpg
for file in "$@"; do

echo "${file##*/}" | ( IFS=- read dummy1 dummy2 mode cbyte len rest
len="${len%.*}"
cbyte="${cbyte#c}"
[ "$dummy1" != "symenc" -o "$dummy2" != "aead" ] && continue
echo "checking mode=$mode chunkbyte=$cbyte length=$len"
if ! $GPG --no-options --rfc4880bis --batch --passphrase "abc" \
           -d < $file >tmp.plain 2>/dev/null; then
    echo "Decryption failed for $file" >&2
    exit 2
fi
plainlen=$(wc -c <tmp.plain)
if [ $plainlen -ne $len ]; then
    echo "Plaintext length mismatch for $file (want=$len have=$plainlen)" >&2
    exit 2
fi

)

done
echo "all files are okay" >&2

------------------------ 8< ------------------------

  • Signed-off-by: Werner Koch <wk@gnupg.org>

Details

Provenance
wernerAuthored on Feb 27 2018, 7:50 PM
Parents
rGb703ba725dad: gpg: Rename cipher.c to cipher-cfb.c
Branches
Unknown
Tags
Unknown