diff options
| -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 | ||
