10afa8e06SEd Maste /* 2*60a517b6SEd Maste * Copyright (c) 2018-2023 Yubico AB. All rights reserved. 30afa8e06SEd Maste * Use of this source code is governed by a BSD-style 40afa8e06SEd Maste * license that can be found in the LICENSE file. 52ccfa855SEd Maste * SPDX-License-Identifier: BSD-2-Clause 60afa8e06SEd Maste */ 70afa8e06SEd Maste 80afa8e06SEd Maste #ifndef _EXTERN_H_ 90afa8e06SEd Maste #define _EXTERN_H_ 100afa8e06SEd Maste 110afa8e06SEd Maste #include <sys/types.h> 120afa8e06SEd Maste 130afa8e06SEd Maste #include <openssl/ec.h> 140afa8e06SEd Maste 150afa8e06SEd Maste #include <fido.h> 160afa8e06SEd Maste #include <stddef.h> 170afa8e06SEd Maste #include <stdio.h> 180afa8e06SEd Maste 190afa8e06SEd Maste struct blob { 200afa8e06SEd Maste unsigned char *ptr; 210afa8e06SEd Maste size_t len; 220afa8e06SEd Maste }; 230afa8e06SEd Maste 24f540a430SEd Maste #define TOKEN_OPT "CDGILPRSVabcdefi:k:l:m:n:p:ru" 250afa8e06SEd Maste 26*60a517b6SEd Maste #define FLAG_DEBUG 0x001 27*60a517b6SEd Maste #define FLAG_QUIET 0x002 28*60a517b6SEd Maste #define FLAG_RK 0x004 29*60a517b6SEd Maste #define FLAG_UV 0x008 30*60a517b6SEd Maste #define FLAG_U2F 0x010 31*60a517b6SEd Maste #define FLAG_HMAC 0x020 32*60a517b6SEd Maste #define FLAG_UP 0x040 33*60a517b6SEd Maste #define FLAG_LARGEBLOB 0x080 34*60a517b6SEd Maste #define FLAG_CD 0x100 350afa8e06SEd Maste 360afa8e06SEd Maste #define PINBUF_LEN 256 370afa8e06SEd Maste 380afa8e06SEd Maste EC_KEY *read_ec_pubkey(const char *); 390afa8e06SEd Maste fido_dev_t *open_dev(const char *); 400afa8e06SEd Maste FILE *open_read(const char *); 410afa8e06SEd Maste FILE *open_write(const char *); 420afa8e06SEd Maste char *get_pin(const char *); 430afa8e06SEd Maste const char *plural(size_t); 440afa8e06SEd Maste const char *cose_string(int); 450afa8e06SEd Maste const char *prot_string(int); 460afa8e06SEd Maste int assert_get(int, char **); 470afa8e06SEd Maste int assert_verify(int, char **); 480afa8e06SEd Maste int base64_decode(const char *, void **, size_t *); 490afa8e06SEd Maste int base64_encode(const void *, size_t, char **); 500afa8e06SEd Maste int base64_read(FILE *, struct blob *); 510afa8e06SEd Maste int bio_delete(const char *, const char *); 520afa8e06SEd Maste int bio_enroll(const char *); 530afa8e06SEd Maste void bio_info(fido_dev_t *); 540afa8e06SEd Maste int bio_list(const char *); 550afa8e06SEd Maste int bio_set_name(const char *, const char *, const char *); 560afa8e06SEd Maste int blob_clean(const char *); 570afa8e06SEd Maste int blob_list(const char *); 580afa8e06SEd Maste int blob_delete(const char *, const char *, const char *, const char *); 590afa8e06SEd Maste int blob_get(const char *, const char *, const char *, const char *, 600afa8e06SEd Maste const char *); 610afa8e06SEd Maste int blob_set(const char *, const char *, const char *, const char *, 620afa8e06SEd Maste const char *); 630afa8e06SEd Maste int config_always_uv(char *, int); 640afa8e06SEd Maste int config_entattest(char *); 650afa8e06SEd Maste int config_force_pin_change(char *); 660afa8e06SEd Maste int config_pin_minlen(char *, const char *); 67f540a430SEd Maste int config_pin_minlen_rpid(char *, const char *); 680afa8e06SEd Maste int cose_type(const char *, int *); 690afa8e06SEd Maste int cred_make(int, char **); 700afa8e06SEd Maste int cred_verify(int, char **); 710afa8e06SEd Maste int credman_delete_rk(const char *, const char *); 720afa8e06SEd Maste int credman_update_rk(const char *, const char *, const char *, const char *, 730afa8e06SEd Maste const char *); 740afa8e06SEd Maste int credman_get_metadata(fido_dev_t *, const char *); 750afa8e06SEd Maste int credman_list_rk(const char *, const char *); 760afa8e06SEd Maste int credman_list_rp(const char *); 770afa8e06SEd Maste int credman_print_rk(fido_dev_t *, const char *, const char *, const char *); 780afa8e06SEd Maste int get_devopt(fido_dev_t *, const char *, int *); 790afa8e06SEd Maste int pin_change(char *); 800afa8e06SEd Maste int pin_set(char *); 810afa8e06SEd Maste int should_retry_with_pin(const fido_dev_t *, int); 820afa8e06SEd Maste int string_read(FILE *, char **); 830afa8e06SEd Maste int token_config(int, char **, char *); 840afa8e06SEd Maste int token_delete(int, char **, char *); 850afa8e06SEd Maste int token_get(int, char **, char *); 860afa8e06SEd Maste int token_info(int, char **, char *); 870afa8e06SEd Maste int token_list(int, char **, char *); 880afa8e06SEd Maste int token_reset(char *); 890afa8e06SEd Maste int token_set(int, char **, char *); 902ccfa855SEd Maste int write_es256_pubkey(FILE *, const void *, size_t); 912ccfa855SEd Maste int write_es384_pubkey(FILE *, const void *, size_t); 920afa8e06SEd Maste int write_rsa_pubkey(FILE *, const void *, size_t); 930afa8e06SEd Maste int read_file(const char *, u_char **, size_t *); 940afa8e06SEd Maste int write_file(const char *, const u_char *, size_t); 950afa8e06SEd Maste RSA *read_rsa_pubkey(const char *); 960afa8e06SEd Maste EVP_PKEY *read_eddsa_pubkey(const char *); 970afa8e06SEd Maste int write_eddsa_pubkey(FILE *, const void *, size_t); 980afa8e06SEd Maste void print_cred(FILE *, int, const fido_cred_t *); 990afa8e06SEd Maste void usage(void); 1000afa8e06SEd Maste void xxd(const void *, size_t); 1010afa8e06SEd Maste int base10(const char *); 1020afa8e06SEd Maste 1030afa8e06SEd Maste #endif /* _EXTERN_H_ */ 104