summaryrefslogtreecommitdiff
path: root/crypto/der_writer.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2020-07-27 18:39:51 +0200
committerRichard Levitte <levitte@openssl.org>2020-07-30 23:23:15 +0200
commit6c6b20d59153cd29e38dfebee0b8a6f998402254 (patch)
tree3b8a0f3eeba0d20789c5540581a29e95a6bfbc23 /crypto/der_writer.c
parent86b5ab58aae0bddb93a58e9dcfac5ea3db022f6a (diff)
downloadopenssl-new-6c6b20d59153cd29e38dfebee0b8a6f998402254.tar.gz
DER writer: Make context-specific tags constructed (i.e. explicit)
For now, that's what we see being used. It's possible that we will have to figure out a way to specific if these should be implicit or explicit on a case by case basis. Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/12544)
Diffstat (limited to 'crypto/der_writer.c')
-rw-r--r--crypto/der_writer.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/crypto/der_writer.c b/crypto/der_writer.c
index 8762787504..117b5dff90 100644
--- a/crypto/der_writer.c
+++ b/crypto/der_writer.c
@@ -38,10 +38,14 @@ static int int_end_context(WPACKET *pkt, int tag)
return 1;
if (!ossl_assert(tag <= 30))
return 0;
+
+ /* Context specific are normally (?) constructed */
+ tag |= DER_F_CONSTRUCTED | DER_C_CONTEXT;
+
return WPACKET_get_total_written(pkt, &size1)
&& WPACKET_close(pkt)
&& WPACKET_get_total_written(pkt, &size2)
- && (size1 == size2 || WPACKET_put_bytes_u8(pkt, DER_C_CONTEXT | tag));
+ && (size1 == size2 || WPACKET_put_bytes_u8(pkt, tag));
}
int DER_w_precompiled(WPACKET *pkt, int tag,