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" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 typedef struct SFTKTokenObjectStr SFTKTokenObject; | 97 typedef struct SFTKTokenObjectStr SFTKTokenObject; |
98 typedef struct SFTKSessionStr SFTKSession; | 98 typedef struct SFTKSessionStr SFTKSession; |
99 typedef struct SFTKSlotStr SFTKSlot; | 99 typedef struct SFTKSlotStr SFTKSlot; |
100 typedef struct SFTKSessionContextStr SFTKSessionContext; | 100 typedef struct SFTKSessionContextStr SFTKSessionContext; |
101 typedef struct SFTKSearchResultsStr SFTKSearchResults; | 101 typedef struct SFTKSearchResultsStr SFTKSearchResults; |
102 typedef struct SFTKHashVerifyInfoStr SFTKHashVerifyInfo; | 102 typedef struct SFTKHashVerifyInfoStr SFTKHashVerifyInfo; |
103 typedef struct SFTKHashSignInfoStr SFTKHashSignInfo; | 103 typedef struct SFTKHashSignInfoStr SFTKHashSignInfo; |
104 typedef struct SFTKOAEPEncryptInfoStr SFTKOAEPEncryptInfo; | 104 typedef struct SFTKOAEPEncryptInfoStr SFTKOAEPEncryptInfo; |
105 typedef struct SFTKOAEPDecryptInfoStr SFTKOAEPDecryptInfo; | 105 typedef struct SFTKOAEPDecryptInfoStr SFTKOAEPDecryptInfo; |
106 typedef struct SFTKSSLMACInfoStr SFTKSSLMACInfo; | 106 typedef struct SFTKSSLMACInfoStr SFTKSSLMACInfo; |
| 107 typedef struct SFTKChaCha20Poly1305InfoStr SFTKChaCha20Poly1305Info; |
107 typedef struct SFTKItemTemplateStr SFTKItemTemplate; | 108 typedef struct SFTKItemTemplateStr SFTKItemTemplate; |
108 | 109 |
109 /* define function pointer typdefs for pointer tables */ | 110 /* define function pointer typdefs for pointer tables */ |
110 typedef void (*SFTKDestroy)(void *, PRBool); | 111 typedef void (*SFTKDestroy)(void *, PRBool); |
111 typedef void (*SFTKBegin)(void *); | 112 typedef void (*SFTKBegin)(void *); |
112 typedef SECStatus (*SFTKCipher)(void *,void *,unsigned int *,unsigned int, | 113 typedef SECStatus (*SFTKCipher)(void *,void *,unsigned int *,unsigned int, |
113 void *, unsigned int); | 114 void *, unsigned int); |
114 typedef SECStatus (*SFTKVerify)(void *,void *,unsigned int,void *,unsigned int); | 115 typedef SECStatus (*SFTKVerify)(void *,void *,unsigned int,void *,unsigned int); |
115 typedef void (*SFTKHash)(void *,void *,unsigned int); | 116 typedef void (*SFTKHash)(void *,void *,unsigned int); |
116 typedef void (*SFTKEnd)(void *,void *,unsigned int *,unsigned int); | 117 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; | 393 void *hashContext; |
393 SFTKBegin begin; | 394 SFTKBegin begin; |
394 SFTKHash update; | 395 SFTKHash update; |
395 SFTKEnd end; | 396 SFTKEnd end; |
396 CK_ULONG macSize; | 397 CK_ULONG macSize; |
397 int padSize; | 398 int padSize; |
398 unsigned char key[MAX_KEY_LEN]; | 399 unsigned char key[MAX_KEY_LEN]; |
399 unsigned int keySize; | 400 unsigned int keySize; |
400 }; | 401 }; |
401 | 402 |
| 403 /* SFTKChaCha20Poly1305Info saves the key and additional data for a |
| 404 * ChaCha20+Poly1305 AEAD operation. */ |
| 405 struct SFTKChaCha20Poly1305InfoStr { |
| 406 unsigned char key[32]; |
| 407 unsigned char nonce[8]; |
| 408 unsigned char ad[16]; |
| 409 unsigned char *adOverflow; |
| 410 unsigned int adLen; |
| 411 unsigned char tagLen; |
| 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 |