add gmssl command

This commit is contained in:
Zhi Guan
2022-04-16 22:18:45 +08:00
parent 7e4dd76839
commit 22639fce28
33 changed files with 786 additions and 216 deletions

View File

@@ -55,6 +55,9 @@
#define GMSSL_GF128_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
@@ -62,28 +65,24 @@
extern "C" {
#endif
#define GMSSL_HAVE_UINT128
#ifdef GMSSL_HAVE_UINT128
typedef unsigned __int128 gf128_t;
#else
//typedef unsigned __int128 gf128_t;
typedef struct {
uint64_t hi;
uint64_t lo;
} gf128_t;
#endif
// 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]);
void gf128_print(const char *s, gf128_t a);
int gf128_print(FILE *fp, int fmt ,int ind, const char *label, gf128_t a);
#ifdef __cplusplus