Webserver+3d print
Embed:
(wiki syntax)
Show/hide line numbers
cipher_mode_gcm.h
Go to the documentation of this file.
00001 /** 00002 * @file cipher_mode_gcm.h 00003 * @brief Galois/Counter Mode (GCM) 00004 * 00005 * @section License 00006 * 00007 * Copyright (C) 2010-2017 Oryx Embedded SARL. All rights reserved. 00008 * 00009 * This file is part of CycloneCrypto Open. 00010 * 00011 * This program is free software; you can redistribute it and/or 00012 * modify it under the terms of the GNU General Public License 00013 * as published by the Free Software Foundation; either version 2 00014 * of the License, or (at your option) any later version. 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU General Public License 00022 * along with this program; if not, write to the Free Software Foundation, 00023 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00024 * 00025 * @author Oryx Embedded SARL (www.oryx-embedded.com) 00026 * @version 1.7.6 00027 **/ 00028 00029 #ifndef _CIPHER_MODE_GCM_H 00030 #define _CIPHER_MODE_GCM_H 00031 00032 //Dependencies 00033 #include "crypto.h" 00034 00035 00036 /** 00037 * @brief GCM context 00038 **/ 00039 00040 typedef struct 00041 { 00042 const CipherAlgo *cipherAlgo; ///<Cipher algorithm 00043 void *cipherContext; ///<Cipher algorithm context 00044 uint32_t m[16][4]; ///<Precalculated table 00045 } GcmContext; 00046 00047 00048 //GCM related functions 00049 error_t gcmInit(GcmContext *context, const CipherAlgo *cipherAlgo, void *cipherContext); 00050 00051 error_t gcmEncrypt(GcmContext *context, const uint8_t *iv, size_t ivLen, const uint8_t *a, 00052 size_t aLen, const uint8_t *p, uint8_t *c, size_t length, uint8_t *t, size_t tLen); 00053 00054 error_t gcmDecrypt(GcmContext *context, const uint8_t *iv, size_t ivLen, const uint8_t *a, 00055 size_t aLen, const uint8_t *c, uint8_t *p, size_t length, const uint8_t *t, size_t tLen); 00056 00057 void gcmMul(GcmContext *context, uint8_t *x); 00058 void gcmXorBlock(uint8_t *x, const uint8_t *a, const uint8_t *b, size_t n); 00059 void gcmIncCounter(uint8_t *x); 00060 00061 #endif 00062
Generated on Tue Jul 12 2022 17:10:12 by
