diff options
| author | David M. Syzdek <david@syzdek.net> | 2023-01-12 16:16:13 -0900 |
|---|---|---|
| committer | David M. Syzdek <david@syzdek.net> | 2023-01-12 16:18:14 -0900 |
| commit | aaab49ba46c961adb78b368331a871a5e42c83d6 (patch) | |
| tree | 406057d05b3ebca3b24e48a40ab3dfb4ecdfc1de /lib | |
| parent | ece4f14c6c7707d1e33481e1deb7f2ca13ab1a6a (diff) | |
| download | otputils-aaab49ba46c961adb78b368331a871a5e42c83d6.tar.gz otputils-aaab49ba46c961adb78b368331a871a5e42c83d6.tar.bz2 otputils-aaab49ba46c961adb78b368331a871a5e42c83d6.tar.xz otputils-aaab49ba46c961adb78b368331a871a5e42c83d6.zip | |
libotputil: adding support for SKEY/OTP to otputil_str()
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/libotputil/lcore.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/lib/libotputil/lcore.c b/lib/libotputil/lcore.c index 5ccc143..7381540 100644 --- a/lib/libotputil/lcore.c +++ b/lib/libotputil/lcore.c | |||
| @@ -750,15 +750,28 @@ otputil_str( | |||
| 750 | dstlen = ((dst)) ? dstlen : sizeof(buff); | 750 | dstlen = ((dst)) ? dstlen : sizeof(buff); |
| 751 | dst = ((dst)) ? dst : buff; | 751 | dst = ((dst)) ? dst : buff; |
| 752 | 752 | ||
| 753 | if ((code = otputil_code(tud)) == -1) | ||
| 754 | return(NULL); | ||
| 755 | |||
| 756 | switch(tud->util_method) | 753 | switch(tud->util_method) |
| 757 | { | 754 | { |
| 758 | case OTPUTIL_METH_HOTP: return(otputil_code2str(code, (int)tud->hotp_digits, dst, dstlen)); | 755 | case OTPUTIL_METH_HOTP: |
| 759 | case OTPUTIL_METH_TOTP: return(otputil_code2str(code, (int)tud->totp_digits, dst, dstlen)); | 756 | if ((code = otputil_code(tud)) == -1) |
| 760 | default: break; | 757 | return(NULL); |
| 758 | return(otputil_code2str(code, (int)tud->hotp_digits, dst, dstlen)); | ||
| 759 | |||
| 760 | case OTPUTIL_METH_OTP: | ||
| 761 | return(otputil_otp_str(tud->otp_pass, tud->otp_seed, tud->otp_seq, tud->otp_hash, tud->otp_encoding, dst, dstlen)); | ||
| 762 | |||
| 763 | case OTPUTIL_METH_SKEY: | ||
| 764 | return(otputil_skey_str(tud->skey_pass, tud->skey_seq, tud->skey_hash, tud->skey_encoding, dst, dstlen)); | ||
| 765 | |||
| 766 | case OTPUTIL_METH_TOTP: | ||
| 767 | if ((code = otputil_code(tud)) == -1) | ||
| 768 | return(NULL); | ||
| 769 | return(otputil_code2str(code, (int)tud->totp_digits, dst, dstlen)); | ||
| 770 | |||
| 771 | default: | ||
| 772 | break; | ||
| 761 | }; | 773 | }; |
| 774 | |||
| 762 | return(NULL); | 775 | return(NULL); |
| 763 | } | 776 | } |
| 764 | 777 | ||
