Skip to content

Commit

Permalink
I FUCKING HATE OPENSSL. IT'S A FUCKING PIECE OF CRAAAAAAAAAAAAAAAAAAA…
Browse files Browse the repository at this point in the history
…AAAAAAAAAAP. FUCK.
  • Loading branch information
acasajus committed Jan 20, 2015
1 parent 1349b76 commit be718fc
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 17 deletions.
17 changes: 6 additions & 11 deletions src/crypto/asn1.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,19 +573,14 @@ int crypto_ASN1_inner_dump(crypto_ASN1* self, BIO* bdata) {
BIO_write( bdata, source, buf - source );
break;
case V_ASN1_OBJECT:
aob = OBJ_txt2obj( PyString_AsString( self->data ), 0 );
if ( aob == NULL )
{
aob = OBJ_txt2obj( PyString_AsString( self->data ), 1 );
}
if( aob == NULL ) {
exception_from_error_queue();
return 0;
}
if( i2d_ASN1_OBJECT( aob, &buf ) == 0 ) {
if( ( aob = OBJ_txt2obj( PyString_AsString( self->data ), 0 ) ) == NULL ) {
PyErr_SetString( PyExc_ValueError, "Unknown object id" );
return 0;
}
if( i2d_ASN1_OBJECT( aob, &buf ) == 0 ) {
exception_from_error_queue();
return 0;
}
}
BIO_write( bdata, source, buf - source );
break;
case V_ASN1_OCTET_STRING:
Expand Down
5 changes: 3 additions & 2 deletions src/crypto/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -880,11 +880,12 @@ static PyObject *
crypto_X509Extension( PyObject * spam, PyObject * args )
{
char *type_name, *value;
int val_length;

if ( !PyArg_ParseTuple( args, "ss:X509Extension", &type_name, &value ) )
if ( !PyArg_ParseTuple( args, "ss#:X509Extension", &type_name, &value, &val_length ) )
return NULL;

return ( PyObject * ) crypto_X509Extension_New( type_name, value );
return ( PyObject * ) crypto_X509Extension_New( type_name, value, val_length);
}

static char crypto_NetscapeSPKI_doc[] = "\n\
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ extern PyObject *crypto_Error;

#define crypto_X509Extension_New_NUM 5
#define crypto_X509Extension_New_RETURN crypto_X509ExtensionObj *
#define crypto_X509Extension_New_PROTO (char *, char *)
#define crypto_X509Extension_New_PROTO (char *, char *, int)

#define crypto_PKCS7_New_NUM 6
#define crypto_PKCS7_New_RETURN crypto_PKCS7Obj *
Expand Down
5 changes: 2 additions & 3 deletions src/crypto/x509ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ static PyMethodDef crypto_X509Extension_methods[] = {
* Returns: The newly created X509Extension object
*/
crypto_X509ExtensionObj *
crypto_X509Extension_New( char *type_name, char *value )
crypto_X509Extension_New( char *type_name, char *value, int val_length )
{
crypto_X509ExtensionObj *self;
int ext_nid;
Expand All @@ -274,8 +274,7 @@ crypto_X509Extension_New( char *type_name, char *value )
return NULL;
}

self =
PyObject_New( crypto_X509ExtensionObj, &crypto_X509Extension_Type );
self = PyObject_New( crypto_X509ExtensionObj, &crypto_X509Extension_Type );
if ( self == NULL )
{
X509_EXTENSION_free( extension );
Expand Down

0 comments on commit be718fc

Please sign in to comment.