mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-27 18:59:26 +08:00
添加Openssl,Gmssl加密库
This commit is contained in:
35
thirdparty/GmSSL-3.1.1/include/gmssl/gf128.h
vendored
35
thirdparty/GmSSL-3.1.1/include/gmssl/gf128.h
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2022 The GmSSL Project. All Rights Reserved.
|
||||
* Copyright 2014-2024 The GmSSL Project. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
@@ -7,11 +7,7 @@
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
|
||||
/* GF(2^128) defined by f(x) = x^128 + x^7 + x^2 + x + 1
|
||||
* A + B mod f(x) = a xor b
|
||||
* A * 2 mod f(x)
|
||||
*/
|
||||
// GF(2^128) defined by f(x) = x^128 + x^7 + x^2 + x + 1
|
||||
|
||||
#ifndef GMSSL_GF128_H
|
||||
#define GMSSL_GF128_H
|
||||
@@ -27,24 +23,19 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//typedef unsigned __int128 gf128_t;
|
||||
|
||||
typedef struct {
|
||||
uint64_t hi;
|
||||
uint64_t lo;
|
||||
} gf128_t;
|
||||
typedef uint64_t gf128_t[2];
|
||||
|
||||
|
||||
// Note: send by value is comptabile with uint128_t and sse2
|
||||
gf128_t gf128_from_hex(const char *s);
|
||||
int gf128_equ_hex(gf128_t a, const char *s);
|
||||
gf128_t gf128_zero(void);
|
||||
gf128_t gf128_add(gf128_t a, gf128_t b);
|
||||
gf128_t gf128_mul(gf128_t a, gf128_t b);
|
||||
gf128_t gf128_mul2(gf128_t a);
|
||||
gf128_t gf128_from_bytes(const uint8_t p[16]);
|
||||
void gf128_to_bytes(gf128_t a, uint8_t p[16]);
|
||||
int gf128_print(FILE *fp, int fmt ,int ind, const char *label, gf128_t a);
|
||||
void gf128_set_zero(gf128_t r);
|
||||
void gf128_set_one(gf128_t r);
|
||||
void gf128_add(gf128_t r, const gf128_t a, const gf128_t b);
|
||||
void gf128_mul(gf128_t r, const gf128_t a, const gf128_t b);
|
||||
void gf128_mul_by_2(gf128_t r, const gf128_t a);
|
||||
void gf128_from_bytes(gf128_t r, const uint8_t p[16]);
|
||||
void gf128_to_bytes(const gf128_t a, uint8_t p[16]);
|
||||
int gf128_from_hex(gf128_t r, const char *s);
|
||||
int gf128_equ_hex(const gf128_t a, const char *s);
|
||||
int gf128_print(FILE *fp, int fmt, int ind, const char *label, const gf128_t a);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
Reference in New Issue
Block a user