summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--asn1.c99
-rw-r--r--asn1.h3
2 files changed, 0 insertions, 102 deletions
diff --git a/asn1.c b/asn1.c
index 06624f9..a3650a6 100644
--- a/asn1.c
+++ b/asn1.c
@@ -260,41 +260,6 @@ bool ber_write_OID_String(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, const char *OID)
return true;
}
-/**
- * Serialize partial OID string.
- * Partial OIDs are in the form:
- * 1:2.5.6:0x81
- * 1:2.5.6:0x8182
- */
-bool ber_write_partial_OID_String(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, const char *partial_oid)
-{
- TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
- char *oid = talloc_strdup(tmp_ctx, partial_oid);
- char *p;
-
- /* truncate partial part so ber_write_OID_String() works */
- p = strchr(oid, ':');
- if (p) {
- *p = '\0';
- p++;
- }
-
- if (!ber_write_OID_String(mem_ctx, blob, oid)) {
- talloc_free(tmp_ctx);
- return false;
- }
-
- /* Add partially endcoded subidentifier */
- if (p) {
- DATA_BLOB tmp_blob = strhex_to_data_blob(tmp_ctx, p);
- data_blob_append(mem_ctx, blob, tmp_blob.data, tmp_blob.length);
- }
-
- talloc_free(tmp_ctx);
-
- return true;
-}
-
/* write an object ID to a ASN1 buffer */
bool asn1_write_OID(struct asn1_data *data, const char *OID)
{
@@ -631,42 +596,6 @@ bool ber_read_OID_String(TALLOC_CTX *mem_ctx, DATA_BLOB blob, const char **OID)
return (bytes_eaten == blob.length);
}
-/**
- * Deserialize partial OID string.
- * Partial OIDs are in the form:
- * 1:2.5.6:0x81
- * 1:2.5.6:0x8182
- */
-bool ber_read_partial_OID_String(TALLOC_CTX *mem_ctx, DATA_BLOB blob, const char **partial_oid)
-{
- size_t bytes_left;
- size_t bytes_eaten;
- char *identifier = NULL;
- char *tmp_oid = NULL;
-
- if (!_ber_read_OID_String_impl(mem_ctx, blob, (const char **)&tmp_oid, &bytes_eaten))
- return false;
-
- if (bytes_eaten < blob.length) {
- bytes_left = blob.length - bytes_eaten;
- identifier = hex_encode_talloc(mem_ctx, &blob.data[bytes_eaten], bytes_left);
- if (!identifier) goto nomem;
-
- *partial_oid = talloc_asprintf_append_buffer(tmp_oid, ":0x%s", identifier);
- if (!*partial_oid) goto nomem;
- TALLOC_FREE(identifier);
- } else {
- *partial_oid = tmp_oid;
- }
-
- return true;
-
-nomem:
- TALLOC_FREE(identifier);
- TALLOC_FREE(tmp_oid);
- return false;
-}
-
/* read an object ID from a ASN1 buffer */
bool asn1_read_OID(struct asn1_data *data, TALLOC_CTX *mem_ctx, const char **OID)
{
@@ -918,31 +847,3 @@ void asn1_load_nocopy(struct asn1_data *data, uint8_t *buf, size_t len)
data->length = len;
}
-/*
- check if a ASN.1 blob is a full tag
-*/
-NTSTATUS asn1_full_tag(DATA_BLOB blob, uint8_t tag, size_t *packet_size)
-{
- struct asn1_data *asn1 = asn1_init(NULL);
- int size;
-
- NT_STATUS_HAVE_NO_MEMORY(asn1);
-
- asn1->data = blob.data;
- asn1->length = blob.length;
- asn1_start_tag(asn1, tag);
- if (asn1->has_error) {
- talloc_free(asn1);
- return STATUS_MORE_ENTRIES;
- }
- size = asn1_tag_remaining(asn1) + asn1->ofs;
-
- talloc_free(asn1);
-
- if (size > blob.length) {
- return STATUS_MORE_ENTRIES;
- }
-
- *packet_size = size;
- return NT_STATUS_OK;
-}
diff --git a/asn1.h b/asn1.h
index ded3244..615041f 100644
--- a/asn1.h
+++ b/asn1.h
@@ -62,7 +62,6 @@ bool asn1_write_implicit_Integer(struct asn1_data *data, int i);
bool asn1_write_Integer(struct asn1_data *data, int i);
bool asn1_write_BitString(struct asn1_data *data, const void *p, size_t length, uint8_t padding);
bool ber_write_OID_String(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, const char *OID);
-bool ber_write_partial_OID_String(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, const char *partial_oid);
bool asn1_write_OID(struct asn1_data *data, const char *OID);
bool asn1_write_OctetString(struct asn1_data *data, const void *p, size_t length);
bool asn1_write_LDAPString(struct asn1_data *data, const char *s);
@@ -84,7 +83,6 @@ bool asn1_start_tag(struct asn1_data *data, uint8_t tag);
bool asn1_end_tag(struct asn1_data *data);
int asn1_tag_remaining(struct asn1_data *data);
bool ber_read_OID_String(TALLOC_CTX *mem_ctx, DATA_BLOB blob, const char **OID);
-bool ber_read_partial_OID_String(TALLOC_CTX *mem_ctx, DATA_BLOB blob, const char **partial_oid);
bool asn1_read_OID(struct asn1_data *data, TALLOC_CTX *mem_ctx, const char **OID);
bool asn1_check_OID(struct asn1_data *data, const char *OID);
bool asn1_read_LDAPString(struct asn1_data *data, TALLOC_CTX *mem_ctx, char **s);
@@ -99,6 +97,5 @@ 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);
void asn1_load_nocopy(struct asn1_data *data, uint8_t *buf, size_t len);
-NTSTATUS asn1_full_tag(DATA_BLOB blob, uint8_t tag, size_t *packet_size);
#endif /* _ASN_1_H */