From cf2305e513fc6aba9dc4bf46af72b4b4d3aee0a1 Mon Sep 17 00:00:00 2001 From: Ron Eldor Date: Mon, 25 Sep 2017 17:03:12 +0300 Subject: [PATCH 1/4] Add tests for mbedtls_cipher_crypt API 1. Add tests for 'mbedtls_cipher_crypt()' API 2. Resolves #1091, by ignoring IV when the cipher mode is MBEDTLS_MODE_ECB --- ChangeLog | 6 + library/cipher.c | 9 +- tests/suites/test_suite_cipher.aes.data | 620 ++++++++++++++++++++++++ tests/suites/test_suite_cipher.function | 57 ++- 4 files changed, 689 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index be0026e2b..36c582410 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ mbed TLS ChangeLog (Sorted per branch, date) += mbed TLS x.x.x branch released xxxx-xx-xx + +Bugfix + * Ignore iv in mbedtls_cipher_set_iv() when the cipher mode is MBEDTLS_MODE_ECB + Fix for #1091 raised by ezdevelop + = mbed TLS 2.7.4 branch released 2018-06-18 Bugfix diff --git a/library/cipher.c b/library/cipher.c index 7369f4823..67c3d3046 100644 --- a/library/cipher.c +++ b/library/cipher.c @@ -215,10 +215,15 @@ int mbedtls_cipher_set_iv( mbedtls_cipher_context_t *ctx, const unsigned char *iv, size_t iv_len ) { size_t actual_iv_size; - - if( NULL == ctx || NULL == ctx->cipher_info || NULL == iv ) + if( NULL == ctx || NULL == ctx->cipher_info || + ( NULL == iv && ( ctx->cipher_info->mode != MBEDTLS_MODE_ECB ) ) ) return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA ); + if ( ctx->cipher_info->mode == MBEDTLS_MODE_ECB ) + { + ctx->iv_size = 0; + return ( 0 ); + } /* avoid buffer overflow in ctx->iv */ if( iv_len > MBEDTLS_MAX_IV_LENGTH ) return( MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE ); diff --git a/tests/suites/test_suite_cipher.aes.data b/tests/suites/test_suite_cipher.aes.data index e8e9a155c..84d487767 100644 --- a/tests/suites/test_suite_cipher.aes.data +++ b/tests/suites/test_suite_cipher.aes.data @@ -1122,6 +1122,626 @@ AES-256-ECB Decrypt NIST KAT #12 depends_on:MBEDTLS_AES_C test_vec_ecb:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_DECRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"9b80eefb7ebe2d2b16247aa0efc72f5d":"e0000000000000000000000000000000":0 +AES-128-ECB crypt Encrypt NIST KAT #1 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"00000000000000000000000000000000":"":"f34481ec3cc627bacd5dc3fb08f273e6":"0336763e966d92595a567cc9ce537f5e":0 + +AES-128-ECB crypt Encrypt NIST KAT #2 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"00000000000000000000000000000000":"":"9798c4640bad75c7c3227db910174e72":"a9a1631bf4996954ebc093957b234589":0 + +AES-128-ECB crypt Encrypt NIST KAT #3 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"00000000000000000000000000000000":"":"96ab5c2ff612d9dfaae8c31f30c42168":"ff4f8391a6a40ca5b25d23bedd44a597":0 + +AES-128-ECB crypt Encrypt NIST KAT #4 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"e0000000000000000000000000000000":"":"00000000000000000000000000000000":"72a1da770f5d7ac4c9ef94d822affd97":0 + +AES-128-ECB crypt Encrypt NIST KAT #5 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"f0000000000000000000000000000000":"":"00000000000000000000000000000000":"970014d634e2b7650777e8e84d03ccd8":0 + +AES-128-ECB crypt Encrypt NIST KAT #6 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"f8000000000000000000000000000000":"":"00000000000000000000000000000000":"f17e79aed0db7e279e955b5f493875a7":0 + +AES-128-ECB crypt Encrypt NIST KAT #7 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"fffffffffffff0000000000000000000":"":"00000000000000000000000000000000":"7b90785125505fad59b13c186dd66ce3":0 + +AES-128-ECB crypt Encrypt NIST KAT #8 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"fffffffffffff8000000000000000000":"":"00000000000000000000000000000000":"8b527a6aebdaec9eaef8eda2cb7783e5":0 + +AES-128-ECB crypt Encrypt NIST KAT #9 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"fffffffffffffc000000000000000000":"":"00000000000000000000000000000000":"43fdaf53ebbc9880c228617d6a9b548b":0 + +AES-128-ECB crypt Encrypt NIST KAT #10 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"ffffffffffffffffffffffffffffc000":"":"00000000000000000000000000000000":"70c46bb30692be657f7eaa93ebad9897":0 + +AES-128-ECB crypt Encrypt NIST KAT #11 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"ffffffffffffffffffffffffffffe000":"":"00000000000000000000000000000000":"323994cfb9da285a5d9642e1759b224a":0 + +AES-128-ECB crypt Encrypt NIST KAT #12 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"fffffffffffffffffffffffffffff000":"":"00000000000000000000000000000000":"1dbf57877b7b17385c85d0b54851e371":0 + +AES-128-ECB crypt Encrypt NIST KAT #13 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"00000000000000000000000000000000":"":"ffffffffffffffc00000000000000000":"3a4d354f02bb5a5e47d39666867f246a":0 + +AES-128-ECB crypt Encrypt NIST KAT #14 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"00000000000000000000000000000000":"":"ffffffffffffffe00000000000000000":"d451b8d6e1e1a0ebb155fbbf6e7b7dc3":0 + +AES-128-ECB crypt Encrypt NIST KAT #15 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"00000000000000000000000000000000":"":"fffffffffffffff00000000000000000":"6898d4f42fa7ba6a10ac05e87b9f2080":0 + +AES-128-ECB crypt Encrypt NIST KAT #16 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"00000000000000000000000000000000":"":"ffffffffffffffffffffffffe0000000":"082eb8be35f442fb52668e16a591d1d6":0 + +AES-128-ECB crypt Encrypt NIST KAT #17 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"00000000000000000000000000000000":"":"fffffffffffffffffffffffff0000000":"e656f9ecf5fe27ec3e4a73d00c282fb3":0 + +AES-128-ECB crypt Encrypt NIST KAT #18 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"00000000000000000000000000000000":"":"fffffffffffffffffffffffff8000000":"2ca8209d63274cd9a29bb74bcd77683a":0 + +AES-128-ECB crypt Decrypt NIST KAT #1 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_DECRYPT:"00000000000000000000000000000000":"":"db4f1aa530967d6732ce4715eb0ee24b":"ff000000000000000000000000000000":0 + +AES-128-ECB crypt Decrypt NIST KAT #2 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_DECRYPT:"00000000000000000000000000000000":"":"a81738252621dd180a34f3455b4baa2f":"ff800000000000000000000000000000":0 + +AES-128-ECB crypt Decrypt NIST KAT #3 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_DECRYPT:"00000000000000000000000000000000":"":"77e2b508db7fd89234caf7939ee5621a":"ffc00000000000000000000000000000":0 + +AES-128-ECB crypt Decrypt NIST KAT #4 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_DECRYPT:"00000000000000000000000000000000":"":"dc43be40be0e53712f7e2bf5ca707209":"6a118a874519e64e9963798a503f1d35":0 + +AES-128-ECB crypt Decrypt NIST KAT #5 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_DECRYPT:"00000000000000000000000000000000":"":"92beedab1895a94faa69b632e5cc47ce":"cb9fceec81286ca3e989bd979b0cb284":0 + +AES-128-ECB crypt Decrypt NIST KAT #6 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_DECRYPT:"00000000000000000000000000000000":"":"459264f4798f6a78bacb89c15ed3d601":"b26aeb1874e47ca8358ff22378f09144":0 + +AES-128-ECB crypt Decrypt NIST KAT #7 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_DECRYPT:"b69418a85332240dc82492353956ae0c":"":"a303d940ded8f0baff6f75414cac5243":"00000000000000000000000000000000":0 + +AES-128-ECB crypt Decrypt NIST KAT #8 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_DECRYPT:"71b5c08a1993e1362e4d0ce9b22b78d5":"":"c2dabd117f8a3ecabfbb11d12194d9d0":"00000000000000000000000000000000":0 + +AES-128-ECB crypt Decrypt NIST KAT #9 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_DECRYPT:"e234cdca2606b81f29408d5f6da21206":"":"fff60a4740086b3b9c56195b98d91a7b":"00000000000000000000000000000000":0 + +AES-128-ECB crypt Decrypt NIST KAT #10 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_DECRYPT:"ffffffffffffffff0000000000000000":"":"84be19e053635f09f2665e7bae85b42d":"00000000000000000000000000000000":0 + +AES-128-ECB crypt Decrypt NIST KAT #11 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_DECRYPT:"ffffffffffffffff8000000000000000":"":"32cd652842926aea4aa6137bb2be2b5e":"00000000000000000000000000000000":0 + +AES-192-ECB crypt Encrypt NIST KAT #1 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_ENCRYPT:"000000000000000000000000000000000000000000000000":"":"fffffffffffffffffffff80000000000":"156f07767a85a4312321f63968338a01":0 + +AES-192-ECB crypt Encrypt NIST KAT #2 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_ENCRYPT:"000000000000000000000000000000000000000000000000":"":"fffffffffffffffffffffc0000000000":"15eec9ebf42b9ca76897d2cd6c5a12e2":0 + +AES-192-ECB crypt Encrypt NIST KAT #3 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_ENCRYPT:"000000000000000000000000000000000000000000000000":"":"fffffffffffffffffffffe0000000000":"db0d3a6fdcc13f915e2b302ceeb70fd8":0 + +AES-192-ECB crypt Encrypt NIST KAT #4 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_ENCRYPT:"000000000000000000000000000000000000000000000000":"":"51719783d3185a535bd75adc65071ce1":"4f354592ff7c8847d2d0870ca9481b7c":0 + +AES-192-ECB crypt Encrypt NIST KAT #5 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_ENCRYPT:"000000000000000000000000000000000000000000000000":"":"26aa49dcfe7629a8901a69a9914e6dfd":"d5e08bf9a182e857cf40b3a36ee248cc":0 + +AES-192-ECB crypt Encrypt NIST KAT #6 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_ENCRYPT:"000000000000000000000000000000000000000000000000":"":"941a4773058224e1ef66d10e0a6ee782":"067cd9d3749207791841562507fa9626":0 + +AES-192-ECB crypt Encrypt NIST KAT #7 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_ENCRYPT:"d2926527e0aa9f37b45e2ec2ade5853ef807576104c7ace3":"":"00000000000000000000000000000000":"dd619e1cf204446112e0af2b9afa8f8c":0 + +AES-192-ECB crypt Encrypt NIST KAT #8 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_ENCRYPT:"982215f4e173dfa0fcffe5d3da41c4812c7bcc8ed3540f93":"":"00000000000000000000000000000000":"d4f0aae13c8fe9339fbf9e69ed0ad74d":0 + +AES-192-ECB crypt Encrypt NIST KAT #9 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_ENCRYPT:"98c6b8e01e379fbd14e61af6af891596583565f2a27d59e9":"":"00000000000000000000000000000000":"19c80ec4a6deb7e5ed1033dda933498f":0 + +AES-192-ECB crypt Encrypt NIST KAT #10 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_ENCRYPT:"fffffffffffffffffffffffffff800000000000000000000":"":"00000000000000000000000000000000":"8dd274bd0f1b58ae345d9e7233f9b8f3":0 + +AES-192-ECB crypt Encrypt NIST KAT #11 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_ENCRYPT:"fffffffffffffffffffffffffffc00000000000000000000":"":"00000000000000000000000000000000":"9d6bdc8f4ce5feb0f3bed2e4b9a9bb0b":0 + +AES-192-ECB crypt Encrypt NIST KAT #12 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_ENCRYPT:"fffffffffffffffffffffffffffe00000000000000000000":"":"00000000000000000000000000000000":"fd5548bcf3f42565f7efa94562528d46":0 + +AES-192-ECB crypt Decrypt NIST KAT #1 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_DECRYPT:"fffffffffffffffffffffffffffffffff000000000000000":"":"bb2852c891c5947d2ed44032c421b85f":"00000000000000000000000000000000":0 + +AES-192-ECB crypt Decrypt NIST KAT #2 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_DECRYPT:"fffffffffffffffffffffffffffffffff800000000000000":"":"1b9f5fbd5e8a4264c0a85b80409afa5e":"00000000000000000000000000000000":0 + +AES-192-ECB crypt Decrypt NIST KAT #3 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_DECRYPT:"fffffffffffffffffffffffffffffffffc00000000000000":"":"30dab809f85a917fe924733f424ac589":"00000000000000000000000000000000":0 + +AES-192-ECB crypt Decrypt NIST KAT #4 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_DECRYPT:"61257134a518a0d57d9d244d45f6498cbc32f2bafc522d79":"":"cfe4d74002696ccf7d87b14a2f9cafc9":"00000000000000000000000000000000":0 + +AES-192-ECB crypt Decrypt NIST KAT #5 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_DECRYPT:"b0ab0a6a818baef2d11fa33eac947284fb7d748cfb75e570":"":"d2eafd86f63b109b91f5dbb3a3fb7e13":"00000000000000000000000000000000":0 + +AES-192-ECB crypt Decrypt NIST KAT #6 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_DECRYPT:"ee053aa011c8b428cdcc3636313c54d6a03cac01c71579d6":"":"9b9fdd1c5975655f539998b306a324af":"00000000000000000000000000000000":0 + +AES-192-ECB crypt Decrypt NIST KAT #7 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_DECRYPT:"000000000000000000000000000000000000000000000000":"":"275cfc0413d8ccb70513c3859b1d0f72":"1b077a6af4b7f98229de786d7516b639":0 + +AES-192-ECB crypt Decrypt NIST KAT #8 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_DECRYPT:"000000000000000000000000000000000000000000000000":"":"c9b8135ff1b5adc413dfd053b21bd96d":"9c2d8842e5f48f57648205d39a239af1":0 + +AES-192-ECB crypt Decrypt NIST KAT #9 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_DECRYPT:"000000000000000000000000000000000000000000000000":"":"4a3650c3371ce2eb35e389a171427440":"bff52510095f518ecca60af4205444bb":0 + +AES-192-ECB crypt Decrypt NIST KAT #10 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_DECRYPT:"000000000000000000000000000000000000000000000000":"":"b2099795e88cc158fd75ea133d7e7fbe":"ffffffffffffffffffffc00000000000":0 + +AES-192-ECB crypt Decrypt NIST KAT #11 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_DECRYPT:"000000000000000000000000000000000000000000000000":"":"a6cae46fb6fadfe7a2c302a34242817b":"ffffffffffffffffffffe00000000000":0 + +AES-192-ECB crypt Decrypt NIST KAT #12 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_DECRYPT:"000000000000000000000000000000000000000000000000":"":"026a7024d6a902e0b3ffccbaa910cc3f":"fffffffffffffffffffff00000000000":0 + +AES-256-ECB crypt Encrypt NIST KAT #1 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_ENCRYPT:"c1cc358b449909a19436cfbb3f852ef8bcb5ed12ac7058325f56e6099aab1a1c":"":"00000000000000000000000000000000":"352065272169abf9856843927d0674fd":0 + +AES-256-ECB crypt Encrypt NIST KAT #2 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_ENCRYPT:"984ca75f4ee8d706f46c2d98c0bf4a45f5b00d791c2dfeb191b5ed8e420fd627":"":"00000000000000000000000000000000":"4307456a9e67813b452e15fa8fffe398":0 + +AES-256-ECB crypt Encrypt NIST KAT #3 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_ENCRYPT:"b43d08a447ac8609baadae4ff12918b9f68fc1653f1269222f123981ded7a92f":"":"00000000000000000000000000000000":"4663446607354989477a5c6f0f007ef4":0 + +AES-256-ECB crypt Encrypt NIST KAT #4 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_ENCRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"":"0b24af36193ce4665f2825d7b4749c98":"a9ff75bd7cf6613d3731c77c3b6d0c04":0 + +AES-256-ECB crypt Encrypt NIST KAT #5 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_ENCRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"":"761c1fe41a18acf20d241650611d90f1":"623a52fcea5d443e48d9181ab32c7421":0 + +AES-256-ECB crypt Encrypt NIST KAT #6 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_ENCRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"":"8a560769d605868ad80d819bdba03771":"38f2c7ae10612415d27ca190d27da8b4":0 + +AES-256-ECB crypt Encrypt NIST KAT #7 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_ENCRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"":"ffffff80000000000000000000000000":"36aff0ef7bf3280772cf4cac80a0d2b2":0 + +AES-256-ECB crypt Encrypt NIST KAT #8 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_ENCRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"":"ffffffc0000000000000000000000000":"1f8eedea0f62a1406d58cfc3ecea72cf":0 + +AES-256-ECB crypt Encrypt NIST KAT #9 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_ENCRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"":"ffffffe0000000000000000000000000":"abf4154a3375a1d3e6b1d454438f95a6":0 + +AES-256-ECB crypt Encrypt NIST KAT #10 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_ENCRYPT:"ffffffffffffffffffffffffffffffffffff8000000000000000000000000000":"":"00000000000000000000000000000000":"45d089c36d5c5a4efc689e3b0de10dd5":0 + +AES-256-ECB crypt Encrypt NIST KAT #11 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_ENCRYPT:"ffffffffffffffffffffffffffffffffffffc000000000000000000000000000":"":"00000000000000000000000000000000":"b4da5df4becb5462e03a0ed00d295629":0 + +AES-256-ECB crypt Encrypt NIST KAT #12 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_ENCRYPT:"ffffffffffffffffffffffffffffffffffffe000000000000000000000000000":"":"00000000000000000000000000000000":"dcf4e129136c1a4b7a0f38935cc34b2b":0 + +AES-256-ECB crypt Decrypt NIST KAT #1 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_DECRYPT:"fffffffffffffffffffffffffffffffffffffffffffffff00000000000000000":"":"edf61ae362e882ddc0167474a7a77f3a":"00000000000000000000000000000000":0 + +AES-256-ECB crypt Decrypt NIST KAT #2 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_DECRYPT:"fffffffffffffffffffffffffffffffffffffffffffffff80000000000000000":"":"6168b00ba7859e0970ecfd757efecf7c":"00000000000000000000000000000000":0 + +AES-256-ECB crypt Decrypt NIST KAT #3 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_DECRYPT:"fffffffffffffffffffffffffffffffffffffffffffffffc0000000000000000":"":"d1415447866230d28bb1ea18a4cdfd02":"00000000000000000000000000000000":0 + +AES-256-ECB crypt Decrypt NIST KAT #4 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_DECRYPT:"f8be9ba615c5a952cabbca24f68f8593039624d524c816acda2c9183bd917cb9":"":"a3944b95ca0b52043584ef02151926a8":"00000000000000000000000000000000":0 + +AES-256-ECB crypt Decrypt NIST KAT #5 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_DECRYPT:"797f8b3d176dac5b7e34a2d539c4ef367a16f8635f6264737591c5c07bf57a3e":"":"a74289fe73a4c123ca189ea1e1b49ad5":"00000000000000000000000000000000":0 + +AES-256-ECB crypt Decrypt NIST KAT #6 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_DECRYPT:"6838d40caf927749c13f0329d331f448e202c73ef52c5f73a37ca635d4c47707":"":"b91d4ea4488644b56cf0812fa7fcf5fc":"00000000000000000000000000000000":0 + +AES-256-ECB crypt Decrypt NIST KAT #7 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_DECRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"":"623a52fcea5d443e48d9181ab32c7421":"761c1fe41a18acf20d241650611d90f1":0 + +AES-256-ECB crypt Decrypt NIST KAT #8 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_DECRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"":"38f2c7ae10612415d27ca190d27da8b4":"8a560769d605868ad80d819bdba03771":0 + +AES-256-ECB crypt Decrypt NIST KAT #9 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_DECRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"":"1bc704f1bce135ceb810341b216d7abe":"91fbef2d15a97816060bee1feaa49afe":0 + +AES-256-ECB crypt Decrypt NIST KAT #10 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_DECRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"":"ddc6bf790c15760d8d9aeb6f9a75fd4e":"80000000000000000000000000000000":0 + +AES-256-ECB crypt Decrypt NIST KAT #11 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_DECRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"":"0a6bdc6d4c1e6280301fd8e97ddbe601":"c0000000000000000000000000000000":0 + +AES-256-ECB crypt Decrypt NIST KAT #12 +depends_on:MBEDTLS_AES_C +test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_DECRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"":"9b80eefb7ebe2d2b16247aa0efc72f5d":"e0000000000000000000000000000000":0 + +AES-128-CBC crypt Encrypt NIST KAT #1 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_ENCRYPT:"00000000000000000000000000000000":"00000000000000000000000000000000":"80000000000000000000000000000000":"3ad78e726c1ec02b7ebfe92b23d9ec34":0 + +AES-128-CBC crypt Encrypt NIST KAT #2 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_ENCRYPT:"00000000000000000000000000000000":"00000000000000000000000000000000":"c0000000000000000000000000000000":"aae5939c8efdf2f04e60b9fe7117b2c2":0 + +AES-128-CBC crypt Encrypt NIST KAT #3 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_ENCRYPT:"00000000000000000000000000000000":"00000000000000000000000000000000":"e0000000000000000000000000000000":"f031d4d74f5dcbf39daaf8ca3af6e527":0 + +AES-128-CBC crypt Encrypt NIST KAT #4 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_ENCRYPT:"00000000000000000000000000000000":"00000000000000000000000000000000":"f0000000000000000000000000000000":"96d9fd5cc4f07441727df0f33e401a36":0 + +AES-128-CBC crypt Encrypt NIST KAT #5 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_ENCRYPT:"ff000000000000000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"b1d758256b28fd850ad4944208cf1155":0 + +AES-128-CBC crypt Encrypt NIST KAT #6 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_ENCRYPT:"ffffc000000000000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"df556a33438db87bc41b1752c55e5e49":0 + +AES-128-CBC crypt Encrypt NIST KAT #7 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_ENCRYPT:"ffffffffffffffffffffffffffffe000":"00000000000000000000000000000000":"00000000000000000000000000000000":"323994cfb9da285a5d9642e1759b224a":0 + +AES-128-CBC crypt Encrypt NIST KAT #8 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_ENCRYPT:"10a58869d74be5a374cf867cfb473859":"00000000000000000000000000000000":"00000000000000000000000000000000":"6d251e6944b051e04eaa6fb4dbf78465":0 + +AES-128-CBC crypt Encrypt NIST KAT #9 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_ENCRYPT:"caea65cdbb75e9169ecd22ebe6e54675":"00000000000000000000000000000000":"00000000000000000000000000000000":"6e29201190152df4ee058139def610bb":0 + +AES-128-CBC crypt Encrypt NIST KAT #10 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_ENCRYPT:"b6364ac4e1de1e285eaf144a2415f7a0":"00000000000000000000000000000000":"00000000000000000000000000000000":"5d9b05578fc944b3cf1ccf0e746cd581":0 + +AES-128-CBC crypt Encrypt NIST KAT #11 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_ENCRYPT:"00000000000000000000000000000000":"00000000000000000000000000000000":"f34481ec3cc627bacd5dc3fb08f273e6":"0336763e966d92595a567cc9ce537f5e":0 + +AES-128-CBC crypt Encrypt NIST KAT #12 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_ENCRYPT:"00000000000000000000000000000000":"00000000000000000000000000000000":"9798c4640bad75c7c3227db910174e72":"a9a1631bf4996954ebc093957b234589":0 + +AES-128-CBC crypt Encrypt NIST KAT #13 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_ENCRYPT:"00000000000000000000000000000000":"00000000000000000000000000000000":"96ab5c2ff612d9dfaae8c31f30c42168":"ff4f8391a6a40ca5b25d23bedd44a597":0 + +AES-128-CBC crypt Decrypt NIST KAT #1 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_DECRYPT:"00000000000000000000000000000000":"00000000000000000000000000000000":"3ad78e726c1ec02b7ebfe92b23d9ec34":"80000000000000000000000000000000":0 + +AES-128-CBC crypt Decrypt NIST KAT #2 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_DECRYPT:"00000000000000000000000000000000":"00000000000000000000000000000000":"aae5939c8efdf2f04e60b9fe7117b2c2":"c0000000000000000000000000000000":0 + +AES-128-CBC crypt Decrypt NIST KAT #3 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_DECRYPT:"00000000000000000000000000000000":"00000000000000000000000000000000":"f031d4d74f5dcbf39daaf8ca3af6e527":"e0000000000000000000000000000000":0 + +AES-128-CBC crypt Decrypt NIST KAT #4 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_DECRYPT:"00000000000000000000000000000000":"00000000000000000000000000000000":"96d9fd5cc4f07441727df0f33e401a36":"f0000000000000000000000000000000":0 + +AES-128-CBC crypt Decrypt NIST KAT #5 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_DECRYPT:"ff000000000000000000000000000000":"00000000000000000000000000000000":"b1d758256b28fd850ad4944208cf1155":"00000000000000000000000000000000":0 + +AES-128-CBC crypt Decrypt NIST KAT #6 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_DECRYPT:"ffffc000000000000000000000000000":"00000000000000000000000000000000":"df556a33438db87bc41b1752c55e5e49":"00000000000000000000000000000000":0 + +AES-128-CBC crypt Decrypt NIST KAT #7 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_DECRYPT:"ffffffffffffffffffffffffffffe000":"00000000000000000000000000000000":"323994cfb9da285a5d9642e1759b224a":"00000000000000000000000000000000":0 + +AES-128-CBC crypt Decrypt NIST KAT #8 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_DECRYPT:"10a58869d74be5a374cf867cfb473859":"00000000000000000000000000000000":"6d251e6944b051e04eaa6fb4dbf78465":"00000000000000000000000000000000":0 + +AES-128-CBC crypt Decrypt NIST KAT #9 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_DECRYPT:"caea65cdbb75e9169ecd22ebe6e54675":"00000000000000000000000000000000":"6e29201190152df4ee058139def610bb":"00000000000000000000000000000000":0 + +AES-128-CBC crypt Decrypt NIST KAT #10 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_DECRYPT:"b6364ac4e1de1e285eaf144a2415f7a0":"00000000000000000000000000000000":"5d9b05578fc944b3cf1ccf0e746cd581":"00000000000000000000000000000000":0 + +AES-128-CBC crypt Decrypt NIST KAT #11 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_DECRYPT:"00000000000000000000000000000000":"00000000000000000000000000000000":"0336763e966d92595a567cc9ce537f5e":"f34481ec3cc627bacd5dc3fb08f273e6":0 + +AES-128-CBC crypt Decrypt NIST KAT #12 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_DECRYPT:"00000000000000000000000000000000":"00000000000000000000000000000000":"a9a1631bf4996954ebc093957b234589":"9798c4640bad75c7c3227db910174e72":0 + +AES-128-CBC crypt Decrypt NIST KAT #13 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_DECRYPT:"00000000000000000000000000000000":"00000000000000000000000000000000":"ff4f8391a6a40ca5b25d23bedd44a597":"96ab5c2ff612d9dfaae8c31f30c42168":0 + +AES-192-CBC crypt Encrypt NIST KAT #1 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_ENCRYPT:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"80000000000000000000000000000000":"6cd02513e8d4dc986b4afe087a60bd0c":0 + +AES-192-CBC crypt Encrypt NIST KAT #2 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_ENCRYPT:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"c0000000000000000000000000000000":"2ce1f8b7e30627c1c4519eada44bc436":0 + +AES-192-CBC crypt Encrypt NIST KAT #3 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_ENCRYPT:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"e0000000000000000000000000000000":"9946b5f87af446f5796c1fee63a2da24":0 + +AES-192-CBC crypt Encrypt NIST KAT #4 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_ENCRYPT:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"f0000000000000000000000000000000":"2a560364ce529efc21788779568d5555":0 + +AES-192-CBC crypt Encrypt NIST KAT #5 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_ENCRYPT:"ff0000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"833f71258d53036b02952c76c744f5a1":0 + +AES-192-CBC crypt Encrypt NIST KAT #6 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_ENCRYPT:"ffffc0000000000000000000000000000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"b2f8b409b0585909aad3a7b5a219072a":0 + +AES-192-CBC crypt Encrypt NIST KAT #7 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_ENCRYPT:"ffffffffffffffffffffffffffffffffffffffffffffe000":"00000000000000000000000000000000":"00000000000000000000000000000000":"75db7cfd4a7b2b62ab78a48f3ddaf4af":0 + +AES-192-CBC crypt Encrypt NIST KAT #8 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_ENCRYPT:"e9f065d7c13573587f7875357dfbb16c53489f6a4bd0f7cd":"00000000000000000000000000000000":"00000000000000000000000000000000":"0956259c9cd5cfd0181cca53380cde06":0 + +AES-192-CBC crypt Encrypt NIST KAT #9 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_ENCRYPT:"15d20f6ebc7e649fd95b76b107e6daba967c8a9484797f29":"00000000000000000000000000000000":"00000000000000000000000000000000":"8e4e18424e591a3d5b6f0876f16f8594":0 + +AES-192-CBC crypt Encrypt NIST KAT #10 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_ENCRYPT:"a8a282ee31c03fae4f8e9b8930d5473c2ed695a347e88b7c":"00000000000000000000000000000000":"00000000000000000000000000000000":"93f3270cfc877ef17e106ce938979cb0":0 + +AES-192-CBC crypt Encrypt NIST KAT #11 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_ENCRYPT:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"1b077a6af4b7f98229de786d7516b639":"275cfc0413d8ccb70513c3859b1d0f72":0 + +AES-192-CBC crypt Encrypt NIST KAT #12 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_ENCRYPT:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"9c2d8842e5f48f57648205d39a239af1":"c9b8135ff1b5adc413dfd053b21bd96d":0 + +AES-192-CBC crypt Encrypt NIST KAT #13 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_ENCRYPT:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"bff52510095f518ecca60af4205444bb":"4a3650c3371ce2eb35e389a171427440":0 + +AES-192-CBC crypt Decrypt NIST KAT #1 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_DECRYPT:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"6cd02513e8d4dc986b4afe087a60bd0c":"80000000000000000000000000000000":0 + +AES-192-CBC crypt Decrypt NIST KAT #2 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_DECRYPT:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"2ce1f8b7e30627c1c4519eada44bc436":"c0000000000000000000000000000000":0 + +AES-192-CBC crypt Decrypt NIST KAT #3 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_DECRYPT:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"9946b5f87af446f5796c1fee63a2da24":"e0000000000000000000000000000000":0 + +AES-192-CBC crypt Decrypt NIST KAT #4 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_DECRYPT:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"2a560364ce529efc21788779568d5555":"f0000000000000000000000000000000":0 + +AES-192-CBC crypt Decrypt NIST KAT #5 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_DECRYPT:"ffe000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"7ababc4b3f516c9aafb35f4140b548f9":"00000000000000000000000000000000":0 + +AES-192-CBC crypt Decrypt NIST KAT #6 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_DECRYPT:"ffffc0000000000000000000000000000000000000000000":"00000000000000000000000000000000":"b2f8b409b0585909aad3a7b5a219072a":"00000000000000000000000000000000":0 + +AES-192-CBC crypt Decrypt NIST KAT #7 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_DECRYPT:"ffffffffffffffffffffffffffffffffffffffffffffe000":"00000000000000000000000000000000":"75db7cfd4a7b2b62ab78a48f3ddaf4af":"00000000000000000000000000000000":0 + +AES-192-CBC crypt Decrypt NIST KAT #8 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_DECRYPT:"e9f065d7c13573587f7875357dfbb16c53489f6a4bd0f7cd":"00000000000000000000000000000000":"0956259c9cd5cfd0181cca53380cde06":"00000000000000000000000000000000":0 + +AES-192-CBC crypt Decrypt NIST KAT #9 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_DECRYPT:"15d20f6ebc7e649fd95b76b107e6daba967c8a9484797f29":"00000000000000000000000000000000":"8e4e18424e591a3d5b6f0876f16f8594":"00000000000000000000000000000000":0 + +AES-192-CBC crypt Decrypt NIST KAT #10 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_DECRYPT:"a8a282ee31c03fae4f8e9b8930d5473c2ed695a347e88b7c":"00000000000000000000000000000000":"93f3270cfc877ef17e106ce938979cb0":"00000000000000000000000000000000":0 + +AES-192-CBC crypt Decrypt NIST KAT #11 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_DECRYPT:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"275cfc0413d8ccb70513c3859b1d0f72":"1b077a6af4b7f98229de786d7516b639":0 + +AES-192-CBC crypt Decrypt NIST KAT #12 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_DECRYPT:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"c9b8135ff1b5adc413dfd053b21bd96d":"9c2d8842e5f48f57648205d39a239af1":0 + +AES-192-CBC crypt Decrypt NIST KAT #13 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_DECRYPT:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"4a3650c3371ce2eb35e389a171427440":"bff52510095f518ecca60af4205444bb":0 + +AES-256-CBC crypt Encrypt NIST KAT #1 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_ENCRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"80000000000000000000000000000000":"ddc6bf790c15760d8d9aeb6f9a75fd4e":0 + +AES-256-CBC crypt Encrypt NIST KAT #2 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_ENCRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"c0000000000000000000000000000000":"0a6bdc6d4c1e6280301fd8e97ddbe601":0 + +AES-256-CBC crypt Encrypt NIST KAT #3 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_ENCRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"e0000000000000000000000000000000":"9b80eefb7ebe2d2b16247aa0efc72f5d":0 + +AES-256-CBC crypt Encrypt NIST KAT #4 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_ENCRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"f0000000000000000000000000000000":"7f2c5ece07a98d8bee13c51177395ff7":0 + +AES-256-CBC crypt Encrypt NIST KAT #5 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_ENCRYPT:"ff00000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"ec52a212f80a09df6317021bc2a9819e":0 + +AES-256-CBC crypt Encrypt NIST KAT #6 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_ENCRYPT:"ffffc00000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"27ef2495dabf323885aab39c80f18d8b":0 + +AES-256-CBC crypt Encrypt NIST KAT #7 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_ENCRYPT:"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe000":"00000000000000000000000000000000":"00000000000000000000000000000000":"50e6d3c9b6698a7cd276f96b1473f35a":0 + +AES-256-CBC crypt Encrypt NIST KAT #8 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_ENCRYPT:"c47b0294dbbbee0fec4757f22ffeee3587ca4730c3d33b691df38bab076bc558":"00000000000000000000000000000000":"00000000000000000000000000000000":"46f2fb342d6f0ab477476fc501242c5f":0 + +AES-256-CBC crypt Encrypt NIST KAT #9 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_ENCRYPT:"28d46cffa158533194214a91e712fc2b45b518076675affd910edeca5f41ac64":"00000000000000000000000000000000":"00000000000000000000000000000000":"4bf3b0a69aeb6657794f2901b1440ad4":0 + +AES-256-CBC crypt Encrypt NIST KAT #10 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_ENCRYPT:"c1cc358b449909a19436cfbb3f852ef8bcb5ed12ac7058325f56e6099aab1a1c":"00000000000000000000000000000000":"00000000000000000000000000000000":"352065272169abf9856843927d0674fd":0 + +AES-256-CBC crypt Encrypt NIST KAT #11 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_ENCRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"014730f80ac625fe84f026c60bfd547d":"5c9d844ed46f9885085e5d6a4f94c7d7":0 + +AES-256-CBC crypt Encrypt NIST KAT #12 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_ENCRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"0b24af36193ce4665f2825d7b4749c98":"a9ff75bd7cf6613d3731c77c3b6d0c04":0 + +AES-256-CBC crypt Encrypt NIST KAT #13 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_ENCRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"761c1fe41a18acf20d241650611d90f1":"623a52fcea5d443e48d9181ab32c7421":0 + +AES-256-CBC crypt Decrypt NIST KAT #1 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_DECRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"ddc6bf790c15760d8d9aeb6f9a75fd4e":"80000000000000000000000000000000":0 + +AES-256-CBC crypt Decrypt NIST KAT #2 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_DECRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"0a6bdc6d4c1e6280301fd8e97ddbe601":"c0000000000000000000000000000000":0 + +AES-256-CBC crypt Decrypt NIST KAT #3 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_DECRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"9b80eefb7ebe2d2b16247aa0efc72f5d":"e0000000000000000000000000000000":0 + +AES-256-CBC crypt Decrypt NIST KAT #4 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_DECRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"7f2c5ece07a98d8bee13c51177395ff7":"f0000000000000000000000000000000":0 + +AES-256-CBC crypt Decrypt NIST KAT #5 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_DECRYPT:"ffe0000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"d1ccb9b1337002cbac42c520b5d67722":"00000000000000000000000000000000":0 + +AES-256-CBC crypt Decrypt NIST KAT #6 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_DECRYPT:"ffffc00000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"27ef2495dabf323885aab39c80f18d8b":"00000000000000000000000000000000":0 + +AES-256-CBC crypt Decrypt NIST KAT #7 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_DECRYPT:"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe000":"00000000000000000000000000000000":"50e6d3c9b6698a7cd276f96b1473f35a":"00000000000000000000000000000000":0 + +AES-256-CBC crypt Decrypt NIST KAT #8 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_DECRYPT:"c47b0294dbbbee0fec4757f22ffeee3587ca4730c3d33b691df38bab076bc558":"00000000000000000000000000000000":"46f2fb342d6f0ab477476fc501242c5f":"00000000000000000000000000000000":0 + +AES-256-CBC crypt Decrypt NIST KAT #9 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_DECRYPT:"28d46cffa158533194214a91e712fc2b45b518076675affd910edeca5f41ac64":"00000000000000000000000000000000":"4bf3b0a69aeb6657794f2901b1440ad4":"00000000000000000000000000000000":0 + +AES-256-CBC crypt Decrypt NIST KAT #10 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_DECRYPT:"c1cc358b449909a19436cfbb3f852ef8bcb5ed12ac7058325f56e6099aab1a1c":"00000000000000000000000000000000":"352065272169abf9856843927d0674fd":"00000000000000000000000000000000":0 + +AES-256-CBC crypt Decrypt NIST KAT #11 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_DECRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"5c9d844ed46f9885085e5d6a4f94c7d7":"014730f80ac625fe84f026c60bfd547d":0 + +AES-256-CBC crypt Decrypt NIST KAT #12 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_DECRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"a9ff75bd7cf6613d3731c77c3b6d0c04":"0b24af36193ce4665f2825d7b4749c98":0 + +AES-256-CBC crypt Decrypt NIST KAT #13 +depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC +test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_DECRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"623a52fcea5d443e48d9181ab32c7421":"761c1fe41a18acf20d241650611d90f1":0 + Cipher Corner Case behaviours depends_on:MBEDTLS_AES_C cipher_special_behaviours: diff --git a/tests/suites/test_suite_cipher.function b/tests/suites/test_suite_cipher.function index 8f1109ee8..581cc78a5 100644 --- a/tests/suites/test_suite_cipher.function +++ b/tests/suites/test_suite_cipher.function @@ -107,7 +107,7 @@ void cipher_special_behaviours( ) memset( iv, 0, sizeof( iv ) ); /* Check and get info structures */ - cipher_info = mbedtls_cipher_info_from_type( MBEDTLS_CIPHER_AES_128_ECB ); + cipher_info = mbedtls_cipher_info_from_type( MBEDTLS_CIPHER_AES_128_CBC ); TEST_ASSERT( NULL != cipher_info ); TEST_ASSERT( 0 == mbedtls_cipher_setup( &ctx, cipher_info ) ); @@ -120,6 +120,12 @@ void cipher_special_behaviours( ) TEST_ASSERT( mbedtls_cipher_set_iv( &ctx, iv, 0 ) == MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA ); + mbedtls_cipher_free( &ctx ); + cipher_info = mbedtls_cipher_info_from_type( MBEDTLS_CIPHER_AES_128_ECB ); + TEST_ASSERT( NULL != cipher_info ); + + TEST_ASSERT( 0 == mbedtls_cipher_setup( &ctx, cipher_info ) ); + /* Update ECB with partial block */ TEST_ASSERT( mbedtls_cipher_update( &ctx, input, 1, output, &olen ) == MBEDTLS_ERR_CIPHER_FULL_BLOCK_EXPECTED ); @@ -690,6 +696,55 @@ exit: } /* END_CASE */ +/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_WITH_PADDING */ +void test_vec_crypt( int cipher_id, int operation, char *hex_key, + char *hex_iv, char *hex_input, char *hex_result, + int finish_result ) +{ + unsigned char key[50]; + unsigned char input[16]; + unsigned char result[16]; + unsigned char iv[16]; + size_t key_len, iv_len, inputlen, resultlen; + mbedtls_cipher_context_t ctx; + unsigned char output[32]; + size_t outlen; + + mbedtls_cipher_init( &ctx ); + + memset( key, 0x00, sizeof( key ) ); + memset( input, 0x00, sizeof( input ) ); + memset( result, 0x00, sizeof( result ) ); + memset( output, 0x00, sizeof( output ) ); + memset( iv, 0x00, sizeof( iv ) ); + + /* Prepare context */ + TEST_ASSERT( 0 == mbedtls_cipher_setup( &ctx, + mbedtls_cipher_info_from_type( cipher_id ) ) ); + + key_len = unhexify( key, hex_key ); + inputlen = unhexify( input, hex_input ); + resultlen = unhexify( result, hex_result ); + + TEST_ASSERT( 0 == mbedtls_cipher_setkey( &ctx, key, 8 * key_len, operation ) ); + if( MBEDTLS_MODE_CBC == ctx.cipher_info->mode ) + TEST_ASSERT( 0 == mbedtls_cipher_set_padding_mode( &ctx, MBEDTLS_PADDING_NONE ) ); + + iv_len = unhexify( iv, hex_iv ); + + TEST_ASSERT( finish_result == mbedtls_cipher_crypt( &ctx, iv_len ? iv : NULL, + iv_len, input, inputlen, + output, &outlen ) ); + TEST_ASSERT( resultlen == outlen ); + /* check plaintext only if everything went fine */ + if( 0 == finish_result ) + TEST_ASSERT( 0 == memcmp( output, result, outlen ) ); + +exit: + mbedtls_cipher_free( &ctx ); +} +/* END_CASE */ + /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_WITH_PADDING */ void set_padding( int cipher_id, int pad_mode, int ret ) { From efba4b077b5f6017de20d50eeddb357ae771889e Mon Sep 17 00:00:00 2001 From: Ron Eldor Date: Mon, 25 Sep 2017 18:22:32 +0300 Subject: [PATCH 2/4] Fix after PR comments 1. Don't set IV onECB 2. Fix style issues 3. reduce number of tests --- library/cipher.c | 18 +- library/cipher_wrap.c | 6 +- tests/suites/test_suite_cipher.aes.data | 480 ++---------------------- tests/suites/test_suite_cipher.function | 6 +- 4 files changed, 36 insertions(+), 474 deletions(-) diff --git a/library/cipher.c b/library/cipher.c index 67c3d3046..220fbab1f 100644 --- a/library/cipher.c +++ b/library/cipher.c @@ -215,15 +215,11 @@ int mbedtls_cipher_set_iv( mbedtls_cipher_context_t *ctx, const unsigned char *iv, size_t iv_len ) { size_t actual_iv_size; - if( NULL == ctx || NULL == ctx->cipher_info || - ( NULL == iv && ( ctx->cipher_info->mode != MBEDTLS_MODE_ECB ) ) ) + if( NULL == ctx || NULL == ctx->cipher_info ) + return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA ); + else if( NULL == iv && iv_len != 0 ) return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA ); - if ( ctx->cipher_info->mode == MBEDTLS_MODE_ECB ) - { - ctx->iv_size = 0; - return ( 0 ); - } /* avoid buffer overflow in ctx->iv */ if( iv_len > MBEDTLS_MAX_IV_LENGTH ) return( MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE ); @@ -238,9 +234,11 @@ int mbedtls_cipher_set_iv( mbedtls_cipher_context_t *ctx, if( actual_iv_size > iv_len ) return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA ); } - - memcpy( ctx->iv, iv, actual_iv_size ); - ctx->iv_size = actual_iv_size; + if ( actual_iv_size ) + { + memcpy( ctx->iv, iv, actual_iv_size ); + ctx->iv_size = actual_iv_size; + } return( 0 ); } diff --git a/library/cipher_wrap.c b/library/cipher_wrap.c index dc76af8ff..dbc5d3fe4 100644 --- a/library/cipher_wrap.c +++ b/library/cipher_wrap.c @@ -204,7 +204,7 @@ static const mbedtls_cipher_info_t aes_128_ecb_info = { MBEDTLS_MODE_ECB, 128, "AES-128-ECB", - 16, + 0, 0, 16, &aes_info @@ -215,7 +215,7 @@ static const mbedtls_cipher_info_t aes_192_ecb_info = { MBEDTLS_MODE_ECB, 192, "AES-192-ECB", - 16, + 0, 0, 16, &aes_info @@ -226,7 +226,7 @@ static const mbedtls_cipher_info_t aes_256_ecb_info = { MBEDTLS_MODE_ECB, 256, "AES-256-ECB", - 16, + 0, 0, 16, &aes_info diff --git a/tests/suites/test_suite_cipher.aes.data b/tests/suites/test_suite_cipher.aes.data index 84d487767..b93d4de9a 100644 --- a/tests/suites/test_suite_cipher.aes.data +++ b/tests/suites/test_suite_cipher.aes.data @@ -1128,113 +1128,21 @@ test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"000000000000000000000 AES-128-ECB crypt Encrypt NIST KAT #2 depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"00000000000000000000000000000000":"":"9798c4640bad75c7c3227db910174e72":"a9a1631bf4996954ebc093957b234589":0 +test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"f0000000000000000000000000000000":"":"00000000000000000000000000000000":"970014d634e2b7650777e8e84d03ccd8":0 AES-128-ECB crypt Encrypt NIST KAT #3 depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"00000000000000000000000000000000":"":"96ab5c2ff612d9dfaae8c31f30c42168":"ff4f8391a6a40ca5b25d23bedd44a597":0 - -AES-128-ECB crypt Encrypt NIST KAT #4 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"e0000000000000000000000000000000":"":"00000000000000000000000000000000":"72a1da770f5d7ac4c9ef94d822affd97":0 - -AES-128-ECB crypt Encrypt NIST KAT #5 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"f0000000000000000000000000000000":"":"00000000000000000000000000000000":"970014d634e2b7650777e8e84d03ccd8":0 - -AES-128-ECB crypt Encrypt NIST KAT #6 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"f8000000000000000000000000000000":"":"00000000000000000000000000000000":"f17e79aed0db7e279e955b5f493875a7":0 - -AES-128-ECB crypt Encrypt NIST KAT #7 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"fffffffffffff0000000000000000000":"":"00000000000000000000000000000000":"7b90785125505fad59b13c186dd66ce3":0 - -AES-128-ECB crypt Encrypt NIST KAT #8 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"fffffffffffff8000000000000000000":"":"00000000000000000000000000000000":"8b527a6aebdaec9eaef8eda2cb7783e5":0 - -AES-128-ECB crypt Encrypt NIST KAT #9 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"fffffffffffffc000000000000000000":"":"00000000000000000000000000000000":"43fdaf53ebbc9880c228617d6a9b548b":0 - -AES-128-ECB crypt Encrypt NIST KAT #10 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"ffffffffffffffffffffffffffffc000":"":"00000000000000000000000000000000":"70c46bb30692be657f7eaa93ebad9897":0 - -AES-128-ECB crypt Encrypt NIST KAT #11 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"ffffffffffffffffffffffffffffe000":"":"00000000000000000000000000000000":"323994cfb9da285a5d9642e1759b224a":0 - -AES-128-ECB crypt Encrypt NIST KAT #12 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"fffffffffffffffffffffffffffff000":"":"00000000000000000000000000000000":"1dbf57877b7b17385c85d0b54851e371":0 - -AES-128-ECB crypt Encrypt NIST KAT #13 -depends_on:MBEDTLS_AES_C test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"00000000000000000000000000000000":"":"ffffffffffffffc00000000000000000":"3a4d354f02bb5a5e47d39666867f246a":0 -AES-128-ECB crypt Encrypt NIST KAT #14 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"00000000000000000000000000000000":"":"ffffffffffffffe00000000000000000":"d451b8d6e1e1a0ebb155fbbf6e7b7dc3":0 - -AES-128-ECB crypt Encrypt NIST KAT #15 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"00000000000000000000000000000000":"":"fffffffffffffff00000000000000000":"6898d4f42fa7ba6a10ac05e87b9f2080":0 - -AES-128-ECB crypt Encrypt NIST KAT #16 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"00000000000000000000000000000000":"":"ffffffffffffffffffffffffe0000000":"082eb8be35f442fb52668e16a591d1d6":0 - -AES-128-ECB crypt Encrypt NIST KAT #17 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"00000000000000000000000000000000":"":"fffffffffffffffffffffffff0000000":"e656f9ecf5fe27ec3e4a73d00c282fb3":0 - -AES-128-ECB crypt Encrypt NIST KAT #18 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_ENCRYPT:"00000000000000000000000000000000":"":"fffffffffffffffffffffffff8000000":"2ca8209d63274cd9a29bb74bcd77683a":0 - AES-128-ECB crypt Decrypt NIST KAT #1 depends_on:MBEDTLS_AES_C test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_DECRYPT:"00000000000000000000000000000000":"":"db4f1aa530967d6732ce4715eb0ee24b":"ff000000000000000000000000000000":0 AES-128-ECB crypt Decrypt NIST KAT #2 depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_DECRYPT:"00000000000000000000000000000000":"":"a81738252621dd180a34f3455b4baa2f":"ff800000000000000000000000000000":0 - -AES-128-ECB crypt Decrypt NIST KAT #3 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_DECRYPT:"00000000000000000000000000000000":"":"77e2b508db7fd89234caf7939ee5621a":"ffc00000000000000000000000000000":0 - -AES-128-ECB crypt Decrypt NIST KAT #4 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_DECRYPT:"00000000000000000000000000000000":"":"dc43be40be0e53712f7e2bf5ca707209":"6a118a874519e64e9963798a503f1d35":0 - -AES-128-ECB crypt Decrypt NIST KAT #5 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_DECRYPT:"00000000000000000000000000000000":"":"92beedab1895a94faa69b632e5cc47ce":"cb9fceec81286ca3e989bd979b0cb284":0 - -AES-128-ECB crypt Decrypt NIST KAT #6 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_DECRYPT:"00000000000000000000000000000000":"":"459264f4798f6a78bacb89c15ed3d601":"b26aeb1874e47ca8358ff22378f09144":0 - -AES-128-ECB crypt Decrypt NIST KAT #7 -depends_on:MBEDTLS_AES_C test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_DECRYPT:"b69418a85332240dc82492353956ae0c":"":"a303d940ded8f0baff6f75414cac5243":"00000000000000000000000000000000":0 -AES-128-ECB crypt Decrypt NIST KAT #8 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_DECRYPT:"71b5c08a1993e1362e4d0ce9b22b78d5":"":"c2dabd117f8a3ecabfbb11d12194d9d0":"00000000000000000000000000000000":0 - -AES-128-ECB crypt Decrypt NIST KAT #9 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_DECRYPT:"e234cdca2606b81f29408d5f6da21206":"":"fff60a4740086b3b9c56195b98d91a7b":"00000000000000000000000000000000":0 - -AES-128-ECB crypt Decrypt NIST KAT #10 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_DECRYPT:"ffffffffffffffff0000000000000000":"":"84be19e053635f09f2665e7bae85b42d":"00000000000000000000000000000000":0 - -AES-128-ECB crypt Decrypt NIST KAT #11 +AES-128-ECB crypt Decrypt NIST KAT #3 depends_on:MBEDTLS_AES_C test_vec_crypt:MBEDTLS_CIPHER_AES_128_ECB:MBEDTLS_DECRYPT:"ffffffffffffffff8000000000000000":"":"32cd652842926aea4aa6137bb2be2b5e":"00000000000000000000000000000000":0 @@ -1244,504 +1152,160 @@ test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_ENCRYPT:"000000000000000000000 AES-192-ECB crypt Encrypt NIST KAT #2 depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_ENCRYPT:"000000000000000000000000000000000000000000000000":"":"fffffffffffffffffffffc0000000000":"15eec9ebf42b9ca76897d2cd6c5a12e2":0 +test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_ENCRYPT:"000000000000000000000000000000000000000000000000":"":"51719783d3185a535bd75adc65071ce1":"4f354592ff7c8847d2d0870ca9481b7c":0 AES-192-ECB crypt Encrypt NIST KAT #3 depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_ENCRYPT:"000000000000000000000000000000000000000000000000":"":"fffffffffffffffffffffe0000000000":"db0d3a6fdcc13f915e2b302ceeb70fd8":0 +test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_ENCRYPT:"d2926527e0aa9f37b45e2ec2ade5853ef807576104c7ace3":"":"00000000000000000000000000000000":"dd619e1cf204446112e0af2b9afa8f8c":0 AES-192-ECB crypt Encrypt NIST KAT #4 depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_ENCRYPT:"000000000000000000000000000000000000000000000000":"":"51719783d3185a535bd75adc65071ce1":"4f354592ff7c8847d2d0870ca9481b7c":0 - -AES-192-ECB crypt Encrypt NIST KAT #5 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_ENCRYPT:"000000000000000000000000000000000000000000000000":"":"26aa49dcfe7629a8901a69a9914e6dfd":"d5e08bf9a182e857cf40b3a36ee248cc":0 - -AES-192-ECB crypt Encrypt NIST KAT #6 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_ENCRYPT:"000000000000000000000000000000000000000000000000":"":"941a4773058224e1ef66d10e0a6ee782":"067cd9d3749207791841562507fa9626":0 - -AES-192-ECB crypt Encrypt NIST KAT #7 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_ENCRYPT:"d2926527e0aa9f37b45e2ec2ade5853ef807576104c7ace3":"":"00000000000000000000000000000000":"dd619e1cf204446112e0af2b9afa8f8c":0 - -AES-192-ECB crypt Encrypt NIST KAT #8 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_ENCRYPT:"982215f4e173dfa0fcffe5d3da41c4812c7bcc8ed3540f93":"":"00000000000000000000000000000000":"d4f0aae13c8fe9339fbf9e69ed0ad74d":0 - -AES-192-ECB crypt Encrypt NIST KAT #9 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_ENCRYPT:"98c6b8e01e379fbd14e61af6af891596583565f2a27d59e9":"":"00000000000000000000000000000000":"19c80ec4a6deb7e5ed1033dda933498f":0 - -AES-192-ECB crypt Encrypt NIST KAT #10 -depends_on:MBEDTLS_AES_C test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_ENCRYPT:"fffffffffffffffffffffffffff800000000000000000000":"":"00000000000000000000000000000000":"8dd274bd0f1b58ae345d9e7233f9b8f3":0 -AES-192-ECB crypt Encrypt NIST KAT #11 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_ENCRYPT:"fffffffffffffffffffffffffffc00000000000000000000":"":"00000000000000000000000000000000":"9d6bdc8f4ce5feb0f3bed2e4b9a9bb0b":0 - -AES-192-ECB crypt Encrypt NIST KAT #12 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_ENCRYPT:"fffffffffffffffffffffffffffe00000000000000000000":"":"00000000000000000000000000000000":"fd5548bcf3f42565f7efa94562528d46":0 - AES-192-ECB crypt Decrypt NIST KAT #1 depends_on:MBEDTLS_AES_C test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_DECRYPT:"fffffffffffffffffffffffffffffffff000000000000000":"":"bb2852c891c5947d2ed44032c421b85f":"00000000000000000000000000000000":0 AES-192-ECB crypt Decrypt NIST KAT #2 depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_DECRYPT:"fffffffffffffffffffffffffffffffff800000000000000":"":"1b9f5fbd5e8a4264c0a85b80409afa5e":"00000000000000000000000000000000":0 +test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_DECRYPT:"61257134a518a0d57d9d244d45f6498cbc32f2bafc522d79":"":"cfe4d74002696ccf7d87b14a2f9cafc9":"00000000000000000000000000000000":0 AES-192-ECB crypt Decrypt NIST KAT #3 depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_DECRYPT:"fffffffffffffffffffffffffffffffffc00000000000000":"":"30dab809f85a917fe924733f424ac589":"00000000000000000000000000000000":0 +test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_DECRYPT:"000000000000000000000000000000000000000000000000":"":"275cfc0413d8ccb70513c3859b1d0f72":"1b077a6af4b7f98229de786d7516b639":0 AES-192-ECB crypt Decrypt NIST KAT #4 depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_DECRYPT:"61257134a518a0d57d9d244d45f6498cbc32f2bafc522d79":"":"cfe4d74002696ccf7d87b14a2f9cafc9":"00000000000000000000000000000000":0 - -AES-192-ECB crypt Decrypt NIST KAT #5 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_DECRYPT:"b0ab0a6a818baef2d11fa33eac947284fb7d748cfb75e570":"":"d2eafd86f63b109b91f5dbb3a3fb7e13":"00000000000000000000000000000000":0 - -AES-192-ECB crypt Decrypt NIST KAT #6 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_DECRYPT:"ee053aa011c8b428cdcc3636313c54d6a03cac01c71579d6":"":"9b9fdd1c5975655f539998b306a324af":"00000000000000000000000000000000":0 - -AES-192-ECB crypt Decrypt NIST KAT #7 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_DECRYPT:"000000000000000000000000000000000000000000000000":"":"275cfc0413d8ccb70513c3859b1d0f72":"1b077a6af4b7f98229de786d7516b639":0 - -AES-192-ECB crypt Decrypt NIST KAT #8 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_DECRYPT:"000000000000000000000000000000000000000000000000":"":"c9b8135ff1b5adc413dfd053b21bd96d":"9c2d8842e5f48f57648205d39a239af1":0 - -AES-192-ECB crypt Decrypt NIST KAT #9 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_DECRYPT:"000000000000000000000000000000000000000000000000":"":"4a3650c3371ce2eb35e389a171427440":"bff52510095f518ecca60af4205444bb":0 - -AES-192-ECB crypt Decrypt NIST KAT #10 -depends_on:MBEDTLS_AES_C test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_DECRYPT:"000000000000000000000000000000000000000000000000":"":"b2099795e88cc158fd75ea133d7e7fbe":"ffffffffffffffffffffc00000000000":0 -AES-192-ECB crypt Decrypt NIST KAT #11 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_DECRYPT:"000000000000000000000000000000000000000000000000":"":"a6cae46fb6fadfe7a2c302a34242817b":"ffffffffffffffffffffe00000000000":0 - -AES-192-ECB crypt Decrypt NIST KAT #12 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_192_ECB:MBEDTLS_DECRYPT:"000000000000000000000000000000000000000000000000":"":"026a7024d6a902e0b3ffccbaa910cc3f":"fffffffffffffffffffff00000000000":0 - AES-256-ECB crypt Encrypt NIST KAT #1 depends_on:MBEDTLS_AES_C test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_ENCRYPT:"c1cc358b449909a19436cfbb3f852ef8bcb5ed12ac7058325f56e6099aab1a1c":"":"00000000000000000000000000000000":"352065272169abf9856843927d0674fd":0 AES-256-ECB crypt Encrypt NIST KAT #2 depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_ENCRYPT:"984ca75f4ee8d706f46c2d98c0bf4a45f5b00d791c2dfeb191b5ed8e420fd627":"":"00000000000000000000000000000000":"4307456a9e67813b452e15fa8fffe398":0 +test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_ENCRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"":"0b24af36193ce4665f2825d7b4749c98":"a9ff75bd7cf6613d3731c77c3b6d0c04":0 AES-256-ECB crypt Encrypt NIST KAT #3 depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_ENCRYPT:"b43d08a447ac8609baadae4ff12918b9f68fc1653f1269222f123981ded7a92f":"":"00000000000000000000000000000000":"4663446607354989477a5c6f0f007ef4":0 +test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_ENCRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"":"ffffff80000000000000000000000000":"36aff0ef7bf3280772cf4cac80a0d2b2":0 AES-256-ECB crypt Encrypt NIST KAT #4 depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_ENCRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"":"0b24af36193ce4665f2825d7b4749c98":"a9ff75bd7cf6613d3731c77c3b6d0c04":0 - -AES-256-ECB crypt Encrypt NIST KAT #5 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_ENCRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"":"761c1fe41a18acf20d241650611d90f1":"623a52fcea5d443e48d9181ab32c7421":0 - -AES-256-ECB crypt Encrypt NIST KAT #6 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_ENCRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"":"8a560769d605868ad80d819bdba03771":"38f2c7ae10612415d27ca190d27da8b4":0 - -AES-256-ECB crypt Encrypt NIST KAT #7 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_ENCRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"":"ffffff80000000000000000000000000":"36aff0ef7bf3280772cf4cac80a0d2b2":0 - -AES-256-ECB crypt Encrypt NIST KAT #8 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_ENCRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"":"ffffffc0000000000000000000000000":"1f8eedea0f62a1406d58cfc3ecea72cf":0 - -AES-256-ECB crypt Encrypt NIST KAT #9 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_ENCRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"":"ffffffe0000000000000000000000000":"abf4154a3375a1d3e6b1d454438f95a6":0 - -AES-256-ECB crypt Encrypt NIST KAT #10 -depends_on:MBEDTLS_AES_C test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_ENCRYPT:"ffffffffffffffffffffffffffffffffffff8000000000000000000000000000":"":"00000000000000000000000000000000":"45d089c36d5c5a4efc689e3b0de10dd5":0 -AES-256-ECB crypt Encrypt NIST KAT #11 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_ENCRYPT:"ffffffffffffffffffffffffffffffffffffc000000000000000000000000000":"":"00000000000000000000000000000000":"b4da5df4becb5462e03a0ed00d295629":0 - -AES-256-ECB crypt Encrypt NIST KAT #12 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_ENCRYPT:"ffffffffffffffffffffffffffffffffffffe000000000000000000000000000":"":"00000000000000000000000000000000":"dcf4e129136c1a4b7a0f38935cc34b2b":0 - AES-256-ECB crypt Decrypt NIST KAT #1 depends_on:MBEDTLS_AES_C test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_DECRYPT:"fffffffffffffffffffffffffffffffffffffffffffffff00000000000000000":"":"edf61ae362e882ddc0167474a7a77f3a":"00000000000000000000000000000000":0 AES-256-ECB crypt Decrypt NIST KAT #2 depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_DECRYPT:"fffffffffffffffffffffffffffffffffffffffffffffff80000000000000000":"":"6168b00ba7859e0970ecfd757efecf7c":"00000000000000000000000000000000":0 +test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_DECRYPT:"f8be9ba615c5a952cabbca24f68f8593039624d524c816acda2c9183bd917cb9":"":"a3944b95ca0b52043584ef02151926a8":"00000000000000000000000000000000":0 AES-256-ECB crypt Decrypt NIST KAT #3 depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_DECRYPT:"fffffffffffffffffffffffffffffffffffffffffffffffc0000000000000000":"":"d1415447866230d28bb1ea18a4cdfd02":"00000000000000000000000000000000":0 +test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_DECRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"":"623a52fcea5d443e48d9181ab32c7421":"761c1fe41a18acf20d241650611d90f1":0 AES-256-ECB crypt Decrypt NIST KAT #4 depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_DECRYPT:"f8be9ba615c5a952cabbca24f68f8593039624d524c816acda2c9183bd917cb9":"":"a3944b95ca0b52043584ef02151926a8":"00000000000000000000000000000000":0 - -AES-256-ECB crypt Decrypt NIST KAT #5 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_DECRYPT:"797f8b3d176dac5b7e34a2d539c4ef367a16f8635f6264737591c5c07bf57a3e":"":"a74289fe73a4c123ca189ea1e1b49ad5":"00000000000000000000000000000000":0 - -AES-256-ECB crypt Decrypt NIST KAT #6 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_DECRYPT:"6838d40caf927749c13f0329d331f448e202c73ef52c5f73a37ca635d4c47707":"":"b91d4ea4488644b56cf0812fa7fcf5fc":"00000000000000000000000000000000":0 - -AES-256-ECB crypt Decrypt NIST KAT #7 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_DECRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"":"623a52fcea5d443e48d9181ab32c7421":"761c1fe41a18acf20d241650611d90f1":0 - -AES-256-ECB crypt Decrypt NIST KAT #8 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_DECRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"":"38f2c7ae10612415d27ca190d27da8b4":"8a560769d605868ad80d819bdba03771":0 - -AES-256-ECB crypt Decrypt NIST KAT #9 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_DECRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"":"1bc704f1bce135ceb810341b216d7abe":"91fbef2d15a97816060bee1feaa49afe":0 - -AES-256-ECB crypt Decrypt NIST KAT #10 -depends_on:MBEDTLS_AES_C test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_DECRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"":"ddc6bf790c15760d8d9aeb6f9a75fd4e":"80000000000000000000000000000000":0 -AES-256-ECB crypt Decrypt NIST KAT #11 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_DECRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"":"0a6bdc6d4c1e6280301fd8e97ddbe601":"c0000000000000000000000000000000":0 - -AES-256-ECB crypt Decrypt NIST KAT #12 -depends_on:MBEDTLS_AES_C -test_vec_crypt:MBEDTLS_CIPHER_AES_256_ECB:MBEDTLS_DECRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"":"9b80eefb7ebe2d2b16247aa0efc72f5d":"e0000000000000000000000000000000":0 - AES-128-CBC crypt Encrypt NIST KAT #1 depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_ENCRYPT:"00000000000000000000000000000000":"00000000000000000000000000000000":"80000000000000000000000000000000":"3ad78e726c1ec02b7ebfe92b23d9ec34":0 AES-128-CBC crypt Encrypt NIST KAT #2 depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_ENCRYPT:"00000000000000000000000000000000":"00000000000000000000000000000000":"c0000000000000000000000000000000":"aae5939c8efdf2f04e60b9fe7117b2c2":0 +test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_ENCRYPT:"ffffffffffffffffffffffffffffe000":"00000000000000000000000000000000":"00000000000000000000000000000000":"323994cfb9da285a5d9642e1759b224a":0 AES-128-CBC crypt Encrypt NIST KAT #3 depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_ENCRYPT:"00000000000000000000000000000000":"00000000000000000000000000000000":"e0000000000000000000000000000000":"f031d4d74f5dcbf39daaf8ca3af6e527":0 +test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_ENCRYPT:"10a58869d74be5a374cf867cfb473859":"00000000000000000000000000000000":"00000000000000000000000000000000":"6d251e6944b051e04eaa6fb4dbf78465":0 AES-128-CBC crypt Encrypt NIST KAT #4 depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_ENCRYPT:"00000000000000000000000000000000":"00000000000000000000000000000000":"f0000000000000000000000000000000":"96d9fd5cc4f07441727df0f33e401a36":0 - -AES-128-CBC crypt Encrypt NIST KAT #5 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_ENCRYPT:"ff000000000000000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"b1d758256b28fd850ad4944208cf1155":0 - -AES-128-CBC crypt Encrypt NIST KAT #6 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_ENCRYPT:"ffffc000000000000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"df556a33438db87bc41b1752c55e5e49":0 - -AES-128-CBC crypt Encrypt NIST KAT #7 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_ENCRYPT:"ffffffffffffffffffffffffffffe000":"00000000000000000000000000000000":"00000000000000000000000000000000":"323994cfb9da285a5d9642e1759b224a":0 - -AES-128-CBC crypt Encrypt NIST KAT #8 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_ENCRYPT:"10a58869d74be5a374cf867cfb473859":"00000000000000000000000000000000":"00000000000000000000000000000000":"6d251e6944b051e04eaa6fb4dbf78465":0 - -AES-128-CBC crypt Encrypt NIST KAT #9 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_ENCRYPT:"caea65cdbb75e9169ecd22ebe6e54675":"00000000000000000000000000000000":"00000000000000000000000000000000":"6e29201190152df4ee058139def610bb":0 - -AES-128-CBC crypt Encrypt NIST KAT #10 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_ENCRYPT:"b6364ac4e1de1e285eaf144a2415f7a0":"00000000000000000000000000000000":"00000000000000000000000000000000":"5d9b05578fc944b3cf1ccf0e746cd581":0 - -AES-128-CBC crypt Encrypt NIST KAT #11 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_ENCRYPT:"00000000000000000000000000000000":"00000000000000000000000000000000":"f34481ec3cc627bacd5dc3fb08f273e6":"0336763e966d92595a567cc9ce537f5e":0 -AES-128-CBC crypt Encrypt NIST KAT #12 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_ENCRYPT:"00000000000000000000000000000000":"00000000000000000000000000000000":"9798c4640bad75c7c3227db910174e72":"a9a1631bf4996954ebc093957b234589":0 - -AES-128-CBC crypt Encrypt NIST KAT #13 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_ENCRYPT:"00000000000000000000000000000000":"00000000000000000000000000000000":"96ab5c2ff612d9dfaae8c31f30c42168":"ff4f8391a6a40ca5b25d23bedd44a597":0 - AES-128-CBC crypt Decrypt NIST KAT #1 depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_DECRYPT:"00000000000000000000000000000000":"00000000000000000000000000000000":"3ad78e726c1ec02b7ebfe92b23d9ec34":"80000000000000000000000000000000":0 AES-128-CBC crypt Decrypt NIST KAT #2 depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_DECRYPT:"00000000000000000000000000000000":"00000000000000000000000000000000":"aae5939c8efdf2f04e60b9fe7117b2c2":"c0000000000000000000000000000000":0 +test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_DECRYPT:"ffffc000000000000000000000000000":"00000000000000000000000000000000":"df556a33438db87bc41b1752c55e5e49":"00000000000000000000000000000000":0 AES-128-CBC crypt Decrypt NIST KAT #3 depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_DECRYPT:"00000000000000000000000000000000":"00000000000000000000000000000000":"f031d4d74f5dcbf39daaf8ca3af6e527":"e0000000000000000000000000000000":0 +test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_DECRYPT:"10a58869d74be5a374cf867cfb473859":"00000000000000000000000000000000":"6d251e6944b051e04eaa6fb4dbf78465":"00000000000000000000000000000000":0 AES-128-CBC crypt Decrypt NIST KAT #4 depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_DECRYPT:"00000000000000000000000000000000":"00000000000000000000000000000000":"96d9fd5cc4f07441727df0f33e401a36":"f0000000000000000000000000000000":0 - -AES-128-CBC crypt Decrypt NIST KAT #5 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_DECRYPT:"ff000000000000000000000000000000":"00000000000000000000000000000000":"b1d758256b28fd850ad4944208cf1155":"00000000000000000000000000000000":0 - -AES-128-CBC crypt Decrypt NIST KAT #6 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_DECRYPT:"ffffc000000000000000000000000000":"00000000000000000000000000000000":"df556a33438db87bc41b1752c55e5e49":"00000000000000000000000000000000":0 - -AES-128-CBC crypt Decrypt NIST KAT #7 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_DECRYPT:"ffffffffffffffffffffffffffffe000":"00000000000000000000000000000000":"323994cfb9da285a5d9642e1759b224a":"00000000000000000000000000000000":0 - -AES-128-CBC crypt Decrypt NIST KAT #8 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_DECRYPT:"10a58869d74be5a374cf867cfb473859":"00000000000000000000000000000000":"6d251e6944b051e04eaa6fb4dbf78465":"00000000000000000000000000000000":0 - -AES-128-CBC crypt Decrypt NIST KAT #9 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_DECRYPT:"caea65cdbb75e9169ecd22ebe6e54675":"00000000000000000000000000000000":"6e29201190152df4ee058139def610bb":"00000000000000000000000000000000":0 - -AES-128-CBC crypt Decrypt NIST KAT #10 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_DECRYPT:"b6364ac4e1de1e285eaf144a2415f7a0":"00000000000000000000000000000000":"5d9b05578fc944b3cf1ccf0e746cd581":"00000000000000000000000000000000":0 - -AES-128-CBC crypt Decrypt NIST KAT #11 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_DECRYPT:"00000000000000000000000000000000":"00000000000000000000000000000000":"0336763e966d92595a567cc9ce537f5e":"f34481ec3cc627bacd5dc3fb08f273e6":0 -AES-128-CBC crypt Decrypt NIST KAT #12 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_DECRYPT:"00000000000000000000000000000000":"00000000000000000000000000000000":"a9a1631bf4996954ebc093957b234589":"9798c4640bad75c7c3227db910174e72":0 - -AES-128-CBC crypt Decrypt NIST KAT #13 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_128_CBC:MBEDTLS_DECRYPT:"00000000000000000000000000000000":"00000000000000000000000000000000":"ff4f8391a6a40ca5b25d23bedd44a597":"96ab5c2ff612d9dfaae8c31f30c42168":0 - AES-192-CBC crypt Encrypt NIST KAT #1 depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_ENCRYPT:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"80000000000000000000000000000000":"6cd02513e8d4dc986b4afe087a60bd0c":0 AES-192-CBC crypt Encrypt NIST KAT #2 depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_ENCRYPT:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"c0000000000000000000000000000000":"2ce1f8b7e30627c1c4519eada44bc436":0 +test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_ENCRYPT:"ff0000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"833f71258d53036b02952c76c744f5a1":0 AES-192-CBC crypt Encrypt NIST KAT #3 depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_ENCRYPT:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"e0000000000000000000000000000000":"9946b5f87af446f5796c1fee63a2da24":0 +test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_ENCRYPT:"e9f065d7c13573587f7875357dfbb16c53489f6a4bd0f7cd":"00000000000000000000000000000000":"00000000000000000000000000000000":"0956259c9cd5cfd0181cca53380cde06":0 AES-192-CBC crypt Encrypt NIST KAT #4 depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_ENCRYPT:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"f0000000000000000000000000000000":"2a560364ce529efc21788779568d5555":0 - -AES-192-CBC crypt Encrypt NIST KAT #5 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_ENCRYPT:"ff0000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"833f71258d53036b02952c76c744f5a1":0 - -AES-192-CBC crypt Encrypt NIST KAT #6 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_ENCRYPT:"ffffc0000000000000000000000000000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"b2f8b409b0585909aad3a7b5a219072a":0 - -AES-192-CBC crypt Encrypt NIST KAT #7 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_ENCRYPT:"ffffffffffffffffffffffffffffffffffffffffffffe000":"00000000000000000000000000000000":"00000000000000000000000000000000":"75db7cfd4a7b2b62ab78a48f3ddaf4af":0 - -AES-192-CBC crypt Encrypt NIST KAT #8 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_ENCRYPT:"e9f065d7c13573587f7875357dfbb16c53489f6a4bd0f7cd":"00000000000000000000000000000000":"00000000000000000000000000000000":"0956259c9cd5cfd0181cca53380cde06":0 - -AES-192-CBC crypt Encrypt NIST KAT #9 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_ENCRYPT:"15d20f6ebc7e649fd95b76b107e6daba967c8a9484797f29":"00000000000000000000000000000000":"00000000000000000000000000000000":"8e4e18424e591a3d5b6f0876f16f8594":0 - -AES-192-CBC crypt Encrypt NIST KAT #10 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_ENCRYPT:"a8a282ee31c03fae4f8e9b8930d5473c2ed695a347e88b7c":"00000000000000000000000000000000":"00000000000000000000000000000000":"93f3270cfc877ef17e106ce938979cb0":0 - -AES-192-CBC crypt Encrypt NIST KAT #11 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_ENCRYPT:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"1b077a6af4b7f98229de786d7516b639":"275cfc0413d8ccb70513c3859b1d0f72":0 -AES-192-CBC crypt Encrypt NIST KAT #12 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_ENCRYPT:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"9c2d8842e5f48f57648205d39a239af1":"c9b8135ff1b5adc413dfd053b21bd96d":0 - -AES-192-CBC crypt Encrypt NIST KAT #13 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_ENCRYPT:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"bff52510095f518ecca60af4205444bb":"4a3650c3371ce2eb35e389a171427440":0 - AES-192-CBC crypt Decrypt NIST KAT #1 depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_DECRYPT:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"6cd02513e8d4dc986b4afe087a60bd0c":"80000000000000000000000000000000":0 AES-192-CBC crypt Decrypt NIST KAT #2 depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_DECRYPT:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"2ce1f8b7e30627c1c4519eada44bc436":"c0000000000000000000000000000000":0 +test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_DECRYPT:"ffe000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"7ababc4b3f516c9aafb35f4140b548f9":"00000000000000000000000000000000":0 AES-192-CBC crypt Decrypt NIST KAT #3 depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_DECRYPT:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"9946b5f87af446f5796c1fee63a2da24":"e0000000000000000000000000000000":0 +test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_DECRYPT:"e9f065d7c13573587f7875357dfbb16c53489f6a4bd0f7cd":"00000000000000000000000000000000":"0956259c9cd5cfd0181cca53380cde06":"00000000000000000000000000000000":0 AES-192-CBC crypt Decrypt NIST KAT #4 depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_DECRYPT:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"2a560364ce529efc21788779568d5555":"f0000000000000000000000000000000":0 - -AES-192-CBC crypt Decrypt NIST KAT #5 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_DECRYPT:"ffe000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"7ababc4b3f516c9aafb35f4140b548f9":"00000000000000000000000000000000":0 - -AES-192-CBC crypt Decrypt NIST KAT #6 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_DECRYPT:"ffffc0000000000000000000000000000000000000000000":"00000000000000000000000000000000":"b2f8b409b0585909aad3a7b5a219072a":"00000000000000000000000000000000":0 - -AES-192-CBC crypt Decrypt NIST KAT #7 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_DECRYPT:"ffffffffffffffffffffffffffffffffffffffffffffe000":"00000000000000000000000000000000":"75db7cfd4a7b2b62ab78a48f3ddaf4af":"00000000000000000000000000000000":0 - -AES-192-CBC crypt Decrypt NIST KAT #8 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_DECRYPT:"e9f065d7c13573587f7875357dfbb16c53489f6a4bd0f7cd":"00000000000000000000000000000000":"0956259c9cd5cfd0181cca53380cde06":"00000000000000000000000000000000":0 - -AES-192-CBC crypt Decrypt NIST KAT #9 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_DECRYPT:"15d20f6ebc7e649fd95b76b107e6daba967c8a9484797f29":"00000000000000000000000000000000":"8e4e18424e591a3d5b6f0876f16f8594":"00000000000000000000000000000000":0 - -AES-192-CBC crypt Decrypt NIST KAT #10 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_DECRYPT:"a8a282ee31c03fae4f8e9b8930d5473c2ed695a347e88b7c":"00000000000000000000000000000000":"93f3270cfc877ef17e106ce938979cb0":"00000000000000000000000000000000":0 - -AES-192-CBC crypt Decrypt NIST KAT #11 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_DECRYPT:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"275cfc0413d8ccb70513c3859b1d0f72":"1b077a6af4b7f98229de786d7516b639":0 -AES-192-CBC crypt Decrypt NIST KAT #12 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_DECRYPT:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"c9b8135ff1b5adc413dfd053b21bd96d":"9c2d8842e5f48f57648205d39a239af1":0 - -AES-192-CBC crypt Decrypt NIST KAT #13 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_192_CBC:MBEDTLS_DECRYPT:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"4a3650c3371ce2eb35e389a171427440":"bff52510095f518ecca60af4205444bb":0 - AES-256-CBC crypt Encrypt NIST KAT #1 depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_ENCRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"80000000000000000000000000000000":"ddc6bf790c15760d8d9aeb6f9a75fd4e":0 AES-256-CBC crypt Encrypt NIST KAT #2 depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_ENCRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"c0000000000000000000000000000000":"0a6bdc6d4c1e6280301fd8e97ddbe601":0 +test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_ENCRYPT:"ff00000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"ec52a212f80a09df6317021bc2a9819e":0 AES-256-CBC crypt Encrypt NIST KAT #3 depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_ENCRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"e0000000000000000000000000000000":"9b80eefb7ebe2d2b16247aa0efc72f5d":0 +test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_ENCRYPT:"c47b0294dbbbee0fec4757f22ffeee3587ca4730c3d33b691df38bab076bc558":"00000000000000000000000000000000":"00000000000000000000000000000000":"46f2fb342d6f0ab477476fc501242c5f":0 AES-256-CBC crypt Encrypt NIST KAT #4 depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_ENCRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"f0000000000000000000000000000000":"7f2c5ece07a98d8bee13c51177395ff7":0 - -AES-256-CBC crypt Encrypt NIST KAT #5 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_ENCRYPT:"ff00000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"ec52a212f80a09df6317021bc2a9819e":0 - -AES-256-CBC crypt Encrypt NIST KAT #6 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_ENCRYPT:"ffffc00000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"27ef2495dabf323885aab39c80f18d8b":0 - -AES-256-CBC crypt Encrypt NIST KAT #7 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_ENCRYPT:"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe000":"00000000000000000000000000000000":"00000000000000000000000000000000":"50e6d3c9b6698a7cd276f96b1473f35a":0 - -AES-256-CBC crypt Encrypt NIST KAT #8 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_ENCRYPT:"c47b0294dbbbee0fec4757f22ffeee3587ca4730c3d33b691df38bab076bc558":"00000000000000000000000000000000":"00000000000000000000000000000000":"46f2fb342d6f0ab477476fc501242c5f":0 - -AES-256-CBC crypt Encrypt NIST KAT #9 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_ENCRYPT:"28d46cffa158533194214a91e712fc2b45b518076675affd910edeca5f41ac64":"00000000000000000000000000000000":"00000000000000000000000000000000":"4bf3b0a69aeb6657794f2901b1440ad4":0 - -AES-256-CBC crypt Encrypt NIST KAT #10 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_ENCRYPT:"c1cc358b449909a19436cfbb3f852ef8bcb5ed12ac7058325f56e6099aab1a1c":"00000000000000000000000000000000":"00000000000000000000000000000000":"352065272169abf9856843927d0674fd":0 - -AES-256-CBC crypt Encrypt NIST KAT #11 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_ENCRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"014730f80ac625fe84f026c60bfd547d":"5c9d844ed46f9885085e5d6a4f94c7d7":0 -AES-256-CBC crypt Encrypt NIST KAT #12 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_ENCRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"0b24af36193ce4665f2825d7b4749c98":"a9ff75bd7cf6613d3731c77c3b6d0c04":0 - -AES-256-CBC crypt Encrypt NIST KAT #13 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_ENCRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"761c1fe41a18acf20d241650611d90f1":"623a52fcea5d443e48d9181ab32c7421":0 - AES-256-CBC crypt Decrypt NIST KAT #1 depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_DECRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"ddc6bf790c15760d8d9aeb6f9a75fd4e":"80000000000000000000000000000000":0 AES-256-CBC crypt Decrypt NIST KAT #2 depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_DECRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"0a6bdc6d4c1e6280301fd8e97ddbe601":"c0000000000000000000000000000000":0 +test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_DECRYPT:"ffe0000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"d1ccb9b1337002cbac42c520b5d67722":"00000000000000000000000000000000":0 AES-256-CBC crypt Decrypt NIST KAT #3 depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_DECRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"9b80eefb7ebe2d2b16247aa0efc72f5d":"e0000000000000000000000000000000":0 +test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_DECRYPT:"c47b0294dbbbee0fec4757f22ffeee3587ca4730c3d33b691df38bab076bc558":"00000000000000000000000000000000":"46f2fb342d6f0ab477476fc501242c5f":"00000000000000000000000000000000":0 AES-256-CBC crypt Decrypt NIST KAT #4 depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_DECRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"7f2c5ece07a98d8bee13c51177395ff7":"f0000000000000000000000000000000":0 - -AES-256-CBC crypt Decrypt NIST KAT #5 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_DECRYPT:"ffe0000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"d1ccb9b1337002cbac42c520b5d67722":"00000000000000000000000000000000":0 - -AES-256-CBC crypt Decrypt NIST KAT #6 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_DECRYPT:"ffffc00000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"27ef2495dabf323885aab39c80f18d8b":"00000000000000000000000000000000":0 - -AES-256-CBC crypt Decrypt NIST KAT #7 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_DECRYPT:"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe000":"00000000000000000000000000000000":"50e6d3c9b6698a7cd276f96b1473f35a":"00000000000000000000000000000000":0 - -AES-256-CBC crypt Decrypt NIST KAT #8 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_DECRYPT:"c47b0294dbbbee0fec4757f22ffeee3587ca4730c3d33b691df38bab076bc558":"00000000000000000000000000000000":"46f2fb342d6f0ab477476fc501242c5f":"00000000000000000000000000000000":0 - -AES-256-CBC crypt Decrypt NIST KAT #9 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_DECRYPT:"28d46cffa158533194214a91e712fc2b45b518076675affd910edeca5f41ac64":"00000000000000000000000000000000":"4bf3b0a69aeb6657794f2901b1440ad4":"00000000000000000000000000000000":0 - -AES-256-CBC crypt Decrypt NIST KAT #10 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_DECRYPT:"c1cc358b449909a19436cfbb3f852ef8bcb5ed12ac7058325f56e6099aab1a1c":"00000000000000000000000000000000":"352065272169abf9856843927d0674fd":"00000000000000000000000000000000":0 - -AES-256-CBC crypt Decrypt NIST KAT #11 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_DECRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"5c9d844ed46f9885085e5d6a4f94c7d7":"014730f80ac625fe84f026c60bfd547d":0 -AES-256-CBC crypt Decrypt NIST KAT #12 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_DECRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"a9ff75bd7cf6613d3731c77c3b6d0c04":"0b24af36193ce4665f2825d7b4749c98":0 - -AES-256-CBC crypt Decrypt NIST KAT #13 -depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC -test_vec_crypt:MBEDTLS_CIPHER_AES_256_CBC:MBEDTLS_DECRYPT:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"623a52fcea5d443e48d9181ab32c7421":"761c1fe41a18acf20d241650611d90f1":0 - Cipher Corner Case behaviours depends_on:MBEDTLS_AES_C cipher_special_behaviours: diff --git a/tests/suites/test_suite_cipher.function b/tests/suites/test_suite_cipher.function index 581cc78a5..9081683cb 100644 --- a/tests/suites/test_suite_cipher.function +++ b/tests/suites/test_suite_cipher.function @@ -120,8 +120,8 @@ void cipher_special_behaviours( ) TEST_ASSERT( mbedtls_cipher_set_iv( &ctx, iv, 0 ) == MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA ); - mbedtls_cipher_free( &ctx ); - cipher_info = mbedtls_cipher_info_from_type( MBEDTLS_CIPHER_AES_128_ECB ); + mbedtls_cipher_free( &ctx ); + cipher_info = mbedtls_cipher_info_from_type( MBEDTLS_CIPHER_AES_128_ECB ); TEST_ASSERT( NULL != cipher_info ); TEST_ASSERT( 0 == mbedtls_cipher_setup( &ctx, cipher_info ) ); @@ -730,7 +730,7 @@ void test_vec_crypt( int cipher_id, int operation, char *hex_key, if( MBEDTLS_MODE_CBC == ctx.cipher_info->mode ) TEST_ASSERT( 0 == mbedtls_cipher_set_padding_mode( &ctx, MBEDTLS_PADDING_NONE ) ); - iv_len = unhexify( iv, hex_iv ); + iv_len = unhexify( iv, hex_iv ); TEST_ASSERT( finish_result == mbedtls_cipher_crypt( &ctx, iv_len ? iv : NULL, iv_len, input, inputlen, From cf330e89102488db222449d274da73db93a8d3a4 Mon Sep 17 00:00:00 2001 From: Ron Eldor Date: Tue, 26 Sep 2017 12:08:54 +0300 Subject: [PATCH 3/4] Fix CI failure Test IV special cases only if `MBEDTLS_CIPHER_MODE_CBC` is defined --- tests/suites/test_suite_cipher.function | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/suites/test_suite_cipher.function b/tests/suites/test_suite_cipher.function index 9081683cb..02802b82f 100644 --- a/tests/suites/test_suite_cipher.function +++ b/tests/suites/test_suite_cipher.function @@ -98,12 +98,15 @@ void cipher_special_behaviours( ) mbedtls_cipher_context_t ctx; unsigned char input[32]; unsigned char output[32]; +#if defined (MBEDTLS_CIPHER_MODE_CBC) unsigned char iv[32]; +#endif size_t olen = 0; mbedtls_cipher_init( &ctx ); memset( input, 0, sizeof( input ) ); memset( output, 0, sizeof( output ) ); +#if defined (MBEDTLS_CIPHER_MODE_CBC) memset( iv, 0, sizeof( iv ) ); /* Check and get info structures */ @@ -121,6 +124,7 @@ void cipher_special_behaviours( ) == MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA ); mbedtls_cipher_free( &ctx ); +#endif /* MBEDTLS_CIPHER_MODE_CBC */ cipher_info = mbedtls_cipher_info_from_type( MBEDTLS_CIPHER_AES_128_ECB ); TEST_ASSERT( NULL != cipher_info ); From de881c01734f5037981fcaef580f039d706f2109 Mon Sep 17 00:00:00 2001 From: Ron Eldor Date: Sun, 1 Oct 2017 17:04:54 +0300 Subject: [PATCH 4/4] Resolve PR review comments Address review comments: 1. add `mbedtls_cipher_init()` after freeing context, in test code 2. style comments 3. set `ctx->iv_size = 0` in case `IV == NULL && iv_len == 0` --- library/cipher.c | 5 ++++- tests/suites/test_suite_cipher.function | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/library/cipher.c b/library/cipher.c index 220fbab1f..eeb628626 100644 --- a/library/cipher.c +++ b/library/cipher.c @@ -220,6 +220,9 @@ int mbedtls_cipher_set_iv( mbedtls_cipher_context_t *ctx, else if( NULL == iv && iv_len != 0 ) return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA ); + if( NULL == iv && iv_len == 0 ) + ctx->iv_size = 0; + /* avoid buffer overflow in ctx->iv */ if( iv_len > MBEDTLS_MAX_IV_LENGTH ) return( MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE ); @@ -234,7 +237,7 @@ int mbedtls_cipher_set_iv( mbedtls_cipher_context_t *ctx, if( actual_iv_size > iv_len ) return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA ); } - if ( actual_iv_size ) + if ( actual_iv_size != 0 ) { memcpy( ctx->iv, iv, actual_iv_size ); ctx->iv_size = actual_iv_size; diff --git a/tests/suites/test_suite_cipher.function b/tests/suites/test_suite_cipher.function index 02802b82f..343dd7863 100644 --- a/tests/suites/test_suite_cipher.function +++ b/tests/suites/test_suite_cipher.function @@ -106,7 +106,7 @@ void cipher_special_behaviours( ) mbedtls_cipher_init( &ctx ); memset( input, 0, sizeof( input ) ); memset( output, 0, sizeof( output ) ); -#if defined (MBEDTLS_CIPHER_MODE_CBC) +#if defined(MBEDTLS_CIPHER_MODE_CBC) memset( iv, 0, sizeof( iv ) ); /* Check and get info structures */ @@ -124,6 +124,7 @@ void cipher_special_behaviours( ) == MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA ); mbedtls_cipher_free( &ctx ); + mbedtls_cipher_init( &ctx ); #endif /* MBEDTLS_CIPHER_MODE_CBC */ cipher_info = mbedtls_cipher_info_from_type( MBEDTLS_CIPHER_AES_128_ECB ); TEST_ASSERT( NULL != cipher_info );