I added functionality to get the RSSI, BER, and Cell Neighbor for reporting connection issues to M2X

Dependencies:   WncControllerK64F

Committer:
JMF
Date:
Thu Nov 17 16:13:29 2016 +0000
Revision:
18:198e9b0acf11
Parent:
12:0071cb144c7a
Updates to mbed os resulted in mutex.h going away and rtos.h needed to be used; This fixes the Mutex typedef failure.  Also cast data buffers from 'char *' to (const std::uint8_t*) to conform with Fred's changes in WncController

Who changed what in which revision?

UserRevisionLine numberNew contents of line
JMF 12:0071cb144c7a 1 /**
JMF 12:0071cb144c7a 2 * \file sha512.h
JMF 12:0071cb144c7a 3 *
JMF 12:0071cb144c7a 4 * \brief SHA-384 and SHA-512 cryptographic hash function
JMF 12:0071cb144c7a 5 *
JMF 12:0071cb144c7a 6 * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
JMF 12:0071cb144c7a 7 * SPDX-License-Identifier: Apache-2.0
JMF 12:0071cb144c7a 8 *
JMF 12:0071cb144c7a 9 * Licensed under the Apache License, Version 2.0 (the "License"); you may
JMF 12:0071cb144c7a 10 * not use this file except in compliance with the License.
JMF 12:0071cb144c7a 11 * You may obtain a copy of the License at
JMF 12:0071cb144c7a 12 *
JMF 12:0071cb144c7a 13 * http://www.apache.org/licenses/LICENSE-2.0
JMF 12:0071cb144c7a 14 *
JMF 12:0071cb144c7a 15 * Unless required by applicable law or agreed to in writing, software
JMF 12:0071cb144c7a 16 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
JMF 12:0071cb144c7a 17 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
JMF 12:0071cb144c7a 18 * See the License for the specific language governing permissions and
JMF 12:0071cb144c7a 19 * limitations under the License.
JMF 12:0071cb144c7a 20 *
JMF 12:0071cb144c7a 21 * This file is part of mbed TLS (https://tls.mbed.org)
JMF 12:0071cb144c7a 22 */
JMF 12:0071cb144c7a 23 #ifndef MBEDTLS_SHA512_H
JMF 12:0071cb144c7a 24 #define MBEDTLS_SHA512_H
JMF 12:0071cb144c7a 25
JMF 12:0071cb144c7a 26 #if !defined(MBEDTLS_CONFIG_FILE)
JMF 12:0071cb144c7a 27 #include "config.h"
JMF 12:0071cb144c7a 28 #else
JMF 12:0071cb144c7a 29 #include MBEDTLS_CONFIG_FILE
JMF 12:0071cb144c7a 30 #endif
JMF 12:0071cb144c7a 31
JMF 12:0071cb144c7a 32 #include <stddef.h>
JMF 12:0071cb144c7a 33 #include <stdint.h>
JMF 12:0071cb144c7a 34
JMF 12:0071cb144c7a 35 #if !defined(MBEDTLS_SHA512_ALT)
JMF 12:0071cb144c7a 36 // Regular implementation
JMF 12:0071cb144c7a 37 //
JMF 12:0071cb144c7a 38
JMF 12:0071cb144c7a 39 #ifdef __cplusplus
JMF 12:0071cb144c7a 40 extern "C" {
JMF 12:0071cb144c7a 41 #endif
JMF 12:0071cb144c7a 42
JMF 12:0071cb144c7a 43 /**
JMF 12:0071cb144c7a 44 * \brief SHA-512 context structure
JMF 12:0071cb144c7a 45 */
JMF 12:0071cb144c7a 46 typedef struct
JMF 12:0071cb144c7a 47 {
JMF 12:0071cb144c7a 48 uint64_t total[2]; /*!< number of bytes processed */
JMF 12:0071cb144c7a 49 uint64_t state[8]; /*!< intermediate digest state */
JMF 12:0071cb144c7a 50 unsigned char buffer[128]; /*!< data block being processed */
JMF 12:0071cb144c7a 51 int is384; /*!< 0 => SHA-512, else SHA-384 */
JMF 12:0071cb144c7a 52 }
JMF 12:0071cb144c7a 53 mbedtls_sha512_context;
JMF 12:0071cb144c7a 54
JMF 12:0071cb144c7a 55 /**
JMF 12:0071cb144c7a 56 * \brief Initialize SHA-512 context
JMF 12:0071cb144c7a 57 *
JMF 12:0071cb144c7a 58 * \param ctx SHA-512 context to be initialized
JMF 12:0071cb144c7a 59 */
JMF 12:0071cb144c7a 60 void mbedtls_sha512_init( mbedtls_sha512_context *ctx );
JMF 12:0071cb144c7a 61
JMF 12:0071cb144c7a 62 /**
JMF 12:0071cb144c7a 63 * \brief Clear SHA-512 context
JMF 12:0071cb144c7a 64 *
JMF 12:0071cb144c7a 65 * \param ctx SHA-512 context to be cleared
JMF 12:0071cb144c7a 66 */
JMF 12:0071cb144c7a 67 void mbedtls_sha512_free( mbedtls_sha512_context *ctx );
JMF 12:0071cb144c7a 68
JMF 12:0071cb144c7a 69 /**
JMF 12:0071cb144c7a 70 * \brief Clone (the state of) a SHA-512 context
JMF 12:0071cb144c7a 71 *
JMF 12:0071cb144c7a 72 * \param dst The destination context
JMF 12:0071cb144c7a 73 * \param src The context to be cloned
JMF 12:0071cb144c7a 74 */
JMF 12:0071cb144c7a 75 void mbedtls_sha512_clone( mbedtls_sha512_context *dst,
JMF 12:0071cb144c7a 76 const mbedtls_sha512_context *src );
JMF 12:0071cb144c7a 77
JMF 12:0071cb144c7a 78 /**
JMF 12:0071cb144c7a 79 * \brief SHA-512 context setup
JMF 12:0071cb144c7a 80 *
JMF 12:0071cb144c7a 81 * \param ctx context to be initialized
JMF 12:0071cb144c7a 82 * \param is384 0 = use SHA512, 1 = use SHA384
JMF 12:0071cb144c7a 83 */
JMF 12:0071cb144c7a 84 void mbedtls_sha512_starts( mbedtls_sha512_context *ctx, int is384 );
JMF 12:0071cb144c7a 85
JMF 12:0071cb144c7a 86 /**
JMF 12:0071cb144c7a 87 * \brief SHA-512 process buffer
JMF 12:0071cb144c7a 88 *
JMF 12:0071cb144c7a 89 * \param ctx SHA-512 context
JMF 12:0071cb144c7a 90 * \param input buffer holding the data
JMF 12:0071cb144c7a 91 * \param ilen length of the input data
JMF 12:0071cb144c7a 92 */
JMF 12:0071cb144c7a 93 void mbedtls_sha512_update( mbedtls_sha512_context *ctx, const unsigned char *input,
JMF 12:0071cb144c7a 94 size_t ilen );
JMF 12:0071cb144c7a 95
JMF 12:0071cb144c7a 96 /**
JMF 12:0071cb144c7a 97 * \brief SHA-512 final digest
JMF 12:0071cb144c7a 98 *
JMF 12:0071cb144c7a 99 * \param ctx SHA-512 context
JMF 12:0071cb144c7a 100 * \param output SHA-384/512 checksum result
JMF 12:0071cb144c7a 101 */
JMF 12:0071cb144c7a 102 void mbedtls_sha512_finish( mbedtls_sha512_context *ctx, unsigned char output[64] );
JMF 12:0071cb144c7a 103
JMF 12:0071cb144c7a 104 #ifdef __cplusplus
JMF 12:0071cb144c7a 105 }
JMF 12:0071cb144c7a 106 #endif
JMF 12:0071cb144c7a 107
JMF 12:0071cb144c7a 108 #else /* MBEDTLS_SHA512_ALT */
JMF 12:0071cb144c7a 109 #include "sha512_alt.h"
JMF 12:0071cb144c7a 110 #endif /* MBEDTLS_SHA512_ALT */
JMF 12:0071cb144c7a 111
JMF 12:0071cb144c7a 112 #ifdef __cplusplus
JMF 12:0071cb144c7a 113 extern "C" {
JMF 12:0071cb144c7a 114 #endif
JMF 12:0071cb144c7a 115
JMF 12:0071cb144c7a 116 /**
JMF 12:0071cb144c7a 117 * \brief Output = SHA-512( input buffer )
JMF 12:0071cb144c7a 118 *
JMF 12:0071cb144c7a 119 * \param input buffer holding the data
JMF 12:0071cb144c7a 120 * \param ilen length of the input data
JMF 12:0071cb144c7a 121 * \param output SHA-384/512 checksum result
JMF 12:0071cb144c7a 122 * \param is384 0 = use SHA512, 1 = use SHA384
JMF 12:0071cb144c7a 123 */
JMF 12:0071cb144c7a 124 void mbedtls_sha512( const unsigned char *input, size_t ilen,
JMF 12:0071cb144c7a 125 unsigned char output[64], int is384 );
JMF 12:0071cb144c7a 126
JMF 12:0071cb144c7a 127 /**
JMF 12:0071cb144c7a 128 * \brief Checkup routine
JMF 12:0071cb144c7a 129 *
JMF 12:0071cb144c7a 130 * \return 0 if successful, or 1 if the test failed
JMF 12:0071cb144c7a 131 */
JMF 12:0071cb144c7a 132 int mbedtls_sha512_self_test( int verbose );
JMF 12:0071cb144c7a 133
JMF 12:0071cb144c7a 134 /* Internal use */
JMF 12:0071cb144c7a 135 void mbedtls_sha512_process( mbedtls_sha512_context *ctx, const unsigned char data[128] );
JMF 12:0071cb144c7a 136
JMF 12:0071cb144c7a 137 #ifdef __cplusplus
JMF 12:0071cb144c7a 138 }
JMF 12:0071cb144c7a 139 #endif
JMF 12:0071cb144c7a 140
JMF 12:0071cb144c7a 141 #endif /* mbedtls_sha512.h */