ASN.1 Write Octet String #0 (Empty string)
mbedtls_asn1_write_octet_string:"":"0400":2:2

ASN.1 Write Octet String #1 (Large buffer)
mbedtls_asn1_write_octet_string:"AABBCC":"0403AABBCC":10:5

ASN.1 Write Octet String #2 (Buffer just fits)
mbedtls_asn1_write_octet_string:"AABBCC":"0403AABBCC":5:5

ASN.1 Write Octet String #3 (Buffer too small for tag)
mbedtls_asn1_write_octet_string:"AABBCC":"0403AABBCC":4:MBEDTLS_ERR_ASN1_BUF_TOO_SMALL

ASN.1 Write Octet String #4 (Buffer too small for len)
mbedtls_asn1_write_octet_string:"AABBCC":"0403AABBCC":3:MBEDTLS_ERR_ASN1_BUF_TOO_SMALL

ASN.1 Write Octet String #5 (Buffer too small for string)
mbedtls_asn1_write_octet_string:"AABBCC":"0403AABBCC":2:MBEDTLS_ERR_ASN1_BUF_TOO_SMALL

ASN.1 Write Octet String #6 (l = 128, large buffer)
mbedtls_asn1_write_octet_string:"000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F":"048180000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F":140:131

ASN.1 Write Octet String #7 (l = 128, buffer just fits)
mbedtls_asn1_write_octet_string:"000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F":"048180000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F":131:131

ASN.1 Write Octet String #8 (l = 128, buffer too small for tag)
mbedtls_asn1_write_octet_string:"000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F":"":130:MBEDTLS_ERR_ASN1_BUF_TOO_SMALL

ASN.1 Write Octet String #9 (l = 128, buffer too small for len)
mbedtls_asn1_write_octet_string:"000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F":"":129:MBEDTLS_ERR_ASN1_BUF_TOO_SMALL

ASN.1 Write Octet String #9 (l = 128, buffer too small for string)
mbedtls_asn1_write_octet_string:"000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F":"":127:MBEDTLS_ERR_ASN1_BUF_TOO_SMALL

ASN.1 Write IA5 String #0 (Empty string)
mbedtls_asn1_write_ia5_string:"":"1600":2:2

ASN.1 Write IA5 String #1 (Large buffer)
mbedtls_asn1_write_ia5_string:"ABC":"1603414243":10:5

ASN.1 Write IA5 String #2 (Buffer just fits)
mbedtls_asn1_write_ia5_string:"ABC":"1603414243":5:5

ASN.1 Write IA5 String #3 (Buffer too small for tag)
mbedtls_asn1_write_ia5_string:"ABC":"":4:MBEDTLS_ERR_ASN1_BUF_TOO_SMALL

ASN.1 Write IA5 String #4 (Buffer too small for len)
mbedtls_asn1_write_ia5_string:"ABC":"":3:MBEDTLS_ERR_ASN1_BUF_TOO_SMALL

ASN.1 Write IA5 String #5 (Buffer too small for string)
mbedtls_asn1_write_ia5_string:"ABC":"":2:MBEDTLS_ERR_ASN1_BUF_TOO_SMALL

ASN.1 Write / Read Length #0 (Len = 0, short form)
mbedtls_asn1_write_len:0:"00":1:1

ASN.1 Write / Read Length #1 (Len = 127, short form)
mbedtls_asn1_write_len:127:"7F":1:1

ASN.1 Write / Read Length #2 (Len = 127, buffer too small)
mbedtls_asn1_write_len:127:"7F":0:MBEDTLS_ERR_ASN1_BUF_TOO_SMALL

ASN.1 Write / Read Length #3 (Len = 128, long form)
mbedtls_asn1_write_len:128:"8180":2:2

ASN.1 Write / Read Length #4 (Len = 255, long form)
mbedtls_asn1_write_len:255:"81FF":2:2

ASN.1 Write / Read Length #5 (Len = 255, buffer too small)
mbedtls_asn1_write_len:255:"81FF":1:MBEDTLS_ERR_ASN1_BUF_TOO_SMALL

ASN.1 Write / Read Length #6 (Len = 258, byte order)
mbedtls_asn1_write_len:258:"820102":3:3

ASN.1 Write / Read Length #7 (Len = 65535, long form)
mbedtls_asn1_write_len:65535:"82FFFF":3:3

