test_suite_base64.data 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. Test case mbedtls_base64_encode #1 buffer just right
  2. mbedtls_base64_encode:"":"":0:0
  3. Test case mbedtls_base64_encode #2 buffer just right
  4. mbedtls_base64_encode:"f":"Zg==":5:0
  5. Test case mbedtls_base64_encode #2 buffer too small
  6. mbedtls_base64_encode:"f":"Zg==":4:MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL
  7. Test case mbedtls_base64_encode #3 buffer just right
  8. mbedtls_base64_encode:"fo":"Zm8=":5:0
  9. Test case mbedtls_base64_encode #3 buffer too small
  10. mbedtls_base64_encode:"fo":"Zm8=":4:MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL
  11. Test case mbedtls_base64_encode #4 buffer just right
  12. mbedtls_base64_encode:"foo":"Zm9v":5:0
  13. Test case mbedtls_base64_encode #4 buffer too small
  14. mbedtls_base64_encode:"foo":"Zm9v":4:MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL
  15. Test case mbedtls_base64_encode #5 buffer just right
  16. mbedtls_base64_encode:"foob":"Zm9vYg==":9:0
  17. Test case mbedtls_base64_encode #5 buffer too small
  18. mbedtls_base64_encode:"foob":"Zm9vYg==":8:MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL
  19. Test case mbedtls_base64_encode #6 buffer just right
  20. mbedtls_base64_encode:"fooba":"Zm9vYmE=":9:0
  21. Test case mbedtls_base64_encode #6 buffer too small
  22. mbedtls_base64_encode:"fooba":"Zm9vYmE=":8:MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL
  23. Test case mbedtls_base64_encode #7 buffer just right
  24. mbedtls_base64_encode:"foobar":"Zm9vYmFy":9:0
  25. Test case mbedtls_base64_encode #7 buffer too small
  26. mbedtls_base64_encode:"foobar":"Zm9vYmFy":8:MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL
  27. Test case mbedtls_base64_decode #1
  28. mbedtls_base64_decode:"":"":0
  29. Test case mbedtls_base64_decode #2
  30. mbedtls_base64_decode:"Zg==":"f":0
  31. Test case mbedtls_base64_decode #3
  32. mbedtls_base64_decode:"Zm8=":"fo":0
  33. Test case mbedtls_base64_decode #4
  34. mbedtls_base64_decode:"Zm9v":"foo":0
  35. Test case mbedtls_base64_decode #5
  36. mbedtls_base64_decode:"Zm9vYg==":"foob":0
  37. Test case mbedtls_base64_decode #6
  38. mbedtls_base64_decode:"Zm9vYmE=":"fooba":0
  39. Test case mbedtls_base64_decode #7
  40. mbedtls_base64_decode:"Zm9vYmFy":"foobar":0
  41. Base64 decode (Illegal character)
  42. mbedtls_base64_decode:"zm#=":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
  43. Base64 decode (Too much equal signs)
  44. mbedtls_base64_decode:"zm===":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
  45. Base64 decode (Invalid char after equal signs)
  46. mbedtls_base64_decode:"zm=masd":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
  47. Base64 decode (Space inside string)
  48. mbedtls_base64_decode:"zm masd":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
  49. Base64 decode "Zm9vYmFy" (no newline nor '\0' at end)
  50. base64_decode_hex_src:"5a6d3976596d4679":"foobar":0
  51. Base64 decode "Zm9vYmFy\n" (LF at end)
  52. base64_decode_hex_src:"5a6d3976596d46790a":"foobar":0
  53. Base64 decode "Zm9vYmFy\r\n" (CRLF at end)
  54. base64_decode_hex_src:"5a6d3976596d46790d0a":"foobar":0
  55. Base64 decode "Zm9vYmFy\r" (CR at end)
  56. base64_decode_hex_src:"5a6d3976596d46790d":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
  57. Base64 decode "Zm9vYmFy " (SP at end)
  58. base64_decode_hex_src:"5a6d3976596d467920":"foobar":0
  59. Base64 decode "Zm9vYmFy \n" (SP+LF at end)
  60. base64_decode_hex_src:"5a6d3976596d4679200a":"foobar":0
  61. Base64 decode "Zm9vYmFy \r\n" (SP+CRLF at end)
  62. base64_decode_hex_src:"5a6d3976596d4679200d0a":"foobar":0
  63. Base64 decode "Zm9vYmFy \r" (SP+CR at end)
  64. base64_decode_hex_src:"5a6d3976596d4679200d":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
  65. Base64 decode "Zm9vYmFy " (2SP at end)
  66. base64_decode_hex_src:"5a6d3976596d46792020":"foobar":0
  67. Base64 decode "Zm9vYmFy \n" (2SP+LF at end)
  68. base64_decode_hex_src:"5a6d3976596d467920200a":"foobar":0
  69. Base64 decode "Zm9vYmFy \r\n" (2SP+CRLF at end)
  70. base64_decode_hex_src:"5a6d3976596d467920200d0a":"foobar":0
  71. Base64 decode "Zm9vYmFy \r" (2SP+CR at end)
  72. base64_decode_hex_src:"5a6d3976596d467920200d":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
  73. Base64 decode "Zm9vYmF\ny" (LF inside)
  74. base64_decode_hex_src:"5a6d3976596d460a79":"foobar":0
  75. Base64 decode "Zm9vYmF\ry" (CRLF inside)
  76. base64_decode_hex_src:"5a6d3976596d460d0a79":"foobar":0
  77. Base64 decode "Zm9vYmF\ry" (CR inside)
  78. base64_decode_hex_src:"5a6d3976596d460d79":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
  79. Base64 decode "Zm9vYmF y" (SP inside)
  80. base64_decode_hex_src:"5a6d3976596d462079":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
  81. Base64 decode "Zm9vYmF \ny" (SP+LF inside)
  82. base64_decode_hex_src:"5a6d3976596d46200a79":"foobar":0
  83. Base64 decode "Zm9vYmF \ry" (SP+CRLF inside)
  84. base64_decode_hex_src:"5a6d3976596d46200d0a79":"foobar":0
  85. Base64 decode "Zm9vYmF \ry" (SP+CR inside)
  86. base64_decode_hex_src:"5a6d3976596d46200d79":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
  87. Base64 decode "Zm9vYmF y" (2SP inside)
  88. base64_decode_hex_src:"5a6d3976596d46202079":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
  89. Base64 decode "Zm9vYmF \ny" (2SP+LF inside)
  90. base64_decode_hex_src:"5a6d3976596d4620200a79":"foobar":0
  91. Base64 decode "Zm9vYmF \ry" (2SP+CRLF inside)
  92. base64_decode_hex_src:"5a6d3976596d4620200d0a79":"foobar":0
  93. Base64 decode "Zm9vYmF \ry" (2SP+CR inside)
  94. base64_decode_hex_src:"5a6d3976596d4620200d79":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
  95. Base64 encode hex #1
  96. base64_encode_hex:"010203040506070809":"AQIDBAUGBwgJ":13:0
  97. Base64 encode hex #2 (buffer too small)
  98. base64_encode_hex:"010203040506070809":"AQIDBAUGBwgJ":12:MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL
  99. Base64 encode hex #3
  100. base64_encode_hex:"0102030405060708":"AQIDBAUGBwg=":13:0
  101. Base64 encode hex #4
  102. base64_encode_hex:"01020304050607":"AQIDBAUGBw==":13:0
  103. Base64 decode hex #1
  104. base64_decode_hex:"AQIDBAUGBwgJ":"010203040506070809":9:0
  105. Base64 decode hex #2 (buffer too small)
  106. base64_decode_hex:"AQIDBAUGBwgJ":"010203040506070809":8:MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL
  107. Base64 decode hex #3
  108. base64_decode_hex:"AQIDBAUGBwg=":"0102030405060708":8:0
  109. Base64 decode hex #4
  110. base64_decode_hex:"AQIDBAUGBw==":"01020304050607":7:0
  111. Base64 decode hex #5 (buffer too small)
  112. base64_decode_hex:"AQIDBAUGBw==":"01020304050607":6:MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL
  113. Base64 Selftest
  114. depends_on:MBEDTLS_SELF_TEST
  115. base64_selftest: