My Project
Loading...
Searching...
No Matches
stsafe.h
1/* stsafe.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 _WOLFPORT_STSAFE_H_
23#define _WOLFPORT_STSAFE_H_
24
25#include <wolfssl/wolfcrypt/settings.h>
28
29#ifdef WOLF_CRYPTO_CB
30#include <wolfssl/wolfcrypt/cryptocb.h>
31#endif
32
33#if !defined(WOLFCRYPT_ONLY) && defined(HAVE_PK_CALLBACKS)
34#include <wolfssl/ssl.h>
35#endif
36
37#ifdef WOLFSSL_STSAFEA100
38
39/* The wolf STSAFE interface layer */
40/* Please contact wolfSSL for the STSAFE port files */
41#include "stsafe_interface.h"
42
43#ifndef STSAFE_MAX_KEY_LEN
44 #define STSAFE_MAX_KEY_LEN ((uint32_t)48) /* for up to 384-bit keys */
45#endif
46#ifndef STSAFE_MAX_PUBKEY_RAW_LEN
47 #define STSAFE_MAX_PUBKEY_RAW_LEN ((uint32_t)STSAFE_MAX_KEY_LEN * 2) /* x/y */
48#endif
49#ifndef STSAFE_MAX_SIG_LEN
50 #define STSAFE_MAX_SIG_LEN ((uint32_t)STSAFE_MAX_KEY_LEN * 2) /* r/s */
51#endif
52
53WOLFSSL_API int SSL_STSAFE_LoadDeviceCertificate(byte** pRawCertificate,
54 word32* pRawCertificateLen);
55
56#if !defined(WOLFCRYPT_ONLY) && defined(HAVE_PK_CALLBACKS)
57WOLFSSL_API int SSL_STSAFE_CreateKeyCb(WOLFSSL* ssl, ecc_key* key, word32 keySz,
58 int ecc_curve, void* ctx);
59WOLFSSL_API int SSL_STSAFE_VerifyPeerCertCb(WOLFSSL* ssl,
60 const unsigned char* sig, unsigned int sigSz,
61 const unsigned char* hash, unsigned int hashSz,
62 const unsigned char* keyDer, unsigned int keySz,
63 int* result, void* ctx);
64WOLFSSL_API int SSL_STSAFE_SignCertificateCb(WOLFSSL* ssl,
65 const byte* in, word32 inSz,
66 byte* out, word32* outSz,
67 const byte* key, word32 keySz, void* ctx);
68WOLFSSL_API int SSL_STSAFE_SharedSecretCb(WOLFSSL* ssl,
69 ecc_key* otherKey,
70 unsigned char* pubKeyDer, unsigned int* pubKeySz,
71 unsigned char* out, unsigned int* outlen,
72 int side, void* ctx);
73
74/* Helper API's for setting up callbacks */
75WOLFSSL_API int SSL_STSAFE_SetupPkCallbacks(WOLFSSL_CTX* ctx);
76WOLFSSL_API int SSL_STSAFE_SetupPkCallbackCtx(WOLFSSL* ssl, void* user_ctx);
77#endif /* HAVE_PK_CALLBACKS */
78
79
80#ifdef WOLF_CRYPTO_CB
81
82/* Device ID that's unique and valid (not INVALID_DEVID -2) */
83#define WOLF_STSAFE_DEVID 0x53545341; /* STSA */
84
86#ifdef HAVE_ECC
87 ecc_key wolfEccKey;
88#endif
89 int devId;
91
92WOLFSSL_API int wolfSSL_STSAFE_CryptoDevCb(int devId, wc_CryptoInfo* info,
93 void* ctx);
94
95#endif /* WOLF_CRYPTO_CB */
96
97#endif /* WOLFSSL_STSAFEA100 */
98
99#endif /* _WOLFPORT_STSAFE_H_ */
Definition internal.h:2595
Definition internal.h:3849
Definition ecc.h:357
Definition stsafe.h:85
Header file containing key wolfSSL API.