[crypto] Remove userptr_t from ASN.1 parsers

Simplify the ASN.1 code by assuming that all objects are fully
accessible via pointer dereferences.  This allows the concept of
"additional data beyond the end of the cursor" to be removed, and
simplifies parsing of all ASN.1 image formats.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2025-04-21 22:40:59 +01:00
parent 04d0b2fdf9
commit 3f8937d2f3
10 changed files with 70 additions and 109 deletions

View File

@@ -481,8 +481,6 @@ asn1_built ( struct asn1_builder *builder ) {
return &u->cursor;
}
extern int asn1_enter_partial ( struct asn1_cursor *cursor, unsigned int type,
size_t *extra );
extern int asn1_enter ( struct asn1_cursor *cursor, unsigned int type );
extern int asn1_skip_if_exists ( struct asn1_cursor *cursor,
unsigned int type );

View File

@@ -13,7 +13,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <ipxe/asn1.h>
#include <ipxe/image.h>
extern int der_asn1 ( userptr_t data, size_t len, size_t offset,
extern int der_asn1 ( const void *data, size_t len, size_t offset,
struct asn1_cursor **cursor );
extern struct image_type der_image_type __image_type ( PROBE_NORMAL );

View File

@@ -10,11 +10,10 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdint.h>
#include <ipxe/uaccess.h>
#include <ipxe/asn1.h>
#include <ipxe/image.h>
extern int efisig_asn1 ( userptr_t data, size_t len, size_t offset,
extern int efisig_asn1 ( const void *data, size_t len, size_t offset,
struct asn1_cursor **cursor );
extern struct image_type efisig_image_type __image_type ( PROBE_NORMAL );

View File

@@ -10,7 +10,6 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdint.h>
#include <ipxe/uaccess.h>
#include <ipxe/asn1.h>
#include <ipxe/image.h>
@@ -20,7 +19,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
/** Post-encapsulation boundary marker */
#define PEM_END "-----END"
extern int pem_asn1 ( userptr_t data, size_t len, size_t offset,
extern int pem_asn1 ( const void *data, size_t len, size_t offset,
struct asn1_cursor **cursor );
extern struct image_type pem_image_type __image_type ( PROBE_NORMAL );