@@ -124,30 +124,6 @@ impl<'a> DerEncodable for Integer<'a> {
124124
125125/// Implements `DerCodable`
126126macro_rules! impl_dercodable {
127- ( signed: $num: ty) => {
128- impl <' a> DerDecodable <' a> for $num {
129- #[ cfg_attr( feature = "no_panic" , no_panic:: no_panic) ]
130- fn load( object: DerObject <' a>) -> Result <Self , Asn1DerError > {
131- // Load integer
132- let integer = Integer :: load( object) . propagate( e!( "Failed to load integer" ) ) ?;
133- let buf = integer. copy_numbytes( [ 0 ; mem:: size_of:: <Self >( ) ] )
134- . propagate( e!( "The numeric value is too large" ) ) ?;
135-
136- // Validate the integer
137- match Self :: from_be_bytes( buf) {
138- num if num. is_negative( ) && !integer. is_negative( ) =>
139- Err ( eunsupported!( "The numeric value is too large" ) ) ,
140- num => Ok ( num)
141- }
142- }
143- }
144- impl DerEncodable for $num {
145- #[ cfg_attr( feature = "no_panic" , no_panic:: no_panic) ]
146- fn encode<S : Sink >( & self , sink: & mut S ) -> Result <( ) , Asn1DerError > {
147- Integer :: write( & self . to_be_bytes( ) , self . is_negative( ) , sink)
148- }
149- }
150- } ;
151127 ( unsigned: $num: ty) => {
152128 impl <' a> DerDecodable <' a> for $num {
153129 #[ cfg_attr( feature = "no_panic" , no_panic:: no_panic) ]
@@ -172,8 +148,6 @@ macro_rules! impl_dercodable {
172148 }
173149 }
174150 } ;
175- ( signed: $( $num: ty) ,+) => ( $( impl_dercodable!( signed: $num) ; ) +) ;
176151 ( unsigned: $( $num: ty) ,+) => ( $( impl_dercodable!( unsigned: $num) ; ) +) ;
177152}
178- impl_dercodable ! ( unsigned: u8 , u16 , u32 , u64 , u128 , usize ) ;
179- impl_dercodable ! ( signed: i8 , i16 , i32 , i64 , i128 , isize ) ;
153+ impl_dercodable ! ( unsigned: u8 , u16 , u32 , u64 , u128 , usize ) ;
0 commit comments