1-Wire® library for mbed. Complete 1-Wire library that supports our silicon masters along with a bit-bang master on the MAX32600MBED platform with one common interface for mbed. Slave support has also been included and more slaves will be added as time permits.
Dependents: MAXREFDES131_Qt_Demo MAX32630FTHR_iButton_uSD_Logger MAX32630FTHR_DS18B20_uSD_Logger MAXREFDES130_131_Demo ... more
ISha256MacCoproc.h
00001 /******************************************************************//** 00002 * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved. 00003 * 00004 * Permission is hereby granted, free of charge, to any person obtaining a 00005 * copy of this software and associated documentation files (the "Software"), 00006 * to deal in the Software without restriction, including without limitation 00007 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 00008 * and/or sell copies of the Software, and to permit persons to whom the 00009 * Software is furnished to do so, subject to the following conditions: 00010 * 00011 * The above copyright notice and this permission notice shall be included 00012 * in all copies or substantial portions of the Software. 00013 * 00014 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00015 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00016 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00017 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES 00018 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 00019 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00020 * OTHER DEALINGS IN THE SOFTWARE. 00021 * 00022 * Except as contained in this notice, the name of Maxim Integrated 00023 * Products, Inc. shall not be used except as stated in the Maxim Integrated 00024 * Products, Inc. Branding Policy. 00025 * 00026 * The mere transfer of this software does not imply any licenses 00027 * of trade secrets, proprietary technology, copyrights, patents, 00028 * trademarks, maskwork rights, or any other form of intellectual 00029 * property whatsoever. Maxim Integrated Products, Inc. retains all 00030 * ownership rights. 00031 **********************************************************************/ 00032 00033 #ifndef OneWire_Authenticators_ISha256MacCoproc 00034 #define OneWire_Authenticators_ISha256MacCoproc 00035 00036 #include <stddef.h> 00037 #include <stdint.h> 00038 #include "Utilities/array.h" 00039 00040 namespace OneWire 00041 { 00042 /// Interface for SHA-256 coprocessors compatible with the DS28E15/22/25 family and similar. 00043 class ISha256MacCoproc 00044 { 00045 public: 00046 enum CmdResult 00047 { 00048 Success, 00049 OperationFailure 00050 }; 00051 00052 /// Holds the contents of a device memory page. 00053 typedef array<uint8_t, 32> DevicePage; 00054 00055 /// Holds the contents of a device scratchpad. 00056 typedef array<uint8_t, 32> DeviceScratchpad; 00057 00058 /// Holds the contents of a device secret. 00059 typedef array<uint8_t, 32> Secret; 00060 00061 /// Container for a SHA-256 MAC. 00062 typedef array<uint8_t, 32> Mac; 00063 00064 /// Additional data fields for Compute Write MAC operation. 00065 typedef array<uint8_t, 20> WriteMacData; 00066 00067 /// Additional data fields for the Compute Auth. MAC operation. 00068 typedef array<uint8_t, 12> AuthMacData; 00069 00070 /// Additional data field for the Compute Slave Secret operation. 00071 typedef array<uint8_t, 12> SlaveSecretData; 00072 00073 /// Set Master Secret in coprocessor. 00074 /// @param[in] masterSecret New master secret to set. 00075 virtual CmdResult setMasterSecret(const Secret & masterSecret) = 0; 00076 00077 /// Compute Slave Secret in the coprocessor. 00078 /// @note Uses the previously set Master Secret in computation. 00079 /// @param[in] devicePage Page data stored on device. 00080 /// @param[in] deviceScratchpad Scratchpad data stored on device. 00081 /// @param[in] slaveSecretData Additional data fields as specified by device. 00082 virtual CmdResult computeSlaveSecret(const DevicePage & devicePage, const DeviceScratchpad & deviceScratchpad, const SlaveSecretData & slaveSecretData) = 0; 00083 00084 /// Compute Write MAC 00085 /// @note Uses the previously computed Slave Secret in computation. 00086 /// @param[in] writeMacData Additional data fields as specified by device. 00087 /// @param[out] mac The computed MAC. 00088 virtual CmdResult computeWriteMac(const WriteMacData & writeMacData, Mac & mac) const = 0; 00089 00090 /// Compute Authentication MAC 00091 /// @note Uses the previously computed Slave Secret in computation. 00092 /// @param[in] devicePage Page data stored on device. 00093 /// @param[in] challege Random challenge for device. 00094 /// @param[in] authMacData Additional data fields as specified by device. 00095 /// @param[out] mac The computed MAC. 00096 virtual CmdResult computeAuthMac(const DevicePage & devicePage, const DeviceScratchpad & challenge, const AuthMacData & authMacData, Mac & mac) const = 0; 00097 }; 00098 } 00099 00100 #endif
Generated on Tue Jul 12 2022 15:46:21 by 1.7.2