|  | @@ -314,15 +314,27 @@ struct asn1_bit_string {
 | 
		
	
		
			
			| 314 | 314 |  	unsigned int unused;
 | 
		
	
		
			
			| 315 | 315 |  } __attribute__ (( packed ));
 | 
		
	
		
			
			| 316 | 316 |  
 | 
		
	
		
			
			|  | 317 | +/**
 | 
		
	
		
			
			|  | 318 | + * Invalidate ASN.1 object cursor
 | 
		
	
		
			
			|  | 319 | + *
 | 
		
	
		
			
			|  | 320 | + * @v cursor		ASN.1 object cursor
 | 
		
	
		
			
			|  | 321 | + */
 | 
		
	
		
			
			|  | 322 | +static inline __attribute__ (( always_inline )) void
 | 
		
	
		
			
			|  | 323 | +asn1_invalidate_cursor ( struct asn1_cursor *cursor ) {
 | 
		
	
		
			
			|  | 324 | +	cursor->len = 0;
 | 
		
	
		
			
			|  | 325 | +}
 | 
		
	
		
			
			|  | 326 | +
 | 
		
	
		
			
			| 317 | 327 |  /**
 | 
		
	
		
			
			| 318 | 328 |   * Extract ASN.1 type
 | 
		
	
		
			
			| 319 | 329 |   *
 | 
		
	
		
			
			| 320 | 330 |   * @v cursor		ASN.1 object cursor
 | 
		
	
		
			
			| 321 |  | - * @ret type		Type
 | 
		
	
		
			
			|  | 331 | + * @ret type		Type, or ASN1_END if cursor is invalid
 | 
		
	
		
			
			| 322 | 332 |   */
 | 
		
	
		
			
			| 323 | 333 |  static inline __attribute__ (( always_inline )) unsigned int
 | 
		
	
		
			
			| 324 | 334 |  asn1_type ( const struct asn1_cursor *cursor ) {
 | 
		
	
		
			
			| 325 |  | -	return ( *( ( const uint8_t * ) cursor->data ) );
 | 
		
	
		
			
			|  | 335 | +	const uint8_t *type = cursor->data;
 | 
		
	
		
			
			|  | 336 | +
 | 
		
	
		
			
			|  | 337 | +	return ( ( cursor->len >= sizeof ( *type ) ) ? *type : ASN1_END );
 | 
		
	
		
			
			| 326 | 338 |  }
 | 
		
	
		
			
			| 327 | 339 |  
 | 
		
	
		
			
			| 328 | 340 |  extern void asn1_invalidate_cursor ( struct asn1_cursor *cursor );
 |