blob: 3b66da165f04b59d927f592acecff1b271c10b11 [file] [log] [blame]
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +02001Test case mbedtls_base64_encode #1
2mbedtls_base64_encode:"":"":1000:0
Paul Bakker367dae42009-06-28 21:50:27 +00003
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +02004Test case mbedtls_base64_encode #2
5mbedtls_base64_encode:"f":"Zg==":1000:0
Paul Bakker367dae42009-06-28 21:50:27 +00006
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +02007Test case mbedtls_base64_encode #3
8mbedtls_base64_encode:"fo":"Zm8=":1000:0
Paul Bakker367dae42009-06-28 21:50:27 +00009
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020010Test case mbedtls_base64_encode #4
11mbedtls_base64_encode:"foo":"Zm9v":1000:0
Paul Bakker367dae42009-06-28 21:50:27 +000012
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020013Test case mbedtls_base64_encode #5
14mbedtls_base64_encode:"foob":"Zm9vYg==":1000:0
Paul Bakker367dae42009-06-28 21:50:27 +000015
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020016Test case mbedtls_base64_encode #6
17mbedtls_base64_encode:"fooba":"Zm9vYmE=":1000:0
Paul Bakker367dae42009-06-28 21:50:27 +000018
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020019Test case mbedtls_base64_encode #7
20mbedtls_base64_encode:"foobar":"Zm9vYmFy":1000:0
Paul Bakker367dae42009-06-28 21:50:27 +000021
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020022Test case mbedtls_base64_decode #1
23mbedtls_base64_decode:"":"":0
Paul Bakker367dae42009-06-28 21:50:27 +000024
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020025Test case mbedtls_base64_decode #2
26mbedtls_base64_decode:"Zg==":"f":0
Paul Bakker367dae42009-06-28 21:50:27 +000027
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020028Test case mbedtls_base64_decode #3
29mbedtls_base64_decode:"Zm8=":"fo":0
Paul Bakker367dae42009-06-28 21:50:27 +000030
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020031Test case mbedtls_base64_decode #4
32mbedtls_base64_decode:"Zm9v":"foo":0
Paul Bakker367dae42009-06-28 21:50:27 +000033
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020034Test case mbedtls_base64_decode #5
35mbedtls_base64_decode:"Zm9vYg==":"foob":0
Paul Bakker367dae42009-06-28 21:50:27 +000036
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020037Test case mbedtls_base64_decode #6
38mbedtls_base64_decode:"Zm9vYmE=":"fooba":0
Paul Bakker367dae42009-06-28 21:50:27 +000039
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020040Test case mbedtls_base64_decode #7
41mbedtls_base64_decode:"Zm9vYmFy":"foobar":0
Paul Bakker5946fd92009-07-11 15:29:30 +000042
43Base64 encode (buffer size just right)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020044mbedtls_base64_encode:"foobar":"Zm9vYmFy":9:0
Paul Bakker5946fd92009-07-11 15:29:30 +000045
46Base64 encode (buffer size too small)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020047mbedtls_base64_encode:"foobar":"":8:MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL
Paul Bakker5946fd92009-07-11 15:29:30 +000048
49Base64 decode (Illegal character)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020050mbedtls_base64_decode:"zm#=":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
Paul Bakker5946fd92009-07-11 15:29:30 +000051
52Base64 decode (Too much equal signs)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020053mbedtls_base64_decode:"zm===":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
Paul Bakker5946fd92009-07-11 15:29:30 +000054
55Base64 decode (Invalid char after equal signs)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020056mbedtls_base64_decode:"zm=masd":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
Paul Bakker3d360822009-07-05 11:29:38 +000057
Manuel Pégourié-Gonnard64938c62014-10-15 21:45:39 +020058Base64 decode (Space inside string)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020059mbedtls_base64_decode:"zm masd":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
Manuel Pégourié-Gonnard64938c62014-10-15 21:45:39 +020060
61Base64 decode "Zm9vYmFy" (no newline nor '\0' at end)
62base64_decode_hex_src:"5a6d3976596d4679":"foobar":0
63
64Base64 decode "Zm9vYmFy\n" (LF at end)
65base64_decode_hex_src:"5a6d3976596d46790a":"foobar":0
66
67Base64 decode "Zm9vYmFy\r\n" (CRLF at end)
68base64_decode_hex_src:"5a6d3976596d46790d0a":"foobar":0
69
70Base64 decode "Zm9vYmFy\r" (CR at end)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020071base64_decode_hex_src:"5a6d3976596d46790d":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
Manuel Pégourié-Gonnard64938c62014-10-15 21:45:39 +020072
73Base64 decode "Zm9vYmFy " (SP at end)
74base64_decode_hex_src:"5a6d3976596d467920":"foobar":0
75
76Base64 decode "Zm9vYmFy \n" (SP+LF at end)
77base64_decode_hex_src:"5a6d3976596d4679200a":"foobar":0
78
79Base64 decode "Zm9vYmFy \r\n" (SP+CRLF at end)
80base64_decode_hex_src:"5a6d3976596d4679200d0a":"foobar":0
81
82Base64 decode "Zm9vYmFy \r" (SP+CR at end)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020083base64_decode_hex_src:"5a6d3976596d4679200d":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
Manuel Pégourié-Gonnard64938c62014-10-15 21:45:39 +020084
85Base64 decode "Zm9vYmFy " (2SP at end)
86base64_decode_hex_src:"5a6d3976596d46792020":"foobar":0
87
88Base64 decode "Zm9vYmFy \n" (2SP+LF at end)
89base64_decode_hex_src:"5a6d3976596d467920200a":"foobar":0
90
91Base64 decode "Zm9vYmFy \r\n" (2SP+CRLF at end)
92base64_decode_hex_src:"5a6d3976596d467920200d0a":"foobar":0
93
94Base64 decode "Zm9vYmFy \r" (2SP+CR at end)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020095base64_decode_hex_src:"5a6d3976596d467920200d":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
Manuel Pégourié-Gonnard64938c62014-10-15 21:45:39 +020096
97Base64 decode "Zm9vYmF\ny" (LF inside)
98base64_decode_hex_src:"5a6d3976596d460a79":"foobar":0
99
100Base64 decode "Zm9vYmF\ry" (CRLF inside)
101base64_decode_hex_src:"5a6d3976596d460d0a79":"foobar":0
102
103Base64 decode "Zm9vYmF\ry" (CR inside)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200104base64_decode_hex_src:"5a6d3976596d460d79":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
Manuel Pégourié-Gonnard64938c62014-10-15 21:45:39 +0200105
106Base64 decode "Zm9vYmF y" (SP inside)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200107base64_decode_hex_src:"5a6d3976596d462079":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
Manuel Pégourié-Gonnard64938c62014-10-15 21:45:39 +0200108
109Base64 decode "Zm9vYmF \ny" (SP+LF inside)
110base64_decode_hex_src:"5a6d3976596d46200a79":"foobar":0
111
112Base64 decode "Zm9vYmF \ry" (SP+CRLF inside)
113base64_decode_hex_src:"5a6d3976596d46200d0a79":"foobar":0
114
115Base64 decode "Zm9vYmF \ry" (SP+CR inside)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200116base64_decode_hex_src:"5a6d3976596d46200d79":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
Manuel Pégourié-Gonnard64938c62014-10-15 21:45:39 +0200117
118Base64 decode "Zm9vYmF y" (2SP inside)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200119base64_decode_hex_src:"5a6d3976596d46202079":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
Manuel Pégourié-Gonnard64938c62014-10-15 21:45:39 +0200120
121Base64 decode "Zm9vYmF \ny" (2SP+LF inside)
122base64_decode_hex_src:"5a6d3976596d4620200a79":"foobar":0
123
124Base64 decode "Zm9vYmF \ry" (2SP+CRLF inside)
125base64_decode_hex_src:"5a6d3976596d4620200d0a79":"foobar":0
126
127Base64 decode "Zm9vYmF \ry" (2SP+CR inside)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200128base64_decode_hex_src:"5a6d3976596d4620200d79":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
Manuel Pégourié-Gonnard64938c62014-10-15 21:45:39 +0200129
Paul Bakkerd5983182014-07-04 13:50:31 +0200130Base64 encode hex #1
131base64_encode_hex:"010203040506070809":"AQIDBAUGBwgJ":13:0
132
133Base64 encode hex #2 (buffer too small)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200134base64_encode_hex:"010203040506070809":"AQIDBAUGBwgJ":12:MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL
Paul Bakkerd5983182014-07-04 13:50:31 +0200135
136Base64 encode hex #3
137base64_encode_hex:"0102030405060708":"AQIDBAUGBwg=":13:0
138
139Base64 encode hex #4
140base64_encode_hex:"01020304050607":"AQIDBAUGBw==":13:0
141
142Base64 decode hex #1
143base64_decode_hex:"AQIDBAUGBwgJ":"010203040506070809":9:0
144
145Base64 decode hex #2 (buffer too small)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200146base64_decode_hex:"AQIDBAUGBwgJ":"010203040506070809":8:MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL
Paul Bakkerd5983182014-07-04 13:50:31 +0200147
148Base64 decode hex #3
149base64_decode_hex:"AQIDBAUGBwg=":"0102030405060708":8:0
150
151Base64 decode hex #4
152base64_decode_hex:"AQIDBAUGBw==":"01020304050607":7:0
153
154Base64 decode hex #5 (buffer too small)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200155base64_decode_hex:"AQIDBAUGBw==":"01020304050607":6:MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL
Paul Bakkerd5983182014-07-04 13:50:31 +0200156
Paul Bakker3d360822009-07-05 11:29:38 +0000157Base64 Selftest
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200158depends_on:MBEDTLS_SELF_TEST
Paul Bakker3d360822009-07-05 11:29:38 +0000159base64_selftest:
Manuel Pégourié-Gonnard64938c62014-10-15 21:45:39 +0200160