xref: /freebsd/contrib/libfido2/src/fido/es256.h (revision 4e8d558c)
1 /*
2  * Copyright (c) 2018-2021 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_ES256_H
8 #define _FIDO_ES256_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 es256_pk_t *es256_pk_new(void);
26 void es256_pk_free(es256_pk_t **);
27 EVP_PKEY *es256_pk_to_EVP_PKEY(const es256_pk_t *);
28 
29 int es256_pk_from_EC_KEY(es256_pk_t *, const EC_KEY *);
30 int es256_pk_from_EVP_PKEY(es256_pk_t *, const EVP_PKEY *);
31 int es256_pk_from_ptr(es256_pk_t *, const void *, size_t);
32 
33 #ifdef _FIDO_INTERNAL
34 es256_sk_t *es256_sk_new(void);
35 void es256_sk_free(es256_sk_t **);
36 EVP_PKEY *es256_sk_to_EVP_PKEY(const es256_sk_t *);
37 
38 int es256_derive_pk(const es256_sk_t *, es256_pk_t *);
39 int es256_sk_create(es256_sk_t *);
40 
41 int es256_pk_set_x(es256_pk_t *, const unsigned char *);
42 int es256_pk_set_y(es256_pk_t *, const unsigned char *);
43 #endif
44 
45 #ifdef __cplusplus
46 } /* extern "C" */
47 #endif /* __cplusplus */
48 
49 #endif /* !_FIDO_ES256_H */
50