diff options
Diffstat (limited to 'src/widget-totp.c')
| -rw-r--r-- | src/widget-totp.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/widget-totp.c b/src/widget-totp.c index fe08220..69c67cb 100644 --- a/src/widget-totp.c +++ b/src/widget-totp.c | |||
| @@ -100,6 +100,7 @@ otputil_widget_totp( | |||
| 100 | otputil_config_t * cnf ) | 100 | otputil_config_t * cnf ) |
| 101 | { | 101 | { |
| 102 | int rc; | 102 | int rc; |
| 103 | int hash; | ||
| 103 | uint64_t meth; | 104 | uint64_t meth; |
| 104 | 105 | ||
| 105 | assert(cnf != NULL); | 106 | assert(cnf != NULL); |
| @@ -112,6 +113,17 @@ otputil_widget_totp( | |||
| 112 | return(1); | 113 | return(1); |
| 113 | }; | 114 | }; |
| 114 | 115 | ||
| 116 | // set default hash | ||
| 117 | if (!(strncasecmp(cnf->argv[0], "totp-", 5))) | ||
| 118 | { | ||
| 119 | if ((hash = otputil_str2md(&cnf->argv[0][5])) == -1) | ||
| 120 | { | ||
| 121 | fprintf(stderr, "%s: unsupported hash algorithm\n", cnf->prog_name); | ||
| 122 | return(1); | ||
| 123 | }; | ||
| 124 | otputil_set_param(NULL, OTPUTIL_OPT_TOTP_HMAC, &hash); | ||
| 125 | }; | ||
| 126 | |||
| 115 | // initial processing of cli arguments | 127 | // initial processing of cli arguments |
| 116 | if ((rc = otputil_arguments(cnf, cnf->argc, cnf->argv)) != 0) | 128 | if ((rc = otputil_arguments(cnf, cnf->argc, cnf->argv)) != 0) |
| 117 | return((rc == -1) ? 0 : 1); | 129 | return((rc == -1) ? 0 : 1); |
