~ubuntu-branches/ubuntu/oneiric/gnupg2/oneiric-updates

« back to all changes in this revision

Viewing changes to tests/openpgp/mds.test

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Viehmann
  • Date: 2008-10-04 10:25:53 UTC
  • mfrom: (5.1.15 intrepid)
  • Revision ID: james.westby@ubuntu.com-20081004102553-fv62pp8dsitxli47
Tags: 2.0.9-3.1
* Non-maintainer upload.
* agent/gpg-agent.c: Deinit the threading library before exec'ing
  the command to run in --daemon mode. And because that still doesn't
  restore the sigprocmask, do that manually. Closes: #499569

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
# Copyright 1998,1999,2000,2001,2002,2003,2004,2005,2006,
 
3
#           2007 Free Software Foundation, Inc.
 
4
# This file is free software; as a special exception the author gives
 
5
# unlimited permission to copy and/or distribute it, with or without
 
6
# modifications, as long as this notice is preserved.  This file is
 
7
# distributed in the hope that it will be useful, but WITHOUT ANY
 
8
# WARRANTY, to the extent permitted by law; without even the implied
 
9
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
10
 
 
11
 
 
12
. $srcdir/defs.inc || exit 3
 
13
 
 
14
 
 
15
test_one () {
 
16
   if [ "`grep $1 y | sed -e 's/:[^:]*:\(.*\):/\1/'`" != "$2" ]; then
 
17
        failed="$failed $1"
 
18
   fi
 
19
}
 
20
 
 
21
failed=""
 
22
 
 
23
#info Checking message digests
 
24
cat /dev/null | $GPG --with-colons --print-mds >y
 
25
# MD5
 
26
test_one ":1:"    "D41D8CD98F00B204E9800998ECF8427E"
 
27
# SHA-1
 
28
test_one ":2:"    "DA39A3EE5E6B4B0D3255BFEF95601890AFD80709"
 
29
# RMD160
 
30
test_one ":3:"    "9C1185A5C5E9FC54612808977EE8F548B2258D31"
 
31
# SHA-224
 
32
if have_hash_algo "SHA224"; then
 
33
  test_one ":11:"    "D14A028C2A3A2BC9476102BB288234C415A2B01F828EA62AC5B3E42F"
 
34
else
 
35
  echo "Hash algorithm SHA-224 is not installed (not an error)"
 
36
fi
 
37
# SHA-256
 
38
if have_hash_algo "SHA256"; then
 
39
  test_one ":8:"    "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855"
 
40
else
 
41
  echo "Hash algorithm SHA-256 is not installed (not an error)"
 
42
fi
 
43
# SHA-384
 
44
if have_hash_algo "SHA384"; then
 
45
  test_one ":9:"  "38B060A751AC96384CD9327EB1B1E36A21FDB71114BE07434C0CC7BF63F6E1DA274EDEBFE76F65FBD51AD2F14898B95B"
 
46
else
 
47
  echo "Hash algorithm SHA-384 is not installed (not an error)"
 
48
fi
 
49
# SHA-512
 
50
if have_hash_algo "SHA512"; then
 
51
  test_one ":10:"  "CF83E1357EEFB8BDF1542850D66D8007D620E4050B5715DC83F4A921D36CE9CE47D0D13C5D85F2B0FF8318D2877EEC2F63B931BD47417A81A538327AF927DA3E"
 
52
else
 
53
  echo "Hash algorithm SHA-512 is not installed (not an error)"
 
54
fi
 
55
 
 
56
[ "$failed" != "" ] && error "$failed failed for empty string"
 
57
 
 
58
echo_n "abcdefghijklmnopqrstuvwxyz" | $GPG --with-colons --print-mds >y
 
59
test_one ":1:"    "C3FCD3D76192E4007DFB496CCA67E13B"
 
60
test_one ":2:"    "32D10C7B8CF96570CA04CE37F2A19D84240D3A89"
 
61
test_one ":3:"    "F71C27109C692C1B56BBDCEB5B9D2865B3708DBC"
 
62
if have_hash_algo "SHA224"; then
 
63
  test_one ":11:"    "45A5F72C39C5CFF2522EB3429799E49E5F44B356EF926BCF390DCCC2"
 
64
fi
 
65
if have_hash_algo "SHA256"; then
 
66
  test_one ":8:"    "71C480DF93D6AE2F1EFAD1447C66C9525E316218CF51FC8D9ED832F2DAF18B73"
 
67
fi
 
68
if have_hash_algo "SHA384"; then
 
69
  test_one ":9:"  "FEB67349DF3DB6F5924815D6C3DC133F091809213731FE5C7B5F4999E463479FF2877F5F2936FA63BB43784B12F3EBB4"
 
70
fi
 
71
if have_hash_algo "SHA512"; then
 
72
  test_one ":10:" "4DBFF86CC2CA1BAE1E16468A05CB9881C97F1753BCE3619034898FAA1AABE429955A1BF8EC483D7421FE3C1646613A59ED5441FB0F321389F77F48A879C7B1F1"
 
73
fi
 
74
 
 
75
[ "$failed" != "" ] && error "$failed failed for a..z"
 
76
 
 
77
exit 0