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