Manuel Pégourié-Gonnard | 36178ff | 2014-05-29 14:26:03 +0200 | [diff] [blame] | 1 | ASN.1 Write Octet String #0 (Empty string) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 2 | mbedtls_asn1_write_octet_string:"":"0400":2:2 |
Manuel Pégourié-Gonnard | 36178ff | 2014-05-29 14:26:03 +0200 | [diff] [blame] | 3 | |
| 4 | ASN.1 Write Octet String #1 (Large buffer) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 5 | mbedtls_asn1_write_octet_string:"AABBCC":"0403AABBCC":10:5 |
Manuel Pégourié-Gonnard | 36178ff | 2014-05-29 14:26:03 +0200 | [diff] [blame] | 6 | |
| 7 | ASN.1 Write Octet String #2 (Buffer just fits) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 8 | mbedtls_asn1_write_octet_string:"AABBCC":"0403AABBCC":5:5 |
Manuel Pégourié-Gonnard | 36178ff | 2014-05-29 14:26:03 +0200 | [diff] [blame] | 9 | |
| 10 | ASN.1 Write Octet String #3 (Buffer too small for tag) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 11 | mbedtls_asn1_write_octet_string:"AABBCC":"0403AABBCC":4:MBEDTLS_ERR_ASN1_BUF_TOO_SMALL |
Manuel Pégourié-Gonnard | 36178ff | 2014-05-29 14:26:03 +0200 | [diff] [blame] | 12 | |
| 13 | ASN.1 Write Octet String #4 (Buffer too small for len) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 14 | mbedtls_asn1_write_octet_string:"AABBCC":"0403AABBCC":3:MBEDTLS_ERR_ASN1_BUF_TOO_SMALL |
Manuel Pégourié-Gonnard | 36178ff | 2014-05-29 14:26:03 +0200 | [diff] [blame] | 15 | |
| 16 | ASN.1 Write Octet String #5 (Buffer too small for string) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 17 | mbedtls_asn1_write_octet_string:"AABBCC":"0403AABBCC":2:MBEDTLS_ERR_ASN1_BUF_TOO_SMALL |
Manuel Pégourié-Gonnard | 36178ff | 2014-05-29 14:26:03 +0200 | [diff] [blame] | 18 | |
| 19 | ASN.1 Write Octet String #6 (l = 128, large buffer) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 20 | mbedtls_asn1_write_octet_string:"000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F":"048180000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F":140:131 |
Manuel Pégourié-Gonnard | 36178ff | 2014-05-29 14:26:03 +0200 | [diff] [blame] | 21 | |
| 22 | ASN.1 Write Octet String #7 (l = 128, buffer just fits) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 23 | mbedtls_asn1_write_octet_string:"000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F":"048180000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F":131:131 |
Manuel Pégourié-Gonnard | 36178ff | 2014-05-29 14:26:03 +0200 | [diff] [blame] | 24 | |
| 25 | ASN.1 Write Octet String #8 (l = 128, buffer too small for tag) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 26 | mbedtls_asn1_write_octet_string:"000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F":"":130:MBEDTLS_ERR_ASN1_BUF_TOO_SMALL |
Manuel Pégourié-Gonnard | 36178ff | 2014-05-29 14:26:03 +0200 | [diff] [blame] | 27 | |
| 28 | ASN.1 Write Octet String #9 (l = 128, buffer too small for len) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 29 | mbedtls_asn1_write_octet_string:"000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F":"":129:MBEDTLS_ERR_ASN1_BUF_TOO_SMALL |
Manuel Pégourié-Gonnard | 36178ff | 2014-05-29 14:26:03 +0200 | [diff] [blame] | 30 | |
| 31 | ASN.1 Write Octet String #9 (l = 128, buffer too small for string) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 32 | mbedtls_asn1_write_octet_string:"000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F":"":127:MBEDTLS_ERR_ASN1_BUF_TOO_SMALL |
Manuel Pégourié-Gonnard | c22bb49 | 2014-05-29 17:16:45 +0200 | [diff] [blame] | 33 | |
| 34 | ASN.1 Write IA5 String #0 (Empty string) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 35 | mbedtls_asn1_write_ia5_string:"":"1600":2:2 |
Manuel Pégourié-Gonnard | c22bb49 | 2014-05-29 17:16:45 +0200 | [diff] [blame] | 36 | |
| 37 | ASN.1 Write IA5 String #1 (Large buffer) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 38 | mbedtls_asn1_write_ia5_string:"ABC":"1603414243":10:5 |
Manuel Pégourié-Gonnard | c22bb49 | 2014-05-29 17:16:45 +0200 | [diff] [blame] | 39 | |
| 40 | ASN.1 Write IA5 String #2 (Buffer just fits) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 41 | mbedtls_asn1_write_ia5_string:"ABC":"1603414243":5:5 |
Manuel Pégourié-Gonnard | c22bb49 | 2014-05-29 17:16:45 +0200 | [diff] [blame] | 42 | |
| 43 | ASN.1 Write IA5 String #3 (Buffer too small for tag) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 44 | mbedtls_asn1_write_ia5_string:"ABC":"":4:MBEDTLS_ERR_ASN1_BUF_TOO_SMALL |
Manuel Pégourié-Gonnard | c22bb49 | 2014-05-29 17:16:45 +0200 | [diff] [blame] | 45 | |
| 46 | ASN.1 Write IA5 String #4 (Buffer too small for len) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 47 | mbedtls_asn1_write_ia5_string:"ABC":"":3:MBEDTLS_ERR_ASN1_BUF_TOO_SMALL |
Manuel Pégourié-Gonnard | c22bb49 | 2014-05-29 17:16:45 +0200 | [diff] [blame] | 48 | |
| 49 | ASN.1 Write IA5 String #5 (Buffer too small for string) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 50 | mbedtls_asn1_write_ia5_string:"ABC":"":2:MBEDTLS_ERR_ASN1_BUF_TOO_SMALL |
Paul Bakker | e325db9 | 2016-07-14 10:27:36 +0100 | [diff] [blame] | 51 | |
| 52 | ASN.1 Write / Read Length #0 (Len = 0, short form) |
Paul Bakker | 58bfb83 | 2016-07-14 11:02:31 +0100 | [diff] [blame] | 53 | mbedtls_asn1_write_len:0:"00":1:1 |
Paul Bakker | e325db9 | 2016-07-14 10:27:36 +0100 | [diff] [blame] | 54 | |
| 55 | ASN.1 Write / Read Length #1 (Len = 127, short form) |
Paul Bakker | 58bfb83 | 2016-07-14 11:02:31 +0100 | [diff] [blame] | 56 | mbedtls_asn1_write_len:127:"7F":1:1 |
Paul Bakker | e325db9 | 2016-07-14 10:27:36 +0100 | [diff] [blame] | 57 | |
Paul Bakker | 58bfb83 | 2016-07-14 11:02:31 +0100 | [diff] [blame] | 58 | ASN.1 Write / Read Length #2 (Len = 127, buffer too small) |
| 59 | mbedtls_asn1_write_len:127:"7F":0:MBEDTLS_ERR_ASN1_BUF_TOO_SMALL |
Paul Bakker | e325db9 | 2016-07-14 10:27:36 +0100 | [diff] [blame] | 60 | |
Paul Bakker | 58bfb83 | 2016-07-14 11:02:31 +0100 | [diff] [blame] | 61 | ASN.1 Write / Read Length #3 (Len = 128, long form) |
| 62 | mbedtls_asn1_write_len:128:"8180":2:2 |
Paul Bakker | e325db9 | 2016-07-14 10:27:36 +0100 | [diff] [blame] | 63 | |
Paul Bakker | 58bfb83 | 2016-07-14 11:02:31 +0100 | [diff] [blame] | 64 | ASN.1 Write / Read Length #4 (Len = 255, long form) |
| 65 | mbedtls_asn1_write_len:255:"81FF":2:2 |
Paul Bakker | e325db9 | 2016-07-14 10:27:36 +0100 | [diff] [blame] | 66 | |
Paul Bakker | 58bfb83 | 2016-07-14 11:02:31 +0100 | [diff] [blame] | 67 | ASN.1 Write / Read Length #5 (Len = 255, buffer too small) |
| 68 | mbedtls_asn1_write_len:255:"81FF":1:MBEDTLS_ERR_ASN1_BUF_TOO_SMALL |
Paul Bakker | e325db9 | 2016-07-14 10:27:36 +0100 | [diff] [blame] | 69 | |
Paul Bakker | c7d6bd4 | 2016-07-14 11:39:56 +0100 | [diff] [blame] | 70 | ASN.1 Write / Read Length #6 (Len = 258, byte order) |
| 71 | mbedtls_asn1_write_len:258:"820102":3:3 |
Paul Bakker | 58bfb83 | 2016-07-14 11:02:31 +0100 | [diff] [blame] | 72 | |
Paul Bakker | c7d6bd4 | 2016-07-14 11:39:56 +0100 | [diff] [blame] | 73 | ASN.1 Write / Read Length #7 (Len = 65535, long form) |
Paul Bakker | 58bfb83 | 2016-07-14 11:02:31 +0100 | [diff] [blame] | 74 | mbedtls_asn1_write_len:65535:"82FFFF":3:3 |
| 75 | |
| 76 | ASN.1 Write / Read Length #8 (Len = 65535, buffer too small) |
| 77 | mbedtls_asn1_write_len:65535:"82FFFF":2:MBEDTLS_ERR_ASN1_BUF_TOO_SMALL |
| 78 | |
Paul Bakker | c7d6bd4 | 2016-07-14 11:39:56 +0100 | [diff] [blame] | 79 | ASN.1 Write / Read Length #9 (Len = 66051, byte order) |
| 80 | mbedtls_asn1_write_len:66051:"83010203":4:4 |
| 81 | |
| 82 | ASN.1 Write / Read Length #10 (Len = 16777215, long form) |
| 83 | mbedtls_asn1_write_len:16777215:"83FFFFFF":4:4 |
| 84 | |
| 85 | ASN.1 Write / Read Length #11 (Len = 16777215, buffer too small) |
| 86 | mbedtls_asn1_write_len:16777215:"83FFFFFF":3:MBEDTLS_ERR_ASN1_BUF_TOO_SMALL |
| 87 | |
| 88 | ASN.1 Write / Read Length #12 (Len = 16909060, byte order) |
| 89 | mbedtls_asn1_write_len:16909060:"8401020304":5:5 |
| 90 | |
| 91 | ASN.1 Write / Read Length #12 (Len = 16909060, buffer too small) |
| 92 | mbedtls_asn1_write_len:16909060:"8401020304":4:MBEDTLS_ERR_ASN1_BUF_TOO_SMALL |
Andres Amaya Garcia | 5d26163 | 2018-09-26 10:51:16 +0100 | [diff] [blame] | 93 | |
| 94 | ASN.1 Write Named Bitstring / Unused bits #0 |
| 95 | test_asn1_write_bitstrings:"FF":8:"030200FF":4:1 |
| 96 | |
| 97 | ASN.1 Write Named Bitstring / Unused bits #1 |
| 98 | test_asn1_write_bitstrings:"FE":8:"030201FE":4:1 |
| 99 | |
| 100 | ASN.1 Write Named Bitstring / Unused bits #2 |
| 101 | test_asn1_write_bitstrings:"FC":7:"030202FC":4:1 |
| 102 | |
| 103 | ASN.1 Write Named Bitstring / Unused bits #3 |
| 104 | test_asn1_write_bitstrings:"F8":8:"030203F8":4:1 |
| 105 | |
| 106 | ASN.1 Write Named Bitstring / Unused bits #4 |
| 107 | test_asn1_write_bitstrings:"F0":6:"030204F0":4:1 |
| 108 | |
| 109 | ASN.1 Write Named Bitstring / Unused bits #5 |
| 110 | test_asn1_write_bitstrings:"E0":6:"030205E0":4:1 |
| 111 | |
| 112 | ASN.1 Write Named Bitstring / Unused bits #6 |
| 113 | test_asn1_write_bitstrings:"C0":8:"030206C0":4:1 |
| 114 | |
| 115 | ASN.1 Write Named Bitstring / Unused bits #7 |
| 116 | test_asn1_write_bitstrings:"80":8:"03020780":4:1 |
| 117 | |
| 118 | ASN.1 Write Named Bitstring / Empty bitstring |
| 119 | test_asn1_write_bitstrings:"00":7:"030100":3:1 |
| 120 | |
| 121 | ASN.1 Write Named Bitstring / Empty bitstring (bits = 16) |
| 122 | test_asn1_write_bitstrings:"0000":16:"030100":3:1 |
| 123 | |
| 124 | ASN.1 Write Named Bitstring / Empty bitstring (bits = 24) |
| 125 | test_asn1_write_bitstrings:"FFFFFF":0:"030100":3:1 |
| 126 | |
| 127 | ASN.1 Write Named Bitstring / 15 trailing bits all unset |
| 128 | test_asn1_write_bitstrings:"F88000":24:"030307F880":5:1 |
| 129 | |
| 130 | ASN.1 Write Named Bitstring / 15 trailing bits all set |
| 131 | test_asn1_write_bitstrings:"F8FFFF":9:"030307F880":5:1 |
| 132 | |
| 133 | ASN.1 Write Bitstring / Unused bits #0 |
| 134 | test_asn1_write_bitstrings:"FF":8:"030200FF":4:0 |
| 135 | |
| 136 | ASN.1 Write Bitstring / Unused bits #1 |
| 137 | test_asn1_write_bitstrings:"FF":7:"030201FE":4:0 |
| 138 | |
| 139 | ASN.1 Write Bitstring / Unused bits #2 |
| 140 | test_asn1_write_bitstrings:"FF":6:"030202FC":4:0 |
| 141 | |
| 142 | ASN.1 Write Bitstring / Unused bits #3 |
| 143 | test_asn1_write_bitstrings:"FF":5:"030203F8":4:0 |
| 144 | |
| 145 | ASN.1 Write Bitstring / Unused bits #4 |
| 146 | test_asn1_write_bitstrings:"FF":4:"030204F0":4:0 |
| 147 | |
| 148 | ASN.1 Write Bitstring / Unused bits #5 |
| 149 | test_asn1_write_bitstrings:"FF":3:"030205E0":4:0 |
| 150 | |
| 151 | ASN.1 Write Bitstring / Unused bits #6 |
| 152 | test_asn1_write_bitstrings:"FF":2:"030206C0":4:0 |
| 153 | |
| 154 | ASN.1 Write Bitstring / Unused bits #7 |
| 155 | test_asn1_write_bitstrings:"FF":1:"03020780":4:0 |
| 156 | |
| 157 | ASN.1 Write Bitstring / 1 trailing bit (bits 15) |
| 158 | test_asn1_write_bitstrings:"0003":15:"0303010002":5:0 |
| 159 | |
| 160 | ASN.1 Write Bitstring / 0 bits |
| 161 | test_asn1_write_bitstrings:"":0:"030100":3:0 |
| 162 | |
| 163 | ASN.1 Write Bitstring / long string all bits unset except trailing bits |
| 164 | test_asn1_write_bitstrings:"000000000007":45:"030703000000000000":9:0 |