|
@@ -9,7 +9,9 @@
|
9
|
9
|
|
10
|
10
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
11
|
11
|
|
|
12
|
+#include <stddef.h>
|
12
|
13
|
#include <stdint.h>
|
|
14
|
+#include <assert.h>
|
13
|
15
|
#include <time.h>
|
14
|
16
|
#include <ipxe/tables.h>
|
15
|
17
|
|
|
@@ -337,6 +339,28 @@ asn1_type ( const struct asn1_cursor *cursor ) {
|
337
|
339
|
return ( ( cursor->len >= sizeof ( *type ) ) ? *type : ASN1_END );
|
338
|
340
|
}
|
339
|
341
|
|
|
342
|
+/**
|
|
343
|
+ * Get cursor for built object
|
|
344
|
+ *
|
|
345
|
+ * @v builder ASN.1 object builder
|
|
346
|
+ * @ret cursor ASN.1 object cursor
|
|
347
|
+ */
|
|
348
|
+static inline __attribute__ (( always_inline )) struct asn1_cursor *
|
|
349
|
+asn1_built ( struct asn1_builder *builder ) {
|
|
350
|
+ union {
|
|
351
|
+ struct asn1_builder builder;
|
|
352
|
+ struct asn1_cursor cursor;
|
|
353
|
+ } *u = container_of ( builder, typeof ( *u ), builder );
|
|
354
|
+
|
|
355
|
+ /* Sanity check */
|
|
356
|
+ linker_assert ( ( ( const void * ) &u->builder.data ) ==
|
|
357
|
+ &u->cursor.data, asn1_builder_cursor_data_mismatch );
|
|
358
|
+ linker_assert ( &u->builder.len == &u->cursor.len,
|
|
359
|
+ asn1_builder_cursor_len_mismatch );
|
|
360
|
+
|
|
361
|
+ return &u->cursor;
|
|
362
|
+}
|
|
363
|
+
|
340
|
364
|
extern int asn1_start ( struct asn1_cursor *cursor, unsigned int type,
|
341
|
365
|
size_t extra );
|
342
|
366
|
extern int asn1_enter ( struct asn1_cursor *cursor, unsigned int type );
|