2209N/A/*
6082N/A * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
2209N/A */
2209N/A
2209N/A/*
2209N/A * Redistribution and use in source and binary forms, with or without
2209N/A * modification, are permitted provided that the following conditions
2209N/A * are met:
2209N/A *
2209N/A * 1. Redistributions of source code must retain the above copyright
2209N/A * notice, this list of conditions and the following disclaimer.
2209N/A *
2209N/A * 2. Redistributions in binary form must reproduce the above copyright
2209N/A * notice, this list of conditions and the following disclaimer in
2209N/A * the documentation and/or other materials provided with the
2209N/A * distribution.
2209N/A *
2209N/A * 3. All advertising materials mentioning features or use of this
2209N/A * software must display the following acknowledgment:
2209N/A * "This product includes software developed by the OpenSSL Project
2209N/A * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
2209N/A *
2209N/A * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
2209N/A * endorse or promote products derived from this software without
2209N/A * prior written permission. For written permission, please contact
2209N/A * licensing@OpenSSL.org.
2209N/A *
2209N/A * 5. Products derived from this software may not be called "OpenSSL"
2209N/A * nor may "OpenSSL" appear in their names without prior written
2209N/A * permission of the OpenSSL Project.
2209N/A *
2209N/A * 6. Redistributions of any form whatsoever must retain the following
2209N/A * acknowledgment:
2209N/A * "This product includes software developed by the OpenSSL Project
2209N/A * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
2209N/A *
2209N/A * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
2209N/A * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2209N/A * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2209N/A * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
2209N/A * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2209N/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2209N/A * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
2209N/A * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2209N/A * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
2209N/A * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2209N/A * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
2209N/A * OF THE POSSIBILITY OF SUCH DAMAGE.
2209N/A */
2209N/A
2231N/A#ifndef E_PK11_URI_H
2231N/A#define E_PK11_URI_H
2209N/A
2209N/A#include <security/pkcs11t.h>
6351N/A#include <cryptoutil.h>
2209N/A
6082N/A#ifdef __cplusplus
6082N/Aextern "C" {
6082N/A#endif
6082N/A
2209N/A/* PKCS#11 URI related prefixes and attributes. */
6351N/A/* define until cryptotuil.h is updated on the system */
6351N/A#ifndef PK11_URI_PREFIX
2209N/A#define PK11_URI_PREFIX "pkcs11:"
2209N/A#define FILE_URI_PREFIX "file://"
2209N/A#define PK11_TOKEN "token"
2209N/A#define PK11_MANUF "manuf"
2209N/A#define PK11_SERIAL "serial"
2209N/A#define PK11_MODEL "model"
2209N/A#define PK11_OBJECT "object"
2209N/A#define PK11_OBJECTTYPE "objecttype"
6351N/A#endif
6351N/A
6351N/A/* OLD PKCS#11 URI supported by OpenSSL pkcs11 engine */
2209N/A#define PK11_ASKPASS "passphrasedialog"
2209N/A
6351N/A#ifndef PK11_URI_BUILTIN_DIALOG
6351N/A/* Use buitin passphrase dialog as a PIN source */
6351N/A#define PK11_URI_BUILTIN_DIALOG ((char *)-1)
6351N/A#endif
6351N/A
2209N/A/* PIN caching policy. */
2209N/A#define POLICY_NOT_INITIALIZED 0
2209N/A#define POLICY_NONE 1
2209N/A#define POLICY_MEMORY 2
2209N/A#define POLICY_MLOCKED_MEMORY 3
2209N/A#define POLICY_WRONG_VALUE 4
2209N/A
2209N/A/*
2209N/A * That's what getpassphrase(3c) supports.
2209N/A */
2209N/A#define PK11_MAX_PIN_LEN 256
2209N/A
2209N/A/* For URI processing. */
2209N/Aextern pthread_mutex_t *uri_lock;
2209N/A
2209N/Aint pk11_get_pin(char *dialog, char **pin);
2209N/Aint pk11_get_pin_caching_policy(void);
6351N/Aint pk11_process_pkcs11_uri(const char *uristr, pkcs11_uri_t *uri_struct,
2209N/A const char **file);
6351N/Aint pk11_check_token_attrs(pkcs11_uri_t *uri_struct);
6351N/Avoid pk11_free_pkcs11_uri(pkcs11_uri_t *uri_struct, CK_BBOOL free_uri_itself);
2209N/Aint pk11_cache_pin(char *pin);
2209N/Aint pk11_token_login(CK_SESSION_HANDLE session, CK_BBOOL *login_done,
6351N/A pkcs11_uri_t *uri_struct, CK_BBOOL is_private);
2209N/Aint pk11_token_relogin(CK_SESSION_HANDLE session);
2209N/A
6082N/A#ifdef __cplusplus
6082N/A}
6082N/A#endif
2231N/A#endif /* E_PK11_URI_H */