From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1QaF6f-0007BC-9Z for mharc-grub-devel@gnu.org; Fri, 24 Jun 2011 18:44:09 -0400 Received: from eggs.gnu.org ([140.186.70.92]:52987) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QaF6c-0007B5-2B for grub-devel@gnu.org; Fri, 24 Jun 2011 18:44:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QaF6a-00014G-UM for grub-devel@gnu.org; Fri, 24 Jun 2011 18:44:06 -0400 Received: from mail-wy0-f169.google.com ([74.125.82.169]:59671) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QaF6a-000140-MB for grub-devel@gnu.org; Fri, 24 Jun 2011 18:44:04 -0400 Received: by wyg36 with SMTP id 36so2693404wyg.0 for ; Fri, 24 Jun 2011 15:44:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :subject:x-enigmail-version:content-type; bh=ty4LrnDXWM9gQYePEcnfOV/8oXxOoVXUhCtt5vDH9Nk=; b=UnjiZD6lhx8dsFgGKBcRGPXmev5PuHozok4D1hSJu8Df6Hp3zPV5ac8zpetvmCXCvY NL2WOJ4pZnj/uMzumKdM2zv5TZl+cGPtEdt9FmH3VtR6RPw1WqaihnUwsDtFR/4dDLIt Lx1Boqtsy2mv6gkR86vx50ls/OSjKBx9YnEy8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :x-enigmail-version:content-type; b=e+nu+rnVJ1QBkJjWRjN4ZG2cArM0JHMMhJIqQqVOkSGbtLVubUOw5P+y7o3o7wHKRo NBP3NhMoOocyPlamJs2HcYOpORrrCZqIszhCmqdUGAtmuPckyq652Gj7guD7UeW01VNT /3YIXZRNNPGi2vYp9dZq7Y7Or/p21VWMwyKMw= Received: by 10.216.9.204 with SMTP id 54mr1001746wet.90.1308955442892; Fri, 24 Jun 2011 15:44:02 -0700 (PDT) Received: from debian.x201.phnet (6.71.63.81.cust.bluewin.ch [81.63.71.6]) by mx.google.com with ESMTPS id h22sm1619632wes.8.2011.06.24.15.44.00 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 24 Jun 2011 15:44:01 -0700 (PDT) Message-ID: <4E05132E.2070709@gmail.com> Date: Sat, 25 Jun 2011 00:43:58 +0200 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110606 Iceowl/1.0b2 Icedove/3.1.10 MIME-Version: 1.0 To: Szymon Janc , The development of GRUB 2 Subject: [PATCH] CRCR64 X-Enigmail-Version: 1.1.2 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="------------enig574E9A5D6BD60EB21827DD4B" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 74.125.82.169 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jun 2011 22:44:07 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig574E9A5D6BD60EB21827DD4B Content-Type: multipart/mixed; boundary="------------090300000309050707040802" This is a multi-part message in MIME format. --------------090300000309050707040802 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable --=20 Regards Vladimir '=CF=86-coder/phcoder' Serbinenko --------------090300000309050707040802 Content-Type: text/x-diff; name="crc64.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="crc64.diff" =3D=3D=3D modified file 'Makefile.util.def' --- Makefile.util.def 2011-06-24 20:16:05 +0000 +++ Makefile.util.def 2011-06-24 21:29:27 +0000 @@ -88,6 +88,7 @@ common =3D grub-core/lib/LzmaEnc.c; common =3D grub-core/lib/pbkdf2.c; common =3D grub-core/lib/crc.c; + common =3D grub-core/lib/crc64.c; common =3D grub-core/normal/datetime.c; common =3D grub-core/normal/misc.c; common =3D grub-core/partmap/acorn.c; =3D=3D=3D modified file 'grub-core/Makefile.core.def' --- grub-core/Makefile.core.def 2011-06-24 20:16:05 +0000 +++ grub-core/Makefile.core.def 2011-06-24 21:21:08 +0000 @@ -1637,3 +1637,8 @@ common =3D commands/keylayouts.c; enable =3D videomodules; }; + +module =3D { + name =3D crc64; + common =3D lib/crc64.c; +}; =3D=3D=3D added file 'grub-core/lib/crc64.c' --- grub-core/lib/crc64.c 1970-01-01 00:00:00 +0000 +++ grub-core/lib/crc64.c 2011-06-24 22:21:37 +0000 @@ -0,0 +1,111 @@ +/* crc64.c - crc64 function */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2008,2011 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * 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 . + */ + +#include +#include +#include + +static grub_uint64_t crc64_table [256]; + +static void +init_crc64_table (void) +{ + auto grub_uint64_t reflect (grub_uint64_t ref, int len); + grub_uint64_t reflect (grub_uint64_t ref, int len) + { + grub_uint64_t result =3D 0; + int i; + + for (i =3D 1; i <=3D len; i++) + { + if (ref & 1) + result |=3D 1ULL << (len - i); + ref >>=3D 1; + } + + return result; + } + + grub_uint64_t polynomial =3D 0x42f0e1eba9ea3693ULL; + int i, j; + + for(i =3D 0; i < 256; i++) + { + crc64_table[i] =3D reflect(i, 8) << 56; + for (j =3D 0; j < 8; j++) + { + crc64_table[i] =3D (crc64_table[i] << 1) ^ + (crc64_table[i] & (1ULL << 63) ? polynomial : 0); + } + crc64_table[i] =3D reflect(crc64_table[i], 64); + } +} + +static void +crc64_init (void *context) +{ + if (! crc64_table[1]) + init_crc64_table (); + *(grub_uint64_t *) context =3D 0; +} + +static void +crc64_write (void *context, const void *buf, grub_size_t size) +{ + unsigned i; + const grub_uint8_t *data =3D buf; + grub_uint64_t crc =3D ~grub_le_to_cpu64 (*(grub_uint64_t *) context); + + for (i =3D 0; i < size; i++) + { + crc =3D (crc >> 8) ^ crc64_table[(crc & 0xFF) ^ *data]; + data++; + } + + *(grub_uint64_t *) context =3D grub_cpu_to_le64 (~crc); +} + +static grub_uint8_t * +crc64_read (void *context) +{ + return context; +} + +static void +crc64_final (void *context __attribute__ ((unused))) +{ +} + +gcry_md_spec_t _gcry_digest_spec_crc64 =3D + { + "CRC64", 0, 0, 0, 8, + crc64_init, crc64_write, crc64_final, crc64_read, + sizeof (grub_uint64_t), + .blocksize =3D 64 + }; + +GRUB_MOD_INIT(crc64) +{ + grub_md_register (&_gcry_digest_spec_crc64); +} + +GRUB_MOD_FINI(crc64) +{ + grub_md_unregister (&_gcry_digest_spec_crc64); +} =3D=3D=3D modified file 'util/import_gcry.py' --- util/import_gcry.py 2011-04-12 10:39:17 +0000 +++ util/import_gcry.py 2011-06-24 21:23:01 +0000 @@ -73,6 +73,8 @@ cryptolist.write ("AES-192: gcry_rijndael\n"); cryptolist.write ("AES-256: gcry_rijndael\n"); =20 +cryptolist.write ("CRC64: crc64\n"); + for cipher_file in cipher_files: infile =3D os.path.join (cipher_dir_in, cipher_file) outfile =3D os.path.join (cipher_dir_out, cipher_file) --------------090300000309050707040802-- --------------enig574E9A5D6BD60EB21827DD4B Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iF4EAREKAAYFAk4FEy4ACgkQNak7dOguQgmlbQEAmDelXmYqB7sWvQnjB0buQD5k Lfu/o52HBC1mXvLoUyYBAIJfpEkEb21RNpeZXEOxfKQfq00RmgsEtf1z7PnY3M4/ =07Lq -----END PGP SIGNATURE----- --------------enig574E9A5D6BD60EB21827DD4B--