~ubuntu-branches/ubuntu/natty/ruby1.8/natty-updates

« back to all changes in this revision

Viewing changes to ext/openssl/ossl_x509name.c

  • Committer: Package Import Robot
  • Author(s): Daigo Moriwaki
  • Date: 2010-06-27 22:16:44 UTC
  • mfrom: (22.1.12 sid)
  • Revision ID: package-import@ubuntu.com-20100627221644-7n8891uzqc17nvyq
Tags: 1.8.7.299-1
* New upstream release
* Removed patches that the upstrem has applied:
  - debian/patches/100312_timeout-fix.dpatch
  - debian/patches/100620_fix_pathname_warning.dpatch
  - debian/patches/100620_fix_super_called_outside_of_method.dpatch

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * $Id: ossl_x509name.c 12800 2007-07-15 13:24:51Z nobu $
 
2
 * $Id: ossl_x509name.c 28367 2010-06-21 09:18:59Z shyouhei $
3
3
 * 'OpenSSL for Ruby' project
4
4
 * Copyright (C) 2001 Michal Rokos <m.rokos@sh.cvut.cz>
5
5
 * All rights reserved.
137
137
        else{
138
138
            unsigned char *p;
139
139
            VALUE str = ossl_to_der_if_possible(arg);
 
140
            X509_NAME *x;
140
141
            StringValue(str);
141
 
            p = RSTRING_PTR(str);
142
 
            if(!d2i_X509_NAME((X509_NAME**)&DATA_PTR(self), &p, RSTRING_LEN(str))){
 
142
            p = (unsigned char *)RSTRING_PTR(str);
 
143
            x = d2i_X509_NAME(&name, &p, RSTRING_LEN(str));
 
144
            DATA_PTR(self) = name;
 
145
            if(!x){
143
146
                ossl_raise(eX509NameError, NULL);
144
147
            }
145
148
        }
303
306
    return ULONG2NUM(hash);
304
307
}
305
308
 
 
309
#ifdef HAVE_X509_NAME_HASH_OLD
 
310
/*
 
311
 * call-seq:
 
312
 *    name.hash_old => integer
 
313
 *
 
314
 * hash_old returns MD5 based hash used in OpenSSL 0.9.X.
 
315
 */
 
316
static VALUE
 
317
ossl_x509name_hash_old(VALUE self)
 
318
{
 
319
    X509_NAME *name;
 
320
    unsigned long hash;
 
321
 
 
322
    GetX509Name(self, name);
 
323
 
 
324
    hash = X509_NAME_hash_old(name);
 
325
 
 
326
    return ULONG2NUM(hash);
 
327
}
 
328
#endif
 
329
 
306
330
/*
307
331
 * call-seq:
308
332
 *    name.to_der => string
348
372
    rb_define_alias(cX509Name, "<=>", "cmp");
349
373
    rb_define_method(cX509Name, "eql?", ossl_x509name_eql, 1);
350
374
    rb_define_method(cX509Name, "hash", ossl_x509name_hash, 0);
 
375
#ifdef HAVE_X509_NAME_HASH_OLD
 
376
    rb_define_method(cX509Name, "hash_old", ossl_x509name_hash_old, 0);
 
377
#endif
351
378
    rb_define_method(cX509Name, "to_der", ossl_x509name_to_der, 0);
352
379
 
353
380
    utf8str = INT2NUM(V_ASN1_UTF8STRING);