~zseil/pyopenssl/bwcompat-c-api

« back to all changes in this revision

Viewing changes to src/crypto/x509.c

  • Committer: Jean-Paul Calderone
  • Date: 2009-07-16 18:09:53 UTC
  • mfrom: (112.2.8 rand_bytes2)
  • Revision ID: exarkun@divmod.com-20090716180953-nltnz5hhdv8k1zdw
Add OpenSSL.rand.bytes function

Show diffs side-by-side

added added

removed removed

Lines of Context:
136
136
 
137
137
    if (bignum == NULL) {
138
138
        if (ASN1_INTEGER_set(X509_get_serialNumber(self->x509), small_serial)) {
139
 
            exception_from_error_queue();
 
139
            exception_from_error_queue(crypto_Error);
140
140
            goto err;
141
141
        }
142
142
    } else {
144
144
        BN_free(bignum);
145
145
        bignum = NULL;
146
146
        if (asn1_i == NULL) {
147
 
            exception_from_error_queue();
 
147
            exception_from_error_queue(crypto_Error);
148
148
            goto err;
149
149
        }
150
150
        if (!X509_set_serialNumber(self->x509, asn1_i)) {
151
 
            exception_from_error_queue();
 
151
            exception_from_error_queue(crypto_Error);
152
152
            goto err;
153
153
        }
154
154
        ASN1_INTEGER_free(asn1_i);
221
221
 
222
222
    if (!X509_set_issuer_name(self->x509, issuer->x509_name))
223
223
    {
224
 
        exception_from_error_queue();
 
224
        exception_from_error_queue(crypto_Error);
225
225
        return NULL;
226
226
    }
227
227
 
273
273
 
274
274
    if (!X509_set_subject_name(self->x509, subject->x509_name))
275
275
    {
276
 
        exception_from_error_queue();
 
276
        exception_from_error_queue(crypto_Error);
277
277
        return NULL;
278
278
    }
279
279
 
299
299
 
300
300
    if ((pkey = X509_get_pubkey(self->x509)) == NULL)
301
301
    {
302
 
        exception_from_error_queue();
 
302
        exception_from_error_queue(crypto_Error);
303
303
        return NULL;
304
304
    }
305
305
 
327
327
 
328
328
    if (!X509_set_pubkey(self->x509, pkey->pkey))
329
329
    {
330
 
        exception_from_error_queue();
 
330
        exception_from_error_queue(crypto_Error);
331
331
        return NULL;
332
332
    }
333
333
 
422
422
        } else {
423
423
                ASN1_TIME_to_generalizedtime(timestamp, &gt_timestamp);
424
424
                if (gt_timestamp == NULL) {
425
 
                        exception_from_error_queue();
 
425
                        exception_from_error_queue(crypto_Error);
426
426
                        return NULL;
427
427
                } else {
428
428
                        py_timestamp = PyString_FromString((char *)gt_timestamp->data);
558
558
 
559
559
    if (!X509_sign(self->x509, pkey->pkey, digest))
560
560
    {
561
 
        exception_from_error_queue();
 
561
        exception_from_error_queue(crypto_Error);
562
562
        return NULL;
563
563
    }
564
564
 
629
629
 
630
630
    if (!X509_digest(self->x509,digest,fp,&len))
631
631
    {
632
 
        exception_from_error_queue();
 
632
        exception_from_error_queue(crypto_Error);
633
633
    }
634
634
    tmp = malloc(3*len+1);
635
635
    memset(tmp, 0, 3*len+1);
679
679
        if (!X509_add_ext(self->x509, ext->x509_extension, -1))
680
680
        {
681
681
            Py_DECREF(seq);
682
 
            exception_from_error_queue();
 
682
            exception_from_error_queue(crypto_Error);
683
683
            return NULL;
684
684
        }
685
685
    }