diff options
| -rw-r--r-- | include/otputil.h | 1 | ||||
| -rw-r--r-- | lib/libotputil/lrfc2289-otp.c | 4 | ||||
| -rw-r--r-- | tests/test-otp.c | 2 |
3 files changed, 5 insertions, 2 deletions
diff --git a/include/otputil.h b/include/otputil.h index 9e2f261..933f3e1 100644 --- a/include/otputil.h +++ b/include/otputil.h | |||
| @@ -416,6 +416,7 @@ otputil_otp_str( | |||
| 416 | const char * otp_seed, | 416 | const char * otp_seed, |
| 417 | int otp_seq, | 417 | int otp_seq, |
| 418 | int otp_hash, | 418 | int otp_hash, |
| 419 | int otp_encoding, | ||
| 419 | char * dst, | 420 | char * dst, |
| 420 | size_t dstlen ); | 421 | size_t dstlen ); |
| 421 | 422 | ||
diff --git a/lib/libotputil/lrfc2289-otp.c b/lib/libotputil/lrfc2289-otp.c index d02343a..ba180bb 100644 --- a/lib/libotputil/lrfc2289-otp.c +++ b/lib/libotputil/lrfc2289-otp.c | |||
| @@ -156,6 +156,7 @@ otputil_otp_str( | |||
| 156 | const char * otp_seed, | 156 | const char * otp_seed, |
| 157 | int otp_seq, | 157 | int otp_seq, |
| 158 | int otp_hash, | 158 | int otp_hash, |
| 159 | int otp_encoding, | ||
| 159 | char * dst, | 160 | char * dst, |
| 160 | size_t dstlen ) | 161 | size_t dstlen ) |
| 161 | { | 162 | { |
| @@ -166,6 +167,7 @@ otputil_otp_str( | |||
| 166 | 167 | ||
| 167 | dstlen = ((dst)) ? dstlen : sizeof(buff); | 168 | dstlen = ((dst)) ? dstlen : sizeof(buff); |
| 168 | dst = ((dst)) ? dst : buff; | 169 | dst = ((dst)) ? dst : buff; |
| 170 | otp_encoding = ((otp_encoding)) ? otp_encoding : otputil_defaults.otp_encoding; | ||
| 169 | res.bv_val = bv_val; | 171 | res.bv_val = bv_val; |
| 170 | res.bv_len = sizeof(bv_val); | 172 | res.bv_len = sizeof(bv_val); |
| 171 | 173 | ||
| @@ -180,7 +182,7 @@ otputil_otp_str( | |||
| 180 | bv_val[5] = (val >> 16) & 0xff; | 182 | bv_val[5] = (val >> 16) & 0xff; |
| 181 | bv_val[6] = (val >> 8) & 0xff; | 183 | bv_val[6] = (val >> 8) & 0xff; |
| 182 | bv_val[7] = (val >> 0) & 0xff; | 184 | bv_val[7] = (val >> 0) & 0xff; |
| 183 | otputil_otp_encode(&res, dst, dstlen, OTPUTIL_ENC_SIXWORD); | 185 | otputil_otp_encode(&res, dst, dstlen, otp_encoding); |
| 184 | 186 | ||
| 185 | return(dst); | 187 | return(dst); |
| 186 | } | 188 | } |
diff --git a/tests/test-otp.c b/tests/test-otp.c index 1c17cd1..73db97e 100644 --- a/tests/test-otp.c +++ b/tests/test-otp.c | |||
| @@ -216,7 +216,7 @@ main( | |||
| 216 | printf("%s\n", rec->six); | 216 | printf("%s\n", rec->six); |
| 217 | }; | 217 | }; |
| 218 | 218 | ||
| 219 | if ((res = otputil_otp_str(rec->pass, rec->seed, rec->count, rec->method, NULL, 0)) == NULL) | 219 | if ((res = otputil_otp_str(rec->pass, rec->seed, rec->count, rec->method, OTPUTIL_ENC_SIXWORD, NULL, 0)) == NULL) |
| 220 | { | 220 | { |
| 221 | printf("otputil_otp_str(): unknown error\n"); | 221 | printf("otputil_otp_str(): unknown error\n"); |
| 222 | if (!(ignore_errors)) | 222 | if (!(ignore_errors)) |
