iPXE
|
PEM-encoded ASN.1 data. More...
#include <stdlib.h>
#include <errno.h>
#include <assert.h>
#include <ipxe/asn1.h>
#include <ipxe/base64.h>
#include <ipxe/uaccess.h>
#include <ipxe/image.h>
#include <ipxe/pem.h>
Go to the source code of this file.
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static size_t | pem_next (userptr_t data, size_t len, size_t offset) |
Locate next line. More... | |
static int | pem_marker (userptr_t data, size_t len, size_t offset, const char *marker) |
Locate boundary marker line. More... | |
int | pem_asn1 (userptr_t data, size_t len, size_t offset, struct asn1_cursor **cursor) |
Extract ASN.1 object from PEM data. More... | |
static int | pem_image_probe (struct image *image) |
Probe PEM image. More... | |
static int | pem_image_asn1 (struct image *image, size_t offset, struct asn1_cursor **cursor) |
Extract ASN.1 object from image. More... | |
struct image_type pem_image_type | __image_type (PROBE_NORMAL) |
PEM image type. More... | |
PEM-encoded ASN.1 data.
Definition in file pem.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
Locate next line.
data | PEM data |
len | Length of PEM data |
offset | Starting offset |
next | Offset to next line |
Definition at line 49 of file pem.c.
References data, len, memchr_user(), and offset.
Referenced by pem_asn1(), and pem_marker().
Locate boundary marker line.
data | PEM data |
len | Length of PEM data |
offset | Starting offset |
marker | Boundary marker |
offset | Offset to boundary marker line, or negative error |
Definition at line 68 of file pem.c.
References assert(), copy_from_user(), data, ENOENT, len, marker, memcmp(), offset, pem_next(), and strlen().
Referenced by pem_asn1(), and pem_image_probe().
int pem_asn1 | ( | userptr_t | data, |
size_t | len, | ||
size_t | offset, | ||
struct asn1_cursor ** | cursor | ||
) |
Extract ASN.1 object from PEM data.
data | PEM data |
len | Length of PEM data |
offset | Offset within data |
cursor | ASN.1 cursor to fill in |
next | Offset to next object, or negative error |
The caller is responsible for eventually calling free() on the allocated ASN.1 cursor.
Definition at line 105 of file pem.c.
References assert(), base64_decode(), base64_decoded_max_len(), copy_from_user(), data, DBGC, end, ENOMEM, free, len, malloc(), NULL, offset, PEM_BEGIN, PEM_END, pem_marker(), pem_next(), rc, and strerror().
Referenced by ipair_rx_pubkey(), and pem_image_asn1().
|
static |
Probe PEM image.
image | PEM image |
rc | Return status code |
Definition at line 193 of file pem.c.
References image::data, DBGC, image::len, image::name, offset, PEM_BEGIN, pem_marker(), rc, and strerror().
|
static |
Extract ASN.1 object from image.
image | PEM image |
offset | Offset within image |
cursor | ASN.1 cursor to fill in |
next | Offset to next image, or negative error |
The caller is responsible for eventually calling free() on the allocated ASN.1 cursor.
Definition at line 220 of file pem.c.
References image::data, DBGC, image::len, image::name, next, offset, pem_asn1(), rc, and strerror().
struct image_type pem_image_type __image_type | ( | PROBE_NORMAL | ) |
PEM image type.