summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2014-04-22 21:27:11 +0000
committermiod <miod@openbsd.org>2014-04-22 21:27:11 +0000
commit31a285ee9c85784ffefe282f3aa54f416527576e (patch)
treee1134643d9b535fddf7d8689a6da6f3fccb78119 /lib
parentuse reallocarray (diff)
downloadwireguard-openbsd-31a285ee9c85784ffefe282f3aa54f416527576e.tar.xz
wireguard-openbsd-31a285ee9c85784ffefe282f3aa54f416527576e.zip
When compiling with AES_WRAP_TEST, make main() return a meaningful value
instead of garbage, and add this to the libcrypto regress. Note these tests are incomplete, as they always use the default IV.
Diffstat (limited to 'lib')
-rw-r--r--lib/libcrypto/aes/aes_wrap.c16
-rw-r--r--lib/libssl/src/crypto/aes/aes_wrap.c16
2 files changed, 30 insertions, 2 deletions
diff --git a/lib/libcrypto/aes/aes_wrap.c b/lib/libcrypto/aes/aes_wrap.c
index 668978425ad..40533440bf3 100644
--- a/lib/libcrypto/aes/aes_wrap.c
+++ b/lib/libcrypto/aes/aes_wrap.c
@@ -231,19 +231,33 @@ main(int argc, char **argv)
};
AES_KEY wctx, xctx;
- int ret;
+ int ret, nfailures = 0;
ret = AES_wrap_unwrap_test(kek, 128, NULL, e1, key, 16);
+ if (ret == 0)
+ nfailures++;
fprintf(stderr, "Key test result %d\n", ret);
ret = AES_wrap_unwrap_test(kek, 192, NULL, e2, key, 16);
+ if (ret == 0)
+ nfailures++;
fprintf(stderr, "Key test result %d\n", ret);
ret = AES_wrap_unwrap_test(kek, 256, NULL, e3, key, 16);
+ if (ret == 0)
+ nfailures++;
fprintf(stderr, "Key test result %d\n", ret);
ret = AES_wrap_unwrap_test(kek, 192, NULL, e4, key, 24);
+ if (ret == 0)
+ nfailures++;
fprintf(stderr, "Key test result %d\n", ret);
ret = AES_wrap_unwrap_test(kek, 256, NULL, e5, key, 24);
+ if (ret == 0)
+ nfailures++;
fprintf(stderr, "Key test result %d\n", ret);
ret = AES_wrap_unwrap_test(kek, 256, NULL, e6, key, 32);
+ if (ret == 0)
+ nfailures++;
fprintf(stderr, "Key test result %d\n", ret);
+
+ return nfailures;
}
#endif
diff --git a/lib/libssl/src/crypto/aes/aes_wrap.c b/lib/libssl/src/crypto/aes/aes_wrap.c
index 668978425ad..40533440bf3 100644
--- a/lib/libssl/src/crypto/aes/aes_wrap.c
+++ b/lib/libssl/src/crypto/aes/aes_wrap.c
@@ -231,19 +231,33 @@ main(int argc, char **argv)
};
AES_KEY wctx, xctx;
- int ret;
+ int ret, nfailures = 0;
ret = AES_wrap_unwrap_test(kek, 128, NULL, e1, key, 16);
+ if (ret == 0)
+ nfailures++;
fprintf(stderr, "Key test result %d\n", ret);
ret = AES_wrap_unwrap_test(kek, 192, NULL, e2, key, 16);
+ if (ret == 0)
+ nfailures++;
fprintf(stderr, "Key test result %d\n", ret);
ret = AES_wrap_unwrap_test(kek, 256, NULL, e3, key, 16);
+ if (ret == 0)
+ nfailures++;
fprintf(stderr, "Key test result %d\n", ret);
ret = AES_wrap_unwrap_test(kek, 192, NULL, e4, key, 24);
+ if (ret == 0)
+ nfailures++;
fprintf(stderr, "Key test result %d\n", ret);
ret = AES_wrap_unwrap_test(kek, 256, NULL, e5, key, 24);
+ if (ret == 0)
+ nfailures++;
fprintf(stderr, "Key test result %d\n", ret);
ret = AES_wrap_unwrap_test(kek, 256, NULL, e6, key, 32);
+ if (ret == 0)
+ nfailures++;
fprintf(stderr, "Key test result %d\n", ret);
+
+ return nfailures;
}
#endif