svn rev #23733: trunk/src/lib/crypto/crypto_tests/
ghudson@MIT.EDU
ghudson at MIT.EDU
Wed Feb 17 15:27:22 EST 2010
http://src.mit.edu/fisheye/changelog/krb5/?cs=23733
Commit By: ghudson
Log Message:
Add display statements for the encrypted tokens generated by t_encrypt
so that its output can be compared between different back ends.
Changed Files:
U trunk/src/lib/crypto/crypto_tests/t_encrypt.c
Modified: trunk/src/lib/crypto/crypto_tests/t_encrypt.c
===================================================================
--- trunk/src/lib/crypto/crypto_tests/t_encrypt.c 2010-02-17 16:09:43 UTC (rev 23732)
+++ trunk/src/lib/crypto/crypto_tests/t_encrypt.c 2010-02-17 20:27:22 UTC (rev 23733)
@@ -75,6 +75,17 @@
return 0;
}
+static void
+display(const char *msg, const krb5_data *d)
+{
+ unsigned int i;
+
+ printf("%s:", msg);
+ for (i = 0; i < d->length; i++)
+ printf(" %02X", (unsigned char) d->data[i]);
+ printf("\n");
+}
+
int
main ()
{
@@ -134,6 +145,7 @@
/* Encrypt, decrypt, and see if we got the plaintext back again. */
test ("Encrypting (c)",
krb5_c_encrypt (context, keyblock, 7, 0, &in, &enc_out));
+ display ("Enc output", &enc_out.ciphertext);
test ("Decrypting",
krb5_c_decrypt (context, keyblock, 7, 0, &enc_out, &check));
test ("Comparing", compare_results (&in, &check));
@@ -142,6 +154,7 @@
memset(out.data, 0, out.length);
test ("Encrypting (k)",
krb5_k_encrypt (context, key, 7, 0, &in, &enc_out));
+ display ("Enc output", &enc_out.ciphertext);
test ("Decrypting",
krb5_k_decrypt (context, key, 7, 0, &enc_out, &check));
test ("Comparing", compare_results (&in, &check));
@@ -197,6 +210,10 @@
test("iov encrypting (c)",
krb5_c_encrypt_iov(context, keyblock, 7, 0, iov, 5));
assert(iov[1].data.length == in.length);
+ display("Header", &iov[0].data);
+ display("Data", &iov[1].data);
+ display("Padding", &iov[3].data);
+ display("Trailer", &iov[4].data);
test("iov decrypting",
krb5_c_decrypt_iov(context, keyblock, 7, 0, iov, 5));
test("Comparing results",
@@ -206,6 +223,10 @@
test("iov encrypting (k)",
krb5_k_encrypt_iov(context, key, 7, 0, iov, 5));
assert(iov[1].data.length == in.length);
+ display("Header", &iov[0].data);
+ display("Data", &iov[1].data);
+ display("Padding", &iov[3].data);
+ display("Trailer", &iov[4].data);
test("iov decrypting",
krb5_k_decrypt_iov(context, key, 7, 0, iov, 5));
test("Comparing results",
@@ -219,8 +240,10 @@
krb5_c_init_state (context, keyblock, 7, &state));
test ("Encrypting with state",
krb5_c_encrypt (context, keyblock, 7, &state, &in, &enc_out));
+ display ("Enc output", &enc_out.ciphertext);
test ("Encrypting again with state",
krb5_c_encrypt (context, keyblock, 7, &state, &in2, &enc_out2));
+ display ("Enc output", &enc_out2.ciphertext);
test ("free_state",
krb5_c_free_state (context, keyblock, &state));
test ("init_state",
@@ -251,6 +274,7 @@
check.length = 2048;
test ("Encrypting with RC4 key usage 8",
krb5_c_encrypt (context, keyblock, 8, 0, &in, &enc_out));
+ display ("Enc output", &enc_out.ciphertext);
test ("Decrypting with RC4 key usage 9",
krb5_c_decrypt (context, keyblock, 9, 0, &enc_out, &check));
test ("Comparing", compare_results (&in, &check));
More information about the cvs-krb5
mailing list