Add one-and-zeros (ISO/IEC 7816-4) padding

This commit is contained in:
Manuel Pégourié-Gonnard 2013-07-26 12:46:02 +02:00 committed by Paul Bakker
parent 6c9789932e
commit 679f9e90ad
7 changed files with 305 additions and 0 deletions

View File

@ -106,6 +106,7 @@ typedef enum {
typedef enum { typedef enum {
POLARSSL_PADDING_PKCS7 = 0, /**< PKCS7 padding (default) */ POLARSSL_PADDING_PKCS7 = 0, /**< PKCS7 padding (default) */
POLARSSL_PADDING_ONE_AND_ZEROS, /**< ISO/IEC 7816-4 padding */
} cipher_padding_t; } cipher_padding_t;
typedef enum { typedef enum {

View File

@ -526,6 +526,9 @@ int cipher_update( cipher_context_t *ctx, const unsigned char *input, size_t ile
return POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE; return POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE;
} }
/*
* PKCS7 (and PKCS5) padding: fill with ll bytes, with ll = padding_len
*/
static void add_pkcs_padding( unsigned char *output, size_t output_len, static void add_pkcs_padding( unsigned char *output, size_t output_len,
size_t data_len ) size_t data_len )
{ {
@ -558,6 +561,39 @@ static int get_pkcs_padding( unsigned char *input, size_t input_len,
return 0; return 0;
} }
/*
* One and zeros padding: fill with 80 00 ... 00
*/
static void add_one_and_zeros_padding( unsigned char *output,
size_t output_len, size_t data_len )
{
size_t padding_len = output_len - data_len;
unsigned char i = 0;
output[data_len] = 0x80;
for( i = 1; i < padding_len; i++ )
output[data_len + i] = 0x00;
}
static int get_one_and_zeros_padding( unsigned char *input, size_t input_len,
size_t *data_len )
{
unsigned char *p = input + input_len - 1;
if( NULL == input || NULL == data_len )
return POLARSSL_ERR_CIPHER_BAD_INPUT_DATA;
while( *p == 0x00 && p > input )
--p;
if( *p != 0x80 )
return POLARSSL_ERR_CIPHER_INVALID_PADDING;
*data_len = p - input;
return 0;
}
int cipher_finish( cipher_context_t *ctx, unsigned char *output, size_t *olen) int cipher_finish( cipher_context_t *ctx, unsigned char *output, size_t *olen)
{ {
int ret = 0; int ret = 0;
@ -623,6 +659,13 @@ int cipher_set_padding_mode( cipher_context_t *ctx, cipher_padding_t mode )
return 0; return 0;
} }
if( POLARSSL_PADDING_ONE_AND_ZEROS == mode )
{
ctx->add_padding = add_one_and_zeros_padding;
ctx->get_padding = get_one_and_zeros_padding;
return 0;
}
return POLARSSL_ERR_CIPHER_BAD_INPUT_DATA; return POLARSSL_ERR_CIPHER_BAD_INPUT_DATA;
} }

View File

@ -65,6 +65,66 @@ AES Encrypt and decrypt 49 bytes
depends_on:POLARSSL_AES_C depends_on:POLARSSL_AES_C
enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:49:-1 enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:49:-1
AES Encrypt and decrypt 0 bytes with one and zeros padding
depends_on:POLARSSL_AES_C
enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:0:POLARSSL_PADDING_ONE_AND_ZEROS
AES Encrypt and decrypt 1 byte with one and zeros padding
depends_on:POLARSSL_AES_C
enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:1:POLARSSL_PADDING_ONE_AND_ZEROS
AES Encrypt and decrypt 2 bytes with one and zeros padding
depends_on:POLARSSL_AES_C
enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:2:POLARSSL_PADDING_ONE_AND_ZEROS
AES Encrypt and decrypt 7 bytes with one and zeros padding
depends_on:POLARSSL_AES_C
enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:7:POLARSSL_PADDING_ONE_AND_ZEROS
AES Encrypt and decrypt 8 bytes with one and zeros padding
depends_on:POLARSSL_AES_C
enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:8:POLARSSL_PADDING_ONE_AND_ZEROS
AES Encrypt and decrypt 9 bytes with one and zeros padding
depends_on:POLARSSL_AES_C
enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:9:POLARSSL_PADDING_ONE_AND_ZEROS
AES Encrypt and decrypt 15 bytes with one and zeros padding
depends_on:POLARSSL_AES_C
enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:15:POLARSSL_PADDING_ONE_AND_ZEROS
AES Encrypt and decrypt 16 bytes with one and zeros padding
depends_on:POLARSSL_AES_C
enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:16:POLARSSL_PADDING_ONE_AND_ZEROS
AES Encrypt and decrypt 17 bytes with one and zeros padding
depends_on:POLARSSL_AES_C
enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:17:POLARSSL_PADDING_ONE_AND_ZEROS
AES Encrypt and decrypt 31 bytes with one and zeros padding
depends_on:POLARSSL_AES_C
enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:31:POLARSSL_PADDING_ONE_AND_ZEROS
AES Encrypt and decrypt 32 bytes with one and zeros padding
depends_on:POLARSSL_AES_C
enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:32:POLARSSL_PADDING_ONE_AND_ZEROS
AES Encrypt and decrypt 33 bytes with one and zeros padding
depends_on:POLARSSL_AES_C
enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:33:POLARSSL_PADDING_ONE_AND_ZEROS
AES Encrypt and decrypt 47 bytes with one and zeros padding
depends_on:POLARSSL_AES_C
enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:47:POLARSSL_PADDING_ONE_AND_ZEROS
AES Encrypt and decrypt 48 bytes with one and zeros padding
depends_on:POLARSSL_AES_C
enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:48:POLARSSL_PADDING_ONE_AND_ZEROS
AES Encrypt and decrypt 49 bytes with one and zeros padding
depends_on:POLARSSL_AES_C
enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:49:POLARSSL_PADDING_ONE_AND_ZEROS
AES Encrypt and decrypt 0 bytes in multiple parts AES Encrypt and decrypt 0 bytes in multiple parts
depends_on:POLARSSL_AES_C depends_on:POLARSSL_AES_C
enc_dec_buf_multipart:POLARSSL_CIPHER_AES_128_CBC:128:0:0: enc_dec_buf_multipart:POLARSSL_CIPHER_AES_128_CBC:128:0:0:

View File

@ -65,6 +65,66 @@ BLOWFISH Encrypt and decrypt 49 bytes
depends_on:POLARSSL_BLOWFISH_C depends_on:POLARSSL_BLOWFISH_C
enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:49:-1 enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:49:-1
BLOWFISH Encrypt and decrypt 0 bytes with one and zeros padding
depends_on:POLARSSL_BLOWFISH_C
enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:0:POLARSSL_PADDING_ONE_AND_ZEROS
BLOWFISH Encrypt and decrypt 1 byte with one and zeros padding
depends_on:POLARSSL_BLOWFISH_C
enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:1:POLARSSL_PADDING_ONE_AND_ZEROS
BLOWFISH Encrypt and decrypt 2 bytes with one and zeros padding
depends_on:POLARSSL_BLOWFISH_C
enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:2:POLARSSL_PADDING_ONE_AND_ZEROS
BLOWFISH Encrypt and decrypt 7 bytes with one and zeros padding
depends_on:POLARSSL_BLOWFISH_C
enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:7:POLARSSL_PADDING_ONE_AND_ZEROS
BLOWFISH Encrypt and decrypt 8 bytes with one and zeros padding
depends_on:POLARSSL_BLOWFISH_C
enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:8:POLARSSL_PADDING_ONE_AND_ZEROS
BLOWFISH Encrypt and decrypt 9 bytes with one and zeros padding
depends_on:POLARSSL_BLOWFISH_C
enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:9:POLARSSL_PADDING_ONE_AND_ZEROS
BLOWFISH Encrypt and decrypt 15 bytes with one and zeros padding
depends_on:POLARSSL_BLOWFISH_C
enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:15:POLARSSL_PADDING_ONE_AND_ZEROS
BLOWFISH Encrypt and decrypt 16 bytes with one and zeros padding
depends_on:POLARSSL_BLOWFISH_C
enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:16:POLARSSL_PADDING_ONE_AND_ZEROS
BLOWFISH Encrypt and decrypt 17 bytes with one and zeros padding
depends_on:POLARSSL_BLOWFISH_C
enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:17:POLARSSL_PADDING_ONE_AND_ZEROS
BLOWFISH Encrypt and decrypt 31 bytes with one and zeros padding
depends_on:POLARSSL_BLOWFISH_C
enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:31:POLARSSL_PADDING_ONE_AND_ZEROS
BLOWFISH Encrypt and decrypt 32 bytes with one and zeros padding
depends_on:POLARSSL_BLOWFISH_C
enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:32:POLARSSL_PADDING_ONE_AND_ZEROS
BLOWFISH Encrypt and decrypt 32 bytes with one and zeros padding
depends_on:POLARSSL_BLOWFISH_C
enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:33:POLARSSL_PADDING_ONE_AND_ZEROS
BLOWFISH Encrypt and decrypt 47 bytes with one and zeros padding
depends_on:POLARSSL_BLOWFISH_C
enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:47:POLARSSL_PADDING_ONE_AND_ZEROS
BLOWFISH Encrypt and decrypt 48 bytes with one and zeros padding
depends_on:POLARSSL_BLOWFISH_C
enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:48:POLARSSL_PADDING_ONE_AND_ZEROS
BLOWFISH Encrypt and decrypt 49 bytes with one and zeros padding
depends_on:POLARSSL_BLOWFISH_C
enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:49:POLARSSL_PADDING_ONE_AND_ZEROS
BLOWFISH Encrypt and decrypt 0 bytes in multiple parts BLOWFISH Encrypt and decrypt 0 bytes in multiple parts
depends_on:POLARSSL_BLOWFISH_C depends_on:POLARSSL_BLOWFISH_C
enc_dec_buf_multipart:POLARSSL_CIPHER_BLOWFISH_CBC:128:0:0: enc_dec_buf_multipart:POLARSSL_CIPHER_BLOWFISH_CBC:128:0:0:

View File

@ -65,6 +65,66 @@ CAMELLIA Encrypt and decrypt 49 bytes
depends_on:POLARSSL_CAMELLIA_C depends_on:POLARSSL_CAMELLIA_C
enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:49:-1 enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:49:-1
CAMELLIA Encrypt and decrypt 0 bytes with one and zeros padding
depends_on:POLARSSL_CAMELLIA_C
enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:0:POLARSSL_PADDING_ONE_AND_ZEROS
CAMELLIA Encrypt and decrypt 1 byte with one and zeros padding
depends_on:POLARSSL_CAMELLIA_C
enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:1:POLARSSL_PADDING_ONE_AND_ZEROS
CAMELLIA Encrypt and decrypt 2 bytes with one and zeros padding
depends_on:POLARSSL_CAMELLIA_C
enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:2:POLARSSL_PADDING_ONE_AND_ZEROS
CAMELLIA Encrypt and decrypt 7 bytes with one and zeros padding
depends_on:POLARSSL_CAMELLIA_C
enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:7:POLARSSL_PADDING_ONE_AND_ZEROS
CAMELLIA Encrypt and decrypt 8 bytes with one and zeros padding
depends_on:POLARSSL_CAMELLIA_C
enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:8:POLARSSL_PADDING_ONE_AND_ZEROS
CAMELLIA Encrypt and decrypt 9 bytes with one and zeros padding
depends_on:POLARSSL_CAMELLIA_C
enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:9:POLARSSL_PADDING_ONE_AND_ZEROS
CAMELLIA Encrypt and decrypt 15 bytes with one and zeros padding
depends_on:POLARSSL_CAMELLIA_C
enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:15:POLARSSL_PADDING_ONE_AND_ZEROS
CAMELLIA Encrypt and decrypt 16 bytes with one and zeros padding
depends_on:POLARSSL_CAMELLIA_C
enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:16:POLARSSL_PADDING_ONE_AND_ZEROS
CAMELLIA Encrypt and decrypt 17 bytes with one and zeros padding
depends_on:POLARSSL_CAMELLIA_C
enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:17:POLARSSL_PADDING_ONE_AND_ZEROS
CAMELLIA Encrypt and decrypt 31 bytes with one and zeros padding
depends_on:POLARSSL_CAMELLIA_C
enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:31:POLARSSL_PADDING_ONE_AND_ZEROS
CAMELLIA Encrypt and decrypt 32 bytes with one and zeros padding
depends_on:POLARSSL_CAMELLIA_C
enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:32:POLARSSL_PADDING_ONE_AND_ZEROS
CAMELLIA Encrypt and decrypt 32 bytes with one and zeros padding
depends_on:POLARSSL_CAMELLIA_C
enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:33:POLARSSL_PADDING_ONE_AND_ZEROS
CAMELLIA Encrypt and decrypt 47 bytes with one and zeros padding
depends_on:POLARSSL_CAMELLIA_C
enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:47:POLARSSL_PADDING_ONE_AND_ZEROS
CAMELLIA Encrypt and decrypt 48 bytes with one and zeros padding
depends_on:POLARSSL_CAMELLIA_C
enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:48:POLARSSL_PADDING_ONE_AND_ZEROS
CAMELLIA Encrypt and decrypt 49 bytes with one and zeros padding
depends_on:POLARSSL_CAMELLIA_C
enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:49:POLARSSL_PADDING_ONE_AND_ZEROS
CAMELLIA Encrypt and decrypt 0 bytes in multiple parts CAMELLIA Encrypt and decrypt 0 bytes in multiple parts
depends_on:POLARSSL_CAMELLIA_C depends_on:POLARSSL_CAMELLIA_C
enc_dec_buf_multipart:POLARSSL_CIPHER_CAMELLIA_128_CBC:128:0:0: enc_dec_buf_multipart:POLARSSL_CIPHER_CAMELLIA_128_CBC:128:0:0:

View File

@ -65,6 +65,66 @@ DES Encrypt and decrypt 49 bytes
depends_on:POLARSSL_DES_C depends_on:POLARSSL_DES_C
enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:49:-1 enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:49:-1
DES Encrypt and decrypt 0 bytes with one and zeros padding
depends_on:POLARSSL_DES_C
enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:0:POLARSSL_PADDING_ONE_AND_ZEROS
DES Encrypt and decrypt 1 byte with one and zeros padding
depends_on:POLARSSL_DES_C
enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:1:POLARSSL_PADDING_ONE_AND_ZEROS
DES Encrypt and decrypt 2 bytes with one and zeros padding
depends_on:POLARSSL_DES_C
enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:2:POLARSSL_PADDING_ONE_AND_ZEROS
DES Encrypt and decrypt 7 bytes with one and zeros padding
depends_on:POLARSSL_DES_C
enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:7:POLARSSL_PADDING_ONE_AND_ZEROS
DES Encrypt and decrypt 8 bytes with one and zeros padding
depends_on:POLARSSL_DES_C
enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:8:POLARSSL_PADDING_ONE_AND_ZEROS
DES Encrypt and decrypt 9 bytes with one and zeros padding
depends_on:POLARSSL_DES_C
enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:9:POLARSSL_PADDING_ONE_AND_ZEROS
DES Encrypt and decrypt 15 bytes with one and zeros padding
depends_on:POLARSSL_DES_C
enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:15:POLARSSL_PADDING_ONE_AND_ZEROS
DES Encrypt and decrypt 16 bytes with one and zeros padding
depends_on:POLARSSL_DES_C
enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:16:POLARSSL_PADDING_ONE_AND_ZEROS
DES Encrypt and decrypt 17 bytes with one and zeros padding
depends_on:POLARSSL_DES_C
enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:17:POLARSSL_PADDING_ONE_AND_ZEROS
DES Encrypt and decrypt 31 bytes with one and zeros padding
depends_on:POLARSSL_DES_C
enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:31:POLARSSL_PADDING_ONE_AND_ZEROS
DES Encrypt and decrypt 32 bytes with one and zeros padding
depends_on:POLARSSL_DES_C
enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:32:POLARSSL_PADDING_ONE_AND_ZEROS
DES Encrypt and decrypt 32 bytes with one and zeros padding
depends_on:POLARSSL_DES_C
enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:33:POLARSSL_PADDING_ONE_AND_ZEROS
DES Encrypt and decrypt 47 bytes with one and zeros padding
depends_on:POLARSSL_DES_C
enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:47:POLARSSL_PADDING_ONE_AND_ZEROS
DES Encrypt and decrypt 48 bytes with one and zeros padding
depends_on:POLARSSL_DES_C
enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:48:POLARSSL_PADDING_ONE_AND_ZEROS
DES Encrypt and decrypt 49 bytes with one and zeros padding
depends_on:POLARSSL_DES_C
enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:49:POLARSSL_PADDING_ONE_AND_ZEROS
DES Encrypt and decrypt 0 bytes in multiple parts DES Encrypt and decrypt 0 bytes in multiple parts
depends_on:POLARSSL_DES_C depends_on:POLARSSL_DES_C
enc_dec_buf_multipart:POLARSSL_CIPHER_DES_CBC:56:0:0: enc_dec_buf_multipart:POLARSSL_CIPHER_DES_CBC:56:0:0:

View File

@ -81,3 +81,24 @@ check_padding:POLARSSL_PADDING_PKCS7:"DABBAD00030203":POLARSSL_ERR_CIPHER_INVALI
Check PKCS padding #8 (overlong) Check PKCS padding #8 (overlong)
check_padding:POLARSSL_PADDING_PKCS7:"040404":POLARSSL_ERR_CIPHER_INVALID_PADDING:0 check_padding:POLARSSL_PADDING_PKCS7:"040404":POLARSSL_ERR_CIPHER_INVALID_PADDING:0
Check one and zeros padding #1 (correct)
check_padding:POLARSSL_PADDING_ONE_AND_ZEROS:"DABBAD0080":0:4
Check one and zeros padding #2 (correct)
check_padding:POLARSSL_PADDING_ONE_AND_ZEROS:"DABBAD008000":0:4
Check one and zeros padding #3 (correct)
check_padding:POLARSSL_PADDING_ONE_AND_ZEROS:"DABBAD00800000":0:4
Check one and zeros padding #4 (correct)
check_padding:POLARSSL_PADDING_ONE_AND_ZEROS:"DABBAD00808000":0:5
Check one and zeros padding #5 (correct)
check_padding:POLARSSL_PADDING_ONE_AND_ZEROS:"800000":0:0
Check one and zeros padding #6 (missing one)
check_padding:POLARSSL_PADDING_ONE_AND_ZEROS:"DABBAD0000":POLARSSL_ERR_CIPHER_INVALID_PADDING:4
Check one and zeros padding #7 (overlong)
check_padding:POLARSSL_PADDING_ONE_AND_ZEROS:"0000000000":POLARSSL_ERR_CIPHER_INVALID_PADDING:4