Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
kal_crypto.h File Reference
========================================================================={{{ Copyright (c) 20XX / All rights reserved / / IMPORTANT: This Software may not be modified, copied or distributed unless / embedded on a WizziLab product. More...
Go to the source code of this file.
Functions | |
| _public void | kal_sha256_init (void) |
| Initialize an SHA Hash generation. | |
| _public void | kal_sha256_update (u8 data[], uint len) |
| Used to 'push' new data into the hash calculation. | |
| _public void | kal_sha256_final (u8 hash[]) |
| To be called when all data has been pushed into the hash generator. | |
| _public void | kal_aes128_init (u8 *key) |
| Perform Key expansion. | |
| _public void | kal_aes128_ecb (u8 *p, u16 len) |
| Encrypt / decrypt in ECB mode (non chaining). | |
| _public void | kal_aes128_ctr (u8 *p, u16 len, u8 *iv, u8 be) |
| Encrypt / decrypt in CTR mode (non chaining). | |
| _public void | kal_aes128_cbc_mac (u8 *mac, u8 *p, u16 len) |
| Generate MAC with block-chaining. | |
| _public void | kal_aes128_cmac_next (u8 *mac, u8 *p, u16 len) |
| Execute CMAC algorithm on a entire number of 16-byte blocks, not including the last block. | |
| _public void | kal_aes128_cmac_last (u8 *mac, u8 *p, u16 len) |
| Execute CMAC algorithm on any size and finalize. | |
| _public void | kal_siphash24 (u8 *out, u8 *v, u8 len, const u8 *key) |
| Generate MAC of an input vector using SIPHASH-2-4. | |
Detailed Description
========================================================================={{{ Copyright (c) 20XX / All rights reserved / / IMPORTANT: This Software may not be modified, copied or distributed unless / embedded on a WizziLab product.
Other than for the foregoing purpose, this / Software and/or its documentation may not be used, reproduced, copied, / prepared derivative works of, modified, performed, distributed, displayed / or sold for any purpose. For the sole purpose of embedding this Software / on a WizziLab product, copy, modification and distribution of this / Software is granted provided that the following conditions are respected: / / Redistributions of source code must retain the above copyright notice, / this list of conditions and the following disclaimer / / Redistributions in binary form must reproduce the above copyright / notice, this list of conditions and the following disclaimer in the / documentation and/or other materials provided with the distribution. / / The name of WizziLab can not be used to endorse or promote products / derived from this software without specific prior written permission. / / THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS / "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED / TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR / PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR / CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, / EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, / PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, / OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY / OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING / NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS / SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. / WIZZILAB HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, / ENHANCEMENTS OR MODIFICATIONS. / / Should you have any questions regarding your right to use this Software, / contact WizziLab at www.wizzilab.com. / / =========================================================================}}} KAL Crypto utilities
Definition in file kal_crypto.h.
Function Documentation
| _public void kal_aes128_cbc_mac | ( | u8 * | mac, |
| u8 * | p, | ||
| u16 | len | ||
| ) |
Generate MAC with block-chaining.
- Parameters:
-
mac u8* MAC 16-bytes inout p u8* payload len u16 payload length
- Return values:
-
void
| _public void kal_aes128_cmac_last | ( | u8 * | mac, |
| u8 * | p, | ||
| u16 | len | ||
| ) |
Execute CMAC algorithm on any size and finalize.
- Parameters:
-
mac u8* MAC 16-bytes inout p u8* payload len u16 payload length
- Return values:
-
void
| _public void kal_aes128_cmac_next | ( | u8 * | mac, |
| u8 * | p, | ||
| u16 | len | ||
| ) |
Execute CMAC algorithm on a entire number of 16-byte blocks, not including the last block.
- Parameters:
-
mac u8* MAC 16-bytes inout p u8* payload len u16 payload length
- Return values:
-
void
| _public void kal_aes128_ctr | ( | u8 * | p, |
| u16 | len, | ||
| u8 * | iv, | ||
| u8 | be | ||
| ) |
Encrypt / decrypt in CTR mode (non chaining).
Note : only 1 byte counter is supported.
- Parameters:
-
p u8* payload inout p(i) = cipher(iv+i, key) ^ p(i) len u16 payload length iv u8* counter IV (returns next value) be u8 counter endianness (byte15 is lsb when TRUE, otherwise byte0)
- Return values:
-
void
| _public void kal_aes128_ecb | ( | u8 * | p, |
| u16 | len | ||
| ) |
Encrypt / decrypt in ECB mode (non chaining).
- Parameters:
-
p u8* payload inout p(i) = cipher(p(i), key) len u16 payload length
- Return values:
-
void
| _public void kal_aes128_init | ( | u8 * | key ) |
Perform Key expansion.
- Parameters:
-
key const u8* encryption key
- Return values:
-
void
| _public void kal_sha256_final | ( | u8 | hash[] ) |
To be called when all data has been pushed into the hash generator.
Finalize and outputs resulting SHA hash.
- Parameters:
-
hash Pointer to the Output (char) buffer. Fills 32-bytes.
Definition at line 208 of file kal_crypto.cpp.
| _public void kal_sha256_init | ( | void | ) |
Initialize an SHA Hash generation.
To be called before any other kal_sha256_update/final functions.
Definition at line 114 of file kal_crypto.cpp.
| _public void kal_sha256_update | ( | u8 | data[], |
| uint | len | ||
| ) |
Used to 'push' new data into the hash calculation.
- Parameters:
-
data pointer to the (char) data stream to hash. len data stream length in bytes
Definition at line 186 of file kal_crypto.cpp.
| _public void kal_siphash24 | ( | u8 * | out, |
| u8 * | v, | ||
| u8 | len, | ||
| const u8 * | key | ||
| ) |
Generate MAC of an input vector using SIPHASH-2-4.
- Parameters:
-
out u8* 64-bit result in u8* input buffer len u8 input buffer length in bytes key const u8* cipher key
- Return values:
-
void
Generated on Tue Jul 12 2022 13:52:24 by
1.7.2