~ubuntu-branches/ubuntu/precise/dropbear/precise

« back to all changes in this revision

Viewing changes to libtomcrypt/testprof/pkcs_1_test.c

  • Committer: Bazaar Package Importer
  • Author(s): Gerrit Pape
  • Date: 2007-03-02 20:48:18 UTC
  • mfrom: (1.3.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20070302204818-ozmbou2sbyj7dus5
Tags: 0.49-1
* new upstream release, fixes
  * CVE-2007-1099: dropbear dbclient insufficient warning on hostkey
    mismatch (closes: #412899).
  * dbclient uses static "Password:" prompt instead of using the server's
    prompt (closes: #394996).
* debian/control: Suggests: openssh-client, not ssh (closes: #405686);
  Standards-Version: 3.7.2.2.
* debian/README.Debian: ssh -> openssh-server, openssh-client; remove
  'Replacing OpenSSH "sshd" with Dropbear' part, this is simply done by not
  installing the openssh-server package.
* debian/README.runit: runsvstat -> sv status.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
int pkcs_1_test(void)
6
6
{
7
7
   unsigned char buf[3][128];
8
 
   int res1, res2, res3, prng_idx, hash_idx;
 
8
   int res1, res2, res3, prng_idx, hash_idx, err;
9
9
   unsigned long x, y, l1, l2, l3, i1, i2, lparamlen, saltlen, modlen;
10
10
   static const unsigned char lparam[] = { 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 };
11
11
 
18
18
      return 1;
19
19
   }   
20
20
 
 
21
   srand(time(NULL));
21
22
   /* do many tests */
22
23
   for (x = 0; x < 100; x++) {
23
24
      zeromem(buf, sizeof(buf));
26
27
      l3 = (rand() & 31) + 8;
27
28
      for (y = 0; y < l3; y++) buf[0][y] = rand() & 255;
28
29
 
29
 
      /* random modulus len (v1.5 must be multiple of 8 though arbitrary sizes seem to work) */
30
 
      modlen = 800 + 8 * (abs(rand()) % 28);
31
 
 
32
30
      /* pick a random lparam len [0..16] */
33
31
      lparamlen = abs(rand()) % 17;
34
32
 
69
67
      DO(pkcs_1_pss_decode(buf[0], l3, buf[1], l1, saltlen, hash_idx, modlen, &res2));
70
68
 
71
69
      buf[0][i1] ^= 1;
72
 
      buf[1][i2 = abs(rand()) % l1] ^= 1;
73
 
      DO(pkcs_1_pss_decode(buf[0], l3, buf[1], l1, saltlen, hash_idx, modlen, &res3));
74
 
 
 
70
      buf[1][i2 = abs(rand()) % (l1 - 1)] ^= 1;
 
71
      pkcs_1_pss_decode(buf[0], l3, buf[1], l1, saltlen, hash_idx, modlen, &res3);
75
72
      if (!(res1 == 1 && res2 == 0 && res3 == 0)) {
76
73
         fprintf(stderr, "PSS failed: %d, %d, %d, %lu, %lu\n", res1, res2, res3, l3, saltlen);
77
74
         return 1;
92
89
 
93
90
 
94
91
/* $Source: /cvs/libtom/libtomcrypt/testprof/pkcs_1_test.c,v $ */
95
 
/* $Revision: 1.6 $ */
96
 
/* $Date: 2005/05/21 12:51:25 $ */
 
92
/* $Revision: 1.7 $ */
 
93
/* $Date: 2006/11/30 03:30:45 $ */