#*
#* GRUB -- GRand Unified Bootloader
#* Copyright (C) 2009 Free Software Foundation, Inc.
#*
#* it under the terms of the GNU General Public License as published by
#* the Free Software Foundation, either version 3 of the License, or
#* (at your option) any later version.
#*
#* GRUB is distributed in the hope that it will be useful,
#* but WITHOUT ANY WARRANTY; without even the implied warranty of
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#* GNU General Public License for more details.
#*
#* You should have received a copy of the GNU General Public License
#* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
#*
import re
import sys
import os
import datetime
import codecs
exit (0)
try:
except:
print ("WARNING: %s already exists" % basedir)
try:
except:
print ("WARNING: %s already exists" % cipher_dir_out)
modules = []
# But libgcrypt uses 64. Let's keep the value for compatibility. Since
"_gcry_digest_spec_crc32_rfc1510" : 64,
"_gcry_digest_spec_crc24_rfc2440" : 64,
"_gcry_digest_spec_md4" : 64,
"_gcry_digest_spec_md5" : 64,
"_gcry_digest_spec_rmd160" : 64,
"_gcry_digest_spec_sha1" : 64,
"_gcry_digest_spec_sha224" : 64,
"_gcry_digest_spec_sha256" : 64,
"_gcry_digest_spec_sha384" : 128,
"_gcry_digest_spec_sha512" : 128,
"_gcry_digest_spec_tiger" : 64,
"_gcry_digest_spec_whirlpool" : 64}
# rijndael is the only cipher using aliases. So no need for mangling, just
# hardcode it
for cipher_file in cipher_files:
if cipher_file == "ChangeLog":
continue
if re.match ("(Manifest|Makefile\.am|ac\.c|cipher\.c|hash-common\.c|hmac-tests\.c|md\.c|pubkey\.c)$", cipher_file):
continue
# Autogenerated files. Not even worth mentionning in ChangeLog
continue
if cipher_file == "camellia.h":
# Whole libgcrypt is distributed under GPLv3+ or compatible
if isc:
ciphernames = []
mdnames = []
if isc:
for line in f:
if skip_statement:
continue
if skip:
continue
if skip2:
continue
if iscryptostart:
if not s is None:
if not iscomma:
if ismd:
if not (mdname in mdblocksizes):
print ("ERROR: Unknown digest blocksize: %s\n"
% mdname)
exit (1)
% mdblocksizes [mdname])
# Used only for selftests.
if not m is None:
if nch:
else:
continue
if hold:
# We're optimising for size.
if not re.match ("(run_selftests|selftest|_gcry_aes_c.._..c|_gcry_[a-z0-9]*_hash_buffer|tripledes_set2keys|do_tripledes_set_extra_info|_gcry_rmd160_mixblock|serpent_test)", line) is None:
if nch:
else:
continue
else:
if not m is None:
if nch:
else:
continue
if isc and not m is None:
assert (not iscryptostart)
assert (not iscipher)
assert (not iscryptostart)
if isc and not m is None:
assert (not ismd)
assert (not iscipher)
assert (not iscryptostart)
if not m is None:
if nch:
else:
continue
m = re.match ("(static const char( |)\*|static gpg_err_code_t|void|static int|static gcry_err_code_t)$", line)
if not m is None:
continue
if not m is None:
continue
if not m is None:
continue
if isc and not m is None:
if nch:
else:
continue
if isc and not m is None:
if nch:
else:
continue
if isglue:
modfiles = "lib/libgcrypt-grub/cipher/%s lib/libgcrypt-grub/cipher/%s" \
else:
if nch:
else:
for ciphername in ciphernames:
for ciphername in ciphernames:
print ("WARNING: C file isn't a module: %s" % cipher_file)
f.close ()
if nch:
continue
print ("WARNING: unknown file %s" % cipher_file)
cryptolist.close ()
for line in f:
f.close ()