⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rc5.h

📁 MANTIS是由科罗拉多大学开发的传感器网络嵌入式操作系统。 这是mantis的0.9.5版本的源码。
💻 H
字号:
//  This file is part of MANTIS OS, Operating System//  See http://mantis.cs.colorado.edu/////  Copyright (C) 2003,2004,2005 University of Colorado, Boulder////  This program is free software; you can redistribute it and/or//  modify it under the terms of the mos license (see file LICENSE)#include <inttypes.h>#define RC5_ROUNDS      12#define RC5_KEYSPACES   ((2 * RC5_ROUNDS) + 2)/** @brief Data structure to save key information. */typedef struct _rc5key_info {  /** @brief Number of times the bits are shifted */  int      rounds;  /** @brief Expanded key */  uint32_t vector[RC5_KEYSPACES];} rc5key_info;/** @brief Key Setup. Expends key. * @param key Initial key (16 bytes) * @param dummy   Size of the key (always use 16) * @param key_info The memory to save expended key  */void rc5_key_setup(uint8_t *key, int dummy, rc5key_info *key_info);/** @brief Standard RC5 block encryption. * * Encrypting 64-bit of data with expended key * @param in input plaintext. Pointer to 2 32-bit words * @param out output ciphertext. Pointer to 2 32-bit words * @param key_info expended key. Pointer to rc5key_info */void rc5_encrypt(uint32_t *in, uint32_t *out, rc5key_info *key_info);/** @brief Standard RC5 block decryption. *   * Decrypting 64-bit of data with expended key * @param in input ciphertext. Pointer to 2 32-bit words * @param out output decrypted text. Pointer to 2 32-bit words * @param key_info expended key. Pointer to rc5key_info */void rc5_decrypt(const uint32_t *in, uint32_t *out, rc5key_info *key_info);/** @brief CBC-mode block encryption using rc5_encrypt. * @param plt input plaintext. Pointer to a >= 8 bytes string * @param enc output ciphertext, Pointer to a >= 8 bytes string * @param size the size of input/output data, counted by bytes * @param iv initial vector. Pointer to an 8-bytes string * @param key_info expended key. Pointer to rc5key_info */void block_encrypt(const uint8_t *plt, uint8_t *enc, int size,                   uint8_t *iv, rc5key_info *key_info);/** @brief CBC-mode block decryption using rc5_encrypt. * @param enc input encrypted text. Pointer to a >= 8 bytes string * @param dec output decrypted text, Pointer to a >= 8 bytes string * @param size the size of input/output data, counted by bytes * @param iv initial vector. Pointer to an 8-bytes string * @param key_info expended key. Pointer to rc5key_info */void block_decrypt(const uint8_t *enc, uint8_t *dec, int size,		   uint8_t *iv, rc5key_info *key_info);/** @brief CBC-mode message authentication code generation. * @param plt input text. Pointer to a >= 8 bytes string * @param size the size of input data, counted by bytes * @param mac output MAC, Pointer to a 3-bytes string * @param mac_size size of MAC, should be <= 8, otherwise, mac won't contain MAC * @param iv initial vector. Pointer to an 8-bytes string * @param key_info expended key. Pointer to rc5key_info */void block_mac(const uint8_t *plt, int size, uint8_t *mac, int mac_size,                      uint8_t *iv, rc5key_info *key_info);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -