ssl_misc.h
Go to the documentation of this file.
1 /**
2  * @file ssl_misc.h
3  * @brief SSL 3.0 helper functions
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2019 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneSSL Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 1.9.6
29  **/
30 
31 #ifndef _SSL_MISC_H
32 #define _SSL_MISC_H
33 
34 //Dependencies
35 #include "core/crypto.h"
36 #include "tls.h"
37 
38 //C++ guard
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 //SSL 3.0 related constants
44 extern const uint8_t sslPad1[48];
45 extern const uint8_t sslPad2[48];
46 
47 //SSL 3.0 related functions
48 error_t sslExpandKey(const uint8_t *secret, size_t secretLen,
49  const uint8_t *random, size_t randomLen, uint8_t *output, size_t outputLen);
50 
51 error_t sslComputeMac(TlsEncryptionEngine *encryptionEngine,
52  const TlsRecord *record, const uint8_t *data, size_t dataLen, uint8_t *mac);
53 
54 uint32_t sslVerifyPadding(TlsEncryptionEngine *decryptionEngine,
55  const uint8_t *data, size_t dataLen, size_t *paddingLen);
56 
57 uint32_t sslVerifyMac(TlsEncryptionEngine *decryptionEngine,
58  const TlsRecord *record, const uint8_t *data, size_t dataLen,
59  size_t maxDataLen, const uint8_t *mac);
60 
61 //C++ guard
62 #ifdef __cplusplus
63 }
64 #endif
65 
66 #endif
uint32_t sslVerifyMac(TlsEncryptionEngine *decryptionEngine, const TlsRecord *record, const uint8_t *data, size_t dataLen, size_t maxDataLen, const uint8_t *mac)
error_t sslComputeMac(TlsEncryptionEngine *encryptionEngine, const TlsRecord *record, const uint8_t *data, size_t dataLen, uint8_t *mac)
error_t sslExpandKey(const uint8_t *secret, size_t secretLen, const uint8_t *random, size_t randomLen, uint8_t *output, size_t outputLen)
error_t
Error codes.
Definition: error.h:42
General definitions for cryptographic algorithms.
uint32_t sslVerifyPadding(TlsEncryptionEngine *decryptionEngine, const uint8_t *data, size_t dataLen, size_t *paddingLen)
const uint8_t sslPad1[48]
Encryption engine.
Definition: tls.h:1942
const uint8_t sslPad2[48]
__start_packed struct @83 TlsRecord
TLS record.
TLS (Transport Layer Security)
uint8_t random[32]
Definition: tls.h:1614
uint8_t data[]
Definition: dtls_misc.h:176