-
Notifications
You must be signed in to change notification settings - Fork 31
Closed
Description
Since v1.2.7, tests are failing:
$ ./tests/test_cotp
[----] ../tests/test_otp.c:89: Assertion Failed
[----]
[----] Expected 000000 to be equal to 755224
[----]
[----] ../tests/test_otp.c:189: Assertion Failed
[----]
[----] Expected 22222 to be equal to YRGQJ
[----]
[----] ../tests/test_otp.c:35: Assertion Failed
[----]
[----] Expected 0000000000 to be equal to 0689005924
[----]
[----] ../tests/test_otp.c:213: Assertion Failed
[----]
[----] Expected 000000 to be equal to 360094
[----]
[----] ../tests/test_otp.c:18: Assertion Failed
[----]
[----] Expected 00000000 to be equal to 94287082
[----]
[----] ../tests/test_otp.c:154: Assertion Failed
[----]
[----] Expected 000000 to be equal to 488431
[----]
[----] ../tests/test_otp.c:53: Assertion Failed
[----]
[----] Expected 00000000 to be equal to 46119246
[----]
[----] ../tests/test_otp.c:89: Assertion Failed
[----]
[----] Expected 000000 to be equal to 287082
[----]
[----] ../tests/test_otp.c:18: Assertion Failed
[----]
[----] Expected 00000000 to be equal to 07081804
[----]
[----] ../tests/test_otp.c:53: Assertion Failed
[----]
[----] Expected 00000000 to be equal to 68084774
[----]
[----] ../tests/test_otp.c:89: Assertion Failed
[----]
[----] Expected 000000 to be equal to 359152
[----]
[FAIL] totp_generic::test_steam_totp: (0.00s)
[FAIL] totp_rfc6238::test_10_digits_sha1: (0.00s)
[FAIL] totp_rfc6238::test_60seconds: (0.00s)
[----] ../tests/test_otp.c:18: Assertion Failed
[----]
[----] Expected 00000000 to be equal to 14050471
[----]
[FAIL] totp_generic::test_secret_with_space: (0.00s)
[----] ../tests/test_otp.c:53: Assertion Failed
[----]
[----] Expected 00000000 to be equal to 67062674
[----]
[----] ../tests/test_otp.c:89: Assertion Failed
[----]
[----] Expected 000000 to be equal to 969429
[----]
[----] ../tests/test_otp.c:18: Assertion Failed
[----]
[----] Expected 00000000 to be equal to 89005924
[----]
[----] ../tests/test_otp.c:53: Assertion Failed
[----]
[----] Expected 00000000 to be equal to 91819424
[----]
[----] ../tests/test_otp.c:71: Assertion Failed
[----]
[----] Expected 00000000 to be equal to 90693936
[----]
[----] ../tests/test_otp.c:89: Assertion Failed
[----]
[----] Expected 000000 to be equal to 338314
[----]
[----] ../tests/test_otp.c:18: Assertion Failed
[----]
[----] Expected 00000000 to be equal to 69279037
[----]
[----] ../tests/test_otp.c:53: Assertion Failed
[----]
[----] Expected 00000000 to be equal to 90698825
[----]
[----] ../tests/test_otp.c:89: Assertion Failed
[----]
[----] Expected 000000 to be equal to 254676
[----]
[----] ../tests/test_otp.c:71: Assertion Failed
[----]
[----] Expected 00000000 to be equal to 25091201
[----]
[----] ../tests/test_otp.c:18: Assertion Failed
[----]
[----] Expected 00000000 to be equal to 65353130
[----]
[----] ../tests/test_otp.c:53: Assertion Failed
[----]
[----] Expected 00000000 to be equal to 77737706
[----]
[----] ../tests/test_otp.c:89: Assertion Failed
[----]
[----] Expected 000000 to be equal to 287922
[----]
[----] ../tests/test_otp.c:71: Assertion Failed
[----]
[----] Expected 00000000 to be equal to 99943326
[----]
[----] ../tests/test_otp.c:89: Assertion Failed
[----]
[----] Expected 000000 to be equal to 162583
[----]
[FAIL] totp_rfc6238::test_8_digits_sha1: (0.00s)
[----] ../tests/test_otp.c:71: Assertion Failed
[----]
[----] Expected 00000000 to be equal to 93441116
[----]
[FAIL] totp_rfc6238::test_8_digits_sha256: (0.00s)
[----] ../tests/test_otp.c:89: Assertion Failed
[----]
[----] Expected 000000 to be equal to 399871
[----]
[----] ../tests/test_otp.c:71: Assertion Failed
[----]
[----] Expected 00000000 to be equal to 38618901
[----]
[----] ../tests/test_otp.c:89: Assertion Failed
[----]
[----] Expected 000000 to be equal to 520489
[----]
[----] ../tests/test_otp.c:71: Assertion Failed
[----]
[----] Expected 00000000 to be equal to 47863826
[----]
[FAIL] totp_rfc6238::test_8_digits_sha512: (0.00s)
[FAIL] hotp_rfc::test_6_digits: (0.01s)
[====] Synthesis: Tested: 15 | Passing: 7 | Failing: 8 | Crashing: 0
Build log:
$ cmake -DBUILD_TESTING=ON ..
-- The C compiler identification is Clang 15.0.6
-- The CXX compiler identification is Clang 15.0.6
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/yoshi/.local/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/yoshi/.local/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.8.0")
-- Found Gcrypt: /usr/lib64/libgcrypt.so (Required is at least version "1.6.0")
-- Checking for module 'baseencode>=1.0.14'
-- Found baseencode, version 1.0.15
-- Configuring done
-- Generating done
-- Build files have been written to: /home/yoshi/Downloads/libcotp/build
$ make
[ 25%] Building C object CMakeFiles/cotp.dir/src/otp.c.o
warning: unknown warning option '-Wno-format-truncation' [-Wunknown-warning-option]
1 warning generated.
[ 50%] Linking C shared library libcotp.so
[ 50%] Built target cotp
[ 75%] Building C object tests/CMakeFiles/test_cotp.dir/test_otp.c.o
/home/yoshi/Downloads/libcotp/tests/test_otp.c:13:36: warning: passing 'const char *' to parameter of type 'const unsigned char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
char *K_base32 = base32_encode(K, strlen(K)+1, &base_err);
^
/usr/include/baseencode.h:14:54: note: passing argument to parameter 'user_data' here
char *base32_encode (const unsigned char *user_data,
^
/home/yoshi/Downloads/libcotp/tests/test_otp.c:31:36: warning: passing 'const char *' to parameter of type 'const unsigned char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
char *K_base32 = base32_encode(K, strlen(K)+1, &base_err);
^
/usr/include/baseencode.h:14:54: note: passing argument to parameter 'user_data' here
char *base32_encode (const unsigned char *user_data,
^
/home/yoshi/Downloads/libcotp/tests/test_otp.c:48:36: warning: passing 'const char *' to parameter of type 'const unsigned char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
char *K_base32 = base32_encode(K, strlen(K)+1, &base_err);
^
/usr/include/baseencode.h:14:54: note: passing argument to parameter 'user_data' here
char *base32_encode (const unsigned char *user_data,
^
/home/yoshi/Downloads/libcotp/tests/test_otp.c:66:36: warning: passing 'const char *' to parameter of type 'const unsigned char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
char *K_base32 = base32_encode(K, strlen(K)+1, &base_err);
^
/usr/include/baseencode.h:14:54: note: passing argument to parameter 'user_data' here
char *base32_encode (const unsigned char *user_data,
^
/home/yoshi/Downloads/libcotp/tests/test_otp.c:84:36: warning: passing 'const char *' to parameter of type 'const unsigned char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
char *K_base32 = base32_encode(K, strlen(K)+1, &base_err);
^
/usr/include/baseencode.h:14:54: note: passing argument to parameter 'user_data' here
char *base32_encode (const unsigned char *user_data,
^
/home/yoshi/Downloads/libcotp/tests/test_otp.c:209:41: warning: passing 'const char *' to parameter of type 'const unsigned char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
char *secret_base32 = base32_encode(secret, strlen(secret)+1, &base_err);
^~~~~~
/usr/include/baseencode.h:14:54: note: passing argument to parameter 'user_data' here
char *base32_encode (const unsigned char *user_data,
^
6 warnings generated.
[100%] Linking C executable test_cotp
[100%] Built target test_cotp
Some of the tests were fixed when I changed compute_hmac
not to call gcry_md_close
.
It looks like the later frees the buffer returned by gcry_md_read
.
Metadata
Metadata
Assignees
Labels
No labels