1
1
/* tiger.c - The TIGER hash function
2
* Copyright (C) 1998, 2001, 2002, 2003 Free Software Foundation, Inc.
2
* Copyright (C) 1998, 2001, 2002, 2003, 2010 Free Software Foundation, Inc.
4
4
* This file is part of Libgcrypt.
14
14
* GNU Lesser General Public License for more details.
16
16
* You should have received a copy of the GNU Lesser General Public
17
* License along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
17
* License along with this program; if not, see <http://www.gnu.org/licenses/>.
20
/* See http://www.cs.technion.ac.il/~biham/Reports/Tiger/ */
21
22
#include <config.h>
23
24
#include <stdlib.h>
783
805
if( hd->count < 56 ) /* enough room */
785
hd->buf[hd->count++] = 0x01; /* pad */
807
hd->buf[hd->count++] = pad;
786
808
while( hd->count < 56 )
787
809
hd->buf[hd->count++] = 0; /* pad */
789
811
else /* need one extra block */
791
hd->buf[hd->count++] = 0x01; /* pad character */
813
hd->buf[hd->count++] = pad;
792
814
while( hd->count < 64 )
793
815
hd->buf[hd->count++] = 0;
794
816
tiger_write(hd, NULL, 0); /* flush */;
832
static byte asn[19] = /* Object ID is 1.3.6.1.4.1.11591.12.2 */
869
/* This is the old TIGER variant based on the unfixed reference
870
implementation. It was used in GnuPG up to 1.3.2. We don't provide
871
an OID anymore because that would not be correct. */
872
gcry_md_spec_t _gcry_digest_spec_tiger =
874
"TIGER192", NULL, 0, NULL, 24,
875
tiger_init, tiger_write, tiger_final, tiger_read,
876
sizeof (TIGER_CONTEXT)
881
/* This is the fixed TIGER implementation. */
882
static byte asn1[19] = /* Object ID is 1.3.6.1.4.1.11591.12.2 */
833
883
{ 0x30, 0x29, 0x30, 0x0d, 0x06, 0x09, 0x2b, 0x06,
834
884
0x01, 0x04, 0x01, 0xda, 0x47, 0x0c, 0x02,
835
885
0x05, 0x00, 0x04, 0x18 };
837
static gcry_md_oid_spec_t oid_spec_tiger[] =
887
static gcry_md_oid_spec_t oid_spec_tiger1[] =
839
889
/* GNU.digestAlgorithm TIGER */
840
890
{ "1.3.6.1.4.1.11591.12.2" },
844
gcry_md_spec_t _gcry_digest_spec_tiger =
846
"TIGER192", asn, DIM (asn), oid_spec_tiger, 24,
847
tiger_init, tiger_write, tiger_final, tiger_read,
848
sizeof (TIGER_CONTEXT)
894
gcry_md_spec_t _gcry_digest_spec_tiger1 =
896
"TIGER", asn1, DIM (asn1), oid_spec_tiger1, 24,
897
tiger1_init, tiger_write, tiger_final, tiger_read,
898
sizeof (TIGER_CONTEXT)
903
/* This is TIGER2 which uses a changed padding algorithm. */
904
gcry_md_spec_t _gcry_digest_spec_tiger2 =
906
"TIGER2", NULL, 0, NULL, 24,
907
tiger2_init, tiger_write, tiger_final, tiger_read,
908
sizeof (TIGER_CONTEXT)
851
913
#endif /* HAVE_U64_TYPEDEF */