aboutsummaryrefslogtreecommitdiffstats
path: root/common/tlv.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2023-06-22 16:42:55 +0000
committerWerner Koch <[email protected]>2023-06-28 15:34:19 +0000
commitc926967d8558df114e14ba40595093d522d049a9 (patch)
treeae53d1612e226001b1d43295cc5045b0d6a0d4a3 /common/tlv.c
parentscd:piv: Fix authentication with Administration Key. (diff)
downloadgnupg-c926967d8558df114e14ba40595093d522d049a9.tar.gz
gnupg-c926967d8558df114e14ba40595093d522d049a9.zip
sm: Remove duplicated code.
* sm/minip12.c (struct tag_info): Change type of length and nhdr. (dump_tag_info): Adjust. (parse_tag): Re-implement using the parse_ber_header.
Diffstat (limited to 'common/tlv.c')
-rw-r--r--common/tlv.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/common/tlv.c b/common/tlv.c
index 4cc1dc7cf..4ba9ef20d 100644
--- a/common/tlv.c
+++ b/common/tlv.c
@@ -150,13 +150,16 @@ find_tlv_unchecked (const unsigned char *buffer, size_t length,
/* ASN.1 BER parser: Parse BUFFER of length SIZE and return the tag
- and the length part from the TLV triplet. Update BUFFER and SIZE
- on success. */
+ * and the length part from the TLV triplet. Update BUFFER and SIZE
+ * on success. Note that this function does not check that the value
+ * fits into the provided buffer; this allows to work on the TL part
+ * of a TLV. */
gpg_error_t
parse_ber_header (unsigned char const **buffer, size_t *size,
int *r_class, int *r_tag,
int *r_constructed, int *r_ndef,
- size_t *r_length, size_t *r_nhdr){
+ size_t *r_length, size_t *r_nhdr)
+{
int c;
unsigned long tag;
const unsigned char *buf = *buffer;