1160814Ssimon/* crypto/ecdh/ech_locl.h */ 2160814Ssimon/* ==================================================================== 3160814Ssimon * Copyright (c) 2000-2005 The OpenSSL Project. All rights reserved. 4160814Ssimon * 5160814Ssimon * Redistribution and use in source and binary forms, with or without 6160814Ssimon * modification, are permitted provided that the following conditions 7160814Ssimon * are met: 8160814Ssimon * 9160814Ssimon * 1. Redistributions of source code must retain the above copyright 10280304Sjkim * notice, this list of conditions and the following disclaimer. 11160814Ssimon * 12160814Ssimon * 2. Redistributions in binary form must reproduce the above copyright 13160814Ssimon * notice, this list of conditions and the following disclaimer in 14160814Ssimon * the documentation and/or other materials provided with the 15160814Ssimon * distribution. 16160814Ssimon * 17160814Ssimon * 3. All advertising materials mentioning features or use of this 18160814Ssimon * software must display the following acknowledgment: 19160814Ssimon * "This product includes software developed by the OpenSSL Project 20160814Ssimon * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 21160814Ssimon * 22160814Ssimon * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 23160814Ssimon * endorse or promote products derived from this software without 24160814Ssimon * prior written permission. For written permission, please contact 25160814Ssimon * licensing@OpenSSL.org. 26160814Ssimon * 27160814Ssimon * 5. Products derived from this software may not be called "OpenSSL" 28160814Ssimon * nor may "OpenSSL" appear in their names without prior written 29160814Ssimon * permission of the OpenSSL Project. 30160814Ssimon * 31160814Ssimon * 6. Redistributions of any form whatsoever must retain the following 32160814Ssimon * acknowledgment: 33160814Ssimon * "This product includes software developed by the OpenSSL Project 34160814Ssimon * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 35160814Ssimon * 36160814Ssimon * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 37160814Ssimon * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 38160814Ssimon * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 39160814Ssimon * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 40160814Ssimon * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 41160814Ssimon * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 42160814Ssimon * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 43160814Ssimon * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 44160814Ssimon * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 45160814Ssimon * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 46160814Ssimon * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 47160814Ssimon * OF THE POSSIBILITY OF SUCH DAMAGE. 48160814Ssimon * ==================================================================== 49160814Ssimon * 50160814Ssimon * This product includes cryptographic software written by Eric Young 51160814Ssimon * (eay@cryptsoft.com). This product includes software written by Tim 52160814Ssimon * Hudson (tjh@cryptsoft.com). 53160814Ssimon * 54160814Ssimon */ 55160814Ssimon 56160814Ssimon#ifndef HEADER_ECH_LOCL_H 57280304Sjkim# define HEADER_ECH_LOCL_H 58160814Ssimon 59280304Sjkim# include <openssl/ecdh.h> 60160814Ssimon 61160814Ssimon#ifdef __cplusplus 62160814Ssimonextern "C" { 63160814Ssimon#endif 64160814Ssimon 65280304Sjkimstruct ecdh_method { 66280304Sjkim const char *name; 67280304Sjkim int (*compute_key) (void *key, size_t outlen, const EC_POINT *pub_key, 68280304Sjkim EC_KEY *ecdh, void *(*KDF) (const void *in, 69280304Sjkim size_t inlen, void *out, 70280304Sjkim size_t *outlen)); 71280304Sjkim# if 0 72280304Sjkim int (*init) (EC_KEY *eckey); 73280304Sjkim int (*finish) (EC_KEY *eckey); 74280304Sjkim# endif 75280304Sjkim int flags; 76280304Sjkim char *app_data; 77280304Sjkim}; 78160814Ssimon 79280304Sjkim/* 80280304Sjkim * If this flag is set the ECDH method is FIPS compliant and can be used in 81280304Sjkim * FIPS mode. This is set in the validated module method. If an application 82280304Sjkim * sets this flag in its own methods it is its responsibility to ensure the 83280304Sjkim * result is compliant. 84238405Sjkim */ 85238405Sjkim 86280304Sjkim# define ECDH_FLAG_FIPS_METHOD 0x1 87238405Sjkim 88160814Ssimontypedef struct ecdh_data_st { 89280304Sjkim /* EC_KEY_METH_DATA part */ 90280304Sjkim int (*init) (EC_KEY *); 91280304Sjkim /* method specific part */ 92280304Sjkim ENGINE *engine; 93280304Sjkim int flags; 94280304Sjkim const ECDH_METHOD *meth; 95280304Sjkim CRYPTO_EX_DATA ex_data; 96160814Ssimon} ECDH_DATA; 97160814Ssimon 98160814SsimonECDH_DATA *ecdh_check(EC_KEY *); 99160814Ssimon 100160814Ssimon#ifdef __cplusplus 101160814Ssimon} 102160814Ssimon#endif 103160814Ssimon 104280304Sjkim#endif /* HEADER_ECH_LOCL_H */ 105