501 static PyObject *
502 crypto_load_pkcs7_data(PyObject *spam, PyObject *args)
503 {
504 int type, len;
505 char *buffer;
506 BIO *bio;
507 PKCS7 *pkcs7 = NULL;
508
509 if (!PyArg_ParseTuple(args, "is#:load_pkcs7_data", &type, &buffer, &len))
when PyArg_ParseTuple() succeeds
taking False path
510 return NULL;
511
512 /*
513 * Try to read the pkcs7 data from the bio
514 */
515 bio = BIO_new_mem_buf(buffer, len);
516 switch (type)
when following case 1
517 {
518 case X509_FILETYPE_PEM:
519 pkcs7 = PEM_read_bio_PKCS7(bio, NULL, NULL, NULL);
520 break;
521
522 case X509_FILETYPE_ASN1:
523 pkcs7 = d2i_PKCS7_bio(bio, NULL);
524 break;
525
526 default:
527 PyErr_SetString(PyExc_ValueError,
528 "type argument must be FILETYPE_PEM or FILETYPE_ASN1");
529 return NULL;
530 }
531 BIO_free(bio);
532
533 /*
534 * Check if we got a PKCS7 structure
535 */
536 if (pkcs7 == NULL)
when treating unknown struct PKCS7 * from OpenSSL/crypto/crypto.c:519 as NULL
taking True path
537 {
538 exception_from_error_queue(crypto_Error);
539 return NULL;
540 }
541
542 return (PyObject *)crypto_PKCS7_New(pkcs7, 1);
543 }
returning (PyObject*)NULL without setting an exception
found 1 similar trace(s) to this