~myers-1/pyopenssl/npn

« back to all changes in this revision

Viewing changes to OpenSSL/crypto/x509req.c

  • Committer: Jean-Paul Calderone
  • Date: 2010-09-14 22:07:08 UTC
  • mfrom: (132.1.54 shore-up-tests)
  • Revision ID: exarkun@divmod.com-20100914220708-qbu4htpfdfsff9cm
Merge shore-up-tests, adding lots of new unit test coverage and fixing a few bugs as well

Show diffs side-by-side

added added

removed removed

Lines of Context:
138
138
    Py_INCREF(Py_None);
139
139
    return Py_None;
140
140
}
141
 
 
 
141
 
142
142
static char crypto_X509Req_verify_doc[] = "\n\
143
143
Verifies a certificate request using the supplied public key\n\
144
144
\n\
145
145
@param key: a public key\n\
146
 
@return: True if the signature is correct, False otherwise.\n\
 
146
@return: True if the signature is correct.\n\
 
147
@raise OpenSSL.crypto.Error: If the signature is invalid or there is a\n\
 
148
    problem verifying the signature.\n\
147
149
";
148
150
 
149
151
PyObject *
153
155
    crypto_PKeyObj *key;
154
156
    int answer;
155
157
 
156
 
    if (!PyArg_ParseTuple(args, "O!:verify", &crypto_PKey_Type, &obj)) 
 
158
    if (!PyArg_ParseTuple(args, "O!:verify", &crypto_PKey_Type, &obj)) {
157
159
        return NULL;
 
160
    }
158
161
 
159
162
    key = (crypto_PKeyObj *)obj;
160
163
 
161
 
    if ((answer = X509_REQ_verify(self->x509_req, key->pkey)) < 0)
162
 
    {
 
164
    if ((answer = X509_REQ_verify(self->x509_req, key->pkey)) <= 0) {
163
165
        exception_from_error_queue(crypto_Error);
164
166
        return NULL;
165
167
    }
213
215
        }
214
216
        sk_X509_EXTENSION_push(exts, ext->x509_extension);
215
217
    }
216
 
    
 
218
 
217
219
    if (!X509_REQ_add_extensions(self->x509_req, exts))
218
220
    {
219
221
        sk_X509_EXTENSION_free(exts);
222
224
    }
223
225
 
224
226
    sk_X509_EXTENSION_free(exts);
225
 
    
 
227
 
226
228
    Py_INCREF(Py_None);
227
229
    return Py_None;
228
230
}