mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-19 09:38:32 -04:00
Prepare for V7.2.0 release.
This commit is contained in:
parent
73ad4387e2
commit
e0bab5981a
1071 changed files with 8726 additions and 2457 deletions
|
@ -68,6 +68,14 @@ typedef struct Aes {
|
|||
|
||||
ALIGN16 word32 reg[AES_BLOCK_SIZE / sizeof(word32)]; /* for CBC mode */
|
||||
ALIGN16 word32 tmp[AES_BLOCK_SIZE / sizeof(word32)]; /* same */
|
||||
|
||||
#ifdef HAVE_AESGCM
|
||||
ALIGN16 byte H[AES_BLOCK_SIZE];
|
||||
#ifdef GCM_TABLE
|
||||
/* key-based fast multiplication table. */
|
||||
ALIGN16 byte M0[256][AES_BLOCK_SIZE];
|
||||
#endif /* GCM_TABLE */
|
||||
#endif /* HAVE_AESGCM */
|
||||
} Aes;
|
||||
|
||||
|
||||
|
@ -80,6 +88,20 @@ CYASSL_API void AesCtrEncrypt(Aes* aes, byte* out, const byte* in, word32 sz);
|
|||
CYASSL_API void AesEncryptDirect(Aes* aes, byte* out, const byte* in);
|
||||
CYASSL_API void AesDecryptDirect(Aes* aes, byte* out, const byte* in);
|
||||
|
||||
#ifdef HAVE_AESGCM
|
||||
CYASSL_API void AesGcmSetKey(Aes* aes, const byte* key, word32 len,
|
||||
const byte* implicitIV);
|
||||
CYASSL_API void AesGcmSetExpIV(Aes* aes, const byte* iv);
|
||||
CYASSL_API void AesGcmGetExpIV(Aes* aes, byte* iv);
|
||||
CYASSL_API void AesGcmIncExpIV(Aes* aes);
|
||||
CYASSL_API void AesGcmEncrypt(Aes* aes, byte* out, const byte* in, word32 sz,
|
||||
byte* authTag, word32 authTagSz,
|
||||
const byte* authIn, word32 authInSz);
|
||||
CYASSL_API int AesGcmDecrypt(Aes* aes, byte* out, const byte* in, word32 sz,
|
||||
const byte* authTag, word32 authTagSz,
|
||||
const byte* authIn, word32 authInSz);
|
||||
#endif /* HAVE_AESGCM */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
|
|
@ -61,6 +61,7 @@ enum ASN_Tags {
|
|||
ASN_SEQUENCE = 0x10,
|
||||
ASN_SET = 0x11,
|
||||
ASN_UTC_TIME = 0x17,
|
||||
ASN_DNS_TYPE = 0x02,
|
||||
ASN_GENERALIZED_TIME = 0x18,
|
||||
CRL_EXTENSIONS = 0xa0,
|
||||
ASN_EXTENSIONS = 0xa3,
|
||||
|
@ -138,6 +139,8 @@ enum Misc_ASN {
|
|||
#endif
|
||||
/* Max total extensions, id + len + others */
|
||||
#endif
|
||||
MAX_OCSP_EXT_SZ = 58, /* Max OCSP Extension length */
|
||||
MAX_OCSP_NONCE_SZ = 18, /* OCSP Nonce size */
|
||||
MAX_PUBLIC_KEY_SZ = MAX_NTRU_ENC_SZ + MAX_ALGO_SZ + MAX_SEQ_SZ * 2
|
||||
/* use bigger NTRU size */
|
||||
};
|
||||
|
@ -198,6 +201,13 @@ enum VerifyType {
|
|||
};
|
||||
|
||||
|
||||
typedef struct DNS_entry DNS_entry;
|
||||
|
||||
struct DNS_entry {
|
||||
DNS_entry* next; /* next on DNS list */
|
||||
char* name; /* actual DNS name */
|
||||
};
|
||||
|
||||
typedef struct DecodedCert DecodedCert;
|
||||
typedef struct Signer Signer;
|
||||
|
||||
|
@ -211,6 +221,7 @@ struct DecodedCert {
|
|||
word32 sigLength; /* length of signature */
|
||||
word32 signatureOID; /* sum of algorithm object id */
|
||||
word32 keyOID; /* sum of key algo object id */
|
||||
DNS_entry* altNames; /* alt names list of dns entries */
|
||||
byte subjectHash[SHA_SIZE]; /* hash of all Names */
|
||||
byte issuerHash[SHA_SIZE]; /* hash of all Names */
|
||||
#ifdef HAVE_OCSP
|
||||
|
@ -219,6 +230,7 @@ struct DecodedCert {
|
|||
byte* signature; /* not owned, points into raw cert */
|
||||
char* subjectCN; /* CommonName */
|
||||
int subjectCNLen;
|
||||
int subjectCNStored; /* have we saved a copy we own */
|
||||
char issuer[ASN_NAME_MAX]; /* full name including common name */
|
||||
char subject[ASN_NAME_MAX]; /* full name including common name */
|
||||
int verify; /* Default to yes, but could be off */
|
||||
|
@ -278,6 +290,7 @@ struct Signer {
|
|||
#define CYASSL_TEST_API CYASSL_LOCAL
|
||||
#endif
|
||||
|
||||
CYASSL_TEST_API void FreeAltNames(DNS_entry*, void*);
|
||||
CYASSL_TEST_API void InitDecodedCert(DecodedCert*, byte*, word32, void*);
|
||||
CYASSL_TEST_API void FreeDecodedCert(DecodedCert*);
|
||||
CYASSL_TEST_API int ParseCert(DecodedCert*, int type, int verify, void* cm);
|
||||
|
@ -295,6 +308,7 @@ CYASSL_LOCAL void FreeSigners(Signer*, void*);
|
|||
CYASSL_LOCAL int ToTraditional(byte* buffer, word32 length);
|
||||
CYASSL_LOCAL int ToTraditionalEnc(byte* buffer, word32 length,const char*, int);
|
||||
|
||||
CYASSL_LOCAL int ValidateDate(const byte* date, byte format, int dateType);
|
||||
|
||||
#ifdef HAVE_ECC
|
||||
/* ASN sig helpers */
|
||||
|
@ -321,6 +335,10 @@ enum cert_enums {
|
|||
#endif /* CYASSL_CERT_GEN */
|
||||
|
||||
|
||||
|
||||
/* for pointer use */
|
||||
typedef struct CertStatus CertStatus;
|
||||
|
||||
#ifdef HAVE_OCSP
|
||||
|
||||
enum Ocsp_Response_Status {
|
||||
|
@ -341,47 +359,82 @@ enum Ocsp_Cert_Status {
|
|||
|
||||
|
||||
enum Ocsp_Sums {
|
||||
OCSP_BASIC_OID = 117
|
||||
OCSP_BASIC_OID = 117,
|
||||
OCSP_NONCE_OID = 118
|
||||
};
|
||||
|
||||
|
||||
#define STATUS_LIST_SIZE 5
|
||||
|
||||
|
||||
typedef struct OcspRequest OcspRequest;
|
||||
typedef struct OcspResponse OcspResponse;
|
||||
|
||||
|
||||
struct CertStatus {
|
||||
CertStatus* next;
|
||||
|
||||
byte serial[EXTERNAL_SERIAL_SIZE];
|
||||
int serialSz;
|
||||
|
||||
int status;
|
||||
|
||||
byte thisDate[MAX_DATE_SIZE];
|
||||
byte nextDate[MAX_DATE_SIZE];
|
||||
byte thisDateFormat;
|
||||
byte nextDateFormat;
|
||||
};
|
||||
|
||||
|
||||
struct OcspResponse {
|
||||
int responseStatus; /* return code from Responder */
|
||||
|
||||
word32 respBegin; /* index to beginning of OCSP Response */
|
||||
word32 respLength; /* length of the OCSP Response */
|
||||
byte* response; /* Pointer to beginning of OCSP Response */
|
||||
word32 responseSz; /* length of the OCSP Response */
|
||||
|
||||
int version; /* Response version number */
|
||||
byte producedDate[MAX_DATE_SIZE];
|
||||
/* Date at which this response was signed */
|
||||
byte producedDateFormat; /* format of the producedDate */
|
||||
byte* issuerHash;
|
||||
byte* issuerKeyHash;
|
||||
|
||||
word32 sigIndex; /* Index into source for start of sig */
|
||||
word32 sigLength; /* Length in octets for the sig */
|
||||
byte* cert;
|
||||
word32 certSz;
|
||||
|
||||
byte* sig; /* Pointer to sig in source */
|
||||
word32 sigSz; /* Length in octets for the sig */
|
||||
word32 sigOID; /* OID for hash used for sig */
|
||||
|
||||
int certStatusCount; /* Count of certificate statuses, Note
|
||||
* 1:1 correspondence between certStatus
|
||||
* and certSerialNumber */
|
||||
byte certSN[STATUS_LIST_SIZE][EXTERNAL_SERIAL_SIZE];
|
||||
int certSNsz[STATUS_LIST_SIZE];
|
||||
/* Certificate serial number array. */
|
||||
word32 certStatus[STATUS_LIST_SIZE];
|
||||
/* Certificate status array */
|
||||
CertStatus* status; /* certificate status to fill out */
|
||||
|
||||
byte* nonce; /* pointer to nonce inside ASN.1 response */
|
||||
int nonceSz; /* length of the nonce string */
|
||||
|
||||
byte* source; /* pointer to source buffer, not owned */
|
||||
word32 maxIdx; /* max offset based on init size */
|
||||
void* heap; /* for user memory overrides */
|
||||
};
|
||||
|
||||
|
||||
CYASSL_LOCAL void InitOcspResponse(OcspResponse*, byte*, word32, void*);
|
||||
CYASSL_LOCAL void FreeOcspResponse(OcspResponse*);
|
||||
struct OcspRequest {
|
||||
DecodedCert* cert;
|
||||
|
||||
byte nonce[MAX_OCSP_NONCE_SZ];
|
||||
int nonceSz;
|
||||
|
||||
byte* issuerHash; /* pointer to issuerHash in source cert */
|
||||
byte* issuerKeyHash; /* pointer to issuerKeyHash in source cert */
|
||||
byte* serial; /* pointer to serial number in source cert */
|
||||
int serialSz; /* length of the serial number */
|
||||
|
||||
byte* dest; /* pointer to the destination ASN.1 buffer */
|
||||
word32 destSz; /* length of the destination buffer */
|
||||
};
|
||||
|
||||
|
||||
CYASSL_LOCAL void InitOcspResponse(OcspResponse*, CertStatus*, byte*, word32);
|
||||
CYASSL_LOCAL int OcspResponseDecode(OcspResponse*);
|
||||
CYASSL_LOCAL int EncodeOcspRequest(DecodedCert*, byte*, word32);
|
||||
|
||||
CYASSL_LOCAL void InitOcspRequest(OcspRequest*, DecodedCert*, byte*, word32);
|
||||
CYASSL_LOCAL int EncodeOcspRequest(OcspRequest*);
|
||||
|
||||
CYASSL_LOCAL int CompareOcspReqResp(OcspRequest*, OcspResponse*);
|
||||
|
||||
|
||||
#endif /* HAVE_OCSP */
|
||||
|
@ -410,12 +463,14 @@ struct DecodedCRL {
|
|||
byte crlHash[MD5_DIGEST_SIZE]; /* raw crl data hash */
|
||||
byte lastDate[MAX_DATE_SIZE]; /* last date updated */
|
||||
byte nextDate[MAX_DATE_SIZE]; /* next update date */
|
||||
byte lastDateFormat; /* format of last date */
|
||||
byte nextDateFormat; /* format of next date */
|
||||
RevokedCert* certs; /* revoked cert list */
|
||||
int totalCerts; /* number on list */
|
||||
};
|
||||
|
||||
CYASSL_LOCAL void InitDecodedCRL(DecodedCRL*);
|
||||
CYASSL_LOCAL int ParseCRL(DecodedCRL*, const byte* buff, long sz);
|
||||
CYASSL_LOCAL int ParseCRL(DecodedCRL*, const byte* buff, long sz, void* cm);
|
||||
CYASSL_LOCAL void FreeDecodedCRL(DecodedCRL*);
|
||||
|
||||
|
||||
|
|
|
@ -98,6 +98,8 @@ enum {
|
|||
NO_PASSWORD = -176, /* no password provided by user */
|
||||
ALT_NAME_E = -177, /* alt name size problem, too big */
|
||||
|
||||
AES_GCM_AUTH_E = -180, /* AES-GCM Authentication check failure */
|
||||
|
||||
MIN_CODE_E = -200 /* errors -101 - -199 */
|
||||
};
|
||||
|
||||
|
|
|
@ -32,6 +32,10 @@
|
|||
#include <cyassl/ctaocrypt/sha256.h>
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_SHA384
|
||||
#include <cyassl/ctaocrypt/sha512.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -40,13 +44,19 @@
|
|||
enum {
|
||||
IPAD = 0x36,
|
||||
OPAD = 0x5C,
|
||||
#ifndef NO_SHA256
|
||||
#if defined(CYASSL_SHA384)
|
||||
INNER_HASH_SIZE = SHA384_DIGEST_SIZE,
|
||||
HMAC_BLOCK_SIZE = SHA384_BLOCK_SIZE
|
||||
#elif !defined(NO_SHA256)
|
||||
INNER_HASH_SIZE = SHA256_DIGEST_SIZE,
|
||||
HMAC_BLOCK_SIZE = SHA256_BLOCK_SIZE,
|
||||
SHA384 = 5
|
||||
#else
|
||||
INNER_HASH_SIZE = SHA_DIGEST_SIZE,
|
||||
HMAC_BLOCK_SIZE = SHA_BLOCK_SIZE,
|
||||
SHA256 = 2, /* hash type unique */
|
||||
SHA384 = 5
|
||||
#endif
|
||||
HMAC_BLOCK_SIZE = MD5_BLOCK_SIZE
|
||||
};
|
||||
|
||||
|
||||
|
@ -57,6 +67,9 @@ typedef union {
|
|||
#ifndef NO_SHA256
|
||||
Sha256 sha256;
|
||||
#endif
|
||||
#ifdef CYASSL_SHA384
|
||||
Sha384 sha384;
|
||||
#endif
|
||||
} Hash;
|
||||
|
||||
/* Hmac digest */
|
||||
|
|
|
@ -15,6 +15,7 @@ nobase_include_HEADERS+= \
|
|||
cyassl/ctaocrypt/hc128.h \
|
||||
cyassl/ctaocrypt/hmac.h \
|
||||
cyassl/ctaocrypt/integer.h \
|
||||
cyassl/ctaocrypt/md2.h \
|
||||
cyassl/ctaocrypt/md4.h \
|
||||
cyassl/ctaocrypt/md5.h \
|
||||
cyassl/ctaocrypt/misc.h \
|
||||
|
|
64
FreeRTOS-Plus/CyaSSL/cyassl/ctaocrypt/md2.h
Normal file
64
FreeRTOS-Plus/CyaSSL/cyassl/ctaocrypt/md2.h
Normal file
|
@ -0,0 +1,64 @@
|
|||
/* md2.h
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
* CyaSSL is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* CyaSSL is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
|
||||
#ifdef CYASSL_MD2
|
||||
|
||||
#ifndef CTAO_CRYPT_MD2_H
|
||||
#define CTAO_CRYPT_MD2_H
|
||||
|
||||
#include <cyassl/ctaocrypt/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* in bytes */
|
||||
enum {
|
||||
MD2 = 6, /* hash type unique */
|
||||
MD2_BLOCK_SIZE = 16,
|
||||
MD2_DIGEST_SIZE = 16,
|
||||
MD2_PAD_SIZE = 16,
|
||||
MD2_X_SIZE = 48
|
||||
};
|
||||
|
||||
|
||||
/* Md2 digest */
|
||||
typedef struct Md2 {
|
||||
word32 count; /* bytes % PAD_SIZE */
|
||||
byte X[MD2_X_SIZE];
|
||||
byte C[MD2_BLOCK_SIZE];
|
||||
byte buffer[MD2_BLOCK_SIZE];
|
||||
} Md2;
|
||||
|
||||
|
||||
CYASSL_API void InitMd2(Md2*);
|
||||
CYASSL_API void Md2Update(Md2*, const byte*, word32);
|
||||
CYASSL_API void Md2Final(Md2*, byte*);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* CTAO_CRYPT_MD2_H */
|
||||
#endif /* CYASSL_MD2 */
|
|
@ -49,6 +49,19 @@ CYASSL_LOCAL
|
|||
void XorWords(word*, const word*, word32);
|
||||
CYASSL_LOCAL
|
||||
void xorbuf(byte*, const byte*, word32);
|
||||
|
||||
#ifdef WORD64_AVAILABLE
|
||||
CYASSL_LOCAL
|
||||
word64 rotlFixed64(word64, word64);
|
||||
CYASSL_LOCAL
|
||||
word64 rotrFixed64(word64, word64);
|
||||
|
||||
CYASSL_LOCAL
|
||||
word64 ByteReverseWord64(word64);
|
||||
CYASSL_LOCAL
|
||||
void ByteReverseWords64(word64*, const word64*, word32);
|
||||
#endif /* WORD64_AVAILABLE */
|
||||
|
||||
#endif /* NO_INLINE */
|
||||
|
||||
|
||||
|
|
|
@ -85,17 +85,22 @@
|
|||
#define NO_HC128
|
||||
#endif /* MBED */
|
||||
|
||||
#ifdef FREERTOS
|
||||
#ifdef FREERTOS_WINSIM
|
||||
#define FREERTOS
|
||||
#define USE_WINDOWS_API
|
||||
#endif
|
||||
|
||||
#ifdef FREERTOS
|
||||
#define NO_WRITEV
|
||||
#define NO_SHA512
|
||||
#define NO_DH
|
||||
#define NO_DSA
|
||||
#define NO_HC128
|
||||
#endif
|
||||
|
||||
#ifdef FREERTOS_WINSIM
|
||||
#define FREERTOS
|
||||
#define USE_WINDOWS_API
|
||||
#ifndef SINGLE_THREADED
|
||||
#include "FreeRTOS.h"
|
||||
#include "semphr.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_GAME_BUILD
|
||||
|
|
|
@ -157,6 +157,8 @@ enum {
|
|||
|
||||
#ifndef STRING_USER
|
||||
#include <string.h>
|
||||
char* mystrnstr(const char* s1, const char* s2, unsigned int n);
|
||||
|
||||
#define XMEMCPY(d,s,l) memcpy((d),(s),(l))
|
||||
#define XMEMSET(b,c,l) memset((b),(c),(l))
|
||||
#define XMEMCMP(s1,s2,n) memcmp((s1),(s2),(n))
|
||||
|
@ -167,6 +169,7 @@ enum {
|
|||
/* strstr, strncmp, and strncat only used by CyaSSL proper, not required for
|
||||
CTaoCrypt only */
|
||||
#define XSTRSTR(s1,s2) strstr((s1),(s2))
|
||||
#define XSTRNSTR(s1,s2,n) mystrnstr((s1),(s2),(n))
|
||||
#define XSTRNCMP(s1,s2,n) strncmp((s1),(s2),(n))
|
||||
#define XSTRNCAT(s1,s2,n) strncat((s1),(s2),(n))
|
||||
#endif
|
||||
|
@ -205,7 +208,11 @@ enum {
|
|||
DYNAMIC_TYPE_CRL = 22,
|
||||
DYNAMIC_TYPE_REVOKED = 23,
|
||||
DYNAMIC_TYPE_CRL_ENTRY = 24,
|
||||
DYNAMIC_TYPE_CERT_MANAGER = 25
|
||||
DYNAMIC_TYPE_CERT_MANAGER = 25,
|
||||
DYNAMIC_TYPE_CRL_MONITOR = 26,
|
||||
DYNAMIC_TYPE_OCSP_STATUS = 27,
|
||||
DYNAMIC_TYPE_OCSP_ENTRY = 28,
|
||||
DYNAMIC_TYPE_ALTNAME = 29
|
||||
};
|
||||
|
||||
/* stack protection */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue