~ubuntu-branches/ubuntu/intrepid/ruby1.9/intrepid-updates

« back to all changes in this revision

Viewing changes to ext/openssl/ossl_rand.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-09-04 16:01:17 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20070904160117-i15zckg2nhxe9fyw
Tags: 1.9.0+20070830-2ubuntu1
* Sync from Debian; remaining changes:
  - Add -g to CFLAGS.
* Fixes build failure on ia64.
* Fixes build failure with gcc-4.2 on lpia.
* Robustify check for target_os, fixing build failure on lpia.
* Set Ubuntu maintainer address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * $Id: ossl_rand.c 12128 2007-03-29 17:29:03Z technorama $
 
2
 * $Id: ossl_rand.c 12571 2007-06-18 08:56:21Z technorama $
3
3
 * 'OpenSSL for Ruby' project
4
4
 * Copyright (C) 2001-2002  Michal Rokos <m.rokos@sh.cvut.cz>
5
5
 * All rights reserved.
135
135
    return Qtrue;
136
136
}
137
137
 
 
138
/*
 
139
 *  call-seq:
 
140
 *     status? => true | false
 
141
 *
 
142
 * Return true if the PRNG has been seeded with enough data, false otherwise.
 
143
 */
 
144
static VALUE
 
145
ossl_rand_status(VALUE self)
 
146
{
 
147
    return RAND_status() ? Qtrue : Qfalse;
 
148
}
 
149
 
138
150
#define DEFMETH(class, name, func, argc) \
139
151
        rb_define_method(class, name, func, argc); \
140
152
        rb_define_singleton_method(class, name, func, argc);
160
172
    DEFMETH(mRandom, "pseudo_bytes", ossl_rand_pseudo_bytes, 1);
161
173
    DEFMETH(mRandom, "egd", ossl_rand_egd, 1);
162
174
    DEFMETH(mRandom, "egd_bytes", ossl_rand_egd_bytes, 2);      
 
175
    DEFMETH(mRandom, "status?", ossl_rand_status, 0)
163
176
}
164
177