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.
ge_operations.h
00001 /* ge_operations.h 00002 * 00003 * Copyright (C) 2006-2017 wolfSSL Inc. 00004 * 00005 * This file is part of wolfSSL. 00006 * 00007 * wolfSSL is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * wolfSSL is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA 00020 */ 00021 00022 00023 /* Based On Daniel J Bernstein's ed25519 Public Domain ref10 work. */ 00024 00025 #ifndef WOLF_CRYPT_GE_OPERATIONS_H 00026 #define WOLF_CRYPT_GE_OPERATIONS_H 00027 00028 #include <wolfcrypt/settings.h> 00029 00030 #ifdef HAVE_ED25519 00031 00032 #include <wolfcrypt/fe_operations.h> 00033 00034 /* 00035 ge means group element. 00036 00037 Here the group is the set of pairs (x,y) of field elements (see fe.h) 00038 satisfying -x^2 + y^2 = 1 + d x^2y^2 00039 where d = -121665/121666. 00040 00041 Representations: 00042 ge_p2 (projective): (X:Y:Z) satisfying x=X/Z, y=Y/Z 00043 ge_p3 (extended): (X:Y:Z:T) satisfying x=X/Z, y=Y/Z, XY=ZT 00044 ge_p1p1 (completed): ((X:Z),(Y:T)) satisfying x=X/Z, y=Y/T 00045 ge_precomp (Duif): (y+x,y-x,2dxy) 00046 */ 00047 00048 #ifdef ED25519_SMALL 00049 typedef byte ge[F25519_SIZE]; 00050 #elif defined(CURVED25519_X64) 00051 typedef int64_t ge[4]; 00052 #elif defined(CURVED25519_128BIT) 00053 typedef int64_t ge[5]; 00054 #else 00055 typedef int32_t ge[10]; 00056 #endif 00057 00058 typedef struct { 00059 ge X; 00060 ge Y; 00061 ge Z; 00062 } ge_p2; 00063 00064 typedef struct { 00065 ge X; 00066 ge Y; 00067 ge Z; 00068 ge T; 00069 } ge_p3; 00070 00071 00072 WOLFSSL_LOCAL int ge_compress_key(byte* out, const byte* xIn, const byte* yIn, 00073 word32 keySz); 00074 WOLFSSL_LOCAL int ge_frombytes_negate_vartime(ge_p3 *,const unsigned char *); 00075 00076 WOLFSSL_LOCAL int ge_double_scalarmult_vartime(ge_p2 *,const unsigned char *, 00077 const ge_p3 *,const unsigned char *); 00078 WOLFSSL_LOCAL void ge_scalarmult_base(ge_p3 *,const unsigned char *); 00079 WOLFSSL_LOCAL void sc_reduce(byte* s); 00080 WOLFSSL_LOCAL void sc_muladd(byte* s, const byte* a, const byte* b, 00081 const byte* c); 00082 WOLFSSL_LOCAL void ge_tobytes(unsigned char *,const ge_p2 *); 00083 WOLFSSL_LOCAL void ge_p3_tobytes(unsigned char *,const ge_p3 *); 00084 00085 00086 #ifndef ED25519_SMALL 00087 typedef struct { 00088 ge X; 00089 ge Y; 00090 ge Z; 00091 ge T; 00092 } ge_p1p1; 00093 00094 typedef struct { 00095 ge yplusx; 00096 ge yminusx; 00097 ge xy2d; 00098 } ge_precomp; 00099 00100 typedef struct { 00101 ge YplusX; 00102 ge YminusX; 00103 ge Z; 00104 ge T2d; 00105 } ge_cached; 00106 00107 #endif /* !ED25519_SMALL */ 00108 00109 #endif /* HAVE_ED25519 */ 00110 00111 #endif /* WOLF_CRYPT_GE_OPERATIONS_H */ 00112
Generated on Tue Jul 12 2022 16:58:06 by
1.7.2