TrustCore SDK Crypto Interface API reference  version 2.0
crypto_interface_pkcs1.h
Go to the documentation of this file.
1 /*
2  * crypto_interface_pkcs1.h
3  *
4  * Cryptographic Interface header file for declaring PKCS1 functions
5  * for the Crypto Interface.
6  *
7  * Copyright 2019-2024 DigiCert, Inc. All Rights Reserved.
8  * Proprietary and Confidential Material.
9  *
10  */
11 
19 #ifndef __CRYPTO_INTERFACE_PKCS1_HEADER__
20 #define __CRYPTO_INTERFACE_PKCS1_HEADER__
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
51 MOC_EXTERN MSTATUS CRYPTO_INTERFACE_PKCS1_rsaOaepEncrypt(
52  MOC_RSA(hwAccelDescr hwAccelCtx)
53  randomContext *pRandomContext,
54  const RSAKey *pRSAKey,
55  ubyte hashAlgo,
56  ubyte mgfAlgo,
57  ubyte mgfHashAlgo,
58  const ubyte *pMessage,
59  ubyte4 mLen,
60  const ubyte *pLabel,
61  ubyte4 lLen,
62  ubyte **ppCipherText,
63  ubyte4 *pCipherTextLen
64  );
65 
88 MOC_EXTERN MSTATUS CRYPTO_INTERFACE_PKCS1_rsaOaepDecrypt(
89  MOC_RSA(hwAccelDescr hwAccelCtx)
90  const RSAKey *pRSAKey,
91  ubyte hashAlgo,
92  ubyte mgfAlgo,
93  ubyte mgfHashAlgo,
94  const ubyte *pCipherText,
95  ubyte4 cLen,
96  const ubyte *pLabel,
97  ubyte4 lLen,
98  ubyte **ppPlainText,
99  ubyte4 *pPlainTextLen
100  );
101 
126 MOC_EXTERN MSTATUS CRYPTO_INTERFACE_PKCS1_rsaPssSignExt (
127  MOC_RSA(hwAccelDescr hwAccelCtx)
128  randomContext *pRandomContext,
129  const RSAKey *pRSAKey,
130  ubyte hashAlgo,
131  ubyte mgfAlgo,
132  ubyte mgfHashAlgo,
133  const ubyte *pMessage,
134  ubyte4 mLen,
135  ubyte4 saltLen,
136  ubyte **ppSignature,
137  ubyte4 *pSignatureLen,
138  void *pExtCtx
139  );
140 
164 MOC_EXTERN MSTATUS CRYPTO_INTERFACE_PKCS1_rsaPssSign (
165  MOC_RSA(hwAccelDescr hwAccelCtx)
166  randomContext *pRandomContext,
167  const RSAKey *pRSAKey,
168  ubyte hashAlgo,
169  ubyte mgfAlgo,
170  ubyte mgfHashAlgo,
171  const ubyte *pMessage,
172  ubyte4 mLen,
173  ubyte4 saltLen,
174  ubyte **ppSignature,
175  ubyte4 *pSignatureLen
176  );
177 
202 MOC_EXTERN MSTATUS CRYPTO_INTERFACE_PKCS1_rsaPssVerifyExt (
203  MOC_RSA(hwAccelDescr hwAccelCtx)
204  const RSAKey *pRSAKey,
205  ubyte hashAlgo,
206  ubyte mgfAlgo,
207  ubyte mgfHashAlgo,
208  const ubyte *pMessage,
209  ubyte4 mLen,
210  const ubyte *pSignature,
211  ubyte4 signatureLen,
212  sbyte4 saltLen,
213  ubyte4 *pVerify,
214  void *pExtCtx
215  );
216 
240 MOC_EXTERN MSTATUS CRYPTO_INTERFACE_PKCS1_rsaPssVerify (
241  MOC_RSA(hwAccelDescr hwAccelCtx)
242  const RSAKey *pRSAKey,
243  ubyte hashAlgo,
244  ubyte mgfAlgo,
245  ubyte mgfHashAlgo,
246  const ubyte *pMessage,
247  ubyte4 mLen,
248  const ubyte *pSignature,
249  ubyte4 signatureLen,
250  sbyte4 saltLen,
251  ubyte4 *pVerify
252  );
253 
254 
255 
277 MOC_EXTERN MSTATUS CRYPTO_INTERFACE_PKCS1_rsassaPssVerify(
278  MOC_RSA(hwAccelDescr hwAccelCtx)
279  const RSAKey *pRSAKey,
280  ubyte H_rsaAlgoId,
281  mgfFunc MGF,
282  const ubyte * const pMessage,
283  ubyte4 mesgLen,
284  const ubyte *pSignature,
285  ubyte4 signatureLen,
286  sbyte4 saltLen,
287  intBoolean *pRetIsSignatureValid
288  );
289 
315 MOC_EXTERN MSTATUS
317  MOC_RSA(hwAccelDescr hwAccelCtx)
318  const ubyte *mgfSeed,
319  ubyte4 mgfSeedLen,
320  ubyte4 maskLen,
321  BulkHashAlgo *H,
322  ubyte **ppRetMask
323  );
324 
352 MOC_EXTERN MSTATUS CRYPTO_INTERFACE_PKCS1_rsaPssPad(
353  MOC_RSA(hwAccelDescr hwAccelCtx)
354  RSAKey *pKey,
355  RNGFun rngFun,
356  void *rngFunArg,
357  ubyte *M,
358  ubyte4 mLen,
359  ubyte4 sLen,
360  ubyte hashAlgo,
361  ubyte mgfAlgo,
362  ubyte mgfHashAlgo,
363  ubyte **ppRetEM,
364  ubyte4 *pRetEMLen
365  );
366 
367 #ifdef __cplusplus
368 }
369 #endif
370 
371 #endif /* __CRYPTO_INTERFACE_PKCS1_HEADER__ */
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_PKCS1_rsaOaepDecrypt(MOC_RSA(hwAccelDescr hwAccelCtx) const RSAKey *pRSAKey, ubyte hashAlgo, ubyte mgfAlgo, ubyte mgfHashAlgo, const ubyte *pCipherText, ubyte4 cLen, const ubyte *pLabel, ubyte4 lLen, ubyte **ppPlainText, ubyte4 *pPlainTextLen)
Perform RSA-OAEP decryption.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_PKCS1_rsaPssVerify(MOC_RSA(hwAccelDescr hwAccelCtx) const RSAKey *pRSAKey, ubyte hashAlgo, ubyte mgfAlgo, ubyte mgfHashAlgo, const ubyte *pMessage, ubyte4 mLen, const ubyte *pSignature, ubyte4 signatureLen, sbyte4 saltLen, ubyte4 *pVerify)
Use the provided RSA Key to verify a PSS signature.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_PKCS1_MGF1(MOC_RSA(hwAccelDescr hwAccelCtx) const ubyte *mgfSeed, ubyte4 mgfSeedLen, ubyte4 maskLen, BulkHashAlgo *H, ubyte **ppRetMask)
Generate an MGF1 mask based on a given hash function, as defined in RFC 3447.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_PKCS1_rsaPssPad(MOC_RSA(hwAccelDescr hwAccelCtx) RSAKey *pKey, RNGFun rngFun, void *rngFunArg, ubyte *M, ubyte4 mLen, ubyte4 sLen, ubyte hashAlgo, ubyte mgfAlgo, ubyte mgfHashAlgo, ubyte **ppRetEM, ubyte4 *pRetEMLen)
Used to generated RSA-PSS padded data.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_PKCS1_rsaPssVerifyExt(MOC_RSA(hwAccelDescr hwAccelCtx) const RSAKey *pRSAKey, ubyte hashAlgo, ubyte mgfAlgo, ubyte mgfHashAlgo, const ubyte *pMessage, ubyte4 mLen, const ubyte *pSignature, ubyte4 signatureLen, sbyte4 saltLen, ubyte4 *pVerify, void *pExtCtx)
Use the provided RSA Key to verify a PSS signature.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_PKCS1_rsaOaepEncrypt(MOC_RSA(hwAccelDescr hwAccelCtx) randomContext *pRandomContext, const RSAKey *pRSAKey, ubyte hashAlgo, ubyte mgfAlgo, ubyte mgfHashAlgo, const ubyte *pMessage, ubyte4 mLen, const ubyte *pLabel, ubyte4 lLen, ubyte **ppCipherText, ubyte4 *pCipherTextLen)
Perform RSA-OAEP encryption.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_PKCS1_rsaPssSignExt(MOC_RSA(hwAccelDescr hwAccelCtx) randomContext *pRandomContext, const RSAKey *pRSAKey, ubyte hashAlgo, ubyte mgfAlgo, ubyte mgfHashAlgo, const ubyte *pMessage, ubyte4 mLen, ubyte4 saltLen, ubyte **ppSignature, ubyte4 *pSignatureLen, void *pExtCtx)
Use the provided RSA Key to sign some data using the PSS scheme.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_PKCS1_rsaPssSign(MOC_RSA(hwAccelDescr hwAccelCtx) randomContext *pRandomContext, const RSAKey *pRSAKey, ubyte hashAlgo, ubyte mgfAlgo, ubyte mgfHashAlgo, const ubyte *pMessage, ubyte4 mLen, ubyte4 saltLen, ubyte **ppSignature, ubyte4 *pSignatureLen)
Use the provided RSA Key to sign some data using the PSS scheme.
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_PKCS1_rsassaPssVerify(MOC_RSA(hwAccelDescr hwAccelCtx) const RSAKey *pRSAKey, ubyte H_rsaAlgoId, mgfFunc MGF, const ubyte *const pMessage, ubyte4 mesgLen, const ubyte *pSignature, ubyte4 signatureLen, sbyte4 saltLen, intBoolean *pRetIsSignatureValid)
Use the provided RSA Key to verify a PSS signature.