mirror of
https://github.com/samba-team/samba.git
synced 2025-01-22 22:04:08 +03:00
asn1: Add asn1_extract_blob()
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
8cfb6a3139
commit
7b7aa016df
@ -1018,6 +1018,26 @@ bool asn1_blob(const struct asn1_data *asn1, DATA_BLOB *blob)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool asn1_extract_blob(struct asn1_data *asn1, TALLOC_CTX *mem_ctx,
|
||||
DATA_BLOB *pblob)
|
||||
{
|
||||
DATA_BLOB blob;
|
||||
|
||||
if (!asn1_blob(asn1, &blob)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
*pblob = (DATA_BLOB) { .length = blob.length };
|
||||
pblob->data = talloc_move(mem_ctx, &blob.data);
|
||||
|
||||
/*
|
||||
* Stop access from here on
|
||||
*/
|
||||
asn1->has_error = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
Fill in an asn1 struct without making a copy
|
||||
*/
|
||||
|
@ -97,6 +97,8 @@ bool asn1_read_enumerated(struct asn1_data *data, int *v);
|
||||
bool asn1_check_enumerated(struct asn1_data *data, int v);
|
||||
bool asn1_write_enumerated(struct asn1_data *data, uint8_t v);
|
||||
bool asn1_blob(const struct asn1_data *asn1, DATA_BLOB *blob);
|
||||
bool asn1_extract_blob(struct asn1_data *asn1, TALLOC_CTX *mem_ctx,
|
||||
DATA_BLOB *pblob);
|
||||
void asn1_load_nocopy(struct asn1_data *data, uint8_t *buf, size_t len);
|
||||
int asn1_peek_full_tag(DATA_BLOB blob, uint8_t tag, size_t *packet_size);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user