"Fossies" - the Fresh Open Source Software Archive

Member "nss-3.37.3/nss/cmd/bltest/tests/aes_ctr/aes_ctr_tests_source.txt" (5 Jun 2018, 6824 Bytes) of package /linux/misc/nss-3.37.3.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #
    2 # From NIST Special Publication 800-38A; 2001 Edition ;
    3 # "Recommendation for Block Cipher Modes of Operation: Methods and Techniques"
    4 # Morris Dworkin
    5 # Appendix F Example Vectors for Modes of Operation of the AES
    6 #
    7 # In this appendix, three examples are provided for each of the modes in this recommendation with
    8 # the AES algorithm [2] as the underlying block cipher: one example is given for each of the
    9 # allowed key sizes (128, 192, and 256 bits). Some intermediate results are presented. For the five
   10 # confidentiality modes, examples are provided for both encryption and decryption. Examples are
   11 # provided for 1-bit, 8-bit, and 128 bit CFB. The plaintext for all but two of these examples is
   12 # equivalent to the following string of hexadecimal characters, formatted into four 128 bit blocks:
   13 #
   14 #     6bc1bee22e409f96e93d7e117393172a 
   15 #     ae2d8a571e03ac9c9eb76fac45af8e51 
   16 #     30c81c46a35ce411e5fbc1191a0a52ef 
   17 #     f69f2445df4f9b17ad2b417be66c3710. 
   18 #
   19 # For the example of 1-bit CFB, the plaintext is the first 16 bits in the above string; for the example
   20 # of 8-bit CFB, the plaintext is the first 18 octets in the above string. All strings are presented in
   21 # hexadecimal notation, except in the example of 1-bit CFB, where the plaintext and ciphertext
   22 # segments are single bits.
   23 #
   24 #
   25 #  F.5 CTR Example Vectors
   26 
   27 Test="F.5.1 CTR-AES128.Encrypt"
   28 Type=Encrypt
   29 Key=2b7e151628aed2a6abf7158809cf4f3c
   30 Init. Counter=f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
   31 Block #1={
   32 Input Block=f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
   33 Output Block=ec8cdf7398607cb0f2d21675ea9ea1e4
   34 Plaintext=6bc1bee22e409f96e93d7e117393172a
   35 Ciphertext=874d6191b620e3261bef6864990db6ce
   36 }
   37 Block #2={
   38 Input Block=f0f1f2f3f4f5f6f7f8f9fafbfcfdff00
   39 Output Block=362b7c3c6773516318a077d7fc5073ae
   40 Plaintext=ae2d8a571e03ac9c9eb76fac45af8e51
   41 Ciphertext=9806f66b7970fdff8617187bb9fffdff
   42 }
   43 Block #3={
   44 Input Block=f0f1f2f3f4f5f6f7f8f9fafbfcfdff01
   45 Output Block=6a2cc3787889374fbeb4c81b17ba6c44
   46 Plaintext=30c81c46a35ce411e5fbc1191a0a52ef
   47 Ciphertext=5ae4df3edbd5d35e5b4f09020db03eab
   48 }
   49 Block #4={
   50 Input Block=f0f1f2f3f4f5f6f7f8f9fafbfcfdff02
   51 Output Block=e89c399ff0f198c6d40a31db156cabfe
   52 Plaintext=f69f2445df4f9b17ad2b417be66c3710
   53 Ciphertext=1e031dda2fbe03d1792170a0f3009cee
   54 }
   55 
   56 Test="F.5.2 CTR-AES128.Decrypt"
   57 Type=Decrypt
   58 Key=2b7e151628aed2a6abf7158809cf4f3c
   59 Init. Counter=f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
   60 Block #1={
   61 Input Block=f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
   62 Output Block=ec8cdf7398607cb0f2d21675ea9ea1e4
   63 Ciphertext=874d6191b620e3261bef6864990db6ce
   64 Plaintext=6bc1bee22e409f96e93d7e117393172a
   65 Block #2={
   66 Input Block=f0f1f2f3f4f5f6f7f8f9fafbfcfdff00
   67 Output Block=362b7c3c6773516318a077d7fc5073ae
   68 Ciphertext=9806f66b7970fdff8617187bb9fffdff
   69 Plaintext=ae2d8a571e03ac9c9eb76fac45af8e51
   70 }
   71 Block #3={
   72 Input Block=f0f1f2f3f4f5f6f7f8f9fafbfcfdff01
   73 Output Block=6a2cc3787889374fbeb4c81b17ba6c44
   74 Ciphertext=5ae4df3edbd5d35e5b4f09020db03eab
   75 Plaintext=30c81c46a35ce411e5fbc1191a0a52ef
   76 }
   77 Block #4={
   78 Input Block=f0f1f2f3f4f5f6f7f8f9fafbfcfdff02
   79 Output Block=e89c399ff0f198c6d40a31db156cabfe
   80 Ciphertext=1e031dda2fbe03d1792170a0f3009cee
   81 Plaintext=f69f2445df4f9b17ad2b417be66c3710
   82 }
   83 
   84 Test="F.5.3 CTR-AES192.Encrypt"
   85 Type=Encrypt
   86 Key=8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b
   87 Init. Counter=f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff 
   88 Block #1={
   89 Input Block=f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff 
   90 Output Block=717d2dc639128334a6167a488ded7921 
   91 Plaintext=6bc1bee22e409f96e93d7e117393172a 
   92 Ciphertext=1abc932417521ca24f2b0459fe7e6e0b
   93 }
   94 Block #2={
   95 Input Block=f0f1f2f3f4f5f6f7f8f9fafbfcfdff00 
   96 Output Block=a72eb3bb14a556734b7bad6ab16100c5 
   97 Plaintext=ae2d8a571e03ac9c9eb76fac45af8e51 
   98 Ciphertext=090339ec0aa6faefd5ccc2c6f4ce8e94
   99 }
  100 Block #3={
  101 Input Block=f0f1f2f3f4f5f6f7f8f9fafbfcfdff01 
  102 Output Block=2efeae2d72b722613446dc7f4c2af918 
  103 Plaintext=30c81c46a35ce411e5fbc1191a0a52ef 
  104 Ciphertext=1e36b26bd1ebc670d1bd1d665620abf7
  105 }
  106 Block #4={
  107 Input Block=f0f1f2f3f4f5f6f7f8f9fafbfcfdff02 
  108 Output Block=b9e783b30dd7924ff7bc9b97beaa8740 
  109 Plaintext=f69f2445df4f9b17ad2b417be66c3710 
  110 Ciphertext=4f78a7f6d29809585a97daec58c6b050
  111 }
  112 
  113 Test="F.5.4 CTR-AES192.Decrypt"
  114 Type="Decrypt"
  115 Key=8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b
  116 Init. Counter=f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff 
  117 Block #1={
  118 Input Block=f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff 
  119 Output Block=717d2dc639128334a6167a488ded7921 
  120 Ciphertext=1abc932417521ca24f2b0459fe7e6e0b
  121 Plaintext=6bc1bee22e409f96e93d7e117393172a
  122 } 
  123 Block #2={
  124 Input Block=f0f1f2f3f4f5f6f7f8f9fafbfcfdff00 
  125 Output Block=a72eb3bb14a556734b7bad6ab16100c5 
  126 Ciphertext=090339ec0aa6faefd5ccc2c6f4ce8e94
  127 Plaintext=ae2d8a571e03ac9c9eb76fac45af8e51
  128 } 
  129 Block #3 
  130 Input Block=f0f1f2f3f4f5f6f7f8f9fafbfcfdff01 
  131 Output Block=2efeae2d72b722613446dc7f4c2af918 
  132 Ciphertext=1e36b26bd1ebc670d1bd1d665620abf7
  133 Plaintext=30c81c46a35ce411e5fbc1191a0a52ef
  134 }
  135 Block #4 
  136 Input Block=f0f1f2f3f4f5f6f7f8f9fafbfcfdff02 
  137 Output Block=b9e783b30dd7924ff7bc9b97beaa8740 
  138 Ciphertext=4f78a7f6d29809585a97daec58c6b050
  139 Plaintext=f69f2445df4f9b17ad2b417be66c3710 
  140 }
  141 
  142 Test="F.5.5 CTR-AES256.Encrypt"
  143 Type=Encrypt
  144 Key=603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4
  145 Init. Counter=f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
  146 Block #1={
  147 Input Block=f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
  148 Output Block=0bdf7df1591716335e9a8b15c860c502
  149 Plaintext=6bc1bee22e409f96e93d7e117393172a
  150 Ciphertext=601ec313775789a5b7a7f504bbf3d228
  151 }
  152 Block #2={
  153 Input Block=f0f1f2f3f4f5f6f7f8f9fafbfcfdff00
  154 Output Block=5a6e699d536119065433863c8f657b94
  155 Plaintext=ae2d8a571e03ac9c9eb76fac45af8e51
  156 Ciphertext=f443e3ca4d62b59aca84e990cacaf5c5
  157 }
  158 Block #3={
  159 Input Block=f0f1f2f3f4f5f6f7f8f9fafbfcfdff01
  160 Output Block=1bc12c9c01610d5d0d8bd6a3378eca62
  161 Plaintext=30c81c46a35ce411e5fbc1191a0a52ef
  162 Ciphertext=2b0930daa23de94ce87017ba2d84988d
  163 }
  164 Block #4={
  165 Input Block=f0f1f2f3f4f5f6f7f8f9fafbfcfdff02
  166 Output Block=2956e1c8693536b1bee99c73a31576b6
  167 Plaintext=f69f2445df4f9b17ad2b417be66c3710
  168 Ciphertext=dfc9c58db67aada613c2dd08457941a6
  169 }
  170 
  171 Test="F.5.6 CTR-AES256.Decrypt"
  172 Type=Decrypt
  173 Key=603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4
  174 Init. Counter=f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff 
  175 Block #1={
  176 Input Block=f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff 
  177 OutputBlock=0bdf7df1591716335e9a8b15c860c502 
  178 Ciphertext=601ec313775789a5b7a7f504bbf3d228
  179 Plaintext=6bc1bee22e409f96e93d7e117393172a 
  180 }
  181 Block #2={
  182 Input Block=f0f1f2f3f4f5f6f7f8f9fafbfcfdff00 
  183 OutputBlock=5a6e699d536119065433863c8f657b94 
  184 Ciphertext=f443e3ca4d62b59aca84e990cacaf5c5 
  185 Plaintext=ae2d8a571e03ac9c9eb76fac45af8e51 
  186 }
  187 Block #3={
  188 Input Block=f0f1f2f3f4f5f6f7f8f9fafbfcfdff01 
  189 OutputBlock=1bc12c9c01610d5d0d8bd6a3378eca62 
  190 Ciphertext=2b0930daa23de94ce87017ba2d84988d 
  191 Plaintext=30c81c46a35ce411e5fbc1191a0a52ef 
  192 }
  193 Block #4={
  194 Input Block=f0f1f2f3f4f5f6f7f8f9fafbfcfdff02 
  195 OutputBlock=2956e1c8693536b1bee99c73a31576b6 
  196 Ciphertext=dfc9c58db67aada613c2dd08457941a6 
  197 Plaintext=f69f2445df4f9b17ad2b417be66c3710
  198 }
  199