OLD | NEW |
---|---|
1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
2 * License, v. 2.0. If a copy of the MPL was not distributed with this | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
4 /* | 4 /* |
5 * Internal data structures and functions used by pkcs11.c | 5 * Internal data structures and functions used by pkcs11.c |
6 */ | 6 */ |
7 #ifndef _PKCS11I_H_ | 7 #ifndef _PKCS11I_H_ |
8 #define _PKCS11I_H_ 1 | 8 #define _PKCS11I_H_ 1 |
9 | 9 |
10 #include "nssilock.h" | 10 #include "nssilock.h" |
11 #include "seccomon.h" | 11 #include "seccomon.h" |
12 #include "secoidt.h" | 12 #include "secoidt.h" |
13 #include "lowkeyti.h" | 13 #include "lowkeyti.h" |
14 #include "pkcs11t.h" | 14 #include "pkcs11t.h" |
15 | 15 |
16 #include "sftkdbt.h" | 16 #include "sftkdbt.h" |
17 #include "chacha20poly1305.h" | |
17 #include "hasht.h" | 18 #include "hasht.h" |
18 | 19 |
19 /* | 20 /* |
20 * Configuration Defines | 21 * Configuration Defines |
21 * | 22 * |
22 * The following defines affect the space verse speed trade offs of | 23 * The following defines affect the space verse speed trade offs of |
23 * the PKCS #11 module. For the most part the current settings are optimized | 24 * the PKCS #11 module. For the most part the current settings are optimized |
24 * for web servers, where we want faster speed and lower lock contention at | 25 * for web servers, where we want faster speed and lower lock contention at |
25 * the expense of space. | 26 * the expense of space. |
26 */ | 27 */ |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 typedef struct SFTKTokenObjectStr SFTKTokenObject; | 98 typedef struct SFTKTokenObjectStr SFTKTokenObject; |
98 typedef struct SFTKSessionStr SFTKSession; | 99 typedef struct SFTKSessionStr SFTKSession; |
99 typedef struct SFTKSlotStr SFTKSlot; | 100 typedef struct SFTKSlotStr SFTKSlot; |
100 typedef struct SFTKSessionContextStr SFTKSessionContext; | 101 typedef struct SFTKSessionContextStr SFTKSessionContext; |
101 typedef struct SFTKSearchResultsStr SFTKSearchResults; | 102 typedef struct SFTKSearchResultsStr SFTKSearchResults; |
102 typedef struct SFTKHashVerifyInfoStr SFTKHashVerifyInfo; | 103 typedef struct SFTKHashVerifyInfoStr SFTKHashVerifyInfo; |
103 typedef struct SFTKHashSignInfoStr SFTKHashSignInfo; | 104 typedef struct SFTKHashSignInfoStr SFTKHashSignInfo; |
104 typedef struct SFTKOAEPEncryptInfoStr SFTKOAEPEncryptInfo; | 105 typedef struct SFTKOAEPEncryptInfoStr SFTKOAEPEncryptInfo; |
105 typedef struct SFTKOAEPDecryptInfoStr SFTKOAEPDecryptInfo; | 106 typedef struct SFTKOAEPDecryptInfoStr SFTKOAEPDecryptInfo; |
106 typedef struct SFTKSSLMACInfoStr SFTKSSLMACInfo; | 107 typedef struct SFTKSSLMACInfoStr SFTKSSLMACInfo; |
108 typedef struct SFTKChaCha20Poly1305InfoStr SFTKChaCha20Poly1305Info; | |
107 typedef struct SFTKItemTemplateStr SFTKItemTemplate; | 109 typedef struct SFTKItemTemplateStr SFTKItemTemplate; |
108 | 110 |
109 /* define function pointer typdefs for pointer tables */ | 111 /* define function pointer typdefs for pointer tables */ |
110 typedef void (*SFTKDestroy)(void *, PRBool); | 112 typedef void (*SFTKDestroy)(void *, PRBool); |
111 typedef void (*SFTKBegin)(void *); | 113 typedef void (*SFTKBegin)(void *); |
112 typedef SECStatus (*SFTKCipher)(void *,void *,unsigned int *,unsigned int, | 114 typedef SECStatus (*SFTKCipher)(void *,void *,unsigned int *,unsigned int, |
113 void *, unsigned int); | 115 void *, unsigned int); |
114 typedef SECStatus (*SFTKVerify)(void *,void *,unsigned int,void *,unsigned int); | 116 typedef SECStatus (*SFTKVerify)(void *,void *,unsigned int,void *,unsigned int); |
115 typedef void (*SFTKHash)(void *,void *,unsigned int); | 117 typedef void (*SFTKHash)(void *,void *,unsigned int); |
116 typedef void (*SFTKEnd)(void *,void *,unsigned int *,unsigned int); | 118 typedef void (*SFTKEnd)(void *,void *,unsigned int *,unsigned int); |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
392 void *hashContext; | 394 void *hashContext; |
393 SFTKBegin begin; | 395 SFTKBegin begin; |
394 SFTKHash update; | 396 SFTKHash update; |
395 SFTKEnd end; | 397 SFTKEnd end; |
396 CK_ULONG macSize; | 398 CK_ULONG macSize; |
397 int padSize; | 399 int padSize; |
398 unsigned char key[MAX_KEY_LEN]; | 400 unsigned char key[MAX_KEY_LEN]; |
399 unsigned int keySize; | 401 unsigned int keySize; |
400 }; | 402 }; |
401 | 403 |
404 /* SFTKChaCha20Poly1305Info saves the key, tag length, nonce, and additional dat a | |
agl
2013/10/23 14:24:28
ditto about 80 chars.
wtc
2013/10/23 20:04:20
Done.
| |
405 * for a ChaCha20+Poly1305 AEAD operation. */ | |
406 struct SFTKChaCha20Poly1305InfoStr { | |
407 ChaCha20Poly1305Context freeblCtx; | |
408 unsigned char nonce[8]; | |
409 unsigned char ad[16]; | |
410 unsigned char *adOverflow; | |
411 unsigned int adLen; | |
412 }; | |
413 | |
402 /* | 414 /* |
403 * Template based on SECItems, suitable for passing as arrays | 415 * Template based on SECItems, suitable for passing as arrays |
404 */ | 416 */ |
405 struct SFTKItemTemplateStr { | 417 struct SFTKItemTemplateStr { |
406 CK_ATTRIBUTE_TYPE type; | 418 CK_ATTRIBUTE_TYPE type; |
407 SECItem *item; | 419 SECItem *item; |
408 }; | 420 }; |
409 | 421 |
410 /* macro for setting SFTKTemplates. */ | 422 /* macro for setting SFTKTemplates. */ |
411 #define SFTK_SET_ITEM_TEMPLATE(templ, count, itemPtr, attr) \ | 423 #define SFTK_SET_ITEM_TEMPLATE(templ, count, itemPtr, attr) \ |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
736 | 748 |
737 extern CK_RV | 749 extern CK_RV |
738 sftk_TLSPRFInit(SFTKSessionContext *context, | 750 sftk_TLSPRFInit(SFTKSessionContext *context, |
739 SFTKObject * key, | 751 SFTKObject * key, |
740 CK_KEY_TYPE key_type, | 752 CK_KEY_TYPE key_type, |
741 HASH_HashType hash_alg); | 753 HASH_HashType hash_alg); |
742 | 754 |
743 SEC_END_PROTOS | 755 SEC_END_PROTOS |
744 | 756 |
745 #endif /* _PKCS11I_H_ */ | 757 #endif /* _PKCS11I_H_ */ |
OLD | NEW |