~peter-pearse/ubuntu/natty/libgcrypt11/prop001

« back to all changes in this revision

Viewing changes to random/rndhw.c

  • Committer: Bazaar Package Importer
  • Author(s): Bhavani Shankar
  • Date: 2010-07-20 20:31:59 UTC
  • mfrom: (1.1.7 upstream) (2.2.6 sid)
  • Revision ID: james.westby@ubuntu.com-20100720203159-aap54ep50zk64eha
Tags: 1.4.5-2ubuntu1
* Merge from Debian unstable (LP: #607861). Remaining changes:
  - Add libgcrypt11-udeb for use by cryptsetup-udeb.
  - Install to /lib.
  - Disable tests when cross-building.
  - Adjust install/libgcrypt11-dev target to cope with move to /lib.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
poll_padlock (void (*add)(const void*, size_t, enum random_origins),
42
42
              enum random_origins origin, int fast)
43
43
{
44
 
  char buffer[64+8] __attribute__ ((aligned (8)));
45
 
  char *p;
 
44
  volatile char buffer[64+8] __attribute__ ((aligned (8)));
 
45
  volatile char *p;
46
46
  unsigned int nbytes, status;
47
47
  
48
48
  /* Peter Gutmann's cryptlib tests again whether the RNG is enabled
59
59
        ("movl %1, %%edi\n\t"         /* Set buffer.  */
60
60
         "xorl %%edx, %%edx\n\t"      /* Request up to 8 bytes.  */
61
61
         ".byte 0x0f, 0xa7, 0xc0\n\t" /* XSTORE RNG. */
62
 
         "movl %%eax, %0\n"           /* Return the status.  */
63
 
         : "=g" (status)
 
62
         : "=a" (status)
64
63
         : "g" (p)
65
64
         : "%edx", "%edi", "cc"
66
65
         );
88
87
 
89
88
  if (nbytes)
90
89
    {
91
 
      (*add) (buffer, nbytes, origin);
 
90
      (*add) ((void*)buffer, nbytes, origin);
92
91
      wipememory (buffer, nbytes);
93
92
    }
94
93
  return nbytes;