8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / common / crypto / padding / padding.h
bloba27d17895ecd6116f8dbde69b514695805990f93
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
23 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
26 #ifndef _PADDING_H
27 #define _PADDING_H
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
33 #include <sys/types.h>
35 #define MIN_PKCS1_PADLEN 11
38 * Values for PKCS#1 method of encoding/decoding.
40 #define PKCS1_ENCRYPT 0x02
41 #define PKCS1_DECRYPT 0x02
42 #define PKCS1_SIGN 0x01
43 #define PKCS1_VERIFY 0x01
45 #ifdef _KERNEL
47 #include <sys/sunddi.h>
48 #include <sys/crypto/common.h>
50 #define CK_BYTE uchar_t
51 #define CK_ULONG ulong_t
53 #define CKR_DATA_LEN_RANGE CRYPTO_DATA_LEN_RANGE
54 #define CKR_DEVICE_ERROR CRYPTO_DEVICE_ERROR
55 #define CKR_ENCRYPTED_DATA_INVALID CRYPTO_ENCRYPTED_DATA_INVALID
56 #define CKR_SIGNATURE_INVALID CRYPTO_SIGNATURE_INVALID
58 int knzero_random_generator(uint8_t *ran_out, size_t ran_len);
59 void kmemset(uint8_t *buf, char pattern, size_t len);
61 #else
63 #include <security/cryptoki.h>
64 #include <security/pkcs11t.h>
66 #endif /* _KERNEL */
68 int pkcs1_encode(int method, uint8_t *databuf, size_t datalen, uint8_t *padbuf,
69 size_t padbuflen);
70 int pkcs1_decode(int method, uint8_t *padbuf, size_t *plen);
72 int pkcs7_encode(uint8_t *databuf, size_t datalen, uint8_t *padbuf,
73 size_t padbuflen, uint8_t multiple);
74 int pkcs7_decode(uint8_t *padbuf, size_t *plen);
76 #ifdef __cplusplus
78 #endif
80 #endif /* _PADDING_H */