ASN.1 Write / Read Length #8 (Len = 65535, buffer too small)
mbedtls_asn1_write_len:65535:"82FFFF":2:MBEDTLS_ERR_ASN1_BUF_TOO_SMALL

ASN.1 Write / Read Length #9 (Len = 66051, byte order)
mbedtls_asn1_write_len:66051:"83010203":4:4

ASN.1 Write / Read Length #10 (Len = 16777215, long form)
mbedtls_asn1_write_len:16777215:"83FFFFFF":4:4

ASN.1 Write / Read Length #11 (Len = 16777215, buffer too small)
mbedtls_asn1_write_len:16777215:"83FFFFFF":3:MBEDTLS_ERR_ASN1_BUF_TOO_SMALL

ASN.1 Write / Read Length #12 (Len = 16909060, byte order)
mbedtls_asn1_write_len:16909060:"8401020304":5:5

ASN.1 Write / Read Length #12 (Len = 16909060, buffer too small)
mbedtls_asn1_write_len:16909060:"8401020304":4:MBEDTLS_ERR_ASN1_BUF_TOO_SMALL

ASN.1 Write Named Bitstring / Unused bits #0
test_asn1_write_bitstrings:"FF":8:"030200FF":4:1

ASN.1 Write Named Bitstring / Unused bits #1
test_asn1_write_bitstrings:"FE":8:"030201FE":4:1

ASN.1 Write Named Bitstring / Unused bits #2
test_asn1_write_bitstrings:"FC":7:"030202FC":4:1

ASN.1 Write Named Bitstring / Unused bits #3
test_asn1_write_bitstrings:"F8":8:"030203F8":4:1

ASN.1 Write Named Bitstring / Unused bits #4
test_asn1_write_bitstrings:"F0":6:"030204F0":4:1

ASN.1 Write Named Bitstring / Unused bits #5
test_asn1_write_bitstrings:"E0":6:"030205E0":4:1

ASN.1 Write Named Bitstring / Unused bits #6
test_asn1_write_bitstrings:"C0":8:"030206C0":4:1

ASN.1 Write Named Bitstring / Unused bits #7
test_asn1_write_bitstrings:"80":8:"03020780":4:1

ASN.1 Write Named Bitstring / Empty bitstring
test_asn1_write_bitstrings:"00":7:"030100":3:1

ASN.1 Write Named Bitstring / Empty bitstring (bits = 16)
test_asn1_write_bitstrings:"0000":16:"030100":3:1

ASN.1 Write Named Bitstring / Empty bitstring (bits = 24)
test_asn1_write_bitstrings:"FFFFFF":0:"030100":3:1

ASN.1 Write Named Bitstring / 15 trailing bits all unset
test_asn1_write_bitstrings:"F88000":24:"030307F880":5:1

ASN.1 Write Named Bitstring / 15 trailing bits all set
test_asn1_write_bitstrings:"F8FFFF":9:"030307F880":5:1

ASN.1 Write Bitstring / Unused bits #0
test_asn1_write_bitstrings:"FF":8:"030200FF":4:0

ASN.1 Write Bitstring / Unused bits #1
test_asn1_write_bitstrings:"FF":7:"030201FE":4:0

ASN.1 Write Bitstring / Unused bits #2
test_asn1_write_bitstrings:"FF":6:"030202FC":4:0

ASN.1 Write Bitstring / Unused bits #3
test_asn1_write_bitstrings:"FF":5:"030203F8":4:0

ASN.1 Write Bitstring / Unused bits #4
test_asn1_write_bitstrings:"FF":4:"030204F0":4:0

ASN.1 Write Bitstring / Unused bits #5
test_asn1_write_bitstrings:"FF":3:"030205E0":4:0

ASN.1 Write Bitstring / Unused bits #6
test_asn1_write_bitstrings:"FF":2:"030206C0":4:0

ASN.1 Write Bitstring / Unused bits #7
test_asn1_write_bitstrings:"FF":1:"03020780":4:0

ASN.1 Write Bitstring / 1 trailing bit (bits 15)
test_asn1_write_bitstrings:"0003":15:"0303010002":5:0

ASN.1 Write Bitstring / 0 bits
test_asn1_write_bitstrings:"":0:"030100":3:0

ASN.1 Write Bitstring / long string all bits unset except trailing bits
test_asn1_write_bitstrings:"000000000007":45:"030703000000000000":9:0
