TrustCore SDK NanoCrypto API reference  version 7.0
aes_keywrap.h
Go to the documentation of this file.
1 /*
2  * aes_keywrap.h
3  *
4  * AES Key Wrap RFC 3394 and 5649 Implementation
5  *
6  * Copyright 2019-2024 DigiCert, Inc. All Rights Reserved.
7  * Proprietary and Confidential Material.
8  *
9  */
10 
16 /*------------------------------------------------------------------*/
17 
18 #ifndef __AESKEYWRAP_HEADER__
19 #define __AESKEYWRAP_HEADER__
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
65 MOC_EXTERN MSTATUS AESKWRAP_encrypt3394 (
66  MOC_SYM (hwAccelDescr hwAccelCtx)
67  ubyte *pKeyMaterial,
68  sbyte4 keyLength,
69  ubyte *pDataToEncrypt,
70  ubyte4 dataToEncryptLen,
71  ubyte *pEncryptedData,
72  ubyte4 bufferSize,
73  ubyte4 *pEncryptedDataLen
74  );
75 
114 MOC_EXTERN MSTATUS AESKWRAP_decrypt3394 (
115  MOC_SYM (hwAccelDescr hwAccelCtx)
116  ubyte *pKeyMaterial,
117  sbyte4 keyLength,
118  ubyte *pEncryptedData,
119  ubyte4 encryptedDataLen,
120  ubyte *pDecryptedData,
121  ubyte4 bufferSize,
122  ubyte4 *pDecryptedDataLen
123  );
124 
177 MOC_EXTERN MSTATUS AESKWRAP_encrypt5649 (
178  MOC_SYM (hwAccelDescr hwAccelCtx)
179  ubyte *pKeyMaterial,
180  sbyte4 keyLength,
181  ubyte *pDataToEncrypt,
182  ubyte4 dataToEncryptLen,
183  ubyte *pEncryptedData,
184  ubyte4 bufferSize,
185  ubyte4 *pEncryptedDataLen
186  );
187 
253 MOC_EXTERN MSTATUS AESKWRAP_decrypt5649 (
254  MOC_SYM (hwAccelDescr hwAccelCtx)
255  ubyte *pKeyMaterial,
256  sbyte4 keyLength,
257  ubyte *pEncryptedData,
258  ubyte4 encryptedDataLen,
259  ubyte *pDecryptedData,
260  ubyte4 bufferSize,
261  ubyte4 *pDecryptedDataLen
262  );
263 
264 /*---------------------------------------------------------------------------*/
265 
266 /* Follwing APIs are same as above with extra option to specify the transform
267  * type used in the operation */
268 
310 MOC_EXTERN MSTATUS AESKWRAP_encrypt3394Ex (
311  MOC_SYM (hwAccelDescr hwAccelCtx)
312  ubyte *pKeyMaterial,
313  sbyte4 keyLength,
314  ubyte *pDataToEncrypt,
315  ubyte4 dataToEncryptLen,
316  ubyte *pEncryptedData,
317  ubyte4 bufferSize,
318  ubyte4 *pEncryptedDataLen,
319  ubyte transform
320  );
321 
361 MOC_EXTERN MSTATUS AESKWRAP_decrypt3394Ex (
362  MOC_SYM (hwAccelDescr hwAccelCtx)
363  ubyte *pKeyMaterial,
364  sbyte4 keyLength,
365  ubyte *pEncryptedData,
366  ubyte4 encryptedDataLen,
367  ubyte *pDecryptedData,
368  ubyte4 bufferSize,
369  ubyte4 *pDecryptedDataLen,
370  ubyte transform
371  );
372 
426 MOC_EXTERN MSTATUS AESKWRAP_encrypt5649Ex (
427  MOC_SYM (hwAccelDescr hwAccelCtx)
428  ubyte *pKeyMaterial,
429  sbyte4 keyLength,
430  ubyte *pDataToEncrypt,
431  ubyte4 dataToEncryptLen,
432  ubyte *pEncryptedData,
433  ubyte4 bufferSize,
434  ubyte4 *pEncryptedDataLen,
435  ubyte transform
436  );
437 
504 MOC_EXTERN MSTATUS AESKWRAP_decrypt5649Ex (
505  MOC_SYM (hwAccelDescr hwAccelCtx)
506  ubyte *pKeyMaterial,
507  sbyte4 keyLength,
508  ubyte *pEncryptedData,
509  ubyte4 encryptedDataLen,
510  ubyte *pDecryptedData,
511  ubyte4 bufferSize,
512  ubyte4 *pDecryptedDataLen,
513  ubyte transform
514  );
515 
516 /* RFC 3394: length of data must be a multiple of 8 */
517 MOC_EXTERN MSTATUS
518 AESKWRAP_encrypt( MOC_SYM(hwAccelDescr hwAccelCtx) ubyte* keyMaterial,
519  sbyte4 keyLength, const ubyte* data, ubyte4 dataLen,
520  ubyte* retData /* Should be dataLen + 8 */);
521 
522 
523 /* RFC 5649: no restriction on length of data */
524 MOC_EXTERN MSTATUS
525 AESKWRAP_encryptEx( MOC_SYM(hwAccelDescr hwAccelCtx) ubyte* keyMaterial,
526  sbyte4 keyLength, const ubyte* data, ubyte4 dataLen,
527  ubyte** retData, ubyte4* retDataLen);
528 
529 
530 /* legacy API: can only deal with RFC 3394 encoded key wraps */
531 MOC_EXTERN MSTATUS
532 AESKWRAP_decrypt(MOC_SYM(hwAccelDescr hwAccelCtx) ubyte* keyMaterial,
533  sbyte4 keyLength, const ubyte* data, ubyte4 dataLen,
534  ubyte* retData /* dataLen - 8 */);
535 
536 
537 /* preferred API: can deal with RFC 3394 and RFC 5649 encoded key wraps */
538 MOC_EXTERN MSTATUS
539 AESKWRAP_decryptEx(MOC_SYM(hwAccelDescr hwAccelCtx) ubyte* keyMaterial,
540  sbyte4 keyLength, const ubyte* data, ubyte4 dataLen,
541  ubyte* retData /* <= dataLen - 8 */, ubyte4* retDataLen);
542 
543 
544 
545 #ifdef __cplusplus
546 }
547 #endif
548 
549 #endif
MOC_EXTERN MSTATUS AESKWRAP_decrypt3394(MOC_SYM(hwAccelDescr hwAccelCtx) ubyte *pKeyMaterial, sbyte4 keyLength, ubyte *pEncryptedData, ubyte4 encryptedDataLen, ubyte *pDecryptedData, ubyte4 bufferSize, ubyte4 *pDecryptedDataLen)
Decrypt pEncryptedData using the AES key wrapping technique of RFC 3394.
MOC_EXTERN MSTATUS AESKWRAP_decrypt5649Ex(MOC_SYM(hwAccelDescr hwAccelCtx) ubyte *pKeyMaterial, sbyte4 keyLength, ubyte *pEncryptedData, ubyte4 encryptedDataLen, ubyte *pDecryptedData, ubyte4 bufferSize, ubyte4 *pDecryptedDataLen, ubyte transform)
Decrypt pEncryptedData using the AES key wrapping technique of RFC 5649.
MOC_EXTERN MSTATUS AESKWRAP_encrypt5649Ex(MOC_SYM(hwAccelDescr hwAccelCtx) ubyte *pKeyMaterial, sbyte4 keyLength, ubyte *pDataToEncrypt, ubyte4 dataToEncryptLen, ubyte *pEncryptedData, ubyte4 bufferSize, ubyte4 *pEncryptedDataLen, ubyte transform)
Encrypt pDataToEncrypt using the AES key wrapping technique of RFC 5649.
MOC_EXTERN MSTATUS AESKWRAP_decrypt3394Ex(MOC_SYM(hwAccelDescr hwAccelCtx) ubyte *pKeyMaterial, sbyte4 keyLength, ubyte *pEncryptedData, ubyte4 encryptedDataLen, ubyte *pDecryptedData, ubyte4 bufferSize, ubyte4 *pDecryptedDataLen, ubyte transform)
Decrypt pEncryptedData using the AES key wrapping technique of RFC 3394.
MOC_EXTERN MSTATUS AESKWRAP_encrypt3394Ex(MOC_SYM(hwAccelDescr hwAccelCtx) ubyte *pKeyMaterial, sbyte4 keyLength, ubyte *pDataToEncrypt, ubyte4 dataToEncryptLen, ubyte *pEncryptedData, ubyte4 bufferSize, ubyte4 *pEncryptedDataLen, ubyte transform)
Encrypt pDataToEncrypt using the AES key wrapping technique of RFC 3394.
MOC_EXTERN MSTATUS AESKWRAP_encrypt5649(MOC_SYM(hwAccelDescr hwAccelCtx) ubyte *pKeyMaterial, sbyte4 keyLength, ubyte *pDataToEncrypt, ubyte4 dataToEncryptLen, ubyte *pEncryptedData, ubyte4 bufferSize, ubyte4 *pEncryptedDataLen)
Encrypt pDataToEncrypt using the AES key wrapping technique of RFC 5649.
MOC_EXTERN MSTATUS AESKWRAP_decrypt5649(MOC_SYM(hwAccelDescr hwAccelCtx) ubyte *pKeyMaterial, sbyte4 keyLength, ubyte *pEncryptedData, ubyte4 encryptedDataLen, ubyte *pDecryptedData, ubyte4 bufferSize, ubyte4 *pDecryptedDataLen)
Decrypt pEncryptedData using the AES key wrapping technique of RFC 5649.
MOC_EXTERN MSTATUS AESKWRAP_encrypt3394(MOC_SYM(hwAccelDescr hwAccelCtx) ubyte *pKeyMaterial, sbyte4 keyLength, ubyte *pDataToEncrypt, ubyte4 dataToEncryptLen, ubyte *pEncryptedData, ubyte4 bufferSize, ubyte4 *pEncryptedDataLen)
Encrypt pDataToEncrypt using the AES key wrapping technique of RFC 3394.