xref: /netbsd-src/crypto/external/bsd/openssh/dist/ssh-pkcs11.h (revision 514b5d45114b5d7b0e4a77c402fe3dc63c475ad5)
1 /*	$NetBSD: ssh-pkcs11.h,v 1.9 2023/12/20 17:15:21 christos Exp $	*/
2 /* $OpenBSD: ssh-pkcs11.h,v 1.7 2023/12/18 14:46:56 djm Exp $ */
3 
4 /*
5  * Copyright (c) 2010 Markus Friedl.  All rights reserved.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /* Errors for pkcs11_add_provider() */
21 #define	SSH_PKCS11_ERR_GENERIC			1
22 #define	SSH_PKCS11_ERR_LOGIN_FAIL		2
23 #define	SSH_PKCS11_ERR_NO_SLOTS			3
24 #define	SSH_PKCS11_ERR_PIN_REQUIRED		4
25 #define	SSH_PKCS11_ERR_PIN_LOCKED		5
26 
27 int	pkcs11_init(int);
28 void	pkcs11_terminate(void);
29 int	pkcs11_add_provider(char *, char *, struct sshkey ***, char ***);
30 int	pkcs11_del_provider(char *);
31 #ifdef WITH_PKCS11_KEYGEN
32 struct sshkey *
33 	pkcs11_gakp(char *, char *, unsigned int, char *, unsigned int,
34 	    unsigned int, unsigned char, u_int32_t *);
35 struct sshkey *
36 	pkcs11_destroy_keypair(char *, char *, unsigned long, unsigned char,
37 	    u_int32_t *);
38 #endif
39 
40 /* Only available in ssh-pkcs11-client.c so far */
41 int pkcs11_make_cert(const struct sshkey *,
42     const struct sshkey *, struct sshkey **);
43 #if !defined(WITH_OPENSSL) && defined(ENABLE_PKCS11)
44 #undef ENABLE_PKCS11
45 #endif
46