xref: /freebsd/contrib/libfido2/src/fido/eddsa.h (revision ba3c1f5972d7b90feb6e6da47905ff2757e0fe57)
1 /*
2  * Copyright (c) 2019 Yubico AB. All rights reserved.
3  * Use of this source code is governed by a BSD-style
4  * license that can be found in the LICENSE file.
5  */
6 
7 #ifndef _FIDO_EDDSA_H
8 #define _FIDO_EDDSA_H
9 
10 #include <openssl/ec.h>
11 
12 #include <stdint.h>
13 #include <stdlib.h>
14 
15 #ifdef _FIDO_INTERNAL
16 #include "types.h"
17 #else
18 #include <fido.h>
19 #endif
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif /* __cplusplus */
24 
25 eddsa_pk_t *eddsa_pk_new(void);
26 void eddsa_pk_free(eddsa_pk_t **);
27 EVP_PKEY *eddsa_pk_to_EVP_PKEY(const eddsa_pk_t *);
28 
29 int eddsa_pk_from_EVP_PKEY(eddsa_pk_t *, const EVP_PKEY *);
30 int eddsa_pk_from_ptr(eddsa_pk_t *, const void *, size_t);
31 
32 #ifdef _FIDO_INTERNAL
33 
34 #if defined(LIBRESSL_VERSION_NUMBER)
35 #define EVP_PKEY_ED25519 EVP_PKEY_NONE
36 int EVP_PKEY_get_raw_public_key(const EVP_PKEY *, unsigned char *, size_t *);
37 EVP_PKEY *EVP_PKEY_new_raw_public_key(int, ENGINE *, const unsigned char *,
38     size_t);
39 int EVP_DigestVerify(EVP_MD_CTX *, const unsigned char *, size_t,
40     const unsigned char *, size_t);
41 #endif /* LIBRESSL_VERSION_NUMBER */
42 
43 #endif /* _FIDO_INTERNAL */
44 
45 #ifdef __cplusplus
46 } /* extern "C" */
47 #endif /* __cplusplus */
48 
49 #endif /* !_FIDO_EDDSA_H */
50