Print this page
Raise max RSA keysize (WIP)
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/common/crypto/dh/dh_impl.h
+++ new/usr/src/common/crypto/dh/dh_impl.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
24 24 */
25 25
26 26 #ifndef _DH_IMPL_H
|
↓ open down ↓ |
26 lines elided |
↑ open up ↑ |
27 27 #define _DH_IMPL_H
28 28
29 29 #ifdef __cplusplus
30 30 extern "C" {
31 31 #endif
32 32
33 33 #include <sys/types.h>
34 34 #include <bignum.h>
35 35
36 36 #define MIN_DH_KEYLENGTH_IN_BYTES 8
37 -#define MAX_DH_KEYLENGTH_IN_BYTES 512
37 +#define MAX_DH_KEYLENGTH_IN_BYTES 2048
38 38 #define DH_MIN_KEY_LEN 64
39 -#define DH_MAX_KEY_LEN 4096
39 +#define DH_MAX_KEY_LEN 16384
40 40
41 41 #ifdef _KERNEL
42 42
43 43 #include <sys/sunddi.h>
44 44 #include <sys/crypto/common.h>
45 45
46 46 #define CK_RV ulong_t
47 47
48 48 #define CKR_OK CRYPTO_SUCCESS
49 49 #define CKR_ARGUMENTS_BAD CRYPTO_ARGUMENTS_BAD
50 50 #define CKR_ATTRIBUTE_TYPE_INVALID CRYPTO_ATTRIBUTE_TYPE_INVALID
51 51 #define CKR_ATTRIBUTE_VALUE_INVALID CRYPTO_ATTRIBUTE_VALUE_INVALID
52 52 #define CKR_DEVICE_ERROR CRYPTO_DEVICE_ERROR
53 53 #define CKR_GENERAL_ERROR CRYPTO_GENERAL_ERROR
54 54 #define CKR_HOST_MEMORY CRYPTO_HOST_MEMORY
55 55 #define CKR_KEY_SIZE_RANGE CRYPTO_KEY_SIZE_RANGE
56 56
57 57 int random_get_bytes(uint8_t *ran_out, size_t ran_len);
58 58 int random_get_pseudo_bytes(uint8_t *ran_out, size_t ran_len);
59 59
60 60 #else
61 61
62 62 #include <security/cryptoki.h>
63 63 #include <security/pkcs11t.h>
64 64
65 65 #endif /* _KERNEL */
66 66
67 67
68 68 /* DH key using BIGNUM representations */
69 69 typedef struct {
70 70 int size; /* key size in bits */
71 71 BIGNUM p; /* p (prime) */
72 72 BIGNUM g; /* g (base) */
73 73 BIGNUM x; /* private value (random) */
74 74 BIGNUM y; /* public value (= g^x mod p) */
75 75 } DHkey;
76 76
77 77 /* DH key using byte string representations, useful for parameter lists */
78 78 typedef struct {
79 79 uint32_t prime_bits; /* size */
80 80 uchar_t *prime; /* p */
81 81 uint32_t base_bytes;
82 82 uchar_t *base; /* g */
83 83 uint32_t value_bits; /* for both x and y */
84 84 uchar_t *private_x; /* x */
85 85 uchar_t *public_y; /* y */
86 86 int (*rfunc)(void *, size_t); /* random function */
87 87 } DHbytekey;
88 88
89 89
90 90 CK_RV dh_genkey_pair(DHbytekey *bkey);
91 91
92 92 CK_RV dh_key_derive(DHbytekey *bkey, uint32_t key_type,
93 93 uchar_t *secretkey, uint32_t *secretkey_len, int flag);
94 94
95 95 #ifdef __cplusplus
96 96 }
97 97 #endif
98 98
99 99 #endif /* _DH_IMPL_H */
|
↓ open down ↓ |
50 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX