Skip to content
Snippets Groups Projects
Commit ea7e02e5 authored by Martin Nilsson's avatar Martin Nilsson
Browse files

throw -> error

Rev: lib/modules/Standards.pmod/ASN1.pmod/Encode.pmod:1.7
Rev: lib/modules/Standards.pmod/ASN1.pmod/Types.pmod:1.18
Rev: lib/modules/Standards.pmod/PKCS.pmod/Certificate.pmod:1.9
parent 7cb3e6f7
No related branches found
No related tags found
No related merge requests found
...@@ -59,8 +59,7 @@ class asn1_object ...@@ -59,8 +59,7 @@ class asn1_object
return sprintf("%c", len); return sprintf("%c", len);
string s = Gmp.mpz(len)->digits(256); string s = Gmp.mpz(len)->digits(256);
if (strlen(s) >= 0x80) if (strlen(s) >= 0x80)
throw( ({ "asn1.encode.asn1_object->encode_length: Max length exceeded.\n", error( "asn1.encode.asn1_object->encode_length: Max length exceeded.\n" );
backtrace() }) );
return sprintf("%c%s", strlen(s) | 0x80, s); return sprintf("%c%s", strlen(s) | 0x80, s);
} }
...@@ -85,8 +84,7 @@ class asn1_compound ...@@ -85,8 +84,7 @@ class asn1_compound
elements = args; elements = args;
foreach(elements, mixed o) foreach(elements, mixed o)
if (!o || !objectp(o)) if (!o || !objectp(o))
throw( ({ "asn1_compound: Non-object argument!\n", error( "asn1_compound: Non-object argument!\n" );
backtrace() }) );
WERROR(sprintf("asn1_compound: %O\n", elements)); WERROR(sprintf("asn1_compound: %O\n", elements));
} }
} }
...@@ -183,8 +181,7 @@ class asn1_identifier ...@@ -183,8 +181,7 @@ class asn1_identifier
if ( (sizeof(args) < 2) if ( (sizeof(args) < 2)
|| (args[0] > 2) || (args[0] > 2)
|| (args[1] >= ( (args[0] < 2) ? 40 : 176) )) || (args[1] >= ( (args[0] < 2) ? 40 : 176) ))
throw( ({ "asn1.encode.asn1_identifier->create: Invalid object identifier.\n", error( "asn1.encode.asn1_identifier->create: Invalid object identifier.\n" );
backtrace() }) );
id = args; id = args;
} }
......
/* /*
* $Id: Types.pmod,v 1.17 2000/11/20 01:28:23 mast Exp $ * $Id: Types.pmod,v 1.18 2002/03/17 18:23:58 nilsson Exp $
* *
* Encodes various asn.1 objects according to the Distinguished * Encodes various asn.1 objects according to the Distinguished
* Encoding Rules (DER) */ * Encoding Rules (DER) */
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
#define WERROR(x) #define WERROR(x)
#endif #endif
#define error(msg) throw( ({ msg, backtrace() }) )
/* Combines tag and class as a single integer, in a somewhat arbitrary /* Combines tag and class as a single integer, in a somewhat arbitrary
* way. This works also for tags beyond 31 (although not for tags * way. This works also for tags beyond 31 (although not for tags
...@@ -93,8 +91,7 @@ class asn1_object ...@@ -93,8 +91,7 @@ class asn1_object
return sprintf("%c", len); return sprintf("%c", len);
string s = Gmp.mpz(len)->digits(256); string s = Gmp.mpz(len)->digits(256);
if (strlen(s) >= 0x80) if (strlen(s) >= 0x80)
throw( ({ "asn1.encode.asn1_object->encode_length: Max length exceeded.\n", error( "asn1.encode.asn1_object->encode_length: Max length exceeded.\n" );
backtrace() }) );
return sprintf("%c%s", strlen(s) | 0x80, s); return sprintf("%c%s", strlen(s) | 0x80, s);
} }
...@@ -142,8 +139,7 @@ class asn1_compound ...@@ -142,8 +139,7 @@ class asn1_compound
elements = args; elements = args;
foreach(elements, mixed o) foreach(elements, mixed o)
if (!o || !objectp(o)) if (!o || !objectp(o))
throw( ({ "asn1_compound: Non-object argument!\n", error( "asn1_compound: Non-object argument!\n" );
backtrace() }) );
WERROR(sprintf("asn1_compound: %O\n", elements)); WERROR(sprintf("asn1_compound: %O\n", elements));
return this_object(); return this_object();
} }
...@@ -387,8 +383,7 @@ class asn1_identifier ...@@ -387,8 +383,7 @@ class asn1_identifier
if ( (sizeof(args) < 2) if ( (sizeof(args) < 2)
|| (args[0] > 2) || (args[0] > 2)
|| (args[1] >= ( (args[0] < 2) ? 40 : 176) )) || (args[1] >= ( (args[0] < 2) ? 40 : 176) ))
throw( ({ "asn1.encode.asn1_identifier->init: Invalid object identifier.\n", error( "asn1.encode.asn1_identifier->init: Invalid object identifier.\n" );
backtrace() }) );
id = args; id = args;
return this_object(); return this_object();
} }
...@@ -1006,14 +1001,12 @@ class asn1_universal_string ...@@ -1006,14 +1001,12 @@ class asn1_universal_string
string der_encode() string der_encode()
{ {
throw (({"asn1_universal_string: Encoding not implemented\n", error( "asn1_universal_string: Encoding not implemented\n" );
backtrace()}));
} }
object decode_primitive (string contents) object decode_primitive (string contents)
{ {
throw (({"asn1_universal_string: Decoding not implemented\n", error( "asn1_universal_string: Decoding not implemented\n" );
backtrace()}));
} }
} }
......
...@@ -144,9 +144,8 @@ class AttributeValueAssertion ...@@ -144,9 +144,8 @@ class AttributeValueAssertion
object value) object value)
{ {
if (!types[type]) if (!types[type])
throw( ({ sprintf("AttributeValueAssertion: " error( "AttributeValueAssertion: "
"Unknown attribute type '%s'\n", "Unknown attribute type '%s'\n", type );
type), backtrace() }) );
::create( ({ types[type], value }) ); ::create( ({ types[type], value }) );
} }
} }
...@@ -186,9 +185,7 @@ class Attribute ...@@ -186,9 +185,7 @@ class Attribute
array(object) v) array(object) v)
{ {
if (!types[type]) if (!types[type])
throw( ({ sprintf("Attribute: " error( "Attribute: Unknown attribute type '%s'\n", type);
"Unknown attribute type '%s'\n",
type), backtrace() }) );
::create( ({ types[type], asn1_set(v) }) ); ::create( ({ types[type], asn1_set(v) }) );
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment