wolfcaam.h
1 /* wolfcaam.h
2  *
3  * Copyright (C) 2006-2020 wolfSSL Inc.
4  *
5  * This file is part of wolfSSL.
6  *
7  * wolfSSL is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * wolfSSL is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
20  */
21 
22 #ifndef WOLF_CRYPT_CAAM_INIT_H
23 #define WOLF_CRYPT_CAAM_INIT_H
24 
25 #include <wolfssl/wolfcrypt/settings.h>
26 
27 #if defined(WOLFSSL_IMX6_CAAM) || defined(WOLFSSL_IMX6_CAAM_RNG)
28 
30 
31 #if defined(__INTEGRITY) || defined(INTEGRITY)
32  #include <INTEGRITY.h>
33 #endif
34 
35 WOLFSSL_LOCAL int wc_caamInit(void);
36 WOLFSSL_LOCAL int wc_caamFree(void);
37 WOLFSSL_LOCAL int wc_caamInitRng(void);
38 WOLFSSL_LOCAL int wc_caamFreeRng(void);
39 
40 WOLFSSL_LOCAL word32 wc_caamReadRegister(word32 reg);
41 WOLFSSL_LOCAL void wc_caamWriteRegister(word32 reg, word32 value);
42 WOLFSSL_LOCAL int wc_caamAddAndWait(Buffer* buf, word32 arg[4], word32 type);
43 
44 WOLFSSL_API int wc_caamSetResource(IODevice ioDev);
45 
46 WOLFSSL_API int wc_caamOpenBlob(byte* data, word32 dataSz, byte* out,
47  word32* outSz);
48 WOLFSSL_API int wc_caamCreateBlob(byte* data, word32 dataSz, byte* out,
49  word32* outSz);
50 
51 /* additional size that is added by CAAM when creating a blob */
52 #define WC_CAAM_BLOB_SZ 48
53 
54 #ifndef WC_CAAM_READ
55  #define WC_CAAM_READ(reg) wc_caamReadRegister((reg))
56 #endif
57 #ifndef WC_CAAM_WRITE
58  #define WC_CAAM_WRITE(reg, x) wc_caamWriteRegister((reg), (x))
59 #endif
60 
61 #endif /* WOLFSSL_IMX6_CAAM */
62 
63 #endif /* WOLF_CRYPT_CAAM_INIT_H */