xref: /freebsd/contrib/libfido2/src/fido/rs256.h (revision a64729f5077d77e13b9497cb33ecb3c82e606ee8)
1 /*
2  * Copyright (c) 2018-2021 Yubico AB. All rights reserved.
3  * SPDX-License-Identifier: BSD-2-Clause
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met:
8  *
9  *    1. Redistributions of source code must retain the above copyright
10  *       notice, this list of conditions and the following disclaimer.
11  *    2. Redistributions in binary form must reproduce the above copyright
12  *       notice, this list of conditions and the following disclaimer in
13  *       the documentation and/or other materials provided with the
14  *       distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef _FIDO_RS256_H
30 #define _FIDO_RS256_H
31 
32 #include <openssl/rsa.h>
33 
34 #include <stdint.h>
35 #include <stdlib.h>
36 
37 #ifdef _FIDO_INTERNAL
38 #include "types.h"
39 #else
40 #include <fido.h>
41 #endif
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif /* __cplusplus */
46 
47 rs256_pk_t *rs256_pk_new(void);
48 void rs256_pk_free(rs256_pk_t **);
49 EVP_PKEY *rs256_pk_to_EVP_PKEY(const rs256_pk_t *);
50 
51 int rs256_pk_from_EVP_PKEY(rs256_pk_t *, const EVP_PKEY *);
52 int rs256_pk_from_RSA(rs256_pk_t *, const RSA *);
53 int rs256_pk_from_ptr(rs256_pk_t *, const void *, size_t);
54 
55 #ifdef __cplusplus
56 } /* extern "C" */
57 #endif /* __cplusplus */
58 
59 #endif /* !_FIDO_RS256_H */
60