xref: /freebsd/contrib/libfido2/src/fido/eddsa.h (revision f540a43052c12c76d3453ead881248d5467a1ab0)
10afa8e06SEd Maste /*
20afa8e06SEd Maste  * Copyright (c) 2019 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.
50afa8e06SEd Maste  */
60afa8e06SEd Maste 
70afa8e06SEd Maste #ifndef _FIDO_EDDSA_H
80afa8e06SEd Maste #define _FIDO_EDDSA_H
90afa8e06SEd Maste 
100afa8e06SEd Maste #include <openssl/ec.h>
110afa8e06SEd Maste 
120afa8e06SEd Maste #include <stdint.h>
130afa8e06SEd Maste #include <stdlib.h>
140afa8e06SEd Maste 
150afa8e06SEd Maste #ifdef _FIDO_INTERNAL
160afa8e06SEd Maste #include "types.h"
170afa8e06SEd Maste #else
180afa8e06SEd Maste #include <fido.h>
190afa8e06SEd Maste #endif
200afa8e06SEd Maste 
210afa8e06SEd Maste #ifdef __cplusplus
220afa8e06SEd Maste extern "C" {
230afa8e06SEd Maste #endif /* __cplusplus */
240afa8e06SEd Maste 
250afa8e06SEd Maste eddsa_pk_t *eddsa_pk_new(void);
260afa8e06SEd Maste void eddsa_pk_free(eddsa_pk_t **);
270afa8e06SEd Maste EVP_PKEY *eddsa_pk_to_EVP_PKEY(const eddsa_pk_t *);
280afa8e06SEd Maste 
290afa8e06SEd Maste int eddsa_pk_from_EVP_PKEY(eddsa_pk_t *, const EVP_PKEY *);
300afa8e06SEd Maste int eddsa_pk_from_ptr(eddsa_pk_t *, const void *, size_t);
310afa8e06SEd Maste 
320afa8e06SEd Maste #ifdef _FIDO_INTERNAL
330afa8e06SEd Maste 
34*f540a430SEd Maste #if defined(LIBRESSL_VERSION_NUMBER)
350afa8e06SEd Maste #define EVP_PKEY_ED25519 EVP_PKEY_NONE
360afa8e06SEd Maste int EVP_PKEY_get_raw_public_key(const EVP_PKEY *, unsigned char *, size_t *);
370afa8e06SEd Maste EVP_PKEY *EVP_PKEY_new_raw_public_key(int, ENGINE *, const unsigned char *,
380afa8e06SEd Maste     size_t);
390afa8e06SEd Maste int EVP_DigestVerify(EVP_MD_CTX *, const unsigned char *, size_t,
400afa8e06SEd Maste     const unsigned char *, size_t);
41*f540a430SEd Maste #endif /* LIBRESSL_VERSION_NUMBER */
420afa8e06SEd Maste 
430afa8e06SEd Maste #endif /* _FIDO_INTERNAL */
440afa8e06SEd Maste 
450afa8e06SEd Maste #ifdef __cplusplus
460afa8e06SEd Maste } /* extern "C" */
470afa8e06SEd Maste #endif /* __cplusplus */
480afa8e06SEd Maste 
490afa8e06SEd Maste #endif /* !_FIDO_EDDSA_H */
50