Return to curve25519_drv.h CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / strongswan / src / libstrongswan / plugins / curve25519 |
1.1 misho 1: /* 2: * Copyright (C) 2015 Martin Willi 3: * Copyright (C) 2015 revosec AG 4: * 5: * This program is free software; you can redistribute it and/or modify it 6: * under the terms of the GNU General Public License as published by the 7: * Free Software Foundation; either version 2 of the License, or (at your 8: * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. 9: * 10: * This program is distributed in the hope that it will be useful, but 11: * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13: * for more details. 14: */ 15: 16: /** 17: * @defgroup curve25519_drv curve25519_drv 18: * @{ @ingroup curve25519_p 19: */ 20: 21: #ifndef CURVE25519_DRV_H_ 22: #define CURVE25519_DRV_H_ 23: 24: typedef struct curve25519_drv_t curve25519_drv_t; 25: 26: #include <library.h> 27: 28: /** 29: * Private key size of Curve25519 30: */ 31: #define CURVE25519_KEY_SIZE 32 32: 33: /** 34: * Backend driver abstraction for Curve25519. 35: */ 36: struct curve25519_drv_t { 37: 38: /** 39: * Set the private key. 40: * 41: * @param key 32 byte private key, clamped 42: * @return TRUE if key set 43: */ 44: bool (*set_key)(curve25519_drv_t *this, u_char *key); 45: 46: /** 47: * Calculate Curve25519 for the set key. 48: * 49: * @param in input data, 32 bytes 50: * @param out output data, 32 bytes 51: * @return TRUE if calculated 52: */ 53: bool (*curve25519)(curve25519_drv_t *this, u_char *in, u_char *out); 54: 55: /** 56: * Destroy a curve25519_drv_t. 57: */ 58: void (*destroy)(curve25519_drv_t *this); 59: }; 60: 61: /** 62: * Create a curve25519_drv instance. 63: */ 64: curve25519_drv_t *curve25519_drv_probe(); 65: 66: #endif /** CURVE25519_DRV_H_ @}*/