10afa8e06SEd Maste /* 2f540a430SEd Maste * Copyright (c) 2018-2021 Yubico AB. All rights reserved. 3*2ccfa855SEd Maste * SPDX-License-Identifier: BSD-2-Clause 4*2ccfa855SEd Maste * 5*2ccfa855SEd Maste * Redistribution and use in source and binary forms, with or without 6*2ccfa855SEd Maste * modification, are permitted provided that the following conditions are 7*2ccfa855SEd Maste * met: 8*2ccfa855SEd Maste * 9*2ccfa855SEd Maste * 1. Redistributions of source code must retain the above copyright 10*2ccfa855SEd Maste * notice, this list of conditions and the following disclaimer. 11*2ccfa855SEd Maste * 2. Redistributions in binary form must reproduce the above copyright 12*2ccfa855SEd Maste * notice, this list of conditions and the following disclaimer in 13*2ccfa855SEd Maste * the documentation and/or other materials provided with the 14*2ccfa855SEd Maste * distribution. 15*2ccfa855SEd Maste * 16*2ccfa855SEd Maste * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17*2ccfa855SEd Maste * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18*2ccfa855SEd Maste * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19*2ccfa855SEd Maste * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20*2ccfa855SEd Maste * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21*2ccfa855SEd Maste * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22*2ccfa855SEd Maste * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23*2ccfa855SEd Maste * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24*2ccfa855SEd Maste * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25*2ccfa855SEd Maste * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26*2ccfa855SEd Maste * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 270afa8e06SEd Maste */ 280afa8e06SEd Maste 290afa8e06SEd Maste #ifndef _FIDO_ES256_H 300afa8e06SEd Maste #define _FIDO_ES256_H 310afa8e06SEd Maste 320afa8e06SEd Maste #include <openssl/ec.h> 330afa8e06SEd Maste 340afa8e06SEd Maste #include <stdint.h> 350afa8e06SEd Maste #include <stdlib.h> 360afa8e06SEd Maste 370afa8e06SEd Maste #ifdef _FIDO_INTERNAL 380afa8e06SEd Maste #include "types.h" 390afa8e06SEd Maste #else 400afa8e06SEd Maste #include <fido.h> 410afa8e06SEd Maste #endif 420afa8e06SEd Maste 430afa8e06SEd Maste #ifdef __cplusplus 440afa8e06SEd Maste extern "C" { 450afa8e06SEd Maste #endif /* __cplusplus */ 460afa8e06SEd Maste 470afa8e06SEd Maste es256_pk_t *es256_pk_new(void); 480afa8e06SEd Maste void es256_pk_free(es256_pk_t **); 490afa8e06SEd Maste EVP_PKEY *es256_pk_to_EVP_PKEY(const es256_pk_t *); 500afa8e06SEd Maste 510afa8e06SEd Maste int es256_pk_from_EC_KEY(es256_pk_t *, const EC_KEY *); 52f540a430SEd Maste int es256_pk_from_EVP_PKEY(es256_pk_t *, const EVP_PKEY *); 530afa8e06SEd Maste int es256_pk_from_ptr(es256_pk_t *, const void *, size_t); 540afa8e06SEd Maste 550afa8e06SEd Maste #ifdef _FIDO_INTERNAL 560afa8e06SEd Maste es256_sk_t *es256_sk_new(void); 570afa8e06SEd Maste void es256_sk_free(es256_sk_t **); 580afa8e06SEd Maste EVP_PKEY *es256_sk_to_EVP_PKEY(const es256_sk_t *); 590afa8e06SEd Maste 600afa8e06SEd Maste int es256_derive_pk(const es256_sk_t *, es256_pk_t *); 610afa8e06SEd Maste int es256_sk_create(es256_sk_t *); 620afa8e06SEd Maste 630afa8e06SEd Maste int es256_pk_set_x(es256_pk_t *, const unsigned char *); 640afa8e06SEd Maste int es256_pk_set_y(es256_pk_t *, const unsigned char *); 650afa8e06SEd Maste #endif 660afa8e06SEd Maste 670afa8e06SEd Maste #ifdef __cplusplus 680afa8e06SEd Maste } /* extern "C" */ 690afa8e06SEd Maste #endif /* __cplusplus */ 700afa8e06SEd Maste 710afa8e06SEd Maste #endif /* !_FIDO_ES256_H */ 72