hc
2024-08-14 d5ef2fdafdb09de9c2f876fc0edf2ba6bf224909
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From 9a990e8c4eb92dd64e0ec483599820e45c35ac23 Mon Sep 17 00:00:00 2001
From: Jouni Malinen <j@w1.fi>
Date: Sat, 13 Mar 2021 23:14:23 +0200
Subject: [PATCH] ASN.1: Add helper functions for recognizing tag values
 
Signed-off-by: Jouni Malinen <j@w1.fi>
[geomatsi@gmail.com: backport asn1_is_null() from upstream 9a990e8c4eb9]
Signed-off-by: Sergey Matyukevich <geomatsi@gmail.com>
[yann.morin.1998@free.fr: 
  - reformat, keep the upstream sha1 and title,
  - drop numbering
]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
---
 src/tls/asn1.h | 102 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 102 insertions(+)
 
diff --git a/src/tls/asn1.h b/src/tls/asn1.h
index de3430adb..a4d1be473 100644
--- a/src/tls/asn1.h
+++ b/src/tls/asn1.h
@@ -66,6 +66,12 @@ struct wpabuf * asn1_build_alg_id(const struct asn1_oid *oid,
 unsigned long asn1_bit_string_to_long(const u8 *buf, size_t len);
 int asn1_oid_equal(const struct asn1_oid *a, const struct asn1_oid *b);
 
+static inline bool asn1_is_null(const struct asn1_hdr *hdr)
+{
+    return hdr->class == ASN1_CLASS_UNIVERSAL &&
+        hdr->tag == ASN1_TAG_NULL;
+}
+
 extern struct asn1_oid asn1_sha1_oid;
 extern struct asn1_oid asn1_sha256_oid;
 
-- 
2.25.1