Lines Matching +full:shared +full:- +full:pin
2 * Copyright (c) 2018-2022 Yubico AB. All rights reserved.
3 * Use of this source code is governed by a BSD-style
5 * SPDX-License-Identifier: BSD-2-Clause
22 if ((digest->ptr = calloc(1, SHA256_DIGEST_LENGTH)) == NULL) in fido_sha256()
23 return (-1); in fido_sha256()
25 digest->len = SHA256_DIGEST_LENGTH; in fido_sha256()
27 if (SHA256(data, data_len, digest->ptr) != digest->ptr) { in fido_sha256()
29 return (-1); in fido_sha256()
36 pin_sha256_enc(const fido_dev_t *dev, const fido_blob_t *shared, in pin_sha256_enc() argument
37 const fido_blob_t *pin, fido_blob_t **out) in pin_sha256_enc() argument
48 if (fido_sha256(ph, pin->ptr, pin->len) < 0 || ph->len < 16) { in pin_sha256_enc()
54 ph->len = 16; /* first 16 bytes */ in pin_sha256_enc()
56 if (aes256_cbc_enc(dev, shared, ph, *out) < 0) { in pin_sha256_enc()
70 pad64(const char *pin, fido_blob_t **ppin) in pad64() argument
75 pin_len = strlen(pin); in pad64()
77 fido_log_debug("%s: invalid pin length", __func__); in pad64()
86 ((*ppin)->ptr = calloc(1, ppin_len)) == NULL) { in pad64()
91 memcpy((*ppin)->ptr, pin, pin_len); in pad64()
92 (*ppin)->len = ppin_len; in pad64()
98 pin_pad64_enc(const fido_dev_t *dev, const fido_blob_t *shared, in pin_pad64_enc() argument
99 const char *pin, fido_blob_t **out) in pin_pad64_enc() argument
104 if ((r = pad64(pin, &ppin)) != FIDO_OK) { in pin_pad64_enc()
114 if (aes256_cbc_enc(dev, shared, ppin, *out) < 0) { in pin_pad64_enc()
150 ctap20_uv_token_tx(fido_dev_t *dev, const char *pin, const fido_blob_t *ecdh, in ctap20_uv_token_tx() argument
162 if (pin == NULL) { in ctap20_uv_token_tx()
163 fido_log_debug("%s: NULL pin", __func__); in ctap20_uv_token_tx()
169 (const unsigned char *)pin, strlen(pin)) < 0) { in ctap20_uv_token_tx()
207 ctap21_uv_token_tx(fido_dev_t *dev, const char *pin, const fido_blob_t *ecdh, in ctap21_uv_token_tx() argument
220 if (pin != NULL) { in ctap21_uv_token_tx()
222 (const unsigned char *)pin, strlen(pin)) < 0) { in ctap21_uv_token_tx()
330 uv_token_wait(fido_dev_t *dev, uint8_t cmd, const char *pin, in uv_token_wait() argument
339 r = ctap21_uv_token_tx(dev, pin, ecdh, pk, cmd, rpid, ms); in uv_token_wait()
341 r = ctap20_uv_token_tx(dev, pin, ecdh, pk, ms); in uv_token_wait()
349 fido_dev_get_uv_token(fido_dev_t *dev, uint8_t cmd, const char *pin, in fido_dev_get_uv_token() argument
353 return (uv_token_wait(dev, cmd, pin, ecdh, pk, rpid, token, ms)); in fido_dev_get_uv_token()
357 fido_dev_change_pin_tx(fido_dev_t *dev, const char *pin, const char *oldpin, in fido_dev_change_pin_tx() argument
384 /* pad and encrypt new pin */ in fido_dev_change_pin_tx()
385 if ((r = pin_pad64_enc(dev, ecdh, pin, &ppine)) != FIDO_OK) { in fido_dev_change_pin_tx()
390 /* hash and encrypt old pin */ in fido_dev_change_pin_tx()
429 fido_dev_set_pin_tx(fido_dev_t *dev, const char *pin, int *ms) in fido_dev_set_pin_tx() argument
446 if ((r = pin_pad64_enc(dev, ecdh, pin, &ppine)) != FIDO_OK) { in fido_dev_set_pin_tx()
480 fido_dev_set_pin_wait(fido_dev_t *dev, const char *pin, const char *oldpin, in fido_dev_set_pin_wait() argument
486 if ((r = fido_dev_change_pin_tx(dev, pin, oldpin, in fido_dev_set_pin_wait()
492 if ((r = fido_dev_set_pin_tx(dev, pin, ms)) != FIDO_OK) { in fido_dev_set_pin_wait()
503 if (dev->flags & FIDO_DEV_PIN_UNSET) { in fido_dev_set_pin_wait()
504 dev->flags &= ~FIDO_DEV_PIN_UNSET; in fido_dev_set_pin_wait()
505 dev->flags |= FIDO_DEV_PIN_SET; in fido_dev_set_pin_wait()
512 fido_dev_set_pin(fido_dev_t *dev, const char *pin, const char *oldpin) in fido_dev_set_pin() argument
514 int ms = dev->timeout_ms; in fido_dev_set_pin()
516 return (fido_dev_set_pin_wait(dev, pin, oldpin, &ms)); in fido_dev_set_pin()
535 return (-1); in parse_retry_count()
634 int ms = dev->timeout_ms; in fido_dev_get_retry_count()
687 int ms = dev->timeout_ms; in fido_dev_get_uv_retry_count()
694 const es256_pk_t *pk, const fido_blob_t *ecdh, const char *pin, in cbor_add_uv_params() argument
705 if ((r = fido_dev_get_uv_token(dev, cmd, pin, ecdh, pk, rpid, in cbor_add_uv_params()