~stepankk/pyopenssl/bug-845445

« back to all changes in this revision

Viewing changes to OpenSSL/crypto/crl.c

  • Committer: Jean-Paul Calderone
  • Date: 2011-09-13 19:24:38 UTC
  • Revision ID: exarkun@divmod.com-20110913192438-1212q0lyyr1fdpwf
Correctly handle errors from X509_CRL_sign

Show diffs side-by-side

added added

removed removed

Lines of Context:
131
131
    ASN1_TIME *tmptm;
132
132
    crypto_X509Obj *x509;
133
133
    static char *kwlist[] = {"cert", "key", "type", "days", NULL};
134
 
    
 
134
 
135
135
    if (!PyArg_ParseTupleAndKeywords(args, keywds, "O!O!|ii:dump_crl", kwlist,
136
 
                                     &crypto_X509_Type, &x509, 
 
136
                                     &crypto_X509_Type, &x509,
137
137
                                     &crypto_PKey_Type, &key, &type, &days)) {
138
138
        return NULL;
139
139
    }
140
 
    
 
140
 
141
141
    bio = BIO_new(BIO_s_mem());
142
142
    tmptm = ASN1_TIME_new();
143
143
    if (!tmptm) {
149
149
    X509_CRL_set_nextUpdate(self->crl, tmptm);
150
150
    ASN1_TIME_free(tmptm);
151
151
    X509_CRL_set_issuer_name(self->crl, X509_get_subject_name(x509->x509));
152
 
    X509_CRL_sign(self->crl, key->pkey, EVP_md5());
 
152
 
 
153
    if (!X509_CRL_sign(self->crl, key->pkey, EVP_md5())) {
 
154
        exception_from_error_queue(crypto_Error);
 
155
        BIO_free(bio);
 
156
        return NULL;
 
157
    }
 
158
 
153
159
    switch (type) {
154
160
        case X509_FILETYPE_PEM:
155
161
            ret = PEM_write_bio_X509_CRL(bio, self->crl);