diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2015-06-04 03:25:57 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2015-06-04 03:25:57 +0300 |
commit | f89d5f29a90d6c71068a759e5891e925131a5e65 (patch) | |
tree | 0eef5f382f350542d9fa5a4288a285422ae61296 | |
parent | add CTR mode (diff) | |
download | aes-tools-f89d5f29a90d6c71068a759e5891e925131a5e65.tar.gz aes-tools-f89d5f29a90d6c71068a759e5891e925131a5e65.zip |
grammar tweaks
-rw-r--r-- | examples/aes128cbc_example.c | 10 | ||||
-rw-r--r-- | examples/aes128cfb_example.c | 10 | ||||
-rw-r--r-- | examples/aes128ctr_example.c | 10 | ||||
-rw-r--r-- | examples/aes128ecb_example.c | 10 | ||||
-rw-r--r-- | examples/aes128ofb_example.c | 10 | ||||
-rw-r--r-- | examples/aes192cbc_example.c | 10 | ||||
-rw-r--r-- | examples/aes192cfb_example.c | 10 | ||||
-rw-r--r-- | examples/aes192ctr_example.c | 10 | ||||
-rw-r--r-- | examples/aes192ecb_example.c | 10 | ||||
-rw-r--r-- | examples/aes192ofb_example.c | 10 | ||||
-rw-r--r-- | examples/aes256cbc_example.c | 10 | ||||
-rw-r--r-- | examples/aes256cfb_example.c | 10 | ||||
-rw-r--r-- | examples/aes256ctr_example.c | 10 | ||||
-rw-r--r-- | examples/aes256ecb_example.c | 10 | ||||
-rw-r--r-- | examples/aes256ofb_example.c | 10 | ||||
-rw-r--r-- | include/aesni/api.h | 108 | ||||
-rw-r--r-- | include/aesni/raw.h | 6 |
17 files changed, 132 insertions, 132 deletions
diff --git a/examples/aes128cbc_example.c b/examples/aes128cbc_example.c index 44df122..bf2c601 100644 --- a/examples/aes128cbc_example.c +++ b/examples/aes128cbc_example.c @@ -12,7 +12,7 @@ int main() { - __declspec(align(16)) AesBlock128 plain, key, cypher, decrypted, iv, next_iv; + __declspec(align(16)) AesBlock128 plain, key, cipher, decrypted, iv, next_iv; __declspec(align(16)) Aes128KeySchedule key_schedule, inverted_schedule; plain = make_aes_block128(0xffeeddcc, 0xbbaa9988, 0x77665544, 0x33221100); @@ -37,10 +37,10 @@ int main() for (int i = 0; i < 11; ++i) printf("\t[%d]: %s\n", i, format_aes_block128(&key_schedule.keys[i]).str); - cypher = aes128cbc_encrypt(plain, &key_schedule, iv, &next_iv); + cipher = aes128cbc_encrypt(plain, &key_schedule, iv, &next_iv); printf("\n"); - printf("Cypher: %s\n", format_aes_block128(&cypher).str); - print_aes_block128_fips_matrix_style(&cypher); + printf("Cypher: %s\n", format_aes_block128(&cipher).str); + print_aes_block128_fips_matrix_style(&cipher); printf("\n"); printf("Next initialization vector: %s\n", format_aes_block128(&next_iv).str); @@ -53,7 +53,7 @@ int main() for (int i = 0; i < 11; ++i) printf("\t[%d]: %s\n", i, format_aes_block128(&inverted_schedule.keys[i]).str); - decrypted = aes128cbc_decrypt(cypher, &inverted_schedule, iv, &next_iv); + decrypted = aes128cbc_decrypt(cipher, &inverted_schedule, iv, &next_iv); printf("\n"); printf("Decrypted: %s\n", format_aes_block128(&decrypted).str); print_aes_block128_fips_matrix_style(&decrypted); diff --git a/examples/aes128cfb_example.c b/examples/aes128cfb_example.c index 9d63a9a..c3b7cd2 100644 --- a/examples/aes128cfb_example.c +++ b/examples/aes128cfb_example.c @@ -12,7 +12,7 @@ int main() { - __declspec(align(16)) AesBlock128 plain, key, cypher, decrypted, iv, next_iv; + __declspec(align(16)) AesBlock128 plain, key, cipher, decrypted, iv, next_iv; __declspec(align(16)) Aes128KeySchedule key_schedule; plain = make_aes_block128(0xffeeddcc, 0xbbaa9988, 0x77665544, 0x33221100); @@ -37,16 +37,16 @@ int main() for (int i = 0; i < 11; ++i) printf("\t[%d]: %s\n", i, format_aes_block128(&key_schedule.keys[i]).str); - cypher = aes128cfb_encrypt(plain, &key_schedule, iv, &next_iv); + cipher = aes128cfb_encrypt(plain, &key_schedule, iv, &next_iv); printf("\n"); - printf("Cypher: %s\n", format_aes_block128(&cypher).str); - print_aes_block128_fips_matrix_style(&cypher); + printf("Cypher: %s\n", format_aes_block128(&cipher).str); + print_aes_block128_fips_matrix_style(&cipher); printf("\n"); printf("Next initialization vector: %s\n", format_aes_block128(&next_iv).str); print_aes_block128_fips_matrix_style(&next_iv); - decrypted = aes128cfb_decrypt(cypher, &key_schedule, iv, &next_iv); + decrypted = aes128cfb_decrypt(cipher, &key_schedule, iv, &next_iv); printf("\n"); printf("Decrypted: %s\n", format_aes_block128(&decrypted).str); print_aes_block128_fips_matrix_style(&decrypted); diff --git a/examples/aes128ctr_example.c b/examples/aes128ctr_example.c index b0d38ff..46251e8 100644 --- a/examples/aes128ctr_example.c +++ b/examples/aes128ctr_example.c @@ -12,7 +12,7 @@ int main() { - __declspec(align(16)) AesBlock128 plain, key, cypher, decrypted, iv; + __declspec(align(16)) AesBlock128 plain, key, cipher, decrypted, iv; __declspec(align(16)) Aes128KeySchedule key_schedule; plain = make_aes_block128(0xffeeddcc, 0xbbaa9988, 0x77665544, 0x33221100); @@ -37,12 +37,12 @@ int main() for (int i = 0; i < 11; ++i) printf("\t[%d]: %s\n", i, format_aes_block128(&key_schedule.keys[i]).str); - cypher = aes128ctr_encrypt(plain, &key_schedule, iv, 0); + cipher = aes128ctr_encrypt(plain, &key_schedule, iv, 0); printf("\n"); - printf("Cypher: %s\n", format_aes_block128(&cypher).str); - print_aes_block128_fips_matrix_style(&cypher); + printf("Cypher: %s\n", format_aes_block128(&cipher).str); + print_aes_block128_fips_matrix_style(&cipher); - decrypted = aes128ctr_decrypt(cypher, &key_schedule, iv, 0); + decrypted = aes128ctr_decrypt(cipher, &key_schedule, iv, 0); printf("\n"); printf("Decrypted: %s\n", format_aes_block128(&decrypted).str); print_aes_block128_fips_matrix_style(&decrypted); diff --git a/examples/aes128ecb_example.c b/examples/aes128ecb_example.c index 78b7e5f..1d8e7ae 100644 --- a/examples/aes128ecb_example.c +++ b/examples/aes128ecb_example.c @@ -12,7 +12,7 @@ int main() { - __declspec(align(16)) AesBlock128 plain, key, cypher, decrypted; + __declspec(align(16)) AesBlock128 plain, key, cipher, decrypted; __declspec(align(16)) Aes128KeySchedule key_schedule, inverted_schedule; plain = make_aes_block128(0xffeeddcc, 0xbbaa9988, 0x77665544, 0x33221100); @@ -32,10 +32,10 @@ int main() for (int i = 0; i < 11; ++i) printf("\t[%d]: %s\n", i, format_aes_block128(&key_schedule.keys[i]).str); - cypher = aes128ecb_encrypt(plain, &key_schedule); + cipher = aes128ecb_encrypt(plain, &key_schedule); printf("\n"); - printf("Cypher: %s\n", format_aes_block128(&cypher).str); - print_aes_block128_fips_matrix_style(&cypher); + printf("Cypher: %s\n", format_aes_block128(&cipher).str); + print_aes_block128_fips_matrix_style(&cipher); aes128_invert_key_schedule(&key_schedule, &inverted_schedule); @@ -44,7 +44,7 @@ int main() for (int i = 0; i < 11; ++i) printf("\t[%d]: %s\n", i, format_aes_block128(&inverted_schedule.keys[i]).str); - decrypted = aes128ecb_decrypt(cypher, &inverted_schedule); + decrypted = aes128ecb_decrypt(cipher, &inverted_schedule); printf("\n"); printf("Decrypted: %s\n", format_aes_block128(&decrypted).str); print_aes_block128_fips_matrix_style(&decrypted); diff --git a/examples/aes128ofb_example.c b/examples/aes128ofb_example.c index 7685008..51f0a8d 100644 --- a/examples/aes128ofb_example.c +++ b/examples/aes128ofb_example.c @@ -12,7 +12,7 @@ int main() { - __declspec(align(16)) AesBlock128 plain, key, cypher, decrypted, iv, next_iv; + __declspec(align(16)) AesBlock128 plain, key, cipher, decrypted, iv, next_iv; __declspec(align(16)) Aes128KeySchedule key_schedule; plain = make_aes_block128(0xffeeddcc, 0xbbaa9988, 0x77665544, 0x33221100); @@ -37,16 +37,16 @@ int main() for (int i = 0; i < 11; ++i) printf("\t[%d]: %s\n", i, format_aes_block128(&key_schedule.keys[i]).str); - cypher = aes128ofb_encrypt(plain, &key_schedule, iv, &next_iv); + cipher = aes128ofb_encrypt(plain, &key_schedule, iv, &next_iv); printf("\n"); - printf("Cypher: %s\n", format_aes_block128(&cypher).str); - print_aes_block128_fips_matrix_style(&cypher); + printf("Cypher: %s\n", format_aes_block128(&cipher).str); + print_aes_block128_fips_matrix_style(&cipher); printf("\n"); printf("Next initialization vector: %s\n", format_aes_block128(&next_iv).str); print_aes_block128_fips_matrix_style(&next_iv); - decrypted = aes128ofb_decrypt(cypher, &key_schedule, iv, &next_iv); + decrypted = aes128ofb_decrypt(cipher, &key_schedule, iv, &next_iv); printf("\n"); printf("Decrypted: %s\n", format_aes_block128(&decrypted).str); print_aes_block128_fips_matrix_style(&decrypted); diff --git a/examples/aes192cbc_example.c b/examples/aes192cbc_example.c index 2133a17..522cc09 100644 --- a/examples/aes192cbc_example.c +++ b/examples/aes192cbc_example.c @@ -12,7 +12,7 @@ int main() { - __declspec(align(16)) AesBlock128 plain, cypher, decrypted, iv, next_iv; + __declspec(align(16)) AesBlock128 plain, cipher, decrypted, iv, next_iv; __declspec(align(16)) AesBlock192 key; __declspec(align(16)) Aes192KeySchedule key_schedule, inverted_schedule; @@ -38,10 +38,10 @@ int main() for (int i = 0; i < 13; ++i) printf("\t[%d]: %s\n", i, format_aes_block128(&key_schedule.keys[i]).str); - cypher = aes192cbc_encrypt(plain, &key_schedule, iv, &next_iv); + cipher = aes192cbc_encrypt(plain, &key_schedule, iv, &next_iv); printf("\n"); - printf("Cypher: %s\n", format_aes_block128(&cypher).str); - print_aes_block128_fips_matrix_style(&cypher); + printf("Cypher: %s\n", format_aes_block128(&cipher).str); + print_aes_block128_fips_matrix_style(&cipher); printf("\n"); printf("Next initialization vector: %s\n", format_aes_block128(&next_iv).str); @@ -54,7 +54,7 @@ int main() for (int i = 0; i < 13; ++i) printf("\t[%d]: %s\n", i, format_aes_block128(&inverted_schedule.keys[i]).str); - decrypted = aes192cbc_decrypt(cypher, &inverted_schedule, iv, &next_iv); + decrypted = aes192cbc_decrypt(cipher, &inverted_schedule, iv, &next_iv); printf("\n"); printf("Decrypted: %s\n", format_aes_block128(&decrypted).str); print_aes_block128_fips_matrix_style(&decrypted); diff --git a/examples/aes192cfb_example.c b/examples/aes192cfb_example.c index d3ac8bc..598516a 100644 --- a/examples/aes192cfb_example.c +++ b/examples/aes192cfb_example.c @@ -12,7 +12,7 @@ int main() { - __declspec(align(16)) AesBlock128 plain, cypher, decrypted, iv, next_iv; + __declspec(align(16)) AesBlock128 plain, cipher, decrypted, iv, next_iv; __declspec(align(16)) AesBlock192 key; __declspec(align(16)) Aes192KeySchedule key_schedule; @@ -38,16 +38,16 @@ int main() for (int i = 0; i < 13; ++i) printf("\t[%d]: %s\n", i, format_aes_block128(&key_schedule.keys[i]).str); - cypher = aes192cfb_encrypt(plain, &key_schedule, iv, &next_iv); + cipher = aes192cfb_encrypt(plain, &key_schedule, iv, &next_iv); printf("\n"); - printf("Cypher: %s\n", format_aes_block128(&cypher).str); - print_aes_block128_fips_matrix_style(&cypher); + printf("Cypher: %s\n", format_aes_block128(&cipher).str); + print_aes_block128_fips_matrix_style(&cipher); printf("\n"); printf("Next initialization vector: %s\n", format_aes_block128(&next_iv).str); print_aes_block128_fips_matrix_style(&next_iv); - decrypted = aes192cfb_decrypt(cypher, &key_schedule, iv, &next_iv); + decrypted = aes192cfb_decrypt(cipher, &key_schedule, iv, &next_iv); printf("\n"); printf("Decrypted: %s\n", format_aes_block128(&decrypted).str); print_aes_block128_fips_matrix_style(&decrypted); diff --git a/examples/aes192ctr_example.c b/examples/aes192ctr_example.c index c438f55..6ba8430 100644 --- a/examples/aes192ctr_example.c +++ b/examples/aes192ctr_example.c @@ -12,7 +12,7 @@ int main() { - __declspec(align(16)) AesBlock128 plain, cypher, decrypted, iv; + __declspec(align(16)) AesBlock128 plain, cipher, decrypted, iv; __declspec(align(16)) AesBlock192 key; __declspec(align(16)) Aes192KeySchedule key_schedule; @@ -38,12 +38,12 @@ int main() for (int i = 0; i < 13; ++i) printf("\t[%d]: %s\n", i, format_aes_block128(&key_schedule.keys[i]).str); - cypher = aes192ctr_encrypt(plain, &key_schedule, iv, 0); + cipher = aes192ctr_encrypt(plain, &key_schedule, iv, 0); printf("\n"); - printf("Cypher: %s\n", format_aes_block128(&cypher).str); - print_aes_block128_fips_matrix_style(&cypher); + printf("Cypher: %s\n", format_aes_block128(&cipher).str); + print_aes_block128_fips_matrix_style(&cipher); - decrypted = aes192ctr_decrypt(cypher, &key_schedule, iv, 0); + decrypted = aes192ctr_decrypt(cipher, &key_schedule, iv, 0); printf("\n"); printf("Decrypted: %s\n", format_aes_block128(&decrypted).str); print_aes_block128_fips_matrix_style(&decrypted); diff --git a/examples/aes192ecb_example.c b/examples/aes192ecb_example.c index e0d435b..5aae0bc 100644 --- a/examples/aes192ecb_example.c +++ b/examples/aes192ecb_example.c @@ -12,7 +12,7 @@ int main() { - __declspec(align(16)) AesBlock128 plain, cypher, decrypted; + __declspec(align(16)) AesBlock128 plain, cipher, decrypted; __declspec(align(16)) AesBlock192 key; __declspec(align(16)) Aes192KeySchedule key_schedule, inverted_schedule; @@ -33,10 +33,10 @@ int main() for (int i = 0; i < 13; ++i) printf("\t[%d]: %s\n", i, format_aes_block128(&key_schedule.keys[i]).str); - cypher = aes192ecb_encrypt(plain, &key_schedule); + cipher = aes192ecb_encrypt(plain, &key_schedule); printf("\n"); - printf("Cypher: %s\n", format_aes_block128(&cypher).str); - print_aes_block128_fips_matrix_style(&cypher); + printf("Cypher: %s\n", format_aes_block128(&cipher).str); + print_aes_block128_fips_matrix_style(&cipher); aes192_invert_key_schedule(&key_schedule, &inverted_schedule); @@ -45,7 +45,7 @@ int main() for (int i = 0; i < 13; ++i) printf("\t[%d]: %s\n", i, format_aes_block128(&inverted_schedule.keys[i]).str); - decrypted = aes192ecb_decrypt(cypher, &inverted_schedule); + decrypted = aes192ecb_decrypt(cipher, &inverted_schedule); printf("\n"); printf("Decrypted: %s\n", format_aes_block128(&decrypted).str); print_aes_block128_fips_matrix_style(&decrypted); diff --git a/examples/aes192ofb_example.c b/examples/aes192ofb_example.c index 1a50dfb..1e561cb 100644 --- a/examples/aes192ofb_example.c +++ b/examples/aes192ofb_example.c @@ -12,7 +12,7 @@ int main() { - __declspec(align(16)) AesBlock128 plain, cypher, decrypted, iv, next_iv; + __declspec(align(16)) AesBlock128 plain, cipher, decrypted, iv, next_iv; __declspec(align(16)) AesBlock192 key; __declspec(align(16)) Aes192KeySchedule key_schedule; @@ -38,16 +38,16 @@ int main() for (int i = 0; i < 13; ++i) printf("\t[%d]: %s\n", i, format_aes_block128(&key_schedule.keys[i]).str); - cypher = aes192ofb_encrypt(plain, &key_schedule, iv, &next_iv); + cipher = aes192ofb_encrypt(plain, &key_schedule, iv, &next_iv); printf("\n"); - printf("Cypher: %s\n", format_aes_block128(&cypher).str); - print_aes_block128_fips_matrix_style(&cypher); + printf("Cypher: %s\n", format_aes_block128(&cipher).str); + print_aes_block128_fips_matrix_style(&cipher); printf("\n"); printf("Next initialization vector: %s\n", format_aes_block128(&next_iv).str); print_aes_block128_fips_matrix_style(&next_iv); - decrypted = aes192ofb_decrypt(cypher, &key_schedule, iv, &next_iv); + decrypted = aes192ofb_decrypt(cipher, &key_schedule, iv, &next_iv); printf("\n"); printf("Decrypted: %s\n", format_aes_block128(&decrypted).str); print_aes_block128_fips_matrix_style(&decrypted); diff --git a/examples/aes256cbc_example.c b/examples/aes256cbc_example.c index 21ae58d..b727bec 100644 --- a/examples/aes256cbc_example.c +++ b/examples/aes256cbc_example.c @@ -12,7 +12,7 @@ int main() { - __declspec(align(16)) AesBlock128 plain, cypher, decrypted, iv, next_iv; + __declspec(align(16)) AesBlock128 plain, cipher, decrypted, iv, next_iv; __declspec(align(16)) AesBlock256 key; __declspec(align(16)) Aes256KeySchedule key_schedule, inverted_schedule; @@ -38,10 +38,10 @@ int main() for (int i = 0; i < 15; ++i) printf("\t[%d]: %s\n", i, format_aes_block128(&key_schedule.keys[i]).str); - cypher = aes256cbc_encrypt(plain, &key_schedule, iv, &next_iv); + cipher = aes256cbc_encrypt(plain, &key_schedule, iv, &next_iv); printf("\n"); - printf("Cypher: %s\n", format_aes_block128(&cypher).str); - print_aes_block128_fips_matrix_style(&cypher); + printf("Cypher: %s\n", format_aes_block128(&cipher).str); + print_aes_block128_fips_matrix_style(&cipher); printf("\n"); printf("Next initialization vector: %s\n", format_aes_block128(&next_iv).str); @@ -54,7 +54,7 @@ int main() for (int i = 0; i < 15; ++i) printf("\t[%d]: %s\n", i, format_aes_block128(&inverted_schedule.keys[i]).str); - decrypted = aes256cbc_decrypt(cypher, &inverted_schedule, iv, &next_iv); + decrypted = aes256cbc_decrypt(cipher, &inverted_schedule, iv, &next_iv); printf("\n"); printf("Decrypted: %s\n", format_aes_block128(&decrypted).str); print_aes_block128_fips_matrix_style(&decrypted); diff --git a/examples/aes256cfb_example.c b/examples/aes256cfb_example.c index 35dd21f..9541ddd 100644 --- a/examples/aes256cfb_example.c +++ b/examples/aes256cfb_example.c @@ -12,7 +12,7 @@ int main() { - __declspec(align(16)) AesBlock128 plain, cypher, decrypted, iv, next_iv; + __declspec(align(16)) AesBlock128 plain, cipher, decrypted, iv, next_iv; __declspec(align(16)) AesBlock256 key; __declspec(align(16)) Aes256KeySchedule key_schedule; @@ -38,16 +38,16 @@ int main() for (int i = 0; i < 15; ++i) printf("\t[%d]: %s\n", i, format_aes_block128(&key_schedule.keys[i]).str); - cypher = aes256cfb_encrypt(plain, &key_schedule, iv, &next_iv); + cipher = aes256cfb_encrypt(plain, &key_schedule, iv, &next_iv); printf("\n"); - printf("Cypher: %s\n", format_aes_block128(&cypher).str); - print_aes_block128_fips_matrix_style(&cypher); + printf("Cypher: %s\n", format_aes_block128(&cipher).str); + print_aes_block128_fips_matrix_style(&cipher); printf("\n"); printf("Next initialization vector: %s\n", format_aes_block128(&next_iv).str); print_aes_block128_fips_matrix_style(&next_iv); - decrypted = aes256cfb_decrypt(cypher, &key_schedule, iv, &next_iv); + decrypted = aes256cfb_decrypt(cipher, &key_schedule, iv, &next_iv); printf("\n"); printf("Decrypted: %s\n", format_aes_block128(&decrypted).str); print_aes_block128_fips_matrix_style(&decrypted); diff --git a/examples/aes256ctr_example.c b/examples/aes256ctr_example.c index a6fcffe..647d668 100644 --- a/examples/aes256ctr_example.c +++ b/examples/aes256ctr_example.c @@ -12,7 +12,7 @@ int main() { - __declspec(align(16)) AesBlock128 plain, cypher, decrypted, iv; + __declspec(align(16)) AesBlock128 plain, cipher, decrypted, iv; __declspec(align(16)) AesBlock256 key; __declspec(align(16)) Aes256KeySchedule key_schedule; @@ -38,12 +38,12 @@ int main() for (int i = 0; i < 15; ++i) printf("\t[%d]: %s\n", i, format_aes_block128(&key_schedule.keys[i]).str); - cypher = aes256ctr_encrypt(plain, &key_schedule, iv, 0); + cipher = aes256ctr_encrypt(plain, &key_schedule, iv, 0); printf("\n"); - printf("Cypher: %s\n", format_aes_block128(&cypher).str); - print_aes_block128_fips_matrix_style(&cypher); + printf("Cypher: %s\n", format_aes_block128(&cipher).str); + print_aes_block128_fips_matrix_style(&cipher); - decrypted = aes256ctr_decrypt(cypher, &key_schedule, iv, 0); + decrypted = aes256ctr_decrypt(cipher, &key_schedule, iv, 0); printf("\n"); printf("Decrypted: %s\n", format_aes_block128(&decrypted).str); print_aes_block128_fips_matrix_style(&decrypted); diff --git a/examples/aes256ecb_example.c b/examples/aes256ecb_example.c index 37366a3..31d05d7 100644 --- a/examples/aes256ecb_example.c +++ b/examples/aes256ecb_example.c @@ -12,7 +12,7 @@ int main() { - __declspec(align(16)) AesBlock128 plain, cypher, decrypted; + __declspec(align(16)) AesBlock128 plain, cipher, decrypted; __declspec(align(16)) AesBlock256 key; __declspec(align(16)) Aes256KeySchedule key_schedule, inverted_schedule; @@ -33,10 +33,10 @@ int main() for (int i = 0; i < 15; ++i) printf("\t[%d]: %s\n", i, format_aes_block128(&key_schedule.keys[i]).str); - cypher = aes256ecb_encrypt(plain, &key_schedule); + cipher = aes256ecb_encrypt(plain, &key_schedule); printf("\n"); - printf("Cypher: %s\n", format_aes_block128(&cypher).str); - print_aes_block128_fips_matrix_style(&cypher); + printf("Cypher: %s\n", format_aes_block128(&cipher).str); + print_aes_block128_fips_matrix_style(&cipher); aes256_invert_key_schedule(&key_schedule, &inverted_schedule); @@ -45,7 +45,7 @@ int main() for (int i = 0; i < 15; ++i) printf("\t[%d]: %s\n", i, format_aes_block128(&inverted_schedule.keys[i]).str); - decrypted = aes256ecb_decrypt(cypher, &inverted_schedule); + decrypted = aes256ecb_decrypt(cipher, &inverted_schedule); printf("\n"); printf("Decrypted: %s\n", format_aes_block128(&decrypted).str); print_aes_block128_fips_matrix_style(&decrypted); diff --git a/examples/aes256ofb_example.c b/examples/aes256ofb_example.c index 749103e..4b2248a 100644 --- a/examples/aes256ofb_example.c +++ b/examples/aes256ofb_example.c @@ -12,7 +12,7 @@ int main() { - __declspec(align(16)) AesBlock128 plain, cypher, decrypted, iv, next_iv; + __declspec(align(16)) AesBlock128 plain, cipher, decrypted, iv, next_iv; __declspec(align(16)) AesBlock256 key; __declspec(align(16)) Aes256KeySchedule key_schedule; @@ -38,16 +38,16 @@ int main() for (int i = 0; i < 15; ++i) printf("\t[%d]: %s\n", i, format_aes_block128(&key_schedule.keys[i]).str); - cypher = aes256ofb_encrypt(plain, &key_schedule, iv, &next_iv); + cipher = aes256ofb_encrypt(plain, &key_schedule, iv, &next_iv); printf("\n"); - printf("Cypher: %s\n", format_aes_block128(&cypher).str); - print_aes_block128_fips_matrix_style(&cypher); + printf("Cypher: %s\n", format_aes_block128(&cipher).str); + print_aes_block128_fips_matrix_style(&cipher); printf("\n"); printf("Next initialization vector: %s\n", format_aes_block128(&next_iv).str); print_aes_block128_fips_matrix_style(&next_iv); - decrypted = aes256ofb_decrypt(cypher, &key_schedule, iv, &next_iv); + decrypted = aes256ofb_decrypt(cipher, &key_schedule, iv, &next_iv); printf("\n"); printf("Decrypted: %s\n", format_aes_block128(&decrypted).str); print_aes_block128_fips_matrix_style(&decrypted); diff --git a/include/aesni/api.h b/include/aesni/api.h index 3318aef..0d45fd8 100644 --- a/include/aesni/api.h +++ b/include/aesni/api.h @@ -33,10 +33,10 @@ static __inline AesBlock128 __fastcall aes128ecb_encrypt( } static __inline AesBlock128 __fastcall aes128ecb_decrypt( - AesBlock128 cypher, + AesBlock128 cipher, Aes128KeySchedule* inverted_schedule) { - return raw_aes128ecb_decrypt(cypher, inverted_schedule); + return raw_aes128ecb_decrypt(cipher, inverted_schedule); } static __inline AesBlock128 __fastcall aes128cbc_encrypt( @@ -45,19 +45,19 @@ static __inline AesBlock128 __fastcall aes128cbc_encrypt( AesBlock128 init_vector, AesBlock128* next_init_vector) { - AesBlock128 cypher = raw_aes128ecb_encrypt(_mm_xor_si128(plain, init_vector), key_schedule); - _mm_storeu_si128(next_init_vector, cypher); - return cypher; + AesBlock128 cipher = raw_aes128ecb_encrypt(_mm_xor_si128(plain, init_vector), key_schedule); + _mm_storeu_si128(next_init_vector, cipher); + return cipher; } static __inline AesBlock128 __fastcall aes128cbc_decrypt( - AesBlock128 cypher, + AesBlock128 cipher, Aes128KeySchedule* inverted_schedule, AesBlock128 init_vector, AesBlock128* next_init_vector) { - AesBlock128 plain = _mm_xor_si128(raw_aes128ecb_decrypt(cypher, inverted_schedule), init_vector); - _mm_storeu_si128(next_init_vector, cypher); + AesBlock128 plain = _mm_xor_si128(raw_aes128ecb_decrypt(cipher, inverted_schedule), init_vector); + _mm_storeu_si128(next_init_vector, cipher); return plain; } @@ -67,19 +67,19 @@ static __inline AesBlock128 __fastcall aes128cfb_encrypt( AesBlock128 init_vector, AesBlock128* next_init_vector) { - AesBlock128 cypher = _mm_xor_si128(raw_aes128ecb_encrypt(init_vector, key_schedule), plain); - _mm_storeu_si128(next_init_vector, cypher); - return cypher; + AesBlock128 cipher = _mm_xor_si128(raw_aes128ecb_encrypt(init_vector, key_schedule), plain); + _mm_storeu_si128(next_init_vector, cipher); + return cipher; } static __inline AesBlock128 __fastcall aes128cfb_decrypt( - AesBlock128 cypher, + AesBlock128 cipher, Aes128KeySchedule* key_schedule, AesBlock128 init_vector, AesBlock128* next_init_vector) { - AesBlock128 plain = _mm_xor_si128(raw_aes128ecb_encrypt(init_vector, key_schedule), cypher); - _mm_storeu_si128(next_init_vector, cypher); + AesBlock128 plain = _mm_xor_si128(raw_aes128ecb_encrypt(init_vector, key_schedule), cipher); + _mm_storeu_si128(next_init_vector, cipher); return plain; } @@ -95,14 +95,14 @@ static __inline AesBlock128 __fastcall aes128ofb_encrypt( } static __inline AesBlock128 __fastcall aes128ofb_decrypt( - AesBlock128 cypher, + AesBlock128 cipher, Aes128KeySchedule* key_schedule, AesBlock128 init_vector, AesBlock128* next_init_vector) { AesBlock128 tmp = raw_aes128ecb_encrypt(init_vector, key_schedule); _mm_storeu_si128(next_init_vector, tmp); - return _mm_xor_si128(tmp, cypher); + return _mm_xor_si128(tmp, cipher); } static __inline AesBlock128 __fastcall aes128ctr_encrypt( @@ -118,7 +118,7 @@ static __inline AesBlock128 __fastcall aes128ctr_encrypt( } static __inline AesBlock128 __fastcall aes128ctr_decrypt( - AesBlock128 cypher, + AesBlock128 cipher, Aes128KeySchedule* key_schedule, AesBlock128 init_vector, int counter) @@ -126,7 +126,7 @@ static __inline AesBlock128 __fastcall aes128ctr_decrypt( init_vector = aes128_le2be(init_vector); init_vector = _mm_add_epi32(init_vector, make_aes_block128(0, 0, 0, counter)); init_vector = aes128_be2le(init_vector); - return _mm_xor_si128(cypher, raw_aes128ecb_encrypt(init_vector, key_schedule)); + return _mm_xor_si128(cipher, raw_aes128ecb_encrypt(init_vector, key_schedule)); } static __inline void __fastcall aes192_expand_key_schedule( @@ -151,10 +151,10 @@ static __inline AesBlock128 __fastcall aes192ecb_encrypt( } static __inline AesBlock128 __fastcall aes192ecb_decrypt( - AesBlock128 cypher, + AesBlock128 cipher, Aes192KeySchedule* inverted_schedule) { - return raw_aes192ecb_decrypt(cypher, inverted_schedule); + return raw_aes192ecb_decrypt(cipher, inverted_schedule); } static __inline AesBlock128 __fastcall aes192cbc_encrypt( @@ -163,19 +163,19 @@ static __inline AesBlock128 __fastcall aes192cbc_encrypt( AesBlock128 init_vector, AesBlock128* next_init_vector) { - AesBlock128 cypher = raw_aes192ecb_encrypt(_mm_xor_si128(plain, init_vector), key_schedule); - _mm_storeu_si128(next_init_vector, cypher); - return cypher; + AesBlock128 cipher = raw_aes192ecb_encrypt(_mm_xor_si128(plain, init_vector), key_schedule); + _mm_storeu_si128(next_init_vector, cipher); + return cipher; } static __inline AesBlock128 __fastcall aes192cbc_decrypt( - AesBlock128 cypher, + AesBlock128 cipher, Aes192KeySchedule* inverted_schedule, AesBlock128 init_vector, AesBlock128* next_init_vector) { - AesBlock128 plain = _mm_xor_si128(raw_aes192ecb_decrypt(cypher, inverted_schedule), init_vector); - _mm_storeu_si128(next_init_vector, cypher); + AesBlock128 plain = _mm_xor_si128(raw_aes192ecb_decrypt(cipher, inverted_schedule), init_vector); + _mm_storeu_si128(next_init_vector, cipher); return plain; } @@ -185,19 +185,19 @@ static __inline AesBlock128 __fastcall aes192cfb_encrypt( AesBlock128 init_vector, AesBlock128* next_init_vector) { - AesBlock128 cypher = _mm_xor_si128(raw_aes192ecb_encrypt(init_vector, key_schedule), plain); - _mm_storeu_si128(next_init_vector, cypher); - return cypher; + AesBlock128 cipher = _mm_xor_si128(raw_aes192ecb_encrypt(init_vector, key_schedule), plain); + _mm_storeu_si128(next_init_vector, cipher); + return cipher; } static __inline AesBlock128 __fastcall aes192cfb_decrypt( - AesBlock128 cypher, + AesBlock128 cipher, Aes192KeySchedule* key_schedule, AesBlock128 init_vector, AesBlock128* next_init_vector) { - AesBlock128 plain = _mm_xor_si128(raw_aes192ecb_encrypt(init_vector, key_schedule), cypher); - _mm_storeu_si128(next_init_vector, cypher); + AesBlock128 plain = _mm_xor_si128(raw_aes192ecb_encrypt(init_vector, key_schedule), cipher); + _mm_storeu_si128(next_init_vector, cipher); return plain; } @@ -213,14 +213,14 @@ static __inline AesBlock128 __fastcall aes192ofb_encrypt( } static __inline AesBlock128 __fastcall aes192ofb_decrypt( - AesBlock128 cypher, + AesBlock128 cipher, Aes192KeySchedule* key_schedule, AesBlock128 init_vector, AesBlock128* next_init_vector) { AesBlock128 tmp = raw_aes192ecb_encrypt(init_vector, key_schedule); _mm_storeu_si128(next_init_vector, tmp); - return _mm_xor_si128(tmp, cypher); + return _mm_xor_si128(tmp, cipher); } static __inline AesBlock128 __fastcall aes192ctr_encrypt( @@ -236,7 +236,7 @@ static __inline AesBlock128 __fastcall aes192ctr_encrypt( } static __inline AesBlock128 __fastcall aes192ctr_decrypt( - AesBlock128 cypher, + AesBlock128 cipher, Aes192KeySchedule* key_schedule, AesBlock128 init_vector, int counter) @@ -244,7 +244,7 @@ static __inline AesBlock128 __fastcall aes192ctr_decrypt( init_vector = aes128_le2be(init_vector); init_vector = _mm_add_epi32(init_vector, make_aes_block128(0, 0, 0, counter)); init_vector = aes128_be2le(init_vector); - return _mm_xor_si128(cypher, raw_aes192ecb_encrypt(init_vector, key_schedule)); + return _mm_xor_si128(cipher, raw_aes192ecb_encrypt(init_vector, key_schedule)); } static __inline void __fastcall aes256_expand_key_schedule( @@ -269,10 +269,10 @@ static __inline AesBlock128 __fastcall aes256ecb_encrypt( } static __inline AesBlock128 __fastcall aes256ecb_decrypt( - AesBlock128 cypher, + AesBlock128 cipher, Aes256KeySchedule* inverted_schedule) { - return raw_aes256ecb_decrypt(cypher, inverted_schedule); + return raw_aes256ecb_decrypt(cipher, inverted_schedule); } static __inline AesBlock128 __fastcall aes256cbc_encrypt( @@ -281,19 +281,19 @@ static __inline AesBlock128 __fastcall aes256cbc_encrypt( AesBlock128 init_vector, AesBlock128* next_init_vector) { - AesBlock128 cypher = raw_aes256ecb_encrypt(_mm_xor_si128(plain, init_vector), key_schedule); - _mm_storeu_si128(next_init_vector, cypher); - return cypher; + AesBlock128 cipher = raw_aes256ecb_encrypt(_mm_xor_si128(plain, init_vector), key_schedule); + _mm_storeu_si128(next_init_vector, cipher); + return cipher; } static __inline AesBlock128 __fastcall aes256cbc_decrypt( - AesBlock128 cypher, + AesBlock128 cipher, Aes256KeySchedule* inverted_schedule, AesBlock128 init_vector, AesBlock128* next_init_vector) { - AesBlock128 plain = _mm_xor_si128(raw_aes256ecb_decrypt(cypher, inverted_schedule), init_vector); - _mm_storeu_si128(next_init_vector, cypher); + AesBlock128 plain = _mm_xor_si128(raw_aes256ecb_decrypt(cipher, inverted_schedule), init_vector); + _mm_storeu_si128(next_init_vector, cipher); return plain; } @@ -303,19 +303,19 @@ static __inline AesBlock128 __fastcall aes256cfb_encrypt( AesBlock128 init_vector, AesBlock128* next_init_vector) { - AesBlock128 cypher = _mm_xor_si128(raw_aes256ecb_encrypt(init_vector, key_schedule), plain); - _mm_storeu_si128(next_init_vector, cypher); - return cypher; + AesBlock128 cipher = _mm_xor_si128(raw_aes256ecb_encrypt(init_vector, key_schedule), plain); + _mm_storeu_si128(next_init_vector, cipher); + return cipher; } static __inline AesBlock128 __fastcall aes256cfb_decrypt( - AesBlock128 cypher, + AesBlock128 cipher, Aes256KeySchedule* key_schedule, AesBlock128 init_vector, AesBlock128* next_init_vector) { - AesBlock128 plain = _mm_xor_si128(raw_aes256ecb_encrypt(init_vector, key_schedule), cypher); - _mm_storeu_si128(next_init_vector, cypher); + AesBlock128 plain = _mm_xor_si128(raw_aes256ecb_encrypt(init_vector, key_schedule), cipher); + _mm_storeu_si128(next_init_vector, cipher); return plain; } @@ -331,14 +331,14 @@ static __inline AesBlock128 __fastcall aes256ofb_encrypt( } static __inline AesBlock128 __fastcall aes256ofb_decrypt( - AesBlock128 cypher, + AesBlock128 cipher, Aes256KeySchedule* key_schedule, AesBlock128 init_vector, AesBlock128* next_init_vector) { AesBlock128 tmp = raw_aes256ecb_encrypt(init_vector, key_schedule); _mm_storeu_si128(next_init_vector, tmp); - return _mm_xor_si128(tmp, cypher); + return _mm_xor_si128(tmp, cipher); } static __inline AesBlock128 __fastcall aes256ctr_encrypt( @@ -354,7 +354,7 @@ static __inline AesBlock128 __fastcall aes256ctr_encrypt( } static __inline AesBlock128 __fastcall aes256ctr_decrypt( - AesBlock128 cypher, + AesBlock128 cipher, Aes256KeySchedule* key_schedule, AesBlock128 init_vector, int counter) @@ -362,5 +362,5 @@ static __inline AesBlock128 __fastcall aes256ctr_decrypt( init_vector = aes128_le2be(init_vector); init_vector = _mm_add_epi32(init_vector, make_aes_block128(0, 0, 0, counter)); init_vector = aes128_be2le(init_vector); - return _mm_xor_si128(cypher, raw_aes256ecb_encrypt(init_vector, key_schedule)); + return _mm_xor_si128(cipher, raw_aes256ecb_encrypt(init_vector, key_schedule)); } diff --git a/include/aesni/raw.h b/include/aesni/raw.h index d6b9518..62ce639 100644 --- a/include/aesni/raw.h +++ b/include/aesni/raw.h @@ -21,7 +21,7 @@ AesBlock128 __fastcall raw_aes128ecb_encrypt( AesBlock128 plain, Aes128KeySchedule* key_schedule); AesBlock128 __fastcall raw_aes128ecb_decrypt( - AesBlock128 cypher, + AesBlock128 cipher, Aes128KeySchedule* inverted_schedule); void __fastcall raw_aes192_expand_key_schedule( @@ -36,7 +36,7 @@ AesBlock128 __fastcall raw_aes192ecb_encrypt( AesBlock128 plain, Aes192KeySchedule* key_schedule); AesBlock128 __fastcall raw_aes192ecb_decrypt( - AesBlock128 cypher, + AesBlock128 cipher, Aes192KeySchedule* inverted_schedule); void __fastcall raw_aes256_expand_key_schedule( @@ -51,5 +51,5 @@ AesBlock128 __fastcall raw_aes256ecb_encrypt( AesBlock128 plain, Aes256KeySchedule* key_schedule); AesBlock128 __fastcall raw_aes256ecb_decrypt( - AesBlock128 cypher, + AesBlock128 cipher, Aes256KeySchedule* inverted_schedule); |