File tree Expand file tree Collapse file tree 1 file changed +2
-11
lines changed Expand file tree Collapse file tree 1 file changed +2
-11
lines changed Original file line number Diff line number Diff line change @@ -45,10 +45,6 @@ impl Length {
45
45
#[ cfg( feature = "ber" ) ]
46
46
pub ( crate ) const EOC_LEN : Self = Self :: new ( 2 ) ;
47
47
48
- /// Maximum number of octets in a DER encoding of a [`Length`] using the
49
- /// rules implemented by this crate.
50
- pub ( crate ) const MAX_SIZE : usize = 5 ;
51
-
52
48
/// Create a new [`Length`] for any value which fits inside of a [`u16`].
53
49
///
54
50
/// This function is const-safe and therefore useful for [`Length`] constants.
@@ -336,13 +332,8 @@ impl Encode for Length {
336
332
337
333
impl DerOrd for Length {
338
334
fn der_cmp ( & self , other : & Self ) -> Result < Ordering > {
339
- let mut buf1 = [ 0u8 ; Self :: MAX_SIZE ] ;
340
- let mut buf2 = [ 0u8 ; Self :: MAX_SIZE ] ;
341
-
342
- let buf1 = self . encode_to_slice ( & mut buf1) ?;
343
- let buf2 = other. encode_to_slice ( & mut buf2) ?;
344
-
345
- Ok ( buf1. cmp ( buf2) )
335
+ // The DER encoding has the same ordering as the integer value
336
+ Ok ( self . inner . cmp ( & other. inner ) )
346
337
}
347
338
}
348
339
You can’t perform that action at this time.
0 commit comments