summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2011-04-24 16:15:04 +0200
committerStephen Gallagher <sgallagh@redhat.com>2011-04-27 11:47:24 -0400
commit172c07013d1ea99447a780fd36f49d5c3a76981b (patch)
tree2118564c1f9b161f40ba04fa124f9066d66ab841 /src/tests
parente81a816cddab4a62f263d1a0274d5d3f101e8e0f (diff)
downloadsssd-172c07013d1ea99447a780fd36f49d5c3a76981b.tar.gz
sssd-172c07013d1ea99447a780fd36f49d5c3a76981b.tar.bz2
sssd-172c07013d1ea99447a780fd36f49d5c3a76981b.zip
Require openssl-devel is libcrypto backend is selected
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/crypto-tests.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/tests/crypto-tests.c b/src/tests/crypto-tests.c
index f802c119..286bc235 100644
--- a/src/tests/crypto-tests.c
+++ b/src/tests/crypto-tests.c
@@ -55,9 +55,18 @@ START_TEST(test_encrypt_decrypt)
"", /* empty */
NULL}; /* sentinel */
int i;
- char *obfpwd;
- char *ctpwd;
+ char *obfpwd = NULL;
+ char *ctpwd = NULL;
int ret;
+ int expected;
+
+#ifdef HAVE_NSS
+ expected = EOK;
+#elif HAVE_LIBCRYPTO
+ expected = ENOSYS;
+#else
+#error Unknown crypto back end
+#endif
test_ctx = talloc_new(NULL);
fail_if(test_ctx == NULL);
@@ -66,12 +75,12 @@ START_TEST(test_encrypt_decrypt)
for (i=0; password[i]; i++) {
ret = sss_password_encrypt(test_ctx, password[i], strlen(password[i])+1,
AES_256, &obfpwd);
- fail_if(ret != EOK);
+ fail_if(ret != expected);
ret = sss_password_decrypt(test_ctx, obfpwd, &ctpwd);
- fail_if(ret != EOK);
+ fail_if(ret != expected);
- fail_if(strcmp(password[i], ctpwd) != 0);
+ fail_if(ctpwd && strcmp(password[i], ctpwd) != 0);
talloc_free(obfpwd);
talloc_free(ctpwd);