~ubuntu-branches/ubuntu/quantal/m2crypto/quantal

« back to all changes in this revision

Viewing changes to SWIG/_pkcs7.i

  • Committer: Bazaar Package Importer
  • Author(s): Dima Barsky
  • Date: 2007-05-24 21:14:36 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20070524211436-73w3oonappxy8k4a
Tags: 0.17-1
* New upstream release
* Acknowledge NMU (Closes: #380861)
* Changed section to python (Closes: #425875)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Copyright (c) 2000 Ng Pheng Siong. All rights reserved. */
2
 
/* $Id: _pkcs7.i 419 2006-04-24 21:57:42Z heikki $ */
 
2
/* $Id: _pkcs7.i 469 2006-09-06 18:38:56Z heikki $ */
3
3
 
4
4
%{
5
5
#include <openssl/bio.h>
21
21
extern void PKCS7_free(PKCS7 *);
22
22
 
23
23
/* S/MIME operation */
24
 
%constant int PKCS7_TEXT        = 0x1;
25
 
%constant int PKCS7_NOCERTS     = 0x2;
26
 
%constant int PKCS7_NOSIGS      = 0x4;
27
 
%constant int PKCS7_NOCHAIN     = 0x8;
28
 
%constant int PKCS7_NOINTERN    = 0x10;
29
 
%constant int PKCS7_NOVERIFY    = 0x20;
30
 
%constant int PKCS7_DETACHED    = 0x40;
31
 
%constant int PKCS7_BINARY      = 0x80;
32
 
%constant int PKCS7_NOATTR      = 0x100;
 
24
%constant int PKCS7_TEXT       = 0x1;
 
25
%constant int PKCS7_NOCERTS    = 0x2;
 
26
%constant int PKCS7_NOSIGS     = 0x4;
 
27
%constant int PKCS7_NOCHAIN    = 0x8;
 
28
%constant int PKCS7_NOINTERN   = 0x10;
 
29
%constant int PKCS7_NOVERIFY   = 0x20;
 
30
%constant int PKCS7_DETACHED   = 0x40;
 
31
%constant int PKCS7_BINARY     = 0x80;
 
32
%constant int PKCS7_NOATTR     = 0x100;
33
33
 
34
 
%constant int PKCS7_SIGNED              = NID_pkcs7_signed;
35
 
%constant int PKCS7_ENVELOPED           = NID_pkcs7_enveloped;
36
 
%constant int PKCS7_SIGNED_ENVELOPED    = NID_pkcs7_signedAndEnveloped;
37
 
%constant int PKCS7_DATA                = NID_pkcs7_data;
 
34
%constant int PKCS7_SIGNED            = NID_pkcs7_signed;
 
35
%constant int PKCS7_ENVELOPED         = NID_pkcs7_enveloped;
 
36
%constant int PKCS7_SIGNED_ENVELOPED  = NID_pkcs7_signedAndEnveloped;
 
37
%constant int PKCS7_DATA              = NID_pkcs7_data;
38
38
 
39
39
%inline %{
40
40
static PyObject *_pkcs7_err, *_smime_err;
135
135
    PKCS7 *p7;
136
136
    PyObject *tuple, *_p7, *_BIO;
137
137
 
 
138
    if (BIO_method_type(bio) == BIO_TYPE_MEM) {
 
139
        /* OpenSSL FAQ explains that this is needed for mem BIO to return EOF,
 
140
         * like file BIO does. Might need to do this for more mem BIOs but
 
141
         * not sure if that is safe, so starting with just this single place.
 
142
         */
 
143
        BIO_set_mem_eof_return(bio, 0);
 
144
    }
 
145
 
138
146
    if (!(p7=SMIME_read_PKCS7(bio, &bcont))) {
139
147
        PyErr_SetString(_smime_err, ERR_reason_error_string(ERR_get_error()));
140
148
        return NULL;