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:
BIN
thirdparty/GmSSL-3.1.1/bin/gmssl.dll
vendored
BIN
thirdparty/GmSSL-3.1.1/bin/gmssl.dll
vendored
Binary file not shown.
BIN
thirdparty/GmSSL-3.1.1/bin/gmssl.exe
vendored
BIN
thirdparty/GmSSL-3.1.1/bin/gmssl.exe
vendored
Binary file not shown.
108
thirdparty/GmSSL-3.1.1/include/gmssl/aead.h
vendored
108
thirdparty/GmSSL-3.1.1/include/gmssl/aead.h
vendored
@@ -1,108 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014-2023 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.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
#ifndef GMSSL_AEAD_H
|
||||
#define GMSSL_AEAD_H
|
||||
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <gmssl/sm3.h>
|
||||
#include <gmssl/sm4.h>
|
||||
#include <gmssl/gcm.h>
|
||||
#include <gmssl/api.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct {
|
||||
SM4_CBC_CTX enc_ctx;
|
||||
SM3_HMAC_CTX mac_ctx;
|
||||
uint8_t mac[SM3_HMAC_SIZE];
|
||||
size_t maclen;
|
||||
} SM4_CBC_SM3_HMAC_CTX;
|
||||
|
||||
#define SM4_CBC_SM3_HMAC_KEY_SIZE 48
|
||||
#define SM4_CBC_SM3_HMAC_IV_SIZE 16
|
||||
|
||||
_gmssl_export int sm4_cbc_sm3_hmac_encrypt_init(SM4_CBC_SM3_HMAC_CTX *ctx,
|
||||
const uint8_t *key, size_t keylen, const uint8_t *iv, size_t ivlen,
|
||||
const uint8_t *aad, size_t aadlen);
|
||||
_gmssl_export int sm4_cbc_sm3_hmac_encrypt_update(SM4_CBC_SM3_HMAC_CTX *ctx,
|
||||
const uint8_t *in, size_t inlen, uint8_t *out, size_t *outlen);
|
||||
_gmssl_export int sm4_cbc_sm3_hmac_encrypt_finish(SM4_CBC_SM3_HMAC_CTX *ctx,
|
||||
uint8_t *out, size_t *outlen);
|
||||
_gmssl_export int sm4_cbc_sm3_hmac_decrypt_init(SM4_CBC_SM3_HMAC_CTX *ctx,
|
||||
const uint8_t *key, size_t keylen, const uint8_t *iv, size_t ivlen,
|
||||
const uint8_t *aad, size_t aadlen);
|
||||
_gmssl_export int sm4_cbc_sm3_hmac_decrypt_update(SM4_CBC_SM3_HMAC_CTX *ctx,
|
||||
const uint8_t *in, size_t inlen, uint8_t *out, size_t *outlen);
|
||||
_gmssl_export int sm4_cbc_sm3_hmac_decrypt_finish(SM4_CBC_SM3_HMAC_CTX *ctx,
|
||||
uint8_t *out, size_t *outlen);
|
||||
|
||||
|
||||
typedef struct {
|
||||
SM4_CTR_CTX enc_ctx;
|
||||
SM3_HMAC_CTX mac_ctx;
|
||||
uint8_t mac[SM3_HMAC_SIZE];
|
||||
size_t maclen;
|
||||
} SM4_CTR_SM3_HMAC_CTX;
|
||||
|
||||
#define SM4_CTR_SM3_HMAC_KEY_SIZE 48
|
||||
#define SM4_CTR_SM3_HMAC_IV_SIZE 16
|
||||
|
||||
_gmssl_export int sm4_ctr_sm3_hmac_encrypt_init(SM4_CTR_SM3_HMAC_CTX *ctx,
|
||||
const uint8_t *key, size_t keylen, const uint8_t *iv, size_t ivlen,
|
||||
const uint8_t *aad, size_t aadlen);
|
||||
_gmssl_export int sm4_ctr_sm3_hmac_encrypt_update(SM4_CTR_SM3_HMAC_CTX *ctx,
|
||||
const uint8_t *in, size_t inlen, uint8_t *out, size_t *outlen);
|
||||
_gmssl_export int sm4_ctr_sm3_hmac_encrypt_finish(SM4_CTR_SM3_HMAC_CTX *ctx,
|
||||
uint8_t *out, size_t *outlen);
|
||||
_gmssl_export int sm4_ctr_sm3_hmac_decrypt_init(SM4_CTR_SM3_HMAC_CTX *ctx,
|
||||
const uint8_t *key, size_t keylen, const uint8_t *iv, size_t ivlen,
|
||||
const uint8_t *aad, size_t aadlen);
|
||||
_gmssl_export int sm4_ctr_sm3_hmac_decrypt_update(SM4_CTR_SM3_HMAC_CTX *ctx,
|
||||
const uint8_t *in, size_t inlen, uint8_t *out, size_t *outlen);
|
||||
_gmssl_export int sm4_ctr_sm3_hmac_decrypt_finish(SM4_CTR_SM3_HMAC_CTX *ctx,
|
||||
uint8_t *out, size_t *outlen);
|
||||
|
||||
|
||||
typedef struct {
|
||||
SM4_CTR_CTX enc_ctx;
|
||||
GHASH_CTX mac_ctx;
|
||||
uint8_t Y[16]; // E(K, Y_0)
|
||||
size_t taglen;
|
||||
uint8_t mac[16];
|
||||
size_t maclen;
|
||||
} SM4_GCM_CTX;
|
||||
|
||||
#define SM4_GCM_KEY_SIZE 16
|
||||
#define SM4_GCM_DEFAULT_TAG_SIZE 16
|
||||
|
||||
_gmssl_export int sm4_gcm_encrypt_init(SM4_GCM_CTX *ctx,
|
||||
const uint8_t *key, size_t keylen, const uint8_t *iv, size_t ivlen,
|
||||
const uint8_t *aad, size_t aadlen, size_t taglen);
|
||||
_gmssl_export int sm4_gcm_encrypt_update(SM4_GCM_CTX *ctx,
|
||||
const uint8_t *in, size_t inlen, uint8_t *out, size_t *outlen);
|
||||
_gmssl_export int sm4_gcm_encrypt_finish(SM4_GCM_CTX *ctx,
|
||||
uint8_t *out, size_t *outlen);
|
||||
_gmssl_export int sm4_gcm_decrypt_init(SM4_GCM_CTX *ctx,
|
||||
const uint8_t *key, size_t keylen, const uint8_t *iv, size_t ivlen,
|
||||
const uint8_t *aad, size_t aadlen, size_t taglen);
|
||||
_gmssl_export int sm4_gcm_decrypt_update(SM4_GCM_CTX *ctx,
|
||||
const uint8_t *in, size_t inlen, uint8_t *out, size_t *outlen);
|
||||
_gmssl_export int sm4_gcm_decrypt_finish(SM4_GCM_CTX *ctx,
|
||||
uint8_t *out, size_t *outlen);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
23
thirdparty/GmSSL-3.1.1/include/gmssl/api.h
vendored
23
thirdparty/GmSSL-3.1.1/include/gmssl/api.h
vendored
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014-2023 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.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
#ifndef GMSSL_API_H
|
||||
#define GMSSL_API_H
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
#define _gmssl_export __declspec(dllexport)
|
||||
#elif defined(__GNUC__)
|
||||
// use -fvisibility=hidden to change the "default" behavior
|
||||
#define _gmssl_export __attribute__((visibility("default")))
|
||||
#else
|
||||
#define _gmssl_export
|
||||
#endif
|
||||
|
||||
#endif
|
||||
20
thirdparty/GmSSL-3.1.1/include/gmssl/asm.h
vendored
Normal file
20
thirdparty/GmSSL-3.1.1/include/gmssl/asm.h
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
|
||||
#ifndef GMSSL_ASM_H
|
||||
#define GMSSL_ASM_H
|
||||
|
||||
#ifdef ENABLE_ASM_UNDERSCORE_PREFIX
|
||||
# define func(foo) _##foo
|
||||
#else
|
||||
# define func(foo) foo
|
||||
#endif
|
||||
|
||||
#endif
|
||||
27
thirdparty/GmSSL-3.1.1/include/gmssl/asn1.h
vendored
27
thirdparty/GmSSL-3.1.1/include/gmssl/asn1.h
vendored
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Copyright 2014-2023 The GmSSL Project. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
@@ -86,8 +86,8 @@ int asn1_type_from_der(int tag, const uint8_t **d, size_t *dlen, const uint8_t *
|
||||
int asn1_nonempty_type_to_der(int tag, const uint8_t *d, size_t dlen, uint8_t **out, size_t *outlen);
|
||||
int asn1_nonempty_type_from_der(int tag, const uint8_t **d, size_t *dlen, const uint8_t **in, size_t *inlen);
|
||||
int asn1_any_type_from_der(int *tag, const uint8_t **d, size_t *dlen, const uint8_t **in, size_t *inlen);
|
||||
int asn1_any_to_der(const uint8_t *a, size_t alen, uint8_t **out, size_t *outlen); // 调用方应保证a,alen为TLV
|
||||
int asn1_any_from_der(const uint8_t **a, size_t *alen, const uint8_t **in, size_t *inlen); // 该函数会检查输入是否为TLV
|
||||
int asn1_any_to_der(const uint8_t *a, size_t alen, uint8_t **out, size_t *outlen); // NOTE: a,alen MUST be TLV
|
||||
int asn1_any_from_der(const uint8_t **a, size_t *alen, const uint8_t **in, size_t *inlen); // asn1_any_from_der check if input is TLV
|
||||
|
||||
#define ASN1_TRUE 0xff
|
||||
#define ASN1_FALSE 0x00
|
||||
@@ -101,7 +101,7 @@ int asn1_boolean_from_der_ex(int tag, int *val, const uint8_t **in, size_t *inle
|
||||
#define asn1_implicit_boolean_to_der(i,val,out,outlen) asn1_boolean_to_der_ex(ASN1_TAG_IMPLICIT(i),val,out,outlen)
|
||||
#define asn1_implicit_boolean_from_der(i,val,in,inlen) asn1_boolean_from_der_ex(ASN1_TAG_IMPLICIT(i),val,in,inlen)
|
||||
|
||||
// asn1_integer_ 不支持负数编解码
|
||||
// asn1_integer_ does not support negative value
|
||||
int asn1_integer_to_der_ex(int tag, const uint8_t *d, size_t dlen, uint8_t **out, size_t *outlen);
|
||||
int asn1_integer_from_der_ex(int tag, const uint8_t **d, size_t *dlen, const uint8_t **in, size_t *inlen);
|
||||
#define asn1_integer_to_der(d,dlen,out,outlen) asn1_integer_to_der_ex(ASN1_TAG_INTEGER,d,dlen,out,outlen)
|
||||
@@ -109,15 +109,15 @@ int asn1_integer_from_der_ex(int tag, const uint8_t **d, size_t *dlen, const uin
|
||||
#define asn1_implicit_integer_to_der(i,d,dlen,out,outlen) asn1_integer_to_der_ex(ASN1_TAG_IMPLICIT(i),d,dlen,out,outlen)
|
||||
#define asn1_implicit_integer_from_der(i,d,dlen,in,inlen) asn1_integer_from_der_ex(ASN1_TAG_IMPLICIT(i),d,dlen,in,inlen)
|
||||
|
||||
// asn1_int_ 只支持小的无符号整数的编解码,不支持负数
|
||||
int asn1_int_to_der_ex(int tag, int val, uint8_t **out, size_t *outlen); // 当 val == -1 时,不输出,返回 0
|
||||
int asn1_int_from_der_ex(int tag, int *val, const uint8_t **in, size_t *inlen); // 不支持负数,返回0时 *val 设置为 -1
|
||||
// asn1_int_ only support small unsigned int, does not support negative integer
|
||||
int asn1_int_to_der_ex(int tag, int val, uint8_t **out, size_t *outlen); // when val == -1, return 0 and no output
|
||||
int asn1_int_from_der_ex(int tag, int *val, const uint8_t **in, size_t *inlen); // when return 0, *val is set to -1
|
||||
#define asn1_int_to_der(val,out,outlen) asn1_int_to_der_ex(ASN1_TAG_INTEGER,val,out,outlen)
|
||||
#define asn1_int_from_der(val,in,inlen) asn1_int_from_der_ex(ASN1_TAG_INTEGER,val,in,inlen)
|
||||
#define asn1_implicit_int_to_der(i,val,out,outlen) asn1_int_to_der_ex(ASN1_TAG_IMPLICIT(i),val,out,outlen)
|
||||
#define asn1_implicit_int_from_der(i,val,in,inlen) asn1_int_from_der_ex(ASN1_TAG_IMPLICIT(i),val,in,inlen)
|
||||
|
||||
// 比特长度不必须为8的整数倍
|
||||
// bit_string can be any length
|
||||
int asn1_bit_string_to_der_ex(int tag, const uint8_t *d, size_t nbits, uint8_t **out, size_t *outlen);
|
||||
int asn1_bit_string_from_der_ex(int tag, const uint8_t **d, size_t *nbits, const uint8_t **in, size_t *inlen);
|
||||
#define asn1_bit_string_to_der(d,nbits,out,outlen) asn1_bit_string_to_der_ex(ASN1_TAG_BIT_STRING,d,nbits,out,outlen)
|
||||
@@ -125,7 +125,7 @@ int asn1_bit_string_from_der_ex(int tag, const uint8_t **d, size_t *nbits, const
|
||||
#define asn1_implicit_bit_string_to_der(i,d,nbits,out,outlen) asn1_bit_string_to_der_ex(ASN1_TAG_IMPLICIT(i),d,nbits,out,outlen)
|
||||
#define asn1_implicit_bit_string_from_der(i,d,nbits,in,inlen) asn1_bit_string_from_der_ex(ASN1_TAG_IMPLICIT(i),d,nbits,in,inlen)
|
||||
|
||||
// 比特长度必须为8的整数倍,因此使用字节长度
|
||||
// bit string MUST be multiple 8 bits
|
||||
int asn1_bit_octets_to_der_ex(int tag, const uint8_t *d, size_t dlen, uint8_t **out, size_t *outlen);
|
||||
int asn1_bit_octets_from_der_ex(int tag, const uint8_t **d, size_t *dlen, const uint8_t **in, size_t *inlen);
|
||||
#define asn1_bit_octets_to_der(d,dlen,out,outlen) asn1_bit_octets_to_der_ex(ASN1_TAG_BIT_STRING,d,dlen,out,outlen)
|
||||
@@ -133,14 +133,14 @@ int asn1_bit_octets_from_der_ex(int tag, const uint8_t **d, size_t *dlen, const
|
||||
#define asn1_implicit_bit_octets_to_der(i,d,dlen,out,outlen) asn1_bit_octets_to_der_ex(ASN1_TAG_IMPLICIT(i),d,dlen,out,outlen)
|
||||
#define asn1_implicit_bit_octets_from_der(i,d,dlen,in,inlen) asn1_bit_octets_from_der_ex(ASN1_TAG_IMPLICIT(i),d,dlen,in,inlen)
|
||||
|
||||
// bits == -1 不编码,只支持较少的比特数量
|
||||
// bits == -1 means no input
|
||||
int asn1_bits_to_der_ex(int tag, int bits, uint8_t **out, size_t *outlen);
|
||||
int asn1_bits_from_der_ex(int tag, int *bits, const uint8_t **in, size_t *inlen);
|
||||
#define asn1_bits_to_der(bits,out,outlen) asn1_bits_to_der_ex(ASN1_TAG_BIT_STRING,bits,out,outlen)
|
||||
#define asn1_bits_from_der(bits,in,inlen) asn1_bits_from_der_ex(ASN1_TAG_BIT_STRING,bits,in,inlen)
|
||||
#define asn1_implicit_bits_to_der(i,bits,out,outlen) asn1_bits_to_der_ex(ASN1_TAG_IMPLICIT(i),bits,out,outlen)
|
||||
#define asn1_implicit_bits_from_der(i,bits,in,inlen) asn1_bits_from_der_ex(ASN1_TAG_IMPLICIT(i),bits,in,inlen)
|
||||
// names[i]对应第i个比特
|
||||
// names[i] is the i-th bit
|
||||
int asn1_bits_print(FILE *fp, int fmt, int ind, const char *label, const char **names, size_t names_cnt, int bits);
|
||||
|
||||
#define asn1_octet_string_to_der_ex(tag,d,dlen,out,outlen) asn1_type_to_der(tag,d,dlen,out,outlen)
|
||||
@@ -182,7 +182,8 @@ typedef struct {
|
||||
|
||||
const ASN1_OID_INFO *asn1_oid_info_from_name(const ASN1_OID_INFO *infos, size_t count, const char *name);
|
||||
const ASN1_OID_INFO *asn1_oid_info_from_oid(const ASN1_OID_INFO *infos, size_t count, int oid);
|
||||
// 如果一个正确解析的OID并不在infos列表中,那么仍然返回1,但是调用方必须检查返回的info是否为空
|
||||
|
||||
// well-formed but unknown OID will return 1, caller should check if *info == NULL when return 1
|
||||
int asn1_oid_info_from_der_ex(const ASN1_OID_INFO **info, uint32_t *nodes, size_t *nodes_cnt,
|
||||
const ASN1_OID_INFO *infos, size_t count, const uint8_t **in, size_t *inlen);
|
||||
int asn1_oid_info_from_der(const ASN1_OID_INFO **info,
|
||||
@@ -283,7 +284,7 @@ int asn1_header_to_der(int tag, size_t dlen, uint8_t **out, size_t *outlen);
|
||||
#define asn1_explicit_to_der(i,d,dlen,out,outlen) asn1_nonempty_type_to_der(ASN1_TAG_EXPLICIT(i),d,dlen,out,outlen)
|
||||
#define asn1_explicit_from_der(i,d,dlen,in,inlen) asn1_nonempty_type_from_der(ASN1_TAG_EXPLICIT(i),d,dlen,in,inlen)
|
||||
|
||||
// d,dlen 是 SEQUENCE OF, SET OF 中的值
|
||||
// d,dlen is the V (of TLV) of SEQUENCE OF, SET OF
|
||||
int asn1_types_get_count(const uint8_t *d, size_t dlen, int tag, size_t *cnt);
|
||||
int asn1_types_get_item_by_index(const uint8_t *d, size_t dlen, int tag,
|
||||
int index, const uint8_t **item_d, size_t *item_dlen);
|
||||
|
||||
15
thirdparty/GmSSL-3.1.1/include/gmssl/base64.h
vendored
15
thirdparty/GmSSL-3.1.1/include/gmssl/base64.h
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2022 The GmSSL Project. All Rights Reserved.
|
||||
* Copyright 2014-2023 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.
|
||||
@@ -19,19 +19,6 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
BASE64 Public API
|
||||
|
||||
BASE64_CTX
|
||||
base64_encode_init
|
||||
base64_encode_update
|
||||
base64_encode_finish
|
||||
base64_decode_init
|
||||
base64_decode_update
|
||||
base64_decode_finish
|
||||
|
||||
*/
|
||||
|
||||
|
||||
typedef struct {
|
||||
/* number saved in a partial encode/decode */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2022 The GmSSL Project. All Rights Reserved.
|
||||
* Copyright 2014-2023 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,9 +7,6 @@
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef GMSSL_BLOCK_CIPHER_H
|
||||
#define GMSSL_BLOCK_CIPHER_H
|
||||
|
||||
@@ -17,8 +14,10 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <gmssl/aes.h>
|
||||
#include <gmssl/sm4.h>
|
||||
#ifdef ENABLE_AES
|
||||
#include <gmssl/aes.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -37,7 +36,9 @@ typedef struct BLOCK_CIPHER_KEY BLOCK_CIPHER_KEY;
|
||||
struct BLOCK_CIPHER_KEY {
|
||||
union {
|
||||
SM4_KEY sm4_key;
|
||||
#ifdef ENABLE_AES
|
||||
AES_KEY aes_key;
|
||||
#endif
|
||||
} u;
|
||||
const BLOCK_CIPHER *cipher;
|
||||
};
|
||||
@@ -58,7 +59,9 @@ struct BLOCK_CIPHER {
|
||||
};
|
||||
|
||||
const BLOCK_CIPHER *BLOCK_CIPHER_sm4(void);
|
||||
#ifdef ENABLE_AES
|
||||
const BLOCK_CIPHER *BLOCK_CIPHER_aes128(void);
|
||||
#endif
|
||||
|
||||
const BLOCK_CIPHER *block_cipher_from_name(const char *name);
|
||||
const char *block_cipher_name(const BLOCK_CIPHER *cipher);
|
||||
|
||||
58
thirdparty/GmSSL-3.1.1/include/gmssl/cms.h
vendored
58
thirdparty/GmSSL-3.1.1/include/gmssl/cms.h
vendored
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Copyright 2014-2022 The GmSSL Project. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
@@ -62,7 +62,7 @@ int cms_content_info_to_der(
|
||||
uint8_t **out, size_t *outlen);
|
||||
int cms_content_info_from_der(
|
||||
int *content_type,
|
||||
const uint8_t **content, size_t *content_len, // 这里获得的是完整的TLV
|
||||
const uint8_t **content, size_t *content_len, // content is the full TLV
|
||||
const uint8_t **in, size_t *inlen);
|
||||
int cms_content_info_print(FILE *fp, int fmt, int ind, const char *label, const uint8_t *d, size_t dlen);
|
||||
|
||||
@@ -269,13 +269,13 @@ typedef struct {
|
||||
|
||||
int cms_signed_data_sign_to_der(
|
||||
const CMS_CERTS_AND_KEY *signers, size_t signers_cnt,
|
||||
int content_type, const uint8_t *data, size_t datalen, // 当OID_cms_data时为raw data
|
||||
const uint8_t *crls, size_t crls_len, // 可以为空
|
||||
int content_type, const uint8_t *data, size_t datalen, // with OID_cms_data, `data` is the raw data
|
||||
const uint8_t *crls, size_t crls_len, // crls can be NULL
|
||||
uint8_t **out, size_t *outlen);
|
||||
int cms_signed_data_verify_from_der(
|
||||
const uint8_t *extra_certs, size_t extra_certs_len,
|
||||
const uint8_t *extra_crls, size_t extra_crls_len,
|
||||
int *content_type, const uint8_t **content, size_t *content_len, // 是否应该返回raw data呢?
|
||||
int *content_type, const uint8_t **content, size_t *content_len, // should we return raw data
|
||||
const uint8_t **certs, size_t *certs_len,
|
||||
const uint8_t **crls, size_t *crls_len,
|
||||
const uint8_t **signer_infos, size_t *signer_infos_len,
|
||||
@@ -289,8 +289,8 @@ RecipientInfo ::= SEQUENCE {
|
||||
keyEncryptionAlgorithm AlgorithmIdentifier,
|
||||
encryptedKey OCTET STRING -- DER-encoding of SM2Cipher
|
||||
}
|
||||
由于encryptedKey的类型为SM2Cipher, 而SM2Cipher中有2个INTEGER,因此长度是不固定的。
|
||||
因此不能预先确定输出长度
|
||||
|
||||
DER-encoding length of RecipientInfo is not fixed (caused by INTEGERs)
|
||||
*/
|
||||
int cms_recipient_info_to_der(
|
||||
int version,
|
||||
@@ -303,7 +303,7 @@ int cms_recipient_info_from_der(
|
||||
int *version,
|
||||
const uint8_t **issuer, size_t *issuer_len,
|
||||
const uint8_t **serial_number, size_t *serial_number_len,
|
||||
int *pke_algor, const uint8_t **params, size_t *params_len,// SM2加密只使用SM3,没有默认参数,但是ECIES可能有
|
||||
int *pke_algor, const uint8_t **params, size_t *params_len,// sm2encrypt has no params, but ECIES might have params
|
||||
const uint8_t **enced_key, size_t *enced_key_len,
|
||||
const uint8_t **in, size_t *inlen);
|
||||
int cms_recipient_info_print(FILE *fp, int fmt, int ind, const char *label, const uint8_t *d, size_t dlen);
|
||||
@@ -452,35 +452,29 @@ int cms_key_agreement_info_print(FILE *fp, int fmt, int ind, const char *label,
|
||||
|
||||
|
||||
|
||||
// 下面是公开API
|
||||
// 公开API的设计考虑:
|
||||
// 1. 不需要调用其他函数
|
||||
// 2. 在逻辑上容易理解
|
||||
// 3. 将cms,cmslen看做对象
|
||||
|
||||
|
||||
// 生成ContentInfo, type == data
|
||||
// generate ContentInfo, type == data
|
||||
int cms_set_data(uint8_t *cms, size_t *cmslen,
|
||||
const uint8_t *d, size_t dlen);
|
||||
|
||||
int cms_encrypt(
|
||||
uint8_t *cms, size_t *cmslen, // 输出的ContentInfo (type encryptedData)
|
||||
int enc_algor, const uint8_t *key, size_t keylen, const uint8_t *iv, size_t ivlen, // 对称加密算法、密钥和IV
|
||||
int content_type, const uint8_t *content, size_t content_len, // 待加密的输入数据
|
||||
const uint8_t *shared_info1, size_t shared_info1_len, // 附加信息
|
||||
uint8_t *cms, size_t *cmslen,
|
||||
int enc_algor, const uint8_t *key, size_t keylen, const uint8_t *iv, size_t ivlen,
|
||||
int content_type, const uint8_t *content, size_t content_len,
|
||||
const uint8_t *shared_info1, size_t shared_info1_len,
|
||||
const uint8_t *shared_info2, size_t shared_info2_len);
|
||||
|
||||
int cms_decrypt(
|
||||
const uint8_t *cms, size_t cmslen, // 输入的ContentInfo (type encryptedData)
|
||||
int *enc_algor, const uint8_t *key, size_t keylen, // 解密密钥(我们不知道解密算法)
|
||||
int *content_type, uint8_t *content, size_t *content_len, // 输出的解密数据类型及数据
|
||||
const uint8_t **shared_info1, size_t *shared_info1_len, // 附加信息
|
||||
const uint8_t *cms, size_t cmslen, // should be ContentInfo (type encryptedData)
|
||||
int *enc_algor, const uint8_t *key, size_t keylen,
|
||||
int *content_type, uint8_t *content, size_t *content_len,
|
||||
const uint8_t **shared_info1, size_t *shared_info1_len,
|
||||
const uint8_t **shared_info2, size_t *shared_info2_len);
|
||||
|
||||
int cms_sign(
|
||||
uint8_t *cms, size_t *cms_len,
|
||||
const CMS_CERTS_AND_KEY *signers, size_t signers_cnt, // 签名者的签名私钥和证书
|
||||
int content_type, const uint8_t *content, size_t content_len, // 待签名的输入数据
|
||||
const CMS_CERTS_AND_KEY *signers, size_t signers_cnt,
|
||||
int content_type, const uint8_t *content, size_t content_len,
|
||||
const uint8_t *crls, size_t crls_len);
|
||||
|
||||
int cms_verify(
|
||||
@@ -494,17 +488,17 @@ int cms_verify(
|
||||
|
||||
int cms_envelop(
|
||||
uint8_t *cms, size_t *cms_len,
|
||||
const uint8_t *rcpt_certs, size_t rcpt_certs_len, // 接收方证书,注意这个参数的类型可以容纳多个证书,但是只有在一个接受者时对调用方最方便
|
||||
int enc_algor, const uint8_t *key, size_t keylen, const uint8_t *iv, size_t ivlen, // 对称加密算法及参数
|
||||
int content_type, const uint8_t *content, size_t content_len, // 待加密的输入数据
|
||||
const uint8_t *shared_info1, size_t shared_info1_len, // 附加输入信息
|
||||
const uint8_t *rcpt_certs, size_t rcpt_certs_len,
|
||||
int enc_algor, const uint8_t *key, size_t keylen, const uint8_t *iv, size_t ivlen,
|
||||
int content_type, const uint8_t *content, size_t content_len,
|
||||
const uint8_t *shared_info1, size_t shared_info1_len,
|
||||
const uint8_t *shared_info2, size_t shared_info2_len);
|
||||
|
||||
int cms_deenvelop(
|
||||
const uint8_t *cms, size_t cms_len,
|
||||
const SM2_KEY *rcpt_key, const uint8_t *rcpt_cert, size_t rcpt_cert_len, // 接收方的解密私钥和对应的证书,注意只需要一个解密方
|
||||
const SM2_KEY *rcpt_key, const uint8_t *rcpt_cert, size_t rcpt_cert_len,
|
||||
int *content_type, uint8_t *content, size_t *content_len,
|
||||
const uint8_t **rcpt_infos, size_t *rcpt_infos_len, // 解析得到,用于显示
|
||||
const uint8_t **rcpt_infos, size_t *rcpt_infos_len,
|
||||
const uint8_t **shared_info1, size_t *shared_info1_len,
|
||||
const uint8_t **shared_info2, size_t *shared_info2_len);
|
||||
|
||||
@@ -531,7 +525,7 @@ int cms_deenvelop_and_verify(
|
||||
const uint8_t **shared_info1, size_t *shared_info1_len,
|
||||
const uint8_t **shared_info2, size_t *shared_info2_len);
|
||||
|
||||
// 生成ContentInfo, type == keyAgreementInfo
|
||||
// create ContentInfo, type == keyAgreementInfo
|
||||
int cms_set_key_agreement_info(
|
||||
uint8_t *cms, size_t *cms_len,
|
||||
const SM2_KEY *temp_public_key_r,
|
||||
|
||||
58
thirdparty/GmSSL-3.1.1/include/gmssl/des.h
vendored
58
thirdparty/GmSSL-3.1.1/include/gmssl/des.h
vendored
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014-2022 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.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
|
||||
/* FIPS PUB 46-3 "Data Encryption Standard (DES)" */
|
||||
|
||||
#ifndef GMSSL_DES_H
|
||||
#define GMSSL_DES_H
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#define DES_KEY_BITS 56
|
||||
#define DES_BLOCK_BITS 64
|
||||
#define DES_KEY_SIZE ((DES_KEY_BITS)/7)
|
||||
#define DES_BLOCK_SIZE (DES_BLOCK_BITS/8)
|
||||
|
||||
#define DES_RK_BITS 48
|
||||
#define DES_RK_SIZE (DES_RK_BITS/8)
|
||||
#define DES_ROUNDS 16
|
||||
|
||||
#define DES_EDE_KEY_SIZE (DES_KEY_SIZE * 3)
|
||||
|
||||
typedef struct {
|
||||
uint64_t rk[DES_ROUNDS];
|
||||
} DES_KEY;
|
||||
|
||||
void des_set_encrypt_key(DES_KEY *key, const uint8_t raw_key[DES_KEY_SIZE]);
|
||||
void des_set_decrypt_key(DES_KEY *key, const uint8_t raw_key[DES_KEY_SIZE]);
|
||||
void des_encrypt(DES_KEY *key, const uint8_t in[DES_BLOCK_SIZE], uint8_t out[DES_BLOCK_SIZE]);
|
||||
|
||||
|
||||
typedef struct {
|
||||
DES_KEY K[3];
|
||||
} DES_EDE_KEY;
|
||||
|
||||
void des_ede_set_encrypt_key(DES_EDE_KEY *key, const uint8_t raw_key[DES_EDE_KEY_SIZE]);
|
||||
void des_ede_set_decrypt_key(DES_EDE_KEY *key, const uint8_t raw_key[DES_EDE_KEY_SIZE]);
|
||||
void des_ede_encrypt(DES_EDE_KEY *key, const uint8_t in[DES_BLOCK_SIZE], uint8_t out[DES_BLOCK_SIZE]);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
18
thirdparty/GmSSL-3.1.1/include/gmssl/digest.h
vendored
18
thirdparty/GmSSL-3.1.1/include/gmssl/digest.h
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2022 The GmSSL Project. All Rights Reserved.
|
||||
* Copyright 2014-2023 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.
|
||||
@@ -16,12 +16,12 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <gmssl/sm3.h>
|
||||
#ifdef ENABLE_BROKEN_CRYPTO
|
||||
#include <gmssl/md5.h>
|
||||
#ifdef ENABLE_SHA1
|
||||
#include <gmssl/sha1.h>
|
||||
#endif
|
||||
#ifdef ENABLE_SHA2
|
||||
#include <gmssl/sha2.h>
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -39,14 +39,15 @@ typedef struct DIGEST_CTX DIGEST_CTX;
|
||||
struct DIGEST_CTX {
|
||||
union {
|
||||
SM3_CTX sm3_ctx;
|
||||
#ifdef ENABLE_BROKEN_CRYPTO
|
||||
MD5_CTX md5_ctx;
|
||||
#ifdef ENABLE_SHA1
|
||||
SHA1_CTX sha1_ctx;
|
||||
#endif
|
||||
#ifdef ENABLE_SHA2
|
||||
SHA224_CTX sha224_ctx;
|
||||
SHA256_CTX sha256_ctx;
|
||||
SHA384_CTX sha384_ctx;
|
||||
SHA512_CTX sha512_ctx;
|
||||
#endif
|
||||
} u;
|
||||
const DIGEST *digest;
|
||||
};
|
||||
@@ -62,16 +63,17 @@ struct DIGEST {
|
||||
};
|
||||
|
||||
const DIGEST *DIGEST_sm3(void);
|
||||
#ifdef ENABLE_BROKEN_CRYPTO
|
||||
const DIGEST *DIGEST_md5(void);
|
||||
#ifdef ENABLE_SHA1
|
||||
const DIGEST *DIGEST_sha1(void);
|
||||
#endif
|
||||
#ifdef ENABLE_SHA2
|
||||
const DIGEST *DIGEST_sha224(void);
|
||||
const DIGEST *DIGEST_sha256(void);
|
||||
const DIGEST *DIGEST_sha384(void);
|
||||
const DIGEST *DIGEST_sha512(void);
|
||||
const DIGEST *DIGEST_sha512_224(void);
|
||||
const DIGEST *DIGEST_sha512_256(void);
|
||||
#endif
|
||||
|
||||
const DIGEST *digest_from_name(const char *name);
|
||||
const char *digest_name(const DIGEST *digest);
|
||||
|
||||
1
thirdparty/GmSSL-3.1.1/include/gmssl/ec.h
vendored
1
thirdparty/GmSSL-3.1.1/include/gmssl/ec.h
vendored
@@ -11,7 +11,6 @@
|
||||
#ifndef GMSSL_EC_H
|
||||
#define GMSSL_EC_H
|
||||
|
||||
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
(uint64_t)(p)[7])
|
||||
|
||||
|
||||
// 注意:PUTU32(buf, val++) 会出错!
|
||||
// WARNING: must not write PUTU32(buf, val++)
|
||||
#define PUTU16(p,V) \
|
||||
((p)[0] = (uint8_t)((V) >> 8), \
|
||||
(p)[1] = (uint8_t)(V))
|
||||
|
||||
8
thirdparty/GmSSL-3.1.1/include/gmssl/error.h
vendored
8
thirdparty/GmSSL-3.1.1/include/gmssl/error.h
vendored
@@ -33,16 +33,16 @@ extern "C" {
|
||||
#define DEBUG 1
|
||||
|
||||
#define warning_print() \
|
||||
do { if (DEBUG) fprintf(stderr, "%s:%d:%s():\n",__FILE__, __LINE__, __func__); } while (0)
|
||||
do { if (DEBUG) fprintf(stderr, "%s:%d:%s():\n",__FILE__, __LINE__, __FUNCTION__); } while (0)
|
||||
|
||||
#define error_print() \
|
||||
do { if (DEBUG) fprintf(stderr, "%s:%d:%s():\n",__FILE__, __LINE__, __func__); } while (0)
|
||||
do { if (DEBUG) fprintf(stderr, "%s:%d:%s():\n",__FILE__, __LINE__, __FUNCTION__); } while (0)
|
||||
|
||||
#define error_print_msg(fmt, ...) \
|
||||
do { if (DEBUG) fprintf(stderr, "%s:%d:%s(): " fmt, __FILE__, __LINE__, __func__, __VA_ARGS__); } while (0)
|
||||
do { if (DEBUG) fprintf(stderr, "%s:%d:%s(): " fmt, __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__); } while (0)
|
||||
|
||||
#define error_puts(str) \
|
||||
do { if (DEBUG) fprintf(stderr, "%s: %d: %s: %s", __FILE__, __LINE__, __func__, str); } while (0)
|
||||
do { if (DEBUG) fprintf(stderr, "%s: %d: %s: %s\n", __FILE__, __LINE__, __FUNCTION__, str); } while (0)
|
||||
|
||||
|
||||
void print_der(const uint8_t *in, size_t inlen);
|
||||
|
||||
2
thirdparty/GmSSL-3.1.1/include/gmssl/file.h
vendored
2
thirdparty/GmSSL-3.1.1/include/gmssl/file.h
vendored
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Copyright 2014-2023 The GmSSL Project. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
|
||||
73
thirdparty/GmSSL-3.1.1/include/gmssl/gcm.h
vendored
73
thirdparty/GmSSL-3.1.1/include/gmssl/gcm.h
vendored
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014-2022 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.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
|
||||
#ifndef GMSSL_GCM_H
|
||||
#define GMSSL_GCM_H
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <gmssl/gf128.h>
|
||||
#include <gmssl/block_cipher.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define GCM_IV_MIN_SIZE 1
|
||||
#define GCM_IV_MAX_SIZE ((uint64_t)(1 << (64-3)))
|
||||
#define GCM_IV_DEFAULT_BITS 96
|
||||
#define GCM_IV_DEFAULT_SIZE 12
|
||||
|
||||
#define GCM_MIN_AAD_SIZE 0
|
||||
#define GCM_MAX_AAD_SIZE ((uint64_t)(1 << (64-3)))
|
||||
|
||||
#define GCM_MIN_PLAINTEXT_SIZE 0
|
||||
#define GCM_MAX_PLAINTEXT_SIZE ((((uint64_t)1 << 39) - 256) >> 3)
|
||||
|
||||
|
||||
#define GHASH_SIZE (16)
|
||||
|
||||
|
||||
#define GCM_IS_LITTLE_ENDIAN 1
|
||||
|
||||
|
||||
void ghash(const uint8_t h[16], const uint8_t *aad, size_t aadlen,
|
||||
const uint8_t *c, size_t clen, uint8_t out[16]);
|
||||
|
||||
typedef struct {
|
||||
gf128_t H;
|
||||
gf128_t X;
|
||||
size_t aadlen;
|
||||
size_t clen;
|
||||
uint8_t block[16];
|
||||
size_t num;
|
||||
} GHASH_CTX;
|
||||
|
||||
void ghash_init(GHASH_CTX *ctx, const uint8_t h[16], const uint8_t *aad, size_t aadlen);
|
||||
void ghash_update(GHASH_CTX *ctx, const uint8_t *c, size_t clen);
|
||||
void ghash_finish(GHASH_CTX *ctx, uint8_t out[16]);
|
||||
|
||||
|
||||
int gcm_encrypt(const BLOCK_CIPHER_KEY *key, const uint8_t *iv, size_t ivlen,
|
||||
const uint8_t *aad, size_t aadlen, const uint8_t *in, size_t inlen,
|
||||
uint8_t *out, size_t taglen, uint8_t *tag);
|
||||
|
||||
int gcm_decrypt(const BLOCK_CIPHER_KEY *key, const uint8_t *iv, size_t ivlen,
|
||||
const uint8_t *aad, size_t aadlen, const uint8_t *in, size_t inlen,
|
||||
const uint8_t *tag, size_t taglen, uint8_t *out);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
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
|
||||
|
||||
49
thirdparty/GmSSL-3.1.1/include/gmssl/ghash.h
vendored
Normal file
49
thirdparty/GmSSL-3.1.1/include/gmssl/ghash.h
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
#ifndef GMSSL_GHASH_H
|
||||
#define GMSSL_GHASH_H
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <gmssl/gf128.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#define GHASH_SIZE (16)
|
||||
|
||||
|
||||
// h = ENC_k(0^128)
|
||||
void ghash(const uint8_t h[16], const uint8_t *aad, size_t aadlen,
|
||||
const uint8_t *c, size_t clen, uint8_t out[16]);
|
||||
|
||||
typedef struct {
|
||||
gf128_t H;
|
||||
gf128_t X;
|
||||
size_t aadlen;
|
||||
size_t clen;
|
||||
uint8_t block[16];
|
||||
size_t num;
|
||||
} GHASH_CTX;
|
||||
|
||||
void ghash_init(GHASH_CTX *ctx, const uint8_t h[16], const uint8_t *aad, size_t aadlen);
|
||||
void ghash_update(GHASH_CTX *ctx, const uint8_t *c, size_t clen);
|
||||
void ghash_finish(GHASH_CTX *ctx, uint8_t out[16]);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
79
thirdparty/GmSSL-3.1.1/include/gmssl/hash_drbg.h
vendored
79
thirdparty/GmSSL-3.1.1/include/gmssl/hash_drbg.h
vendored
@@ -1,79 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014-2022 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.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
|
||||
/* NIST SP800-90A Rev.1 "Recommendation for Random Number Generation
|
||||
* Using Deterministic Random Bit Generators", 10.1.1 Hash_DRBG */
|
||||
|
||||
#ifndef GMSSL_HASH_DRBG_H
|
||||
#define GMSSL_HASH_DRBG_H
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <gmssl/digest.h>
|
||||
|
||||
|
||||
/* seedlen for hash_drgb, table 2 of nist sp 800-90a rev.1 */
|
||||
#define HASH_DRBG_SM3_SEED_BITS 440 /* 55 bytes */
|
||||
#define HASH_DRBG_SHA1_SEED_BITS 440
|
||||
#define HASH_DRBG_SHA224_SEED_BITS 440
|
||||
#define HASH_DRBG_SHA512_224_SEED_BITS 440
|
||||
#define HASH_DRBG_SHA256_SEED_BITS 440
|
||||
#define HASH_DRBG_SHA512_256_SEED_BITS 440
|
||||
#define HASH_DRBG_SHA384_SEED_BITS 888 /* 110 bytes */
|
||||
#define HASH_DRBG_SHA512_SEED_BITS 888
|
||||
#define HASH_DRBG_MAX_SEED_BITS 888
|
||||
|
||||
#define HASH_DRBG_SM3_SEED_SIZE (HASH_DRBG_SM3_SEED_BITS/8)
|
||||
#define HASH_DRBG_SHA1_SEED_SIZE (HASH_DRBG_SHA1_SEED_BITS/8)
|
||||
#define HASH_DRBG_SHA224_SEED_SIZE (HASH_DRBG_SHA224_SEED_BITS/8)
|
||||
#define HASH_DRBG_SHA512_224_SEED_SIZE (HASH_DRBG_SHA512_224_SEED_BITS/8)
|
||||
#define HASH_DRBG_SHA256_SEED_SIZE (HASH_DRBG_SHA256_SEED_BITS/8)
|
||||
#define HASH_DRBG_SHA512_256_SEED_SIZE (HASH_DRBG_SHA512_256_SEED_BITS/8)
|
||||
#define HASH_DRBG_SHA384_SEED_SIZE (HASH_DRBG_SHA384_SEED_BITS/8)
|
||||
#define HASH_DRBG_SHA512_SEED_SIZE (HASH_DRBG_SHA512_SEED_BITS/8)
|
||||
#define HASH_DRBG_MAX_SEED_SIZE (HASH_DRBG_MAX_SEED_BITS/8)
|
||||
|
||||
#define HASH_DRBG_RESEED_INTERVAL ((uint64_t)1 << 48)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct {
|
||||
const DIGEST *digest;
|
||||
uint8_t V[HASH_DRBG_MAX_SEED_SIZE];
|
||||
uint8_t C[HASH_DRBG_MAX_SEED_SIZE];
|
||||
size_t seedlen;
|
||||
uint64_t reseed_counter;
|
||||
} HASH_DRBG;
|
||||
|
||||
|
||||
int hash_drbg_init(HASH_DRBG *drbg,
|
||||
const DIGEST *digest,
|
||||
const uint8_t *entropy, size_t entropy_len,
|
||||
const uint8_t *nonce, size_t nonce_len,
|
||||
const uint8_t *personalstr, size_t personalstr_len);
|
||||
|
||||
int hash_drbg_reseed(HASH_DRBG *drbg,
|
||||
const uint8_t *entropy, size_t entropy_len,
|
||||
const uint8_t *additional, size_t additional_len);
|
||||
|
||||
int hash_drbg_generate(HASH_DRBG *drbg,
|
||||
const uint8_t *additional, size_t additional_len,
|
||||
size_t outlen, uint8_t *out);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
4
thirdparty/GmSSL-3.1.1/include/gmssl/hkdf.h
vendored
4
thirdparty/GmSSL-3.1.1/include/gmssl/hkdf.h
vendored
@@ -32,9 +32,9 @@ int hkdf_expand(const DIGEST *digest, const uint8_t *prk, size_t prklen,
|
||||
|
||||
int sm3_hkdf_extract(const uint8_t *salt, size_t saltlen,
|
||||
const uint8_t *ikm, size_t ikmlen,
|
||||
uint8_t *prk, size_t *prklen);
|
||||
uint8_t prk[32]);
|
||||
|
||||
int sm3_hkdf_expand(const uint8_t *prk, size_t prklen,
|
||||
int sm3_hkdf_expand(const uint8_t prk[32],
|
||||
const uint8_t *opt_info, size_t opt_infolen,
|
||||
size_t L, uint8_t *okm);
|
||||
|
||||
|
||||
48
thirdparty/GmSSL-3.1.1/include/gmssl/md5.h
vendored
48
thirdparty/GmSSL-3.1.1/include/gmssl/md5.h
vendored
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014-2022 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.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef GMSSL_MD5_H
|
||||
#define GMSSL_MD5_H
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#define MD5_IS_BIG_ENDIAN 0
|
||||
|
||||
#define MD5_DIGEST_SIZE 16
|
||||
#define MD5_BLOCK_SIZE 64
|
||||
#define MD5_STATE_WORDS (MD5_BLOCK_SIZE/sizeof(uint32_t))
|
||||
|
||||
typedef struct {
|
||||
uint32_t state[MD5_STATE_WORDS];
|
||||
uint64_t nblocks;
|
||||
uint8_t block[MD5_BLOCK_SIZE];
|
||||
size_t num;
|
||||
} MD5_CTX;
|
||||
|
||||
|
||||
void md5_init(MD5_CTX *ctx);
|
||||
void md5_update(MD5_CTX *ctx, const uint8_t *data, size_t datalen);
|
||||
void md5_finish(MD5_CTX *ctx, uint8_t dgst[MD5_DIGEST_SIZE]);
|
||||
void md5_digest(const uint8_t *data, size_t datalen, uint8_t dgst[MD5_DIGEST_SIZE]);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
2
thirdparty/GmSSL-3.1.1/include/gmssl/oid.h
vendored
2
thirdparty/GmSSL-3.1.1/include/gmssl/oid.h
vendored
@@ -147,7 +147,7 @@ enum {
|
||||
OID_aes192_cbc,
|
||||
OID_aes256_cbc,
|
||||
|
||||
OID_aes128, // 没有OID
|
||||
OID_aes128, // No OID
|
||||
|
||||
OID_ecdsa_with_sha1,
|
||||
OID_ecdsa_with_sha224,
|
||||
|
||||
12
thirdparty/GmSSL-3.1.1/include/gmssl/pbkdf2.h
vendored
12
thirdparty/GmSSL-3.1.1/include/gmssl/pbkdf2.h
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2022 The GmSSL Project. All Rights Reserved.
|
||||
* Copyright 2014-2023 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.
|
||||
@@ -22,16 +22,6 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
PBKDF2 Public API
|
||||
|
||||
PBKDF2_MIN_ITER
|
||||
PBKDF2_DEFAULT_SALT_SIZE
|
||||
PBKDF2_MAX_SALT_SIZE
|
||||
|
||||
pbkdf2_hmac_sm3_genkey
|
||||
*/
|
||||
|
||||
|
||||
#define PBKDF2_MIN_ITER 10000
|
||||
#define PBKDF2_MAX_ITER (INT_MAX)
|
||||
|
||||
4
thirdparty/GmSSL-3.1.1/include/gmssl/pkcs8.h
vendored
4
thirdparty/GmSSL-3.1.1/include/gmssl/pkcs8.h
vendored
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Copyright 2014-2022 The GmSSL Project. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
@@ -34,7 +34,7 @@ PBKDF2-params ::= SEQUENCE {
|
||||
otherSource AlgorithmIdentifier {{PBKDF2-SaltSources}}
|
||||
},
|
||||
iterationCount INTEGER (1..MAX),
|
||||
keyLength INTEGER (1..MAX) OPTIONAL, -- 这个参数可以由函数指定
|
||||
keyLength INTEGER (1..MAX) OPTIONAL,
|
||||
prf AlgorithmIdentifier {{PBKDF2-PRFs}} DEFAULT algid-hmacWithSHA1
|
||||
}
|
||||
|
||||
|
||||
3
thirdparty/GmSSL-3.1.1/include/gmssl/rand.h
vendored
3
thirdparty/GmSSL-3.1.1/include/gmssl/rand.h
vendored
@@ -13,7 +13,6 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <gmssl/api.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -22,7 +21,7 @@ extern "C" {
|
||||
|
||||
#define RAND_BYTES_MAX_SIZE (256)
|
||||
|
||||
_gmssl_export int rand_bytes(uint8_t *buf, size_t buflen);
|
||||
int rand_bytes(uint8_t *buf, size_t buflen);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
40
thirdparty/GmSSL-3.1.1/include/gmssl/rc4.h
vendored
40
thirdparty/GmSSL-3.1.1/include/gmssl/rc4.h
vendored
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014-2022 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.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef GMSSL_RC4_H
|
||||
#define GMSSL_RC4_H
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#define RC4_MIN_KEY_BITS 40
|
||||
#define RC4_STATE_NUM_WORDS 256
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint8_t d[RC4_STATE_NUM_WORDS];
|
||||
} RC4_STATE;
|
||||
|
||||
void rc4_init(RC4_STATE *state, const uint8_t *key, size_t keylen);
|
||||
void rc4_generate_keystream(RC4_STATE *state, size_t outlen, uint8_t *out);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
73
thirdparty/GmSSL-3.1.1/include/gmssl/sdf.h
vendored
73
thirdparty/GmSSL-3.1.1/include/gmssl/sdf.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.
|
||||
@@ -14,29 +14,13 @@
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <gmssl/sm2.h>
|
||||
#include <gmssl/sm4.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
SDF Public API
|
||||
|
||||
sdf_load_library
|
||||
sdf_unload_library
|
||||
|
||||
SDF_DEVICE
|
||||
sdf_open_device
|
||||
sdf_close_device
|
||||
sdf_print_device_info
|
||||
sdf_rand_bytes
|
||||
sdf_load_sign_key
|
||||
|
||||
SDF_KEY
|
||||
sdf_sign
|
||||
sdf_release_key
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
void *handle;
|
||||
@@ -46,19 +30,60 @@ typedef struct {
|
||||
} SDF_DEVICE;
|
||||
|
||||
typedef struct {
|
||||
SM2_KEY public_key;
|
||||
void *session;
|
||||
} SDF_DIGEST_CTX;
|
||||
|
||||
typedef struct {
|
||||
void *session;
|
||||
void *handle;
|
||||
} SDF_KEY;
|
||||
|
||||
typedef struct {
|
||||
SDF_KEY key;
|
||||
uint8_t iv[SM4_BLOCK_SIZE];
|
||||
uint8_t block[SM4_BLOCK_SIZE];
|
||||
size_t block_nbytes;
|
||||
} SDF_CBC_CTX;
|
||||
|
||||
typedef struct {
|
||||
void *session;
|
||||
int index;
|
||||
} SDF_KEY;
|
||||
} SDF_PRIVATE_KEY;
|
||||
|
||||
typedef struct {
|
||||
SM3_CTX sm3_ctx;
|
||||
SM3_CTX saved_sm3_ctx;
|
||||
SDF_PRIVATE_KEY key;
|
||||
} SDF_SIGN_CTX;
|
||||
|
||||
|
||||
int sdf_load_library(const char *so_path, const char *vendor);
|
||||
int sdf_open_device(SDF_DEVICE *dev);
|
||||
int sdf_print_device_info(FILE *fp, int fmt, int ind, const char *lable, SDF_DEVICE *dev);
|
||||
int sdf_rand_bytes(SDF_DEVICE *dev, uint8_t *buf, size_t len);
|
||||
int sdf_load_sign_key(SDF_DEVICE *dev, SDF_KEY *key, int index, const char *pass);
|
||||
int sdf_sign(SDF_KEY *key, const uint8_t dgst[32], uint8_t *sig, size_t *siglen);
|
||||
int sdf_release_key(SDF_KEY *key);
|
||||
int sdf_digest_init(SDF_DIGEST_CTX *ctx, SDF_DEVICE *dev);
|
||||
int sdf_digest_update(SDF_DIGEST_CTX *ctx, const uint8_t *data, size_t datalen);
|
||||
int sdf_digest_finish(SDF_DIGEST_CTX *ctx, uint8_t dgst[SM3_DIGEST_SIZE]);
|
||||
int sdf_digest_reset(SDF_DIGEST_CTX *ctx);
|
||||
int sdf_digest_cleanup(SDF_DIGEST_CTX *ctx);
|
||||
int sdf_generate_key(SDF_DEVICE *dev, SDF_KEY *key, const SM2_KEY *sm2_key, uint8_t *wrappedkey, size_t *wrappedkey_len);
|
||||
int sdf_import_key(SDF_DEVICE *dev, unsigned int key_index, const char *pass, const uint8_t *wrappedkey, size_t wrappedkey_len, SDF_KEY *key); // XXX: Is `pass` needed? see impl in sdf.c
|
||||
int sdf_cbc_encrypt_init(SDF_CBC_CTX *ctx, const SDF_KEY *key, const uint8_t iv[16]);
|
||||
int sdf_cbc_encrypt_update(SDF_CBC_CTX *ctx, const uint8_t *in, size_t inlen, uint8_t *out, size_t *outlen);
|
||||
int sdf_cbc_encrypt_finish(SDF_CBC_CTX *ctx, uint8_t *out, size_t *outlen);
|
||||
int sdf_cbc_decrypt_init(SDF_CBC_CTX *ctx, const SDF_KEY *key, const uint8_t iv[16]);
|
||||
int sdf_cbc_decrypt_update(SDF_CBC_CTX *ctx, const uint8_t *in, size_t inlen, uint8_t *out, size_t *outlen);
|
||||
int sdf_cbc_decrypt_finish(SDF_CBC_CTX *ctx, uint8_t *out, size_t *outlen);
|
||||
int sdf_destroy_key(SDF_KEY *key);
|
||||
int sdf_export_sign_public_key(SDF_DEVICE *dev, int key_index, SM2_KEY *public_key);
|
||||
int sdf_export_encrypt_public_key(SDF_DEVICE *dev, int key_index, SM2_KEY *public_key);
|
||||
int sdf_load_private_key(SDF_DEVICE *dev, SDF_PRIVATE_KEY *key, int key_index, const char *pass);
|
||||
int sdf_decrypt(const SDF_PRIVATE_KEY *key, const uint8_t *in, size_t inlen, uint8_t *out, size_t *outlen);
|
||||
int sdf_sign(const SDF_PRIVATE_KEY *key, const uint8_t dgst[32], uint8_t *sig, size_t *siglen);
|
||||
int sdf_sign_init(SDF_SIGN_CTX *ctx, const SDF_PRIVATE_KEY *key, const char *id, size_t idlen);
|
||||
int sdf_sign_update(SDF_SIGN_CTX *ctx, const uint8_t *data, size_t datalen);
|
||||
int sdf_sign_finish(SDF_SIGN_CTX *ctx, uint8_t *sig, size_t *siglen);
|
||||
int sdf_sign_reset(SDF_SIGN_CTX *ctx);
|
||||
int sdf_release_private_key(SDF_PRIVATE_KEY *key);
|
||||
int sdf_close_device(SDF_DEVICE *dev);
|
||||
void sdf_unload_library(void);
|
||||
|
||||
|
||||
3
thirdparty/GmSSL-3.1.1/include/gmssl/sha1.h
vendored
3
thirdparty/GmSSL-3.1.1/include/gmssl/sha1.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.
|
||||
@@ -36,7 +36,6 @@ typedef struct {
|
||||
void sha1_init(SHA1_CTX *ctx);
|
||||
void sha1_update(SHA1_CTX *ctx, const uint8_t *data, size_t datalen);
|
||||
void sha1_finish(SHA1_CTX *ctx, uint8_t dgst[SHA1_DIGEST_SIZE]);
|
||||
void sha1_digest(const uint8_t *data, size_t datalen, uint8_t dgst[SHA1_DIGEST_SIZE]);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
10
thirdparty/GmSSL-3.1.1/include/gmssl/sha2.h
vendored
10
thirdparty/GmSSL-3.1.1/include/gmssl/sha2.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.
|
||||
@@ -38,8 +38,6 @@ typedef struct {
|
||||
void sha224_init(SHA224_CTX *ctx);
|
||||
void sha224_update(SHA224_CTX *ctx, const uint8_t* data, size_t datalen);
|
||||
void sha224_finish(SHA224_CTX *ctx, uint8_t dgst[SHA224_DIGEST_SIZE]);
|
||||
void sha224_digest(const uint8_t *data, size_t datalen,
|
||||
uint8_t dgst[SHA224_DIGEST_SIZE]);
|
||||
|
||||
|
||||
#define SHA256_DIGEST_SIZE 32
|
||||
@@ -56,8 +54,6 @@ typedef struct {
|
||||
void sha256_init(SHA256_CTX *ctx);
|
||||
void sha256_update(SHA256_CTX *ctx, const uint8_t* data, size_t datalen);
|
||||
void sha256_finish(SHA256_CTX *ctx, uint8_t dgst[SHA256_DIGEST_SIZE]);
|
||||
void sha256_digest(const uint8_t *data, size_t datalen,
|
||||
uint8_t dgst[SHA256_DIGEST_SIZE]);
|
||||
|
||||
|
||||
#define SHA384_DIGEST_SIZE 48
|
||||
@@ -74,8 +70,6 @@ typedef struct {
|
||||
void sha384_init(SHA384_CTX *ctx);
|
||||
void sha384_update(SHA384_CTX *ctx, const uint8_t* data, size_t datalen);
|
||||
void sha384_finish(SHA384_CTX *ctx, uint8_t dgst[SHA384_DIGEST_SIZE]);
|
||||
void sha384_digest(const uint8_t *data, size_t datalen,
|
||||
uint8_t dgst[SHA384_DIGEST_SIZE]);
|
||||
|
||||
|
||||
#define SHA512_DIGEST_SIZE 64
|
||||
@@ -92,8 +86,6 @@ typedef struct {
|
||||
void sha512_init(SHA512_CTX *ctx);
|
||||
void sha512_update(SHA512_CTX *ctx, const uint8_t* data, size_t datalen);
|
||||
void sha512_finish(SHA512_CTX *ctx, uint8_t dgst[SHA512_DIGEST_SIZE]);
|
||||
void sha512_digest(const uint8_t *data, size_t datalen,
|
||||
uint8_t dgst[SHA512_DIGEST_SIZE]);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
92
thirdparty/GmSSL-3.1.1/include/gmssl/sha3.h
vendored
92
thirdparty/GmSSL-3.1.1/include/gmssl/sha3.h
vendored
@@ -1,92 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014-2022 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.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef GMSSL_SHA3_H
|
||||
#define GMSSL_SHA3_H
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#define SHA3_KECCAK_P_SIZE (1600/8)
|
||||
|
||||
#define SHA3_224_DIGEST_SIZE (224/8)
|
||||
#define SHA3_256_DIGEST_SIZE (256/8)
|
||||
#define SHA3_384_DIGEST_SIZE (384/8)
|
||||
#define SHA3_512_DIGEST_SIZE (512/8)
|
||||
|
||||
#define SHA3_224_CAPACITY (SHA3_224_DIGEST_SIZE * 2)
|
||||
#define SHA3_256_CAPACITY (SHA3_256_DIGEST_SIZE * 2)
|
||||
#define SHA3_384_CAPACITY (SHA3_384_DIGEST_SIZE * 2)
|
||||
#define SHA3_512_CAPACITY (SHA3_512_DIGEST_SIZE * 2)
|
||||
|
||||
#define SHA3_224_BLOCK_SIZE (SHA3_KECCAK_P_SIZE - SHA3_224_CAPACITY) // 144
|
||||
#define SHA3_256_BLOCK_SIZE (SHA3_KECCAK_P_SIZE - SHA3_224_CAPACITY) // 136
|
||||
#define SHA3_384_BLOCK_SIZE (SHA3_KECCAK_P_SIZE - SHA3_224_CAPACITY) // 104
|
||||
#define SHA3_512_BLOCK_SIZE (SHA3_KECCAK_P_SIZE - SHA3_224_CAPACITY) // 72
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint64_t A[5][5];
|
||||
uint8_t buf[SHA3_224_BLOCK_SIZE];
|
||||
int num;
|
||||
} SHA3_224_CTX;
|
||||
|
||||
void sha3_224_init(SHA3_224_CTX *ctx);
|
||||
void sha3_224_update(SHA3_224_CTX *ctx, const uint8_t *data, size_t datalen);
|
||||
void sha3_224_finish(SHA3_224_CTX *ctx, uint8_t dgst[SHA3_224_DIGEST_SIZE]);
|
||||
|
||||
typedef struct {
|
||||
uint64_t A[5][5];
|
||||
uint8_t buf[SHA3_256_BLOCK_SIZE];
|
||||
int num;
|
||||
} SHA3_256_CTX;
|
||||
|
||||
void sha3_256_init(SHA3_256_CTX *ctx);
|
||||
void sha3_256_update(SHA3_256_CTX *ctx, const uint8_t *data, size_t datalen);
|
||||
void sha3_256_finish(SHA3_256_CTX *ctx, uint8_t dgst[SHA3_256_DIGEST_SIZE]);
|
||||
|
||||
typedef struct {
|
||||
uint64_t A[5][5];
|
||||
uint8_t buf[SHA3_384_BLOCK_SIZE];
|
||||
int num;
|
||||
} SHA3_384_CTX;
|
||||
|
||||
void sha3_384_init(SHA3_384_CTX *ctx);
|
||||
void sha3_384_update(SHA3_384_CTX *ctx, const uint8_t *data, size_t datalen);
|
||||
void sha3_384_finish(SHA3_384_CTX *ctx, uint8_t dgst[SHA3_384_DIGEST_SIZE]);
|
||||
|
||||
typedef struct {
|
||||
uint64_t A[5][5];
|
||||
uint8_t buf[SHA3_512_BLOCK_SIZE];
|
||||
int num;
|
||||
} SHA3_512_CTX;
|
||||
|
||||
void sha3_512_init(SHA3_512_CTX *ctx);
|
||||
void sha3_512_update(SHA3_512_CTX *ctx, const uint8_t *data, size_t datalen);
|
||||
void sha3_512_finish(SHA3_512_CTX *ctx, uint8_t dgst[SHA3_512_DIGEST_SIZE]);
|
||||
|
||||
void sha3_shake128(const uint8_t *in, size_t *inlen, size_t outlen, uint8_t *out);
|
||||
void sha3_shake256(const uint8_t *in, size_t *inlen, size_t outlen, uint8_t *out);
|
||||
void sha3_keccak_p(uint8_t state[SHA3_KECCAK_P_SIZE]);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
38
thirdparty/GmSSL-3.1.1/include/gmssl/skf.h
vendored
38
thirdparty/GmSSL-3.1.1/include/gmssl/skf.h
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2022 The GmSSL Project. All Rights Reserved.
|
||||
* Copyright 2014-2023 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.
|
||||
@@ -22,42 +22,6 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
SKF Public API
|
||||
|
||||
skf_load_library
|
||||
skf_unload_library
|
||||
skf_list_devices
|
||||
skf_print_device_info
|
||||
|
||||
SKF_DEVICE
|
||||
skf_open_device
|
||||
skf_close_deivce
|
||||
skf_set_label
|
||||
skf_change_authkey
|
||||
skf_list_apps
|
||||
skf_create_app
|
||||
skf_delete_app
|
||||
skf_change_app_admin_pin
|
||||
skf_change_app_user_pin
|
||||
skf_unblock_user_pin
|
||||
skf_list_objects
|
||||
skf_import_object
|
||||
skf_export_object
|
||||
skf_delete_object
|
||||
skf_list_containers
|
||||
skf_create_container
|
||||
skf_delete_container
|
||||
skf_import_sign_cert
|
||||
skf_export_sign_cert
|
||||
skf_rand_bytes
|
||||
skf_load_sign_key
|
||||
|
||||
SKF_KEY
|
||||
skf_sign
|
||||
skf_release_key
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
void *handle;
|
||||
char manufacturer[65];
|
||||
|
||||
311
thirdparty/GmSSL-3.1.1/include/gmssl/sm2.h
vendored
311
thirdparty/GmSSL-3.1.1/include/gmssl/sm2.h
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2023 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.
|
||||
@@ -16,205 +16,34 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <gmssl/sm3.h>
|
||||
#include <gmssl/api.h>
|
||||
#include <gmssl/sm2_z256.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
SM2 Public API
|
||||
|
||||
SM2_DEFAULT_ID
|
||||
SM2_MAX_ID_LENGTH
|
||||
SM2_MAX_SIGNATURE_SIZE
|
||||
SM2_MAX_PLAINTEXT_SIZE
|
||||
SM2_MAX_CIPHERTEXT_SIZE
|
||||
|
||||
SM2_KEY
|
||||
sm2_key_generate
|
||||
sm2_private_key_info_encrypt_to_der
|
||||
sm2_private_key_info_decrypt_from_der
|
||||
sm2_private_key_info_encrypt_to_pem
|
||||
sm2_private_key_info_decrypt_from_pem
|
||||
sm2_public_key_info_to_der
|
||||
sm2_public_key_info_from_der
|
||||
sm2_public_key_info_to_pem
|
||||
sm2_public_key_info_from_pem
|
||||
|
||||
sm2_sign
|
||||
sm2_verify
|
||||
sm2_encrypt
|
||||
sm2_decrypt
|
||||
sm2_ecdh
|
||||
|
||||
SM2_SIGN_CTX
|
||||
sm2_sign_init
|
||||
sm2_sign_update
|
||||
sm2_sign_finish
|
||||
sm2_verify_init
|
||||
sm2_verify_update
|
||||
sm2_verify_finish
|
||||
*/
|
||||
|
||||
typedef uint64_t SM2_BN[8];
|
||||
|
||||
int sm2_bn_is_zero(const SM2_BN a);
|
||||
int sm2_bn_is_one(const SM2_BN a);
|
||||
int sm2_bn_is_odd(const SM2_BN a);
|
||||
int sm2_bn_cmp(const SM2_BN a, const SM2_BN b);
|
||||
int sm2_bn_from_hex(SM2_BN r, const char hex[64]);
|
||||
int sm2_bn_from_asn1_integer(SM2_BN r, const uint8_t *d, size_t dlen);
|
||||
int sm2_bn_equ_hex(const SM2_BN a, const char *hex);
|
||||
int sm2_bn_print(FILE *fp, int fmt, int ind, const char *label, const SM2_BN a);
|
||||
int sm2_bn_rshift(SM2_BN ret, const SM2_BN a, unsigned int nbits);
|
||||
|
||||
void sm2_bn_to_bytes(const SM2_BN a, uint8_t out[32]);
|
||||
void sm2_bn_from_bytes(SM2_BN r, const uint8_t in[32]);
|
||||
void sm2_bn_to_hex(const SM2_BN a, char hex[64]);
|
||||
void sm2_bn_to_bits(const SM2_BN a, char bits[256]);
|
||||
void sm2_bn_set_word(SM2_BN r, uint32_t a);
|
||||
void sm2_bn_add(SM2_BN r, const SM2_BN a, const SM2_BN b);
|
||||
void sm2_bn_sub(SM2_BN ret, const SM2_BN a, const SM2_BN b);
|
||||
int sm2_bn_rand_range(SM2_BN r, const SM2_BN range);
|
||||
|
||||
#define sm2_bn_init(r) memset((r),0,sizeof(SM2_BN))
|
||||
#define sm2_bn_set_zero(r) memset((r),0,sizeof(SM2_BN))
|
||||
#define sm2_bn_set_one(r) sm2_bn_set_word((r),1)
|
||||
#define sm2_bn_copy(r,a) memcpy((r),(a),sizeof(SM2_BN))
|
||||
#define sm2_bn_clean(r) memset((r),0,sizeof(SM2_BN))
|
||||
|
||||
|
||||
// GF(p)
|
||||
typedef SM2_BN SM2_Fp;
|
||||
|
||||
void sm2_fp_add(SM2_Fp r, const SM2_Fp a, const SM2_Fp b);
|
||||
void sm2_fp_sub(SM2_Fp r, const SM2_Fp a, const SM2_Fp b);
|
||||
void sm2_fp_mul(SM2_Fp r, const SM2_Fp a, const SM2_Fp b);
|
||||
void sm2_fp_exp(SM2_Fp r, const SM2_Fp a, const SM2_Fp e);
|
||||
void sm2_fp_dbl(SM2_Fp r, const SM2_Fp a);
|
||||
void sm2_fp_tri(SM2_Fp r, const SM2_Fp a);
|
||||
void sm2_fp_div2(SM2_Fp r, const SM2_Fp a);
|
||||
void sm2_fp_neg(SM2_Fp r, const SM2_Fp a);
|
||||
void sm2_fp_sqr(SM2_Fp r, const SM2_Fp a);
|
||||
void sm2_fp_inv(SM2_Fp r, const SM2_Fp a);
|
||||
int sm2_fp_rand(SM2_Fp r);
|
||||
|
||||
int sm2_fp_sqrt(SM2_Fp r, const SM2_Fp a);
|
||||
|
||||
#define sm2_fp_init(r) sm2_bn_init(r)
|
||||
#define sm2_fp_set_zero(r) sm2_bn_set_zero(r)
|
||||
#define sm2_fp_set_one(r) sm2_bn_set_one(r)
|
||||
#define sm2_fp_copy(r,a) sm2_bn_copy(r,a)
|
||||
#define sm2_fp_clean(r) sm2_bn_clean(r)
|
||||
|
||||
// GF(n)
|
||||
typedef SM2_BN SM2_Fn;
|
||||
|
||||
void sm2_fn_add(SM2_Fn r, const SM2_Fn a, const SM2_Fn b);
|
||||
void sm2_fn_sub(SM2_Fn r, const SM2_Fn a, const SM2_Fn b);
|
||||
void sm2_fn_mul(SM2_Fn r, const SM2_Fn a, const SM2_Fn b);
|
||||
void sm2_fn_mul_word(SM2_Fn r, const SM2_Fn a, uint32_t b);
|
||||
void sm2_fn_exp(SM2_Fn r, const SM2_Fn a, const SM2_Fn e);
|
||||
void sm2_fn_neg(SM2_Fn r, const SM2_Fn a);
|
||||
void sm2_fn_sqr(SM2_Fn r, const SM2_Fn a);
|
||||
void sm2_fn_inv(SM2_Fn r, const SM2_Fn a);
|
||||
int sm2_fn_rand(SM2_Fn r);
|
||||
|
||||
#define sm2_fn_init(r) sm2_bn_init(r)
|
||||
#define sm2_fn_set_zero(r) sm2_bn_set_zero(r)
|
||||
#define sm2_fn_set_one(r) sm2_bn_set_one(r)
|
||||
#define sm2_fn_copy(r,a) sm2_bn_copy(r,a)
|
||||
#define sm2_fn_clean(r) sm2_bn_clean(r)
|
||||
|
||||
|
||||
typedef struct {
|
||||
SM2_BN X;
|
||||
SM2_BN Y;
|
||||
SM2_BN Z;
|
||||
} SM2_JACOBIAN_POINT;
|
||||
|
||||
void sm2_jacobian_point_init(SM2_JACOBIAN_POINT *R);
|
||||
void sm2_jacobian_point_set_xy(SM2_JACOBIAN_POINT *R, const SM2_BN x, const SM2_BN y);
|
||||
void sm2_jacobian_point_get_xy(const SM2_JACOBIAN_POINT *P, SM2_BN x, SM2_BN y);
|
||||
void sm2_jacobian_point_neg(SM2_JACOBIAN_POINT *R, const SM2_JACOBIAN_POINT *P);
|
||||
void sm2_jacobian_point_dbl(SM2_JACOBIAN_POINT *R, const SM2_JACOBIAN_POINT *P);
|
||||
void sm2_jacobian_point_add(SM2_JACOBIAN_POINT *R, const SM2_JACOBIAN_POINT *P, const SM2_JACOBIAN_POINT *Q);
|
||||
void sm2_jacobian_point_sub(SM2_JACOBIAN_POINT *R, const SM2_JACOBIAN_POINT *P, const SM2_JACOBIAN_POINT *Q);
|
||||
void sm2_jacobian_point_mul(SM2_JACOBIAN_POINT *R, const SM2_BN k, const SM2_JACOBIAN_POINT *P);
|
||||
void sm2_jacobian_point_to_bytes(const SM2_JACOBIAN_POINT *P, uint8_t out[64]);
|
||||
void sm2_jacobian_point_from_bytes(SM2_JACOBIAN_POINT *P, const uint8_t in[64]);
|
||||
void sm2_jacobian_point_mul_generator(SM2_JACOBIAN_POINT *R, const SM2_BN k);
|
||||
void sm2_jacobian_point_mul_sum(SM2_JACOBIAN_POINT *R, const SM2_BN t, const SM2_JACOBIAN_POINT *P, const SM2_BN s);
|
||||
void sm2_jacobian_point_from_hex(SM2_JACOBIAN_POINT *P, const char hex[64 * 2]); // for testing only
|
||||
|
||||
int sm2_jacobian_point_is_at_infinity(const SM2_JACOBIAN_POINT *P);
|
||||
int sm2_jacobian_point_is_on_curve(const SM2_JACOBIAN_POINT *P);
|
||||
int sm2_jacobian_point_equ_hex(const SM2_JACOBIAN_POINT *P, const char hex[128]); // for testing only
|
||||
int sm2_jacobian_point_print(FILE *fp, int fmt, int ind, const char *label, const SM2_JACOBIAN_POINT *P);
|
||||
|
||||
#define sm2_jacobian_point_set_infinity(R) sm2_jacobian_point_init(R)
|
||||
#define sm2_jacobian_point_copy(R, P) memcpy((R), (P), sizeof(SM2_JACOBIAN_POINT))
|
||||
|
||||
typedef uint8_t sm2_bn_t[32];
|
||||
|
||||
typedef struct {
|
||||
uint8_t x[32];
|
||||
uint8_t y[32];
|
||||
} SM2_POINT;
|
||||
|
||||
#define sm2_point_init(P) memset((P),0,sizeof(SM2_POINT))
|
||||
#define sm2_point_set_infinity(P) sm2_point_init(P)
|
||||
int sm2_point_from_octets(SM2_POINT *P, const uint8_t *in, size_t inlen);
|
||||
void sm2_point_to_compressed_octets(const SM2_POINT *P, uint8_t out[33]);
|
||||
void sm2_point_to_uncompressed_octets(const SM2_POINT *P, uint8_t out[65]);
|
||||
|
||||
int sm2_point_from_x(SM2_POINT *P, const uint8_t x[32], int y);
|
||||
int sm2_point_from_xy(SM2_POINT *P, const uint8_t x[32], const uint8_t y[32]);
|
||||
int sm2_point_is_on_curve(const SM2_POINT *P);
|
||||
int sm2_point_is_at_infinity(const SM2_POINT *P);
|
||||
int sm2_point_add(SM2_POINT *R, const SM2_POINT *P, const SM2_POINT *Q);
|
||||
int sm2_point_sub(SM2_POINT *R, const SM2_POINT *P, const SM2_POINT *Q);
|
||||
int sm2_point_neg(SM2_POINT *R, const SM2_POINT *P);
|
||||
int sm2_point_dbl(SM2_POINT *R, const SM2_POINT *P);
|
||||
int sm2_point_mul(SM2_POINT *R, const uint8_t k[32], const SM2_POINT *P);
|
||||
int sm2_point_mul_generator(SM2_POINT *R, const uint8_t k[32]);
|
||||
int sm2_point_mul_sum(SM2_POINT *R, const uint8_t k[32], const SM2_POINT *P, const uint8_t s[32]); // R = k * P + s * G
|
||||
|
||||
/*
|
||||
RFC 5480 Elliptic Curve Cryptography Subject Public Key Information
|
||||
ECPoint ::= OCTET STRING
|
||||
*/
|
||||
#define SM2_POINT_MAX_SIZE (2 + 65)
|
||||
int sm2_point_to_der(const SM2_POINT *P, uint8_t **out, size_t *outlen);
|
||||
int sm2_point_from_der(SM2_POINT *P, const uint8_t **in, size_t *inlen);
|
||||
int sm2_point_print(FILE *fp, int fmt, int ind, const char *label, const SM2_POINT *P);
|
||||
int sm2_point_from_hash(SM2_POINT *R, const uint8_t *data, size_t datalen);
|
||||
|
||||
|
||||
typedef struct {
|
||||
SM2_POINT public_key;
|
||||
uint8_t private_key[32];
|
||||
SM2_Z256_POINT public_key;
|
||||
sm2_z256_t private_key;
|
||||
} SM2_KEY;
|
||||
|
||||
|
||||
_gmssl_export int sm2_key_generate(SM2_KEY *key);
|
||||
int sm2_key_set_private_key(SM2_KEY *key, const uint8_t private_key[32]); // key->public_key will be replaced
|
||||
int sm2_key_set_public_key(SM2_KEY *key, const SM2_POINT *public_key); // key->private_key will be cleared // FIXME: support octets as input?
|
||||
int sm2_key_generate(SM2_KEY *key);
|
||||
int sm2_key_print(FILE *fp, int fmt, int ind, const char *label, const SM2_KEY *key);
|
||||
int sm2_key_set_private_key(SM2_KEY *key, const sm2_z256_t private_key);
|
||||
int sm2_key_set_public_key(SM2_KEY *key, const SM2_Z256_POINT *public_key);
|
||||
|
||||
int sm2_public_key_equ(const SM2_KEY *sm2_key, const SM2_KEY *pub_key);
|
||||
//int sm2_public_key_copy(SM2_KEY *sm2_key, const SM2_KEY *pub_key); // do we need this?
|
||||
int sm2_public_key_digest(const SM2_KEY *key, uint8_t dgst[32]);
|
||||
int sm2_public_key_print(FILE *fp, int fmt, int ind, const char *label, const SM2_KEY *pub_key);
|
||||
|
||||
|
||||
/*
|
||||
from RFC 5915
|
||||
|
||||
ECPrivateKey ::= SEQUENCE {
|
||||
version INTEGER, -- value MUST be (1)
|
||||
privateKey OCTET STRING, -- big endian encoding of integer 这里不是以INTEGER编码的,因此长度固定
|
||||
privateKey OCTET STRING, -- big endian encoding of integer, fixed length
|
||||
parameters [0] EXPLICIT ECParameters OPTIONAL,
|
||||
-- ONLY namedCurve OID is permitted, by RFC 5480
|
||||
-- MUST always include this field, by RFC 5915
|
||||
@@ -247,10 +76,10 @@ SubjectPublicKeyInfo ::= SEQUENCE {
|
||||
algorithm AlgorithmIdentifier,
|
||||
subjectPublicKey BIT STRING -- uncompressed octets of ECPoint }
|
||||
*/
|
||||
_gmssl_export int sm2_public_key_info_to_der(const SM2_KEY *a, uint8_t **out, size_t *outlen);
|
||||
_gmssl_export int sm2_public_key_info_from_der(SM2_KEY *a, const uint8_t **in, size_t *inlen);
|
||||
_gmssl_export int sm2_public_key_info_to_pem(const SM2_KEY *a, FILE *fp);
|
||||
_gmssl_export int sm2_public_key_info_from_pem(SM2_KEY *a, FILE *fp);
|
||||
int sm2_public_key_info_to_der(const SM2_KEY *a, uint8_t **out, size_t *outlen);
|
||||
int sm2_public_key_info_from_der(SM2_KEY *a, const uint8_t **in, size_t *inlen);
|
||||
int sm2_public_key_info_to_pem(const SM2_KEY *a, FILE *fp);
|
||||
int sm2_public_key_info_from_pem(SM2_KEY *a, FILE *fp);
|
||||
|
||||
/*
|
||||
PKCS #8 PrivateKeyInfo from RFC 5208
|
||||
@@ -278,13 +107,14 @@ EncryptedPrivateKeyInfo ::= SEQUENCE {
|
||||
encryptionAlgorithm EncryptionAlgorithmIdentifier, -- id-PBES2
|
||||
encryptedData OCTET STRING }
|
||||
*/
|
||||
_gmssl_export int sm2_private_key_info_encrypt_to_der(const SM2_KEY *key,
|
||||
int sm2_private_key_info_encrypt_to_der(const SM2_KEY *key,
|
||||
const char *pass, uint8_t **out, size_t *outlen);
|
||||
_gmssl_export int sm2_private_key_info_decrypt_from_der(SM2_KEY *key, const uint8_t **attrs, size_t *attrs_len,
|
||||
int sm2_private_key_info_decrypt_from_der(SM2_KEY *key, const uint8_t **attrs, size_t *attrs_len,
|
||||
const char *pass, const uint8_t **in, size_t *inlen);
|
||||
_gmssl_export int sm2_private_key_info_encrypt_to_pem(const SM2_KEY *key, const char *pass, FILE *fp);
|
||||
int sm2_private_key_info_encrypt_to_pem(const SM2_KEY *key, const char *pass, FILE *fp);
|
||||
// FIXME: #define default buffer size
|
||||
_gmssl_export int sm2_private_key_info_decrypt_from_pem(SM2_KEY *key, const char *pass, FILE *fp);
|
||||
int sm2_private_key_info_decrypt_from_pem(SM2_KEY *key, const char *pass, FILE *fp);
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
@@ -293,17 +123,31 @@ typedef struct {
|
||||
} SM2_SIGNATURE;
|
||||
|
||||
int sm2_do_sign(const SM2_KEY *key, const uint8_t dgst[32], SM2_SIGNATURE *sig);
|
||||
int sm2_do_sign_fast(const SM2_Fn d, const uint8_t dgst[32], SM2_SIGNATURE *sig);
|
||||
int sm2_do_verify(const SM2_KEY *key, const uint8_t dgst[32], const SM2_SIGNATURE *sig);
|
||||
|
||||
int sm2_fast_sign_compute_key(const SM2_KEY *key, sm2_z256_t fast_private);
|
||||
|
||||
typedef struct {
|
||||
sm2_z256_t k;
|
||||
sm2_z256_t x1_modn;
|
||||
} SM2_SIGN_PRE_COMP;
|
||||
|
||||
#define SM2_SIGN_PRE_COMP_COUNT 32
|
||||
|
||||
int sm2_fast_sign_pre_compute(SM2_SIGN_PRE_COMP pre_comp[32]);
|
||||
int sm2_fast_sign(const sm2_z256_t fast_private, SM2_SIGN_PRE_COMP *pre_comp,
|
||||
const uint8_t dgst[32], SM2_SIGNATURE *sig);
|
||||
int sm2_fast_verify(const SM2_Z256_POINT point_table[16],
|
||||
const uint8_t dgst[32], const SM2_SIGNATURE *sig);
|
||||
|
||||
|
||||
#define SM2_MIN_SIGNATURE_SIZE 8
|
||||
#define SM2_MAX_SIGNATURE_SIZE 72
|
||||
int sm2_signature_to_der(const SM2_SIGNATURE *sig, uint8_t **out, size_t *outlen);
|
||||
int sm2_signature_from_der(SM2_SIGNATURE *sig, const uint8_t **in, size_t *inlen);
|
||||
int sm2_signature_print(FILE *fp, int fmt, int ind, const char *label, const uint8_t *sig, size_t siglen);
|
||||
_gmssl_export int sm2_sign(const SM2_KEY *key, const uint8_t dgst[32], uint8_t *sig, size_t *siglen);
|
||||
_gmssl_export int sm2_verify(const SM2_KEY *key, const uint8_t dgst[32], const uint8_t *sig, size_t siglen);
|
||||
int sm2_sign(const SM2_KEY *key, const uint8_t dgst[32], uint8_t *sig, size_t *siglen);
|
||||
int sm2_verify(const SM2_KEY *key, const uint8_t dgst[32], const uint8_t *sig, size_t siglen);
|
||||
|
||||
enum {
|
||||
SM2_signature_compact_size = 70,
|
||||
@@ -312,28 +156,48 @@ enum {
|
||||
};
|
||||
int sm2_sign_fixlen(const SM2_KEY *key, const uint8_t dgst[32], size_t siglen, uint8_t *sig);
|
||||
|
||||
|
||||
|
||||
#define SM2_DEFAULT_ID "1234567812345678"
|
||||
#define SM2_DEFAULT_ID_LENGTH (sizeof(SM2_DEFAULT_ID) - 1) // LENGTH for string and SIZE for bytes
|
||||
#define SM2_DEFAULT_ID_BITS (SM2_DEFAULT_ID_LENGTH * 8)
|
||||
#define SM2_MAX_ID_BITS 65535
|
||||
#define SM2_MAX_ID_LENGTH (SM2_MAX_ID_BITS/8)
|
||||
|
||||
int sm2_compute_z(uint8_t z[32], const SM2_POINT *pub, const char *id, size_t idlen);
|
||||
int sm2_compute_z(uint8_t z[32], const SM2_Z256_POINT *pub, const char *id, size_t idlen);
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
SM3_CTX sm3_ctx;
|
||||
SM3_CTX saved_sm3_ctx;
|
||||
SM2_KEY key;
|
||||
sm2_z256_t fast_sign_private;
|
||||
SM2_SIGN_PRE_COMP pre_comp[SM2_SIGN_PRE_COMP_COUNT];
|
||||
unsigned int num_pre_comp;
|
||||
|
||||
// verify public point table, P, 2P, ..., 16P
|
||||
SM2_Z256_POINT public_point_table[16];
|
||||
} SM2_SIGN_CTX;
|
||||
|
||||
_gmssl_export int sm2_sign_init(SM2_SIGN_CTX *ctx, const SM2_KEY *key, const char *id, size_t idlen);
|
||||
_gmssl_export int sm2_sign_update(SM2_SIGN_CTX *ctx, const uint8_t *data, size_t datalen);
|
||||
_gmssl_export int sm2_sign_finish(SM2_SIGN_CTX *ctx, uint8_t *sig, size_t *siglen);
|
||||
int sm2_sign_init(SM2_SIGN_CTX *ctx, const SM2_KEY *key, const char *id, size_t idlen);
|
||||
int sm2_sign_update(SM2_SIGN_CTX *ctx, const uint8_t *data, size_t datalen);
|
||||
int sm2_sign_finish(SM2_SIGN_CTX *ctx, uint8_t *sig, size_t *siglen);
|
||||
int sm2_sign_reset(SM2_SIGN_CTX *ctx);
|
||||
int sm2_sign_finish_fixlen(SM2_SIGN_CTX *ctx, size_t siglen, uint8_t *sig);
|
||||
|
||||
_gmssl_export int sm2_verify_init(SM2_SIGN_CTX *ctx, const SM2_KEY *key, const char *id, size_t idlen);
|
||||
_gmssl_export int sm2_verify_update(SM2_SIGN_CTX *ctx, const uint8_t *data, size_t datalen);
|
||||
_gmssl_export int sm2_verify_finish(SM2_SIGN_CTX *ctx, const uint8_t *sig, size_t siglen);
|
||||
typedef struct {
|
||||
SM3_CTX sm3_ctx;
|
||||
SM3_CTX saved_sm3_ctx;
|
||||
SM2_KEY key;
|
||||
SM2_Z256_POINT public_point_table[16];
|
||||
} SM2_VERIFY_CTX;
|
||||
|
||||
int sm2_verify_init(SM2_VERIFY_CTX *ctx, const SM2_KEY *key, const char *id, size_t idlen);
|
||||
int sm2_verify_update(SM2_VERIFY_CTX *ctx, const uint8_t *data, size_t datalen);
|
||||
int sm2_verify_finish(SM2_VERIFY_CTX *ctx, const uint8_t *sig, size_t siglen);
|
||||
int sm2_verify_reset(SM2_VERIFY_CTX *ctx);
|
||||
|
||||
|
||||
/*
|
||||
SM2Cipher ::= SEQUENCE {
|
||||
@@ -345,6 +209,11 @@ SM2Cipher ::= SEQUENCE {
|
||||
#define SM2_MIN_PLAINTEXT_SIZE 1 // re-compute SM2_MIN_CIPHERTEXT_SIZE when modify
|
||||
#define SM2_MAX_PLAINTEXT_SIZE 255 // re-compute SM2_MAX_CIPHERTEXT_SIZE when modify
|
||||
|
||||
typedef struct {
|
||||
uint8_t x[32];
|
||||
uint8_t y[32];
|
||||
} SM2_POINT;
|
||||
|
||||
typedef struct {
|
||||
SM2_POINT point;
|
||||
uint8_t hash[32];
|
||||
@@ -352,6 +221,9 @@ typedef struct {
|
||||
uint8_t ciphertext[SM2_MAX_PLAINTEXT_SIZE];
|
||||
} SM2_CIPHERTEXT;
|
||||
|
||||
|
||||
int sm2_kdf(const uint8_t *in, size_t inlen, size_t outlen, uint8_t *out);
|
||||
|
||||
int sm2_do_encrypt(const SM2_KEY *key, const uint8_t *in, size_t inlen, SM2_CIPHERTEXT *out);
|
||||
int sm2_do_decrypt(const SM2_KEY *key, const SM2_CIPHERTEXT *in, uint8_t *out, size_t *outlen);
|
||||
|
||||
@@ -360,8 +232,8 @@ int sm2_do_decrypt(const SM2_KEY *key, const SM2_CIPHERTEXT *in, uint8_t *out, s
|
||||
int sm2_ciphertext_to_der(const SM2_CIPHERTEXT *c, uint8_t **out, size_t *outlen);
|
||||
int sm2_ciphertext_from_der(SM2_CIPHERTEXT *c, const uint8_t **in, size_t *inlen);
|
||||
int sm2_ciphertext_print(FILE *fp, int fmt, int ind, const char *label, const uint8_t *a, size_t alen);
|
||||
_gmssl_export int sm2_encrypt(const SM2_KEY *key, const uint8_t *in, size_t inlen, uint8_t *out, size_t *outlen);
|
||||
_gmssl_export int sm2_decrypt(const SM2_KEY *key, const uint8_t *in, size_t inlen, uint8_t *out, size_t *outlen);
|
||||
int sm2_encrypt(const SM2_KEY *key, const uint8_t *in, size_t inlen, uint8_t *out, size_t *outlen);
|
||||
int sm2_decrypt(const SM2_KEY *key, const uint8_t *in, size_t inlen, uint8_t *out, size_t *outlen);
|
||||
|
||||
enum {
|
||||
SM2_ciphertext_compact_point_size = 68,
|
||||
@@ -372,8 +244,41 @@ int sm2_do_encrypt_fixlen(const SM2_KEY *key, const uint8_t *in, size_t inlen, i
|
||||
int sm2_encrypt_fixlen(const SM2_KEY *key, const uint8_t *in, size_t inlen, int point_size, uint8_t *out, size_t *outlen);
|
||||
|
||||
|
||||
int sm2_do_ecdh(const SM2_KEY *key, const SM2_POINT *peer_public, SM2_POINT *out);
|
||||
_gmssl_export int sm2_ecdh(const SM2_KEY *key, const uint8_t *peer_public, size_t peer_public_len, SM2_POINT *out);
|
||||
int sm2_do_ecdh(const SM2_KEY *key, const SM2_Z256_POINT *peer_public, SM2_Z256_POINT *out);
|
||||
int sm2_ecdh(const SM2_KEY *key, const uint8_t *peer_public, size_t peer_public_len, uint8_t out[64]);
|
||||
|
||||
|
||||
typedef struct {
|
||||
sm2_z256_t k;
|
||||
SM2_POINT C1;
|
||||
} SM2_ENC_PRE_COMP;
|
||||
|
||||
#define SM2_ENC_PRE_COMP_NUM 8
|
||||
int sm2_encrypt_pre_compute(SM2_ENC_PRE_COMP pre_comp[SM2_ENC_PRE_COMP_NUM]);
|
||||
int sm2_do_encrypt_ex(const SM2_KEY *key, const SM2_ENC_PRE_COMP *pre_comp,
|
||||
const uint8_t *in, size_t inlen, SM2_CIPHERTEXT *out);
|
||||
|
||||
typedef struct {
|
||||
SM2_ENC_PRE_COMP pre_comp[SM2_ENC_PRE_COMP_NUM];
|
||||
size_t pre_comp_num;
|
||||
uint8_t buf[SM2_MAX_PLAINTEXT_SIZE];
|
||||
size_t buf_size;
|
||||
} SM2_ENC_CTX;
|
||||
|
||||
int sm2_encrypt_init(SM2_ENC_CTX *ctx);
|
||||
int sm2_encrypt_update(SM2_ENC_CTX *ctx, const uint8_t *in, size_t inlen);
|
||||
int sm2_encrypt_finish(SM2_ENC_CTX *ctx, const SM2_KEY *public_key, uint8_t *out, size_t *outlen);
|
||||
int sm2_encrypt_reset(SM2_ENC_CTX *ctx);
|
||||
|
||||
typedef struct {
|
||||
uint8_t buf[SM2_MAX_CIPHERTEXT_SIZE];
|
||||
size_t buf_size;
|
||||
} SM2_DEC_CTX;
|
||||
|
||||
int sm2_decrypt_init(SM2_DEC_CTX *ctx);
|
||||
int sm2_decrypt_update(SM2_DEC_CTX *ctx, const uint8_t *in, size_t inlen);
|
||||
int sm2_decrypt_finish(SM2_DEC_CTX *ctx, const SM2_KEY *key, uint8_t *out, size_t *outlen);
|
||||
int sm2_decrypt_reset(SM2_DEC_CTX *ctx);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Copyright 2014-2022 The GmSSL Project. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Copyright 2014-2022 The GmSSL Project. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Copyright 2014-2022 The GmSSL Project. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
|
||||
156
thirdparty/GmSSL-3.1.1/include/gmssl/sm2_z256.h
vendored
Normal file
156
thirdparty/GmSSL-3.1.1/include/gmssl/sm2_z256.h
vendored
Normal file
@@ -0,0 +1,156 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
|
||||
#ifndef GMSSL_SM2_Z256_H
|
||||
#define GMSSL_SM2_Z256_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
// z256 means compact presentation of uint256
|
||||
typedef uint64_t sm2_z256_t[4];
|
||||
typedef uint64_t sm2_z512_t[8];
|
||||
|
||||
|
||||
void sm2_z256_set_one(sm2_z256_t r);
|
||||
void sm2_z256_set_zero(sm2_z256_t r);
|
||||
|
||||
int sm2_z256_rand_range(sm2_z256_t r, const sm2_z256_t range);
|
||||
void sm2_z256_copy(sm2_z256_t r, const sm2_z256_t a);
|
||||
void sm2_z256_copy_conditional(sm2_z256_t dst, const sm2_z256_t src, uint64_t move);
|
||||
void sm2_z256_from_bytes(sm2_z256_t r, const uint8_t in[32]);
|
||||
void sm2_z256_to_bytes(const sm2_z256_t a, uint8_t out[32]);
|
||||
int sm2_z256_cmp(const sm2_z256_t a, const sm2_z256_t b);
|
||||
uint64_t sm2_z256_is_zero(const sm2_z256_t a);
|
||||
uint64_t sm2_z256_equ(const sm2_z256_t a, const sm2_z256_t b);
|
||||
void sm2_z256_rshift(sm2_z256_t r, const sm2_z256_t a, unsigned int nbits);
|
||||
uint64_t sm2_z256_add(sm2_z256_t r, const sm2_z256_t a, const sm2_z256_t b);
|
||||
uint64_t sm2_z256_sub(sm2_z256_t r, const sm2_z256_t a, const sm2_z256_t b);
|
||||
void sm2_z256_mul(sm2_z512_t r, const sm2_z256_t a, const sm2_z256_t b);
|
||||
int sm2_z256_get_booth(const sm2_z256_t a, unsigned int window_size, int i);
|
||||
void sm2_z256_from_hex(sm2_z256_t r, const char *hex);
|
||||
int sm2_z256_equ_hex(const sm2_z256_t a, const char *hex);
|
||||
int sm2_z256_print(FILE *fp, int ind, int fmt, const char *label, const sm2_z256_t a);
|
||||
|
||||
void sm2_z256_modp_add(sm2_z256_t r, const sm2_z256_t a, const sm2_z256_t b);
|
||||
void sm2_z256_modp_dbl(sm2_z256_t r, const sm2_z256_t a);
|
||||
void sm2_z256_modp_tri(sm2_z256_t r, const sm2_z256_t a);
|
||||
void sm2_z256_modp_sub(sm2_z256_t r, const sm2_z256_t a, const sm2_z256_t b);
|
||||
void sm2_z256_modp_neg(sm2_z256_t r, const sm2_z256_t a);
|
||||
void sm2_z256_modp_haf(sm2_z256_t r, const sm2_z256_t a);
|
||||
|
||||
void sm2_z256_modp_to_mont(const sm2_z256_t a, sm2_z256_t r);
|
||||
void sm2_z256_modp_from_mont(sm2_z256_t r, const sm2_z256_t a);
|
||||
void sm2_z256_modp_mont_mul(sm2_z256_t r, const sm2_z256_t a, const sm2_z256_t b);
|
||||
void sm2_z256_modp_mont_sqr(sm2_z256_t r, const sm2_z256_t a);
|
||||
void sm2_z256_modp_mont_exp(sm2_z256_t r, const sm2_z256_t a, const sm2_z256_t e);
|
||||
void sm2_z256_modp_mont_inv(sm2_z256_t r, const sm2_z256_t a);
|
||||
int sm2_z256_modp_mont_sqrt(sm2_z256_t r, const sm2_z256_t a);
|
||||
|
||||
void sm2_z256_modn_add(sm2_z256_t r, const sm2_z256_t a, const sm2_z256_t b);
|
||||
void sm2_z256_modn_sub(sm2_z256_t r, const sm2_z256_t a, const sm2_z256_t b);
|
||||
void sm2_z256_modn_neg(sm2_z256_t r, const sm2_z256_t a);
|
||||
void sm2_z256_modn_mul(sm2_z256_t r, const sm2_z256_t a, const sm2_z256_t b);
|
||||
void sm2_z256_modn_sqr(sm2_z256_t r, const sm2_z256_t a);
|
||||
void sm2_z256_modn_exp(sm2_z256_t r, const sm2_z256_t a, const sm2_z256_t e);
|
||||
void sm2_z256_modn_inv(sm2_z256_t r, const sm2_z256_t a);
|
||||
|
||||
void sm2_z256_modn_to_mont(const sm2_z256_t a, sm2_z256_t r);
|
||||
void sm2_z256_modn_from_mont(sm2_z256_t r, const sm2_z256_t a);
|
||||
void sm2_z256_modn_mont_mul(sm2_z256_t r, const sm2_z256_t a, const sm2_z256_t b);
|
||||
void sm2_z256_modn_mont_sqr(sm2_z256_t r, const sm2_z256_t a);
|
||||
void sm2_z256_modn_mont_exp(sm2_z256_t r, const sm2_z256_t a, const sm2_z256_t e);
|
||||
void sm2_z256_modn_mont_inv(sm2_z256_t r, const sm2_z256_t a);
|
||||
|
||||
|
||||
typedef struct {
|
||||
sm2_z256_t X;
|
||||
sm2_z256_t Y;
|
||||
sm2_z256_t Z;
|
||||
} SM2_Z256_POINT;
|
||||
|
||||
void sm2_z256_point_set_infinity(SM2_Z256_POINT *P);
|
||||
int sm2_z256_point_is_at_infinity(const SM2_Z256_POINT *P);
|
||||
int sm2_z256_point_to_bytes(const SM2_Z256_POINT *P, uint8_t out[64]);
|
||||
int sm2_z256_point_from_bytes(SM2_Z256_POINT *P, const uint8_t in[64]);
|
||||
int sm2_z256_point_from_hex(SM2_Z256_POINT *P, const char *hex);
|
||||
int sm2_z256_point_equ_hex(const SM2_Z256_POINT *P, const char *hex);
|
||||
int sm2_z256_point_is_on_curve(const SM2_Z256_POINT *P);
|
||||
int sm2_z256_point_equ(const SM2_Z256_POINT *P, const SM2_Z256_POINT *Q); // equivalent jacobian points
|
||||
int sm2_z256_point_get_xy(const SM2_Z256_POINT *P, uint64_t x[4], uint64_t y[4]);
|
||||
|
||||
void sm2_z256_point_dbl(SM2_Z256_POINT *R, const SM2_Z256_POINT *A);
|
||||
void sm2_z256_point_add(SM2_Z256_POINT *r, const SM2_Z256_POINT *a, const SM2_Z256_POINT *b);
|
||||
void sm2_z256_point_neg(SM2_Z256_POINT *R, const SM2_Z256_POINT *P);
|
||||
void sm2_z256_point_sub(SM2_Z256_POINT *R, const SM2_Z256_POINT *A, const SM2_Z256_POINT *B);
|
||||
void sm2_z256_point_get_affine(const SM2_Z256_POINT *P, uint64_t x[4], uint64_t y[4]);
|
||||
int sm2_z256_point_print(FILE *fp, int fmt, int ind, const char *label, const SM2_Z256_POINT *P);
|
||||
|
||||
|
||||
typedef struct {
|
||||
sm2_z256_t x;
|
||||
sm2_z256_t y;
|
||||
} SM2_Z256_AFFINE_POINT;
|
||||
|
||||
void sm2_z256_point_copy_affine(SM2_Z256_POINT *R, const SM2_Z256_AFFINE_POINT *P);
|
||||
void sm2_z256_point_add_affine(SM2_Z256_POINT *r, const SM2_Z256_POINT *a, const SM2_Z256_AFFINE_POINT *b);
|
||||
void sm2_z256_point_sub_affine(SM2_Z256_POINT *R, const SM2_Z256_POINT *A, const SM2_Z256_AFFINE_POINT *B);
|
||||
int sm2_z256_point_affine_print(FILE *fp, int fmt, int ind, const char *label, const SM2_Z256_AFFINE_POINT *P);
|
||||
|
||||
void sm2_z256_point_mul_generator(SM2_Z256_POINT *R, const sm2_z256_t k);
|
||||
void sm2_z256_point_mul_pre_compute(const SM2_Z256_POINT *P, SM2_Z256_POINT T[16]);
|
||||
void sm2_z256_point_mul_ex(SM2_Z256_POINT *R, const sm2_z256_t k, const SM2_Z256_POINT P_table[16]);
|
||||
void sm2_z256_point_mul(SM2_Z256_POINT *R, const sm2_z256_t k, const SM2_Z256_POINT *P);
|
||||
void sm2_z256_point_mul_sum(SM2_Z256_POINT *R, const sm2_z256_t t, const SM2_Z256_POINT *P, const sm2_z256_t s);
|
||||
|
||||
|
||||
const uint64_t *sm2_z256_prime(void);
|
||||
const uint64_t *sm2_z256_order(void);
|
||||
const uint64_t *sm2_z256_order_minus_one(void);
|
||||
const uint64_t *sm2_z256_one(void);
|
||||
|
||||
|
||||
enum {
|
||||
SM2_point_at_infinity = 0x00,
|
||||
SM2_point_compressed_y_even = 0x02,
|
||||
SM2_point_compressed_y_odd = 0x03,
|
||||
SM2_point_uncompressed = 0x04,
|
||||
SM2_point_uncompressed_y_even = 0x06,
|
||||
SM2_point_uncompressed_y_odd = 0x07,
|
||||
};
|
||||
|
||||
int sm2_z256_point_from_x_bytes(SM2_Z256_POINT *P, const uint8_t x_bytes[32], int y_is_odd);
|
||||
int sm2_z256_point_from_hash(SM2_Z256_POINT *R, const uint8_t *data, size_t datalen, int y_is_odd);
|
||||
int sm2_z256_point_from_octets(SM2_Z256_POINT *P, const uint8_t *in, size_t inlen);
|
||||
|
||||
int sm2_z256_point_to_uncompressed_octets(const SM2_Z256_POINT *P, uint8_t out[65]);
|
||||
int sm2_z256_point_to_compressed_octets(const SM2_Z256_POINT *P, uint8_t out[33]);
|
||||
|
||||
/*
|
||||
RFC 5480 Elliptic Curve Cryptography Subject Public Key Information
|
||||
ECPoint ::= OCTET STRING
|
||||
*/
|
||||
#define SM2_POINT_MAX_SIZE (2 + 65)
|
||||
int sm2_z256_point_to_der(const SM2_Z256_POINT *P, uint8_t **out, size_t *outlen);
|
||||
int sm2_z256_point_from_der(SM2_Z256_POINT *P, const uint8_t **in, size_t *inlen);
|
||||
int sm2_z256_point_print(FILE *fp, int fmt, int ind, const char *label, const SM2_Z256_POINT *P);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
58
thirdparty/GmSSL-3.1.1/include/gmssl/sm3.h
vendored
58
thirdparty/GmSSL-3.1.1/include/gmssl/sm3.h
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2022 The GmSSL Project. All Rights Reserved.
|
||||
* Copyright 2014-2023 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.
|
||||
@@ -18,32 +18,10 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
SM3 Public API
|
||||
|
||||
SM3_DIGEST_SIZE
|
||||
SM3_HMAC_SIZE
|
||||
|
||||
SM3_CTX
|
||||
sm3_init
|
||||
sm3_update
|
||||
sm3_finish
|
||||
|
||||
SM3_HMAC_CTX
|
||||
sm3_hmac_init
|
||||
sm3_hmac_update
|
||||
sm3_hmac_finish
|
||||
|
||||
sm3_digest
|
||||
sm3_hmac
|
||||
*/
|
||||
|
||||
#define SM3_IS_BIG_ENDIAN 1
|
||||
|
||||
#define SM3_DIGEST_SIZE 32
|
||||
#define SM3_BLOCK_SIZE 64
|
||||
#define SM3_STATE_WORDS 8
|
||||
#define SM3_HMAC_SIZE (SM3_DIGEST_SIZE)
|
||||
|
||||
|
||||
typedef struct {
|
||||
@@ -53,12 +31,14 @@ typedef struct {
|
||||
size_t num;
|
||||
} SM3_CTX;
|
||||
|
||||
void sm3_compress_blocks(uint32_t digest[8], const uint8_t *data, size_t blocks);
|
||||
|
||||
void sm3_init(SM3_CTX *ctx);
|
||||
void sm3_update(SM3_CTX *ctx, const uint8_t *data, size_t datalen);
|
||||
void sm3_finish(SM3_CTX *ctx, uint8_t dgst[SM3_DIGEST_SIZE]);
|
||||
void sm3_digest(const uint8_t *data, size_t datalen, uint8_t dgst[SM3_DIGEST_SIZE]);
|
||||
|
||||
void sm3_compress_blocks(uint32_t digest[8], const uint8_t *data, size_t blocks);
|
||||
|
||||
#define SM3_HMAC_SIZE (SM3_DIGEST_SIZE)
|
||||
|
||||
typedef struct {
|
||||
SM3_CTX sm3_ctx;
|
||||
@@ -68,9 +48,6 @@ typedef struct {
|
||||
void sm3_hmac_init(SM3_HMAC_CTX *ctx, const uint8_t *key, size_t keylen);
|
||||
void sm3_hmac_update(SM3_HMAC_CTX *ctx, const uint8_t *data, size_t datalen);
|
||||
void sm3_hmac_finish(SM3_HMAC_CTX *ctx, uint8_t mac[SM3_HMAC_SIZE]);
|
||||
void sm3_hmac(const uint8_t *key, size_t keylen,
|
||||
const uint8_t *data, size_t datalen,
|
||||
uint8_t mac[SM3_HMAC_SIZE]);
|
||||
|
||||
|
||||
typedef struct {
|
||||
@@ -79,10 +56,33 @@ typedef struct {
|
||||
} SM3_KDF_CTX;
|
||||
|
||||
void sm3_kdf_init(SM3_KDF_CTX *ctx, size_t outlen);
|
||||
void sm3_kdf_update(SM3_KDF_CTX *ctx, const uint8_t *data, size_t datalen);
|
||||
void sm3_kdf_update(SM3_KDF_CTX *ctx, const uint8_t *in, size_t inlen);
|
||||
void sm3_kdf_finish(SM3_KDF_CTX *ctx, uint8_t *out);
|
||||
|
||||
|
||||
#define SM3_PBKDF2_MIN_ITER 10000
|
||||
#define SM3_PBKDF2_MAX_ITER (16777216-1)
|
||||
#define SM3_PBKDF2_MAX_SALT_SIZE 64
|
||||
#define SM3_PBKDF2_DEFAULT_SALT_SIZE 8
|
||||
|
||||
int sm3_pbkdf2(const char *pass, size_t passlen,
|
||||
const uint8_t *salt, size_t saltlen, size_t count,
|
||||
size_t outlen, uint8_t *out);
|
||||
|
||||
|
||||
typedef struct {
|
||||
union {
|
||||
SM3_CTX sm3_ctx;
|
||||
SM3_HMAC_CTX hmac_ctx;
|
||||
};
|
||||
int state;
|
||||
} SM3_DIGEST_CTX;
|
||||
|
||||
int sm3_digest_init(SM3_DIGEST_CTX *ctx, const uint8_t *key, size_t keylen);
|
||||
int sm3_digest_update(SM3_DIGEST_CTX *ctx, const uint8_t *data, size_t datalen);
|
||||
int sm3_digest_finish(SM3_DIGEST_CTX *ctx, uint8_t dgst[SM3_DIGEST_SIZE]);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
42
thirdparty/GmSSL-3.1.1/include/gmssl/sm3_rng.h
vendored
42
thirdparty/GmSSL-3.1.1/include/gmssl/sm3_rng.h
vendored
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014-2022 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.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
#ifndef GMSSL_SM3_RNG_H
|
||||
#define GMSSL_SM3_RNG_H
|
||||
|
||||
#include <time.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#define SM3_RNG_MAX_RESEED_COUNTER (1<<20)
|
||||
#define SM3_RNG_MAX_RESEED_SECONDS 600
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint8_t V[55];
|
||||
uint8_t C[55];
|
||||
uint32_t reseed_counter;
|
||||
time_t last_reseed_time;
|
||||
} SM3_RNG;
|
||||
|
||||
int sm3_rng_init(SM3_RNG *rng, const uint8_t *nonce, size_t nonce_len,
|
||||
const uint8_t *label, size_t label_len);
|
||||
int sm3_rng_reseed(SM3_RNG *rng, const uint8_t *addin, size_t addin_len);
|
||||
int sm3_rng_generate(SM3_RNG *rng, const uint8_t *addin, size_t addin_len,
|
||||
uint8_t *out, size_t outlen);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -7,7 +7,10 @@
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
#ifndef GMSSL_SM3_X8_AVX2_H
|
||||
// TODO: a new header for coarse-grained parallelism SM3, implemented by sm3_avx2/avx512, sm3_sve/sve2, sm3_cl
|
||||
// and used by sm3_xmss or other algors
|
||||
|
||||
#ifndef GMSSL_SM3_X8_AVX2_H // GMSSL_SM3_MULTI_H ?
|
||||
#define GMSSL_SM3_X8_AVX2_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
127
thirdparty/GmSSL-3.1.1/include/gmssl/sm3_xmss.h
vendored
Normal file
127
thirdparty/GmSSL-3.1.1/include/gmssl/sm3_xmss.h
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* Copyright 2014-2023 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.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
#ifndef GMSSL_SM3_XMSS_H
|
||||
#define GMSSL_SM3_XMSS_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <gmssl/sm3.h>
|
||||
#ifdef ENABLE_SHA2
|
||||
#include <gmssl/sha2.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
// Crosscheck with data from xmss-reference (SHA-256), except the XMSS signature.
|
||||
#if defined(ENABLE_SM3_XMSS_CROSSCHECK) && defined(ENABLE_SHA2)
|
||||
# define HASH256_CTX SHA256_CTX
|
||||
# define hash256_init sha256_init
|
||||
# define hash256_update sha256_update
|
||||
# define hash256_finish sha256_finish
|
||||
# define hash256_digest sha256_digest
|
||||
#else
|
||||
# define HASH256_CTX SM3_CTX
|
||||
# define hash256_init sm3_init
|
||||
# define hash256_update sm3_update
|
||||
# define hash256_finish sm3_finish
|
||||
# define hash256_digest sm3_digest
|
||||
#endif
|
||||
|
||||
typedef uint8_t hash256_bytes_t[32];
|
||||
|
||||
// Derive wots+ sk from a secret seed use the spec of xmss-reference.
|
||||
void sm3_wots_derive_sk(const uint8_t secret[32],
|
||||
const uint8_t seed[32], const uint8_t in_adrs[32],
|
||||
hash256_bytes_t sk[67]);
|
||||
void sm3_wots_derive_pk(const hash256_bytes_t sk[67],
|
||||
const HASH256_CTX *prf_seed_ctx, const uint8_t in_adrs[32],
|
||||
hash256_bytes_t pk[67]);
|
||||
void sm3_wots_do_sign(const hash256_bytes_t sk[67],
|
||||
const HASH256_CTX *prf_seed_ctx, const uint8_t in_adrs[32],
|
||||
const uint8_t dgst[32], hash256_bytes_t sig[67]);
|
||||
void sm3_wots_sig_to_pk(const hash256_bytes_t sig[67], const uint8_t dgst[32],
|
||||
const HASH256_CTX *prf_seed_ctx, const uint8_t in_adrs[32],
|
||||
hash256_bytes_t pk[67]);
|
||||
|
||||
void sm3_xmss_derive_root(const uint8_t xmss_secret[32], int height,
|
||||
const uint8_t seed[32],
|
||||
hash256_bytes_t *tree, uint8_t xmss_root[32]);
|
||||
void sm3_xmss_do_sign(const uint8_t xmss_secret[32], int index,
|
||||
const uint8_t seed[32], const uint8_t in_adrs[32], int height,
|
||||
const hash256_bytes_t *tree,
|
||||
const uint8_t dgst[32],
|
||||
hash256_bytes_t wots_sig[67],
|
||||
hash256_bytes_t *auth_path);
|
||||
|
||||
void sm3_xmss_sig_to_root(const hash256_bytes_t wots_sig[67], int index, const hash256_bytes_t *auth_path,
|
||||
const uint8_t seed[32], const uint8_t in_adrs[32], int height,
|
||||
const uint8_t dgst[32],
|
||||
uint8_t xmss_root[32]);
|
||||
|
||||
enum {
|
||||
XMSS_SM3_10 = 0x10000001,
|
||||
XMSS_SM3_16 = 0x10000002,
|
||||
XMSS_SM3_20 = 0x10000003,
|
||||
XMSS_SHA256_10 = 0x00000001,
|
||||
XMSS_SHA256_16 = 0x00000002,
|
||||
XMSS_SHA256_20 = 0x00000003,
|
||||
};
|
||||
|
||||
int sm3_xmss_height_from_oid(uint32_t *height, uint32_t id);
|
||||
|
||||
typedef struct {
|
||||
uint32_t oid;
|
||||
uint8_t seed[32];
|
||||
uint8_t root[32];
|
||||
uint8_t secret[32];
|
||||
uint8_t prf_key[32];
|
||||
uint32_t index;
|
||||
hash256_bytes_t *tree;
|
||||
} SM3_XMSS_KEY;
|
||||
|
||||
int sm3_xmss_key_generate(SM3_XMSS_KEY *key, uint32_t oid);
|
||||
int sm3_xmss_key_print(FILE *fp, int fmt, int ind, const char *label, const SM3_XMSS_KEY *key);
|
||||
int sm3_xmss_key_get_height(const SM3_XMSS_KEY *key, uint32_t *height);
|
||||
int sm3_xmss_key_to_bytes(const SM3_XMSS_KEY *key, uint8_t *out, size_t *outlen);
|
||||
int sm3_xmss_key_from_bytes(SM3_XMSS_KEY *key, const uint8_t *in, size_t inlen);
|
||||
int sm3_xmss_public_key_to_bytes(const SM3_XMSS_KEY *key, uint8_t *out, size_t *outlen);
|
||||
int sm3_xmss_public_key_from_bytes(SM3_XMSS_KEY *key, const uint8_t *in, size_t inlen);
|
||||
void sm3_xmss_key_cleanup(SM3_XMSS_KEY *key);
|
||||
|
||||
typedef struct {
|
||||
uint8_t index[4];
|
||||
uint8_t random[32];
|
||||
hash256_bytes_t wots_sig[67];
|
||||
hash256_bytes_t auth_path[20];
|
||||
} SM3_XMSS_SIGNATURE;
|
||||
|
||||
int sm3_xmss_signature_print(FILE *fp, int fmt, int ind, const char *label, const uint8_t *in, size_t inlen);
|
||||
|
||||
typedef struct {
|
||||
uint8_t random[32];
|
||||
HASH256_CTX hash256_ctx;
|
||||
} SM3_XMSS_SIGN_CTX;
|
||||
|
||||
int sm3_xmss_sign_init(SM3_XMSS_SIGN_CTX *ctx, const SM3_XMSS_KEY *key);
|
||||
int sm3_xmss_sign_update(SM3_XMSS_SIGN_CTX *ctx, const uint8_t *data, size_t datalen);
|
||||
int sm3_xmss_sign_finish(SM3_XMSS_SIGN_CTX *ctx, const SM3_XMSS_KEY *key, uint8_t *sigbuf, size_t *siglen);
|
||||
int sm3_xmss_verify_init(SM3_XMSS_SIGN_CTX *ctx, const SM3_XMSS_KEY *key, const uint8_t *sigbuf, size_t siglen);
|
||||
int sm3_xmss_verify_update(SM3_XMSS_SIGN_CTX *ctx, const uint8_t *data, size_t datalen);
|
||||
int sm3_xmss_verify_finish(SM3_XMSS_SIGN_CTX *ctx, const SM3_XMSS_KEY *key, const uint8_t *sigbuf, size_t siglen);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
265
thirdparty/GmSSL-3.1.1/include/gmssl/sm4.h
vendored
265
thirdparty/GmSSL-3.1.1/include/gmssl/sm4.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.
|
||||
@@ -13,35 +13,13 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <gmssl/ghash.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
SM4 Public API
|
||||
|
||||
SM4_KEY_SIZE
|
||||
SM4_BLOCK_SIZE
|
||||
|
||||
SM4_CBC_CTX
|
||||
sm4_cbc_encrypt_init
|
||||
sm4_cbc_encrypt_update
|
||||
sm4_cbc_encrypt_finish
|
||||
sm4_cbc_decrypt_init
|
||||
sm4_cbc_decrypt_update
|
||||
sm4_cbc_decrypt_finish
|
||||
|
||||
SM4_CTR_CTX
|
||||
sm4_ctr_encrypt_init
|
||||
sm4_ctr_encrypt_update
|
||||
sm4_ctr_encrypt_finish
|
||||
sm4_ctr_decrypt_init
|
||||
sm4_ctr_decrypt_update
|
||||
sm4_ctr_decrypt_finish
|
||||
*/
|
||||
|
||||
#define SM4_KEY_SIZE (16)
|
||||
#define SM4_BLOCK_SIZE (16)
|
||||
#define SM4_NUM_ROUNDS (32)
|
||||
@@ -54,54 +32,21 @@ typedef struct {
|
||||
void sm4_set_encrypt_key(SM4_KEY *key, const uint8_t raw_key[SM4_KEY_SIZE]);
|
||||
void sm4_set_decrypt_key(SM4_KEY *key, const uint8_t raw_key[SM4_KEY_SIZE]);
|
||||
void sm4_encrypt(const SM4_KEY *key, const uint8_t in[SM4_BLOCK_SIZE], uint8_t out[SM4_BLOCK_SIZE]);
|
||||
#define sm4_decrypt(key,in,out) sm4_encrypt(key,in,out)
|
||||
|
||||
|
||||
void sm4_cbc_encrypt(const SM4_KEY *key, const uint8_t iv[SM4_BLOCK_SIZE],
|
||||
void sm4_encrypt_blocks(const SM4_KEY *key, const uint8_t *in, size_t nblocks, uint8_t *out);
|
||||
void sm4_cbc_encrypt_blocks(const SM4_KEY *key, uint8_t iv[SM4_BLOCK_SIZE],
|
||||
const uint8_t *in, size_t nblocks, uint8_t *out);
|
||||
void sm4_cbc_decrypt(const SM4_KEY *key, const uint8_t iv[SM4_BLOCK_SIZE],
|
||||
void sm4_cbc_decrypt_blocks(const SM4_KEY *key, uint8_t iv[SM4_BLOCK_SIZE],
|
||||
const uint8_t *in, size_t nblocks, uint8_t *out);
|
||||
int sm4_cbc_padding_encrypt(const SM4_KEY *key, const uint8_t iv[SM4_BLOCK_SIZE],
|
||||
void sm4_ctr_encrypt_blocks(const SM4_KEY *key, uint8_t ctr[16], const uint8_t *in, size_t nblocks, uint8_t *out);
|
||||
void sm4_ctr32_encrypt_blocks(const SM4_KEY *key, uint8_t ctr[16], const uint8_t *in, size_t nblocks, uint8_t *out);
|
||||
|
||||
int sm4_cbc_padding_encrypt(const SM4_KEY *key, const uint8_t iv[SM4_BLOCK_SIZE],
|
||||
const uint8_t *in, size_t inlen, uint8_t *out, size_t *outlen);
|
||||
int sm4_cbc_padding_decrypt(const SM4_KEY *key, const uint8_t iv[SM4_BLOCK_SIZE],
|
||||
int sm4_cbc_padding_decrypt(const SM4_KEY *key, const uint8_t iv[SM4_BLOCK_SIZE],
|
||||
const uint8_t *in, size_t inlen, uint8_t *out, size_t *outlen);
|
||||
|
||||
|
||||
void sm4_ctr_encrypt(const SM4_KEY *key, uint8_t ctr[SM4_BLOCK_SIZE],
|
||||
const uint8_t *in, size_t inlen, uint8_t *out);
|
||||
#define sm4_ctr_decrypt(key,ctr,in,inlen,out) sm4_ctr_encrypt(key,ctr,in,inlen,out)
|
||||
|
||||
|
||||
#define SM4_GCM_IV_MIN_SIZE 1
|
||||
#define SM4_GCM_IV_MAX_SIZE (((uint64_t)1 << (64-3)) - 1) // 2305843009213693951
|
||||
|
||||
#define SM4_GCM_IV_DEFAULT_BITS 96
|
||||
#define SM4_GCM_IV_DEFAULT_SIZE 12
|
||||
|
||||
//#define NIST_SP800_GCM_MAX_IV_SIZE (((uint64_t)1 << (64-3)) - 1) // 2305843009213693951
|
||||
|
||||
#define SM4_GCM_MAX_IV_SIZE 64
|
||||
#define SM4_GCM_MIN_IV_SIZE 1
|
||||
#define SM4_GCM_DEFAULT_IV_SIZE 12
|
||||
|
||||
#define SM4_GCM_MIN_AAD_SIZE 0
|
||||
#define SM4_GCM_MAX_AAD_SIZE (((uint64_t)1 << (64-3)) - 1) // 2305843009213693951
|
||||
|
||||
#define SM4_GCM_MIN_PLAINTEXT_SIZE 0
|
||||
#define SM4_GCM_MAX_PLAINTEXT_SIZE ((((uint64_t)1 << 39) - 256) >> 3) // 68719476704
|
||||
|
||||
#define SM4_GCM_MAX_TAG_SIZE 16
|
||||
#define SM4_GCM_MIN_TAG_SIZE 12
|
||||
// For certain applications (voice or video), tag may be 64 or 32 bits
|
||||
// see NIST Special Publication 800-38D, Appendix C for more details
|
||||
|
||||
|
||||
int sm4_gcm_encrypt(const SM4_KEY *key, const uint8_t *iv, size_t ivlen,
|
||||
const uint8_t *aad, size_t aadlen, const uint8_t *in, size_t inlen,
|
||||
uint8_t *out, size_t taglen, uint8_t *tag);
|
||||
int sm4_gcm_decrypt(const SM4_KEY *key, const uint8_t *iv, size_t ivlen,
|
||||
const uint8_t *aad, size_t aadlen, const uint8_t *in, size_t inlen,
|
||||
const uint8_t *tag, size_t taglen, uint8_t *out);
|
||||
void sm4_ctr_encrypt(const SM4_KEY *key, uint8_t ctr[16], const uint8_t *in, size_t inlen, uint8_t *out);
|
||||
void sm4_ctr32_encrypt(const SM4_KEY *key, uint8_t ctr[16], const uint8_t *in, size_t inlen, uint8_t *out);
|
||||
|
||||
|
||||
typedef struct {
|
||||
@@ -114,12 +59,16 @@ typedef struct {
|
||||
int sm4_cbc_encrypt_init(SM4_CBC_CTX *ctx, const uint8_t key[SM4_KEY_SIZE], const uint8_t iv[SM4_BLOCK_SIZE]);
|
||||
int sm4_cbc_encrypt_update(SM4_CBC_CTX *ctx, const uint8_t *in, size_t inlen, uint8_t *out, size_t *outlen);
|
||||
int sm4_cbc_encrypt_finish(SM4_CBC_CTX *ctx, uint8_t *out, size_t *outlen);
|
||||
|
||||
int sm4_cbc_decrypt_init(SM4_CBC_CTX *ctx, const uint8_t key[SM4_KEY_SIZE], const uint8_t iv[SM4_BLOCK_SIZE]);
|
||||
int sm4_cbc_decrypt_update(SM4_CBC_CTX *ctx, const uint8_t *in, size_t inlen, uint8_t *out, size_t *outlen);
|
||||
int sm4_cbc_decrypt_finish(SM4_CBC_CTX *ctx, uint8_t *out, size_t *outlen);
|
||||
|
||||
|
||||
void sm4_ctr_encrypt(const SM4_KEY *key, uint8_t ctr[SM4_BLOCK_SIZE],
|
||||
const uint8_t *in, size_t inlen, uint8_t *out);
|
||||
void sm4_ctr32_encrypt(const SM4_KEY *key, uint8_t ctr[SM4_BLOCK_SIZE],
|
||||
const uint8_t *in, size_t inlen, uint8_t *out);
|
||||
|
||||
typedef struct {
|
||||
SM4_KEY sm4_key;
|
||||
uint8_t ctr[SM4_BLOCK_SIZE];
|
||||
@@ -130,10 +79,184 @@ typedef struct {
|
||||
int sm4_ctr_encrypt_init(SM4_CTR_CTX *ctx, const uint8_t key[SM4_KEY_SIZE], const uint8_t ctr[SM4_BLOCK_SIZE]);
|
||||
int sm4_ctr_encrypt_update(SM4_CTR_CTX *ctx, const uint8_t *in, size_t inlen, uint8_t *out, size_t *outlen);
|
||||
int sm4_ctr_encrypt_finish(SM4_CTR_CTX *ctx, uint8_t *out, size_t *outlen);
|
||||
int sm4_ctr32_encrypt_init(SM4_CTR_CTX *ctx, const uint8_t key[SM4_KEY_SIZE], const uint8_t ctr[SM4_BLOCK_SIZE]);
|
||||
int sm4_ctr32_encrypt_update(SM4_CTR_CTX *ctx, const uint8_t *in, size_t inlen, uint8_t *out, size_t *outlen);
|
||||
int sm4_ctr32_encrypt_finish(SM4_CTR_CTX *ctx, uint8_t *out, size_t *outlen);
|
||||
|
||||
#define sm4_ctr_decrypt_init(ctx,key,ctr) sm4_ctr_encrypt_init(ctx,key,ctr)
|
||||
#define sm4_ctr_decrypt_update(ctx,in,inlen,out,outlen) sm4_ctr_encrypt_update(ctx,in,inlen,out,outlen)
|
||||
#define sm4_ctr_decrypt_finish(ctx,out,outlen) sm4_ctr_encrypt_finish(ctx,out,outlen)
|
||||
|
||||
#define NIST_SP800_GCM_MAX_IV_SIZE (((uint64_t)1 << (64-3)) - 1) // 2305843009213693951
|
||||
#define SM4_GCM_MAX_IV_SIZE 64
|
||||
#define SM4_GCM_MIN_IV_SIZE 1
|
||||
#define SM4_GCM_DEFAULT_IV_SIZE 12
|
||||
|
||||
#define NIST_SP800_GCM_MAX_AAD_SIZE (((uint64_t)1 << (64-3)) - 1) // 2305843009213693951
|
||||
#define SM4_GCM_MIN_AAD_SIZE 0
|
||||
#define SM4_GCM_MAX_AAD_SIZE (1<<24) // 16MiB
|
||||
|
||||
#define SM4_GCM_MIN_PLAINTEXT_SIZE 0
|
||||
#define SM4_GCM_MAX_PLAINTEXT_NBLOCKS (((uint64_t)1 << 32) - 2)
|
||||
#define SM4_GCM_MAX_PLAINTEXT_SIZE (SM4_GCM_MAX_PLAINTEXT_NBLOCKS * 16) // 68719476704
|
||||
|
||||
#define SM4_GCM_MAX_TAG_SIZE 16
|
||||
#define SM4_GCM_MIN_TAG_SIZE 12
|
||||
#define SM4_GCM_DEFAULT_TAG_SIZE 16
|
||||
// For certain applications (voice or video), tag may be 64 or 32 bits
|
||||
// see NIST Special Publication 800-38D, Appendix C for more details
|
||||
|
||||
int sm4_gcm_encrypt(const SM4_KEY *key, const uint8_t *iv, size_t ivlen,
|
||||
const uint8_t *aad, size_t aadlen, const uint8_t *in, size_t inlen,
|
||||
uint8_t *out, size_t taglen, uint8_t *tag);
|
||||
int sm4_gcm_decrypt(const SM4_KEY *key, const uint8_t *iv, size_t ivlen,
|
||||
const uint8_t *aad, size_t aadlen, const uint8_t *in, size_t inlen,
|
||||
const uint8_t *tag, size_t taglen, uint8_t *out);
|
||||
|
||||
|
||||
typedef struct {
|
||||
SM4_CTR_CTX enc_ctx;
|
||||
GHASH_CTX mac_ctx;
|
||||
uint8_t Y[16]; // E(K, Y_0)
|
||||
size_t taglen;
|
||||
uint8_t mac[16];
|
||||
size_t maclen;
|
||||
uint64_t encedlen;
|
||||
} SM4_GCM_CTX;
|
||||
|
||||
int sm4_gcm_encrypt_init(SM4_GCM_CTX *ctx,
|
||||
const uint8_t *key, size_t keylen, const uint8_t *iv, size_t ivlen,
|
||||
const uint8_t *aad, size_t aadlen, size_t taglen);
|
||||
int sm4_gcm_encrypt_update(SM4_GCM_CTX *ctx,
|
||||
const uint8_t *in, size_t inlen, uint8_t *out, size_t *outlen);
|
||||
int sm4_gcm_encrypt_finish(SM4_GCM_CTX *ctx,
|
||||
uint8_t *out, size_t *outlen);
|
||||
int sm4_gcm_decrypt_init(SM4_GCM_CTX *ctx,
|
||||
const uint8_t *key, size_t keylen, const uint8_t *iv, size_t ivlen,
|
||||
const uint8_t *aad, size_t aadlen, size_t taglen);
|
||||
int sm4_gcm_decrypt_update(SM4_GCM_CTX *ctx,
|
||||
const uint8_t *in, size_t inlen, uint8_t *out, size_t *outlen);
|
||||
int sm4_gcm_decrypt_finish(SM4_GCM_CTX *ctx,
|
||||
uint8_t *out, size_t *outlen);
|
||||
|
||||
|
||||
#ifdef ENABLE_SM4_ECB
|
||||
// call `sm4_set_decrypt_key` before decrypt
|
||||
|
||||
typedef struct {
|
||||
SM4_KEY sm4_key;
|
||||
uint8_t block[SM4_BLOCK_SIZE];
|
||||
size_t block_nbytes;
|
||||
} SM4_ECB_CTX;
|
||||
|
||||
int sm4_ecb_encrypt_init(SM4_ECB_CTX *ctx, const uint8_t key[SM4_BLOCK_SIZE]);
|
||||
int sm4_ecb_encrypt_update(SM4_ECB_CTX *ctx,
|
||||
const uint8_t *in, size_t inlen, uint8_t *out, size_t *outlen);
|
||||
int sm4_ecb_encrypt_finish(SM4_ECB_CTX *ctx, uint8_t *out, size_t *outlen);
|
||||
|
||||
int sm4_ecb_decrypt_init(SM4_ECB_CTX *ctx, const uint8_t key[SM4_BLOCK_SIZE]);
|
||||
int sm4_ecb_decrypt_update(SM4_ECB_CTX *ctx,
|
||||
const uint8_t *in, size_t inlen, uint8_t *out, size_t *outlen);
|
||||
int sm4_ecb_decrypt_finish(SM4_ECB_CTX *ctx, uint8_t *out, size_t *outlen);
|
||||
#endif // ENABLE_SM4_ECB
|
||||
|
||||
|
||||
#ifdef ENABLE_SM4_OFB
|
||||
// always call `sm4_set_encrypt_key` before encrypt/decrypt
|
||||
// `sm4_ofb_encrypt` will change the param `iv`
|
||||
void sm4_ofb_encrypt(const SM4_KEY *key, uint8_t iv[16], const uint8_t *in, size_t inlen, uint8_t *out);
|
||||
|
||||
typedef struct {
|
||||
SM4_KEY sm4_key;
|
||||
uint8_t iv[SM4_BLOCK_SIZE];
|
||||
uint8_t block[SM4_BLOCK_SIZE];
|
||||
size_t block_nbytes;
|
||||
} SM4_OFB_CTX;
|
||||
|
||||
int sm4_ofb_encrypt_init(SM4_OFB_CTX *ctx,
|
||||
const uint8_t key[SM4_BLOCK_SIZE], const uint8_t iv[SM4_BLOCK_SIZE]);
|
||||
int sm4_ofb_encrypt_update(SM4_OFB_CTX *ctx,
|
||||
const uint8_t *in, size_t inlen, uint8_t *out, size_t *outlen);
|
||||
int sm4_ofb_encrypt_finish(SM4_OFB_CTX *ctx, uint8_t *out, size_t *outlen);
|
||||
#endif // ENABLE_SM4_OFB
|
||||
|
||||
|
||||
#ifdef ENABLE_SM4_CFB
|
||||
#define SM4_CFB_MIN_SBYTES 1
|
||||
#define SM4_CFB_MAX_SBYTES 16
|
||||
|
||||
// pre-defined values for `sbytes`
|
||||
#define SM4_CFB_8 1
|
||||
#define SM4_CFB_64 8
|
||||
#define SM4_CFB_128 16
|
||||
|
||||
// always call `sm4_set_encrypt_key` before encrypt/decrypt
|
||||
// `sm4_cfb_encrypt/decrypt` will change the param `iv`
|
||||
void sm4_cfb_encrypt(const SM4_KEY *key, size_t sbytes, uint8_t iv[16],
|
||||
const uint8_t *in, size_t inlen, uint8_t *out);
|
||||
void sm4_cfb_decrypt(const SM4_KEY *key, size_t sbytes, uint8_t iv[16],
|
||||
const uint8_t *in, size_t inlen, uint8_t *out);
|
||||
|
||||
typedef struct {
|
||||
SM4_KEY sm4_key;
|
||||
uint8_t iv[SM4_BLOCK_SIZE];
|
||||
uint8_t block[SM4_BLOCK_SIZE];
|
||||
size_t block_nbytes;
|
||||
size_t sbytes;
|
||||
} SM4_CFB_CTX;
|
||||
|
||||
int sm4_cfb_encrypt_init(SM4_CFB_CTX *ctx, size_t sbytes,
|
||||
const uint8_t key[SM4_BLOCK_SIZE], const uint8_t iv[SM4_BLOCK_SIZE]);
|
||||
int sm4_cfb_encrypt_update(SM4_CFB_CTX *ctx,
|
||||
const uint8_t *in, size_t inlen, uint8_t *out, size_t *outlen);
|
||||
int sm4_cfb_encrypt_finish(SM4_CFB_CTX *ctx, uint8_t *out, size_t *outlen);
|
||||
|
||||
int sm4_cfb_decrypt_init(SM4_CFB_CTX *ctx, size_t sbytes,
|
||||
const uint8_t key[SM4_BLOCK_SIZE], const uint8_t iv[SM4_BLOCK_SIZE]);
|
||||
int sm4_cfb_decrypt_update(SM4_CFB_CTX *ctx,
|
||||
const uint8_t *in, size_t inlen, uint8_t *out, size_t *outlen);
|
||||
int sm4_cfb_decrypt_finish(SM4_CFB_CTX *ctx, uint8_t *out, size_t *outlen);
|
||||
#endif // ENABLE_SM4_CFB
|
||||
|
||||
|
||||
#ifdef ENABLE_SM4_CCM
|
||||
#define SM4_CCM_MIN_IV_SIZE 7
|
||||
#define SM4_CCM_MAX_IV_SIZE 13
|
||||
#define SM4_CCM_MIN_TAG_SIZE 4
|
||||
#define SM4_CCM_MAX_TAG_SIZE 16
|
||||
#define SM4_CCM_DEFAULT_TAG_SIZE 16
|
||||
|
||||
// make sure inlen < 2^((15 - ivlen) * 8)
|
||||
int sm4_ccm_encrypt(const SM4_KEY *sm4_key, const uint8_t *iv, size_t ivlen,
|
||||
const uint8_t *aad, size_t aadlen, const uint8_t *in, size_t inlen,
|
||||
uint8_t *out, size_t taglen, uint8_t *tag);
|
||||
int sm4_ccm_decrypt(const SM4_KEY *sm4_key, const uint8_t *iv, size_t ivlen,
|
||||
const uint8_t *aad, size_t aadlen, const uint8_t *in, size_t inlen,
|
||||
const uint8_t *tag, size_t taglen, uint8_t *out);
|
||||
#endif // ENABLE_SM4_CCM
|
||||
|
||||
|
||||
#ifdef ENABLE_SM4_XTS
|
||||
// call `sm4_set_encrypt_key` to set both `key1` and `key2`
|
||||
int sm4_xts_encrypt(const SM4_KEY *key1, const SM4_KEY *key2, const uint8_t tweak[16],
|
||||
const uint8_t *in, size_t inlen, uint8_t *out);
|
||||
// call `sm4_set_decrypt_key(key1)` and `sm4_set_encrypt_key(key2)`
|
||||
int sm4_xts_decrypt(const SM4_KEY *key1, const SM4_KEY *key2, const uint8_t tweak[16],
|
||||
const uint8_t *in, size_t inlen, uint8_t *out);
|
||||
|
||||
typedef struct {
|
||||
SM4_KEY key1;
|
||||
SM4_KEY key2;
|
||||
uint8_t tweak[16];
|
||||
size_t data_unit_size;
|
||||
uint8_t *block;
|
||||
size_t block_nbytes;
|
||||
} SM4_XTS_CTX;
|
||||
|
||||
int sm4_xts_encrypt_init(SM4_XTS_CTX *ctx, const uint8_t key[32], const uint8_t iv[16], size_t data_unit_size);
|
||||
int sm4_xts_encrypt_update(SM4_XTS_CTX *ctx, const uint8_t *in, size_t inlen, uint8_t *out, size_t *outlen);
|
||||
int sm4_xts_encrypt_finish(SM4_XTS_CTX *ctx, uint8_t *out, size_t *outlen);
|
||||
int sm4_xts_decrypt_init(SM4_XTS_CTX *ctx, const uint8_t key[32], const uint8_t iv[16], size_t data_unit_size);
|
||||
int sm4_xts_decrypt_update(SM4_XTS_CTX *ctx, const uint8_t *in, size_t inlen, uint8_t *out, size_t *outlen);
|
||||
int sm4_xts_decrypt_finish(SM4_XTS_CTX *ctx, uint8_t *out, size_t *outlen);
|
||||
#endif // ENABLE_SM4_XTS
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2022 The GmSSL Project. All Rights Reserved.
|
||||
* Copyright 2014-2023 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.
|
||||
@@ -24,6 +24,8 @@ typedef struct {
|
||||
size_t ivlen;
|
||||
} SM4_CBC_MAC_CTX;
|
||||
|
||||
#define SM4_CBC_MAC_SIZE (SM4_BLOCK_SIZE)
|
||||
|
||||
void sm4_cbc_mac_init(SM4_CBC_MAC_CTX *ctx, const uint8_t key[16]);
|
||||
void sm4_cbc_mac_update(SM4_CBC_MAC_CTX *ctx, const uint8_t *data, size_t datalen);
|
||||
void sm4_cbc_mac_finish(SM4_CBC_MAC_CTX *ctx, uint8_t mac[16]);
|
||||
|
||||
52
thirdparty/GmSSL-3.1.1/include/gmssl/sm4_cbc_sm3_hmac.h
vendored
Normal file
52
thirdparty/GmSSL-3.1.1/include/gmssl/sm4_cbc_sm3_hmac.h
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
#ifndef GMSSL_SM4_CBC_SM3_HMAC_H
|
||||
#define GMSSL_SM4_CBC_SM3_HMAC_H
|
||||
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <gmssl/sm4.h>
|
||||
#include <gmssl/sm3.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct {
|
||||
SM4_CBC_CTX enc_ctx;
|
||||
SM3_HMAC_CTX mac_ctx;
|
||||
uint8_t mac[SM3_HMAC_SIZE];
|
||||
size_t maclen;
|
||||
} SM4_CBC_SM3_HMAC_CTX;
|
||||
|
||||
#define SM4_CBC_SM3_HMAC_KEY_SIZE 48
|
||||
#define SM4_CBC_SM3_HMAC_IV_SIZE 16
|
||||
|
||||
int sm4_cbc_sm3_hmac_encrypt_init(SM4_CBC_SM3_HMAC_CTX *ctx,
|
||||
const uint8_t key[48], const uint8_t iv[16],
|
||||
const uint8_t *aad, size_t aadlen);
|
||||
int sm4_cbc_sm3_hmac_encrypt_update(SM4_CBC_SM3_HMAC_CTX *ctx,
|
||||
const uint8_t *in, size_t inlen, uint8_t *out, size_t *outlen);
|
||||
int sm4_cbc_sm3_hmac_encrypt_finish(SM4_CBC_SM3_HMAC_CTX *ctx,
|
||||
uint8_t *out, size_t *outlen);
|
||||
int sm4_cbc_sm3_hmac_decrypt_init(SM4_CBC_SM3_HMAC_CTX *ctx,
|
||||
const uint8_t key[48], const uint8_t iv[16],
|
||||
const uint8_t *aad, size_t aadlen);
|
||||
int sm4_cbc_sm3_hmac_decrypt_update(SM4_CBC_SM3_HMAC_CTX *ctx,
|
||||
const uint8_t *in, size_t inlen, uint8_t *out, size_t *outlen);
|
||||
int sm4_cbc_sm3_hmac_decrypt_finish(SM4_CBC_SM3_HMAC_CTX *ctx,
|
||||
uint8_t *out, size_t *outlen);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
21
thirdparty/GmSSL-3.1.1/include/gmssl/sm4_cl.h
vendored
21
thirdparty/GmSSL-3.1.1/include/gmssl/sm4_cl.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.
|
||||
@@ -10,44 +10,39 @@
|
||||
#ifndef GMSSL_SM4_CL_H
|
||||
#define GMSSL_SM4_CL_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <gmssl/sm4.h>
|
||||
|
||||
|
||||
#ifdef APPLE
|
||||
#ifdef MACOS
|
||||
#include <OpenCL/OpenCL.h>
|
||||
#else
|
||||
#include <CL/cl.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint32_t rk[32];
|
||||
//size_t workgroup_size;
|
||||
cl_context context;
|
||||
cl_command_queue queue;
|
||||
cl_program program;
|
||||
cl_kernel kernel;
|
||||
cl_mem mem_rk;
|
||||
cl_mem mem_io;
|
||||
size_t workgroup_size;
|
||||
} SM4_CL_CTX;
|
||||
|
||||
|
||||
int sm4_cl_set_encrypt_key(SM4_CL_CTX *ctx, const uint8_t key[16]);
|
||||
int sm4_cl_set_decrypt_key(SM4_CL_CTX *ctx, const uint8_t key[16]);
|
||||
int sm4_cl_encrypt(SM4_CL_CTX *ctx, const uint8_t *in, size_t nblocks, uint8_t *out);
|
||||
int sm4_cl_ctr32_encrypt_blocks(SM4_CL_CTX *ctx, uint8_t iv[16], const uint8_t *in, size_t nblocks, uint8_t *out);
|
||||
void sm4_cl_cleanup(SM4_CL_CTX *ctx);
|
||||
|
||||
int test_sm4_cl_encrypt(void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
52
thirdparty/GmSSL-3.1.1/include/gmssl/sm4_ctr_sm3_hmac.h
vendored
Normal file
52
thirdparty/GmSSL-3.1.1/include/gmssl/sm4_ctr_sm3_hmac.h
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
#ifndef GMSSL_SM4_CTR_SM3_HMAC_H
|
||||
#define GMSSL_SM4_CTR_SM3_HMAC_H
|
||||
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <gmssl/sm4.h>
|
||||
#include <gmssl/sm3.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct {
|
||||
SM4_CTR_CTX enc_ctx;
|
||||
SM3_HMAC_CTX mac_ctx;
|
||||
uint8_t mac[SM3_HMAC_SIZE];
|
||||
size_t maclen;
|
||||
} SM4_CTR_SM3_HMAC_CTX;
|
||||
|
||||
#define SM4_CTR_SM3_HMAC_KEY_SIZE 48
|
||||
#define SM4_CTR_SM3_HMAC_IV_SIZE 16
|
||||
|
||||
int sm4_ctr_sm3_hmac_encrypt_init(SM4_CTR_SM3_HMAC_CTX *ctx,
|
||||
const uint8_t key[48], const uint8_t iv[16],
|
||||
const uint8_t *aad, size_t aadlen);
|
||||
int sm4_ctr_sm3_hmac_encrypt_update(SM4_CTR_SM3_HMAC_CTX *ctx,
|
||||
const uint8_t *in, size_t inlen, uint8_t *out, size_t *outlen);
|
||||
int sm4_ctr_sm3_hmac_encrypt_finish(SM4_CTR_SM3_HMAC_CTX *ctx,
|
||||
uint8_t *out, size_t *outlen);
|
||||
int sm4_ctr_sm3_hmac_decrypt_init(SM4_CTR_SM3_HMAC_CTX *ctx,
|
||||
const uint8_t key[48], const uint8_t iv[16],
|
||||
const uint8_t *aad, size_t aadlen);
|
||||
int sm4_ctr_sm3_hmac_decrypt_update(SM4_CTR_SM3_HMAC_CTX *ctx,
|
||||
const uint8_t *in, size_t inlen, uint8_t *out, size_t *outlen);
|
||||
int sm4_ctr_sm3_hmac_decrypt_finish(SM4_CTR_SM3_HMAC_CTX *ctx,
|
||||
uint8_t *out, size_t *outlen);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
43
thirdparty/GmSSL-3.1.1/include/gmssl/sm4_rng.h
vendored
43
thirdparty/GmSSL-3.1.1/include/gmssl/sm4_rng.h
vendored
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014-2022 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.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
#ifndef GMSSL_SM4_RNG_H
|
||||
#define GMSSL_SM4_RNG_H
|
||||
|
||||
#include <time.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#define SM4_RNG_MAX_RESEED_COUNTER (1<<20)
|
||||
#define SM4_RNG_MAX_RESEED_SECONDS 600
|
||||
|
||||
typedef struct {
|
||||
uint8_t V[16];
|
||||
uint8_t K[16];
|
||||
uint32_t reseed_counter;
|
||||
time_t last_reseed_time;
|
||||
} SM4_RNG;
|
||||
|
||||
|
||||
int sm4_rng_init(SM4_RNG *rng, const uint8_t *nonce, size_t nonce_len,
|
||||
const uint8_t *label, size_t label_len);
|
||||
int sm4_rng_update(SM4_RNG *rng, const uint8_t seed[32]);
|
||||
int sm4_rng_reseed(SM4_RNG *rng, const uint8_t *addin, size_t addin_len);
|
||||
int sm4_rng_generate(SM4_RNG *rng, const uint8_t *addin, size_t addin_len,
|
||||
uint8_t *out, size_t outlen);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
388
thirdparty/GmSSL-3.1.1/include/gmssl/sm9.h
vendored
388
thirdparty/GmSSL-3.1.1/include/gmssl/sm9.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,6 +7,8 @@
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
#ifndef GMSSL_SM9_H
|
||||
#define GMSSL_SM9_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -14,346 +16,15 @@
|
||||
#include <stdint.h>
|
||||
#include <gmssl/sm3.h>
|
||||
#include <gmssl/sm2.h>
|
||||
|
||||
|
||||
#ifndef GMSSL_SM9_H
|
||||
#define GMSSL_SM9_H
|
||||
#include <gmssl/sm9_z256.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
SM9 Public API
|
||||
|
||||
SM9_SIGNATURE_SIZE
|
||||
SM9_MAX_PLAINTEXT_SIZE
|
||||
SM9_MAX_CIPHERTEXT_SIZE
|
||||
|
||||
SM9_SIGN_MASTER_KEY
|
||||
sm9_sign_master_key_generate
|
||||
sm9_sign_master_key_extract_key
|
||||
sm9_sign_master_key_info_encrypt_to_der
|
||||
sm9_sign_master_key_info_decrypt_from_der
|
||||
sm9_sign_master_key_info_encrypt_to_pem
|
||||
sm9_sign_master_key_info_decrypt_from_pem
|
||||
sm9_sign_master_public_key_to_der
|
||||
sm9_sign_master_public_key_from_der
|
||||
sm9_sign_master_public_key_to_pem
|
||||
sm9_sign_master_public_key_from_pem
|
||||
|
||||
SM9_SIGN_KEY
|
||||
sm9_sign_key_info_encrypt_to_der
|
||||
sm9_sign_key_info_decrypt_from_der
|
||||
sm9_sign_key_info_encrypt_to_pem
|
||||
sm9_sign_key_info_decrypt_from_pem
|
||||
|
||||
SM9_SIGN_CTX
|
||||
sm9_sign_init
|
||||
sm9_sign_update
|
||||
sm9_sign_finish
|
||||
sm9_verify_init
|
||||
sm9_verify_update
|
||||
sm9_verify_finish
|
||||
|
||||
SM9_ENC_MASTER_KEY
|
||||
sm9_enc_master_key_generate
|
||||
sm9_enc_master_key_extract_key
|
||||
sm9_enc_master_key_info_encrypt_to_der
|
||||
sm9_enc_master_key_info_decrypt_from_der
|
||||
sm9_enc_master_key_info_encrypt_to_pem
|
||||
sm9_enc_master_key_info_decrypt_from_pem
|
||||
sm9_enc_master_public_key_to_der
|
||||
sm9_enc_master_public_key_from_der
|
||||
sm9_enc_master_public_key_to_pem
|
||||
sm9_enc_master_public_key_from_pem
|
||||
|
||||
SM9_ENC_KEY
|
||||
sm9_enc_key_info_encrypt_to_der
|
||||
sm9_enc_key_info_decrypt_from_der
|
||||
sm9_enc_key_info_encrypt_to_pem
|
||||
sm9_enc_key_info_decrypt_from_pem
|
||||
|
||||
sm9_encrypt
|
||||
sm9_decrypt
|
||||
*/
|
||||
|
||||
#define SM9_HEX_SEP '\n'
|
||||
|
||||
typedef uint64_t sm9_bn_t[8];
|
||||
|
||||
#define sm9_bn_init(r) sm9_bn_set_zero(r)
|
||||
#define sm9_bn_clean(r) sm9_bn_set_zero(r)
|
||||
|
||||
void sm9_bn_set_zero(sm9_bn_t r);
|
||||
void sm9_bn_set_one(sm9_bn_t r);
|
||||
int sm9_bn_is_zero(const sm9_bn_t a);
|
||||
int sm9_bn_is_one(const sm9_bn_t a);
|
||||
void sm9_bn_set_word(sm9_bn_t r, uint32_t a);
|
||||
void sm9_bn_copy(sm9_bn_t r, const sm9_bn_t a);
|
||||
int sm9_bn_rand_range(sm9_bn_t r, const sm9_bn_t range);
|
||||
int sm9_bn_equ(const sm9_bn_t a, const sm9_bn_t b);
|
||||
int sm9_bn_cmp(const sm9_bn_t a, const sm9_bn_t b);
|
||||
void sm9_bn_add(sm9_bn_t r, const sm9_bn_t a, const sm9_bn_t b);
|
||||
void sm9_bn_sub(sm9_bn_t ret, const sm9_bn_t a, const sm9_bn_t b);
|
||||
void sm9_bn_to_bits(const sm9_bn_t a, char bits[256]);
|
||||
void sm9_bn_to_bytes(const sm9_bn_t a, uint8_t out[32]);
|
||||
void sm9_bn_from_bytes(sm9_bn_t r, const uint8_t in[32]);
|
||||
void sm9_bn_to_hex(const sm9_bn_t a, char hex[64]);
|
||||
int sm9_bn_from_hex(sm9_bn_t r, const char hex[64]);
|
||||
int sm9_bn_print(FILE *fp, int fmt, int ind, const char *label, const sm9_bn_t a);
|
||||
void sm9_print_bn(const char *prefix, const sm9_bn_t a); // 标准打印格式
|
||||
|
||||
|
||||
typedef sm9_bn_t sm9_fp_t;
|
||||
|
||||
#define sm9_fp_init(r) sm9_fp_set_zero(r)
|
||||
#define sm9_fp_clean(f) sm9_fp_set_zero(r)
|
||||
#define sm9_fp_set_zero(r) sm9_bn_set_zero(r)
|
||||
#define sm9_fp_set_one(r) sm9_bn_set_one(r)
|
||||
#define sm9_fp_copy(r,a) sm9_bn_copy((r),(a))
|
||||
#define sm9_fp_rand(r) sm9_bn_rand_range((r), SM9_P)
|
||||
#define sm9_fp_is_zero(a) sm9_bn_is_zero(a)
|
||||
#define sm9_fp_is_one(a) sm9_bn_is_one(a)
|
||||
#define sm9_fp_equ(a,b) sm9_bn_equ((a),(b))
|
||||
#define sm9_fp_to_bytes(a,buf) sm9_bn_to_bytes((a),(buf))
|
||||
#define sm9_fp_to_hex(a,s) sm9_bn_to_hex((a),(s))
|
||||
#define sm9_fp_print(fp,fmt,ind,label,a) sm9_bn_print(fp,fmt,ind,label,a)
|
||||
|
||||
void sm9_fp_add(sm9_fp_t r, const sm9_fp_t a, const sm9_fp_t b);
|
||||
void sm9_fp_sub(sm9_fp_t r, const sm9_fp_t a, const sm9_fp_t b);
|
||||
void sm9_fp_dbl(sm9_fp_t r, const sm9_fp_t a);
|
||||
void sm9_fp_tri(sm9_fp_t r, const sm9_fp_t a);
|
||||
void sm9_fp_neg(sm9_fp_t r, const sm9_fp_t a);
|
||||
void sm9_fp_mul(sm9_fp_t r, const sm9_fp_t a, const sm9_fp_t b);
|
||||
void sm9_fp_sqr(sm9_fp_t r, const sm9_fp_t a);
|
||||
void sm9_fp_pow(sm9_fp_t r, const sm9_fp_t a, const sm9_bn_t e);
|
||||
void sm9_fp_inv(sm9_fp_t r, const sm9_fp_t a);
|
||||
void sm9_fp_div2(sm9_fp_t r, const sm9_fp_t a);
|
||||
int sm9_fp_from_bytes(sm9_fp_t r, const uint8_t buf[32]);
|
||||
int sm9_fp_from_hex(sm9_fp_t r, const char hex[64]);
|
||||
|
||||
|
||||
typedef sm9_bn_t sm9_fn_t;
|
||||
|
||||
#define sm9_fn_init(r) sm9_fn_set_zero(r)
|
||||
#define sm9_fn_clean(f) sm9_fn_set_zero(r)
|
||||
#define sm9_fn_set_zero(r) sm9_bn_set_zero(r)
|
||||
#define sm9_fn_set_one(r) sm9_bn_set_one(r)
|
||||
#define sm9_fn_copy(r,a) sm9_bn_copy((r),(a))
|
||||
#define sm9_fn_rand(r) sm9_bn_rand_range((r), SM9_N)
|
||||
#define sm9_fn_is_zero(a) sm9_bn_is_zero(a)
|
||||
#define sm9_fn_is_one(a) sm9_bn_is_one(a)
|
||||
#define sm9_fn_equ(a,b) sm9_bn_equ((a),(b))
|
||||
#define sm9_fn_to_bytes(a,out) sm9_bn_to_bytes((a),(out))
|
||||
#define sm9_fn_to_hex(a,s) sm9_bn_to_hex((a),(s))
|
||||
#define sm9_fn_print(fp,fmt,ind,label,a) sm9_bn_print(fp,fmt,ind,label,a)
|
||||
|
||||
void sm9_fn_add(sm9_fn_t r, const sm9_fn_t a, const sm9_fn_t b);
|
||||
void sm9_fn_sub(sm9_fn_t r, const sm9_fn_t a, const sm9_fn_t b);
|
||||
void sm9_fn_mul(sm9_fn_t r, const sm9_fn_t a, const sm9_fn_t b);
|
||||
void sm9_fn_pow(sm9_fn_t r, const sm9_fn_t a, const sm9_bn_t e);
|
||||
void sm9_fn_inv(sm9_fn_t r, const sm9_fn_t a);
|
||||
void sm9_fn_from_hash(sm9_fn_t h, const uint8_t Ha[40]);
|
||||
int sm9_fn_from_bytes(sm9_fn_t a, const uint8_t in[32]);
|
||||
int sm9_fn_from_hex(sm9_fn_t r, const char hex[64]);
|
||||
|
||||
|
||||
typedef uint64_t sm9_barrett_bn_t[9];
|
||||
|
||||
int sm9_barrett_bn_cmp(const sm9_barrett_bn_t a, const sm9_barrett_bn_t b);
|
||||
void sm9_barrett_bn_add(sm9_barrett_bn_t r, const sm9_barrett_bn_t a, const sm9_barrett_bn_t b);
|
||||
void sm9_barrett_bn_sub(sm9_barrett_bn_t ret, const sm9_barrett_bn_t a, const sm9_barrett_bn_t b);
|
||||
|
||||
|
||||
typedef sm9_fp_t sm9_fp2_t[2];
|
||||
extern const sm9_fp2_t SM9_FP2_ZERO;
|
||||
extern const sm9_fp2_t SM9_FP2_ONE;
|
||||
extern const sm9_fp2_t SM9_FP2_U;
|
||||
|
||||
#define sm9_fp2_init(a) sm9_fp2_set_zero(a)
|
||||
#define sm9_fp2_clean(a) sm9_fp2_set_zero(a)
|
||||
#define sm9_fp2_set_zero(a) sm9_fp2_copy((a), SM9_FP2_ZERO)
|
||||
#define sm9_fp2_set_one(a) sm9_fp2_copy((a), SM9_FP2_ONE)
|
||||
#define sm9_fp2_set_u(a) sm9_fp2_copy((a), SM9_FP2_U)
|
||||
#define sm9_fp2_is_zero(a) sm9_fp2_equ((a), SM9_FP2_ZERO)
|
||||
#define sm9_fp2_is_one(a) sm9_fp2_equ((a), SM9_FP2_ONE)
|
||||
|
||||
void sm9_fp2_set_fp(sm9_fp2_t r, const sm9_fp_t a);
|
||||
void sm9_fp2_set(sm9_fp2_t r, const sm9_fp_t a0, const sm9_fp_t a1);
|
||||
void sm9_fp2_copy(sm9_fp2_t r, const sm9_fp2_t a);
|
||||
int sm9_fp2_rand(sm9_fp2_t r);
|
||||
int sm9_fp2_equ(const sm9_fp2_t a, const sm9_fp2_t b);
|
||||
void sm9_fp2_add(sm9_fp2_t r, const sm9_fp2_t a, const sm9_fp2_t b);
|
||||
void sm9_fp2_dbl(sm9_fp2_t r, const sm9_fp2_t a);
|
||||
void sm9_fp2_tri(sm9_fp2_t r, const sm9_fp2_t a);
|
||||
void sm9_fp2_sub(sm9_fp2_t r, const sm9_fp2_t a, const sm9_fp2_t b);
|
||||
void sm9_fp2_neg(sm9_fp2_t r, const sm9_fp2_t a);
|
||||
void sm9_fp2_mul(sm9_fp2_t r, const sm9_fp2_t a, const sm9_fp2_t b);
|
||||
void sm9_fp2_mul_u(sm9_fp2_t r, const sm9_fp2_t a, const sm9_fp2_t b);
|
||||
void sm9_fp2_mul_fp(sm9_fp2_t r, const sm9_fp2_t a, const sm9_fp_t k);
|
||||
void sm9_fp2_sqr(sm9_fp2_t r, const sm9_fp2_t a);
|
||||
void sm9_fp2_sqr_u(sm9_fp2_t r, const sm9_fp2_t a);
|
||||
void sm9_fp2_inv(sm9_fp2_t r, const sm9_fp2_t a);
|
||||
void sm9_fp2_div(sm9_fp2_t r, const sm9_fp2_t a, const sm9_fp2_t b);
|
||||
void sm9_fp2_div2(sm9_fp2_t r, const sm9_fp2_t a);
|
||||
void sm9_fp2_to_hex(const sm9_fp2_t a, char hex[129]);
|
||||
int sm9_fp2_from_hex(sm9_fp2_t r, const char hex[129]);
|
||||
int sm9_fp2_print(FILE *fp, int fmt, int ind, const char *label, const sm9_fp2_t a);
|
||||
|
||||
|
||||
typedef sm9_fp2_t sm9_fp4_t[2];
|
||||
extern const sm9_fp4_t SM9_FP4_ZERO;
|
||||
extern const sm9_fp4_t SM9_FP4_ONE;
|
||||
extern const sm9_fp4_t SM9_FP4_U;
|
||||
extern const sm9_fp4_t SM9_FP4_V;
|
||||
|
||||
#define sm9_fp4_init(a) sm9_fp4_set_zero(a)
|
||||
#define sm9_fp4_clean(a) sm9_fp4_set_zero(a)
|
||||
#define sm9_fp4_set_zero(a) sm9_fp4_copy((a), SM9_FP4_ZERO)
|
||||
#define sm9_fp4_set_one(a) sm9_fp4_copy((a), SM9_FP4_ONE)
|
||||
#define sm9_fp4_is_zero(a) sm9_fp4_equ((a), SM9_FP4_ZERO)
|
||||
#define sm9_fp4_is_one(a) sm9_fp4_equ((a), SM9_FP4_ONE)
|
||||
|
||||
void sm9_fp4_set_u(sm9_fp4_t r);
|
||||
void sm9_fp4_set_v(sm9_fp4_t r);
|
||||
void sm9_fp4_set_fp(sm9_fp4_t r, const sm9_fp_t a);
|
||||
void sm9_fp4_set_fp2(sm9_fp4_t r, const sm9_fp2_t a);
|
||||
void sm9_fp4_set(sm9_fp4_t r, const sm9_fp2_t a0, const sm9_fp2_t a1);
|
||||
void sm9_fp4_copy(sm9_fp4_t r, const sm9_fp4_t a);
|
||||
int sm9_fp4_rand(sm9_fp4_t r);
|
||||
int sm9_fp4_equ(const sm9_fp4_t a, const sm9_fp4_t b);
|
||||
void sm9_fp4_add(sm9_fp4_t r, const sm9_fp4_t a, const sm9_fp4_t b);
|
||||
void sm9_fp4_dbl(sm9_fp4_t r, const sm9_fp4_t a);
|
||||
void sm9_fp4_sub(sm9_fp4_t r, const sm9_fp4_t a, const sm9_fp4_t b);
|
||||
void sm9_fp4_neg(sm9_fp4_t r, const sm9_fp4_t a);
|
||||
void sm9_fp4_mul(sm9_fp4_t r, const sm9_fp4_t a, const sm9_fp4_t b);
|
||||
void sm9_fp4_mul_fp(sm9_fp4_t r, const sm9_fp4_t a, const sm9_fp_t k);
|
||||
void sm9_fp4_mul_fp2(sm9_fp4_t r, const sm9_fp4_t a, const sm9_fp2_t b0);
|
||||
void sm9_fp4_mul_v(sm9_fp4_t r, const sm9_fp4_t a, const sm9_fp4_t b);
|
||||
void sm9_fp4_sqr(sm9_fp4_t r, const sm9_fp4_t a);
|
||||
void sm9_fp4_sqr_v(sm9_fp4_t r, const sm9_fp4_t a);
|
||||
void sm9_fp4_inv(sm9_fp4_t r, const sm9_fp4_t a);
|
||||
void sm9_fp4_to_bytes(const sm9_fp4_t a, uint8_t buf[128]);
|
||||
int sm9_fp4_from_bytes(sm9_fp4_t r, const uint8_t buf[128]);
|
||||
void sm9_fp4_to_hex(const sm9_fp4_t a, char hex[259]);
|
||||
int sm9_fp4_from_hex(sm9_fp4_t r, const char hex[259]);
|
||||
|
||||
|
||||
typedef sm9_fp4_t sm9_fp12_t[3];
|
||||
|
||||
#define sm9_fp12_init(r) sm9_fp12_set_zero(a)
|
||||
#define sm9_fp12_clean(r) sm9_fp12_set_zero(a)
|
||||
|
||||
void sm9_fp12_set_zero(sm9_fp12_t r);
|
||||
void sm9_fp12_set_one(sm9_fp12_t r);
|
||||
void sm9_fp12_set_u(sm9_fp12_t r);
|
||||
void sm9_fp12_set_v(sm9_fp12_t r);
|
||||
void sm9_fp12_set_w(sm9_fp12_t r);
|
||||
void sm9_fp12_set_w_sqr(sm9_fp12_t r);
|
||||
void sm9_fp12_set_fp(sm9_fp12_t r, const sm9_fp_t a);
|
||||
void sm9_fp12_set_fp2(sm9_fp12_t r, const sm9_fp2_t a);
|
||||
void sm9_fp12_set_fp4(sm9_fp12_t r, const sm9_fp4_t a);
|
||||
void sm9_fp12_set(sm9_fp12_t r, const sm9_fp4_t a0, const sm9_fp4_t a1, const sm9_fp4_t a2);
|
||||
void sm9_fp12_copy(sm9_fp12_t r, const sm9_fp12_t a);
|
||||
int sm9_fp12_rand(sm9_fp12_t r);
|
||||
int sm9_fp12_is_one(const sm9_fp12_t a);
|
||||
int sm9_fp12_is_zero(const sm9_fp12_t a);
|
||||
int sm9_fp12_equ(const sm9_fp12_t a, const sm9_fp12_t b);
|
||||
void sm9_fp12_add(sm9_fp12_t r, const sm9_fp12_t a, const sm9_fp12_t b);
|
||||
void sm9_fp12_dbl(sm9_fp12_t r, const sm9_fp12_t a);
|
||||
void sm9_fp12_tri(sm9_fp12_t r, const sm9_fp12_t a);
|
||||
void sm9_fp12_sub(sm9_fp12_t r, const sm9_fp12_t a, const sm9_fp12_t b);
|
||||
void sm9_fp12_neg(sm9_fp12_t r, const sm9_fp12_t a);
|
||||
void sm9_fp12_mul(sm9_fp12_t r, const sm9_fp12_t a, const sm9_fp12_t b);
|
||||
void sm9_fp12_sqr(sm9_fp12_t r, const sm9_fp12_t a);
|
||||
void sm9_fp12_inv(sm9_fp12_t r, const sm9_fp12_t a);
|
||||
void sm9_fp12_pow(sm9_fp12_t r, const sm9_fp12_t a, const sm9_bn_t k);
|
||||
void sm9_fp12_to_bytes(const sm9_fp12_t a, uint8_t buf[32 * 12]);
|
||||
int sm9_fp12_from_bytes(sm9_fp12_t r, const uint8_t in[32 * 12]);
|
||||
void sm9_fp12_to_hex(const sm9_fp12_t a, char hex[65 * 12]);
|
||||
int sm9_fp12_from_hex(sm9_fp12_t r, const char hex[65 * 12]); // 这个明显是不对的
|
||||
void sm9_fp12_print(const char *prefix, const sm9_fp12_t a);
|
||||
|
||||
|
||||
void sm9_fp2_conjugate(sm9_fp2_t r, const sm9_fp2_t a);
|
||||
void sm9_fp2_frobenius(sm9_fp2_t r, const sm9_fp2_t a);
|
||||
void sm9_fp4_frobenius(sm9_fp4_t r, const sm9_fp4_t a);
|
||||
void sm9_fp4_conjugate(sm9_fp4_t r, const sm9_fp4_t a);
|
||||
void sm9_fp4_frobenius2(sm9_fp4_t r, const sm9_fp4_t a);
|
||||
void sm9_fp4_frobenius3(sm9_fp4_t r, const sm9_fp4_t a);
|
||||
void sm9_fp12_frobenius(sm9_fp12_t r, const sm9_fp12_t x);
|
||||
void sm9_fp12_frobenius2(sm9_fp12_t r, const sm9_fp12_t x);
|
||||
void sm9_fp12_frobenius3(sm9_fp12_t r, const sm9_fp12_t x);
|
||||
void sm9_fp12_frobenius6(sm9_fp12_t r, const sm9_fp12_t x);
|
||||
|
||||
|
||||
typedef struct {
|
||||
sm9_fp_t X;
|
||||
sm9_fp_t Y;
|
||||
sm9_fp_t Z;
|
||||
} SM9_POINT;
|
||||
|
||||
#define sm9_point_init(R) sm9_point_set_infinity(R)
|
||||
#define sm9_point_clean(R) sm9_point_set_infinity(R)
|
||||
|
||||
void sm9_point_set_infinity(SM9_POINT *R);
|
||||
void sm9_point_copy(SM9_POINT *R, const SM9_POINT *P);
|
||||
void sm9_point_get_xy(const SM9_POINT *P, sm9_fp_t x, sm9_fp_t y);
|
||||
int sm9_point_is_at_infinity(const SM9_POINT *P);
|
||||
int sm9_point_equ(const SM9_POINT *P, const SM9_POINT *Q);
|
||||
int sm9_point_is_on_curve(const SM9_POINT *P);
|
||||
void sm9_point_dbl(SM9_POINT *R, const SM9_POINT *P);
|
||||
void sm9_point_add(SM9_POINT *R, const SM9_POINT *P, const SM9_POINT *Q);
|
||||
void sm9_point_neg(SM9_POINT *R, const SM9_POINT *P);
|
||||
void sm9_point_sub(SM9_POINT *R, const SM9_POINT *P, const SM9_POINT *Q);
|
||||
void sm9_point_mul(SM9_POINT *R, const sm9_bn_t k, const SM9_POINT *P);
|
||||
void sm9_point_mul_generator(SM9_POINT *R, const sm9_bn_t k);
|
||||
void sm9_point_from_hex(SM9_POINT *R, const char hex[65 * 2]);
|
||||
int sm9_point_to_uncompressed_octets(const SM9_POINT *P, uint8_t octets[65]);
|
||||
int sm9_point_from_uncompressed_octets(SM9_POINT *P, const uint8_t octets[65]);
|
||||
int sm9_point_print(FILE *fp, int fmt, int ind, const char *label, const SM9_POINT *P);
|
||||
|
||||
|
||||
typedef struct {
|
||||
sm9_fp2_t X;
|
||||
sm9_fp2_t Y;
|
||||
sm9_fp2_t Z;
|
||||
} SM9_TWIST_POINT;
|
||||
|
||||
#define sm9_twist_point_copy(R, P) memcpy((R), (P), sizeof(SM9_TWIST_POINT))
|
||||
|
||||
int sm9_twist_point_to_uncompressed_octets(const SM9_TWIST_POINT *P, uint8_t octets[129]);
|
||||
int sm9_twist_point_from_uncompressed_octets(SM9_TWIST_POINT *P, const uint8_t octets[129]);
|
||||
|
||||
|
||||
void sm9_twist_point_from_hex(SM9_TWIST_POINT *R, const char hex[65 * 4]);
|
||||
int sm9_twist_point_is_at_infinity(const SM9_TWIST_POINT *P);
|
||||
void sm9_twist_point_set_infinity(SM9_TWIST_POINT *R);
|
||||
void sm9_twist_point_get_xy(const SM9_TWIST_POINT *P, sm9_fp2_t x, sm9_fp2_t y);
|
||||
|
||||
int sm9_twist_point_equ(const SM9_TWIST_POINT *P, const SM9_TWIST_POINT *Q);
|
||||
int sm9_twist_point_is_on_curve(const SM9_TWIST_POINT *P);
|
||||
void sm9_twist_point_neg(SM9_TWIST_POINT *R, const SM9_TWIST_POINT *P);
|
||||
void sm9_twist_point_dbl(SM9_TWIST_POINT *R, const SM9_TWIST_POINT *P);
|
||||
void sm9_twist_point_add(SM9_TWIST_POINT *R, const SM9_TWIST_POINT *P, const SM9_TWIST_POINT *Q);
|
||||
void sm9_twist_point_sub(SM9_TWIST_POINT *R, const SM9_TWIST_POINT *P, const SM9_TWIST_POINT *Q);
|
||||
void sm9_twist_point_add_full(SM9_TWIST_POINT *R, const SM9_TWIST_POINT *P, const SM9_TWIST_POINT *Q);
|
||||
void sm9_twist_point_mul(SM9_TWIST_POINT *R, const sm9_bn_t k, const SM9_TWIST_POINT *P);
|
||||
void sm9_twist_point_mul_generator(SM9_TWIST_POINT *R, const sm9_bn_t k);
|
||||
int sm9_twist_point_print(FILE *fp, int fmt, int ind, const char *label, const SM9_TWIST_POINT *P);
|
||||
|
||||
|
||||
|
||||
void sm9_eval_g_tangent(sm9_fp12_t num, sm9_fp12_t den, const SM9_TWIST_POINT *P, const SM9_POINT *Q);
|
||||
void sm9_eval_g_line(sm9_fp12_t num, sm9_fp12_t den, const SM9_TWIST_POINT *T, const SM9_TWIST_POINT *P, const SM9_POINT *Q);
|
||||
void sm9_twist_point_pi1(SM9_TWIST_POINT *R, const SM9_TWIST_POINT *P);
|
||||
void sm9_twist_point_pi2(SM9_TWIST_POINT *R, const SM9_TWIST_POINT *P);
|
||||
void sm9_twist_point_neg_pi2(SM9_TWIST_POINT *R, const SM9_TWIST_POINT *P);
|
||||
void sm9_final_exponent_hard_part(sm9_fp12_t r, const sm9_fp12_t f);
|
||||
void sm9_final_exponent(sm9_fp12_t r, const sm9_fp12_t f);
|
||||
void sm9_pairing(sm9_fp12_t r, const SM9_TWIST_POINT *Q, const SM9_POINT *P);
|
||||
|
||||
int sm9_z256_hash1(sm9_z256_t h1, const char *id, size_t idlen, uint8_t hid);
|
||||
|
||||
/* private key extract algorithms */
|
||||
#define SM9_HID_SIGN 0x01
|
||||
@@ -363,9 +34,6 @@ void sm9_pairing(sm9_fp12_t r, const SM9_TWIST_POINT *Q, const SM9_POINT *P);
|
||||
#define SM9_HASH1_PREFIX 0x01
|
||||
#define SM9_HASH2_PREFIX 0x02
|
||||
|
||||
int sm9_hash1(sm9_bn_t h1, const char *id, size_t idlen, uint8_t hid);
|
||||
|
||||
|
||||
const char *sm9_oid_name(int oid);
|
||||
int sm9_oid_from_name(const char *name);
|
||||
int sm9_oid_to_der(int oid, uint8_t **out, size_t *outlen);
|
||||
@@ -397,13 +65,13 @@ SM9SignPrivateKey ::= SEQUENCE {
|
||||
Ppubs BIT STRING -- uncompressed octets of twisted point }
|
||||
*/
|
||||
typedef struct {
|
||||
SM9_TWIST_POINT Ppubs; // Ppubs = ks * P2
|
||||
sm9_fn_t ks;
|
||||
SM9_Z256_TWIST_POINT Ppubs; // Ppubs = ks * P2
|
||||
sm9_z256_t ks;
|
||||
} SM9_SIGN_MASTER_KEY;
|
||||
|
||||
typedef struct {
|
||||
SM9_TWIST_POINT Ppubs;
|
||||
SM9_POINT ds;
|
||||
SM9_Z256_TWIST_POINT Ppubs;
|
||||
SM9_Z256_POINT ds;
|
||||
} SM9_SIGN_KEY;
|
||||
|
||||
int sm9_sign_master_key_generate(SM9_SIGN_MASTER_KEY *master);
|
||||
@@ -443,8 +111,8 @@ SM9Signature ::= SEQUENCE {
|
||||
S BIT STRING -- uncompressed octets of ECPoint }
|
||||
*/
|
||||
typedef struct {
|
||||
sm9_fn_t h;
|
||||
SM9_POINT S;
|
||||
sm9_z256_t h;
|
||||
SM9_Z256_POINT S;
|
||||
} SM9_SIGNATURE;
|
||||
|
||||
int sm9_do_sign(const SM9_SIGN_KEY *key, const SM3_CTX *sm3_ctx, SM9_SIGNATURE *sig);
|
||||
@@ -468,6 +136,7 @@ int sm9_verify_finish(SM9_SIGN_CTX *ctx, const uint8_t *sig, size_t siglen,
|
||||
const SM9_SIGN_MASTER_KEY *mpk, const char *id, size_t idlen);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
SM9EncMasterKey ::= SEQUENCE {
|
||||
de INTEGER,
|
||||
@@ -482,13 +151,13 @@ SM9EncPrivateKey ::= SEQUENCE {
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
SM9_POINT Ppube; // Ppube = ke * P1
|
||||
sm9_fn_t ke;
|
||||
SM9_Z256_POINT Ppube; // Ppube = ke * P1
|
||||
sm9_z256_t ke;
|
||||
} SM9_ENC_MASTER_KEY;
|
||||
|
||||
typedef struct {
|
||||
SM9_POINT Ppube;
|
||||
SM9_TWIST_POINT de;
|
||||
SM9_Z256_POINT Ppube;
|
||||
SM9_Z256_TWIST_POINT de;
|
||||
} SM9_ENC_KEY;
|
||||
|
||||
int sm9_enc_master_key_generate(SM9_ENC_MASTER_KEY *master);
|
||||
@@ -534,18 +203,18 @@ SM9Cipher ::= SEQUENCE {
|
||||
CipherText OCTET STRING }
|
||||
*/
|
||||
|
||||
int sm9_kem_encrypt(const SM9_ENC_MASTER_KEY *mpk, const char *id, size_t idlen, size_t klen, uint8_t *kbuf, SM9_POINT *C);
|
||||
int sm9_kem_decrypt(const SM9_ENC_KEY *key, const char *id, size_t idlen, const SM9_POINT *C, size_t klen, uint8_t *kbuf);
|
||||
int sm9_kem_encrypt(const SM9_ENC_MASTER_KEY *mpk, const char *id, size_t idlen, size_t klen, uint8_t *kbuf, SM9_Z256_POINT *C);
|
||||
int sm9_kem_decrypt(const SM9_ENC_KEY *key, const char *id, size_t idlen, const SM9_Z256_POINT *C, size_t klen, uint8_t *kbuf);
|
||||
int sm9_do_encrypt(const SM9_ENC_MASTER_KEY *mpk, const char *id, size_t idlen,
|
||||
const uint8_t *in, size_t inlen, SM9_POINT *C1, uint8_t *c2, uint8_t c3[SM3_HMAC_SIZE]);
|
||||
const uint8_t *in, size_t inlen, SM9_Z256_POINT *C1, uint8_t *c2, uint8_t c3[SM3_HMAC_SIZE]);
|
||||
int sm9_do_decrypt(const SM9_ENC_KEY *key, const char *id, size_t idlen,
|
||||
const SM9_POINT *C1, const uint8_t *c2, size_t c2len, const uint8_t c3[SM3_HMAC_SIZE], uint8_t *out);
|
||||
const SM9_Z256_POINT *C1, const uint8_t *c2, size_t c2len, const uint8_t c3[SM3_HMAC_SIZE], uint8_t *out);
|
||||
|
||||
#define SM9_MAX_PLAINTEXT_SIZE 255
|
||||
#define SM9_MAX_CIPHERTEXT_SIZE 367 // calculated in test_sm9_ciphertext()
|
||||
int sm9_ciphertext_to_der(const SM9_POINT *C1, const uint8_t *c2, size_t c2len,
|
||||
int sm9_ciphertext_to_der(const SM9_Z256_POINT *C1, const uint8_t *c2, size_t c2len,
|
||||
const uint8_t c3[SM3_HMAC_SIZE], uint8_t **out, size_t *outlen);
|
||||
int sm9_ciphertext_from_der(SM9_POINT *C1, const uint8_t **c2, size_t *c2len,
|
||||
int sm9_ciphertext_from_der(SM9_Z256_POINT *C1, const uint8_t **c2, size_t *c2len,
|
||||
const uint8_t **c3, const uint8_t **in, size_t *inlen);
|
||||
int sm9_ciphertext_print(FILE *fp, int fmt, int ind, const char *label, const uint8_t *a, size_t alen);
|
||||
int sm9_encrypt(const SM9_ENC_MASTER_KEY *mpk, const char *id, size_t idlen,
|
||||
@@ -554,6 +223,19 @@ int sm9_decrypt(const SM9_ENC_KEY *key, const char *id, size_t idlen,
|
||||
const uint8_t *in, size_t inlen, uint8_t *out, size_t *outlen);
|
||||
|
||||
|
||||
// SM9 Key Exchange (To be continued)
|
||||
#define SM9_EXCH_MASTER_KEY SM9_ENC_MASTER_KEY
|
||||
#define SM9_EXCH_KEY SM9_ENC_KEY
|
||||
#define sm9_exch_master_key_generate(msk) sm9_enc_master_key_generate(msk)
|
||||
int sm9_exch_master_key_extract_key(SM9_EXCH_MASTER_KEY *master, const char *id, size_t idlen, SM9_EXCH_KEY *key);
|
||||
|
||||
int sm9_exch_step_1A(const SM9_EXCH_MASTER_KEY *mpk, const char *idB, size_t idBlen, SM9_Z256_POINT *RA, sm9_z256_t rA);
|
||||
int sm9_exch_step_1B(const SM9_EXCH_MASTER_KEY *mpk, const char *idA, size_t idAlen, const char *idB, size_t idBlen,
|
||||
const SM9_EXCH_KEY *key, const SM9_Z256_POINT *RA, SM9_Z256_POINT *RB, uint8_t *sk, size_t klen);
|
||||
int sm9_exch_step_2A(const SM9_EXCH_MASTER_KEY *mpk, const char *idA, size_t idAlen, const char *idB, size_t idBlen,
|
||||
const SM9_EXCH_KEY *key, const sm9_z256_t rA, const SM9_Z256_POINT *RA, const SM9_Z256_POINT *RB, uint8_t *sk, size_t klen);
|
||||
int sm9_exch_step_2B();
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
247
thirdparty/GmSSL-3.1.1/include/gmssl/sm9_z256.h
vendored
Normal file
247
thirdparty/GmSSL-3.1.1/include/gmssl/sm9_z256.h
vendored
Normal file
@@ -0,0 +1,247 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
#ifndef GMSSL_SM9_Z256_H
|
||||
#define GMSSL_SM9_Z256_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <gmssl/sm3.h>
|
||||
#include <gmssl/sm2.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
typedef uint64_t sm9_z256_t[4];
|
||||
|
||||
void sm9_z256_set_one(sm9_z256_t r);
|
||||
void sm9_z256_set_zero(sm9_z256_t r);
|
||||
void sm9_z256_copy(sm9_z256_t r, const sm9_z256_t a);
|
||||
void sm9_z256_copy_conditional(sm9_z256_t r, const sm9_z256_t a, uint64_t move);
|
||||
int sm9_z256_cmp(const sm9_z256_t a, const sm9_z256_t b);
|
||||
uint64_t sm9_z256_is_zero(const sm9_z256_t a);
|
||||
uint64_t sm9_z256_equ(const sm9_z256_t a, const sm9_z256_t b);
|
||||
uint64_t sm9_z256_add(sm9_z256_t r, const sm9_z256_t a, const sm9_z256_t b);
|
||||
uint64_t sm9_z256_sub(sm9_z256_t r, const sm9_z256_t a, const sm9_z256_t b);
|
||||
void sm9_z256_mul(uint64_t r[8], const sm9_z256_t a, const sm9_z256_t b);
|
||||
void sm9_z256_from_bytes(sm9_z256_t r, const uint8_t in[32]);
|
||||
void sm9_z256_to_bytes(const sm9_z256_t a, uint8_t out[32]);
|
||||
int sm9_z256_from_hex(sm9_z256_t r, const char *hex);
|
||||
void sm9_z256_to_hex(const sm9_z256_t r, char hex[64]);
|
||||
int sm9_z256_equ_hex(const sm9_z256_t a, const char *hex);
|
||||
void sm9_z256_to_bits(const sm9_z256_t a, char bits[256]);
|
||||
int sm9_z256_rand_range(sm9_z256_t r, const sm9_z256_t range);
|
||||
void sm9_z256_print_bn(const char *prefix, const sm9_z256_t a);
|
||||
int sm9_z256_print(FILE *fp, int ind, int fmt, const char *label, const sm9_z256_t a);
|
||||
|
||||
const uint64_t *sm9_z256_prime(void);
|
||||
|
||||
void sm9_z256_modp_add(sm9_z256_t r, const sm9_z256_t a, const sm9_z256_t b);
|
||||
void sm9_z256_modp_sub(sm9_z256_t r, const sm9_z256_t a, const sm9_z256_t b);
|
||||
void sm9_z256_modp_dbl(sm9_z256_t r, const sm9_z256_t a);
|
||||
void sm9_z256_modp_tri(sm9_z256_t r, const sm9_z256_t a);
|
||||
void sm9_z256_modp_haf(sm9_z256_t r, const sm9_z256_t a);
|
||||
void sm9_z256_modp_neg(sm9_z256_t r, const sm9_z256_t a);
|
||||
|
||||
void sm9_z256_modp_to_mont(sm9_z256_t r, const sm9_z256_t a);
|
||||
void sm9_z256_modp_from_mont(sm9_z256_t r, const sm9_z256_t a);
|
||||
void sm9_z256_modp_mont_mul(sm9_z256_t r, const sm9_z256_t a, const sm9_z256_t b);
|
||||
void sm9_z256_modp_mont_sqr(sm9_z256_t r, const sm9_z256_t a);
|
||||
void sm9_z256_modp_mont_pow(sm9_z256_t r, const sm9_z256_t a, const sm9_z256_t e);
|
||||
void sm9_z256_modp_mont_inv(sm9_z256_t r, const sm9_z256_t a);
|
||||
|
||||
const uint64_t *sm9_z256_order(void);
|
||||
|
||||
void sm9_z256_modn_add(sm9_z256_t r, const sm9_z256_t a, const sm9_z256_t b);
|
||||
void sm9_z256_modn_sub(sm9_z256_t r, const sm9_z256_t a, const sm9_z256_t b);
|
||||
void sm9_z256_modn_mul(sm9_z256_t r, const sm9_z256_t a, const sm9_z256_t b);
|
||||
void sm9_z256_modn_pow(sm9_z256_t r, const sm9_z256_t a, const sm9_z256_t e);
|
||||
void sm9_z256_modn_inv(sm9_z256_t r, const sm9_z256_t a);
|
||||
void sm9_z256_modn_from_hash(sm9_z256_t h, const uint8_t Ha[40]);
|
||||
|
||||
|
||||
typedef sm9_z256_t sm9_z256_fp2_t[2];
|
||||
|
||||
void sm9_z256_fp2_set_one(sm9_z256_fp2_t r);
|
||||
void sm9_z256_fp2_set_zero(sm9_z256_fp2_t r);
|
||||
int sm9_z256_fp2_is_one(const sm9_z256_fp2_t a);
|
||||
int sm9_z256_fp2_is_zero(const sm9_z256_fp2_t a);
|
||||
int sm9_z256_fp2_equ(const sm9_z256_fp2_t a, const sm9_z256_fp2_t b);
|
||||
void sm9_z256_fp2_copy(sm9_z256_fp2_t r, const sm9_z256_fp2_t a);
|
||||
int sm9_z256_fp2_rand(sm9_z256_fp2_t r);
|
||||
void sm9_z256_fp2_to_bytes(const sm9_z256_fp2_t a, uint8_t buf[64]);
|
||||
int sm9_z256_fp2_from_bytes(sm9_z256_fp2_t r, const uint8_t buf[64]);
|
||||
void sm9_z256_fp2_to_hex(const sm9_z256_fp2_t a, char hex[129]);
|
||||
int sm9_z256_fp2_from_hex(sm9_z256_fp2_t r, const char hex[129]);
|
||||
void sm9_z256_fp2_add(sm9_z256_fp2_t r, const sm9_z256_fp2_t a, const sm9_z256_fp2_t b);
|
||||
void sm9_z256_fp2_dbl(sm9_z256_fp2_t r, const sm9_z256_fp2_t a);
|
||||
void sm9_z256_fp2_tri(sm9_z256_fp2_t r, const sm9_z256_fp2_t a);
|
||||
void sm9_z256_fp2_sub(sm9_z256_fp2_t r, const sm9_z256_fp2_t a, const sm9_z256_fp2_t b);
|
||||
void sm9_z256_fp2_neg(sm9_z256_fp2_t r, const sm9_z256_fp2_t a);
|
||||
void sm9_z256_fp2_a_mul_u(sm9_z256_fp2_t r, sm9_z256_fp2_t a);
|
||||
void sm9_z256_fp2_mul(sm9_z256_fp2_t r, const sm9_z256_fp2_t a, const sm9_z256_fp2_t b);
|
||||
void sm9_z256_fp2_mul_u(sm9_z256_fp2_t r, const sm9_z256_fp2_t a, const sm9_z256_fp2_t b);
|
||||
void sm9_z256_fp2_mul_fp(sm9_z256_fp2_t r, const sm9_z256_fp2_t a, const sm9_z256_t k);
|
||||
void sm9_z256_fp2_sqr(sm9_z256_fp2_t r, const sm9_z256_fp2_t a);
|
||||
void sm9_z256_fp2_sqr_u(sm9_z256_fp2_t r, const sm9_z256_fp2_t a);
|
||||
void sm9_z256_fp2_inv(sm9_z256_fp2_t r, const sm9_z256_fp2_t a);
|
||||
void sm9_z256_fp2_div(sm9_z256_fp2_t r, const sm9_z256_fp2_t a, const sm9_z256_fp2_t b);
|
||||
void sm9_z256_fp2_haf(sm9_z256_fp2_t r, const sm9_z256_fp2_t a);
|
||||
void sm9_z256_fp2_conjugate(sm9_z256_fp2_t r, const sm9_z256_fp2_t a);
|
||||
void sm9_z256_fp2_frobenius(sm9_z256_fp2_t r, const sm9_z256_fp2_t a);
|
||||
|
||||
|
||||
typedef sm9_z256_fp2_t sm9_z256_fp4_t[2];
|
||||
|
||||
int sm9_z256_fp4_is_zero(const sm9_z256_fp4_t a);
|
||||
int sm9_z256_fp4_equ(const sm9_z256_fp4_t a, const sm9_z256_fp4_t b);
|
||||
int sm9_z256_fp4_rand(sm9_z256_fp4_t r);
|
||||
void sm9_z256_fp4_copy(sm9_z256_fp4_t r, const sm9_z256_fp4_t a);
|
||||
void sm9_z256_fp4_to_bytes(const sm9_z256_fp4_t a, uint8_t buf[128]);
|
||||
int sm9_z256_fp4_from_bytes(sm9_z256_fp4_t r, const uint8_t buf[128]);
|
||||
int sm9_z256_fp4_from_hex(sm9_z256_fp4_t r, const char hex[259]);
|
||||
void sm9_z256_fp4_to_hex(const sm9_z256_fp4_t a, char hex[259]);
|
||||
void sm9_z256_fp4_add(sm9_z256_fp4_t r, const sm9_z256_fp4_t a, const sm9_z256_fp4_t b);
|
||||
void sm9_z256_fp4_dbl(sm9_z256_fp4_t r, const sm9_z256_fp4_t a);
|
||||
void sm9_z256_fp4_sub(sm9_z256_fp4_t r, const sm9_z256_fp4_t a, const sm9_z256_fp4_t b);
|
||||
void sm9_z256_fp4_neg(sm9_z256_fp4_t r, const sm9_z256_fp4_t a);
|
||||
void sm9_z256_fp4_haf(sm9_z256_fp4_t r, const sm9_z256_fp4_t a);
|
||||
void sm9_z256_fp4_a_mul_v(sm9_z256_fp4_t r, sm9_z256_fp4_t a);
|
||||
void sm9_z256_fp4_mul(sm9_z256_fp4_t r, const sm9_z256_fp4_t a, const sm9_z256_fp4_t b);
|
||||
void sm9_z256_fp4_mul_fp(sm9_z256_fp4_t r, const sm9_z256_fp4_t a, const sm9_z256_t k);
|
||||
void sm9_z256_fp4_mul_fp2(sm9_z256_fp4_t r, const sm9_z256_fp4_t a, const sm9_z256_fp2_t b0);
|
||||
void sm9_z256_fp4_mul_v(sm9_z256_fp4_t r, const sm9_z256_fp4_t a, const sm9_z256_fp4_t b);
|
||||
void sm9_z256_fp4_sqr(sm9_z256_fp4_t r, const sm9_z256_fp4_t a);
|
||||
void sm9_z256_fp4_sqr_v(sm9_z256_fp4_t r, const sm9_z256_fp4_t a);
|
||||
void sm9_z256_fp4_inv(sm9_z256_fp4_t r, const sm9_z256_fp4_t a);
|
||||
void sm9_z256_fp4_frobenius(sm9_z256_fp4_t r, const sm9_z256_fp4_t a);
|
||||
void sm9_z256_fp4_conjugate(sm9_z256_fp4_t r, const sm9_z256_fp4_t a);
|
||||
void sm9_z256_fp4_frobenius2(sm9_z256_fp4_t r, const sm9_z256_fp4_t a);
|
||||
void sm9_z256_fp4_frobenius3(sm9_z256_fp4_t r, const sm9_z256_fp4_t a);
|
||||
|
||||
|
||||
typedef sm9_z256_fp4_t sm9_z256_fp12_t[3];
|
||||
|
||||
void sm9_z256_fp12_set_one(sm9_z256_fp12_t r);
|
||||
void sm9_z256_fp12_set_zero(sm9_z256_fp12_t r);
|
||||
void sm9_z256_fp12_copy(sm9_z256_fp12_t r, const sm9_z256_fp12_t a);
|
||||
int sm9_z256_fp12_rand(sm9_z256_fp12_t r);
|
||||
int sm9_z256_fp12_from_hex(sm9_z256_fp12_t r, const char hex[779]); // 779 = 64*12 + 11
|
||||
void sm9_z256_fp12_to_hex(const sm9_z256_fp12_t a, char hex[779]);
|
||||
void sm9_z256_fp12_to_bytes(const sm9_z256_fp12_t a, uint8_t buf[384]);
|
||||
int sm9_z256_fp12_from_bytes(sm9_z256_fp12_t r, const uint8_t buf[384]);
|
||||
|
||||
void sm9_z256_fp12_print(const char *prefix, const sm9_z256_fp12_t a);
|
||||
void sm9_z256_fp12_set(sm9_z256_fp12_t r, const sm9_z256_fp4_t a0, const sm9_z256_fp4_t a1, const sm9_z256_fp4_t a2);
|
||||
int sm9_z256_fp12_equ(const sm9_z256_fp12_t a, const sm9_z256_fp12_t b);
|
||||
void sm9_z256_fp12_add(sm9_z256_fp12_t r, const sm9_z256_fp12_t a, const sm9_z256_fp12_t b);
|
||||
void sm9_z256_fp12_dbl(sm9_z256_fp12_t r, const sm9_z256_fp12_t a);
|
||||
void sm9_z256_fp12_tri(sm9_z256_fp12_t r, const sm9_z256_fp12_t a);
|
||||
void sm9_z256_fp12_sub(sm9_z256_fp12_t r, const sm9_z256_fp12_t a, const sm9_z256_fp12_t b);
|
||||
void sm9_z256_fp12_neg(sm9_z256_fp12_t r, const sm9_z256_fp12_t a);
|
||||
void sm9_z256_fp12_mul(sm9_z256_fp12_t r, const sm9_z256_fp12_t a, const sm9_z256_fp12_t b);
|
||||
void sm9_z256_fp12_sqr(sm9_z256_fp12_t r, const sm9_z256_fp12_t a);
|
||||
void sm9_z256_fp12_inv(sm9_z256_fp12_t r, const sm9_z256_fp12_t a);
|
||||
void sm9_z256_fp12_pow(sm9_z256_fp12_t r, const sm9_z256_fp12_t a, const sm9_z256_t k);
|
||||
void sm9_z256_fp12_frobenius(sm9_z256_fp12_t r, const sm9_z256_fp12_t x);
|
||||
void sm9_z256_fp12_frobenius2(sm9_z256_fp12_t r, const sm9_z256_fp12_t x);
|
||||
void sm9_z256_fp12_frobenius3(sm9_z256_fp12_t r, const sm9_z256_fp12_t x);
|
||||
void sm9_z256_fp12_frobenius6(sm9_z256_fp12_t r, const sm9_z256_fp12_t x);
|
||||
|
||||
|
||||
// E(F_p): y^2 = x^3 + 5
|
||||
|
||||
typedef struct {
|
||||
sm9_z256_t X; // is mont(X)
|
||||
sm9_z256_t Y; // is mont(Y)
|
||||
sm9_z256_t Z; // is mont(Z)
|
||||
} SM9_Z256_POINT;
|
||||
|
||||
const SM9_Z256_POINT *sm9_z256_generator(void);
|
||||
|
||||
int sm9_z256_point_from_hex(SM9_Z256_POINT *R, const char hex[129]);
|
||||
int sm9_z256_point_is_at_infinity(const SM9_Z256_POINT *P);
|
||||
void sm9_z256_point_set_infinity(SM9_Z256_POINT *R);
|
||||
void sm9_z256_point_get_xy(const SM9_Z256_POINT *P, sm9_z256_t x, sm9_z256_t y);
|
||||
int sm9_z256_point_equ(const SM9_Z256_POINT *P, const SM9_Z256_POINT *Q);
|
||||
int sm9_z256_point_is_on_curve(const SM9_Z256_POINT *P);
|
||||
void sm9_z256_point_dbl(SM9_Z256_POINT *R, const SM9_Z256_POINT *P);
|
||||
void sm9_z256_point_neg(SM9_Z256_POINT *R, const SM9_Z256_POINT *P);
|
||||
void sm9_z256_point_add(SM9_Z256_POINT *R, const SM9_Z256_POINT *P, const SM9_Z256_POINT *Q);
|
||||
void sm9_z256_point_sub(SM9_Z256_POINT *R, const SM9_Z256_POINT *P, const SM9_Z256_POINT *Q);
|
||||
void sm9_z256_point_mul(SM9_Z256_POINT *R, const sm9_z256_t k, const SM9_Z256_POINT *P);
|
||||
void sm9_z256_point_mul_generator(SM9_Z256_POINT *R, const sm9_z256_t k);
|
||||
int sm9_z256_point_print(FILE *fp, int fmt, int ind, const char *label, const SM9_Z256_POINT *P);
|
||||
int sm9_z256_point_to_uncompressed_octets(const SM9_Z256_POINT *P, uint8_t octets[65]);
|
||||
int sm9_z256_point_from_uncompressed_octets(SM9_Z256_POINT *P, const uint8_t octets[65]);
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint64_t X[4];
|
||||
uint64_t Y[4];
|
||||
} SM9_Z256_AFFINE_POINT;
|
||||
|
||||
void sm9_z256_point_copy_affine(SM9_Z256_POINT *R, const SM9_Z256_AFFINE_POINT *P);
|
||||
void sm9_z256_point_add_affine(SM9_Z256_POINT *R, const SM9_Z256_POINT *P, const SM9_Z256_AFFINE_POINT *Q);
|
||||
void sm9_z256_point_sub_affine(SM9_Z256_POINT *R, const SM9_Z256_POINT *P, const SM9_Z256_AFFINE_POINT *Q);
|
||||
|
||||
|
||||
typedef struct {
|
||||
sm9_z256_fp2_t X;
|
||||
sm9_z256_fp2_t Y;
|
||||
sm9_z256_fp2_t Z;
|
||||
} SM9_Z256_TWIST_POINT;
|
||||
|
||||
const SM9_Z256_TWIST_POINT *sm9_z256_twist_generator(void);
|
||||
|
||||
int sm9_z256_twist_point_to_uncompressed_octets(const SM9_Z256_TWIST_POINT *P, uint8_t octets[129]);
|
||||
int sm9_z256_twist_point_from_uncompressed_octets(SM9_Z256_TWIST_POINT *P, const uint8_t octets[129]);
|
||||
|
||||
int sm9_z256_twist_point_print(FILE *fp, int fmt, int ind, const char *label, const SM9_Z256_TWIST_POINT *P);
|
||||
void sm9_z256_twist_point_from_hex(SM9_Z256_TWIST_POINT *R, const char hex[259]); // 259 = 64 * 4 + 3
|
||||
int sm9_z256_twist_point_is_at_infinity(const SM9_Z256_TWIST_POINT *P);
|
||||
void sm9_z256_twist_point_set_infinity(SM9_Z256_TWIST_POINT *R);
|
||||
void sm9_z256_twist_point_get_xy(const SM9_Z256_TWIST_POINT *P, sm9_z256_fp2_t x, sm9_z256_fp2_t y);
|
||||
int sm9_z256_twist_point_equ(const SM9_Z256_TWIST_POINT *P, const SM9_Z256_TWIST_POINT *Q);
|
||||
int sm9_z256_twist_point_is_on_curve(const SM9_Z256_TWIST_POINT *P);
|
||||
void sm9_z256_twist_point_neg(SM9_Z256_TWIST_POINT *R, const SM9_Z256_TWIST_POINT *P);
|
||||
void sm9_z256_twist_point_dbl(SM9_Z256_TWIST_POINT *R, const SM9_Z256_TWIST_POINT *P);
|
||||
void sm9_z256_twist_point_add(SM9_Z256_TWIST_POINT *R, const SM9_Z256_TWIST_POINT *P, const SM9_Z256_TWIST_POINT *Q);
|
||||
void sm9_z256_twist_point_sub(SM9_Z256_TWIST_POINT *R, const SM9_Z256_TWIST_POINT *P, const SM9_Z256_TWIST_POINT *Q);
|
||||
void sm9_z256_twist_point_add_full(SM9_Z256_TWIST_POINT *R, const SM9_Z256_TWIST_POINT *P, const SM9_Z256_TWIST_POINT *Q);
|
||||
void sm9_z256_twist_point_mul(SM9_Z256_TWIST_POINT *R, const sm9_z256_t k, const SM9_Z256_TWIST_POINT *P);
|
||||
void sm9_z256_twist_point_mul_generator(SM9_Z256_TWIST_POINT *R, const sm9_z256_t k);
|
||||
|
||||
|
||||
void sm9_z256_point_to_affine(SM9_Z256_AFFINE_POINT *Q, const SM9_Z256_POINT *P);
|
||||
void sm9_z256_eval_g_tangent(SM9_Z256_TWIST_POINT *R, sm9_z256_fp2_t lw[3],
|
||||
const SM9_Z256_TWIST_POINT *P, const SM9_Z256_AFFINE_POINT *Q);
|
||||
void sm9_z256_eval_g_line(SM9_Z256_TWIST_POINT *R, sm9_z256_fp2_t lw[3], sm9_z256_fp2_t pre[5],
|
||||
const SM9_Z256_TWIST_POINT *P, const SM9_Z256_TWIST_POINT *T, const SM9_Z256_AFFINE_POINT *Q);
|
||||
void sm9_z256_eval_g_line_no_pre(SM9_Z256_TWIST_POINT *R, sm9_z256_fp2_t lw[3],
|
||||
const SM9_Z256_TWIST_POINT *P, const SM9_Z256_TWIST_POINT *T, const SM9_Z256_AFFINE_POINT *Q);
|
||||
void sm9_z256_fp12_line_mul(sm9_z256_fp12_t r, const sm9_z256_fp12_t a, const sm9_z256_fp2_t lw[3]);
|
||||
//void sm9_z256_eval_g_tangent(sm9_z256_fp12_t num, sm9_z256_fp12_t den, const SM9_Z256_TWIST_POINT *P, const SM9_Z256_POINT *Q);
|
||||
//void sm9_z256_eval_g_line(sm9_z256_fp12_t num, sm9_z256_fp12_t den, const SM9_Z256_TWIST_POINT *T, const SM9_Z256_TWIST_POINT *P, const SM9_Z256_POINT *Q);
|
||||
void sm9_z256_twist_point_pi1(SM9_Z256_TWIST_POINT *R, const SM9_Z256_TWIST_POINT *P);
|
||||
void sm9_z256_twist_point_pi2(SM9_Z256_TWIST_POINT *R, const SM9_Z256_TWIST_POINT *P);
|
||||
void sm9_z256_twist_point_neg_pi2(SM9_Z256_TWIST_POINT *R, const SM9_Z256_TWIST_POINT *P);
|
||||
void sm9_z256_final_exponent_hard_part(sm9_z256_fp12_t r, const sm9_z256_fp12_t f);
|
||||
void sm9_z256_final_exponent(sm9_z256_fp12_t r, const sm9_z256_fp12_t f);
|
||||
void sm9_z256_pairing(sm9_z256_fp12_t r, const SM9_Z256_TWIST_POINT *Q, const SM9_Z256_POINT *P);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -35,7 +36,7 @@ typedef int tls_socklen_t;
|
||||
#define tls_socket_send(sock,buf,len,flags) send(sock,buf,(int)(len),flags)
|
||||
#define tls_socket_recv(sock,buf,len,flags) recv(sock,buf,(int)(len),flags)
|
||||
#define tls_socket_close(sock) closesocket(sock)
|
||||
|
||||
#define tls_socket_wait() Sleep(1)
|
||||
|
||||
#else
|
||||
|
||||
@@ -55,6 +56,7 @@ typedef socklen_t tls_socklen_t;
|
||||
#define tls_socket_send(sock,buf,len,flags) send(sock,buf,len,flags)
|
||||
#define tls_socket_recv(sock,buf,len,flags) recv(sock,buf,len,flags)
|
||||
#define tls_socket_close(sock) close(sock)
|
||||
#define tls_socket_wait() usleep(1000)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
94
thirdparty/GmSSL-3.1.1/include/gmssl/tls.h
vendored
94
thirdparty/GmSSL-3.1.1/include/gmssl/tls.h
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2022 The GmSSL Project. All Rights Reserved.
|
||||
/*
|
||||
* Copyright 2014-2023 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.
|
||||
@@ -27,39 +27,6 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
TLS Public API
|
||||
|
||||
TLS_PROTOCOL
|
||||
TLS_protocol_tlcp
|
||||
TLS_protocol_tls12
|
||||
TLS_protocol_tls13
|
||||
|
||||
TLS_CIPHER_SUITE
|
||||
TLS_cipher_ecc_sm4_cbc_sm3
|
||||
TLS_cipher_ecc_sm4_gcm_sm3
|
||||
TLS_cipher_ecdhe_sm4_cbc_sm3
|
||||
TLS_cipher_ecdhe_sm4_gcm_sm3
|
||||
TLS_cipher_sm4_gcm_sm3
|
||||
|
||||
TLS_CTX
|
||||
tls_ctx_init
|
||||
tls_ctx_set_cipher_suites
|
||||
tls_ctx_set_ca_certificates
|
||||
tls_ctx_set_certificate_and_key
|
||||
tls_ctx_set_tlcp_server_certificate_and_keys
|
||||
tls_ctx_cleanup
|
||||
|
||||
TLS_CONNECT
|
||||
tls_init
|
||||
tls_set_socket
|
||||
tls_do_handshake
|
||||
tls_send
|
||||
tls_recv
|
||||
tls_shutdown
|
||||
tls_cleanup
|
||||
*/
|
||||
|
||||
typedef uint32_t uint24_t;
|
||||
|
||||
#define tls_uint8_size() 1
|
||||
@@ -108,7 +75,7 @@ typedef enum {
|
||||
TLS_cipher_sm4_ccm_sm3 = 0x00c7,
|
||||
|
||||
// TLCP, GB/T 38636-2020, GM/T 0024-2012
|
||||
TLS_cipher_ecdhe_sm4_cbc_sm3 = 0xe011, // 可以让TLSv1.2使用这个
|
||||
TLS_cipher_ecdhe_sm4_cbc_sm3 = 0xe011, // TODO: let TLSv1.2 use this as default cipher suite
|
||||
TLS_cipher_ecdhe_sm4_gcm_sm3 = 0xe051,
|
||||
TLS_cipher_ecc_sm4_cbc_sm3 = 0xe013,
|
||||
TLS_cipher_ecc_sm4_gcm_sm3 = 0xe053,
|
||||
@@ -286,8 +253,6 @@ typedef enum {
|
||||
const char *tls_curve_type_name(int type);
|
||||
|
||||
|
||||
// 与其支持v2,还不如直接修改v2,让v2和v3兼容
|
||||
|
||||
typedef enum {
|
||||
TLS_curve_secp256k1 = 22,
|
||||
TLS_curve_secp256r1 = 23,
|
||||
@@ -304,7 +269,7 @@ typedef enum {
|
||||
TLS_curve_sm2p256v1 = 41, // GmSSLv2: 30
|
||||
} TLS_NAMED_CURVE;
|
||||
|
||||
const char *tls_named_curve_name(int curve);
|
||||
const char *tls_curve_name(int curve);
|
||||
|
||||
|
||||
typedef enum {
|
||||
@@ -342,6 +307,7 @@ typedef enum {
|
||||
|
||||
|
||||
typedef enum {
|
||||
TLS_alert_level_undefined = 0,
|
||||
TLS_alert_level_warning = 1,
|
||||
TLS_alert_level_fatal = 2,
|
||||
} TLS_ALERT_LEVEL;
|
||||
@@ -440,14 +406,15 @@ typedef struct {
|
||||
#define tls_record_protocol(record) (((uint16_t)((record)[1]) << 8) | (record)[2])
|
||||
#define tls_record_data(record) ((record)+TLS_RECORD_HEADER_SIZE)
|
||||
#define tls_record_data_length(record) (((uint16_t)((record)[3]) << 8) | (record)[4])
|
||||
#define tls_record_length(record) (TLS_RECORD_HEADER_SIZE + tls_record_data_length(record))
|
||||
#define tls_record_length(record) ((size_t)(TLS_RECORD_HEADER_SIZE + tls_record_data_length(record)))
|
||||
|
||||
int tls_record_set_type(uint8_t *record, int type);
|
||||
int tls_record_set_protocol(uint8_t *record, int protocol);
|
||||
int tls_record_set_data_length(uint8_t *record, size_t length);
|
||||
int tls_record_set_data(uint8_t *record, const uint8_t *data, size_t datalen);
|
||||
|
||||
// 握手消息ServerKeyExchange, ClientKeyExchange的解析依赖当前密码套件
|
||||
|
||||
// parse ServerKeyExchange, ClientKeyExchange depends on current cipher_suite
|
||||
#define tls_format_set_cipher_suite(fmt,cipher) do {(fmt)|=((cipher)<<8);} while (0)
|
||||
int tls_record_print(FILE *fp, const uint8_t *record, size_t recordlen, int format, int indent);
|
||||
int tlcp_record_print(FILE *fp, const uint8_t *record, size_t recordlen, int format, int indent);
|
||||
@@ -534,13 +501,13 @@ int tls13_process_client_supported_versions(const uint8_t *ext_data, size_t ext_
|
||||
|
||||
int tls13_process_server_supported_versions(const uint8_t *ext_data, size_t ext_datalen);
|
||||
|
||||
int tls13_key_share_entry_to_bytes(const SM2_POINT *point, uint8_t **out, size_t *outlen);
|
||||
int tls13_client_key_share_ext_to_bytes(const SM2_POINT *point, uint8_t **out, size_t *outlen);
|
||||
int tls13_server_key_share_ext_to_bytes(const SM2_POINT *point, uint8_t **out, size_t *outlen);
|
||||
int tls13_key_share_entry_to_bytes(const SM2_Z256_POINT *point, uint8_t **out, size_t *outlen);
|
||||
int tls13_client_key_share_ext_to_bytes(const SM2_Z256_POINT *point, uint8_t **out, size_t *outlen);
|
||||
int tls13_server_key_share_ext_to_bytes(const SM2_Z256_POINT *point, uint8_t **out, size_t *outlen);
|
||||
int tls13_process_client_key_share(const uint8_t *ext_data, size_t ext_datalen,
|
||||
const SM2_KEY *server_ecdhe_key, SM2_POINT *client_ecdhe_public,
|
||||
const SM2_KEY *server_ecdhe_key, SM2_Z256_POINT *client_ecdhe_public,
|
||||
uint8_t **out, size_t *outlen);
|
||||
int tls13_process_server_key_share(const uint8_t *ext_data, size_t ext_datalen, SM2_POINT *point);
|
||||
int tls13_process_server_key_share(const uint8_t *ext_data, size_t ext_datalen, SM2_Z256_POINT *point);
|
||||
|
||||
|
||||
int tls13_certificate_authorities_ext_to_bytes(const uint8_t *ca_names, size_t ca_names_len,
|
||||
@@ -555,8 +522,8 @@ int tls_process_server_exts(const uint8_t *exts, size_t extslen,
|
||||
// Certificate
|
||||
int tls_record_set_handshake_certificate(uint8_t *record, size_t *recordlen,
|
||||
const uint8_t *certs, size_t certslen);
|
||||
// 这个函数比较特殊,是直接解析了证书链,而不是返回指针
|
||||
// 应该提供一个独立的解析函数来解析TLS的证书链
|
||||
// see the impl of tls_record_get_handshake_certificate
|
||||
// a standalone cert-chain parsing function should be given
|
||||
int tls_record_get_handshake_certificate(const uint8_t *record, uint8_t *certs, size_t *certslen);
|
||||
|
||||
// ServerKeyExchange
|
||||
@@ -565,14 +532,14 @@ int tls_server_key_exchange_print(FILE *fp, const uint8_t *ske, size_t skelen, i
|
||||
#define TLS_MAX_SIGNATURE_SIZE SM2_MAX_SIGNATURE_SIZE
|
||||
int tls_sign_server_ecdh_params(const SM2_KEY *server_sign_key,
|
||||
const uint8_t client_random[32], const uint8_t server_random[32],
|
||||
int curve, const SM2_POINT *point, uint8_t *sig, size_t *siglen);
|
||||
int curve, const SM2_Z256_POINT *point, uint8_t *sig, size_t *siglen);
|
||||
int tls_verify_server_ecdh_params(const SM2_KEY *server_sign_key,
|
||||
const uint8_t client_random[32], const uint8_t server_random[32],
|
||||
int curve, const SM2_POINT *point, const uint8_t *sig, size_t siglen);
|
||||
int curve, const SM2_Z256_POINT *point, const uint8_t *sig, size_t siglen);
|
||||
int tls_record_set_handshake_server_key_exchange_ecdhe(uint8_t *record, size_t *recordlen,
|
||||
int curve, const SM2_POINT *point, const uint8_t *sig, size_t siglen);
|
||||
int curve, const SM2_Z256_POINT *point, const uint8_t *sig, size_t siglen);
|
||||
int tls_record_get_handshake_server_key_exchange_ecdhe(const uint8_t *record,
|
||||
int *curve, SM2_POINT *point, const uint8_t **sig, size_t *siglen);
|
||||
int *curve, SM2_Z256_POINT *point, const uint8_t **sig, size_t *siglen);
|
||||
int tls_server_key_exchange_ecdhe_print(FILE *fp, const uint8_t *data, size_t datalen,
|
||||
int format, int indent);
|
||||
|
||||
@@ -615,8 +582,8 @@ int tls_client_key_exchange_pke_print(FILE *fp, const uint8_t *cke, size_t ckele
|
||||
int tls_client_key_exchange_print(FILE *fp, const uint8_t *cke, size_t ckelen, int format, int indent);
|
||||
|
||||
int tls_record_set_handshake_client_key_exchange_ecdhe(uint8_t *record, size_t *recordlen,
|
||||
const SM2_POINT *point); // 这里不应该支持SM2_POINT类型
|
||||
int tls_record_get_handshake_client_key_exchange_ecdhe(const uint8_t *record, SM2_POINT *point);
|
||||
const SM2_Z256_POINT *point); // shoulde we use SM2_Z256_POITN?
|
||||
int tls_record_get_handshake_client_key_exchange_ecdhe(const uint8_t *record, SM2_Z256_POINT *point);
|
||||
int tls_client_key_exchange_ecdhe_print(FILE *fp, const uint8_t *data, size_t datalen,
|
||||
int format, int indent);
|
||||
|
||||
@@ -650,8 +617,8 @@ int tls_client_verify_finish(TLS_CLIENT_VERIFY_CTX *ctx, const uint8_t *sig, siz
|
||||
void tls_client_verify_cleanup(TLS_CLIENT_VERIFY_CTX *ctx);
|
||||
|
||||
// Finished
|
||||
// FIXME: 支持TLS 1.3 提供MIN, MAX或TLS12, TLS13, TLCP...
|
||||
#define TLS_VERIFY_DATA_SIZE 12 // TLS 1.3或者其他版本支持更长的verify_data
|
||||
// FIXME: to support TLS 1.3 need MIN, MAX or TLS12, TLS13, TLCP...
|
||||
#define TLS_VERIFY_DATA_SIZE 12 // TLS 1.3 use longer verify_data (>= 12 bytes)
|
||||
#define TLS_FINISHED_RECORD_SIZE (TLS_RECORD_HEADER_SIZE + TLS_HANDSHAKE_HEADER_SIZE + TLS_VERIFY_DATA_SIZE) // 21
|
||||
#define TLS_MAX_PADDING_SIZE (1 + 255)
|
||||
#define TLS_MAC_SIZE SM3_HMAC_SIZE
|
||||
@@ -716,6 +683,8 @@ typedef struct {
|
||||
SM2_KEY signkey;
|
||||
SM2_KEY kenckey;
|
||||
int verify_depth;
|
||||
|
||||
int quiet;
|
||||
} TLS_CTX;
|
||||
|
||||
int tls_ctx_init(TLS_CTX *ctx, int protocol, int is_client);
|
||||
@@ -748,15 +717,14 @@ typedef struct {
|
||||
|
||||
uint8_t record[TLS_MAX_RECORD_SIZE];
|
||||
|
||||
// 其实这个就不太对了,还是应该有一个完整的密文记录
|
||||
uint8_t databuf[TLS_MAX_PLAINTEXT_SIZE];
|
||||
uint8_t databuf[TLS_MAX_RECORD_SIZE];
|
||||
uint8_t *data;
|
||||
size_t datalen;
|
||||
|
||||
int cipher_suite;
|
||||
uint8_t session_id[32];
|
||||
size_t session_id_len;
|
||||
uint8_t server_certs[TLS_MAX_CERTIFICATES_SIZE]; // 动态的可能会好一点
|
||||
uint8_t server_certs[TLS_MAX_CERTIFICATES_SIZE]; // TODO: use ptr and malloc
|
||||
size_t server_certs_len;
|
||||
uint8_t client_certs[TLS_MAX_CERTIFICATES_SIZE];
|
||||
size_t client_certs_len;
|
||||
@@ -783,10 +751,11 @@ typedef struct {
|
||||
BLOCK_CIPHER_KEY client_write_key;
|
||||
BLOCK_CIPHER_KEY server_write_key;
|
||||
|
||||
int quiet;
|
||||
} TLS_CONNECT;
|
||||
|
||||
|
||||
#define TLS_MAX_EXTENSIONS_SIZE 512 // 这个应该再考虑一下数值,是否可以用其他的缓冲区装载?
|
||||
#define TLS_MAX_EXTENSIONS_SIZE 512 // FIXME: no reason to give fixed max length
|
||||
|
||||
|
||||
int tls_init(TLS_CONNECT *conn, const TLS_CTX *ctx);
|
||||
@@ -854,20 +823,23 @@ int tls13_gcm_decrypt(const BLOCK_CIPHER_KEY *key, const uint8_t iv[12],
|
||||
int *record_type, uint8_t *out, size_t *outlen);
|
||||
|
||||
|
||||
#ifdef TLS_DEBUG
|
||||
#ifdef ENABLE_TLS_DEBUG
|
||||
# define tls_trace(s) fprintf(stderr,(s))
|
||||
# define tls_record_trace(fp,rec,reclen,fmt,ind) tls_record_print(fp,rec,reclen,fmt,ind)
|
||||
# define tls_encrypted_record_trace(fp,rec,reclen,fmt,ind) tls_encrypted_record_print(fp,rec,reclen,fmt,ind)
|
||||
# define tlcp_record_trace(fp,rec,reclen,fmt,ind) tlcp_record_print(fp,rec,reclen,fmt,ind)
|
||||
# define tls12_record_trace(fp,rec,reclen,fmt,ind) tls12_record_print(fp,rec,reclen,fmt,ind)
|
||||
# define tls13_record_trace(fp,rec,reclen,fmt,ind) tls13_record_print(fp,fmt,ind,rec,reclen)
|
||||
#else
|
||||
# define tls_trace(s)
|
||||
# define tls_record_trace(fp,rec,reclen,fmt,ind)
|
||||
# define tls_encrypted_record_trace(fp,rec,reclen,fmt,ind)
|
||||
# define tlcp_record_trace(fp,rec,reclen,fmt,ind)
|
||||
# define tls12_record_trace(fp,rec,reclen,fmt,ind)
|
||||
# define tls13_record_trace(fp,rec,reclen,fmt,ind)
|
||||
#endif
|
||||
|
||||
int tls_encrypted_record_print(FILE *fp, const uint8_t *record, size_t recordlen, int format, int indent);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
10
thirdparty/GmSSL-3.1.1/include/gmssl/version.h
vendored
10
thirdparty/GmSSL-3.1.1/include/gmssl/version.h
vendored
@@ -12,19 +12,17 @@
|
||||
#ifndef GMSSL_VERSION_H
|
||||
#define GMSSL_VERSION_H
|
||||
|
||||
#include <gmssl/api.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
// Also update CPACK_PACKAGE_VERSION in CMakeLists.txt
|
||||
#define GMSSL_VERSION_NUM 30101
|
||||
#define GMSSL_VERSION_STR "GmSSL 3.1.1"
|
||||
#define GMSSL_VERSION_NUM 30102
|
||||
#define GMSSL_VERSION_STR "GmSSL 3.1.2 Dev"
|
||||
|
||||
_gmssl_export int gmssl_version_num(void);
|
||||
_gmssl_export const char *gmssl_version_str(void);
|
||||
int gmssl_version_num(void);
|
||||
const char *gmssl_version_str(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
2
thirdparty/GmSSL-3.1.1/include/gmssl/x509.h
vendored
2
thirdparty/GmSSL-3.1.1/include/gmssl/x509.h
vendored
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Copyright 2014-2023 The GmSSL Project. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Copyright 2014-2023 The GmSSL Project. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
|
||||
39
thirdparty/GmSSL-3.1.1/include/gmssl/zuc.h
vendored
39
thirdparty/GmSSL-3.1.1/include/gmssl/zuc.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.
|
||||
@@ -11,41 +11,14 @@
|
||||
#ifndef GMSSL_ZUC_H
|
||||
#define GMSSL_ZUC_H
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
ZUC Public API
|
||||
|
||||
ZUC_KEY_SIZE
|
||||
ZUC_IV_SIZE
|
||||
ZUC_MAC_SIZE
|
||||
|
||||
ZUC_CTX
|
||||
zuc_encrypt_init
|
||||
zuc_encrypt_update
|
||||
zuc_encrypt_finish
|
||||
zuc_decrypt_init
|
||||
zuc_decrypt_update
|
||||
zuc_decrypt_finish
|
||||
|
||||
ZUC_MAC_CTX
|
||||
zuc_mac_init
|
||||
zuc_mac_update
|
||||
zuc_mac_finish
|
||||
|
||||
zuc_eea_encrypt
|
||||
zuc_eia_generate_mac
|
||||
*/
|
||||
|
||||
|
||||
# define ZUC_KEY_SIZE 16
|
||||
# define ZUC_IV_SIZE 16
|
||||
# define ZUC_MAC_SIZE 4
|
||||
@@ -103,8 +76,8 @@ ZUC_UINT32 zuc_eia_generate_mac(const ZUC_UINT32 *data, size_t nbits,
|
||||
typedef ZUC_STATE ZUC256_STATE;
|
||||
|
||||
void zuc256_init(ZUC256_STATE *state, const uint8_t key[ZUC256_KEY_SIZE], const uint8_t iv[ZUC256_IV_SIZE]);
|
||||
#define zuc256_generate_keystream(state,nwords,words) zuc_generate_keystream(state,nwords,words)
|
||||
#define zuc256_generate_keyword(state) zuc_generate_keyword(state)
|
||||
void zuc256_generate_keystream(ZUC_STATE *state, size_t nwords, ZUC_UINT32 *words);
|
||||
ZUC_UINT32 zuc256_generate_keyword(ZUC_STATE *state);
|
||||
|
||||
|
||||
typedef struct ZUC256_MAC_CTX_st {
|
||||
@@ -124,8 +97,6 @@ void zuc256_mac_update(ZUC256_MAC_CTX *ctx, const uint8_t *data, size_t len);
|
||||
void zuc256_mac_finish(ZUC256_MAC_CTX *ctx, const uint8_t *data, size_t nbits, uint8_t mac[ZUC_MAC_SIZE]);
|
||||
|
||||
|
||||
// Public API
|
||||
|
||||
typedef struct {
|
||||
ZUC_STATE zuc_state;
|
||||
uint8_t block[4];
|
||||
@@ -136,10 +107,6 @@ int zuc_encrypt_init(ZUC_CTX *ctx, const uint8_t key[ZUC_KEY_SIZE], const uint8_
|
||||
int zuc_encrypt_update(ZUC_CTX *ctx, const uint8_t *in, size_t inlen, uint8_t *out, size_t *outlen);
|
||||
int zuc_encrypt_finish(ZUC_CTX *ctx, uint8_t *out, size_t *outlen);
|
||||
|
||||
#define zuc_decrypt_init(ctx,key,iv) zuc_encrypt_init(ctx,key,iv)
|
||||
#define zuc_decrypt_update(ctx,in,inlen,out,outlen) zuc_encrypt_update(ctx,in,inlen,out,outlen)
|
||||
#define zuc_decrypt_finish(ctx,out,outlen) zuc_encrypt_finish(ctx,out,outlen)
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
BIN
thirdparty/GmSSL-3.1.1/lib/gmssl.lib
vendored
BIN
thirdparty/GmSSL-3.1.1/lib/gmssl.lib
vendored
Binary file not shown.
22
thirdparty/OpenSSL-3.5.3/include/openssl/__DECC_INCLUDE_EPILOGUE.H
vendored
Normal file
22
thirdparty/OpenSSL-3.5.3/include/openssl/__DECC_INCLUDE_EPILOGUE.H
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is only used by HP C/C++ on VMS, and is included automatically
|
||||
* after each header file from this directory
|
||||
*/
|
||||
|
||||
/*
|
||||
* The C++ compiler doesn't understand these pragmas, even though it
|
||||
* understands the corresponding command line qualifier.
|
||||
*/
|
||||
#ifndef __cplusplus
|
||||
/* restore state. Must correspond to the save in __decc_include_prologue.h */
|
||||
# pragma names restore
|
||||
#endif
|
||||
26
thirdparty/OpenSSL-3.5.3/include/openssl/__DECC_INCLUDE_PROLOGUE.H
vendored
Normal file
26
thirdparty/OpenSSL-3.5.3/include/openssl/__DECC_INCLUDE_PROLOGUE.H
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is only used by HP C/C++ on VMS, and is included automatically
|
||||
* after each header file from this directory
|
||||
*/
|
||||
|
||||
/*
|
||||
* The C++ compiler doesn't understand these pragmas, even though it
|
||||
* understands the corresponding command line qualifier.
|
||||
*/
|
||||
#ifndef __cplusplus
|
||||
/* save state */
|
||||
# pragma names save
|
||||
/* have the compiler shorten symbols larger than 31 chars to 23 chars
|
||||
* followed by a 8 hex char CRC
|
||||
*/
|
||||
# pragma names as_is,shortened
|
||||
#endif
|
||||
111
thirdparty/OpenSSL-3.5.3/include/openssl/aes.h
vendored
Normal file
111
thirdparty/OpenSSL-3.5.3/include/openssl/aes.h
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef OPENSSL_AES_H
|
||||
# define OPENSSL_AES_H
|
||||
# pragma once
|
||||
|
||||
# include <openssl/macros.h>
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
# define HEADER_AES_H
|
||||
# endif
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# include <stddef.h>
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
# define AES_BLOCK_SIZE 16
|
||||
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
|
||||
# define AES_ENCRYPT 1
|
||||
# define AES_DECRYPT 0
|
||||
|
||||
# define AES_MAXNR 14
|
||||
|
||||
|
||||
/* This should be a hidden type, but EVP requires that the size be known */
|
||||
struct aes_key_st {
|
||||
# ifdef AES_LONG
|
||||
unsigned long rd_key[4 * (AES_MAXNR + 1)];
|
||||
# else
|
||||
unsigned int rd_key[4 * (AES_MAXNR + 1)];
|
||||
# endif
|
||||
int rounds;
|
||||
};
|
||||
typedef struct aes_key_st AES_KEY;
|
||||
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
OSSL_DEPRECATEDIN_3_0 const char *AES_options(void);
|
||||
OSSL_DEPRECATEDIN_3_0
|
||||
int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
|
||||
AES_KEY *key);
|
||||
OSSL_DEPRECATEDIN_3_0
|
||||
int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
|
||||
AES_KEY *key);
|
||||
OSSL_DEPRECATEDIN_3_0
|
||||
void AES_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const AES_KEY *key);
|
||||
OSSL_DEPRECATEDIN_3_0
|
||||
void AES_decrypt(const unsigned char *in, unsigned char *out,
|
||||
const AES_KEY *key);
|
||||
OSSL_DEPRECATEDIN_3_0
|
||||
void AES_ecb_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const AES_KEY *key, const int enc);
|
||||
OSSL_DEPRECATEDIN_3_0
|
||||
void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const AES_KEY *key,
|
||||
unsigned char *ivec, const int enc);
|
||||
OSSL_DEPRECATEDIN_3_0
|
||||
void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const AES_KEY *key,
|
||||
unsigned char *ivec, int *num, const int enc);
|
||||
OSSL_DEPRECATEDIN_3_0
|
||||
void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const AES_KEY *key,
|
||||
unsigned char *ivec, int *num, const int enc);
|
||||
OSSL_DEPRECATEDIN_3_0
|
||||
void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const AES_KEY *key,
|
||||
unsigned char *ivec, int *num, const int enc);
|
||||
OSSL_DEPRECATEDIN_3_0
|
||||
void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const AES_KEY *key,
|
||||
unsigned char *ivec, int *num);
|
||||
|
||||
/* NB: the IV is _two_ blocks long */
|
||||
OSSL_DEPRECATEDIN_3_0
|
||||
void AES_ige_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const AES_KEY *key,
|
||||
unsigned char *ivec, const int enc);
|
||||
/* NB: the IV is _four_ blocks long */
|
||||
OSSL_DEPRECATEDIN_3_0
|
||||
void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const AES_KEY *key, const AES_KEY *key2,
|
||||
const unsigned char *ivec, const int enc);
|
||||
OSSL_DEPRECATEDIN_3_0
|
||||
int AES_wrap_key(AES_KEY *key, const unsigned char *iv,
|
||||
unsigned char *out, const unsigned char *in,
|
||||
unsigned int inlen);
|
||||
OSSL_DEPRECATEDIN_3_0
|
||||
int AES_unwrap_key(AES_KEY *key, const unsigned char *iv,
|
||||
unsigned char *out, const unsigned char *in,
|
||||
unsigned int inlen);
|
||||
# endif
|
||||
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
|
||||
#endif
|
||||
153
thirdparty/OpenSSL-3.5.3/include/openssl/applink.c
vendored
Normal file
153
thirdparty/OpenSSL-3.5.3/include/openssl/applink.c
vendored
Normal file
@@ -0,0 +1,153 @@
|
||||
/*
|
||||
* Copyright 2004-2023 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#define APPLINK_STDIN 1
|
||||
#define APPLINK_STDOUT 2
|
||||
#define APPLINK_STDERR 3
|
||||
#define APPLINK_FPRINTF 4
|
||||
#define APPLINK_FGETS 5
|
||||
#define APPLINK_FREAD 6
|
||||
#define APPLINK_FWRITE 7
|
||||
#define APPLINK_FSETMOD 8
|
||||
#define APPLINK_FEOF 9
|
||||
#define APPLINK_FCLOSE 10 /* should not be used */
|
||||
|
||||
#define APPLINK_FOPEN 11 /* solely for completeness */
|
||||
#define APPLINK_FSEEK 12
|
||||
#define APPLINK_FTELL 13
|
||||
#define APPLINK_FFLUSH 14
|
||||
#define APPLINK_FERROR 15
|
||||
#define APPLINK_CLEARERR 16
|
||||
#define APPLINK_FILENO 17 /* to be used with below */
|
||||
|
||||
#define APPLINK_OPEN 18 /* formally can't be used, as flags can vary */
|
||||
#define APPLINK_READ 19
|
||||
#define APPLINK_WRITE 20
|
||||
#define APPLINK_LSEEK 21
|
||||
#define APPLINK_CLOSE 22
|
||||
#define APPLINK_MAX 22 /* always same as last macro */
|
||||
|
||||
#ifndef APPMACROS_ONLY
|
||||
|
||||
/*
|
||||
* Normally, do not define APPLINK_NO_INCLUDES. Define it if you are using
|
||||
* symbol preprocessing and do not want the preprocessing to affect the
|
||||
* following included header files. You will need to put these
|
||||
* include lines somewhere in the file that is including applink.c.
|
||||
*/
|
||||
# ifndef APPLINK_NO_INCLUDES
|
||||
# include <stdio.h>
|
||||
# include <io.h>
|
||||
# include <fcntl.h>
|
||||
# endif
|
||||
|
||||
# ifdef __BORLANDC__
|
||||
/* _lseek in <io.h> is a function-like macro so we can't take its address */
|
||||
# undef _lseek
|
||||
# define _lseek lseek
|
||||
# endif
|
||||
|
||||
static void *app_stdin(void)
|
||||
{
|
||||
return stdin;
|
||||
}
|
||||
|
||||
static void *app_stdout(void)
|
||||
{
|
||||
return stdout;
|
||||
}
|
||||
|
||||
static void *app_stderr(void)
|
||||
{
|
||||
return stderr;
|
||||
}
|
||||
|
||||
static int app_feof(FILE *fp)
|
||||
{
|
||||
return feof(fp);
|
||||
}
|
||||
|
||||
static int app_ferror(FILE *fp)
|
||||
{
|
||||
return ferror(fp);
|
||||
}
|
||||
|
||||
static void app_clearerr(FILE *fp)
|
||||
{
|
||||
clearerr(fp);
|
||||
}
|
||||
|
||||
static int app_fileno(FILE *fp)
|
||||
{
|
||||
return _fileno(fp);
|
||||
}
|
||||
|
||||
static int app_fsetmod(FILE *fp, char mod)
|
||||
{
|
||||
return _setmode(_fileno(fp), mod == 'b' ? _O_BINARY : _O_TEXT);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
__declspec(dllexport)
|
||||
void **
|
||||
# if defined(__BORLANDC__)
|
||||
/*
|
||||
* __stdcall appears to be the only way to get the name
|
||||
* decoration right with Borland C. Otherwise it works
|
||||
* purely incidentally, as we pass no parameters.
|
||||
*/
|
||||
__stdcall
|
||||
# else
|
||||
__cdecl
|
||||
# endif
|
||||
OPENSSL_Applink(void)
|
||||
{
|
||||
static int once = 1;
|
||||
static void *OPENSSL_ApplinkTable[APPLINK_MAX + 1] =
|
||||
{ (void *)APPLINK_MAX };
|
||||
|
||||
if (once) {
|
||||
OPENSSL_ApplinkTable[APPLINK_STDIN] = app_stdin;
|
||||
OPENSSL_ApplinkTable[APPLINK_STDOUT] = app_stdout;
|
||||
OPENSSL_ApplinkTable[APPLINK_STDERR] = app_stderr;
|
||||
OPENSSL_ApplinkTable[APPLINK_FPRINTF] = fprintf;
|
||||
OPENSSL_ApplinkTable[APPLINK_FGETS] = fgets;
|
||||
OPENSSL_ApplinkTable[APPLINK_FREAD] = fread;
|
||||
OPENSSL_ApplinkTable[APPLINK_FWRITE] = fwrite;
|
||||
OPENSSL_ApplinkTable[APPLINK_FSETMOD] = app_fsetmod;
|
||||
OPENSSL_ApplinkTable[APPLINK_FEOF] = app_feof;
|
||||
OPENSSL_ApplinkTable[APPLINK_FCLOSE] = fclose;
|
||||
|
||||
OPENSSL_ApplinkTable[APPLINK_FOPEN] = fopen;
|
||||
OPENSSL_ApplinkTable[APPLINK_FSEEK] = fseek;
|
||||
OPENSSL_ApplinkTable[APPLINK_FTELL] = ftell;
|
||||
OPENSSL_ApplinkTable[APPLINK_FFLUSH] = fflush;
|
||||
OPENSSL_ApplinkTable[APPLINK_FERROR] = app_ferror;
|
||||
OPENSSL_ApplinkTable[APPLINK_CLEARERR] = app_clearerr;
|
||||
OPENSSL_ApplinkTable[APPLINK_FILENO] = app_fileno;
|
||||
|
||||
OPENSSL_ApplinkTable[APPLINK_OPEN] = _open;
|
||||
OPENSSL_ApplinkTable[APPLINK_READ] = _read;
|
||||
OPENSSL_ApplinkTable[APPLINK_WRITE] = _write;
|
||||
OPENSSL_ApplinkTable[APPLINK_LSEEK] = _lseek;
|
||||
OPENSSL_ApplinkTable[APPLINK_CLOSE] = _close;
|
||||
|
||||
once = 0;
|
||||
}
|
||||
|
||||
return OPENSSL_ApplinkTable;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
1134
thirdparty/OpenSSL-3.5.3/include/openssl/asn1.h
vendored
Normal file
1134
thirdparty/OpenSSL-3.5.3/include/openssl/asn1.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
142
thirdparty/OpenSSL-3.5.3/include/openssl/asn1err.h
vendored
Normal file
142
thirdparty/OpenSSL-3.5.3/include/openssl/asn1err.h
vendored
Normal file
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2024 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef OPENSSL_ASN1ERR_H
|
||||
# define OPENSSL_ASN1ERR_H
|
||||
# pragma once
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
# include <openssl/symhacks.h>
|
||||
# include <openssl/cryptoerr_legacy.h>
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* ASN1 reason codes.
|
||||
*/
|
||||
# define ASN1_R_ADDING_OBJECT 171
|
||||
# define ASN1_R_ASN1_PARSE_ERROR 203
|
||||
# define ASN1_R_ASN1_SIG_PARSE_ERROR 204
|
||||
# define ASN1_R_AUX_ERROR 100
|
||||
# define ASN1_R_BAD_OBJECT_HEADER 102
|
||||
# define ASN1_R_BAD_TEMPLATE 230
|
||||
# define ASN1_R_BMPSTRING_IS_WRONG_LENGTH 214
|
||||
# define ASN1_R_BN_LIB 105
|
||||
# define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 106
|
||||
# define ASN1_R_BUFFER_TOO_SMALL 107
|
||||
# define ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 108
|
||||
# define ASN1_R_CONTEXT_NOT_INITIALISED 217
|
||||
# define ASN1_R_DATA_IS_WRONG 109
|
||||
# define ASN1_R_DECODE_ERROR 110
|
||||
# define ASN1_R_DEPTH_EXCEEDED 174
|
||||
# define ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED 198
|
||||
# define ASN1_R_ENCODE_ERROR 112
|
||||
# define ASN1_R_ERROR_GETTING_TIME 173
|
||||
# define ASN1_R_ERROR_LOADING_SECTION 172
|
||||
# define ASN1_R_ERROR_SETTING_CIPHER_PARAMS 114
|
||||
# define ASN1_R_EXPECTING_AN_INTEGER 115
|
||||
# define ASN1_R_EXPECTING_AN_OBJECT 116
|
||||
# define ASN1_R_EXPLICIT_LENGTH_MISMATCH 119
|
||||
# define ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED 120
|
||||
# define ASN1_R_FIELD_MISSING 121
|
||||
# define ASN1_R_FIRST_NUM_TOO_LARGE 122
|
||||
# define ASN1_R_GENERALIZEDTIME_IS_TOO_SHORT 232
|
||||
# define ASN1_R_HEADER_TOO_LONG 123
|
||||
# define ASN1_R_ILLEGAL_BITSTRING_FORMAT 175
|
||||
# define ASN1_R_ILLEGAL_BOOLEAN 176
|
||||
# define ASN1_R_ILLEGAL_CHARACTERS 124
|
||||
# define ASN1_R_ILLEGAL_FORMAT 177
|
||||
# define ASN1_R_ILLEGAL_HEX 178
|
||||
# define ASN1_R_ILLEGAL_IMPLICIT_TAG 179
|
||||
# define ASN1_R_ILLEGAL_INTEGER 180
|
||||
# define ASN1_R_ILLEGAL_NEGATIVE_VALUE 226
|
||||
# define ASN1_R_ILLEGAL_NESTED_TAGGING 181
|
||||
# define ASN1_R_ILLEGAL_NULL 125
|
||||
# define ASN1_R_ILLEGAL_NULL_VALUE 182
|
||||
# define ASN1_R_ILLEGAL_OBJECT 183
|
||||
# define ASN1_R_ILLEGAL_OPTIONAL_ANY 126
|
||||
# define ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE 170
|
||||
# define ASN1_R_ILLEGAL_PADDING 221
|
||||
# define ASN1_R_ILLEGAL_TAGGED_ANY 127
|
||||
# define ASN1_R_ILLEGAL_TIME_VALUE 184
|
||||
# define ASN1_R_ILLEGAL_ZERO_CONTENT 222
|
||||
# define ASN1_R_INTEGER_NOT_ASCII_FORMAT 185
|
||||
# define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG 128
|
||||
# define ASN1_R_INVALID_BIT_STRING_BITS_LEFT 220
|
||||
# define ASN1_R_INVALID_BMPSTRING_LENGTH 129
|
||||
# define ASN1_R_INVALID_DIGIT 130
|
||||
# define ASN1_R_INVALID_MIME_TYPE 205
|
||||
# define ASN1_R_INVALID_MODIFIER 186
|
||||
# define ASN1_R_INVALID_NUMBER 187
|
||||
# define ASN1_R_INVALID_OBJECT_ENCODING 216
|
||||
# define ASN1_R_INVALID_SCRYPT_PARAMETERS 227
|
||||
# define ASN1_R_INVALID_SEPARATOR 131
|
||||
# define ASN1_R_INVALID_STRING_TABLE_VALUE 218
|
||||
# define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH 133
|
||||
# define ASN1_R_INVALID_UTF8STRING 134
|
||||
# define ASN1_R_INVALID_VALUE 219
|
||||
# define ASN1_R_LENGTH_TOO_LONG 231
|
||||
# define ASN1_R_LIST_ERROR 188
|
||||
# define ASN1_R_MIME_NO_CONTENT_TYPE 206
|
||||
# define ASN1_R_MIME_PARSE_ERROR 207
|
||||
# define ASN1_R_MIME_SIG_PARSE_ERROR 208
|
||||
# define ASN1_R_MISSING_EOC 137
|
||||
# define ASN1_R_MISSING_SECOND_NUMBER 138
|
||||
# define ASN1_R_MISSING_VALUE 189
|
||||
# define ASN1_R_MSTRING_NOT_UNIVERSAL 139
|
||||
# define ASN1_R_MSTRING_WRONG_TAG 140
|
||||
# define ASN1_R_NESTED_ASN1_STRING 197
|
||||
# define ASN1_R_NESTED_TOO_DEEP 201
|
||||
# define ASN1_R_NON_HEX_CHARACTERS 141
|
||||
# define ASN1_R_NOT_ASCII_FORMAT 190
|
||||
# define ASN1_R_NOT_ENOUGH_DATA 142
|
||||
# define ASN1_R_NO_CONTENT_TYPE 209
|
||||
# define ASN1_R_NO_MATCHING_CHOICE_TYPE 143
|
||||
# define ASN1_R_NO_MULTIPART_BODY_FAILURE 210
|
||||
# define ASN1_R_NO_MULTIPART_BOUNDARY 211
|
||||
# define ASN1_R_NO_SIG_CONTENT_TYPE 212
|
||||
# define ASN1_R_NULL_IS_WRONG_LENGTH 144
|
||||
# define ASN1_R_OBJECT_NOT_ASCII_FORMAT 191
|
||||
# define ASN1_R_ODD_NUMBER_OF_CHARS 145
|
||||
# define ASN1_R_SECOND_NUMBER_TOO_LARGE 147
|
||||
# define ASN1_R_SEQUENCE_LENGTH_MISMATCH 148
|
||||
# define ASN1_R_SEQUENCE_NOT_CONSTRUCTED 149
|
||||
# define ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG 192
|
||||
# define ASN1_R_SHORT_LINE 150
|
||||
# define ASN1_R_SIG_INVALID_MIME_TYPE 213
|
||||
# define ASN1_R_STREAMING_NOT_SUPPORTED 202
|
||||
# define ASN1_R_STRING_TOO_LONG 151
|
||||
# define ASN1_R_STRING_TOO_SHORT 152
|
||||
# define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 154
|
||||
# define ASN1_R_TIME_NOT_ASCII_FORMAT 193
|
||||
# define ASN1_R_TOO_LARGE 223
|
||||
# define ASN1_R_TOO_LONG 155
|
||||
# define ASN1_R_TOO_SMALL 224
|
||||
# define ASN1_R_TYPE_NOT_CONSTRUCTED 156
|
||||
# define ASN1_R_TYPE_NOT_PRIMITIVE 195
|
||||
# define ASN1_R_UNEXPECTED_EOC 159
|
||||
# define ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH 215
|
||||
# define ASN1_R_UNKNOWN_DIGEST 229
|
||||
# define ASN1_R_UNKNOWN_FORMAT 160
|
||||
# define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 161
|
||||
# define ASN1_R_UNKNOWN_OBJECT_TYPE 162
|
||||
# define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 163
|
||||
# define ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM 199
|
||||
# define ASN1_R_UNKNOWN_TAG 194
|
||||
# define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE 164
|
||||
# define ASN1_R_UNSUPPORTED_CIPHER 228
|
||||
# define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 167
|
||||
# define ASN1_R_UNSUPPORTED_TYPE 196
|
||||
# define ASN1_R_UTCTIME_IS_TOO_SHORT 233
|
||||
# define ASN1_R_WRONG_INTEGER_TYPE 225
|
||||
# define ASN1_R_WRONG_PUBLIC_KEY_TYPE 200
|
||||
# define ASN1_R_WRONG_TAG 168
|
||||
|
||||
#endif
|
||||
946
thirdparty/OpenSSL-3.5.3/include/openssl/asn1t.h
vendored
Normal file
946
thirdparty/OpenSSL-3.5.3/include/openssl/asn1t.h
vendored
Normal file
@@ -0,0 +1,946 @@
|
||||
/*
|
||||
* WARNING: do not edit!
|
||||
* Generated by makefile from include\openssl\asn1t.h.in
|
||||
*
|
||||
* Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef OPENSSL_ASN1T_H
|
||||
# define OPENSSL_ASN1T_H
|
||||
# pragma once
|
||||
|
||||
# include <openssl/macros.h>
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
# define HEADER_ASN1T_H
|
||||
# endif
|
||||
|
||||
# include <stddef.h>
|
||||
# include <openssl/e_os2.h>
|
||||
# include <openssl/asn1.h>
|
||||
|
||||
# ifdef OPENSSL_BUILD_SHLIBCRYPTO
|
||||
# undef OPENSSL_EXTERN
|
||||
# define OPENSSL_EXTERN OPENSSL_EXPORT
|
||||
# endif
|
||||
|
||||
/* ASN1 template defines, structures and functions */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*-
|
||||
* These are the possible values for the itype field of the
|
||||
* ASN1_ITEM structure and determine how it is interpreted.
|
||||
*
|
||||
* For PRIMITIVE types the underlying type
|
||||
* determines the behaviour if items is NULL.
|
||||
*
|
||||
* Otherwise templates must contain a single
|
||||
* template and the type is treated in the
|
||||
* same way as the type specified in the template.
|
||||
*
|
||||
* For SEQUENCE types the templates field points
|
||||
* to the members, the size field is the
|
||||
* structure size.
|
||||
*
|
||||
* For CHOICE types the templates field points
|
||||
* to each possible member (typically a union)
|
||||
* and the 'size' field is the offset of the
|
||||
* selector.
|
||||
*
|
||||
* The 'funcs' field is used for application-specific
|
||||
* data and functions.
|
||||
*
|
||||
* The EXTERN type uses a new style d2i/i2d.
|
||||
* The new style should be used where possible
|
||||
* because it avoids things like the d2i IMPLICIT
|
||||
* hack.
|
||||
*
|
||||
* MSTRING is a multiple string type, it is used
|
||||
* for a CHOICE of character strings where the
|
||||
* actual strings all occupy an ASN1_STRING
|
||||
* structure. In this case the 'utype' field
|
||||
* has a special meaning, it is used as a mask
|
||||
* of acceptable types using the B_ASN1 constants.
|
||||
*
|
||||
* NDEF_SEQUENCE is the same as SEQUENCE except
|
||||
* that it will use indefinite length constructed
|
||||
* encoding if requested.
|
||||
*
|
||||
*/
|
||||
|
||||
# define ASN1_ITYPE_PRIMITIVE 0x0
|
||||
# define ASN1_ITYPE_SEQUENCE 0x1
|
||||
# define ASN1_ITYPE_CHOICE 0x2
|
||||
/* unused value 0x3 */
|
||||
# define ASN1_ITYPE_EXTERN 0x4
|
||||
# define ASN1_ITYPE_MSTRING 0x5
|
||||
# define ASN1_ITYPE_NDEF_SEQUENCE 0x6
|
||||
|
||||
/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */
|
||||
# define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)((iptr)()))
|
||||
|
||||
/* Macros for start and end of ASN1_ITEM definition */
|
||||
|
||||
# define ASN1_ITEM_start(itname) \
|
||||
const ASN1_ITEM * itname##_it(void) \
|
||||
{ \
|
||||
static const ASN1_ITEM local_it = {
|
||||
|
||||
# define static_ASN1_ITEM_start(itname) \
|
||||
static ASN1_ITEM_start(itname)
|
||||
|
||||
# define ASN1_ITEM_end(itname) \
|
||||
}; \
|
||||
return &local_it; \
|
||||
}
|
||||
|
||||
/* Macros to aid ASN1 template writing */
|
||||
|
||||
# define ASN1_ITEM_TEMPLATE(tname) \
|
||||
static const ASN1_TEMPLATE tname##_item_tt
|
||||
|
||||
# define ASN1_ITEM_TEMPLATE_END(tname) \
|
||||
;\
|
||||
ASN1_ITEM_start(tname) \
|
||||
ASN1_ITYPE_PRIMITIVE,\
|
||||
-1,\
|
||||
&tname##_item_tt,\
|
||||
0,\
|
||||
NULL,\
|
||||
0,\
|
||||
#tname \
|
||||
ASN1_ITEM_end(tname)
|
||||
# define static_ASN1_ITEM_TEMPLATE_END(tname) \
|
||||
;\
|
||||
static_ASN1_ITEM_start(tname) \
|
||||
ASN1_ITYPE_PRIMITIVE,\
|
||||
-1,\
|
||||
&tname##_item_tt,\
|
||||
0,\
|
||||
NULL,\
|
||||
0,\
|
||||
#tname \
|
||||
ASN1_ITEM_end(tname)
|
||||
|
||||
/* This is a ASN1 type which just embeds a template */
|
||||
|
||||
/*-
|
||||
* This pair helps declare a SEQUENCE. We can do:
|
||||
*
|
||||
* ASN1_SEQUENCE(stname) = {
|
||||
* ... SEQUENCE components ...
|
||||
* } ASN1_SEQUENCE_END(stname)
|
||||
*
|
||||
* This will produce an ASN1_ITEM called stname_it
|
||||
* for a structure called stname.
|
||||
*
|
||||
* If you want the same structure but a different
|
||||
* name then use:
|
||||
*
|
||||
* ASN1_SEQUENCE(itname) = {
|
||||
* ... SEQUENCE components ...
|
||||
* } ASN1_SEQUENCE_END_name(stname, itname)
|
||||
*
|
||||
* This will create an item called itname_it using
|
||||
* a structure called stname.
|
||||
*/
|
||||
|
||||
# define ASN1_SEQUENCE(tname) \
|
||||
static const ASN1_TEMPLATE tname##_seq_tt[]
|
||||
|
||||
# define ASN1_SEQUENCE_END(stname) ASN1_SEQUENCE_END_name(stname, stname)
|
||||
|
||||
# define static_ASN1_SEQUENCE_END(stname) static_ASN1_SEQUENCE_END_name(stname, stname)
|
||||
|
||||
# define ASN1_SEQUENCE_END_name(stname, tname) \
|
||||
;\
|
||||
ASN1_ITEM_start(tname) \
|
||||
ASN1_ITYPE_SEQUENCE,\
|
||||
V_ASN1_SEQUENCE,\
|
||||
tname##_seq_tt,\
|
||||
sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
|
||||
NULL,\
|
||||
sizeof(stname),\
|
||||
#tname \
|
||||
ASN1_ITEM_end(tname)
|
||||
|
||||
# define static_ASN1_SEQUENCE_END_name(stname, tname) \
|
||||
;\
|
||||
static_ASN1_ITEM_start(tname) \
|
||||
ASN1_ITYPE_SEQUENCE,\
|
||||
V_ASN1_SEQUENCE,\
|
||||
tname##_seq_tt,\
|
||||
sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
|
||||
NULL,\
|
||||
sizeof(stname),\
|
||||
#stname \
|
||||
ASN1_ITEM_end(tname)
|
||||
|
||||
# define ASN1_NDEF_SEQUENCE(tname) \
|
||||
ASN1_SEQUENCE(tname)
|
||||
|
||||
# define ASN1_NDEF_SEQUENCE_cb(tname, cb) \
|
||||
ASN1_SEQUENCE_cb(tname, cb)
|
||||
|
||||
# define ASN1_SEQUENCE_cb(tname, cb) \
|
||||
static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0, NULL}; \
|
||||
ASN1_SEQUENCE(tname)
|
||||
|
||||
# define ASN1_SEQUENCE_const_cb(tname, const_cb) \
|
||||
static const ASN1_AUX tname##_aux = \
|
||||
{NULL, ASN1_AFLG_CONST_CB, 0, 0, NULL, 0, const_cb}; \
|
||||
ASN1_SEQUENCE(tname)
|
||||
|
||||
# define ASN1_SEQUENCE_cb_const_cb(tname, cb, const_cb) \
|
||||
static const ASN1_AUX tname##_aux = \
|
||||
{NULL, ASN1_AFLG_CONST_CB, 0, 0, cb, 0, const_cb}; \
|
||||
ASN1_SEQUENCE(tname)
|
||||
|
||||
# define ASN1_SEQUENCE_ref(tname, cb) \
|
||||
static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), offsetof(tname, lock), cb, 0, NULL}; \
|
||||
ASN1_SEQUENCE(tname)
|
||||
|
||||
# define ASN1_SEQUENCE_enc(tname, enc, cb) \
|
||||
static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_ENCODING, 0, 0, cb, offsetof(tname, enc), NULL}; \
|
||||
ASN1_SEQUENCE(tname)
|
||||
|
||||
# define ASN1_NDEF_SEQUENCE_END(tname) \
|
||||
;\
|
||||
ASN1_ITEM_start(tname) \
|
||||
ASN1_ITYPE_NDEF_SEQUENCE,\
|
||||
V_ASN1_SEQUENCE,\
|
||||
tname##_seq_tt,\
|
||||
sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
|
||||
NULL,\
|
||||
sizeof(tname),\
|
||||
#tname \
|
||||
ASN1_ITEM_end(tname)
|
||||
# define static_ASN1_NDEF_SEQUENCE_END(tname) \
|
||||
;\
|
||||
static_ASN1_ITEM_start(tname) \
|
||||
ASN1_ITYPE_NDEF_SEQUENCE,\
|
||||
V_ASN1_SEQUENCE,\
|
||||
tname##_seq_tt,\
|
||||
sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
|
||||
NULL,\
|
||||
sizeof(tname),\
|
||||
#tname \
|
||||
ASN1_ITEM_end(tname)
|
||||
|
||||
|
||||
# define ASN1_SEQUENCE_END_enc(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname)
|
||||
|
||||
# define ASN1_SEQUENCE_END_cb(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname)
|
||||
# define static_ASN1_SEQUENCE_END_cb(stname, tname) static_ASN1_SEQUENCE_END_ref(stname, tname)
|
||||
|
||||
# define ASN1_SEQUENCE_END_ref(stname, tname) \
|
||||
;\
|
||||
ASN1_ITEM_start(tname) \
|
||||
ASN1_ITYPE_SEQUENCE,\
|
||||
V_ASN1_SEQUENCE,\
|
||||
tname##_seq_tt,\
|
||||
sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
|
||||
&tname##_aux,\
|
||||
sizeof(stname),\
|
||||
#tname \
|
||||
ASN1_ITEM_end(tname)
|
||||
# define static_ASN1_SEQUENCE_END_ref(stname, tname) \
|
||||
;\
|
||||
static_ASN1_ITEM_start(tname) \
|
||||
ASN1_ITYPE_SEQUENCE,\
|
||||
V_ASN1_SEQUENCE,\
|
||||
tname##_seq_tt,\
|
||||
sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
|
||||
&tname##_aux,\
|
||||
sizeof(stname),\
|
||||
#stname \
|
||||
ASN1_ITEM_end(tname)
|
||||
|
||||
# define ASN1_NDEF_SEQUENCE_END_cb(stname, tname) \
|
||||
;\
|
||||
ASN1_ITEM_start(tname) \
|
||||
ASN1_ITYPE_NDEF_SEQUENCE,\
|
||||
V_ASN1_SEQUENCE,\
|
||||
tname##_seq_tt,\
|
||||
sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
|
||||
&tname##_aux,\
|
||||
sizeof(stname),\
|
||||
#stname \
|
||||
ASN1_ITEM_end(tname)
|
||||
|
||||
/*-
|
||||
* This pair helps declare a CHOICE type. We can do:
|
||||
*
|
||||
* ASN1_CHOICE(chname) = {
|
||||
* ... CHOICE options ...
|
||||
* ASN1_CHOICE_END(chname)
|
||||
*
|
||||
* This will produce an ASN1_ITEM called chname_it
|
||||
* for a structure called chname. The structure
|
||||
* definition must look like this:
|
||||
* typedef struct {
|
||||
* int type;
|
||||
* union {
|
||||
* ASN1_SOMETHING *opt1;
|
||||
* ASN1_SOMEOTHER *opt2;
|
||||
* } value;
|
||||
* } chname;
|
||||
*
|
||||
* the name of the selector must be 'type'.
|
||||
* to use an alternative selector name use the
|
||||
* ASN1_CHOICE_END_selector() version.
|
||||
*/
|
||||
|
||||
# define ASN1_CHOICE(tname) \
|
||||
static const ASN1_TEMPLATE tname##_ch_tt[]
|
||||
|
||||
# define ASN1_CHOICE_cb(tname, cb) \
|
||||
static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0, NULL}; \
|
||||
ASN1_CHOICE(tname)
|
||||
|
||||
# define ASN1_CHOICE_END(stname) ASN1_CHOICE_END_name(stname, stname)
|
||||
|
||||
# define static_ASN1_CHOICE_END(stname) static_ASN1_CHOICE_END_name(stname, stname)
|
||||
|
||||
# define ASN1_CHOICE_END_name(stname, tname) ASN1_CHOICE_END_selector(stname, tname, type)
|
||||
|
||||
# define static_ASN1_CHOICE_END_name(stname, tname) static_ASN1_CHOICE_END_selector(stname, tname, type)
|
||||
|
||||
# define ASN1_CHOICE_END_selector(stname, tname, selname) \
|
||||
;\
|
||||
ASN1_ITEM_start(tname) \
|
||||
ASN1_ITYPE_CHOICE,\
|
||||
offsetof(stname,selname) ,\
|
||||
tname##_ch_tt,\
|
||||
sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
|
||||
NULL,\
|
||||
sizeof(stname),\
|
||||
#stname \
|
||||
ASN1_ITEM_end(tname)
|
||||
|
||||
# define static_ASN1_CHOICE_END_selector(stname, tname, selname) \
|
||||
;\
|
||||
static_ASN1_ITEM_start(tname) \
|
||||
ASN1_ITYPE_CHOICE,\
|
||||
offsetof(stname,selname) ,\
|
||||
tname##_ch_tt,\
|
||||
sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
|
||||
NULL,\
|
||||
sizeof(stname),\
|
||||
#stname \
|
||||
ASN1_ITEM_end(tname)
|
||||
|
||||
# define ASN1_CHOICE_END_cb(stname, tname, selname) \
|
||||
;\
|
||||
ASN1_ITEM_start(tname) \
|
||||
ASN1_ITYPE_CHOICE,\
|
||||
offsetof(stname,selname) ,\
|
||||
tname##_ch_tt,\
|
||||
sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
|
||||
&tname##_aux,\
|
||||
sizeof(stname),\
|
||||
#stname \
|
||||
ASN1_ITEM_end(tname)
|
||||
|
||||
/* This helps with the template wrapper form of ASN1_ITEM */
|
||||
|
||||
# define ASN1_EX_TEMPLATE_TYPE(flags, tag, name, type) { \
|
||||
(flags), (tag), 0,\
|
||||
#name, ASN1_ITEM_ref(type) }
|
||||
|
||||
/* These help with SEQUENCE or CHOICE components */
|
||||
|
||||
/* used to declare other types */
|
||||
|
||||
# define ASN1_EX_TYPE(flags, tag, stname, field, type) { \
|
||||
(flags), (tag), offsetof(stname, field),\
|
||||
#field, ASN1_ITEM_ref(type) }
|
||||
|
||||
/* implicit and explicit helper macros */
|
||||
|
||||
# define ASN1_IMP_EX(stname, field, type, tag, ex) \
|
||||
ASN1_EX_TYPE(ASN1_TFLG_IMPLICIT | (ex), tag, stname, field, type)
|
||||
|
||||
# define ASN1_EXP_EX(stname, field, type, tag, ex) \
|
||||
ASN1_EX_TYPE(ASN1_TFLG_EXPLICIT | (ex), tag, stname, field, type)
|
||||
|
||||
/* Any defined by macros: the field used is in the table itself */
|
||||
|
||||
# define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, tblname##_adb }
|
||||
# define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, tblname##_adb }
|
||||
|
||||
/* Plain simple type */
|
||||
# define ASN1_SIMPLE(stname, field, type) ASN1_EX_TYPE(0,0, stname, field, type)
|
||||
/* Embedded simple type */
|
||||
# define ASN1_EMBED(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_EMBED,0, stname, field, type)
|
||||
|
||||
/* OPTIONAL simple type */
|
||||
# define ASN1_OPT(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL, 0, stname, field, type)
|
||||
# define ASN1_OPT_EMBED(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED, 0, stname, field, type)
|
||||
|
||||
/* IMPLICIT tagged simple type */
|
||||
# define ASN1_IMP(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, 0)
|
||||
# define ASN1_IMP_EMBED(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_EMBED)
|
||||
|
||||
/* IMPLICIT tagged OPTIONAL simple type */
|
||||
# define ASN1_IMP_OPT(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL)
|
||||
# define ASN1_IMP_OPT_EMBED(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED)
|
||||
|
||||
/* Same as above but EXPLICIT */
|
||||
|
||||
# define ASN1_EXP(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, 0)
|
||||
# define ASN1_EXP_EMBED(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_EMBED)
|
||||
# define ASN1_EXP_OPT(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL)
|
||||
# define ASN1_EXP_OPT_EMBED(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED)
|
||||
|
||||
/* SEQUENCE OF type */
|
||||
# define ASN1_SEQUENCE_OF(stname, field, type) \
|
||||
ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, stname, field, type)
|
||||
|
||||
/* OPTIONAL SEQUENCE OF */
|
||||
# define ASN1_SEQUENCE_OF_OPT(stname, field, type) \
|
||||
ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type)
|
||||
|
||||
/* Same as above but for SET OF */
|
||||
|
||||
# define ASN1_SET_OF(stname, field, type) \
|
||||
ASN1_EX_TYPE(ASN1_TFLG_SET_OF, 0, stname, field, type)
|
||||
|
||||
# define ASN1_SET_OF_OPT(stname, field, type) \
|
||||
ASN1_EX_TYPE(ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type)
|
||||
|
||||
/* Finally compound types of SEQUENCE, SET, IMPLICIT, EXPLICIT and OPTIONAL */
|
||||
|
||||
# define ASN1_IMP_SET_OF(stname, field, type, tag) \
|
||||
ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF)
|
||||
|
||||
# define ASN1_EXP_SET_OF(stname, field, type, tag) \
|
||||
ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF)
|
||||
|
||||
# define ASN1_IMP_SET_OF_OPT(stname, field, type, tag) \
|
||||
ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL)
|
||||
|
||||
# define ASN1_EXP_SET_OF_OPT(stname, field, type, tag) \
|
||||
ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL)
|
||||
|
||||
# define ASN1_IMP_SEQUENCE_OF(stname, field, type, tag) \
|
||||
ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF)
|
||||
|
||||
# define ASN1_IMP_SEQUENCE_OF_OPT(stname, field, type, tag) \
|
||||
ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL)
|
||||
|
||||
# define ASN1_EXP_SEQUENCE_OF(stname, field, type, tag) \
|
||||
ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF)
|
||||
|
||||
# define ASN1_EXP_SEQUENCE_OF_OPT(stname, field, type, tag) \
|
||||
ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL)
|
||||
|
||||
/* EXPLICIT using indefinite length constructed form */
|
||||
# define ASN1_NDEF_EXP(stname, field, type, tag) \
|
||||
ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_NDEF)
|
||||
|
||||
/* EXPLICIT OPTIONAL using indefinite length constructed form */
|
||||
# define ASN1_NDEF_EXP_OPT(stname, field, type, tag) \
|
||||
ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_NDEF)
|
||||
|
||||
/* Macros for the ASN1_ADB structure */
|
||||
|
||||
# define ASN1_ADB(name) \
|
||||
static const ASN1_ADB_TABLE name##_adbtbl[]
|
||||
|
||||
# define ASN1_ADB_END(name, flags, field, adb_cb, def, none) \
|
||||
;\
|
||||
static const ASN1_ITEM *name##_adb(void) \
|
||||
{ \
|
||||
static const ASN1_ADB internal_adb = \
|
||||
{\
|
||||
flags,\
|
||||
offsetof(name, field),\
|
||||
adb_cb,\
|
||||
name##_adbtbl,\
|
||||
sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\
|
||||
def,\
|
||||
none\
|
||||
}; \
|
||||
return (const ASN1_ITEM *) &internal_adb; \
|
||||
} \
|
||||
void dummy_function(void)
|
||||
|
||||
# define ADB_ENTRY(val, template) {val, template}
|
||||
|
||||
# define ASN1_ADB_TEMPLATE(name) \
|
||||
static const ASN1_TEMPLATE name##_tt
|
||||
|
||||
/*
|
||||
* This is the ASN1 template structure that defines a wrapper round the
|
||||
* actual type. It determines the actual position of the field in the value
|
||||
* structure, various flags such as OPTIONAL and the field name.
|
||||
*/
|
||||
|
||||
struct ASN1_TEMPLATE_st {
|
||||
unsigned long flags; /* Various flags */
|
||||
long tag; /* tag, not used if no tagging */
|
||||
unsigned long offset; /* Offset of this field in structure */
|
||||
const char *field_name; /* Field name */
|
||||
ASN1_ITEM_EXP *item; /* Relevant ASN1_ITEM or ASN1_ADB */
|
||||
};
|
||||
|
||||
/* Macro to extract ASN1_ITEM and ASN1_ADB pointer from ASN1_TEMPLATE */
|
||||
|
||||
# define ASN1_TEMPLATE_item(t) (t->item_ptr)
|
||||
# define ASN1_TEMPLATE_adb(t) (t->item_ptr)
|
||||
|
||||
typedef struct ASN1_ADB_TABLE_st ASN1_ADB_TABLE;
|
||||
typedef struct ASN1_ADB_st ASN1_ADB;
|
||||
|
||||
struct ASN1_ADB_st {
|
||||
unsigned long flags; /* Various flags */
|
||||
unsigned long offset; /* Offset of selector field */
|
||||
int (*adb_cb)(long *psel); /* Application callback */
|
||||
const ASN1_ADB_TABLE *tbl; /* Table of possible types */
|
||||
long tblcount; /* Number of entries in tbl */
|
||||
const ASN1_TEMPLATE *default_tt; /* Type to use if no match */
|
||||
const ASN1_TEMPLATE *null_tt; /* Type to use if selector is NULL */
|
||||
};
|
||||
|
||||
struct ASN1_ADB_TABLE_st {
|
||||
long value; /* NID for an object or value for an int */
|
||||
const ASN1_TEMPLATE tt; /* item for this value */
|
||||
};
|
||||
|
||||
/* template flags */
|
||||
|
||||
/* Field is optional */
|
||||
# define ASN1_TFLG_OPTIONAL (0x1)
|
||||
|
||||
/* Field is a SET OF */
|
||||
# define ASN1_TFLG_SET_OF (0x1 << 1)
|
||||
|
||||
/* Field is a SEQUENCE OF */
|
||||
# define ASN1_TFLG_SEQUENCE_OF (0x2 << 1)
|
||||
|
||||
/*
|
||||
* Special case: this refers to a SET OF that will be sorted into DER order
|
||||
* when encoded *and* the corresponding STACK will be modified to match the
|
||||
* new order.
|
||||
*/
|
||||
# define ASN1_TFLG_SET_ORDER (0x3 << 1)
|
||||
|
||||
/* Mask for SET OF or SEQUENCE OF */
|
||||
# define ASN1_TFLG_SK_MASK (0x3 << 1)
|
||||
|
||||
/*
|
||||
* These flags mean the tag should be taken from the tag field. If EXPLICIT
|
||||
* then the underlying type is used for the inner tag.
|
||||
*/
|
||||
|
||||
/* IMPLICIT tagging */
|
||||
# define ASN1_TFLG_IMPTAG (0x1 << 3)
|
||||
|
||||
/* EXPLICIT tagging, inner tag from underlying type */
|
||||
# define ASN1_TFLG_EXPTAG (0x2 << 3)
|
||||
|
||||
# define ASN1_TFLG_TAG_MASK (0x3 << 3)
|
||||
|
||||
/* context specific IMPLICIT */
|
||||
# define ASN1_TFLG_IMPLICIT (ASN1_TFLG_IMPTAG|ASN1_TFLG_CONTEXT)
|
||||
|
||||
/* context specific EXPLICIT */
|
||||
# define ASN1_TFLG_EXPLICIT (ASN1_TFLG_EXPTAG|ASN1_TFLG_CONTEXT)
|
||||
|
||||
/*
|
||||
* If tagging is in force these determine the type of tag to use. Otherwise
|
||||
* the tag is determined by the underlying type. These values reflect the
|
||||
* actual octet format.
|
||||
*/
|
||||
|
||||
/* Universal tag */
|
||||
# define ASN1_TFLG_UNIVERSAL (0x0<<6)
|
||||
/* Application tag */
|
||||
# define ASN1_TFLG_APPLICATION (0x1<<6)
|
||||
/* Context specific tag */
|
||||
# define ASN1_TFLG_CONTEXT (0x2<<6)
|
||||
/* Private tag */
|
||||
# define ASN1_TFLG_PRIVATE (0x3<<6)
|
||||
|
||||
# define ASN1_TFLG_TAG_CLASS (0x3<<6)
|
||||
|
||||
/*
|
||||
* These are for ANY DEFINED BY type. In this case the 'item' field points to
|
||||
* an ASN1_ADB structure which contains a table of values to decode the
|
||||
* relevant type
|
||||
*/
|
||||
|
||||
# define ASN1_TFLG_ADB_MASK (0x3<<8)
|
||||
|
||||
# define ASN1_TFLG_ADB_OID (0x1<<8)
|
||||
|
||||
# define ASN1_TFLG_ADB_INT (0x1<<9)
|
||||
|
||||
/*
|
||||
* This flag when present in a SEQUENCE OF, SET OF or EXPLICIT causes
|
||||
* indefinite length constructed encoding to be used if required.
|
||||
*/
|
||||
|
||||
# define ASN1_TFLG_NDEF (0x1<<11)
|
||||
|
||||
/* Field is embedded and not a pointer */
|
||||
# define ASN1_TFLG_EMBED (0x1 << 12)
|
||||
|
||||
/* This is the actual ASN1 item itself */
|
||||
|
||||
struct ASN1_ITEM_st {
|
||||
char itype; /* The item type, primitive, SEQUENCE, CHOICE
|
||||
* or extern */
|
||||
long utype; /* underlying type */
|
||||
const ASN1_TEMPLATE *templates; /* If SEQUENCE or CHOICE this contains
|
||||
* the contents */
|
||||
long tcount; /* Number of templates if SEQUENCE or CHOICE */
|
||||
const void *funcs; /* further data and type-specific functions */
|
||||
/* funcs can be ASN1_PRIMITIVE_FUNCS*, ASN1_EXTERN_FUNCS*, or ASN1_AUX* */
|
||||
long size; /* Structure size (usually) */
|
||||
const char *sname; /* Structure name */
|
||||
};
|
||||
|
||||
/*
|
||||
* Cache for ASN1 tag and length, so we don't keep re-reading it for things
|
||||
* like CHOICE
|
||||
*/
|
||||
|
||||
struct ASN1_TLC_st {
|
||||
char valid; /* Values below are valid */
|
||||
int ret; /* return value */
|
||||
long plen; /* length */
|
||||
int ptag; /* class value */
|
||||
int pclass; /* class value */
|
||||
int hdrlen; /* header length */
|
||||
};
|
||||
|
||||
/* Typedefs for ASN1 function pointers */
|
||||
typedef int ASN1_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
|
||||
const ASN1_ITEM *it, int tag, int aclass, char opt,
|
||||
ASN1_TLC *ctx);
|
||||
|
||||
typedef int ASN1_ex_d2i_ex(ASN1_VALUE **pval, const unsigned char **in, long len,
|
||||
const ASN1_ITEM *it, int tag, int aclass, char opt,
|
||||
ASN1_TLC *ctx, OSSL_LIB_CTX *libctx,
|
||||
const char *propq);
|
||||
typedef int ASN1_ex_i2d(const ASN1_VALUE **pval, unsigned char **out,
|
||||
const ASN1_ITEM *it, int tag, int aclass);
|
||||
typedef int ASN1_ex_new_func(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
typedef int ASN1_ex_new_ex_func(ASN1_VALUE **pval, const ASN1_ITEM *it,
|
||||
OSSL_LIB_CTX *libctx, const char *propq);
|
||||
typedef void ASN1_ex_free_func(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
|
||||
typedef int ASN1_ex_print_func(BIO *out, const ASN1_VALUE **pval,
|
||||
int indent, const char *fname,
|
||||
const ASN1_PCTX *pctx);
|
||||
|
||||
typedef int ASN1_primitive_i2c(const ASN1_VALUE **pval, unsigned char *cont,
|
||||
int *putype, const ASN1_ITEM *it);
|
||||
typedef int ASN1_primitive_c2i(ASN1_VALUE **pval, const unsigned char *cont,
|
||||
int len, int utype, char *free_cont,
|
||||
const ASN1_ITEM *it);
|
||||
typedef int ASN1_primitive_print(BIO *out, const ASN1_VALUE **pval,
|
||||
const ASN1_ITEM *it, int indent,
|
||||
const ASN1_PCTX *pctx);
|
||||
|
||||
typedef struct ASN1_EXTERN_FUNCS_st {
|
||||
void *app_data;
|
||||
ASN1_ex_new_func *asn1_ex_new;
|
||||
ASN1_ex_free_func *asn1_ex_free;
|
||||
ASN1_ex_free_func *asn1_ex_clear;
|
||||
ASN1_ex_d2i *asn1_ex_d2i;
|
||||
ASN1_ex_i2d *asn1_ex_i2d;
|
||||
ASN1_ex_print_func *asn1_ex_print;
|
||||
ASN1_ex_new_ex_func *asn1_ex_new_ex;
|
||||
ASN1_ex_d2i_ex *asn1_ex_d2i_ex;
|
||||
} ASN1_EXTERN_FUNCS;
|
||||
|
||||
typedef struct ASN1_PRIMITIVE_FUNCS_st {
|
||||
void *app_data;
|
||||
unsigned long flags;
|
||||
ASN1_ex_new_func *prim_new;
|
||||
ASN1_ex_free_func *prim_free;
|
||||
ASN1_ex_free_func *prim_clear;
|
||||
ASN1_primitive_c2i *prim_c2i;
|
||||
ASN1_primitive_i2c *prim_i2c;
|
||||
ASN1_primitive_print *prim_print;
|
||||
} ASN1_PRIMITIVE_FUNCS;
|
||||
|
||||
/*
|
||||
* This is the ASN1_AUX structure: it handles various miscellaneous
|
||||
* requirements. For example the use of reference counts and an informational
|
||||
* callback. The "informational callback" is called at various points during
|
||||
* the ASN1 encoding and decoding. It can be used to provide minor
|
||||
* customisation of the structures used. This is most useful where the
|
||||
* supplied routines *almost* do the right thing but need some extra help at
|
||||
* a few points. If the callback returns zero then it is assumed a fatal
|
||||
* error has occurred and the main operation should be abandoned. If major
|
||||
* changes in the default behaviour are required then an external type is
|
||||
* more appropriate.
|
||||
* For the operations ASN1_OP_I2D_PRE, ASN1_OP_I2D_POST, ASN1_OP_PRINT_PRE, and
|
||||
* ASN1_OP_PRINT_POST, meanwhile a variant of the callback with const parameter
|
||||
* 'in' is provided to make clear statically that its input is not modified. If
|
||||
* and only if this variant is in use the flag ASN1_AFLG_CONST_CB must be set.
|
||||
*/
|
||||
|
||||
typedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *it,
|
||||
void *exarg);
|
||||
typedef int ASN1_aux_const_cb(int operation, const ASN1_VALUE **in,
|
||||
const ASN1_ITEM *it, void *exarg);
|
||||
|
||||
typedef struct ASN1_AUX_st {
|
||||
void *app_data;
|
||||
int flags;
|
||||
int ref_offset; /* Offset of reference value */
|
||||
int ref_lock; /* Offset of lock value */
|
||||
ASN1_aux_cb *asn1_cb;
|
||||
int enc_offset; /* Offset of ASN1_ENCODING structure */
|
||||
ASN1_aux_const_cb *asn1_const_cb; /* for ASN1_OP_I2D_ and ASN1_OP_PRINT_ */
|
||||
} ASN1_AUX;
|
||||
|
||||
/* For print related callbacks exarg points to this structure */
|
||||
typedef struct ASN1_PRINT_ARG_st {
|
||||
BIO *out;
|
||||
int indent;
|
||||
const ASN1_PCTX *pctx;
|
||||
} ASN1_PRINT_ARG;
|
||||
|
||||
/* For streaming related callbacks exarg points to this structure */
|
||||
typedef struct ASN1_STREAM_ARG_st {
|
||||
/* BIO to stream through */
|
||||
BIO *out;
|
||||
/* BIO with filters appended */
|
||||
BIO *ndef_bio;
|
||||
/* Streaming I/O boundary */
|
||||
unsigned char **boundary;
|
||||
} ASN1_STREAM_ARG;
|
||||
|
||||
/* Flags in ASN1_AUX */
|
||||
|
||||
/* Use a reference count */
|
||||
# define ASN1_AFLG_REFCOUNT 1
|
||||
/* Save the encoding of structure (useful for signatures) */
|
||||
# define ASN1_AFLG_ENCODING 2
|
||||
/* The Sequence length is invalid */
|
||||
# define ASN1_AFLG_BROKEN 4
|
||||
/* Use the new asn1_const_cb */
|
||||
# define ASN1_AFLG_CONST_CB 8
|
||||
|
||||
/* operation values for asn1_cb */
|
||||
|
||||
# define ASN1_OP_NEW_PRE 0
|
||||
# define ASN1_OP_NEW_POST 1
|
||||
# define ASN1_OP_FREE_PRE 2
|
||||
# define ASN1_OP_FREE_POST 3
|
||||
# define ASN1_OP_D2I_PRE 4
|
||||
# define ASN1_OP_D2I_POST 5
|
||||
# define ASN1_OP_I2D_PRE 6
|
||||
# define ASN1_OP_I2D_POST 7
|
||||
# define ASN1_OP_PRINT_PRE 8
|
||||
# define ASN1_OP_PRINT_POST 9
|
||||
# define ASN1_OP_STREAM_PRE 10
|
||||
# define ASN1_OP_STREAM_POST 11
|
||||
# define ASN1_OP_DETACHED_PRE 12
|
||||
# define ASN1_OP_DETACHED_POST 13
|
||||
# define ASN1_OP_DUP_PRE 14
|
||||
# define ASN1_OP_DUP_POST 15
|
||||
# define ASN1_OP_GET0_LIBCTX 16
|
||||
# define ASN1_OP_GET0_PROPQ 17
|
||||
|
||||
/* Macro to implement a primitive type */
|
||||
# define IMPLEMENT_ASN1_TYPE(stname) IMPLEMENT_ASN1_TYPE_ex(stname, stname, 0)
|
||||
# define IMPLEMENT_ASN1_TYPE_ex(itname, vname, ex) \
|
||||
ASN1_ITEM_start(itname) \
|
||||
ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \
|
||||
ASN1_ITEM_end(itname)
|
||||
|
||||
/* Macro to implement a multi string type */
|
||||
# define IMPLEMENT_ASN1_MSTRING(itname, mask) \
|
||||
ASN1_ITEM_start(itname) \
|
||||
ASN1_ITYPE_MSTRING, mask, NULL, 0, NULL, sizeof(ASN1_STRING), #itname \
|
||||
ASN1_ITEM_end(itname)
|
||||
|
||||
# define IMPLEMENT_EXTERN_ASN1(sname, tag, fptrs) \
|
||||
ASN1_ITEM_start(sname) \
|
||||
ASN1_ITYPE_EXTERN, \
|
||||
tag, \
|
||||
NULL, \
|
||||
0, \
|
||||
&fptrs, \
|
||||
0, \
|
||||
#sname \
|
||||
ASN1_ITEM_end(sname)
|
||||
|
||||
/* Macro to implement standard functions in terms of ASN1_ITEM structures */
|
||||
|
||||
# define IMPLEMENT_ASN1_FUNCTIONS(stname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, stname, stname)
|
||||
|
||||
# define IMPLEMENT_ASN1_FUNCTIONS_name(stname, itname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, itname)
|
||||
|
||||
# define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \
|
||||
IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname)
|
||||
|
||||
# define IMPLEMENT_STATIC_ASN1_ALLOC_FUNCTIONS(stname) \
|
||||
IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(static, stname, stname, stname)
|
||||
|
||||
# define IMPLEMENT_ASN1_ALLOC_FUNCTIONS(stname) \
|
||||
IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, stname, stname)
|
||||
|
||||
# define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(pre, stname, itname, fname) \
|
||||
pre stname *fname##_new(void) \
|
||||
{ \
|
||||
return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \
|
||||
} \
|
||||
pre void fname##_free(stname *a) \
|
||||
{ \
|
||||
ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
|
||||
}
|
||||
|
||||
# define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \
|
||||
stname *fname##_new(void) \
|
||||
{ \
|
||||
return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \
|
||||
} \
|
||||
void fname##_free(stname *a) \
|
||||
{ \
|
||||
ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
|
||||
}
|
||||
|
||||
# define IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, fname) \
|
||||
IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \
|
||||
IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname)
|
||||
|
||||
# define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \
|
||||
stname *d2i_##fname(stname **a, const unsigned char **in, long len) \
|
||||
{ \
|
||||
return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
|
||||
} \
|
||||
int i2d_##fname(const stname *a, unsigned char **out) \
|
||||
{ \
|
||||
return ASN1_item_i2d((const ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
|
||||
}
|
||||
|
||||
# define IMPLEMENT_ASN1_NDEF_FUNCTION(stname) \
|
||||
int i2d_##stname##_NDEF(const stname *a, unsigned char **out) \
|
||||
{ \
|
||||
return ASN1_item_ndef_i2d((const ASN1_VALUE *)a, out, ASN1_ITEM_rptr(stname));\
|
||||
}
|
||||
|
||||
# define IMPLEMENT_STATIC_ASN1_ENCODE_FUNCTIONS(stname) \
|
||||
static stname *d2i_##stname(stname **a, \
|
||||
const unsigned char **in, long len) \
|
||||
{ \
|
||||
return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, \
|
||||
ASN1_ITEM_rptr(stname)); \
|
||||
} \
|
||||
static int i2d_##stname(const stname *a, unsigned char **out) \
|
||||
{ \
|
||||
return ASN1_item_i2d((const ASN1_VALUE *)a, out, \
|
||||
ASN1_ITEM_rptr(stname)); \
|
||||
}
|
||||
|
||||
# define IMPLEMENT_ASN1_DUP_FUNCTION(stname) \
|
||||
stname * stname##_dup(const stname *x) \
|
||||
{ \
|
||||
return ASN1_item_dup(ASN1_ITEM_rptr(stname), x); \
|
||||
}
|
||||
|
||||
# define IMPLEMENT_ASN1_PRINT_FUNCTION(stname) \
|
||||
IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, stname, stname)
|
||||
|
||||
# define IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, itname, fname) \
|
||||
int fname##_print_ctx(BIO *out, const stname *x, int indent, \
|
||||
const ASN1_PCTX *pctx) \
|
||||
{ \
|
||||
return ASN1_item_print(out, (const ASN1_VALUE *)x, indent, \
|
||||
ASN1_ITEM_rptr(itname), pctx); \
|
||||
}
|
||||
|
||||
/* external definitions for primitive types */
|
||||
|
||||
DECLARE_ASN1_ITEM(ASN1_BOOLEAN)
|
||||
DECLARE_ASN1_ITEM(ASN1_TBOOLEAN)
|
||||
DECLARE_ASN1_ITEM(ASN1_FBOOLEAN)
|
||||
DECLARE_ASN1_ITEM(ASN1_SEQUENCE)
|
||||
DECLARE_ASN1_ITEM(CBIGNUM)
|
||||
DECLARE_ASN1_ITEM(BIGNUM)
|
||||
DECLARE_ASN1_ITEM(INT32)
|
||||
DECLARE_ASN1_ITEM(ZINT32)
|
||||
DECLARE_ASN1_ITEM(UINT32)
|
||||
DECLARE_ASN1_ITEM(ZUINT32)
|
||||
DECLARE_ASN1_ITEM(INT64)
|
||||
DECLARE_ASN1_ITEM(ZINT64)
|
||||
DECLARE_ASN1_ITEM(UINT64)
|
||||
DECLARE_ASN1_ITEM(ZUINT64)
|
||||
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
/*
|
||||
* LONG and ZLONG are strongly discouraged for use as stored data, as the
|
||||
* underlying C type (long) differs in size depending on the architecture.
|
||||
* They are designed with 32-bit longs in mind.
|
||||
*/
|
||||
DECLARE_ASN1_ITEM(LONG)
|
||||
DECLARE_ASN1_ITEM(ZLONG)
|
||||
# endif
|
||||
|
||||
SKM_DEFINE_STACK_OF_INTERNAL(ASN1_VALUE, ASN1_VALUE, ASN1_VALUE)
|
||||
#define sk_ASN1_VALUE_num(sk) OPENSSL_sk_num(ossl_check_const_ASN1_VALUE_sk_type(sk))
|
||||
#define sk_ASN1_VALUE_value(sk, idx) ((ASN1_VALUE *)OPENSSL_sk_value(ossl_check_const_ASN1_VALUE_sk_type(sk), (idx)))
|
||||
#define sk_ASN1_VALUE_new(cmp) ((STACK_OF(ASN1_VALUE) *)OPENSSL_sk_new(ossl_check_ASN1_VALUE_compfunc_type(cmp)))
|
||||
#define sk_ASN1_VALUE_new_null() ((STACK_OF(ASN1_VALUE) *)OPENSSL_sk_new_null())
|
||||
#define sk_ASN1_VALUE_new_reserve(cmp, n) ((STACK_OF(ASN1_VALUE) *)OPENSSL_sk_new_reserve(ossl_check_ASN1_VALUE_compfunc_type(cmp), (n)))
|
||||
#define sk_ASN1_VALUE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_ASN1_VALUE_sk_type(sk), (n))
|
||||
#define sk_ASN1_VALUE_free(sk) OPENSSL_sk_free(ossl_check_ASN1_VALUE_sk_type(sk))
|
||||
#define sk_ASN1_VALUE_zero(sk) OPENSSL_sk_zero(ossl_check_ASN1_VALUE_sk_type(sk))
|
||||
#define sk_ASN1_VALUE_delete(sk, i) ((ASN1_VALUE *)OPENSSL_sk_delete(ossl_check_ASN1_VALUE_sk_type(sk), (i)))
|
||||
#define sk_ASN1_VALUE_delete_ptr(sk, ptr) ((ASN1_VALUE *)OPENSSL_sk_delete_ptr(ossl_check_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_type(ptr)))
|
||||
#define sk_ASN1_VALUE_push(sk, ptr) OPENSSL_sk_push(ossl_check_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_type(ptr))
|
||||
#define sk_ASN1_VALUE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_type(ptr))
|
||||
#define sk_ASN1_VALUE_pop(sk) ((ASN1_VALUE *)OPENSSL_sk_pop(ossl_check_ASN1_VALUE_sk_type(sk)))
|
||||
#define sk_ASN1_VALUE_shift(sk) ((ASN1_VALUE *)OPENSSL_sk_shift(ossl_check_ASN1_VALUE_sk_type(sk)))
|
||||
#define sk_ASN1_VALUE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_ASN1_VALUE_sk_type(sk),ossl_check_ASN1_VALUE_freefunc_type(freefunc))
|
||||
#define sk_ASN1_VALUE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_type(ptr), (idx))
|
||||
#define sk_ASN1_VALUE_set(sk, idx, ptr) ((ASN1_VALUE *)OPENSSL_sk_set(ossl_check_ASN1_VALUE_sk_type(sk), (idx), ossl_check_ASN1_VALUE_type(ptr)))
|
||||
#define sk_ASN1_VALUE_find(sk, ptr) OPENSSL_sk_find(ossl_check_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_type(ptr))
|
||||
#define sk_ASN1_VALUE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_type(ptr))
|
||||
#define sk_ASN1_VALUE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_type(ptr), pnum)
|
||||
#define sk_ASN1_VALUE_sort(sk) OPENSSL_sk_sort(ossl_check_ASN1_VALUE_sk_type(sk))
|
||||
#define sk_ASN1_VALUE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_ASN1_VALUE_sk_type(sk))
|
||||
#define sk_ASN1_VALUE_dup(sk) ((STACK_OF(ASN1_VALUE) *)OPENSSL_sk_dup(ossl_check_const_ASN1_VALUE_sk_type(sk)))
|
||||
#define sk_ASN1_VALUE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(ASN1_VALUE) *)OPENSSL_sk_deep_copy(ossl_check_const_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_copyfunc_type(copyfunc), ossl_check_ASN1_VALUE_freefunc_type(freefunc)))
|
||||
#define sk_ASN1_VALUE_set_cmp_func(sk, cmp) ((sk_ASN1_VALUE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_compfunc_type(cmp)))
|
||||
|
||||
|
||||
|
||||
/* Functions used internally by the ASN1 code */
|
||||
|
||||
int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
|
||||
int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
|
||||
const ASN1_ITEM *it, int tag, int aclass, char opt,
|
||||
ASN1_TLC *ctx);
|
||||
|
||||
int ASN1_item_ex_i2d(const ASN1_VALUE **pval, unsigned char **out,
|
||||
const ASN1_ITEM *it, int tag, int aclass);
|
||||
|
||||
/* Legacy compatibility */
|
||||
# define IMPLEMENT_ASN1_FUNCTIONS_const(name) IMPLEMENT_ASN1_FUNCTIONS(name)
|
||||
# define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \
|
||||
IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
104
thirdparty/OpenSSL-3.5.3/include/openssl/async.h
vendored
Normal file
104
thirdparty/OpenSSL-3.5.3/include/openssl/async.h
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef OPENSSL_ASYNC_H
|
||||
# define OPENSSL_ASYNC_H
|
||||
# pragma once
|
||||
|
||||
# include <openssl/macros.h>
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
# define HEADER_ASYNC_H
|
||||
# endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
# if defined(BASETYPES) || defined(_WINDEF_H)
|
||||
/* application has to include <windows.h> to use this */
|
||||
#define OSSL_ASYNC_FD HANDLE
|
||||
#define OSSL_BAD_ASYNC_FD INVALID_HANDLE_VALUE
|
||||
# endif
|
||||
#else
|
||||
#define OSSL_ASYNC_FD int
|
||||
#define OSSL_BAD_ASYNC_FD -1
|
||||
#endif
|
||||
# include <openssl/asyncerr.h>
|
||||
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
typedef struct async_job_st ASYNC_JOB;
|
||||
typedef struct async_wait_ctx_st ASYNC_WAIT_CTX;
|
||||
typedef int (*ASYNC_callback_fn)(void *arg);
|
||||
|
||||
#define ASYNC_ERR 0
|
||||
#define ASYNC_NO_JOBS 1
|
||||
#define ASYNC_PAUSE 2
|
||||
#define ASYNC_FINISH 3
|
||||
|
||||
#define ASYNC_STATUS_UNSUPPORTED 0
|
||||
#define ASYNC_STATUS_ERR 1
|
||||
#define ASYNC_STATUS_OK 2
|
||||
#define ASYNC_STATUS_EAGAIN 3
|
||||
|
||||
int ASYNC_init_thread(size_t max_size, size_t init_size);
|
||||
void ASYNC_cleanup_thread(void);
|
||||
|
||||
#ifdef OSSL_ASYNC_FD
|
||||
ASYNC_WAIT_CTX *ASYNC_WAIT_CTX_new(void);
|
||||
void ASYNC_WAIT_CTX_free(ASYNC_WAIT_CTX *ctx);
|
||||
int ASYNC_WAIT_CTX_set_wait_fd(ASYNC_WAIT_CTX *ctx, const void *key,
|
||||
OSSL_ASYNC_FD fd,
|
||||
void *custom_data,
|
||||
void (*cleanup)(ASYNC_WAIT_CTX *, const void *,
|
||||
OSSL_ASYNC_FD, void *));
|
||||
int ASYNC_WAIT_CTX_get_fd(ASYNC_WAIT_CTX *ctx, const void *key,
|
||||
OSSL_ASYNC_FD *fd, void **custom_data);
|
||||
int ASYNC_WAIT_CTX_get_all_fds(ASYNC_WAIT_CTX *ctx, OSSL_ASYNC_FD *fd,
|
||||
size_t *numfds);
|
||||
int ASYNC_WAIT_CTX_get_callback(ASYNC_WAIT_CTX *ctx,
|
||||
ASYNC_callback_fn *callback,
|
||||
void **callback_arg);
|
||||
int ASYNC_WAIT_CTX_set_callback(ASYNC_WAIT_CTX *ctx,
|
||||
ASYNC_callback_fn callback,
|
||||
void *callback_arg);
|
||||
int ASYNC_WAIT_CTX_set_status(ASYNC_WAIT_CTX *ctx, int status);
|
||||
int ASYNC_WAIT_CTX_get_status(ASYNC_WAIT_CTX *ctx);
|
||||
int ASYNC_WAIT_CTX_get_changed_fds(ASYNC_WAIT_CTX *ctx, OSSL_ASYNC_FD *addfd,
|
||||
size_t *numaddfds, OSSL_ASYNC_FD *delfd,
|
||||
size_t *numdelfds);
|
||||
int ASYNC_WAIT_CTX_clear_fd(ASYNC_WAIT_CTX *ctx, const void *key);
|
||||
#endif
|
||||
|
||||
int ASYNC_is_capable(void);
|
||||
|
||||
typedef void *(*ASYNC_stack_alloc_fn)(size_t *num);
|
||||
typedef void (*ASYNC_stack_free_fn)(void *addr);
|
||||
|
||||
int ASYNC_set_mem_functions(ASYNC_stack_alloc_fn alloc_fn,
|
||||
ASYNC_stack_free_fn free_fn);
|
||||
void ASYNC_get_mem_functions(ASYNC_stack_alloc_fn *alloc_fn,
|
||||
ASYNC_stack_free_fn *free_fn);
|
||||
|
||||
int ASYNC_start_job(ASYNC_JOB **job, ASYNC_WAIT_CTX *ctx, int *ret,
|
||||
int (*func)(void *), void *args, size_t size);
|
||||
int ASYNC_pause_job(void);
|
||||
|
||||
ASYNC_JOB *ASYNC_get_current_job(void);
|
||||
ASYNC_WAIT_CTX *ASYNC_get_wait_ctx(ASYNC_JOB *job);
|
||||
void ASYNC_block_pause(void);
|
||||
void ASYNC_unblock_pause(void);
|
||||
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
29
thirdparty/OpenSSL-3.5.3/include/openssl/asyncerr.h
vendored
Normal file
29
thirdparty/OpenSSL-3.5.3/include/openssl/asyncerr.h
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef OPENSSL_ASYNCERR_H
|
||||
# define OPENSSL_ASYNCERR_H
|
||||
# pragma once
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
# include <openssl/symhacks.h>
|
||||
# include <openssl/cryptoerr_legacy.h>
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* ASYNC reason codes.
|
||||
*/
|
||||
# define ASYNC_R_FAILED_TO_SET_POOL 101
|
||||
# define ASYNC_R_FAILED_TO_SWAP_CONTEXT 102
|
||||
# define ASYNC_R_INIT_FAILED 105
|
||||
# define ASYNC_R_INVALID_POOL_SIZE 103
|
||||
|
||||
#endif
|
||||
1022
thirdparty/OpenSSL-3.5.3/include/openssl/bio.h
vendored
Normal file
1022
thirdparty/OpenSSL-3.5.3/include/openssl/bio.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
72
thirdparty/OpenSSL-3.5.3/include/openssl/bioerr.h
vendored
Normal file
72
thirdparty/OpenSSL-3.5.3/include/openssl/bioerr.h
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef OPENSSL_BIOERR_H
|
||||
# define OPENSSL_BIOERR_H
|
||||
# pragma once
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
# include <openssl/symhacks.h>
|
||||
# include <openssl/cryptoerr_legacy.h>
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* BIO reason codes.
|
||||
*/
|
||||
# define BIO_R_ACCEPT_ERROR 100
|
||||
# define BIO_R_ADDRINFO_ADDR_IS_NOT_AF_INET 141
|
||||
# define BIO_R_AMBIGUOUS_HOST_OR_SERVICE 129
|
||||
# define BIO_R_BAD_FOPEN_MODE 101
|
||||
# define BIO_R_BROKEN_PIPE 124
|
||||
# define BIO_R_CONNECT_ERROR 103
|
||||
# define BIO_R_CONNECT_TIMEOUT 147
|
||||
# define BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET 107
|
||||
# define BIO_R_GETSOCKNAME_ERROR 132
|
||||
# define BIO_R_GETSOCKNAME_TRUNCATED_ADDRESS 133
|
||||
# define BIO_R_GETTING_SOCKTYPE 134
|
||||
# define BIO_R_INVALID_ARGUMENT 125
|
||||
# define BIO_R_INVALID_SOCKET 135
|
||||
# define BIO_R_IN_USE 123
|
||||
# define BIO_R_LENGTH_TOO_LONG 102
|
||||
# define BIO_R_LISTEN_V6_ONLY 136
|
||||
# define BIO_R_LOCAL_ADDR_NOT_AVAILABLE 111
|
||||
# define BIO_R_LOOKUP_RETURNED_NOTHING 142
|
||||
# define BIO_R_MALFORMED_HOST_OR_SERVICE 130
|
||||
# define BIO_R_NBIO_CONNECT_ERROR 110
|
||||
# define BIO_R_NON_FATAL 112
|
||||
# define BIO_R_NO_ACCEPT_ADDR_OR_SERVICE_SPECIFIED 143
|
||||
# define BIO_R_NO_HOSTNAME_OR_SERVICE_SPECIFIED 144
|
||||
# define BIO_R_NO_PORT_DEFINED 113
|
||||
# define BIO_R_NO_SUCH_FILE 128
|
||||
# define BIO_R_NULL_PARAMETER 115 /* unused */
|
||||
# define BIO_R_TFO_DISABLED 106
|
||||
# define BIO_R_TFO_NO_KERNEL_SUPPORT 108
|
||||
# define BIO_R_TRANSFER_ERROR 104
|
||||
# define BIO_R_TRANSFER_TIMEOUT 105
|
||||
# define BIO_R_UNABLE_TO_BIND_SOCKET 117
|
||||
# define BIO_R_UNABLE_TO_CREATE_SOCKET 118
|
||||
# define BIO_R_UNABLE_TO_KEEPALIVE 137
|
||||
# define BIO_R_UNABLE_TO_LISTEN_SOCKET 119
|
||||
# define BIO_R_UNABLE_TO_NODELAY 138
|
||||
# define BIO_R_UNABLE_TO_REUSEADDR 139
|
||||
# define BIO_R_UNABLE_TO_TFO 109
|
||||
# define BIO_R_UNAVAILABLE_IP_FAMILY 145
|
||||
# define BIO_R_UNINITIALIZED 120
|
||||
# define BIO_R_UNKNOWN_INFO_TYPE 140
|
||||
# define BIO_R_UNSUPPORTED_IP_FAMILY 146
|
||||
# define BIO_R_UNSUPPORTED_METHOD 121
|
||||
# define BIO_R_UNSUPPORTED_PROTOCOL_FAMILY 131
|
||||
# define BIO_R_WRITE_TO_READ_ONLY_BIO 126
|
||||
# define BIO_R_WSASTARTUP 122
|
||||
# define BIO_R_PORT_MISMATCH 150
|
||||
# define BIO_R_PEER_ADDR_NOT_AVAILABLE 151
|
||||
|
||||
#endif
|
||||
78
thirdparty/OpenSSL-3.5.3/include/openssl/blowfish.h
vendored
Normal file
78
thirdparty/OpenSSL-3.5.3/include/openssl/blowfish.h
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef OPENSSL_BLOWFISH_H
|
||||
# define OPENSSL_BLOWFISH_H
|
||||
# pragma once
|
||||
|
||||
# include <openssl/macros.h>
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
# define HEADER_BLOWFISH_H
|
||||
# endif
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_BF
|
||||
# include <openssl/e_os2.h>
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
# define BF_BLOCK 8
|
||||
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
|
||||
# define BF_ENCRYPT 1
|
||||
# define BF_DECRYPT 0
|
||||
|
||||
/*-
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
* ! BF_LONG has to be at least 32 bits wide. !
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
*/
|
||||
# define BF_LONG unsigned int
|
||||
|
||||
# define BF_ROUNDS 16
|
||||
|
||||
typedef struct bf_key_st {
|
||||
BF_LONG P[BF_ROUNDS + 2];
|
||||
BF_LONG S[4 * 256];
|
||||
} BF_KEY;
|
||||
|
||||
# endif /* OPENSSL_NO_DEPRECATED_3_0 */
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
OSSL_DEPRECATEDIN_3_0 void BF_set_key(BF_KEY *key, int len,
|
||||
const unsigned char *data);
|
||||
OSSL_DEPRECATEDIN_3_0 void BF_encrypt(BF_LONG *data, const BF_KEY *key);
|
||||
OSSL_DEPRECATEDIN_3_0 void BF_decrypt(BF_LONG *data, const BF_KEY *key);
|
||||
OSSL_DEPRECATEDIN_3_0 void BF_ecb_encrypt(const unsigned char *in,
|
||||
unsigned char *out, const BF_KEY *key,
|
||||
int enc);
|
||||
OSSL_DEPRECATEDIN_3_0 void BF_cbc_encrypt(const unsigned char *in,
|
||||
unsigned char *out, long length,
|
||||
const BF_KEY *schedule,
|
||||
unsigned char *ivec, int enc);
|
||||
OSSL_DEPRECATEDIN_3_0 void BF_cfb64_encrypt(const unsigned char *in,
|
||||
unsigned char *out,
|
||||
long length, const BF_KEY *schedule,
|
||||
unsigned char *ivec, int *num,
|
||||
int enc);
|
||||
OSSL_DEPRECATEDIN_3_0 void BF_ofb64_encrypt(const unsigned char *in,
|
||||
unsigned char *out,
|
||||
long length, const BF_KEY *schedule,
|
||||
unsigned char *ivec, int *num);
|
||||
OSSL_DEPRECATEDIN_3_0 const char *BF_options(void);
|
||||
# endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
590
thirdparty/OpenSSL-3.5.3/include/openssl/bn.h
vendored
Normal file
590
thirdparty/OpenSSL-3.5.3/include/openssl/bn.h
vendored
Normal file
@@ -0,0 +1,590 @@
|
||||
/*
|
||||
* Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef OPENSSL_BN_H
|
||||
# define OPENSSL_BN_H
|
||||
# pragma once
|
||||
|
||||
# include <openssl/macros.h>
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
# define HEADER_BN_H
|
||||
# endif
|
||||
|
||||
# include <openssl/e_os2.h>
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
# include <stdio.h>
|
||||
# endif
|
||||
# include <openssl/opensslconf.h>
|
||||
# include <openssl/types.h>
|
||||
# include <openssl/crypto.h>
|
||||
# include <openssl/bnerr.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 64-bit processor with LP64 ABI
|
||||
*/
|
||||
# ifdef SIXTY_FOUR_BIT_LONG
|
||||
# define BN_ULONG unsigned long
|
||||
# define BN_BYTES 8
|
||||
# endif
|
||||
|
||||
/*
|
||||
* 64-bit processor other than LP64 ABI
|
||||
*/
|
||||
# ifdef SIXTY_FOUR_BIT
|
||||
# define BN_ULONG unsigned long long
|
||||
# define BN_BYTES 8
|
||||
# endif
|
||||
|
||||
# ifdef THIRTY_TWO_BIT
|
||||
# define BN_ULONG unsigned int
|
||||
# define BN_BYTES 4
|
||||
# endif
|
||||
|
||||
# define BN_BITS2 (BN_BYTES * 8)
|
||||
# define BN_BITS (BN_BITS2 * 2)
|
||||
# define BN_TBIT ((BN_ULONG)1 << (BN_BITS2 - 1))
|
||||
|
||||
# define BN_FLG_MALLOCED 0x01
|
||||
# define BN_FLG_STATIC_DATA 0x02
|
||||
|
||||
/*
|
||||
* avoid leaking exponent information through timing,
|
||||
* BN_mod_exp_mont() will call BN_mod_exp_mont_consttime,
|
||||
* BN_div() will call BN_div_no_branch,
|
||||
* BN_mod_inverse() will call bn_mod_inverse_no_branch.
|
||||
*/
|
||||
# define BN_FLG_CONSTTIME 0x04
|
||||
# define BN_FLG_SECURE 0x08
|
||||
|
||||
# ifndef OPENSSL_NO_DEPRECATED_0_9_8
|
||||
/* deprecated name for the flag */
|
||||
# define BN_FLG_EXP_CONSTTIME BN_FLG_CONSTTIME
|
||||
# define BN_FLG_FREE 0x8000 /* used for debugging */
|
||||
# endif
|
||||
|
||||
void BN_set_flags(BIGNUM *b, int n);
|
||||
int BN_get_flags(const BIGNUM *b, int n);
|
||||
|
||||
/* Values for |top| in BN_rand() */
|
||||
#define BN_RAND_TOP_ANY -1
|
||||
#define BN_RAND_TOP_ONE 0
|
||||
#define BN_RAND_TOP_TWO 1
|
||||
|
||||
/* Values for |bottom| in BN_rand() */
|
||||
#define BN_RAND_BOTTOM_ANY 0
|
||||
#define BN_RAND_BOTTOM_ODD 1
|
||||
|
||||
/*
|
||||
* get a clone of a BIGNUM with changed flags, for *temporary* use only (the
|
||||
* two BIGNUMs cannot be used in parallel!). Also only for *read only* use. The
|
||||
* value |dest| should be a newly allocated BIGNUM obtained via BN_new() that
|
||||
* has not been otherwise initialised or used.
|
||||
*/
|
||||
void BN_with_flags(BIGNUM *dest, const BIGNUM *b, int flags);
|
||||
|
||||
/* Wrapper function to make using BN_GENCB easier */
|
||||
int BN_GENCB_call(BN_GENCB *cb, int a, int b);
|
||||
|
||||
BN_GENCB *BN_GENCB_new(void);
|
||||
void BN_GENCB_free(BN_GENCB *cb);
|
||||
|
||||
/* Populate a BN_GENCB structure with an "old"-style callback */
|
||||
void BN_GENCB_set_old(BN_GENCB *gencb, void (*callback) (int, int, void *),
|
||||
void *cb_arg);
|
||||
|
||||
/* Populate a BN_GENCB structure with a "new"-style callback */
|
||||
void BN_GENCB_set(BN_GENCB *gencb, int (*callback) (int, int, BN_GENCB *),
|
||||
void *cb_arg);
|
||||
|
||||
void *BN_GENCB_get_arg(BN_GENCB *cb);
|
||||
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
# define BN_prime_checks 0 /* default: select number of iterations based
|
||||
* on the size of the number */
|
||||
|
||||
/*
|
||||
* BN_prime_checks_for_size() returns the number of Miller-Rabin iterations
|
||||
* that will be done for checking that a random number is probably prime. The
|
||||
* error rate for accepting a composite number as prime depends on the size of
|
||||
* the prime |b|. The error rates used are for calculating an RSA key with 2 primes,
|
||||
* and so the level is what you would expect for a key of double the size of the
|
||||
* prime.
|
||||
*
|
||||
* This table is generated using the algorithm of FIPS PUB 186-4
|
||||
* Digital Signature Standard (DSS), section F.1, page 117.
|
||||
* (https://dx.doi.org/10.6028/NIST.FIPS.186-4)
|
||||
*
|
||||
* The following magma script was used to generate the output:
|
||||
* securitybits:=125;
|
||||
* k:=1024;
|
||||
* for t:=1 to 65 do
|
||||
* for M:=3 to Floor(2*Sqrt(k-1)-1) do
|
||||
* S:=0;
|
||||
* // Sum over m
|
||||
* for m:=3 to M do
|
||||
* s:=0;
|
||||
* // Sum over j
|
||||
* for j:=2 to m do
|
||||
* s+:=(RealField(32)!2)^-(j+(k-1)/j);
|
||||
* end for;
|
||||
* S+:=2^(m-(m-1)*t)*s;
|
||||
* end for;
|
||||
* A:=2^(k-2-M*t);
|
||||
* B:=8*(Pi(RealField(32))^2-6)/3*2^(k-2)*S;
|
||||
* pkt:=2.00743*Log(2)*k*2^-k*(A+B);
|
||||
* seclevel:=Floor(-Log(2,pkt));
|
||||
* if seclevel ge securitybits then
|
||||
* printf "k: %5o, security: %o bits (t: %o, M: %o)\n",k,seclevel,t,M;
|
||||
* break;
|
||||
* end if;
|
||||
* end for;
|
||||
* if seclevel ge securitybits then break; end if;
|
||||
* end for;
|
||||
*
|
||||
* It can be run online at:
|
||||
* http://magma.maths.usyd.edu.au/calc
|
||||
*
|
||||
* And will output:
|
||||
* k: 1024, security: 129 bits (t: 6, M: 23)
|
||||
*
|
||||
* k is the number of bits of the prime, securitybits is the level we want to
|
||||
* reach.
|
||||
*
|
||||
* prime length | RSA key size | # MR tests | security level
|
||||
* -------------+--------------|------------+---------------
|
||||
* (b) >= 6394 | >= 12788 | 3 | 256 bit
|
||||
* (b) >= 3747 | >= 7494 | 3 | 192 bit
|
||||
* (b) >= 1345 | >= 2690 | 4 | 128 bit
|
||||
* (b) >= 1080 | >= 2160 | 5 | 128 bit
|
||||
* (b) >= 852 | >= 1704 | 5 | 112 bit
|
||||
* (b) >= 476 | >= 952 | 5 | 80 bit
|
||||
* (b) >= 400 | >= 800 | 6 | 80 bit
|
||||
* (b) >= 347 | >= 694 | 7 | 80 bit
|
||||
* (b) >= 308 | >= 616 | 8 | 80 bit
|
||||
* (b) >= 55 | >= 110 | 27 | 64 bit
|
||||
* (b) >= 6 | >= 12 | 34 | 64 bit
|
||||
*/
|
||||
|
||||
# define BN_prime_checks_for_size(b) ((b) >= 3747 ? 3 : \
|
||||
(b) >= 1345 ? 4 : \
|
||||
(b) >= 476 ? 5 : \
|
||||
(b) >= 400 ? 6 : \
|
||||
(b) >= 347 ? 7 : \
|
||||
(b) >= 308 ? 8 : \
|
||||
(b) >= 55 ? 27 : \
|
||||
/* b >= 6 */ 34)
|
||||
# endif
|
||||
|
||||
# define BN_num_bytes(a) ((BN_num_bits(a)+7)/8)
|
||||
|
||||
int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w);
|
||||
int BN_is_zero(const BIGNUM *a);
|
||||
int BN_is_one(const BIGNUM *a);
|
||||
int BN_is_word(const BIGNUM *a, const BN_ULONG w);
|
||||
int BN_is_odd(const BIGNUM *a);
|
||||
|
||||
# define BN_one(a) (BN_set_word((a),1))
|
||||
|
||||
void BN_zero_ex(BIGNUM *a);
|
||||
|
||||
# if OPENSSL_API_LEVEL > 908
|
||||
# define BN_zero(a) BN_zero_ex(a)
|
||||
# else
|
||||
# define BN_zero(a) (BN_set_word((a),0))
|
||||
# endif
|
||||
|
||||
const BIGNUM *BN_value_one(void);
|
||||
char *BN_options(void);
|
||||
BN_CTX *BN_CTX_new_ex(OSSL_LIB_CTX *ctx);
|
||||
BN_CTX *BN_CTX_new(void);
|
||||
BN_CTX *BN_CTX_secure_new_ex(OSSL_LIB_CTX *ctx);
|
||||
BN_CTX *BN_CTX_secure_new(void);
|
||||
void BN_CTX_free(BN_CTX *c);
|
||||
void BN_CTX_start(BN_CTX *ctx);
|
||||
BIGNUM *BN_CTX_get(BN_CTX *ctx);
|
||||
void BN_CTX_end(BN_CTX *ctx);
|
||||
int BN_rand_ex(BIGNUM *rnd, int bits, int top, int bottom,
|
||||
unsigned int strength, BN_CTX *ctx);
|
||||
int BN_rand(BIGNUM *rnd, int bits, int top, int bottom);
|
||||
int BN_priv_rand_ex(BIGNUM *rnd, int bits, int top, int bottom,
|
||||
unsigned int strength, BN_CTX *ctx);
|
||||
int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom);
|
||||
int BN_rand_range_ex(BIGNUM *r, const BIGNUM *range, unsigned int strength,
|
||||
BN_CTX *ctx);
|
||||
int BN_rand_range(BIGNUM *rnd, const BIGNUM *range);
|
||||
int BN_priv_rand_range_ex(BIGNUM *r, const BIGNUM *range,
|
||||
unsigned int strength, BN_CTX *ctx);
|
||||
int BN_priv_rand_range(BIGNUM *rnd, const BIGNUM *range);
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
OSSL_DEPRECATEDIN_3_0
|
||||
int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom);
|
||||
OSSL_DEPRECATEDIN_3_0
|
||||
int BN_pseudo_rand_range(BIGNUM *rnd, const BIGNUM *range);
|
||||
# endif
|
||||
int BN_num_bits(const BIGNUM *a);
|
||||
int BN_num_bits_word(BN_ULONG l);
|
||||
int BN_security_bits(int L, int N);
|
||||
BIGNUM *BN_new(void);
|
||||
BIGNUM *BN_secure_new(void);
|
||||
void BN_clear_free(BIGNUM *a);
|
||||
BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b);
|
||||
void BN_swap(BIGNUM *a, BIGNUM *b);
|
||||
BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret);
|
||||
BIGNUM *BN_signed_bin2bn(const unsigned char *s, int len, BIGNUM *ret);
|
||||
int BN_bn2bin(const BIGNUM *a, unsigned char *to);
|
||||
int BN_bn2binpad(const BIGNUM *a, unsigned char *to, int tolen);
|
||||
int BN_signed_bn2bin(const BIGNUM *a, unsigned char *to, int tolen);
|
||||
BIGNUM *BN_lebin2bn(const unsigned char *s, int len, BIGNUM *ret);
|
||||
BIGNUM *BN_signed_lebin2bn(const unsigned char *s, int len, BIGNUM *ret);
|
||||
int BN_bn2lebinpad(const BIGNUM *a, unsigned char *to, int tolen);
|
||||
int BN_signed_bn2lebin(const BIGNUM *a, unsigned char *to, int tolen);
|
||||
BIGNUM *BN_native2bn(const unsigned char *s, int len, BIGNUM *ret);
|
||||
BIGNUM *BN_signed_native2bn(const unsigned char *s, int len, BIGNUM *ret);
|
||||
int BN_bn2nativepad(const BIGNUM *a, unsigned char *to, int tolen);
|
||||
int BN_signed_bn2native(const BIGNUM *a, unsigned char *to, int tolen);
|
||||
BIGNUM *BN_mpi2bn(const unsigned char *s, int len, BIGNUM *ret);
|
||||
int BN_bn2mpi(const BIGNUM *a, unsigned char *to);
|
||||
int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
|
||||
int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
|
||||
int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
|
||||
int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
|
||||
int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
|
||||
int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx);
|
||||
/** BN_set_negative sets sign of a BIGNUM
|
||||
* \param b pointer to the BIGNUM object
|
||||
* \param n 0 if the BIGNUM b should be positive and a value != 0 otherwise
|
||||
*/
|
||||
void BN_set_negative(BIGNUM *b, int n);
|
||||
/** BN_is_negative returns 1 if the BIGNUM is negative
|
||||
* \param b pointer to the BIGNUM object
|
||||
* \return 1 if a < 0 and 0 otherwise
|
||||
*/
|
||||
int BN_is_negative(const BIGNUM *b);
|
||||
|
||||
int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d,
|
||||
BN_CTX *ctx);
|
||||
# define BN_mod(rem,m,d,ctx) BN_div(NULL,(rem),(m),(d),(ctx))
|
||||
int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx);
|
||||
int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
|
||||
BN_CTX *ctx);
|
||||
int BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||
const BIGNUM *m);
|
||||
int BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
|
||||
BN_CTX *ctx);
|
||||
int BN_mod_sub_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||
const BIGNUM *m);
|
||||
int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
|
||||
BN_CTX *ctx);
|
||||
int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);
|
||||
int BN_mod_lshift1(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);
|
||||
int BN_mod_lshift1_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *m);
|
||||
int BN_mod_lshift(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m,
|
||||
BN_CTX *ctx);
|
||||
int BN_mod_lshift_quick(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m);
|
||||
|
||||
BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w);
|
||||
BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w);
|
||||
int BN_mul_word(BIGNUM *a, BN_ULONG w);
|
||||
int BN_add_word(BIGNUM *a, BN_ULONG w);
|
||||
int BN_sub_word(BIGNUM *a, BN_ULONG w);
|
||||
int BN_set_word(BIGNUM *a, BN_ULONG w);
|
||||
BN_ULONG BN_get_word(const BIGNUM *a);
|
||||
|
||||
int BN_cmp(const BIGNUM *a, const BIGNUM *b);
|
||||
void BN_free(BIGNUM *a);
|
||||
int BN_is_bit_set(const BIGNUM *a, int n);
|
||||
int BN_lshift(BIGNUM *r, const BIGNUM *a, int n);
|
||||
int BN_lshift1(BIGNUM *r, const BIGNUM *a);
|
||||
int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
|
||||
|
||||
int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||
const BIGNUM *m, BN_CTX *ctx);
|
||||
int BN_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||
const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
|
||||
int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
|
||||
const BIGNUM *m, BN_CTX *ctx,
|
||||
BN_MONT_CTX *in_mont);
|
||||
int BN_mod_exp_mont_word(BIGNUM *r, BN_ULONG a, const BIGNUM *p,
|
||||
const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
|
||||
int BN_mod_exp2_mont(BIGNUM *r, const BIGNUM *a1, const BIGNUM *p1,
|
||||
const BIGNUM *a2, const BIGNUM *p2, const BIGNUM *m,
|
||||
BN_CTX *ctx, BN_MONT_CTX *m_ctx);
|
||||
int BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||
const BIGNUM *m, BN_CTX *ctx);
|
||||
int BN_mod_exp_mont_consttime_x2(BIGNUM *rr1, const BIGNUM *a1, const BIGNUM *p1,
|
||||
const BIGNUM *m1, BN_MONT_CTX *in_mont1,
|
||||
BIGNUM *rr2, const BIGNUM *a2, const BIGNUM *p2,
|
||||
const BIGNUM *m2, BN_MONT_CTX *in_mont2,
|
||||
BN_CTX *ctx);
|
||||
|
||||
int BN_mask_bits(BIGNUM *a, int n);
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
int BN_print_fp(FILE *fp, const BIGNUM *a);
|
||||
# endif
|
||||
int BN_print(BIO *bio, const BIGNUM *a);
|
||||
int BN_reciprocal(BIGNUM *r, const BIGNUM *m, int len, BN_CTX *ctx);
|
||||
int BN_rshift(BIGNUM *r, const BIGNUM *a, int n);
|
||||
int BN_rshift1(BIGNUM *r, const BIGNUM *a);
|
||||
void BN_clear(BIGNUM *a);
|
||||
BIGNUM *BN_dup(const BIGNUM *a);
|
||||
int BN_ucmp(const BIGNUM *a, const BIGNUM *b);
|
||||
int BN_set_bit(BIGNUM *a, int n);
|
||||
int BN_clear_bit(BIGNUM *a, int n);
|
||||
char *BN_bn2hex(const BIGNUM *a);
|
||||
char *BN_bn2dec(const BIGNUM *a);
|
||||
int BN_hex2bn(BIGNUM **a, const char *str);
|
||||
int BN_dec2bn(BIGNUM **a, const char *str);
|
||||
int BN_asc2bn(BIGNUM **a, const char *str);
|
||||
int BN_gcd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
|
||||
int BN_kronecker(const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); /* returns
|
||||
* -2 for
|
||||
* error */
|
||||
int BN_are_coprime(BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
|
||||
BIGNUM *BN_mod_inverse(BIGNUM *ret,
|
||||
const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx);
|
||||
BIGNUM *BN_mod_sqrt(BIGNUM *ret,
|
||||
const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx);
|
||||
|
||||
void BN_consttime_swap(BN_ULONG swap, BIGNUM *a, BIGNUM *b, int nwords);
|
||||
|
||||
/* Deprecated versions */
|
||||
# ifndef OPENSSL_NO_DEPRECATED_0_9_8
|
||||
OSSL_DEPRECATEDIN_0_9_8
|
||||
BIGNUM *BN_generate_prime(BIGNUM *ret, int bits, int safe,
|
||||
const BIGNUM *add, const BIGNUM *rem,
|
||||
void (*callback) (int, int, void *),
|
||||
void *cb_arg);
|
||||
OSSL_DEPRECATEDIN_0_9_8
|
||||
int BN_is_prime(const BIGNUM *p, int nchecks,
|
||||
void (*callback) (int, int, void *),
|
||||
BN_CTX *ctx, void *cb_arg);
|
||||
OSSL_DEPRECATEDIN_0_9_8
|
||||
int BN_is_prime_fasttest(const BIGNUM *p, int nchecks,
|
||||
void (*callback) (int, int, void *),
|
||||
BN_CTX *ctx, void *cb_arg,
|
||||
int do_trial_division);
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
OSSL_DEPRECATEDIN_3_0
|
||||
int BN_is_prime_ex(const BIGNUM *p, int nchecks, BN_CTX *ctx, BN_GENCB *cb);
|
||||
OSSL_DEPRECATEDIN_3_0
|
||||
int BN_is_prime_fasttest_ex(const BIGNUM *p, int nchecks, BN_CTX *ctx,
|
||||
int do_trial_division, BN_GENCB *cb);
|
||||
# endif
|
||||
/* Newer versions */
|
||||
int BN_generate_prime_ex2(BIGNUM *ret, int bits, int safe,
|
||||
const BIGNUM *add, const BIGNUM *rem, BN_GENCB *cb,
|
||||
BN_CTX *ctx);
|
||||
int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe, const BIGNUM *add,
|
||||
const BIGNUM *rem, BN_GENCB *cb);
|
||||
int BN_check_prime(const BIGNUM *p, BN_CTX *ctx, BN_GENCB *cb);
|
||||
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
OSSL_DEPRECATEDIN_3_0
|
||||
int BN_X931_generate_Xpq(BIGNUM *Xp, BIGNUM *Xq, int nbits, BN_CTX *ctx);
|
||||
|
||||
OSSL_DEPRECATEDIN_3_0
|
||||
int BN_X931_derive_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2,
|
||||
const BIGNUM *Xp, const BIGNUM *Xp1,
|
||||
const BIGNUM *Xp2, const BIGNUM *e, BN_CTX *ctx,
|
||||
BN_GENCB *cb);
|
||||
OSSL_DEPRECATEDIN_3_0
|
||||
int BN_X931_generate_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, BIGNUM *Xp1,
|
||||
BIGNUM *Xp2, const BIGNUM *Xp, const BIGNUM *e,
|
||||
BN_CTX *ctx, BN_GENCB *cb);
|
||||
# endif
|
||||
|
||||
BN_MONT_CTX *BN_MONT_CTX_new(void);
|
||||
int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||
BN_MONT_CTX *mont, BN_CTX *ctx);
|
||||
int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont,
|
||||
BN_CTX *ctx);
|
||||
int BN_from_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont,
|
||||
BN_CTX *ctx);
|
||||
void BN_MONT_CTX_free(BN_MONT_CTX *mont);
|
||||
int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx);
|
||||
BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from);
|
||||
BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, CRYPTO_RWLOCK *lock,
|
||||
const BIGNUM *mod, BN_CTX *ctx);
|
||||
|
||||
/* BN_BLINDING flags */
|
||||
# define BN_BLINDING_NO_UPDATE 0x00000001
|
||||
# define BN_BLINDING_NO_RECREATE 0x00000002
|
||||
|
||||
BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod);
|
||||
void BN_BLINDING_free(BN_BLINDING *b);
|
||||
int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx);
|
||||
int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);
|
||||
int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);
|
||||
int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *);
|
||||
int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b,
|
||||
BN_CTX *);
|
||||
|
||||
int BN_BLINDING_is_current_thread(BN_BLINDING *b);
|
||||
void BN_BLINDING_set_current_thread(BN_BLINDING *b);
|
||||
int BN_BLINDING_lock(BN_BLINDING *b);
|
||||
int BN_BLINDING_unlock(BN_BLINDING *b);
|
||||
|
||||
unsigned long BN_BLINDING_get_flags(const BN_BLINDING *);
|
||||
void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long);
|
||||
BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b,
|
||||
const BIGNUM *e, BIGNUM *m, BN_CTX *ctx,
|
||||
int (*bn_mod_exp) (BIGNUM *r,
|
||||
const BIGNUM *a,
|
||||
const BIGNUM *p,
|
||||
const BIGNUM *m,
|
||||
BN_CTX *ctx,
|
||||
BN_MONT_CTX *m_ctx),
|
||||
BN_MONT_CTX *m_ctx);
|
||||
# ifndef OPENSSL_NO_DEPRECATED_0_9_8
|
||||
OSSL_DEPRECATEDIN_0_9_8
|
||||
void BN_set_params(int mul, int high, int low, int mont);
|
||||
OSSL_DEPRECATEDIN_0_9_8
|
||||
int BN_get_params(int which); /* 0, mul, 1 high, 2 low, 3 mont */
|
||||
# endif
|
||||
|
||||
BN_RECP_CTX *BN_RECP_CTX_new(void);
|
||||
void BN_RECP_CTX_free(BN_RECP_CTX *recp);
|
||||
int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *rdiv, BN_CTX *ctx);
|
||||
int BN_mod_mul_reciprocal(BIGNUM *r, const BIGNUM *x, const BIGNUM *y,
|
||||
BN_RECP_CTX *recp, BN_CTX *ctx);
|
||||
int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||
const BIGNUM *m, BN_CTX *ctx);
|
||||
int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m,
|
||||
BN_RECP_CTX *recp, BN_CTX *ctx);
|
||||
|
||||
# ifndef OPENSSL_NO_EC2M
|
||||
|
||||
/*
|
||||
* Functions for arithmetic over binary polynomials represented by BIGNUMs.
|
||||
* The BIGNUM::neg property of BIGNUMs representing binary polynomials is
|
||||
* ignored. Note that input arguments are not const so that their bit arrays
|
||||
* can be expanded to the appropriate size if needed.
|
||||
*/
|
||||
|
||||
/*
|
||||
* r = a + b
|
||||
*/
|
||||
int BN_GF2m_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
|
||||
# define BN_GF2m_sub(r, a, b) BN_GF2m_add(r, a, b)
|
||||
/*
|
||||
* r=a mod p
|
||||
*/
|
||||
int BN_GF2m_mod(BIGNUM *r, const BIGNUM *a, const BIGNUM *p);
|
||||
/* r = (a * b) mod p */
|
||||
int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||
const BIGNUM *p, BN_CTX *ctx);
|
||||
/* r = (a * a) mod p */
|
||||
int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
|
||||
/* r = (1 / b) mod p */
|
||||
int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *b, const BIGNUM *p, BN_CTX *ctx);
|
||||
/* r = (a / b) mod p */
|
||||
int BN_GF2m_mod_div(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||
const BIGNUM *p, BN_CTX *ctx);
|
||||
/* r = (a ^ b) mod p */
|
||||
int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||
const BIGNUM *p, BN_CTX *ctx);
|
||||
/* r = sqrt(a) mod p */
|
||||
int BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||
BN_CTX *ctx);
|
||||
/* r^2 + r = a mod p */
|
||||
int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||
BN_CTX *ctx);
|
||||
# define BN_GF2m_cmp(a, b) BN_ucmp((a), (b))
|
||||
/*-
|
||||
* Some functions allow for representation of the irreducible polynomials
|
||||
* as an unsigned int[], say p. The irreducible f(t) is then of the form:
|
||||
* t^p[0] + t^p[1] + ... + t^p[k]
|
||||
* where m = p[0] > p[1] > ... > p[k] = 0.
|
||||
*/
|
||||
/* r = a mod p */
|
||||
int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const int p[]);
|
||||
/* r = (a * b) mod p */
|
||||
int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||
const int p[], BN_CTX *ctx);
|
||||
/* r = (a * a) mod p */
|
||||
int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const int p[],
|
||||
BN_CTX *ctx);
|
||||
/* r = (1 / b) mod p */
|
||||
int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *b, const int p[],
|
||||
BN_CTX *ctx);
|
||||
/* r = (a / b) mod p */
|
||||
int BN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||
const int p[], BN_CTX *ctx);
|
||||
/* r = (a ^ b) mod p */
|
||||
int BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||
const int p[], BN_CTX *ctx);
|
||||
/* r = sqrt(a) mod p */
|
||||
int BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a,
|
||||
const int p[], BN_CTX *ctx);
|
||||
/* r^2 + r = a mod p */
|
||||
int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a,
|
||||
const int p[], BN_CTX *ctx);
|
||||
int BN_GF2m_poly2arr(const BIGNUM *a, int p[], int max);
|
||||
int BN_GF2m_arr2poly(const int p[], BIGNUM *a);
|
||||
|
||||
# endif
|
||||
|
||||
/*
|
||||
* faster mod functions for the 'NIST primes' 0 <= a < p^2
|
||||
*/
|
||||
int BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
|
||||
int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
|
||||
int BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
|
||||
int BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
|
||||
int BN_nist_mod_521(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
|
||||
|
||||
const BIGNUM *BN_get0_nist_prime_192(void);
|
||||
const BIGNUM *BN_get0_nist_prime_224(void);
|
||||
const BIGNUM *BN_get0_nist_prime_256(void);
|
||||
const BIGNUM *BN_get0_nist_prime_384(void);
|
||||
const BIGNUM *BN_get0_nist_prime_521(void);
|
||||
|
||||
int (*BN_nist_mod_func(const BIGNUM *p)) (BIGNUM *r, const BIGNUM *a,
|
||||
const BIGNUM *field, BN_CTX *ctx);
|
||||
|
||||
int BN_generate_dsa_nonce(BIGNUM *out, const BIGNUM *range,
|
||||
const BIGNUM *priv, const unsigned char *message,
|
||||
size_t message_len, BN_CTX *ctx);
|
||||
|
||||
/* Primes from RFC 2409 */
|
||||
BIGNUM *BN_get_rfc2409_prime_768(BIGNUM *bn);
|
||||
BIGNUM *BN_get_rfc2409_prime_1024(BIGNUM *bn);
|
||||
|
||||
/* Primes from RFC 3526 */
|
||||
BIGNUM *BN_get_rfc3526_prime_1536(BIGNUM *bn);
|
||||
BIGNUM *BN_get_rfc3526_prime_2048(BIGNUM *bn);
|
||||
BIGNUM *BN_get_rfc3526_prime_3072(BIGNUM *bn);
|
||||
BIGNUM *BN_get_rfc3526_prime_4096(BIGNUM *bn);
|
||||
BIGNUM *BN_get_rfc3526_prime_6144(BIGNUM *bn);
|
||||
BIGNUM *BN_get_rfc3526_prime_8192(BIGNUM *bn);
|
||||
|
||||
# ifndef OPENSSL_NO_DEPRECATED_1_1_0
|
||||
# define get_rfc2409_prime_768 BN_get_rfc2409_prime_768
|
||||
# define get_rfc2409_prime_1024 BN_get_rfc2409_prime_1024
|
||||
# define get_rfc3526_prime_1536 BN_get_rfc3526_prime_1536
|
||||
# define get_rfc3526_prime_2048 BN_get_rfc3526_prime_2048
|
||||
# define get_rfc3526_prime_3072 BN_get_rfc3526_prime_3072
|
||||
# define get_rfc3526_prime_4096 BN_get_rfc3526_prime_4096
|
||||
# define get_rfc3526_prime_6144 BN_get_rfc3526_prime_6144
|
||||
# define get_rfc3526_prime_8192 BN_get_rfc3526_prime_8192
|
||||
# endif
|
||||
|
||||
int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom);
|
||||
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
47
thirdparty/OpenSSL-3.5.3/include/openssl/bnerr.h
vendored
Normal file
47
thirdparty/OpenSSL-3.5.3/include/openssl/bnerr.h
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef OPENSSL_BNERR_H
|
||||
# define OPENSSL_BNERR_H
|
||||
# pragma once
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
# include <openssl/symhacks.h>
|
||||
# include <openssl/cryptoerr_legacy.h>
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* BN reason codes.
|
||||
*/
|
||||
# define BN_R_ARG2_LT_ARG3 100
|
||||
# define BN_R_BAD_RECIPROCAL 101
|
||||
# define BN_R_BIGNUM_TOO_LONG 114
|
||||
# define BN_R_BITS_TOO_SMALL 118
|
||||
# define BN_R_CALLED_WITH_EVEN_MODULUS 102
|
||||
# define BN_R_DIV_BY_ZERO 103
|
||||
# define BN_R_ENCODING_ERROR 104
|
||||
# define BN_R_EXPAND_ON_STATIC_BIGNUM_DATA 105
|
||||
# define BN_R_INPUT_NOT_REDUCED 110
|
||||
# define BN_R_INVALID_LENGTH 106
|
||||
# define BN_R_INVALID_RANGE 115
|
||||
# define BN_R_INVALID_SHIFT 119
|
||||
# define BN_R_NOT_A_SQUARE 111
|
||||
# define BN_R_NOT_INITIALIZED 107
|
||||
# define BN_R_NO_INVERSE 108
|
||||
# define BN_R_NO_PRIME_CANDIDATE 121
|
||||
# define BN_R_NO_SOLUTION 116
|
||||
# define BN_R_NO_SUITABLE_DIGEST 120
|
||||
# define BN_R_PRIVATE_KEY_TOO_LARGE 117
|
||||
# define BN_R_P_IS_NOT_PRIME 112
|
||||
# define BN_R_TOO_MANY_ITERATIONS 113
|
||||
# define BN_R_TOO_MANY_TEMPORARY_VARIABLES 109
|
||||
|
||||
#endif
|
||||
62
thirdparty/OpenSSL-3.5.3/include/openssl/buffer.h
vendored
Normal file
62
thirdparty/OpenSSL-3.5.3/include/openssl/buffer.h
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef OPENSSL_BUFFER_H
|
||||
# define OPENSSL_BUFFER_H
|
||||
# pragma once
|
||||
|
||||
# include <openssl/macros.h>
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
# define HEADER_BUFFER_H
|
||||
# endif
|
||||
|
||||
# include <openssl/types.h>
|
||||
# ifndef OPENSSL_CRYPTO_H
|
||||
# include <openssl/crypto.h>
|
||||
# endif
|
||||
# include <openssl/buffererr.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
# include <stddef.h>
|
||||
# include <sys/types.h>
|
||||
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
# define BUF_strdup(s) OPENSSL_strdup(s)
|
||||
# define BUF_strndup(s, size) OPENSSL_strndup(s, size)
|
||||
# define BUF_memdup(data, size) OPENSSL_memdup(data, size)
|
||||
# define BUF_strlcpy(dst, src, size) OPENSSL_strlcpy(dst, src, size)
|
||||
# define BUF_strlcat(dst, src, size) OPENSSL_strlcat(dst, src, size)
|
||||
# define BUF_strnlen(str, maxlen) OPENSSL_strnlen(str, maxlen)
|
||||
# endif
|
||||
|
||||
struct buf_mem_st {
|
||||
size_t length; /* current number of bytes */
|
||||
char *data;
|
||||
size_t max; /* size of buffer */
|
||||
unsigned long flags;
|
||||
};
|
||||
|
||||
# define BUF_MEM_FLAG_SECURE 0x01
|
||||
|
||||
BUF_MEM *BUF_MEM_new(void);
|
||||
BUF_MEM *BUF_MEM_new_ex(unsigned long flags);
|
||||
void BUF_MEM_free(BUF_MEM *a);
|
||||
size_t BUF_MEM_grow(BUF_MEM *str, size_t len);
|
||||
size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len);
|
||||
void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz);
|
||||
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
25
thirdparty/OpenSSL-3.5.3/include/openssl/buffererr.h
vendored
Normal file
25
thirdparty/OpenSSL-3.5.3/include/openssl/buffererr.h
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef OPENSSL_BUFFERERR_H
|
||||
# define OPENSSL_BUFFERERR_H
|
||||
# pragma once
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
# include <openssl/symhacks.h>
|
||||
# include <openssl/cryptoerr_legacy.h>
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* BUF reason codes.
|
||||
*/
|
||||
|
||||
#endif
|
||||
339
thirdparty/OpenSSL-3.5.3/include/openssl/byteorder.h
vendored
Normal file
339
thirdparty/OpenSSL-3.5.3/include/openssl/byteorder.h
vendored
Normal file
@@ -0,0 +1,339 @@
|
||||
/*
|
||||
* Copyright 2025 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef OPENSSL_BYTEORDER_H
|
||||
# define OPENSSL_BYTEORDER_H
|
||||
# pragma once
|
||||
|
||||
# include <openssl/e_os2.h>
|
||||
# include <string.h>
|
||||
|
||||
/*
|
||||
* "Modern" compilers do a decent job of optimising these functions to just a
|
||||
* couple of instruction ([swap +] store, or load [+ swap]) when either no
|
||||
* swapping is required, or a suitable swap instruction is available.
|
||||
*/
|
||||
|
||||
# if defined(_MSC_VER) && _MSC_VER>=1300
|
||||
# include <stdlib.h>
|
||||
# pragma intrinsic(_byteswap_ushort)
|
||||
# pragma intrinsic(_byteswap_ulong)
|
||||
# pragma intrinsic(_byteswap_uint64)
|
||||
# define OSSL_HTOBE16(x) _byteswap_ushort(x)
|
||||
# define OSSL_HTOBE32(x) _byteswap_ulong(x)
|
||||
# define OSSL_HTOBE64(x) _byteswap_uint64(x)
|
||||
# define OSSL_BE16TOH(x) _byteswap_ushort(x)
|
||||
# define OSSL_BE32TOH(x) _byteswap_ulong(x)
|
||||
# define OSSL_BE64TOH(x) _byteswap_uint64(x)
|
||||
# define OSSL_HTOLE16(x) (x)
|
||||
# define OSSL_HTOLE32(x) (x)
|
||||
# define OSSL_HTOLE64(x) (x)
|
||||
# define OSSL_LE16TOH(x) (x)
|
||||
# define OSSL_LE32TOH(x) (x)
|
||||
# define OSSL_LE64TOH(x) (x)
|
||||
|
||||
# elif defined(__GLIBC__) && defined(__GLIBC_PREREQ)
|
||||
# if (__GLIBC_PREREQ(2, 19)) && defined(_DEFAULT_SOURCE)
|
||||
# include <endian.h>
|
||||
# define OSSL_HTOBE16(x) htobe16(x)
|
||||
# define OSSL_HTOBE32(x) htobe32(x)
|
||||
# define OSSL_HTOBE64(x) htobe64(x)
|
||||
# define OSSL_BE16TOH(x) be16toh(x)
|
||||
# define OSSL_BE32TOH(x) be32toh(x)
|
||||
# define OSSL_BE64TOH(x) be64toh(x)
|
||||
# define OSSL_HTOLE16(x) htole16(x)
|
||||
# define OSSL_HTOLE32(x) htole32(x)
|
||||
# define OSSL_HTOLE64(x) htole64(x)
|
||||
# define OSSL_LE16TOH(x) le16toh(x)
|
||||
# define OSSL_LE32TOH(x) le32toh(x)
|
||||
# define OSSL_LE64TOH(x) le64toh(x)
|
||||
# endif
|
||||
|
||||
# elif defined(__FreeBSD__) || defined(__NetBSD__) || defined (__OpenBSD__)
|
||||
# if defined(__OpenBSD__)
|
||||
# include <sys/types.h>
|
||||
# else
|
||||
# include <sys/endian.h>
|
||||
# endif
|
||||
# define OSSL_HTOBE16(x) htobe16(x)
|
||||
# define OSSL_HTOBE32(x) htobe32(x)
|
||||
# define OSSL_HTOBE64(x) htobe64(x)
|
||||
# define OSSL_BE16TOH(x) be16toh(x)
|
||||
# define OSSL_BE32TOH(x) be32toh(x)
|
||||
# define OSSL_BE64TOH(x) be64toh(x)
|
||||
# define OSSL_HTOLE16(x) htole16(x)
|
||||
# define OSSL_HTOLE32(x) htole32(x)
|
||||
# define OSSL_HTOLE64(x) htole64(x)
|
||||
# define OSSL_LE16TOH(x) le16toh(x)
|
||||
# define OSSL_LE32TOH(x) le32toh(x)
|
||||
# define OSSL_LE64TOH(x) le64toh(x)
|
||||
|
||||
# elif defined(__APPLE__)
|
||||
# include <libkern/OSByteOrder.h>
|
||||
# define OSSL_HTOBE16(x) OSSwapHostToBigInt16(x)
|
||||
# define OSSL_HTOBE32(x) OSSwapHostToBigInt32(x)
|
||||
# define OSSL_HTOBE64(x) OSSwapHostToBigInt64(x)
|
||||
# define OSSL_BE16TOH(x) OSSwapBigToHostInt16(x)
|
||||
# define OSSL_BE32TOH(x) OSSwapBigToHostInt32(x)
|
||||
# define OSSL_BE64TOH(x) OSSwapBigToHostInt64(x)
|
||||
# define OSSL_HTOLE16(x) OSSwapHostToLittleInt16(x)
|
||||
# define OSSL_HTOLE32(x) OSSwapHostToLittleInt32(x)
|
||||
# define OSSL_HTOLE64(x) OSSwapHostToLittleInt64(x)
|
||||
# define OSSL_LE16TOH(x) OSSwapLittleToHostInt16(x)
|
||||
# define OSSL_LE32TOH(x) OSSwapLittleToHostInt32(x)
|
||||
# define OSSL_LE64TOH(x) OSSwapLittleToHostInt64(x)
|
||||
|
||||
# endif
|
||||
|
||||
static ossl_inline ossl_unused unsigned char *
|
||||
OPENSSL_store_u16_le(unsigned char *out, uint16_t val)
|
||||
{
|
||||
# ifdef OSSL_HTOLE16
|
||||
uint16_t t = OSSL_HTOLE16(val);
|
||||
|
||||
memcpy(out, (unsigned char *)&t, 2);
|
||||
return out + 2;
|
||||
# else
|
||||
*out++ = (val & 0xff);
|
||||
*out++ = (val >> 8) & 0xff;
|
||||
return out;
|
||||
# endif
|
||||
}
|
||||
|
||||
static ossl_inline ossl_unused unsigned char *
|
||||
OPENSSL_store_u16_be(unsigned char *out, uint16_t val)
|
||||
{
|
||||
# ifdef OSSL_HTOBE16
|
||||
uint16_t t = OSSL_HTOBE16(val);
|
||||
|
||||
memcpy(out, (unsigned char *)&t, 2);
|
||||
return out + 2;
|
||||
# else
|
||||
*out++ = (val >> 8) & 0xff;
|
||||
*out++ = (val & 0xff);
|
||||
return out;
|
||||
# endif
|
||||
}
|
||||
|
||||
static ossl_inline ossl_unused unsigned char *
|
||||
OPENSSL_store_u32_le(unsigned char *out, uint32_t val)
|
||||
{
|
||||
# ifdef OSSL_HTOLE32
|
||||
uint32_t t = OSSL_HTOLE32(val);
|
||||
|
||||
memcpy(out, (unsigned char *)&t, 4);
|
||||
return out + 4;
|
||||
# else
|
||||
*out++ = (val & 0xff);
|
||||
*out++ = (val >> 8) & 0xff;
|
||||
*out++ = (val >> 16) & 0xff;
|
||||
*out++ = (val >> 24) & 0xff;
|
||||
return out;
|
||||
# endif
|
||||
}
|
||||
|
||||
static ossl_inline ossl_unused unsigned char *
|
||||
OPENSSL_store_u32_be(unsigned char *out, uint32_t val)
|
||||
{
|
||||
# ifdef OSSL_HTOBE32
|
||||
uint32_t t = OSSL_HTOBE32(val);
|
||||
|
||||
memcpy(out, (unsigned char *)&t, 4);
|
||||
return out + 4;
|
||||
# else
|
||||
*out++ = (val >> 24) & 0xff;
|
||||
*out++ = (val >> 16) & 0xff;
|
||||
*out++ = (val >> 8) & 0xff;
|
||||
*out++ = (val & 0xff);
|
||||
return out;
|
||||
# endif
|
||||
}
|
||||
|
||||
static ossl_inline ossl_unused unsigned char *
|
||||
OPENSSL_store_u64_le(unsigned char *out, uint64_t val)
|
||||
{
|
||||
# ifdef OSSL_HTOLE64
|
||||
uint64_t t = OSSL_HTOLE64(val);
|
||||
|
||||
memcpy(out, (unsigned char *)&t, 8);
|
||||
return out + 8;
|
||||
# else
|
||||
*out++ = (val & 0xff);
|
||||
*out++ = (val >> 8) & 0xff;
|
||||
*out++ = (val >> 16) & 0xff;
|
||||
*out++ = (val >> 24) & 0xff;
|
||||
*out++ = (val >> 32) & 0xff;
|
||||
*out++ = (val >> 40) & 0xff;
|
||||
*out++ = (val >> 48) & 0xff;
|
||||
*out++ = (val >> 56) & 0xff;
|
||||
return out;
|
||||
# endif
|
||||
}
|
||||
|
||||
static ossl_inline ossl_unused unsigned char *
|
||||
OPENSSL_store_u64_be(unsigned char *out, uint64_t val)
|
||||
{
|
||||
# ifdef OSSL_HTOLE64
|
||||
uint64_t t = OSSL_HTOBE64(val);
|
||||
|
||||
memcpy(out, (unsigned char *)&t, 8);
|
||||
return out + 8;
|
||||
# else
|
||||
*out++ = (val >> 56) & 0xff;
|
||||
*out++ = (val >> 48) & 0xff;
|
||||
*out++ = (val >> 40) & 0xff;
|
||||
*out++ = (val >> 32) & 0xff;
|
||||
*out++ = (val >> 24) & 0xff;
|
||||
*out++ = (val >> 16) & 0xff;
|
||||
*out++ = (val >> 8) & 0xff;
|
||||
*out++ = (val & 0xff);
|
||||
return out;
|
||||
# endif
|
||||
}
|
||||
|
||||
static ossl_inline ossl_unused const unsigned char *
|
||||
OPENSSL_load_u16_le(uint16_t *val, const unsigned char *in)
|
||||
{
|
||||
# ifdef OSSL_LE16TOH
|
||||
uint16_t t;
|
||||
|
||||
memcpy((unsigned char *)&t, in, 2);
|
||||
*val = OSSL_LE16TOH(t);
|
||||
return in + 2;
|
||||
# else
|
||||
uint16_t b0 = *in++;
|
||||
uint16_t b1 = *in++;
|
||||
|
||||
*val = b0 | (b1 << 8);
|
||||
return in;
|
||||
#endif
|
||||
}
|
||||
|
||||
static ossl_inline ossl_unused const unsigned char *
|
||||
OPENSSL_load_u16_be(uint16_t *val, const unsigned char *in)
|
||||
{
|
||||
# ifdef OSSL_LE16TOH
|
||||
uint16_t t;
|
||||
|
||||
memcpy((unsigned char *)&t, in, 2);
|
||||
*val = OSSL_BE16TOH(t);
|
||||
return in + 2;
|
||||
# else
|
||||
uint16_t b1 = *in++;
|
||||
uint16_t b0 = *in++;
|
||||
|
||||
*val = b0 | (b1 << 8);
|
||||
return in;
|
||||
#endif
|
||||
}
|
||||
|
||||
static ossl_inline ossl_unused const unsigned char *
|
||||
OPENSSL_load_u32_le(uint32_t *val, const unsigned char *in)
|
||||
{
|
||||
# ifdef OSSL_LE32TOH
|
||||
uint32_t t;
|
||||
|
||||
memcpy((unsigned char *)&t, in, 4);
|
||||
*val = OSSL_LE32TOH(t);
|
||||
return in + 4;
|
||||
# else
|
||||
uint32_t b0 = *in++;
|
||||
uint32_t b1 = *in++;
|
||||
uint32_t b2 = *in++;
|
||||
uint32_t b3 = *in++;
|
||||
|
||||
*val = b0 | (b1 << 8) | (b2 << 16) | (b3 << 24);
|
||||
return in;
|
||||
#endif
|
||||
}
|
||||
|
||||
static ossl_inline ossl_unused const unsigned char *
|
||||
OPENSSL_load_u32_be(uint32_t *val, const unsigned char *in)
|
||||
{
|
||||
# ifdef OSSL_LE32TOH
|
||||
uint32_t t;
|
||||
|
||||
memcpy((unsigned char *)&t, in, 4);
|
||||
*val = OSSL_BE32TOH(t);
|
||||
return in + 4;
|
||||
# else
|
||||
uint32_t b3 = *in++;
|
||||
uint32_t b2 = *in++;
|
||||
uint32_t b1 = *in++;
|
||||
uint32_t b0 = *in++;
|
||||
|
||||
*val = b0 | (b1 << 8) | (b2 << 16) | (b3 << 24);
|
||||
return in;
|
||||
#endif
|
||||
}
|
||||
|
||||
static ossl_inline ossl_unused const unsigned char *
|
||||
OPENSSL_load_u64_le(uint64_t *val, const unsigned char *in)
|
||||
{
|
||||
# ifdef OSSL_LE64TOH
|
||||
uint64_t t;
|
||||
|
||||
memcpy((unsigned char *)&t, in, 8);
|
||||
*val = OSSL_LE64TOH(t);
|
||||
return in + 8;
|
||||
# else
|
||||
uint64_t b0 = *in++;
|
||||
uint64_t b1 = *in++;
|
||||
uint64_t b2 = *in++;
|
||||
uint64_t b3 = *in++;
|
||||
uint64_t b4 = *in++;
|
||||
uint64_t b5 = *in++;
|
||||
uint64_t b6 = *in++;
|
||||
uint64_t b7 = *in++;
|
||||
|
||||
*val = b0 | (b1 << 8) | (b2 << 16) | (b3 << 24)
|
||||
| (b4 << 32) | (b5 << 40) | (b6 << 48) | (b7 << 56);
|
||||
return in;
|
||||
#endif
|
||||
}
|
||||
|
||||
static ossl_inline ossl_unused const unsigned char *
|
||||
OPENSSL_load_u64_be(uint64_t *val, const unsigned char *in)
|
||||
{
|
||||
# ifdef OSSL_LE64TOH
|
||||
uint64_t t;
|
||||
|
||||
memcpy((unsigned char *)&t, in, 8);
|
||||
*val = OSSL_BE64TOH(t);
|
||||
return in + 8;
|
||||
# else
|
||||
uint64_t b7 = *in++;
|
||||
uint64_t b6 = *in++;
|
||||
uint64_t b5 = *in++;
|
||||
uint64_t b4 = *in++;
|
||||
uint64_t b3 = *in++;
|
||||
uint64_t b2 = *in++;
|
||||
uint64_t b1 = *in++;
|
||||
uint64_t b0 = *in++;
|
||||
|
||||
*val = b0 | (b1 << 8) | (b2 << 16) | (b3 << 24)
|
||||
| (b4 << 32) | (b5 << 40) | (b6 << 48) | (b7 << 56);
|
||||
return in;
|
||||
#endif
|
||||
}
|
||||
|
||||
# undef OSSL_HTOBE16
|
||||
# undef OSSL_HTOBE32
|
||||
# undef OSSL_HTOBE64
|
||||
# undef OSSL_BE16TOH
|
||||
# undef OSSL_BE32TOH
|
||||
# undef OSSL_BE64TOH
|
||||
# undef OSSL_HTOLE16
|
||||
# undef OSSL_HTOLE32
|
||||
# undef OSSL_HTOLE64
|
||||
# undef OSSL_LE16TOH
|
||||
# undef OSSL_LE32TOH
|
||||
# undef OSSL_LE64TOH
|
||||
|
||||
#endif
|
||||
117
thirdparty/OpenSSL-3.5.3/include/openssl/camellia.h
vendored
Normal file
117
thirdparty/OpenSSL-3.5.3/include/openssl/camellia.h
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Copyright 2006-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef OPENSSL_CAMELLIA_H
|
||||
# define OPENSSL_CAMELLIA_H
|
||||
# pragma once
|
||||
|
||||
# include <openssl/macros.h>
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
# define HEADER_CAMELLIA_H
|
||||
# endif
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_CAMELLIA
|
||||
# include <stddef.h>
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
# define CAMELLIA_BLOCK_SIZE 16
|
||||
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
|
||||
# define CAMELLIA_ENCRYPT 1
|
||||
# define CAMELLIA_DECRYPT 0
|
||||
|
||||
/*
|
||||
* Because array size can't be a const in C, the following two are macros.
|
||||
* Both sizes are in bytes.
|
||||
*/
|
||||
|
||||
/* This should be a hidden type, but EVP requires that the size be known */
|
||||
|
||||
# define CAMELLIA_TABLE_BYTE_LEN 272
|
||||
# define CAMELLIA_TABLE_WORD_LEN (CAMELLIA_TABLE_BYTE_LEN / 4)
|
||||
|
||||
typedef unsigned int KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN]; /* to match
|
||||
* with WORD */
|
||||
|
||||
struct camellia_key_st {
|
||||
union {
|
||||
double d; /* ensures 64-bit align */
|
||||
KEY_TABLE_TYPE rd_key;
|
||||
} u;
|
||||
int grand_rounds;
|
||||
};
|
||||
typedef struct camellia_key_st CAMELLIA_KEY;
|
||||
|
||||
# endif /* OPENSSL_NO_DEPRECATED_3_0 */
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
OSSL_DEPRECATEDIN_3_0 int Camellia_set_key(const unsigned char *userKey,
|
||||
const int bits,
|
||||
CAMELLIA_KEY *key);
|
||||
OSSL_DEPRECATEDIN_3_0 void Camellia_encrypt(const unsigned char *in,
|
||||
unsigned char *out,
|
||||
const CAMELLIA_KEY *key);
|
||||
OSSL_DEPRECATEDIN_3_0 void Camellia_decrypt(const unsigned char *in,
|
||||
unsigned char *out,
|
||||
const CAMELLIA_KEY *key);
|
||||
OSSL_DEPRECATEDIN_3_0 void Camellia_ecb_encrypt(const unsigned char *in,
|
||||
unsigned char *out,
|
||||
const CAMELLIA_KEY *key,
|
||||
const int enc);
|
||||
OSSL_DEPRECATEDIN_3_0 void Camellia_cbc_encrypt(const unsigned char *in,
|
||||
unsigned char *out,
|
||||
size_t length,
|
||||
const CAMELLIA_KEY *key,
|
||||
unsigned char *ivec,
|
||||
const int enc);
|
||||
OSSL_DEPRECATEDIN_3_0 void Camellia_cfb128_encrypt(const unsigned char *in,
|
||||
unsigned char *out,
|
||||
size_t length,
|
||||
const CAMELLIA_KEY *key,
|
||||
unsigned char *ivec,
|
||||
int *num,
|
||||
const int enc);
|
||||
OSSL_DEPRECATEDIN_3_0 void Camellia_cfb1_encrypt(const unsigned char *in,
|
||||
unsigned char *out,
|
||||
size_t length,
|
||||
const CAMELLIA_KEY *key,
|
||||
unsigned char *ivec,
|
||||
int *num,
|
||||
const int enc);
|
||||
OSSL_DEPRECATEDIN_3_0 void Camellia_cfb8_encrypt(const unsigned char *in,
|
||||
unsigned char *out,
|
||||
size_t length,
|
||||
const CAMELLIA_KEY *key,
|
||||
unsigned char *ivec,
|
||||
int *num,
|
||||
const int enc);
|
||||
OSSL_DEPRECATEDIN_3_0 void Camellia_ofb128_encrypt(const unsigned char *in,
|
||||
unsigned char *out,
|
||||
size_t length,
|
||||
const CAMELLIA_KEY *key,
|
||||
unsigned char *ivec,
|
||||
int *num);
|
||||
OSSL_DEPRECATEDIN_3_0
|
||||
void Camellia_ctr128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const CAMELLIA_KEY *key,
|
||||
unsigned char ivec[CAMELLIA_BLOCK_SIZE],
|
||||
unsigned char ecount_buf[CAMELLIA_BLOCK_SIZE],
|
||||
unsigned int *num);
|
||||
# endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
71
thirdparty/OpenSSL-3.5.3/include/openssl/cast.h
vendored
Normal file
71
thirdparty/OpenSSL-3.5.3/include/openssl/cast.h
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef OPENSSL_CAST_H
|
||||
# define OPENSSL_CAST_H
|
||||
# pragma once
|
||||
|
||||
# include <openssl/macros.h>
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
# define HEADER_CAST_H
|
||||
# endif
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_CAST
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
# define CAST_BLOCK 8
|
||||
# define CAST_KEY_LENGTH 16
|
||||
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
|
||||
# define CAST_ENCRYPT 1
|
||||
# define CAST_DECRYPT 0
|
||||
|
||||
# define CAST_LONG unsigned int
|
||||
|
||||
typedef struct cast_key_st {
|
||||
CAST_LONG data[32];
|
||||
int short_key; /* Use reduced rounds for short key */
|
||||
} CAST_KEY;
|
||||
|
||||
# endif /* OPENSSL_NO_DEPRECATED_3_0 */
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
OSSL_DEPRECATEDIN_3_0
|
||||
void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data);
|
||||
OSSL_DEPRECATEDIN_3_0
|
||||
void CAST_ecb_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const CAST_KEY *key, int enc);
|
||||
OSSL_DEPRECATEDIN_3_0
|
||||
void CAST_encrypt(CAST_LONG *data, const CAST_KEY *key);
|
||||
OSSL_DEPRECATEDIN_3_0
|
||||
void CAST_decrypt(CAST_LONG *data, const CAST_KEY *key);
|
||||
OSSL_DEPRECATEDIN_3_0
|
||||
void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length, const CAST_KEY *ks, unsigned char *iv,
|
||||
int enc);
|
||||
OSSL_DEPRECATEDIN_3_0
|
||||
void CAST_cfb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length, const CAST_KEY *schedule,
|
||||
unsigned char *ivec, int *num, int enc);
|
||||
OSSL_DEPRECATEDIN_3_0
|
||||
void CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length, const CAST_KEY *schedule,
|
||||
unsigned char *ivec, int *num);
|
||||
# endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
52
thirdparty/OpenSSL-3.5.3/include/openssl/cmac.h
vendored
Normal file
52
thirdparty/OpenSSL-3.5.3/include/openssl/cmac.h
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright 2010-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef OPENSSL_CMAC_H
|
||||
# define OPENSSL_CMAC_H
|
||||
# pragma once
|
||||
|
||||
# include <openssl/macros.h>
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
# define HEADER_CMAC_H
|
||||
# endif
|
||||
|
||||
# ifndef OPENSSL_NO_CMAC
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
# include <openssl/evp.h>
|
||||
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
/* Opaque */
|
||||
typedef struct CMAC_CTX_st CMAC_CTX;
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
OSSL_DEPRECATEDIN_3_0 CMAC_CTX *CMAC_CTX_new(void);
|
||||
OSSL_DEPRECATEDIN_3_0 void CMAC_CTX_cleanup(CMAC_CTX *ctx);
|
||||
OSSL_DEPRECATEDIN_3_0 void CMAC_CTX_free(CMAC_CTX *ctx);
|
||||
OSSL_DEPRECATEDIN_3_0 EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx);
|
||||
OSSL_DEPRECATEDIN_3_0 int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in);
|
||||
OSSL_DEPRECATEDIN_3_0 int CMAC_Init(CMAC_CTX *ctx,
|
||||
const void *key, size_t keylen,
|
||||
const EVP_CIPHER *cipher, ENGINE *impl);
|
||||
OSSL_DEPRECATEDIN_3_0 int CMAC_Update(CMAC_CTX *ctx,
|
||||
const void *data, size_t dlen);
|
||||
OSSL_DEPRECATEDIN_3_0 int CMAC_Final(CMAC_CTX *ctx,
|
||||
unsigned char *out, size_t *poutlen);
|
||||
OSSL_DEPRECATEDIN_3_0 int CMAC_resume(CMAC_CTX *ctx);
|
||||
# endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
|
||||
# endif
|
||||
#endif
|
||||
727
thirdparty/OpenSSL-3.5.3/include/openssl/cmp.h
vendored
Normal file
727
thirdparty/OpenSSL-3.5.3/include/openssl/cmp.h
vendored
Normal file
@@ -0,0 +1,727 @@
|
||||
/*
|
||||
* WARNING: do not edit!
|
||||
* Generated by makefile from include\openssl\cmp.h.in
|
||||
*
|
||||
* Copyright 2007-2024 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright Nokia 2007-2019
|
||||
* Copyright Siemens AG 2015-2019
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef OPENSSL_CMP_H
|
||||
# define OPENSSL_CMP_H
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
# ifndef OPENSSL_NO_CMP
|
||||
|
||||
# include <openssl/crmf.h>
|
||||
# include <openssl/cmperr.h>
|
||||
# include <openssl/cmp_util.h>
|
||||
# include <openssl/http.h>
|
||||
|
||||
/* explicit #includes not strictly needed since implied by the above: */
|
||||
# include <openssl/types.h>
|
||||
# include <openssl/safestack.h>
|
||||
# include <openssl/x509.h>
|
||||
# include <openssl/x509v3.h>
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
# define OSSL_CMP_PVNO_2 2
|
||||
# define OSSL_CMP_PVNO_3 3
|
||||
# define OSSL_CMP_PVNO OSSL_CMP_PVNO_2 /* v2 is the default */
|
||||
|
||||
/*-
|
||||
* PKIFailureInfo ::= BIT STRING {
|
||||
* -- since we can fail in more than one way!
|
||||
* -- More codes may be added in the future if/when required.
|
||||
* badAlg (0),
|
||||
* -- unrecognized or unsupported Algorithm Identifier
|
||||
* badMessageCheck (1),
|
||||
* -- integrity check failed (e.g., signature did not verify)
|
||||
* badRequest (2),
|
||||
* -- transaction not permitted or supported
|
||||
* badTime (3),
|
||||
* -- messageTime was not sufficiently close to the system time,
|
||||
* -- as defined by local policy
|
||||
* badCertId (4),
|
||||
* -- no certificate could be found matching the provided criteria
|
||||
* badDataFormat (5),
|
||||
* -- the data submitted has the wrong format
|
||||
* wrongAuthority (6),
|
||||
* -- the authority indicated in the request is different from the
|
||||
* -- one creating the response token
|
||||
* incorrectData (7),
|
||||
* -- the requester's data is incorrect (for notary services)
|
||||
* missingTimeStamp (8),
|
||||
* -- when the timestamp is missing but should be there
|
||||
* -- (by policy)
|
||||
* badPOP (9),
|
||||
* -- the proof-of-possession failed
|
||||
* certRevoked (10),
|
||||
* -- the certificate has already been revoked
|
||||
* certConfirmed (11),
|
||||
* -- the certificate has already been confirmed
|
||||
* wrongIntegrity (12),
|
||||
* -- invalid integrity, password based instead of signature or
|
||||
* -- vice versa
|
||||
* badRecipientNonce (13),
|
||||
* -- invalid recipient nonce, either missing or wrong value
|
||||
* timeNotAvailable (14),
|
||||
* -- the TSA's time source is not available
|
||||
* unacceptedPolicy (15),
|
||||
* -- the requested TSA policy is not supported by the TSA.
|
||||
* unacceptedExtension (16),
|
||||
* -- the requested extension is not supported by the TSA.
|
||||
* addInfoNotAvailable (17),
|
||||
* -- the additional information requested could not be
|
||||
* -- understood or is not available
|
||||
* badSenderNonce (18),
|
||||
* -- invalid sender nonce, either missing or wrong size
|
||||
* badCertTemplate (19),
|
||||
* -- invalid cert. template or missing mandatory information
|
||||
* signerNotTrusted (20),
|
||||
* -- signer of the message unknown or not trusted
|
||||
* transactionIdInUse (21),
|
||||
* -- the transaction identifier is already in use
|
||||
* unsupportedVersion (22),
|
||||
* -- the version of the message is not supported
|
||||
* notAuthorized (23),
|
||||
* -- the sender was not authorized to make the preceding
|
||||
* -- request or perform the preceding action
|
||||
* systemUnavail (24),
|
||||
* -- the request cannot be handled due to system unavailability
|
||||
* systemFailure (25),
|
||||
* -- the request cannot be handled due to system failure
|
||||
* duplicateCertReq (26)
|
||||
* -- certificate cannot be issued because a duplicate
|
||||
* -- certificate already exists
|
||||
* }
|
||||
*/
|
||||
# define OSSL_CMP_PKIFAILUREINFO_badAlg 0
|
||||
# define OSSL_CMP_PKIFAILUREINFO_badMessageCheck 1
|
||||
# define OSSL_CMP_PKIFAILUREINFO_badRequest 2
|
||||
# define OSSL_CMP_PKIFAILUREINFO_badTime 3
|
||||
# define OSSL_CMP_PKIFAILUREINFO_badCertId 4
|
||||
# define OSSL_CMP_PKIFAILUREINFO_badDataFormat 5
|
||||
# define OSSL_CMP_PKIFAILUREINFO_wrongAuthority 6
|
||||
# define OSSL_CMP_PKIFAILUREINFO_incorrectData 7
|
||||
# define OSSL_CMP_PKIFAILUREINFO_missingTimeStamp 8
|
||||
# define OSSL_CMP_PKIFAILUREINFO_badPOP 9
|
||||
# define OSSL_CMP_PKIFAILUREINFO_certRevoked 10
|
||||
# define OSSL_CMP_PKIFAILUREINFO_certConfirmed 11
|
||||
# define OSSL_CMP_PKIFAILUREINFO_wrongIntegrity 12
|
||||
# define OSSL_CMP_PKIFAILUREINFO_badRecipientNonce 13
|
||||
# define OSSL_CMP_PKIFAILUREINFO_timeNotAvailable 14
|
||||
# define OSSL_CMP_PKIFAILUREINFO_unacceptedPolicy 15
|
||||
# define OSSL_CMP_PKIFAILUREINFO_unacceptedExtension 16
|
||||
# define OSSL_CMP_PKIFAILUREINFO_addInfoNotAvailable 17
|
||||
# define OSSL_CMP_PKIFAILUREINFO_badSenderNonce 18
|
||||
# define OSSL_CMP_PKIFAILUREINFO_badCertTemplate 19
|
||||
# define OSSL_CMP_PKIFAILUREINFO_signerNotTrusted 20
|
||||
# define OSSL_CMP_PKIFAILUREINFO_transactionIdInUse 21
|
||||
# define OSSL_CMP_PKIFAILUREINFO_unsupportedVersion 22
|
||||
# define OSSL_CMP_PKIFAILUREINFO_notAuthorized 23
|
||||
# define OSSL_CMP_PKIFAILUREINFO_systemUnavail 24
|
||||
# define OSSL_CMP_PKIFAILUREINFO_systemFailure 25
|
||||
# define OSSL_CMP_PKIFAILUREINFO_duplicateCertReq 26
|
||||
# define OSSL_CMP_PKIFAILUREINFO_MAX 26
|
||||
# define OSSL_CMP_PKIFAILUREINFO_MAX_BIT_PATTERN \
|
||||
((1 << (OSSL_CMP_PKIFAILUREINFO_MAX + 1)) - 1)
|
||||
# if OSSL_CMP_PKIFAILUREINFO_MAX_BIT_PATTERN > INT_MAX
|
||||
# error CMP_PKIFAILUREINFO_MAX bit pattern does not fit in type int
|
||||
# endif
|
||||
typedef ASN1_BIT_STRING OSSL_CMP_PKIFAILUREINFO;
|
||||
|
||||
# define OSSL_CMP_CTX_FAILINFO_badAlg (1 << 0)
|
||||
# define OSSL_CMP_CTX_FAILINFO_badMessageCheck (1 << 1)
|
||||
# define OSSL_CMP_CTX_FAILINFO_badRequest (1 << 2)
|
||||
# define OSSL_CMP_CTX_FAILINFO_badTime (1 << 3)
|
||||
# define OSSL_CMP_CTX_FAILINFO_badCertId (1 << 4)
|
||||
# define OSSL_CMP_CTX_FAILINFO_badDataFormat (1 << 5)
|
||||
# define OSSL_CMP_CTX_FAILINFO_wrongAuthority (1 << 6)
|
||||
# define OSSL_CMP_CTX_FAILINFO_incorrectData (1 << 7)
|
||||
# define OSSL_CMP_CTX_FAILINFO_missingTimeStamp (1 << 8)
|
||||
# define OSSL_CMP_CTX_FAILINFO_badPOP (1 << 9)
|
||||
# define OSSL_CMP_CTX_FAILINFO_certRevoked (1 << 10)
|
||||
# define OSSL_CMP_CTX_FAILINFO_certConfirmed (1 << 11)
|
||||
# define OSSL_CMP_CTX_FAILINFO_wrongIntegrity (1 << 12)
|
||||
# define OSSL_CMP_CTX_FAILINFO_badRecipientNonce (1 << 13)
|
||||
# define OSSL_CMP_CTX_FAILINFO_timeNotAvailable (1 << 14)
|
||||
# define OSSL_CMP_CTX_FAILINFO_unacceptedPolicy (1 << 15)
|
||||
# define OSSL_CMP_CTX_FAILINFO_unacceptedExtension (1 << 16)
|
||||
# define OSSL_CMP_CTX_FAILINFO_addInfoNotAvailable (1 << 17)
|
||||
# define OSSL_CMP_CTX_FAILINFO_badSenderNonce (1 << 18)
|
||||
# define OSSL_CMP_CTX_FAILINFO_badCertTemplate (1 << 19)
|
||||
# define OSSL_CMP_CTX_FAILINFO_signerNotTrusted (1 << 20)
|
||||
# define OSSL_CMP_CTX_FAILINFO_transactionIdInUse (1 << 21)
|
||||
# define OSSL_CMP_CTX_FAILINFO_unsupportedVersion (1 << 22)
|
||||
# define OSSL_CMP_CTX_FAILINFO_notAuthorized (1 << 23)
|
||||
# define OSSL_CMP_CTX_FAILINFO_systemUnavail (1 << 24)
|
||||
# define OSSL_CMP_CTX_FAILINFO_systemFailure (1 << 25)
|
||||
# define OSSL_CMP_CTX_FAILINFO_duplicateCertReq (1 << 26)
|
||||
|
||||
/*-
|
||||
* PKIStatus ::= INTEGER {
|
||||
* accepted (0),
|
||||
* -- you got exactly what you asked for
|
||||
* grantedWithMods (1),
|
||||
* -- you got something like what you asked for; the
|
||||
* -- requester is responsible for ascertaining the differences
|
||||
* rejection (2),
|
||||
* -- you don't get it, more information elsewhere in the message
|
||||
* waiting (3),
|
||||
* -- the request body part has not yet been processed; expect to
|
||||
* -- hear more later (note: proper handling of this status
|
||||
* -- response MAY use the polling req/rep PKIMessages specified
|
||||
* -- in Section 5.3.22; alternatively, polling in the underlying
|
||||
* -- transport layer MAY have some utility in this regard)
|
||||
* revocationWarning (4),
|
||||
* -- this message contains a warning that a revocation is
|
||||
* -- imminent
|
||||
* revocationNotification (5),
|
||||
* -- notification that a revocation has occurred
|
||||
* keyUpdateWarning (6)
|
||||
* -- update already done for the oldCertId specified in
|
||||
* -- CertReqMsg
|
||||
* }
|
||||
*/
|
||||
# define OSSL_CMP_PKISTATUS_request -3
|
||||
# define OSSL_CMP_PKISTATUS_trans -2
|
||||
# define OSSL_CMP_PKISTATUS_unspecified -1
|
||||
# define OSSL_CMP_PKISTATUS_accepted 0
|
||||
# define OSSL_CMP_PKISTATUS_grantedWithMods 1
|
||||
# define OSSL_CMP_PKISTATUS_rejection 2
|
||||
# define OSSL_CMP_PKISTATUS_waiting 3
|
||||
# define OSSL_CMP_PKISTATUS_revocationWarning 4
|
||||
# define OSSL_CMP_PKISTATUS_revocationNotification 5
|
||||
# define OSSL_CMP_PKISTATUS_keyUpdateWarning 6
|
||||
typedef ASN1_INTEGER OSSL_CMP_PKISTATUS;
|
||||
|
||||
DECLARE_ASN1_ITEM(OSSL_CMP_PKISTATUS)
|
||||
|
||||
# define OSSL_CMP_CERTORENCCERT_CERTIFICATE 0
|
||||
# define OSSL_CMP_CERTORENCCERT_ENCRYPTEDCERT 1
|
||||
|
||||
/* data type declarations */
|
||||
typedef struct ossl_cmp_ctx_st OSSL_CMP_CTX;
|
||||
typedef struct ossl_cmp_pkiheader_st OSSL_CMP_PKIHEADER;
|
||||
DECLARE_ASN1_FUNCTIONS(OSSL_CMP_PKIHEADER)
|
||||
typedef struct ossl_cmp_msg_st OSSL_CMP_MSG;
|
||||
DECLARE_ASN1_DUP_FUNCTION(OSSL_CMP_MSG)
|
||||
DECLARE_ASN1_ENCODE_FUNCTIONS(OSSL_CMP_MSG, OSSL_CMP_MSG, OSSL_CMP_MSG)
|
||||
typedef struct ossl_cmp_certstatus_st OSSL_CMP_CERTSTATUS;
|
||||
SKM_DEFINE_STACK_OF_INTERNAL(OSSL_CMP_CERTSTATUS, OSSL_CMP_CERTSTATUS, OSSL_CMP_CERTSTATUS)
|
||||
#define sk_OSSL_CMP_CERTSTATUS_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_CMP_CERTSTATUS_sk_type(sk))
|
||||
#define sk_OSSL_CMP_CERTSTATUS_value(sk, idx) ((OSSL_CMP_CERTSTATUS *)OPENSSL_sk_value(ossl_check_const_OSSL_CMP_CERTSTATUS_sk_type(sk), (idx)))
|
||||
#define sk_OSSL_CMP_CERTSTATUS_new(cmp) ((STACK_OF(OSSL_CMP_CERTSTATUS) *)OPENSSL_sk_new(ossl_check_OSSL_CMP_CERTSTATUS_compfunc_type(cmp)))
|
||||
#define sk_OSSL_CMP_CERTSTATUS_new_null() ((STACK_OF(OSSL_CMP_CERTSTATUS) *)OPENSSL_sk_new_null())
|
||||
#define sk_OSSL_CMP_CERTSTATUS_new_reserve(cmp, n) ((STACK_OF(OSSL_CMP_CERTSTATUS) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_CMP_CERTSTATUS_compfunc_type(cmp), (n)))
|
||||
#define sk_OSSL_CMP_CERTSTATUS_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk), (n))
|
||||
#define sk_OSSL_CMP_CERTSTATUS_free(sk) OPENSSL_sk_free(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk))
|
||||
#define sk_OSSL_CMP_CERTSTATUS_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk))
|
||||
#define sk_OSSL_CMP_CERTSTATUS_delete(sk, i) ((OSSL_CMP_CERTSTATUS *)OPENSSL_sk_delete(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk), (i)))
|
||||
#define sk_OSSL_CMP_CERTSTATUS_delete_ptr(sk, ptr) ((OSSL_CMP_CERTSTATUS *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CERTSTATUS_type(ptr)))
|
||||
#define sk_OSSL_CMP_CERTSTATUS_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CERTSTATUS_type(ptr))
|
||||
#define sk_OSSL_CMP_CERTSTATUS_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CERTSTATUS_type(ptr))
|
||||
#define sk_OSSL_CMP_CERTSTATUS_pop(sk) ((OSSL_CMP_CERTSTATUS *)OPENSSL_sk_pop(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk)))
|
||||
#define sk_OSSL_CMP_CERTSTATUS_shift(sk) ((OSSL_CMP_CERTSTATUS *)OPENSSL_sk_shift(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk)))
|
||||
#define sk_OSSL_CMP_CERTSTATUS_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk),ossl_check_OSSL_CMP_CERTSTATUS_freefunc_type(freefunc))
|
||||
#define sk_OSSL_CMP_CERTSTATUS_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CERTSTATUS_type(ptr), (idx))
|
||||
#define sk_OSSL_CMP_CERTSTATUS_set(sk, idx, ptr) ((OSSL_CMP_CERTSTATUS *)OPENSSL_sk_set(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk), (idx), ossl_check_OSSL_CMP_CERTSTATUS_type(ptr)))
|
||||
#define sk_OSSL_CMP_CERTSTATUS_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CERTSTATUS_type(ptr))
|
||||
#define sk_OSSL_CMP_CERTSTATUS_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CERTSTATUS_type(ptr))
|
||||
#define sk_OSSL_CMP_CERTSTATUS_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CERTSTATUS_type(ptr), pnum)
|
||||
#define sk_OSSL_CMP_CERTSTATUS_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk))
|
||||
#define sk_OSSL_CMP_CERTSTATUS_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_CMP_CERTSTATUS_sk_type(sk))
|
||||
#define sk_OSSL_CMP_CERTSTATUS_dup(sk) ((STACK_OF(OSSL_CMP_CERTSTATUS) *)OPENSSL_sk_dup(ossl_check_const_OSSL_CMP_CERTSTATUS_sk_type(sk)))
|
||||
#define sk_OSSL_CMP_CERTSTATUS_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_CMP_CERTSTATUS) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_CMP_CERTSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CERTSTATUS_copyfunc_type(copyfunc), ossl_check_OSSL_CMP_CERTSTATUS_freefunc_type(freefunc)))
|
||||
#define sk_OSSL_CMP_CERTSTATUS_set_cmp_func(sk, cmp) ((sk_OSSL_CMP_CERTSTATUS_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CERTSTATUS_compfunc_type(cmp)))
|
||||
|
||||
typedef struct ossl_cmp_itav_st OSSL_CMP_ITAV;
|
||||
DECLARE_ASN1_DUP_FUNCTION(OSSL_CMP_ITAV)
|
||||
SKM_DEFINE_STACK_OF_INTERNAL(OSSL_CMP_ITAV, OSSL_CMP_ITAV, OSSL_CMP_ITAV)
|
||||
#define sk_OSSL_CMP_ITAV_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_CMP_ITAV_sk_type(sk))
|
||||
#define sk_OSSL_CMP_ITAV_value(sk, idx) ((OSSL_CMP_ITAV *)OPENSSL_sk_value(ossl_check_const_OSSL_CMP_ITAV_sk_type(sk), (idx)))
|
||||
#define sk_OSSL_CMP_ITAV_new(cmp) ((STACK_OF(OSSL_CMP_ITAV) *)OPENSSL_sk_new(ossl_check_OSSL_CMP_ITAV_compfunc_type(cmp)))
|
||||
#define sk_OSSL_CMP_ITAV_new_null() ((STACK_OF(OSSL_CMP_ITAV) *)OPENSSL_sk_new_null())
|
||||
#define sk_OSSL_CMP_ITAV_new_reserve(cmp, n) ((STACK_OF(OSSL_CMP_ITAV) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_CMP_ITAV_compfunc_type(cmp), (n)))
|
||||
#define sk_OSSL_CMP_ITAV_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_CMP_ITAV_sk_type(sk), (n))
|
||||
#define sk_OSSL_CMP_ITAV_free(sk) OPENSSL_sk_free(ossl_check_OSSL_CMP_ITAV_sk_type(sk))
|
||||
#define sk_OSSL_CMP_ITAV_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_CMP_ITAV_sk_type(sk))
|
||||
#define sk_OSSL_CMP_ITAV_delete(sk, i) ((OSSL_CMP_ITAV *)OPENSSL_sk_delete(ossl_check_OSSL_CMP_ITAV_sk_type(sk), (i)))
|
||||
#define sk_OSSL_CMP_ITAV_delete_ptr(sk, ptr) ((OSSL_CMP_ITAV *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_CMP_ITAV_sk_type(sk), ossl_check_OSSL_CMP_ITAV_type(ptr)))
|
||||
#define sk_OSSL_CMP_ITAV_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_CMP_ITAV_sk_type(sk), ossl_check_OSSL_CMP_ITAV_type(ptr))
|
||||
#define sk_OSSL_CMP_ITAV_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_CMP_ITAV_sk_type(sk), ossl_check_OSSL_CMP_ITAV_type(ptr))
|
||||
#define sk_OSSL_CMP_ITAV_pop(sk) ((OSSL_CMP_ITAV *)OPENSSL_sk_pop(ossl_check_OSSL_CMP_ITAV_sk_type(sk)))
|
||||
#define sk_OSSL_CMP_ITAV_shift(sk) ((OSSL_CMP_ITAV *)OPENSSL_sk_shift(ossl_check_OSSL_CMP_ITAV_sk_type(sk)))
|
||||
#define sk_OSSL_CMP_ITAV_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_CMP_ITAV_sk_type(sk),ossl_check_OSSL_CMP_ITAV_freefunc_type(freefunc))
|
||||
#define sk_OSSL_CMP_ITAV_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_CMP_ITAV_sk_type(sk), ossl_check_OSSL_CMP_ITAV_type(ptr), (idx))
|
||||
#define sk_OSSL_CMP_ITAV_set(sk, idx, ptr) ((OSSL_CMP_ITAV *)OPENSSL_sk_set(ossl_check_OSSL_CMP_ITAV_sk_type(sk), (idx), ossl_check_OSSL_CMP_ITAV_type(ptr)))
|
||||
#define sk_OSSL_CMP_ITAV_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_CMP_ITAV_sk_type(sk), ossl_check_OSSL_CMP_ITAV_type(ptr))
|
||||
#define sk_OSSL_CMP_ITAV_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_CMP_ITAV_sk_type(sk), ossl_check_OSSL_CMP_ITAV_type(ptr))
|
||||
#define sk_OSSL_CMP_ITAV_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_CMP_ITAV_sk_type(sk), ossl_check_OSSL_CMP_ITAV_type(ptr), pnum)
|
||||
#define sk_OSSL_CMP_ITAV_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_CMP_ITAV_sk_type(sk))
|
||||
#define sk_OSSL_CMP_ITAV_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_CMP_ITAV_sk_type(sk))
|
||||
#define sk_OSSL_CMP_ITAV_dup(sk) ((STACK_OF(OSSL_CMP_ITAV) *)OPENSSL_sk_dup(ossl_check_const_OSSL_CMP_ITAV_sk_type(sk)))
|
||||
#define sk_OSSL_CMP_ITAV_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_CMP_ITAV) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_CMP_ITAV_sk_type(sk), ossl_check_OSSL_CMP_ITAV_copyfunc_type(copyfunc), ossl_check_OSSL_CMP_ITAV_freefunc_type(freefunc)))
|
||||
#define sk_OSSL_CMP_ITAV_set_cmp_func(sk, cmp) ((sk_OSSL_CMP_ITAV_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_CMP_ITAV_sk_type(sk), ossl_check_OSSL_CMP_ITAV_compfunc_type(cmp)))
|
||||
|
||||
|
||||
typedef struct ossl_cmp_crlstatus_st OSSL_CMP_CRLSTATUS;
|
||||
SKM_DEFINE_STACK_OF_INTERNAL(OSSL_CMP_CRLSTATUS, OSSL_CMP_CRLSTATUS, OSSL_CMP_CRLSTATUS)
|
||||
#define sk_OSSL_CMP_CRLSTATUS_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_CMP_CRLSTATUS_sk_type(sk))
|
||||
#define sk_OSSL_CMP_CRLSTATUS_value(sk, idx) ((OSSL_CMP_CRLSTATUS *)OPENSSL_sk_value(ossl_check_const_OSSL_CMP_CRLSTATUS_sk_type(sk), (idx)))
|
||||
#define sk_OSSL_CMP_CRLSTATUS_new(cmp) ((STACK_OF(OSSL_CMP_CRLSTATUS) *)OPENSSL_sk_new(ossl_check_OSSL_CMP_CRLSTATUS_compfunc_type(cmp)))
|
||||
#define sk_OSSL_CMP_CRLSTATUS_new_null() ((STACK_OF(OSSL_CMP_CRLSTATUS) *)OPENSSL_sk_new_null())
|
||||
#define sk_OSSL_CMP_CRLSTATUS_new_reserve(cmp, n) ((STACK_OF(OSSL_CMP_CRLSTATUS) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_CMP_CRLSTATUS_compfunc_type(cmp), (n)))
|
||||
#define sk_OSSL_CMP_CRLSTATUS_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk), (n))
|
||||
#define sk_OSSL_CMP_CRLSTATUS_free(sk) OPENSSL_sk_free(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk))
|
||||
#define sk_OSSL_CMP_CRLSTATUS_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk))
|
||||
#define sk_OSSL_CMP_CRLSTATUS_delete(sk, i) ((OSSL_CMP_CRLSTATUS *)OPENSSL_sk_delete(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk), (i)))
|
||||
#define sk_OSSL_CMP_CRLSTATUS_delete_ptr(sk, ptr) ((OSSL_CMP_CRLSTATUS *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CRLSTATUS_type(ptr)))
|
||||
#define sk_OSSL_CMP_CRLSTATUS_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CRLSTATUS_type(ptr))
|
||||
#define sk_OSSL_CMP_CRLSTATUS_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CRLSTATUS_type(ptr))
|
||||
#define sk_OSSL_CMP_CRLSTATUS_pop(sk) ((OSSL_CMP_CRLSTATUS *)OPENSSL_sk_pop(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk)))
|
||||
#define sk_OSSL_CMP_CRLSTATUS_shift(sk) ((OSSL_CMP_CRLSTATUS *)OPENSSL_sk_shift(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk)))
|
||||
#define sk_OSSL_CMP_CRLSTATUS_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk),ossl_check_OSSL_CMP_CRLSTATUS_freefunc_type(freefunc))
|
||||
#define sk_OSSL_CMP_CRLSTATUS_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CRLSTATUS_type(ptr), (idx))
|
||||
#define sk_OSSL_CMP_CRLSTATUS_set(sk, idx, ptr) ((OSSL_CMP_CRLSTATUS *)OPENSSL_sk_set(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk), (idx), ossl_check_OSSL_CMP_CRLSTATUS_type(ptr)))
|
||||
#define sk_OSSL_CMP_CRLSTATUS_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CRLSTATUS_type(ptr))
|
||||
#define sk_OSSL_CMP_CRLSTATUS_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CRLSTATUS_type(ptr))
|
||||
#define sk_OSSL_CMP_CRLSTATUS_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CRLSTATUS_type(ptr), pnum)
|
||||
#define sk_OSSL_CMP_CRLSTATUS_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk))
|
||||
#define sk_OSSL_CMP_CRLSTATUS_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_CMP_CRLSTATUS_sk_type(sk))
|
||||
#define sk_OSSL_CMP_CRLSTATUS_dup(sk) ((STACK_OF(OSSL_CMP_CRLSTATUS) *)OPENSSL_sk_dup(ossl_check_const_OSSL_CMP_CRLSTATUS_sk_type(sk)))
|
||||
#define sk_OSSL_CMP_CRLSTATUS_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_CMP_CRLSTATUS) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_CMP_CRLSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CRLSTATUS_copyfunc_type(copyfunc), ossl_check_OSSL_CMP_CRLSTATUS_freefunc_type(freefunc)))
|
||||
#define sk_OSSL_CMP_CRLSTATUS_set_cmp_func(sk, cmp) ((sk_OSSL_CMP_CRLSTATUS_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CRLSTATUS_compfunc_type(cmp)))
|
||||
|
||||
|
||||
typedef OSSL_CRMF_ATTRIBUTETYPEANDVALUE OSSL_CMP_ATAV;
|
||||
# define OSSL_CMP_ATAV_free OSSL_CRMF_ATTRIBUTETYPEANDVALUE_free
|
||||
typedef STACK_OF(OSSL_CRMF_ATTRIBUTETYPEANDVALUE) OSSL_CMP_ATAVS;
|
||||
DECLARE_ASN1_FUNCTIONS(OSSL_CMP_ATAVS)
|
||||
# define stack_st_OSSL_CMP_ATAV stack_st_OSSL_CRMF_ATTRIBUTETYPEANDVALUE
|
||||
# define sk_OSSL_CMP_ATAV_num sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_num
|
||||
# define sk_OSSL_CMP_ATAV_value sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_value
|
||||
# define sk_OSSL_CMP_ATAV_push sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_push
|
||||
# define sk_OSSL_CMP_ATAV_pop_free sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_pop_free
|
||||
|
||||
typedef struct ossl_cmp_revrepcontent_st OSSL_CMP_REVREPCONTENT;
|
||||
typedef struct ossl_cmp_pkisi_st OSSL_CMP_PKISI;
|
||||
DECLARE_ASN1_FUNCTIONS(OSSL_CMP_PKISI)
|
||||
DECLARE_ASN1_DUP_FUNCTION(OSSL_CMP_PKISI)
|
||||
SKM_DEFINE_STACK_OF_INTERNAL(OSSL_CMP_PKISI, OSSL_CMP_PKISI, OSSL_CMP_PKISI)
|
||||
#define sk_OSSL_CMP_PKISI_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_CMP_PKISI_sk_type(sk))
|
||||
#define sk_OSSL_CMP_PKISI_value(sk, idx) ((OSSL_CMP_PKISI *)OPENSSL_sk_value(ossl_check_const_OSSL_CMP_PKISI_sk_type(sk), (idx)))
|
||||
#define sk_OSSL_CMP_PKISI_new(cmp) ((STACK_OF(OSSL_CMP_PKISI) *)OPENSSL_sk_new(ossl_check_OSSL_CMP_PKISI_compfunc_type(cmp)))
|
||||
#define sk_OSSL_CMP_PKISI_new_null() ((STACK_OF(OSSL_CMP_PKISI) *)OPENSSL_sk_new_null())
|
||||
#define sk_OSSL_CMP_PKISI_new_reserve(cmp, n) ((STACK_OF(OSSL_CMP_PKISI) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_CMP_PKISI_compfunc_type(cmp), (n)))
|
||||
#define sk_OSSL_CMP_PKISI_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_CMP_PKISI_sk_type(sk), (n))
|
||||
#define sk_OSSL_CMP_PKISI_free(sk) OPENSSL_sk_free(ossl_check_OSSL_CMP_PKISI_sk_type(sk))
|
||||
#define sk_OSSL_CMP_PKISI_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_CMP_PKISI_sk_type(sk))
|
||||
#define sk_OSSL_CMP_PKISI_delete(sk, i) ((OSSL_CMP_PKISI *)OPENSSL_sk_delete(ossl_check_OSSL_CMP_PKISI_sk_type(sk), (i)))
|
||||
#define sk_OSSL_CMP_PKISI_delete_ptr(sk, ptr) ((OSSL_CMP_PKISI *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_CMP_PKISI_sk_type(sk), ossl_check_OSSL_CMP_PKISI_type(ptr)))
|
||||
#define sk_OSSL_CMP_PKISI_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_CMP_PKISI_sk_type(sk), ossl_check_OSSL_CMP_PKISI_type(ptr))
|
||||
#define sk_OSSL_CMP_PKISI_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_CMP_PKISI_sk_type(sk), ossl_check_OSSL_CMP_PKISI_type(ptr))
|
||||
#define sk_OSSL_CMP_PKISI_pop(sk) ((OSSL_CMP_PKISI *)OPENSSL_sk_pop(ossl_check_OSSL_CMP_PKISI_sk_type(sk)))
|
||||
#define sk_OSSL_CMP_PKISI_shift(sk) ((OSSL_CMP_PKISI *)OPENSSL_sk_shift(ossl_check_OSSL_CMP_PKISI_sk_type(sk)))
|
||||
#define sk_OSSL_CMP_PKISI_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_CMP_PKISI_sk_type(sk),ossl_check_OSSL_CMP_PKISI_freefunc_type(freefunc))
|
||||
#define sk_OSSL_CMP_PKISI_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_CMP_PKISI_sk_type(sk), ossl_check_OSSL_CMP_PKISI_type(ptr), (idx))
|
||||
#define sk_OSSL_CMP_PKISI_set(sk, idx, ptr) ((OSSL_CMP_PKISI *)OPENSSL_sk_set(ossl_check_OSSL_CMP_PKISI_sk_type(sk), (idx), ossl_check_OSSL_CMP_PKISI_type(ptr)))
|
||||
#define sk_OSSL_CMP_PKISI_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_CMP_PKISI_sk_type(sk), ossl_check_OSSL_CMP_PKISI_type(ptr))
|
||||
#define sk_OSSL_CMP_PKISI_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_CMP_PKISI_sk_type(sk), ossl_check_OSSL_CMP_PKISI_type(ptr))
|
||||
#define sk_OSSL_CMP_PKISI_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_CMP_PKISI_sk_type(sk), ossl_check_OSSL_CMP_PKISI_type(ptr), pnum)
|
||||
#define sk_OSSL_CMP_PKISI_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_CMP_PKISI_sk_type(sk))
|
||||
#define sk_OSSL_CMP_PKISI_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_CMP_PKISI_sk_type(sk))
|
||||
#define sk_OSSL_CMP_PKISI_dup(sk) ((STACK_OF(OSSL_CMP_PKISI) *)OPENSSL_sk_dup(ossl_check_const_OSSL_CMP_PKISI_sk_type(sk)))
|
||||
#define sk_OSSL_CMP_PKISI_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_CMP_PKISI) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_CMP_PKISI_sk_type(sk), ossl_check_OSSL_CMP_PKISI_copyfunc_type(copyfunc), ossl_check_OSSL_CMP_PKISI_freefunc_type(freefunc)))
|
||||
#define sk_OSSL_CMP_PKISI_set_cmp_func(sk, cmp) ((sk_OSSL_CMP_PKISI_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_CMP_PKISI_sk_type(sk), ossl_check_OSSL_CMP_PKISI_compfunc_type(cmp)))
|
||||
|
||||
typedef struct ossl_cmp_certrepmessage_st OSSL_CMP_CERTREPMESSAGE;
|
||||
SKM_DEFINE_STACK_OF_INTERNAL(OSSL_CMP_CERTREPMESSAGE, OSSL_CMP_CERTREPMESSAGE, OSSL_CMP_CERTREPMESSAGE)
|
||||
#define sk_OSSL_CMP_CERTREPMESSAGE_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_CMP_CERTREPMESSAGE_sk_type(sk))
|
||||
#define sk_OSSL_CMP_CERTREPMESSAGE_value(sk, idx) ((OSSL_CMP_CERTREPMESSAGE *)OPENSSL_sk_value(ossl_check_const_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), (idx)))
|
||||
#define sk_OSSL_CMP_CERTREPMESSAGE_new(cmp) ((STACK_OF(OSSL_CMP_CERTREPMESSAGE) *)OPENSSL_sk_new(ossl_check_OSSL_CMP_CERTREPMESSAGE_compfunc_type(cmp)))
|
||||
#define sk_OSSL_CMP_CERTREPMESSAGE_new_null() ((STACK_OF(OSSL_CMP_CERTREPMESSAGE) *)OPENSSL_sk_new_null())
|
||||
#define sk_OSSL_CMP_CERTREPMESSAGE_new_reserve(cmp, n) ((STACK_OF(OSSL_CMP_CERTREPMESSAGE) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_CMP_CERTREPMESSAGE_compfunc_type(cmp), (n)))
|
||||
#define sk_OSSL_CMP_CERTREPMESSAGE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), (n))
|
||||
#define sk_OSSL_CMP_CERTREPMESSAGE_free(sk) OPENSSL_sk_free(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk))
|
||||
#define sk_OSSL_CMP_CERTREPMESSAGE_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk))
|
||||
#define sk_OSSL_CMP_CERTREPMESSAGE_delete(sk, i) ((OSSL_CMP_CERTREPMESSAGE *)OPENSSL_sk_delete(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), (i)))
|
||||
#define sk_OSSL_CMP_CERTREPMESSAGE_delete_ptr(sk, ptr) ((OSSL_CMP_CERTREPMESSAGE *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), ossl_check_OSSL_CMP_CERTREPMESSAGE_type(ptr)))
|
||||
#define sk_OSSL_CMP_CERTREPMESSAGE_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), ossl_check_OSSL_CMP_CERTREPMESSAGE_type(ptr))
|
||||
#define sk_OSSL_CMP_CERTREPMESSAGE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), ossl_check_OSSL_CMP_CERTREPMESSAGE_type(ptr))
|
||||
#define sk_OSSL_CMP_CERTREPMESSAGE_pop(sk) ((OSSL_CMP_CERTREPMESSAGE *)OPENSSL_sk_pop(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk)))
|
||||
#define sk_OSSL_CMP_CERTREPMESSAGE_shift(sk) ((OSSL_CMP_CERTREPMESSAGE *)OPENSSL_sk_shift(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk)))
|
||||
#define sk_OSSL_CMP_CERTREPMESSAGE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk),ossl_check_OSSL_CMP_CERTREPMESSAGE_freefunc_type(freefunc))
|
||||
#define sk_OSSL_CMP_CERTREPMESSAGE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), ossl_check_OSSL_CMP_CERTREPMESSAGE_type(ptr), (idx))
|
||||
#define sk_OSSL_CMP_CERTREPMESSAGE_set(sk, idx, ptr) ((OSSL_CMP_CERTREPMESSAGE *)OPENSSL_sk_set(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), (idx), ossl_check_OSSL_CMP_CERTREPMESSAGE_type(ptr)))
|
||||
#define sk_OSSL_CMP_CERTREPMESSAGE_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), ossl_check_OSSL_CMP_CERTREPMESSAGE_type(ptr))
|
||||
#define sk_OSSL_CMP_CERTREPMESSAGE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), ossl_check_OSSL_CMP_CERTREPMESSAGE_type(ptr))
|
||||
#define sk_OSSL_CMP_CERTREPMESSAGE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), ossl_check_OSSL_CMP_CERTREPMESSAGE_type(ptr), pnum)
|
||||
#define sk_OSSL_CMP_CERTREPMESSAGE_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk))
|
||||
#define sk_OSSL_CMP_CERTREPMESSAGE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_CMP_CERTREPMESSAGE_sk_type(sk))
|
||||
#define sk_OSSL_CMP_CERTREPMESSAGE_dup(sk) ((STACK_OF(OSSL_CMP_CERTREPMESSAGE) *)OPENSSL_sk_dup(ossl_check_const_OSSL_CMP_CERTREPMESSAGE_sk_type(sk)))
|
||||
#define sk_OSSL_CMP_CERTREPMESSAGE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_CMP_CERTREPMESSAGE) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), ossl_check_OSSL_CMP_CERTREPMESSAGE_copyfunc_type(copyfunc), ossl_check_OSSL_CMP_CERTREPMESSAGE_freefunc_type(freefunc)))
|
||||
#define sk_OSSL_CMP_CERTREPMESSAGE_set_cmp_func(sk, cmp) ((sk_OSSL_CMP_CERTREPMESSAGE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), ossl_check_OSSL_CMP_CERTREPMESSAGE_compfunc_type(cmp)))
|
||||
|
||||
typedef struct ossl_cmp_pollrep_st OSSL_CMP_POLLREP;
|
||||
typedef STACK_OF(OSSL_CMP_POLLREP) OSSL_CMP_POLLREPCONTENT;
|
||||
typedef struct ossl_cmp_certresponse_st OSSL_CMP_CERTRESPONSE;
|
||||
SKM_DEFINE_STACK_OF_INTERNAL(OSSL_CMP_CERTRESPONSE, OSSL_CMP_CERTRESPONSE, OSSL_CMP_CERTRESPONSE)
|
||||
#define sk_OSSL_CMP_CERTRESPONSE_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_CMP_CERTRESPONSE_sk_type(sk))
|
||||
#define sk_OSSL_CMP_CERTRESPONSE_value(sk, idx) ((OSSL_CMP_CERTRESPONSE *)OPENSSL_sk_value(ossl_check_const_OSSL_CMP_CERTRESPONSE_sk_type(sk), (idx)))
|
||||
#define sk_OSSL_CMP_CERTRESPONSE_new(cmp) ((STACK_OF(OSSL_CMP_CERTRESPONSE) *)OPENSSL_sk_new(ossl_check_OSSL_CMP_CERTRESPONSE_compfunc_type(cmp)))
|
||||
#define sk_OSSL_CMP_CERTRESPONSE_new_null() ((STACK_OF(OSSL_CMP_CERTRESPONSE) *)OPENSSL_sk_new_null())
|
||||
#define sk_OSSL_CMP_CERTRESPONSE_new_reserve(cmp, n) ((STACK_OF(OSSL_CMP_CERTRESPONSE) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_CMP_CERTRESPONSE_compfunc_type(cmp), (n)))
|
||||
#define sk_OSSL_CMP_CERTRESPONSE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk), (n))
|
||||
#define sk_OSSL_CMP_CERTRESPONSE_free(sk) OPENSSL_sk_free(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk))
|
||||
#define sk_OSSL_CMP_CERTRESPONSE_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk))
|
||||
#define sk_OSSL_CMP_CERTRESPONSE_delete(sk, i) ((OSSL_CMP_CERTRESPONSE *)OPENSSL_sk_delete(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk), (i)))
|
||||
#define sk_OSSL_CMP_CERTRESPONSE_delete_ptr(sk, ptr) ((OSSL_CMP_CERTRESPONSE *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk), ossl_check_OSSL_CMP_CERTRESPONSE_type(ptr)))
|
||||
#define sk_OSSL_CMP_CERTRESPONSE_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk), ossl_check_OSSL_CMP_CERTRESPONSE_type(ptr))
|
||||
#define sk_OSSL_CMP_CERTRESPONSE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk), ossl_check_OSSL_CMP_CERTRESPONSE_type(ptr))
|
||||
#define sk_OSSL_CMP_CERTRESPONSE_pop(sk) ((OSSL_CMP_CERTRESPONSE *)OPENSSL_sk_pop(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk)))
|
||||
#define sk_OSSL_CMP_CERTRESPONSE_shift(sk) ((OSSL_CMP_CERTRESPONSE *)OPENSSL_sk_shift(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk)))
|
||||
#define sk_OSSL_CMP_CERTRESPONSE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk),ossl_check_OSSL_CMP_CERTRESPONSE_freefunc_type(freefunc))
|
||||
#define sk_OSSL_CMP_CERTRESPONSE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk), ossl_check_OSSL_CMP_CERTRESPONSE_type(ptr), (idx))
|
||||
#define sk_OSSL_CMP_CERTRESPONSE_set(sk, idx, ptr) ((OSSL_CMP_CERTRESPONSE *)OPENSSL_sk_set(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk), (idx), ossl_check_OSSL_CMP_CERTRESPONSE_type(ptr)))
|
||||
#define sk_OSSL_CMP_CERTRESPONSE_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk), ossl_check_OSSL_CMP_CERTRESPONSE_type(ptr))
|
||||
#define sk_OSSL_CMP_CERTRESPONSE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk), ossl_check_OSSL_CMP_CERTRESPONSE_type(ptr))
|
||||
#define sk_OSSL_CMP_CERTRESPONSE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk), ossl_check_OSSL_CMP_CERTRESPONSE_type(ptr), pnum)
|
||||
#define sk_OSSL_CMP_CERTRESPONSE_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk))
|
||||
#define sk_OSSL_CMP_CERTRESPONSE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_CMP_CERTRESPONSE_sk_type(sk))
|
||||
#define sk_OSSL_CMP_CERTRESPONSE_dup(sk) ((STACK_OF(OSSL_CMP_CERTRESPONSE) *)OPENSSL_sk_dup(ossl_check_const_OSSL_CMP_CERTRESPONSE_sk_type(sk)))
|
||||
#define sk_OSSL_CMP_CERTRESPONSE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_CMP_CERTRESPONSE) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_CMP_CERTRESPONSE_sk_type(sk), ossl_check_OSSL_CMP_CERTRESPONSE_copyfunc_type(copyfunc), ossl_check_OSSL_CMP_CERTRESPONSE_freefunc_type(freefunc)))
|
||||
#define sk_OSSL_CMP_CERTRESPONSE_set_cmp_func(sk, cmp) ((sk_OSSL_CMP_CERTRESPONSE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk), ossl_check_OSSL_CMP_CERTRESPONSE_compfunc_type(cmp)))
|
||||
|
||||
typedef STACK_OF(ASN1_UTF8STRING) OSSL_CMP_PKIFREETEXT;
|
||||
|
||||
/*
|
||||
* function DECLARATIONS
|
||||
*/
|
||||
|
||||
/* from cmp_asn.c */
|
||||
OSSL_CMP_ITAV *OSSL_CMP_ITAV_create(ASN1_OBJECT *type, ASN1_TYPE *value);
|
||||
void OSSL_CMP_ITAV_set0(OSSL_CMP_ITAV *itav, ASN1_OBJECT *type,
|
||||
ASN1_TYPE *value);
|
||||
ASN1_OBJECT *OSSL_CMP_ITAV_get0_type(const OSSL_CMP_ITAV *itav);
|
||||
ASN1_TYPE *OSSL_CMP_ITAV_get0_value(const OSSL_CMP_ITAV *itav);
|
||||
int OSSL_CMP_ITAV_push0_stack_item(STACK_OF(OSSL_CMP_ITAV) **sk_p,
|
||||
OSSL_CMP_ITAV *itav);
|
||||
void OSSL_CMP_ITAV_free(OSSL_CMP_ITAV *itav);
|
||||
|
||||
OSSL_CMP_ITAV *OSSL_CMP_ITAV_new0_certProfile(STACK_OF(ASN1_UTF8STRING)
|
||||
*certProfile);
|
||||
int OSSL_CMP_ITAV_get0_certProfile(const OSSL_CMP_ITAV *itav,
|
||||
STACK_OF(ASN1_UTF8STRING) **out);
|
||||
OSSL_CMP_ITAV *OSSL_CMP_ITAV_new_caCerts(const STACK_OF(X509) *caCerts);
|
||||
int OSSL_CMP_ITAV_get0_caCerts(const OSSL_CMP_ITAV *itav, STACK_OF(X509) **out);
|
||||
|
||||
OSSL_CMP_ITAV *OSSL_CMP_ITAV_new_rootCaCert(const X509 *rootCaCert);
|
||||
int OSSL_CMP_ITAV_get0_rootCaCert(const OSSL_CMP_ITAV *itav, X509 **out);
|
||||
OSSL_CMP_ITAV *OSSL_CMP_ITAV_new_rootCaKeyUpdate(const X509 *newWithNew,
|
||||
const X509 *newWithOld,
|
||||
const X509 *oldWithNew);
|
||||
int OSSL_CMP_ITAV_get0_rootCaKeyUpdate(const OSSL_CMP_ITAV *itav,
|
||||
X509 **newWithNew,
|
||||
X509 **newWithOld,
|
||||
X509 **oldWithNew);
|
||||
|
||||
OSSL_CMP_CRLSTATUS *OSSL_CMP_CRLSTATUS_create(const X509_CRL *crl,
|
||||
const X509 *cert, int only_DN);
|
||||
OSSL_CMP_CRLSTATUS *OSSL_CMP_CRLSTATUS_new1(const DIST_POINT_NAME *dpn,
|
||||
const GENERAL_NAMES *issuer,
|
||||
const ASN1_TIME *thisUpdate);
|
||||
int OSSL_CMP_CRLSTATUS_get0(const OSSL_CMP_CRLSTATUS *crlstatus,
|
||||
DIST_POINT_NAME **dpn, GENERAL_NAMES **issuer,
|
||||
ASN1_TIME **thisUpdate);
|
||||
void OSSL_CMP_CRLSTATUS_free(OSSL_CMP_CRLSTATUS *crlstatus);
|
||||
OSSL_CMP_ITAV
|
||||
*OSSL_CMP_ITAV_new0_crlStatusList(STACK_OF(OSSL_CMP_CRLSTATUS) *crlStatusList);
|
||||
int OSSL_CMP_ITAV_get0_crlStatusList(const OSSL_CMP_ITAV *itav,
|
||||
STACK_OF(OSSL_CMP_CRLSTATUS) **out);
|
||||
OSSL_CMP_ITAV *OSSL_CMP_ITAV_new_crls(const X509_CRL *crls);
|
||||
int OSSL_CMP_ITAV_get0_crls(const OSSL_CMP_ITAV *it, STACK_OF(X509_CRL) **out);
|
||||
OSSL_CMP_ITAV
|
||||
*OSSL_CMP_ITAV_new0_certReqTemplate(OSSL_CRMF_CERTTEMPLATE *certTemplate,
|
||||
OSSL_CMP_ATAVS *keySpec);
|
||||
int OSSL_CMP_ITAV_get1_certReqTemplate(const OSSL_CMP_ITAV *itav,
|
||||
OSSL_CRMF_CERTTEMPLATE **certTemplate,
|
||||
OSSL_CMP_ATAVS **keySpec);
|
||||
|
||||
OSSL_CMP_ATAV *OSSL_CMP_ATAV_create(ASN1_OBJECT *type, ASN1_TYPE *value);
|
||||
void OSSL_CMP_ATAV_set0(OSSL_CMP_ATAV *itav, ASN1_OBJECT *type,
|
||||
ASN1_TYPE *value);
|
||||
ASN1_OBJECT *OSSL_CMP_ATAV_get0_type(const OSSL_CMP_ATAV *itav);
|
||||
ASN1_TYPE *OSSL_CMP_ATAV_get0_value(const OSSL_CMP_ATAV *itav);
|
||||
OSSL_CMP_ATAV *OSSL_CMP_ATAV_new_algId(const X509_ALGOR *alg);
|
||||
X509_ALGOR *OSSL_CMP_ATAV_get0_algId(const OSSL_CMP_ATAV *atav);
|
||||
OSSL_CMP_ATAV *OSSL_CMP_ATAV_new_rsaKeyLen(int len);
|
||||
int OSSL_CMP_ATAV_get_rsaKeyLen(const OSSL_CMP_ATAV *atav);
|
||||
int OSSL_CMP_ATAV_push1(OSSL_CMP_ATAVS **sk_p, const OSSL_CMP_ATAV *atav);
|
||||
|
||||
void OSSL_CMP_MSG_free(OSSL_CMP_MSG *msg);
|
||||
|
||||
/* from cmp_ctx.c */
|
||||
OSSL_CMP_CTX *OSSL_CMP_CTX_new(OSSL_LIB_CTX *libctx, const char *propq);
|
||||
void OSSL_CMP_CTX_free(OSSL_CMP_CTX *ctx);
|
||||
int OSSL_CMP_CTX_reinit(OSSL_CMP_CTX *ctx);
|
||||
OSSL_LIB_CTX *OSSL_CMP_CTX_get0_libctx(const OSSL_CMP_CTX *ctx);
|
||||
const char *OSSL_CMP_CTX_get0_propq(const OSSL_CMP_CTX *ctx);
|
||||
/* CMP general options: */
|
||||
# define OSSL_CMP_OPT_LOG_VERBOSITY 0
|
||||
/* CMP transfer options: */
|
||||
# define OSSL_CMP_OPT_KEEP_ALIVE 10
|
||||
# define OSSL_CMP_OPT_MSG_TIMEOUT 11
|
||||
# define OSSL_CMP_OPT_TOTAL_TIMEOUT 12
|
||||
# define OSSL_CMP_OPT_USE_TLS 13
|
||||
/* CMP request options: */
|
||||
# define OSSL_CMP_OPT_VALIDITY_DAYS 20
|
||||
# define OSSL_CMP_OPT_SUBJECTALTNAME_NODEFAULT 21
|
||||
# define OSSL_CMP_OPT_SUBJECTALTNAME_CRITICAL 22
|
||||
# define OSSL_CMP_OPT_POLICIES_CRITICAL 23
|
||||
# define OSSL_CMP_OPT_POPO_METHOD 24
|
||||
# define OSSL_CMP_OPT_IMPLICIT_CONFIRM 25
|
||||
# define OSSL_CMP_OPT_DISABLE_CONFIRM 26
|
||||
# define OSSL_CMP_OPT_REVOCATION_REASON 27
|
||||
/* CMP protection options: */
|
||||
# define OSSL_CMP_OPT_UNPROTECTED_SEND 30
|
||||
# define OSSL_CMP_OPT_UNPROTECTED_ERRORS 31
|
||||
# define OSSL_CMP_OPT_OWF_ALGNID 32
|
||||
# define OSSL_CMP_OPT_MAC_ALGNID 33
|
||||
# define OSSL_CMP_OPT_DIGEST_ALGNID 34
|
||||
# define OSSL_CMP_OPT_IGNORE_KEYUSAGE 35
|
||||
# define OSSL_CMP_OPT_PERMIT_TA_IN_EXTRACERTS_FOR_IR 36
|
||||
# define OSSL_CMP_OPT_NO_CACHE_EXTRACERTS 37
|
||||
int OSSL_CMP_CTX_set_option(OSSL_CMP_CTX *ctx, int opt, int val);
|
||||
int OSSL_CMP_CTX_get_option(const OSSL_CMP_CTX *ctx, int opt);
|
||||
/* CMP-specific callback for logging and outputting the error queue: */
|
||||
int OSSL_CMP_CTX_set_log_cb(OSSL_CMP_CTX *ctx, OSSL_CMP_log_cb_t cb);
|
||||
# define OSSL_CMP_CTX_set_log_verbosity(ctx, level) \
|
||||
OSSL_CMP_CTX_set_option(ctx, OSSL_CMP_OPT_LOG_VERBOSITY, level)
|
||||
void OSSL_CMP_CTX_print_errors(const OSSL_CMP_CTX *ctx);
|
||||
/* message transfer: */
|
||||
int OSSL_CMP_CTX_set1_serverPath(OSSL_CMP_CTX *ctx, const char *path);
|
||||
int OSSL_CMP_CTX_set1_server(OSSL_CMP_CTX *ctx, const char *address);
|
||||
int OSSL_CMP_CTX_set_serverPort(OSSL_CMP_CTX *ctx, int port);
|
||||
int OSSL_CMP_CTX_set1_proxy(OSSL_CMP_CTX *ctx, const char *name);
|
||||
int OSSL_CMP_CTX_set1_no_proxy(OSSL_CMP_CTX *ctx, const char *names);
|
||||
# ifndef OPENSSL_NO_HTTP
|
||||
int OSSL_CMP_CTX_set_http_cb(OSSL_CMP_CTX *ctx, OSSL_HTTP_bio_cb_t cb);
|
||||
int OSSL_CMP_CTX_set_http_cb_arg(OSSL_CMP_CTX *ctx, void *arg);
|
||||
void *OSSL_CMP_CTX_get_http_cb_arg(const OSSL_CMP_CTX *ctx);
|
||||
# endif
|
||||
typedef OSSL_CMP_MSG *(*OSSL_CMP_transfer_cb_t) (OSSL_CMP_CTX *ctx,
|
||||
const OSSL_CMP_MSG *req);
|
||||
int OSSL_CMP_CTX_set_transfer_cb(OSSL_CMP_CTX *ctx, OSSL_CMP_transfer_cb_t cb);
|
||||
int OSSL_CMP_CTX_set_transfer_cb_arg(OSSL_CMP_CTX *ctx, void *arg);
|
||||
void *OSSL_CMP_CTX_get_transfer_cb_arg(const OSSL_CMP_CTX *ctx);
|
||||
/* server authentication: */
|
||||
int OSSL_CMP_CTX_set1_srvCert(OSSL_CMP_CTX *ctx, X509 *cert);
|
||||
int OSSL_CMP_CTX_set1_expected_sender(OSSL_CMP_CTX *ctx, const X509_NAME *name);
|
||||
int OSSL_CMP_CTX_set0_trustedStore(OSSL_CMP_CTX *ctx, X509_STORE *store);
|
||||
# define OSSL_CMP_CTX_set0_trusted OSSL_CMP_CTX_set0_trustedStore
|
||||
X509_STORE *OSSL_CMP_CTX_get0_trustedStore(const OSSL_CMP_CTX *ctx);
|
||||
# define OSSL_CMP_CTX_get0_trusted OSSL_CMP_CTX_get0_trustedStore
|
||||
int OSSL_CMP_CTX_set1_untrusted(OSSL_CMP_CTX *ctx, STACK_OF(X509) *certs);
|
||||
STACK_OF(X509) *OSSL_CMP_CTX_get0_untrusted(const OSSL_CMP_CTX *ctx);
|
||||
/* client authentication: */
|
||||
int OSSL_CMP_CTX_set1_cert(OSSL_CMP_CTX *ctx, X509 *cert);
|
||||
int OSSL_CMP_CTX_build_cert_chain(OSSL_CMP_CTX *ctx, X509_STORE *own_trusted,
|
||||
STACK_OF(X509) *candidates);
|
||||
int OSSL_CMP_CTX_set1_pkey(OSSL_CMP_CTX *ctx, EVP_PKEY *pkey);
|
||||
int OSSL_CMP_CTX_set1_referenceValue(OSSL_CMP_CTX *ctx,
|
||||
const unsigned char *ref, int len);
|
||||
int OSSL_CMP_CTX_set1_secretValue(OSSL_CMP_CTX *ctx,
|
||||
const unsigned char *sec, int len);
|
||||
/* CMP message header and extra certificates: */
|
||||
int OSSL_CMP_CTX_set1_recipient(OSSL_CMP_CTX *ctx, const X509_NAME *name);
|
||||
int OSSL_CMP_CTX_push0_geninfo_ITAV(OSSL_CMP_CTX *ctx, OSSL_CMP_ITAV *itav);
|
||||
int OSSL_CMP_CTX_reset_geninfo_ITAVs(OSSL_CMP_CTX *ctx);
|
||||
STACK_OF(OSSL_CMP_ITAV)
|
||||
*OSSL_CMP_CTX_get0_geninfo_ITAVs(const OSSL_CMP_CTX *ctx);
|
||||
int OSSL_CMP_CTX_set1_extraCertsOut(OSSL_CMP_CTX *ctx,
|
||||
STACK_OF(X509) *extraCertsOut);
|
||||
/* certificate template: */
|
||||
int OSSL_CMP_CTX_set0_newPkey(OSSL_CMP_CTX *ctx, int priv, EVP_PKEY *pkey);
|
||||
EVP_PKEY *OSSL_CMP_CTX_get0_newPkey(const OSSL_CMP_CTX *ctx, int priv);
|
||||
int OSSL_CMP_CTX_set1_issuer(OSSL_CMP_CTX *ctx, const X509_NAME *name);
|
||||
int OSSL_CMP_CTX_set1_serialNumber(OSSL_CMP_CTX *ctx, const ASN1_INTEGER *sn);
|
||||
int OSSL_CMP_CTX_set1_subjectName(OSSL_CMP_CTX *ctx, const X509_NAME *name);
|
||||
int OSSL_CMP_CTX_push1_subjectAltName(OSSL_CMP_CTX *ctx,
|
||||
const GENERAL_NAME *name);
|
||||
int OSSL_CMP_CTX_set0_reqExtensions(OSSL_CMP_CTX *ctx, X509_EXTENSIONS *exts);
|
||||
int OSSL_CMP_CTX_reqExtensions_have_SAN(OSSL_CMP_CTX *ctx);
|
||||
int OSSL_CMP_CTX_push0_policy(OSSL_CMP_CTX *ctx, POLICYINFO *pinfo);
|
||||
int OSSL_CMP_CTX_set1_oldCert(OSSL_CMP_CTX *ctx, X509 *cert);
|
||||
int OSSL_CMP_CTX_set1_p10CSR(OSSL_CMP_CTX *ctx, const X509_REQ *csr);
|
||||
/* misc body contents: */
|
||||
int OSSL_CMP_CTX_push0_genm_ITAV(OSSL_CMP_CTX *ctx, OSSL_CMP_ITAV *itav);
|
||||
/* certificate confirmation: */
|
||||
typedef int (*OSSL_CMP_certConf_cb_t) (OSSL_CMP_CTX *ctx, X509 *cert,
|
||||
int fail_info, const char **txt);
|
||||
int OSSL_CMP_certConf_cb(OSSL_CMP_CTX *ctx, X509 *cert, int fail_info,
|
||||
const char **text);
|
||||
int OSSL_CMP_CTX_set_certConf_cb(OSSL_CMP_CTX *ctx, OSSL_CMP_certConf_cb_t cb);
|
||||
int OSSL_CMP_CTX_set_certConf_cb_arg(OSSL_CMP_CTX *ctx, void *arg);
|
||||
void *OSSL_CMP_CTX_get_certConf_cb_arg(const OSSL_CMP_CTX *ctx);
|
||||
/* result fetching: */
|
||||
int OSSL_CMP_CTX_get_status(const OSSL_CMP_CTX *ctx);
|
||||
OSSL_CMP_PKIFREETEXT *OSSL_CMP_CTX_get0_statusString(const OSSL_CMP_CTX *ctx);
|
||||
int OSSL_CMP_CTX_get_failInfoCode(const OSSL_CMP_CTX *ctx);
|
||||
# define OSSL_CMP_PKISI_BUFLEN 1024
|
||||
X509 *OSSL_CMP_CTX_get0_validatedSrvCert(const OSSL_CMP_CTX *ctx);
|
||||
X509 *OSSL_CMP_CTX_get0_newCert(const OSSL_CMP_CTX *ctx);
|
||||
STACK_OF(X509) *OSSL_CMP_CTX_get1_newChain(const OSSL_CMP_CTX *ctx);
|
||||
STACK_OF(X509) *OSSL_CMP_CTX_get1_caPubs(const OSSL_CMP_CTX *ctx);
|
||||
STACK_OF(X509) *OSSL_CMP_CTX_get1_extraCertsIn(const OSSL_CMP_CTX *ctx);
|
||||
int OSSL_CMP_CTX_set1_transactionID(OSSL_CMP_CTX *ctx,
|
||||
const ASN1_OCTET_STRING *id);
|
||||
int OSSL_CMP_CTX_set1_senderNonce(OSSL_CMP_CTX *ctx,
|
||||
const ASN1_OCTET_STRING *nonce);
|
||||
|
||||
/* from cmp_status.c */
|
||||
char *OSSL_CMP_CTX_snprint_PKIStatus(const OSSL_CMP_CTX *ctx, char *buf,
|
||||
size_t bufsize);
|
||||
char *OSSL_CMP_snprint_PKIStatusInfo(const OSSL_CMP_PKISI *statusInfo,
|
||||
char *buf, size_t bufsize);
|
||||
OSSL_CMP_PKISI *
|
||||
OSSL_CMP_STATUSINFO_new(int status, int fail_info, const char *text);
|
||||
|
||||
/* from cmp_hdr.c */
|
||||
ASN1_OCTET_STRING *OSSL_CMP_HDR_get0_transactionID(const
|
||||
OSSL_CMP_PKIHEADER *hdr);
|
||||
ASN1_OCTET_STRING *OSSL_CMP_HDR_get0_recipNonce(const OSSL_CMP_PKIHEADER *hdr);
|
||||
STACK_OF(OSSL_CMP_ITAV)
|
||||
*OSSL_CMP_HDR_get0_geninfo_ITAVs(const OSSL_CMP_PKIHEADER *hdr);
|
||||
|
||||
/* from cmp_msg.c */
|
||||
OSSL_CMP_PKIHEADER *OSSL_CMP_MSG_get0_header(const OSSL_CMP_MSG *msg);
|
||||
int OSSL_CMP_MSG_get_bodytype(const OSSL_CMP_MSG *msg);
|
||||
X509_PUBKEY *OSSL_CMP_MSG_get0_certreq_publickey(const OSSL_CMP_MSG *msg);
|
||||
int OSSL_CMP_MSG_update_transactionID(OSSL_CMP_CTX *ctx, OSSL_CMP_MSG *msg);
|
||||
int OSSL_CMP_MSG_update_recipNonce(OSSL_CMP_CTX *ctx, OSSL_CMP_MSG *msg);
|
||||
OSSL_CRMF_MSG *OSSL_CMP_CTX_setup_CRM(OSSL_CMP_CTX *ctx, int for_KUR, int rid);
|
||||
OSSL_CMP_MSG *OSSL_CMP_MSG_read(const char *file, OSSL_LIB_CTX *libctx,
|
||||
const char *propq);
|
||||
int OSSL_CMP_MSG_write(const char *file, const OSSL_CMP_MSG *msg);
|
||||
OSSL_CMP_MSG *d2i_OSSL_CMP_MSG_bio(BIO *bio, OSSL_CMP_MSG **msg);
|
||||
int i2d_OSSL_CMP_MSG_bio(BIO *bio, const OSSL_CMP_MSG *msg);
|
||||
|
||||
/* from cmp_vfy.c */
|
||||
int OSSL_CMP_validate_msg(OSSL_CMP_CTX *ctx, const OSSL_CMP_MSG *msg);
|
||||
int OSSL_CMP_validate_cert_path(const OSSL_CMP_CTX *ctx,
|
||||
X509_STORE *trusted_store, X509 *cert);
|
||||
|
||||
/* from cmp_http.c */
|
||||
# ifndef OPENSSL_NO_HTTP
|
||||
OSSL_CMP_MSG *OSSL_CMP_MSG_http_perform(OSSL_CMP_CTX *ctx,
|
||||
const OSSL_CMP_MSG *req);
|
||||
# endif
|
||||
|
||||
/* from cmp_server.c */
|
||||
typedef struct ossl_cmp_srv_ctx_st OSSL_CMP_SRV_CTX;
|
||||
OSSL_CMP_MSG *OSSL_CMP_SRV_process_request(OSSL_CMP_SRV_CTX *srv_ctx,
|
||||
const OSSL_CMP_MSG *req);
|
||||
OSSL_CMP_MSG * OSSL_CMP_CTX_server_perform(OSSL_CMP_CTX *client_ctx,
|
||||
const OSSL_CMP_MSG *req);
|
||||
OSSL_CMP_SRV_CTX *OSSL_CMP_SRV_CTX_new(OSSL_LIB_CTX *libctx, const char *propq);
|
||||
void OSSL_CMP_SRV_CTX_free(OSSL_CMP_SRV_CTX *srv_ctx);
|
||||
typedef OSSL_CMP_PKISI *(*OSSL_CMP_SRV_cert_request_cb_t)
|
||||
(OSSL_CMP_SRV_CTX *srv_ctx, const OSSL_CMP_MSG *req, int certReqId,
|
||||
const OSSL_CRMF_MSG *crm, const X509_REQ *p10cr,
|
||||
X509 **certOut, STACK_OF(X509) **chainOut, STACK_OF(X509) **caPubs);
|
||||
typedef OSSL_CMP_PKISI *(*OSSL_CMP_SRV_rr_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx,
|
||||
const OSSL_CMP_MSG *req,
|
||||
const X509_NAME *issuer,
|
||||
const ASN1_INTEGER *serial);
|
||||
typedef int (*OSSL_CMP_SRV_genm_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx,
|
||||
const OSSL_CMP_MSG *req,
|
||||
const STACK_OF(OSSL_CMP_ITAV) *in,
|
||||
STACK_OF(OSSL_CMP_ITAV) **out);
|
||||
typedef void (*OSSL_CMP_SRV_error_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx,
|
||||
const OSSL_CMP_MSG *req,
|
||||
const OSSL_CMP_PKISI *statusInfo,
|
||||
const ASN1_INTEGER *errorCode,
|
||||
const OSSL_CMP_PKIFREETEXT *errDetails);
|
||||
typedef int (*OSSL_CMP_SRV_certConf_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx,
|
||||
const OSSL_CMP_MSG *req,
|
||||
int certReqId,
|
||||
const ASN1_OCTET_STRING *certHash,
|
||||
const OSSL_CMP_PKISI *si);
|
||||
typedef int (*OSSL_CMP_SRV_pollReq_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx,
|
||||
const OSSL_CMP_MSG *req, int certReqId,
|
||||
OSSL_CMP_MSG **certReq,
|
||||
int64_t *check_after);
|
||||
int OSSL_CMP_SRV_CTX_init(OSSL_CMP_SRV_CTX *srv_ctx, void *custom_ctx,
|
||||
OSSL_CMP_SRV_cert_request_cb_t process_cert_request,
|
||||
OSSL_CMP_SRV_rr_cb_t process_rr,
|
||||
OSSL_CMP_SRV_genm_cb_t process_genm,
|
||||
OSSL_CMP_SRV_error_cb_t process_error,
|
||||
OSSL_CMP_SRV_certConf_cb_t process_certConf,
|
||||
OSSL_CMP_SRV_pollReq_cb_t process_pollReq);
|
||||
typedef int (*OSSL_CMP_SRV_delayed_delivery_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx,
|
||||
const OSSL_CMP_MSG *req);
|
||||
typedef int (*OSSL_CMP_SRV_clean_transaction_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx,
|
||||
const ASN1_OCTET_STRING *id);
|
||||
int OSSL_CMP_SRV_CTX_init_trans(OSSL_CMP_SRV_CTX *srv_ctx,
|
||||
OSSL_CMP_SRV_delayed_delivery_cb_t delay,
|
||||
OSSL_CMP_SRV_clean_transaction_cb_t clean);
|
||||
OSSL_CMP_CTX *OSSL_CMP_SRV_CTX_get0_cmp_ctx(const OSSL_CMP_SRV_CTX *srv_ctx);
|
||||
void *OSSL_CMP_SRV_CTX_get0_custom_ctx(const OSSL_CMP_SRV_CTX *srv_ctx);
|
||||
int OSSL_CMP_SRV_CTX_set_send_unprotected_errors(OSSL_CMP_SRV_CTX *srv_ctx,
|
||||
int val);
|
||||
int OSSL_CMP_SRV_CTX_set_accept_unprotected(OSSL_CMP_SRV_CTX *srv_ctx, int val);
|
||||
int OSSL_CMP_SRV_CTX_set_accept_raverified(OSSL_CMP_SRV_CTX *srv_ctx, int val);
|
||||
int OSSL_CMP_SRV_CTX_set_grant_implicit_confirm(OSSL_CMP_SRV_CTX *srv_ctx,
|
||||
int val);
|
||||
|
||||
/* from cmp_client.c */
|
||||
X509 *OSSL_CMP_exec_certreq(OSSL_CMP_CTX *ctx, int req_type,
|
||||
const OSSL_CRMF_MSG *crm);
|
||||
# define OSSL_CMP_IR 0
|
||||
# define OSSL_CMP_CR 2
|
||||
# define OSSL_CMP_P10CR 4
|
||||
# define OSSL_CMP_KUR 7
|
||||
# define OSSL_CMP_GENM 21
|
||||
# define OSSL_CMP_ERROR 23
|
||||
# define OSSL_CMP_exec_IR_ses(ctx) \
|
||||
OSSL_CMP_exec_certreq(ctx, OSSL_CMP_IR, NULL)
|
||||
# define OSSL_CMP_exec_CR_ses(ctx) \
|
||||
OSSL_CMP_exec_certreq(ctx, OSSL_CMP_CR, NULL)
|
||||
# define OSSL_CMP_exec_P10CR_ses(ctx) \
|
||||
OSSL_CMP_exec_certreq(ctx, OSSL_CMP_P10CR, NULL)
|
||||
# define OSSL_CMP_exec_KUR_ses(ctx) \
|
||||
OSSL_CMP_exec_certreq(ctx, OSSL_CMP_KUR, NULL)
|
||||
int OSSL_CMP_try_certreq(OSSL_CMP_CTX *ctx, int req_type,
|
||||
const OSSL_CRMF_MSG *crm, int *checkAfter);
|
||||
int OSSL_CMP_exec_RR_ses(OSSL_CMP_CTX *ctx);
|
||||
STACK_OF(OSSL_CMP_ITAV) *OSSL_CMP_exec_GENM_ses(OSSL_CMP_CTX *ctx);
|
||||
|
||||
/* from cmp_genm.c */
|
||||
int OSSL_CMP_get1_caCerts(OSSL_CMP_CTX *ctx, STACK_OF(X509) **out);
|
||||
int OSSL_CMP_get1_rootCaKeyUpdate(OSSL_CMP_CTX *ctx,
|
||||
const X509 *oldWithOld, X509 **newWithNew,
|
||||
X509 **newWithOld, X509 **oldWithNew);
|
||||
int OSSL_CMP_get1_crlUpdate(OSSL_CMP_CTX *ctx, const X509 *crlcert,
|
||||
const X509_CRL *last_crl,
|
||||
X509_CRL **crl);
|
||||
int OSSL_CMP_get1_certReqTemplate(OSSL_CMP_CTX *ctx,
|
||||
OSSL_CRMF_CERTTEMPLATE **certTemplate,
|
||||
OSSL_CMP_ATAVS **keySpec);
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
# endif /* !defined(OPENSSL_NO_CMP) */
|
||||
#endif /* !defined(OPENSSL_CMP_H) */
|
||||
56
thirdparty/OpenSSL-3.5.3/include/openssl/cmp_util.h
vendored
Normal file
56
thirdparty/OpenSSL-3.5.3/include/openssl/cmp_util.h
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright 2007-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright Nokia 2007-2019
|
||||
* Copyright Siemens AG 2015-2019
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef OPENSSL_CMP_UTIL_H
|
||||
# define OPENSSL_CMP_UTIL_H
|
||||
# pragma once
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
# ifndef OPENSSL_NO_CMP
|
||||
|
||||
# include <openssl/macros.h>
|
||||
# include <openssl/trace.h>
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
int OSSL_CMP_log_open(void);
|
||||
void OSSL_CMP_log_close(void);
|
||||
# define OSSL_CMP_LOG_PREFIX "CMP "
|
||||
|
||||
/*
|
||||
* generalized logging/error callback mirroring the severity levels of syslog.h
|
||||
*/
|
||||
typedef int OSSL_CMP_severity;
|
||||
# define OSSL_CMP_LOG_EMERG 0
|
||||
# define OSSL_CMP_LOG_ALERT 1
|
||||
# define OSSL_CMP_LOG_CRIT 2
|
||||
# define OSSL_CMP_LOG_ERR 3
|
||||
# define OSSL_CMP_LOG_WARNING 4
|
||||
# define OSSL_CMP_LOG_NOTICE 5
|
||||
# define OSSL_CMP_LOG_INFO 6
|
||||
# define OSSL_CMP_LOG_DEBUG 7
|
||||
# define OSSL_CMP_LOG_TRACE 8
|
||||
# define OSSL_CMP_LOG_MAX OSSL_CMP_LOG_TRACE
|
||||
typedef int (*OSSL_CMP_log_cb_t)(const char *func, const char *file, int line,
|
||||
OSSL_CMP_severity level, const char *msg);
|
||||
|
||||
int OSSL_CMP_print_to_bio(BIO *bio, const char *component, const char *file,
|
||||
int line, OSSL_CMP_severity level, const char *msg);
|
||||
/* use of the logging callback for outputting error queue */
|
||||
void OSSL_CMP_print_errors_cb(OSSL_CMP_log_cb_t log_fn);
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
# endif /* !defined(OPENSSL_NO_CMP) */
|
||||
#endif /* !defined(OPENSSL_CMP_UTIL_H) */
|
||||
134
thirdparty/OpenSSL-3.5.3/include/openssl/cmperr.h
vendored
Normal file
134
thirdparty/OpenSSL-3.5.3/include/openssl/cmperr.h
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef OPENSSL_CMPERR_H
|
||||
# define OPENSSL_CMPERR_H
|
||||
# pragma once
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
# include <openssl/symhacks.h>
|
||||
# include <openssl/cryptoerr_legacy.h>
|
||||
|
||||
|
||||
# ifndef OPENSSL_NO_CMP
|
||||
|
||||
|
||||
/*
|
||||
* CMP reason codes.
|
||||
*/
|
||||
# define CMP_R_ALGORITHM_NOT_SUPPORTED 139
|
||||
# define CMP_R_BAD_CHECKAFTER_IN_POLLREP 167
|
||||
# define CMP_R_BAD_REQUEST_ID 108
|
||||
# define CMP_R_CERTHASH_UNMATCHED 156
|
||||
# define CMP_R_CERTID_NOT_FOUND 109
|
||||
# define CMP_R_CERTIFICATE_NOT_ACCEPTED 169
|
||||
# define CMP_R_CERTIFICATE_NOT_FOUND 112
|
||||
# define CMP_R_CERTREQMSG_NOT_FOUND 157
|
||||
# define CMP_R_CERTRESPONSE_NOT_FOUND 113
|
||||
# define CMP_R_CERT_AND_KEY_DO_NOT_MATCH 114
|
||||
# define CMP_R_CHECKAFTER_OUT_OF_RANGE 181
|
||||
# define CMP_R_ENCOUNTERED_KEYUPDATEWARNING 176
|
||||
# define CMP_R_ENCOUNTERED_WAITING 162
|
||||
# define CMP_R_ERROR_CALCULATING_PROTECTION 115
|
||||
# define CMP_R_ERROR_CREATING_CERTCONF 116
|
||||
# define CMP_R_ERROR_CREATING_CERTREP 117
|
||||
# define CMP_R_ERROR_CREATING_CERTREQ 163
|
||||
# define CMP_R_ERROR_CREATING_ERROR 118
|
||||
# define CMP_R_ERROR_CREATING_GENM 119
|
||||
# define CMP_R_ERROR_CREATING_GENP 120
|
||||
# define CMP_R_ERROR_CREATING_PKICONF 122
|
||||
# define CMP_R_ERROR_CREATING_POLLREP 123
|
||||
# define CMP_R_ERROR_CREATING_POLLREQ 124
|
||||
# define CMP_R_ERROR_CREATING_RP 125
|
||||
# define CMP_R_ERROR_CREATING_RR 126
|
||||
# define CMP_R_ERROR_PARSING_PKISTATUS 107
|
||||
# define CMP_R_ERROR_PROCESSING_MESSAGE 158
|
||||
# define CMP_R_ERROR_PROTECTING_MESSAGE 127
|
||||
# define CMP_R_ERROR_SETTING_CERTHASH 128
|
||||
# define CMP_R_ERROR_UNEXPECTED_CERTCONF 160
|
||||
# define CMP_R_ERROR_VALIDATING_PROTECTION 140
|
||||
# define CMP_R_ERROR_VALIDATING_SIGNATURE 171
|
||||
# define CMP_R_EXPECTED_POLLREQ 104
|
||||
# define CMP_R_FAILED_BUILDING_OWN_CHAIN 164
|
||||
# define CMP_R_FAILED_EXTRACTING_CENTRAL_GEN_KEY 203
|
||||
# define CMP_R_FAILED_EXTRACTING_PUBKEY 141
|
||||
# define CMP_R_FAILURE_OBTAINING_RANDOM 110
|
||||
# define CMP_R_FAIL_INFO_OUT_OF_RANGE 129
|
||||
# define CMP_R_GENERATE_CERTREQTEMPLATE 197
|
||||
# define CMP_R_GENERATE_CRLSTATUS 198
|
||||
# define CMP_R_GETTING_GENP 192
|
||||
# define CMP_R_GET_ITAV 199
|
||||
# define CMP_R_INVALID_ARGS 100
|
||||
# define CMP_R_INVALID_GENP 193
|
||||
# define CMP_R_INVALID_KEYSPEC 202
|
||||
# define CMP_R_INVALID_OPTION 174
|
||||
# define CMP_R_INVALID_ROOTCAKEYUPDATE 195
|
||||
# define CMP_R_MISSING_CENTRAL_GEN_KEY 204
|
||||
# define CMP_R_MISSING_CERTID 165
|
||||
# define CMP_R_MISSING_KEY_INPUT_FOR_CREATING_PROTECTION 130
|
||||
# define CMP_R_MISSING_KEY_USAGE_DIGITALSIGNATURE 142
|
||||
# define CMP_R_MISSING_P10CSR 121
|
||||
# define CMP_R_MISSING_PBM_SECRET 166
|
||||
# define CMP_R_MISSING_PRIVATE_KEY 131
|
||||
# define CMP_R_MISSING_PRIVATE_KEY_FOR_POPO 190
|
||||
# define CMP_R_MISSING_PROTECTION 143
|
||||
# define CMP_R_MISSING_PUBLIC_KEY 183
|
||||
# define CMP_R_MISSING_REFERENCE_CERT 168
|
||||
# define CMP_R_MISSING_SECRET 178
|
||||
# define CMP_R_MISSING_SENDER_IDENTIFICATION 111
|
||||
# define CMP_R_MISSING_TRUST_ANCHOR 179
|
||||
# define CMP_R_MISSING_TRUST_STORE 144
|
||||
# define CMP_R_MULTIPLE_REQUESTS_NOT_SUPPORTED 161
|
||||
# define CMP_R_MULTIPLE_RESPONSES_NOT_SUPPORTED 170
|
||||
# define CMP_R_MULTIPLE_SAN_SOURCES 102
|
||||
# define CMP_R_NO_STDIO 194
|
||||
# define CMP_R_NO_SUITABLE_SENDER_CERT 145
|
||||
# define CMP_R_NULL_ARGUMENT 103
|
||||
# define CMP_R_PKIBODY_ERROR 146
|
||||
# define CMP_R_PKISTATUSINFO_NOT_FOUND 132
|
||||
# define CMP_R_POLLING_FAILED 172
|
||||
# define CMP_R_POTENTIALLY_INVALID_CERTIFICATE 147
|
||||
# define CMP_R_RECEIVED_ERROR 180
|
||||
# define CMP_R_RECIPNONCE_UNMATCHED 148
|
||||
# define CMP_R_REQUEST_NOT_ACCEPTED 149
|
||||
# define CMP_R_REQUEST_REJECTED_BY_SERVER 182
|
||||
# define CMP_R_SENDER_GENERALNAME_TYPE_NOT_SUPPORTED 150
|
||||
# define CMP_R_SRVCERT_DOES_NOT_VALIDATE_MSG 151
|
||||
# define CMP_R_TOTAL_TIMEOUT 184
|
||||
# define CMP_R_TRANSACTIONID_UNMATCHED 152
|
||||
# define CMP_R_TRANSFER_ERROR 159
|
||||
# define CMP_R_UNCLEAN_CTX 191
|
||||
# define CMP_R_UNEXPECTED_CENTRAL_GEN_KEY 205
|
||||
# define CMP_R_UNEXPECTED_CERTPROFILE 196
|
||||
# define CMP_R_UNEXPECTED_CRLSTATUSLIST 201
|
||||
# define CMP_R_UNEXPECTED_PKIBODY 133
|
||||
# define CMP_R_UNEXPECTED_PKISTATUS 185
|
||||
# define CMP_R_UNEXPECTED_POLLREQ 105
|
||||
# define CMP_R_UNEXPECTED_PVNO 153
|
||||
# define CMP_R_UNEXPECTED_SENDER 106
|
||||
# define CMP_R_UNKNOWN_ALGORITHM_ID 134
|
||||
# define CMP_R_UNKNOWN_CERT_TYPE 135
|
||||
# define CMP_R_UNKNOWN_CRL_ISSUER 200
|
||||
# define CMP_R_UNKNOWN_PKISTATUS 186
|
||||
# define CMP_R_UNSUPPORTED_ALGORITHM 136
|
||||
# define CMP_R_UNSUPPORTED_KEY_TYPE 137
|
||||
# define CMP_R_UNSUPPORTED_PKIBODY 101
|
||||
# define CMP_R_UNSUPPORTED_PROTECTION_ALG_DHBASEDMAC 154
|
||||
# define CMP_R_VALUE_TOO_LARGE 175
|
||||
# define CMP_R_VALUE_TOO_SMALL 177
|
||||
# define CMP_R_WRONG_ALGORITHM_OID 138
|
||||
# define CMP_R_WRONG_CERTID 189
|
||||
# define CMP_R_WRONG_CERTID_IN_RP 187
|
||||
# define CMP_R_WRONG_PBM_VALUE 155
|
||||
# define CMP_R_WRONG_RP_COMPONENT_COUNT 188
|
||||
# define CMP_R_WRONG_SERIAL_IN_RP 173
|
||||
|
||||
# endif
|
||||
#endif
|
||||
511
thirdparty/OpenSSL-3.5.3/include/openssl/cms.h
vendored
Normal file
511
thirdparty/OpenSSL-3.5.3/include/openssl/cms.h
vendored
Normal file
@@ -0,0 +1,511 @@
|
||||
/*
|
||||
* WARNING: do not edit!
|
||||
* Generated by makefile from include\openssl\cms.h.in
|
||||
*
|
||||
* Copyright 2008-2025 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef OPENSSL_CMS_H
|
||||
# define OPENSSL_CMS_H
|
||||
# pragma once
|
||||
|
||||
# include <openssl/macros.h>
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
# define HEADER_CMS_H
|
||||
# endif
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_CMS
|
||||
# include <openssl/x509.h>
|
||||
# include <openssl/x509v3.h>
|
||||
# include <openssl/cmserr.h>
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
typedef struct CMS_EnvelopedData_st CMS_EnvelopedData;
|
||||
typedef struct CMS_ContentInfo_st CMS_ContentInfo;
|
||||
typedef struct CMS_SignerInfo_st CMS_SignerInfo;
|
||||
typedef struct CMS_SignedData_st CMS_SignedData;
|
||||
typedef struct CMS_CertificateChoices CMS_CertificateChoices;
|
||||
typedef struct CMS_RevocationInfoChoice_st CMS_RevocationInfoChoice;
|
||||
typedef struct CMS_RecipientInfo_st CMS_RecipientInfo;
|
||||
typedef struct CMS_ReceiptRequest_st CMS_ReceiptRequest;
|
||||
typedef struct CMS_Receipt_st CMS_Receipt;
|
||||
typedef struct CMS_RecipientEncryptedKey_st CMS_RecipientEncryptedKey;
|
||||
typedef struct CMS_OtherKeyAttribute_st CMS_OtherKeyAttribute;
|
||||
|
||||
SKM_DEFINE_STACK_OF_INTERNAL(CMS_SignerInfo, CMS_SignerInfo, CMS_SignerInfo)
|
||||
#define sk_CMS_SignerInfo_num(sk) OPENSSL_sk_num(ossl_check_const_CMS_SignerInfo_sk_type(sk))
|
||||
#define sk_CMS_SignerInfo_value(sk, idx) ((CMS_SignerInfo *)OPENSSL_sk_value(ossl_check_const_CMS_SignerInfo_sk_type(sk), (idx)))
|
||||
#define sk_CMS_SignerInfo_new(cmp) ((STACK_OF(CMS_SignerInfo) *)OPENSSL_sk_new(ossl_check_CMS_SignerInfo_compfunc_type(cmp)))
|
||||
#define sk_CMS_SignerInfo_new_null() ((STACK_OF(CMS_SignerInfo) *)OPENSSL_sk_new_null())
|
||||
#define sk_CMS_SignerInfo_new_reserve(cmp, n) ((STACK_OF(CMS_SignerInfo) *)OPENSSL_sk_new_reserve(ossl_check_CMS_SignerInfo_compfunc_type(cmp), (n)))
|
||||
#define sk_CMS_SignerInfo_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_CMS_SignerInfo_sk_type(sk), (n))
|
||||
#define sk_CMS_SignerInfo_free(sk) OPENSSL_sk_free(ossl_check_CMS_SignerInfo_sk_type(sk))
|
||||
#define sk_CMS_SignerInfo_zero(sk) OPENSSL_sk_zero(ossl_check_CMS_SignerInfo_sk_type(sk))
|
||||
#define sk_CMS_SignerInfo_delete(sk, i) ((CMS_SignerInfo *)OPENSSL_sk_delete(ossl_check_CMS_SignerInfo_sk_type(sk), (i)))
|
||||
#define sk_CMS_SignerInfo_delete_ptr(sk, ptr) ((CMS_SignerInfo *)OPENSSL_sk_delete_ptr(ossl_check_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_type(ptr)))
|
||||
#define sk_CMS_SignerInfo_push(sk, ptr) OPENSSL_sk_push(ossl_check_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_type(ptr))
|
||||
#define sk_CMS_SignerInfo_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_type(ptr))
|
||||
#define sk_CMS_SignerInfo_pop(sk) ((CMS_SignerInfo *)OPENSSL_sk_pop(ossl_check_CMS_SignerInfo_sk_type(sk)))
|
||||
#define sk_CMS_SignerInfo_shift(sk) ((CMS_SignerInfo *)OPENSSL_sk_shift(ossl_check_CMS_SignerInfo_sk_type(sk)))
|
||||
#define sk_CMS_SignerInfo_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_CMS_SignerInfo_sk_type(sk),ossl_check_CMS_SignerInfo_freefunc_type(freefunc))
|
||||
#define sk_CMS_SignerInfo_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_type(ptr), (idx))
|
||||
#define sk_CMS_SignerInfo_set(sk, idx, ptr) ((CMS_SignerInfo *)OPENSSL_sk_set(ossl_check_CMS_SignerInfo_sk_type(sk), (idx), ossl_check_CMS_SignerInfo_type(ptr)))
|
||||
#define sk_CMS_SignerInfo_find(sk, ptr) OPENSSL_sk_find(ossl_check_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_type(ptr))
|
||||
#define sk_CMS_SignerInfo_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_type(ptr))
|
||||
#define sk_CMS_SignerInfo_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_type(ptr), pnum)
|
||||
#define sk_CMS_SignerInfo_sort(sk) OPENSSL_sk_sort(ossl_check_CMS_SignerInfo_sk_type(sk))
|
||||
#define sk_CMS_SignerInfo_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_CMS_SignerInfo_sk_type(sk))
|
||||
#define sk_CMS_SignerInfo_dup(sk) ((STACK_OF(CMS_SignerInfo) *)OPENSSL_sk_dup(ossl_check_const_CMS_SignerInfo_sk_type(sk)))
|
||||
#define sk_CMS_SignerInfo_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(CMS_SignerInfo) *)OPENSSL_sk_deep_copy(ossl_check_const_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_copyfunc_type(copyfunc), ossl_check_CMS_SignerInfo_freefunc_type(freefunc)))
|
||||
#define sk_CMS_SignerInfo_set_cmp_func(sk, cmp) ((sk_CMS_SignerInfo_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_compfunc_type(cmp)))
|
||||
SKM_DEFINE_STACK_OF_INTERNAL(CMS_RecipientEncryptedKey, CMS_RecipientEncryptedKey, CMS_RecipientEncryptedKey)
|
||||
#define sk_CMS_RecipientEncryptedKey_num(sk) OPENSSL_sk_num(ossl_check_const_CMS_RecipientEncryptedKey_sk_type(sk))
|
||||
#define sk_CMS_RecipientEncryptedKey_value(sk, idx) ((CMS_RecipientEncryptedKey *)OPENSSL_sk_value(ossl_check_const_CMS_RecipientEncryptedKey_sk_type(sk), (idx)))
|
||||
#define sk_CMS_RecipientEncryptedKey_new(cmp) ((STACK_OF(CMS_RecipientEncryptedKey) *)OPENSSL_sk_new(ossl_check_CMS_RecipientEncryptedKey_compfunc_type(cmp)))
|
||||
#define sk_CMS_RecipientEncryptedKey_new_null() ((STACK_OF(CMS_RecipientEncryptedKey) *)OPENSSL_sk_new_null())
|
||||
#define sk_CMS_RecipientEncryptedKey_new_reserve(cmp, n) ((STACK_OF(CMS_RecipientEncryptedKey) *)OPENSSL_sk_new_reserve(ossl_check_CMS_RecipientEncryptedKey_compfunc_type(cmp), (n)))
|
||||
#define sk_CMS_RecipientEncryptedKey_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), (n))
|
||||
#define sk_CMS_RecipientEncryptedKey_free(sk) OPENSSL_sk_free(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk))
|
||||
#define sk_CMS_RecipientEncryptedKey_zero(sk) OPENSSL_sk_zero(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk))
|
||||
#define sk_CMS_RecipientEncryptedKey_delete(sk, i) ((CMS_RecipientEncryptedKey *)OPENSSL_sk_delete(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), (i)))
|
||||
#define sk_CMS_RecipientEncryptedKey_delete_ptr(sk, ptr) ((CMS_RecipientEncryptedKey *)OPENSSL_sk_delete_ptr(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_type(ptr)))
|
||||
#define sk_CMS_RecipientEncryptedKey_push(sk, ptr) OPENSSL_sk_push(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_type(ptr))
|
||||
#define sk_CMS_RecipientEncryptedKey_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_type(ptr))
|
||||
#define sk_CMS_RecipientEncryptedKey_pop(sk) ((CMS_RecipientEncryptedKey *)OPENSSL_sk_pop(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk)))
|
||||
#define sk_CMS_RecipientEncryptedKey_shift(sk) ((CMS_RecipientEncryptedKey *)OPENSSL_sk_shift(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk)))
|
||||
#define sk_CMS_RecipientEncryptedKey_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk),ossl_check_CMS_RecipientEncryptedKey_freefunc_type(freefunc))
|
||||
#define sk_CMS_RecipientEncryptedKey_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_type(ptr), (idx))
|
||||
#define sk_CMS_RecipientEncryptedKey_set(sk, idx, ptr) ((CMS_RecipientEncryptedKey *)OPENSSL_sk_set(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), (idx), ossl_check_CMS_RecipientEncryptedKey_type(ptr)))
|
||||
#define sk_CMS_RecipientEncryptedKey_find(sk, ptr) OPENSSL_sk_find(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_type(ptr))
|
||||
#define sk_CMS_RecipientEncryptedKey_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_type(ptr))
|
||||
#define sk_CMS_RecipientEncryptedKey_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_type(ptr), pnum)
|
||||
#define sk_CMS_RecipientEncryptedKey_sort(sk) OPENSSL_sk_sort(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk))
|
||||
#define sk_CMS_RecipientEncryptedKey_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_CMS_RecipientEncryptedKey_sk_type(sk))
|
||||
#define sk_CMS_RecipientEncryptedKey_dup(sk) ((STACK_OF(CMS_RecipientEncryptedKey) *)OPENSSL_sk_dup(ossl_check_const_CMS_RecipientEncryptedKey_sk_type(sk)))
|
||||
#define sk_CMS_RecipientEncryptedKey_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(CMS_RecipientEncryptedKey) *)OPENSSL_sk_deep_copy(ossl_check_const_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_copyfunc_type(copyfunc), ossl_check_CMS_RecipientEncryptedKey_freefunc_type(freefunc)))
|
||||
#define sk_CMS_RecipientEncryptedKey_set_cmp_func(sk, cmp) ((sk_CMS_RecipientEncryptedKey_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_compfunc_type(cmp)))
|
||||
SKM_DEFINE_STACK_OF_INTERNAL(CMS_RecipientInfo, CMS_RecipientInfo, CMS_RecipientInfo)
|
||||
#define sk_CMS_RecipientInfo_num(sk) OPENSSL_sk_num(ossl_check_const_CMS_RecipientInfo_sk_type(sk))
|
||||
#define sk_CMS_RecipientInfo_value(sk, idx) ((CMS_RecipientInfo *)OPENSSL_sk_value(ossl_check_const_CMS_RecipientInfo_sk_type(sk), (idx)))
|
||||
#define sk_CMS_RecipientInfo_new(cmp) ((STACK_OF(CMS_RecipientInfo) *)OPENSSL_sk_new(ossl_check_CMS_RecipientInfo_compfunc_type(cmp)))
|
||||
#define sk_CMS_RecipientInfo_new_null() ((STACK_OF(CMS_RecipientInfo) *)OPENSSL_sk_new_null())
|
||||
#define sk_CMS_RecipientInfo_new_reserve(cmp, n) ((STACK_OF(CMS_RecipientInfo) *)OPENSSL_sk_new_reserve(ossl_check_CMS_RecipientInfo_compfunc_type(cmp), (n)))
|
||||
#define sk_CMS_RecipientInfo_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_CMS_RecipientInfo_sk_type(sk), (n))
|
||||
#define sk_CMS_RecipientInfo_free(sk) OPENSSL_sk_free(ossl_check_CMS_RecipientInfo_sk_type(sk))
|
||||
#define sk_CMS_RecipientInfo_zero(sk) OPENSSL_sk_zero(ossl_check_CMS_RecipientInfo_sk_type(sk))
|
||||
#define sk_CMS_RecipientInfo_delete(sk, i) ((CMS_RecipientInfo *)OPENSSL_sk_delete(ossl_check_CMS_RecipientInfo_sk_type(sk), (i)))
|
||||
#define sk_CMS_RecipientInfo_delete_ptr(sk, ptr) ((CMS_RecipientInfo *)OPENSSL_sk_delete_ptr(ossl_check_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_type(ptr)))
|
||||
#define sk_CMS_RecipientInfo_push(sk, ptr) OPENSSL_sk_push(ossl_check_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_type(ptr))
|
||||
#define sk_CMS_RecipientInfo_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_type(ptr))
|
||||
#define sk_CMS_RecipientInfo_pop(sk) ((CMS_RecipientInfo *)OPENSSL_sk_pop(ossl_check_CMS_RecipientInfo_sk_type(sk)))
|
||||
#define sk_CMS_RecipientInfo_shift(sk) ((CMS_RecipientInfo *)OPENSSL_sk_shift(ossl_check_CMS_RecipientInfo_sk_type(sk)))
|
||||
#define sk_CMS_RecipientInfo_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_CMS_RecipientInfo_sk_type(sk),ossl_check_CMS_RecipientInfo_freefunc_type(freefunc))
|
||||
#define sk_CMS_RecipientInfo_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_type(ptr), (idx))
|
||||
#define sk_CMS_RecipientInfo_set(sk, idx, ptr) ((CMS_RecipientInfo *)OPENSSL_sk_set(ossl_check_CMS_RecipientInfo_sk_type(sk), (idx), ossl_check_CMS_RecipientInfo_type(ptr)))
|
||||
#define sk_CMS_RecipientInfo_find(sk, ptr) OPENSSL_sk_find(ossl_check_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_type(ptr))
|
||||
#define sk_CMS_RecipientInfo_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_type(ptr))
|
||||
#define sk_CMS_RecipientInfo_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_type(ptr), pnum)
|
||||
#define sk_CMS_RecipientInfo_sort(sk) OPENSSL_sk_sort(ossl_check_CMS_RecipientInfo_sk_type(sk))
|
||||
#define sk_CMS_RecipientInfo_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_CMS_RecipientInfo_sk_type(sk))
|
||||
#define sk_CMS_RecipientInfo_dup(sk) ((STACK_OF(CMS_RecipientInfo) *)OPENSSL_sk_dup(ossl_check_const_CMS_RecipientInfo_sk_type(sk)))
|
||||
#define sk_CMS_RecipientInfo_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(CMS_RecipientInfo) *)OPENSSL_sk_deep_copy(ossl_check_const_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_copyfunc_type(copyfunc), ossl_check_CMS_RecipientInfo_freefunc_type(freefunc)))
|
||||
#define sk_CMS_RecipientInfo_set_cmp_func(sk, cmp) ((sk_CMS_RecipientInfo_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_compfunc_type(cmp)))
|
||||
SKM_DEFINE_STACK_OF_INTERNAL(CMS_RevocationInfoChoice, CMS_RevocationInfoChoice, CMS_RevocationInfoChoice)
|
||||
#define sk_CMS_RevocationInfoChoice_num(sk) OPENSSL_sk_num(ossl_check_const_CMS_RevocationInfoChoice_sk_type(sk))
|
||||
#define sk_CMS_RevocationInfoChoice_value(sk, idx) ((CMS_RevocationInfoChoice *)OPENSSL_sk_value(ossl_check_const_CMS_RevocationInfoChoice_sk_type(sk), (idx)))
|
||||
#define sk_CMS_RevocationInfoChoice_new(cmp) ((STACK_OF(CMS_RevocationInfoChoice) *)OPENSSL_sk_new(ossl_check_CMS_RevocationInfoChoice_compfunc_type(cmp)))
|
||||
#define sk_CMS_RevocationInfoChoice_new_null() ((STACK_OF(CMS_RevocationInfoChoice) *)OPENSSL_sk_new_null())
|
||||
#define sk_CMS_RevocationInfoChoice_new_reserve(cmp, n) ((STACK_OF(CMS_RevocationInfoChoice) *)OPENSSL_sk_new_reserve(ossl_check_CMS_RevocationInfoChoice_compfunc_type(cmp), (n)))
|
||||
#define sk_CMS_RevocationInfoChoice_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), (n))
|
||||
#define sk_CMS_RevocationInfoChoice_free(sk) OPENSSL_sk_free(ossl_check_CMS_RevocationInfoChoice_sk_type(sk))
|
||||
#define sk_CMS_RevocationInfoChoice_zero(sk) OPENSSL_sk_zero(ossl_check_CMS_RevocationInfoChoice_sk_type(sk))
|
||||
#define sk_CMS_RevocationInfoChoice_delete(sk, i) ((CMS_RevocationInfoChoice *)OPENSSL_sk_delete(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), (i)))
|
||||
#define sk_CMS_RevocationInfoChoice_delete_ptr(sk, ptr) ((CMS_RevocationInfoChoice *)OPENSSL_sk_delete_ptr(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_type(ptr)))
|
||||
#define sk_CMS_RevocationInfoChoice_push(sk, ptr) OPENSSL_sk_push(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_type(ptr))
|
||||
#define sk_CMS_RevocationInfoChoice_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_type(ptr))
|
||||
#define sk_CMS_RevocationInfoChoice_pop(sk) ((CMS_RevocationInfoChoice *)OPENSSL_sk_pop(ossl_check_CMS_RevocationInfoChoice_sk_type(sk)))
|
||||
#define sk_CMS_RevocationInfoChoice_shift(sk) ((CMS_RevocationInfoChoice *)OPENSSL_sk_shift(ossl_check_CMS_RevocationInfoChoice_sk_type(sk)))
|
||||
#define sk_CMS_RevocationInfoChoice_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_CMS_RevocationInfoChoice_sk_type(sk),ossl_check_CMS_RevocationInfoChoice_freefunc_type(freefunc))
|
||||
#define sk_CMS_RevocationInfoChoice_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_type(ptr), (idx))
|
||||
#define sk_CMS_RevocationInfoChoice_set(sk, idx, ptr) ((CMS_RevocationInfoChoice *)OPENSSL_sk_set(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), (idx), ossl_check_CMS_RevocationInfoChoice_type(ptr)))
|
||||
#define sk_CMS_RevocationInfoChoice_find(sk, ptr) OPENSSL_sk_find(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_type(ptr))
|
||||
#define sk_CMS_RevocationInfoChoice_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_type(ptr))
|
||||
#define sk_CMS_RevocationInfoChoice_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_type(ptr), pnum)
|
||||
#define sk_CMS_RevocationInfoChoice_sort(sk) OPENSSL_sk_sort(ossl_check_CMS_RevocationInfoChoice_sk_type(sk))
|
||||
#define sk_CMS_RevocationInfoChoice_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_CMS_RevocationInfoChoice_sk_type(sk))
|
||||
#define sk_CMS_RevocationInfoChoice_dup(sk) ((STACK_OF(CMS_RevocationInfoChoice) *)OPENSSL_sk_dup(ossl_check_const_CMS_RevocationInfoChoice_sk_type(sk)))
|
||||
#define sk_CMS_RevocationInfoChoice_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(CMS_RevocationInfoChoice) *)OPENSSL_sk_deep_copy(ossl_check_const_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_copyfunc_type(copyfunc), ossl_check_CMS_RevocationInfoChoice_freefunc_type(freefunc)))
|
||||
#define sk_CMS_RevocationInfoChoice_set_cmp_func(sk, cmp) ((sk_CMS_RevocationInfoChoice_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_compfunc_type(cmp)))
|
||||
|
||||
|
||||
DECLARE_ASN1_ITEM(CMS_EnvelopedData)
|
||||
DECLARE_ASN1_ALLOC_FUNCTIONS(CMS_SignedData)
|
||||
DECLARE_ASN1_FUNCTIONS(CMS_ContentInfo)
|
||||
DECLARE_ASN1_FUNCTIONS(CMS_ReceiptRequest)
|
||||
DECLARE_ASN1_PRINT_FUNCTION(CMS_ContentInfo)
|
||||
|
||||
DECLARE_ASN1_DUP_FUNCTION(CMS_EnvelopedData)
|
||||
|
||||
CMS_ContentInfo *CMS_ContentInfo_new_ex(OSSL_LIB_CTX *libctx, const char *propq);
|
||||
|
||||
# define CMS_SIGNERINFO_ISSUER_SERIAL 0
|
||||
# define CMS_SIGNERINFO_KEYIDENTIFIER 1
|
||||
|
||||
# define CMS_RECIPINFO_NONE -1
|
||||
# define CMS_RECIPINFO_TRANS 0
|
||||
# define CMS_RECIPINFO_AGREE 1
|
||||
# define CMS_RECIPINFO_KEK 2
|
||||
# define CMS_RECIPINFO_PASS 3
|
||||
# define CMS_RECIPINFO_OTHER 4
|
||||
|
||||
/* S/MIME related flags */
|
||||
|
||||
# define CMS_TEXT 0x1
|
||||
# define CMS_NOCERTS 0x2
|
||||
# define CMS_NO_CONTENT_VERIFY 0x4
|
||||
# define CMS_NO_ATTR_VERIFY 0x8
|
||||
# define CMS_NOSIGS \
|
||||
(CMS_NO_CONTENT_VERIFY|CMS_NO_ATTR_VERIFY)
|
||||
# define CMS_NOINTERN 0x10
|
||||
# define CMS_NO_SIGNER_CERT_VERIFY 0x20
|
||||
# define CMS_NOVERIFY 0x20
|
||||
# define CMS_DETACHED 0x40
|
||||
# define CMS_BINARY 0x80
|
||||
# define CMS_NOATTR 0x100
|
||||
# define CMS_NOSMIMECAP 0x200
|
||||
# define CMS_NOOLDMIMETYPE 0x400
|
||||
# define CMS_CRLFEOL 0x800
|
||||
# define CMS_STREAM 0x1000
|
||||
# define CMS_NOCRL 0x2000
|
||||
# define CMS_PARTIAL 0x4000
|
||||
# define CMS_REUSE_DIGEST 0x8000
|
||||
# define CMS_USE_KEYID 0x10000
|
||||
# define CMS_DEBUG_DECRYPT 0x20000
|
||||
# define CMS_KEY_PARAM 0x40000
|
||||
# define CMS_ASCIICRLF 0x80000
|
||||
# define CMS_CADES 0x100000
|
||||
# define CMS_USE_ORIGINATOR_KEYID 0x200000
|
||||
# define CMS_NO_SIGNING_TIME 0x400000
|
||||
|
||||
const ASN1_OBJECT *CMS_get0_type(const CMS_ContentInfo *cms);
|
||||
|
||||
BIO *CMS_dataInit(CMS_ContentInfo *cms, BIO *icont);
|
||||
int CMS_dataFinal(CMS_ContentInfo *cms, BIO *bio);
|
||||
|
||||
ASN1_OCTET_STRING **CMS_get0_content(CMS_ContentInfo *cms);
|
||||
int CMS_is_detached(CMS_ContentInfo *cms);
|
||||
int CMS_set_detached(CMS_ContentInfo *cms, int detached);
|
||||
|
||||
# ifdef OPENSSL_PEM_H
|
||||
DECLARE_PEM_rw(CMS, CMS_ContentInfo)
|
||||
# endif
|
||||
int CMS_stream(unsigned char ***boundary, CMS_ContentInfo *cms);
|
||||
CMS_ContentInfo *d2i_CMS_bio(BIO *bp, CMS_ContentInfo **cms);
|
||||
int i2d_CMS_bio(BIO *bp, CMS_ContentInfo *cms);
|
||||
|
||||
BIO *BIO_new_CMS(BIO *out, CMS_ContentInfo *cms);
|
||||
int i2d_CMS_bio_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int flags);
|
||||
int PEM_write_bio_CMS_stream(BIO *out, CMS_ContentInfo *cms, BIO *in,
|
||||
int flags);
|
||||
CMS_ContentInfo *SMIME_read_CMS(BIO *bio, BIO **bcont);
|
||||
CMS_ContentInfo *SMIME_read_CMS_ex(BIO *bio, int flags, BIO **bcont, CMS_ContentInfo **ci);
|
||||
int SMIME_write_CMS(BIO *bio, CMS_ContentInfo *cms, BIO *data, int flags);
|
||||
|
||||
int CMS_final(CMS_ContentInfo *cms, BIO *data, BIO *dcont,
|
||||
unsigned int flags);
|
||||
int CMS_final_digest(CMS_ContentInfo *cms,
|
||||
const unsigned char *md, unsigned int mdlen, BIO *dcont,
|
||||
unsigned int flags);
|
||||
|
||||
CMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey,
|
||||
STACK_OF(X509) *certs, BIO *data,
|
||||
unsigned int flags);
|
||||
CMS_ContentInfo *CMS_sign_ex(X509 *signcert, EVP_PKEY *pkey,
|
||||
STACK_OF(X509) *certs, BIO *data,
|
||||
unsigned int flags, OSSL_LIB_CTX *libctx,
|
||||
const char *propq);
|
||||
|
||||
CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si,
|
||||
X509 *signcert, EVP_PKEY *pkey,
|
||||
STACK_OF(X509) *certs, unsigned int flags);
|
||||
|
||||
int CMS_data(CMS_ContentInfo *cms, BIO *out, unsigned int flags);
|
||||
CMS_ContentInfo *CMS_data_create(BIO *in, unsigned int flags);
|
||||
CMS_ContentInfo *CMS_data_create_ex(BIO *in, unsigned int flags,
|
||||
OSSL_LIB_CTX *libctx, const char *propq);
|
||||
|
||||
int CMS_digest_verify(CMS_ContentInfo *cms, BIO *dcont, BIO *out,
|
||||
unsigned int flags);
|
||||
CMS_ContentInfo *CMS_digest_create(BIO *in, const EVP_MD *md,
|
||||
unsigned int flags);
|
||||
CMS_ContentInfo *CMS_digest_create_ex(BIO *in, const EVP_MD *md,
|
||||
unsigned int flags, OSSL_LIB_CTX *libctx,
|
||||
const char *propq);
|
||||
|
||||
int CMS_EncryptedData_decrypt(CMS_ContentInfo *cms,
|
||||
const unsigned char *key, size_t keylen,
|
||||
BIO *dcont, BIO *out, unsigned int flags);
|
||||
CMS_ContentInfo *CMS_EncryptedData_encrypt(BIO *in, const EVP_CIPHER *cipher,
|
||||
const unsigned char *key,
|
||||
size_t keylen, unsigned int flags);
|
||||
CMS_ContentInfo *CMS_EncryptedData_encrypt_ex(BIO *in, const EVP_CIPHER *cipher,
|
||||
const unsigned char *key,
|
||||
size_t keylen, unsigned int flags,
|
||||
OSSL_LIB_CTX *libctx,
|
||||
const char *propq);
|
||||
|
||||
int CMS_EncryptedData_set1_key(CMS_ContentInfo *cms, const EVP_CIPHER *ciph,
|
||||
const unsigned char *key, size_t keylen);
|
||||
|
||||
int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs,
|
||||
X509_STORE *store, BIO *dcont, BIO *out, unsigned int flags);
|
||||
|
||||
int CMS_verify_receipt(CMS_ContentInfo *rcms, CMS_ContentInfo *ocms,
|
||||
STACK_OF(X509) *certs,
|
||||
X509_STORE *store, unsigned int flags);
|
||||
|
||||
STACK_OF(X509) *CMS_get0_signers(CMS_ContentInfo *cms);
|
||||
|
||||
CMS_ContentInfo *CMS_encrypt(STACK_OF(X509) *certs, BIO *in,
|
||||
const EVP_CIPHER *cipher, unsigned int flags);
|
||||
CMS_ContentInfo *CMS_encrypt_ex(STACK_OF(X509) *certs, BIO *in,
|
||||
const EVP_CIPHER *cipher, unsigned int flags,
|
||||
OSSL_LIB_CTX *libctx, const char *propq);
|
||||
|
||||
int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pkey, X509 *cert,
|
||||
BIO *dcont, BIO *out, unsigned int flags);
|
||||
|
||||
int CMS_decrypt_set1_pkey(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert);
|
||||
int CMS_decrypt_set1_pkey_and_peer(CMS_ContentInfo *cms, EVP_PKEY *pk,
|
||||
X509 *cert, X509 *peer);
|
||||
int CMS_decrypt_set1_key(CMS_ContentInfo *cms,
|
||||
unsigned char *key, size_t keylen,
|
||||
const unsigned char *id, size_t idlen);
|
||||
int CMS_decrypt_set1_password(CMS_ContentInfo *cms,
|
||||
unsigned char *pass, ossl_ssize_t passlen);
|
||||
|
||||
STACK_OF(CMS_RecipientInfo) *CMS_get0_RecipientInfos(CMS_ContentInfo *cms);
|
||||
int CMS_RecipientInfo_type(CMS_RecipientInfo *ri);
|
||||
EVP_PKEY_CTX *CMS_RecipientInfo_get0_pkey_ctx(CMS_RecipientInfo *ri);
|
||||
CMS_ContentInfo *CMS_AuthEnvelopedData_create(const EVP_CIPHER *cipher);
|
||||
CMS_ContentInfo *
|
||||
CMS_AuthEnvelopedData_create_ex(const EVP_CIPHER *cipher, OSSL_LIB_CTX *libctx,
|
||||
const char *propq);
|
||||
CMS_ContentInfo *CMS_EnvelopedData_create(const EVP_CIPHER *cipher);
|
||||
CMS_ContentInfo *CMS_EnvelopedData_create_ex(const EVP_CIPHER *cipher,
|
||||
OSSL_LIB_CTX *libctx,
|
||||
const char *propq);
|
||||
BIO *CMS_EnvelopedData_decrypt(CMS_EnvelopedData *env, BIO *detached_data,
|
||||
EVP_PKEY *pkey, X509 *cert,
|
||||
ASN1_OCTET_STRING *secret, unsigned int flags,
|
||||
OSSL_LIB_CTX *libctx, const char *propq);
|
||||
|
||||
CMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms,
|
||||
X509 *recip, unsigned int flags);
|
||||
CMS_RecipientInfo *CMS_add1_recipient(CMS_ContentInfo *cms, X509 *recip,
|
||||
EVP_PKEY *originatorPrivKey, X509 * originator, unsigned int flags);
|
||||
int CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pkey);
|
||||
int CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert);
|
||||
int CMS_RecipientInfo_ktri_get0_algs(CMS_RecipientInfo *ri,
|
||||
EVP_PKEY **pk, X509 **recip,
|
||||
X509_ALGOR **palg);
|
||||
int CMS_RecipientInfo_ktri_get0_signer_id(CMS_RecipientInfo *ri,
|
||||
ASN1_OCTET_STRING **keyid,
|
||||
X509_NAME **issuer,
|
||||
ASN1_INTEGER **sno);
|
||||
|
||||
CMS_RecipientInfo *CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid,
|
||||
unsigned char *key, size_t keylen,
|
||||
unsigned char *id, size_t idlen,
|
||||
ASN1_GENERALIZEDTIME *date,
|
||||
ASN1_OBJECT *otherTypeId,
|
||||
ASN1_TYPE *otherType);
|
||||
|
||||
int CMS_RecipientInfo_kekri_get0_id(CMS_RecipientInfo *ri,
|
||||
X509_ALGOR **palg,
|
||||
ASN1_OCTET_STRING **pid,
|
||||
ASN1_GENERALIZEDTIME **pdate,
|
||||
ASN1_OBJECT **potherid,
|
||||
ASN1_TYPE **pothertype);
|
||||
|
||||
int CMS_RecipientInfo_set0_key(CMS_RecipientInfo *ri,
|
||||
unsigned char *key, size_t keylen);
|
||||
|
||||
int CMS_RecipientInfo_kekri_id_cmp(CMS_RecipientInfo *ri,
|
||||
const unsigned char *id, size_t idlen);
|
||||
|
||||
int CMS_RecipientInfo_set0_password(CMS_RecipientInfo *ri,
|
||||
unsigned char *pass,
|
||||
ossl_ssize_t passlen);
|
||||
|
||||
CMS_RecipientInfo *CMS_add0_recipient_password(CMS_ContentInfo *cms,
|
||||
int iter, int wrap_nid,
|
||||
int pbe_nid,
|
||||
unsigned char *pass,
|
||||
ossl_ssize_t passlen,
|
||||
const EVP_CIPHER *kekciph);
|
||||
|
||||
int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri);
|
||||
int CMS_RecipientInfo_encrypt(const CMS_ContentInfo *cms, CMS_RecipientInfo *ri);
|
||||
|
||||
int CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out,
|
||||
unsigned int flags);
|
||||
CMS_ContentInfo *CMS_compress(BIO *in, int comp_nid, unsigned int flags);
|
||||
|
||||
int CMS_set1_eContentType(CMS_ContentInfo *cms, const ASN1_OBJECT *oid);
|
||||
const ASN1_OBJECT *CMS_get0_eContentType(CMS_ContentInfo *cms);
|
||||
|
||||
CMS_CertificateChoices *CMS_add0_CertificateChoices(CMS_ContentInfo *cms);
|
||||
int CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert);
|
||||
int CMS_add1_cert(CMS_ContentInfo *cms, X509 *cert);
|
||||
STACK_OF(X509) *CMS_get1_certs(CMS_ContentInfo *cms);
|
||||
|
||||
CMS_RevocationInfoChoice *CMS_add0_RevocationInfoChoice(CMS_ContentInfo *cms);
|
||||
int CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl);
|
||||
int CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl);
|
||||
STACK_OF(X509_CRL) *CMS_get1_crls(CMS_ContentInfo *cms);
|
||||
|
||||
int CMS_SignedData_init(CMS_ContentInfo *cms);
|
||||
CMS_SignerInfo *CMS_add1_signer(CMS_ContentInfo *cms,
|
||||
X509 *signer, EVP_PKEY *pk, const EVP_MD *md,
|
||||
unsigned int flags);
|
||||
EVP_PKEY_CTX *CMS_SignerInfo_get0_pkey_ctx(CMS_SignerInfo *si);
|
||||
EVP_MD_CTX *CMS_SignerInfo_get0_md_ctx(CMS_SignerInfo *si);
|
||||
STACK_OF(CMS_SignerInfo) *CMS_get0_SignerInfos(CMS_ContentInfo *cms);
|
||||
|
||||
void CMS_SignerInfo_set1_signer_cert(CMS_SignerInfo *si, X509 *signer);
|
||||
int CMS_SignerInfo_get0_signer_id(CMS_SignerInfo *si,
|
||||
ASN1_OCTET_STRING **keyid,
|
||||
X509_NAME **issuer, ASN1_INTEGER **sno);
|
||||
int CMS_SignerInfo_cert_cmp(CMS_SignerInfo *si, X509 *cert);
|
||||
int CMS_set1_signers_certs(CMS_ContentInfo *cms, STACK_OF(X509) *certs,
|
||||
unsigned int flags);
|
||||
void CMS_SignerInfo_get0_algs(CMS_SignerInfo *si, EVP_PKEY **pk,
|
||||
X509 **signer, X509_ALGOR **pdig,
|
||||
X509_ALGOR **psig);
|
||||
ASN1_OCTET_STRING *CMS_SignerInfo_get0_signature(CMS_SignerInfo *si);
|
||||
int CMS_SignerInfo_sign(CMS_SignerInfo *si);
|
||||
int CMS_SignerInfo_verify(CMS_SignerInfo *si);
|
||||
int CMS_SignerInfo_verify_content(CMS_SignerInfo *si, BIO *chain);
|
||||
BIO *CMS_SignedData_verify(CMS_SignedData *sd, BIO *detached_data,
|
||||
STACK_OF(X509) *scerts, X509_STORE *store,
|
||||
STACK_OF(X509) *extra, STACK_OF(X509_CRL) *crls,
|
||||
unsigned int flags,
|
||||
OSSL_LIB_CTX *libctx, const char *propq);
|
||||
|
||||
int CMS_add_smimecap(CMS_SignerInfo *si, STACK_OF(X509_ALGOR) *algs);
|
||||
int CMS_add_simple_smimecap(STACK_OF(X509_ALGOR) **algs,
|
||||
int algnid, int keysize);
|
||||
int CMS_add_standard_smimecap(STACK_OF(X509_ALGOR) **smcap);
|
||||
|
||||
int CMS_signed_get_attr_count(const CMS_SignerInfo *si);
|
||||
int CMS_signed_get_attr_by_NID(const CMS_SignerInfo *si, int nid,
|
||||
int lastpos);
|
||||
int CMS_signed_get_attr_by_OBJ(const CMS_SignerInfo *si, const ASN1_OBJECT *obj,
|
||||
int lastpos);
|
||||
X509_ATTRIBUTE *CMS_signed_get_attr(const CMS_SignerInfo *si, int loc);
|
||||
X509_ATTRIBUTE *CMS_signed_delete_attr(CMS_SignerInfo *si, int loc);
|
||||
int CMS_signed_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr);
|
||||
int CMS_signed_add1_attr_by_OBJ(CMS_SignerInfo *si,
|
||||
const ASN1_OBJECT *obj, int type,
|
||||
const void *bytes, int len);
|
||||
int CMS_signed_add1_attr_by_NID(CMS_SignerInfo *si,
|
||||
int nid, int type,
|
||||
const void *bytes, int len);
|
||||
int CMS_signed_add1_attr_by_txt(CMS_SignerInfo *si,
|
||||
const char *attrname, int type,
|
||||
const void *bytes, int len);
|
||||
void *CMS_signed_get0_data_by_OBJ(const CMS_SignerInfo *si,
|
||||
const ASN1_OBJECT *oid,
|
||||
int lastpos, int type);
|
||||
|
||||
int CMS_unsigned_get_attr_count(const CMS_SignerInfo *si);
|
||||
int CMS_unsigned_get_attr_by_NID(const CMS_SignerInfo *si, int nid,
|
||||
int lastpos);
|
||||
int CMS_unsigned_get_attr_by_OBJ(const CMS_SignerInfo *si,
|
||||
const ASN1_OBJECT *obj, int lastpos);
|
||||
X509_ATTRIBUTE *CMS_unsigned_get_attr(const CMS_SignerInfo *si, int loc);
|
||||
X509_ATTRIBUTE *CMS_unsigned_delete_attr(CMS_SignerInfo *si, int loc);
|
||||
int CMS_unsigned_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr);
|
||||
int CMS_unsigned_add1_attr_by_OBJ(CMS_SignerInfo *si,
|
||||
const ASN1_OBJECT *obj, int type,
|
||||
const void *bytes, int len);
|
||||
int CMS_unsigned_add1_attr_by_NID(CMS_SignerInfo *si,
|
||||
int nid, int type,
|
||||
const void *bytes, int len);
|
||||
int CMS_unsigned_add1_attr_by_txt(CMS_SignerInfo *si,
|
||||
const char *attrname, int type,
|
||||
const void *bytes, int len);
|
||||
void *CMS_unsigned_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid,
|
||||
int lastpos, int type);
|
||||
|
||||
int CMS_get1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest **prr);
|
||||
CMS_ReceiptRequest *CMS_ReceiptRequest_create0(
|
||||
unsigned char *id, int idlen, int allorfirst,
|
||||
STACK_OF(GENERAL_NAMES) *receiptList,
|
||||
STACK_OF(GENERAL_NAMES) *receiptsTo);
|
||||
CMS_ReceiptRequest *CMS_ReceiptRequest_create0_ex(
|
||||
unsigned char *id, int idlen, int allorfirst,
|
||||
STACK_OF(GENERAL_NAMES) *receiptList,
|
||||
STACK_OF(GENERAL_NAMES) *receiptsTo,
|
||||
OSSL_LIB_CTX *libctx);
|
||||
|
||||
int CMS_add1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest *rr);
|
||||
void CMS_ReceiptRequest_get0_values(CMS_ReceiptRequest *rr,
|
||||
ASN1_STRING **pcid,
|
||||
int *pallorfirst,
|
||||
STACK_OF(GENERAL_NAMES) **plist,
|
||||
STACK_OF(GENERAL_NAMES) **prto);
|
||||
int CMS_RecipientInfo_kari_get0_alg(CMS_RecipientInfo *ri,
|
||||
X509_ALGOR **palg,
|
||||
ASN1_OCTET_STRING **pukm);
|
||||
STACK_OF(CMS_RecipientEncryptedKey)
|
||||
*CMS_RecipientInfo_kari_get0_reks(CMS_RecipientInfo *ri);
|
||||
|
||||
int CMS_RecipientInfo_kari_get0_orig_id(CMS_RecipientInfo *ri,
|
||||
X509_ALGOR **pubalg,
|
||||
ASN1_BIT_STRING **pubkey,
|
||||
ASN1_OCTET_STRING **keyid,
|
||||
X509_NAME **issuer,
|
||||
ASN1_INTEGER **sno);
|
||||
|
||||
int CMS_RecipientInfo_kari_orig_id_cmp(CMS_RecipientInfo *ri, X509 *cert);
|
||||
|
||||
int CMS_RecipientEncryptedKey_get0_id(CMS_RecipientEncryptedKey *rek,
|
||||
ASN1_OCTET_STRING **keyid,
|
||||
ASN1_GENERALIZEDTIME **tm,
|
||||
CMS_OtherKeyAttribute **other,
|
||||
X509_NAME **issuer, ASN1_INTEGER **sno);
|
||||
int CMS_RecipientEncryptedKey_cert_cmp(CMS_RecipientEncryptedKey *rek,
|
||||
X509 *cert);
|
||||
int CMS_RecipientInfo_kari_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pk);
|
||||
int CMS_RecipientInfo_kari_set0_pkey_and_peer(CMS_RecipientInfo *ri, EVP_PKEY *pk, X509 *peer);
|
||||
EVP_CIPHER_CTX *CMS_RecipientInfo_kari_get0_ctx(CMS_RecipientInfo *ri);
|
||||
int CMS_RecipientInfo_kari_decrypt(CMS_ContentInfo *cms,
|
||||
CMS_RecipientInfo *ri,
|
||||
CMS_RecipientEncryptedKey *rek);
|
||||
|
||||
int CMS_SharedInfo_encode(unsigned char **pder, X509_ALGOR *kekalg,
|
||||
ASN1_OCTET_STRING *ukm, int keylen);
|
||||
|
||||
/* Backward compatibility for spelling errors. */
|
||||
# define CMS_R_UNKNOWN_DIGEST_ALGORITM CMS_R_UNKNOWN_DIGEST_ALGORITHM
|
||||
# define CMS_R_UNSUPPORTED_RECPIENTINFO_TYPE \
|
||||
CMS_R_UNSUPPORTED_RECIPIENTINFO_TYPE
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
126
thirdparty/OpenSSL-3.5.3/include/openssl/cmserr.h
vendored
Normal file
126
thirdparty/OpenSSL-3.5.3/include/openssl/cmserr.h
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef OPENSSL_CMSERR_H
|
||||
# define OPENSSL_CMSERR_H
|
||||
# pragma once
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
# include <openssl/symhacks.h>
|
||||
# include <openssl/cryptoerr_legacy.h>
|
||||
|
||||
|
||||
# ifndef OPENSSL_NO_CMS
|
||||
|
||||
|
||||
/*
|
||||
* CMS reason codes.
|
||||
*/
|
||||
# define CMS_R_ADD_SIGNER_ERROR 99
|
||||
# define CMS_R_ATTRIBUTE_ERROR 161
|
||||
# define CMS_R_CERTIFICATE_ALREADY_PRESENT 175
|
||||
# define CMS_R_CERTIFICATE_HAS_NO_KEYID 160
|
||||
# define CMS_R_CERTIFICATE_VERIFY_ERROR 100
|
||||
# define CMS_R_CIPHER_AEAD_SET_TAG_ERROR 184
|
||||
# define CMS_R_CIPHER_GET_TAG 185
|
||||
# define CMS_R_CIPHER_INITIALISATION_ERROR 101
|
||||
# define CMS_R_CIPHER_PARAMETER_INITIALISATION_ERROR 102
|
||||
# define CMS_R_CMS_DATAFINAL_ERROR 103
|
||||
# define CMS_R_CMS_LIB 104
|
||||
# define CMS_R_CONTENTIDENTIFIER_MISMATCH 170
|
||||
# define CMS_R_CONTENT_NOT_FOUND 105
|
||||
# define CMS_R_CONTENT_TYPE_MISMATCH 171
|
||||
# define CMS_R_CONTENT_TYPE_NOT_COMPRESSED_DATA 106
|
||||
# define CMS_R_CONTENT_TYPE_NOT_ENVELOPED_DATA 107
|
||||
# define CMS_R_CONTENT_TYPE_NOT_SIGNED_DATA 108
|
||||
# define CMS_R_CONTENT_VERIFY_ERROR 109
|
||||
# define CMS_R_CTRL_ERROR 110
|
||||
# define CMS_R_CTRL_FAILURE 111
|
||||
# define CMS_R_DECODE_ERROR 187
|
||||
# define CMS_R_DECRYPT_ERROR 112
|
||||
# define CMS_R_ERROR_GETTING_PUBLIC_KEY 113
|
||||
# define CMS_R_ERROR_READING_MESSAGEDIGEST_ATTRIBUTE 114
|
||||
# define CMS_R_ERROR_SETTING_KEY 115
|
||||
# define CMS_R_ERROR_SETTING_RECIPIENTINFO 116
|
||||
# define CMS_R_ERROR_UNSUPPORTED_STATIC_KEY_AGREEMENT 196
|
||||
# define CMS_R_ESS_SIGNING_CERTID_MISMATCH_ERROR 183
|
||||
# define CMS_R_INVALID_ENCRYPTED_KEY_LENGTH 117
|
||||
# define CMS_R_INVALID_KEY_ENCRYPTION_PARAMETER 176
|
||||
# define CMS_R_INVALID_KEY_LENGTH 118
|
||||
# define CMS_R_INVALID_LABEL 190
|
||||
# define CMS_R_INVALID_OAEP_PARAMETERS 191
|
||||
# define CMS_R_KDF_PARAMETER_ERROR 186
|
||||
# define CMS_R_MD_BIO_INIT_ERROR 119
|
||||
# define CMS_R_MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH 120
|
||||
# define CMS_R_MESSAGEDIGEST_WRONG_LENGTH 121
|
||||
# define CMS_R_MSGSIGDIGEST_ERROR 172
|
||||
# define CMS_R_MSGSIGDIGEST_VERIFICATION_FAILURE 162
|
||||
# define CMS_R_MSGSIGDIGEST_WRONG_LENGTH 163
|
||||
# define CMS_R_NEED_ONE_SIGNER 164
|
||||
# define CMS_R_NOT_A_SIGNED_RECEIPT 165
|
||||
# define CMS_R_NOT_ENCRYPTED_DATA 122
|
||||
# define CMS_R_NOT_KEK 123
|
||||
# define CMS_R_NOT_KEY_AGREEMENT 181
|
||||
# define CMS_R_NOT_KEY_TRANSPORT 124
|
||||
# define CMS_R_NOT_PWRI 177
|
||||
# define CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 125
|
||||
# define CMS_R_NO_CIPHER 126
|
||||
# define CMS_R_NO_CONTENT 127
|
||||
# define CMS_R_NO_CONTENT_TYPE 173
|
||||
# define CMS_R_NO_DEFAULT_DIGEST 128
|
||||
# define CMS_R_NO_DIGEST_SET 129
|
||||
# define CMS_R_NO_KEY 130
|
||||
# define CMS_R_NO_KEY_OR_CERT 174
|
||||
# define CMS_R_NO_MATCHING_DIGEST 131
|
||||
# define CMS_R_NO_MATCHING_RECIPIENT 132
|
||||
# define CMS_R_NO_MATCHING_SIGNATURE 166
|
||||
# define CMS_R_NO_MSGSIGDIGEST 167
|
||||
# define CMS_R_NO_PASSWORD 178
|
||||
# define CMS_R_NO_PRIVATE_KEY 133
|
||||
# define CMS_R_NO_PUBLIC_KEY 134
|
||||
# define CMS_R_NO_RECEIPT_REQUEST 168
|
||||
# define CMS_R_NO_SIGNERS 135
|
||||
# define CMS_R_OPERATION_UNSUPPORTED 182
|
||||
# define CMS_R_PEER_KEY_ERROR 188
|
||||
# define CMS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 136
|
||||
# define CMS_R_RECEIPT_DECODE_ERROR 169
|
||||
# define CMS_R_RECIPIENT_ERROR 137
|
||||
# define CMS_R_SHARED_INFO_ERROR 189
|
||||
# define CMS_R_SIGNER_CERTIFICATE_NOT_FOUND 138
|
||||
# define CMS_R_SIGNFINAL_ERROR 139
|
||||
# define CMS_R_SMIME_TEXT_ERROR 140
|
||||
# define CMS_R_STORE_INIT_ERROR 141
|
||||
# define CMS_R_TYPE_NOT_COMPRESSED_DATA 142
|
||||
# define CMS_R_TYPE_NOT_DATA 143
|
||||
# define CMS_R_TYPE_NOT_DIGESTED_DATA 144
|
||||
# define CMS_R_TYPE_NOT_ENCRYPTED_DATA 145
|
||||
# define CMS_R_TYPE_NOT_ENVELOPED_DATA 146
|
||||
# define CMS_R_UNABLE_TO_FINALIZE_CONTEXT 147
|
||||
# define CMS_R_UNKNOWN_CIPHER 148
|
||||
# define CMS_R_UNKNOWN_DIGEST_ALGORITHM 149
|
||||
# define CMS_R_UNKNOWN_ID 150
|
||||
# define CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM 151
|
||||
# define CMS_R_UNSUPPORTED_CONTENT_ENCRYPTION_ALGORITHM 194
|
||||
# define CMS_R_UNSUPPORTED_CONTENT_TYPE 152
|
||||
# define CMS_R_UNSUPPORTED_ENCRYPTION_TYPE 192
|
||||
# define CMS_R_UNSUPPORTED_KEK_ALGORITHM 153
|
||||
# define CMS_R_UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM 179
|
||||
# define CMS_R_UNSUPPORTED_LABEL_SOURCE 193
|
||||
# define CMS_R_UNSUPPORTED_RECIPIENTINFO_TYPE 155
|
||||
# define CMS_R_UNSUPPORTED_RECIPIENT_TYPE 154
|
||||
# define CMS_R_UNSUPPORTED_SIGNATURE_ALGORITHM 195
|
||||
# define CMS_R_UNSUPPORTED_TYPE 156
|
||||
# define CMS_R_UNWRAP_ERROR 157
|
||||
# define CMS_R_UNWRAP_FAILURE 180
|
||||
# define CMS_R_VERIFICATION_FAILURE 158
|
||||
# define CMS_R_WRAP_ERROR 159
|
||||
|
||||
# endif
|
||||
#endif
|
||||
98
thirdparty/OpenSSL-3.5.3/include/openssl/comp.h
vendored
Normal file
98
thirdparty/OpenSSL-3.5.3/include/openssl/comp.h
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright 2015-2024 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef OPENSSL_COMP_H
|
||||
# define OPENSSL_COMP_H
|
||||
# pragma once
|
||||
|
||||
# include <openssl/macros.h>
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
# define HEADER_COMP_H
|
||||
# endif
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# include <openssl/crypto.h>
|
||||
# include <openssl/comperr.h>
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
|
||||
|
||||
# ifndef OPENSSL_NO_COMP
|
||||
|
||||
COMP_CTX *COMP_CTX_new(COMP_METHOD *meth);
|
||||
const COMP_METHOD *COMP_CTX_get_method(const COMP_CTX *ctx);
|
||||
int COMP_CTX_get_type(const COMP_CTX* comp);
|
||||
int COMP_get_type(const COMP_METHOD *meth);
|
||||
const char *COMP_get_name(const COMP_METHOD *meth);
|
||||
void COMP_CTX_free(COMP_CTX *ctx);
|
||||
|
||||
int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen,
|
||||
unsigned char *in, int ilen);
|
||||
int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen,
|
||||
unsigned char *in, int ilen);
|
||||
|
||||
COMP_METHOD *COMP_zlib(void);
|
||||
COMP_METHOD *COMP_zlib_oneshot(void);
|
||||
COMP_METHOD *COMP_brotli(void);
|
||||
COMP_METHOD *COMP_brotli_oneshot(void);
|
||||
COMP_METHOD *COMP_zstd(void);
|
||||
COMP_METHOD *COMP_zstd_oneshot(void);
|
||||
|
||||
# ifndef OPENSSL_NO_DEPRECATED_1_1_0
|
||||
# define COMP_zlib_cleanup() while(0) continue
|
||||
# endif
|
||||
|
||||
# ifdef OPENSSL_BIO_H
|
||||
const BIO_METHOD *BIO_f_zlib(void);
|
||||
const BIO_METHOD *BIO_f_brotli(void);
|
||||
const BIO_METHOD *BIO_f_zstd(void);
|
||||
# endif
|
||||
|
||||
# endif
|
||||
|
||||
typedef struct ssl_comp_st SSL_COMP;
|
||||
|
||||
SKM_DEFINE_STACK_OF_INTERNAL(SSL_COMP, SSL_COMP, SSL_COMP)
|
||||
#define sk_SSL_COMP_num(sk) OPENSSL_sk_num(ossl_check_const_SSL_COMP_sk_type(sk))
|
||||
#define sk_SSL_COMP_value(sk, idx) ((SSL_COMP *)OPENSSL_sk_value(ossl_check_const_SSL_COMP_sk_type(sk), (idx)))
|
||||
#define sk_SSL_COMP_new(cmp) ((STACK_OF(SSL_COMP) *)OPENSSL_sk_new(ossl_check_SSL_COMP_compfunc_type(cmp)))
|
||||
#define sk_SSL_COMP_new_null() ((STACK_OF(SSL_COMP) *)OPENSSL_sk_new_null())
|
||||
#define sk_SSL_COMP_new_reserve(cmp, n) ((STACK_OF(SSL_COMP) *)OPENSSL_sk_new_reserve(ossl_check_SSL_COMP_compfunc_type(cmp), (n)))
|
||||
#define sk_SSL_COMP_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_SSL_COMP_sk_type(sk), (n))
|
||||
#define sk_SSL_COMP_free(sk) OPENSSL_sk_free(ossl_check_SSL_COMP_sk_type(sk))
|
||||
#define sk_SSL_COMP_zero(sk) OPENSSL_sk_zero(ossl_check_SSL_COMP_sk_type(sk))
|
||||
#define sk_SSL_COMP_delete(sk, i) ((SSL_COMP *)OPENSSL_sk_delete(ossl_check_SSL_COMP_sk_type(sk), (i)))
|
||||
#define sk_SSL_COMP_delete_ptr(sk, ptr) ((SSL_COMP *)OPENSSL_sk_delete_ptr(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_type(ptr)))
|
||||
#define sk_SSL_COMP_push(sk, ptr) OPENSSL_sk_push(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_type(ptr))
|
||||
#define sk_SSL_COMP_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_type(ptr))
|
||||
#define sk_SSL_COMP_pop(sk) ((SSL_COMP *)OPENSSL_sk_pop(ossl_check_SSL_COMP_sk_type(sk)))
|
||||
#define sk_SSL_COMP_shift(sk) ((SSL_COMP *)OPENSSL_sk_shift(ossl_check_SSL_COMP_sk_type(sk)))
|
||||
#define sk_SSL_COMP_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_SSL_COMP_sk_type(sk),ossl_check_SSL_COMP_freefunc_type(freefunc))
|
||||
#define sk_SSL_COMP_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_type(ptr), (idx))
|
||||
#define sk_SSL_COMP_set(sk, idx, ptr) ((SSL_COMP *)OPENSSL_sk_set(ossl_check_SSL_COMP_sk_type(sk), (idx), ossl_check_SSL_COMP_type(ptr)))
|
||||
#define sk_SSL_COMP_find(sk, ptr) OPENSSL_sk_find(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_type(ptr))
|
||||
#define sk_SSL_COMP_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_type(ptr))
|
||||
#define sk_SSL_COMP_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_type(ptr), pnum)
|
||||
#define sk_SSL_COMP_sort(sk) OPENSSL_sk_sort(ossl_check_SSL_COMP_sk_type(sk))
|
||||
#define sk_SSL_COMP_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_SSL_COMP_sk_type(sk))
|
||||
#define sk_SSL_COMP_dup(sk) ((STACK_OF(SSL_COMP) *)OPENSSL_sk_dup(ossl_check_const_SSL_COMP_sk_type(sk)))
|
||||
#define sk_SSL_COMP_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(SSL_COMP) *)OPENSSL_sk_deep_copy(ossl_check_const_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_copyfunc_type(copyfunc), ossl_check_SSL_COMP_freefunc_type(freefunc)))
|
||||
#define sk_SSL_COMP_set_cmp_func(sk, cmp) ((sk_SSL_COMP_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_compfunc_type(cmp)))
|
||||
|
||||
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
38
thirdparty/OpenSSL-3.5.3/include/openssl/comperr.h
vendored
Normal file
38
thirdparty/OpenSSL-3.5.3/include/openssl/comperr.h
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef OPENSSL_COMPERR_H
|
||||
# define OPENSSL_COMPERR_H
|
||||
# pragma once
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
# include <openssl/symhacks.h>
|
||||
# include <openssl/cryptoerr_legacy.h>
|
||||
|
||||
|
||||
# ifndef OPENSSL_NO_COMP
|
||||
|
||||
|
||||
/*
|
||||
* COMP reason codes.
|
||||
*/
|
||||
# define COMP_R_BROTLI_DECODE_ERROR 102
|
||||
# define COMP_R_BROTLI_ENCODE_ERROR 103
|
||||
# define COMP_R_BROTLI_NOT_SUPPORTED 104
|
||||
# define COMP_R_ZLIB_DEFLATE_ERROR 99
|
||||
# define COMP_R_ZLIB_INFLATE_ERROR 100
|
||||
# define COMP_R_ZLIB_NOT_SUPPORTED 101
|
||||
# define COMP_R_ZSTD_COMPRESS_ERROR 105
|
||||
# define COMP_R_ZSTD_DECODE_ERROR 106
|
||||
# define COMP_R_ZSTD_DECOMPRESS_ERROR 107
|
||||
# define COMP_R_ZSTD_NOT_SUPPORTED 108
|
||||
|
||||
# endif
|
||||
#endif
|
||||
214
thirdparty/OpenSSL-3.5.3/include/openssl/conf.h
vendored
Normal file
214
thirdparty/OpenSSL-3.5.3/include/openssl/conf.h
vendored
Normal file
@@ -0,0 +1,214 @@
|
||||
/*
|
||||
* WARNING: do not edit!
|
||||
* Generated by makefile from include\openssl\conf.h.in
|
||||
*
|
||||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef OPENSSL_CONF_H
|
||||
# define OPENSSL_CONF_H
|
||||
# pragma once
|
||||
|
||||
# include <openssl/macros.h>
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
# define HEADER_CONF_H
|
||||
# endif
|
||||
|
||||
# include <openssl/bio.h>
|
||||
# include <openssl/lhash.h>
|
||||
# include <openssl/safestack.h>
|
||||
# include <openssl/e_os2.h>
|
||||
# include <openssl/types.h>
|
||||
# include <openssl/conferr.h>
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
# include <stdio.h>
|
||||
# endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
char *section;
|
||||
char *name;
|
||||
char *value;
|
||||
} CONF_VALUE;
|
||||
|
||||
SKM_DEFINE_STACK_OF_INTERNAL(CONF_VALUE, CONF_VALUE, CONF_VALUE)
|
||||
#define sk_CONF_VALUE_num(sk) OPENSSL_sk_num(ossl_check_const_CONF_VALUE_sk_type(sk))
|
||||
#define sk_CONF_VALUE_value(sk, idx) ((CONF_VALUE *)OPENSSL_sk_value(ossl_check_const_CONF_VALUE_sk_type(sk), (idx)))
|
||||
#define sk_CONF_VALUE_new(cmp) ((STACK_OF(CONF_VALUE) *)OPENSSL_sk_new(ossl_check_CONF_VALUE_compfunc_type(cmp)))
|
||||
#define sk_CONF_VALUE_new_null() ((STACK_OF(CONF_VALUE) *)OPENSSL_sk_new_null())
|
||||
#define sk_CONF_VALUE_new_reserve(cmp, n) ((STACK_OF(CONF_VALUE) *)OPENSSL_sk_new_reserve(ossl_check_CONF_VALUE_compfunc_type(cmp), (n)))
|
||||
#define sk_CONF_VALUE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_CONF_VALUE_sk_type(sk), (n))
|
||||
#define sk_CONF_VALUE_free(sk) OPENSSL_sk_free(ossl_check_CONF_VALUE_sk_type(sk))
|
||||
#define sk_CONF_VALUE_zero(sk) OPENSSL_sk_zero(ossl_check_CONF_VALUE_sk_type(sk))
|
||||
#define sk_CONF_VALUE_delete(sk, i) ((CONF_VALUE *)OPENSSL_sk_delete(ossl_check_CONF_VALUE_sk_type(sk), (i)))
|
||||
#define sk_CONF_VALUE_delete_ptr(sk, ptr) ((CONF_VALUE *)OPENSSL_sk_delete_ptr(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_type(ptr)))
|
||||
#define sk_CONF_VALUE_push(sk, ptr) OPENSSL_sk_push(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_type(ptr))
|
||||
#define sk_CONF_VALUE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_type(ptr))
|
||||
#define sk_CONF_VALUE_pop(sk) ((CONF_VALUE *)OPENSSL_sk_pop(ossl_check_CONF_VALUE_sk_type(sk)))
|
||||
#define sk_CONF_VALUE_shift(sk) ((CONF_VALUE *)OPENSSL_sk_shift(ossl_check_CONF_VALUE_sk_type(sk)))
|
||||
#define sk_CONF_VALUE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_CONF_VALUE_sk_type(sk),ossl_check_CONF_VALUE_freefunc_type(freefunc))
|
||||
#define sk_CONF_VALUE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_type(ptr), (idx))
|
||||
#define sk_CONF_VALUE_set(sk, idx, ptr) ((CONF_VALUE *)OPENSSL_sk_set(ossl_check_CONF_VALUE_sk_type(sk), (idx), ossl_check_CONF_VALUE_type(ptr)))
|
||||
#define sk_CONF_VALUE_find(sk, ptr) OPENSSL_sk_find(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_type(ptr))
|
||||
#define sk_CONF_VALUE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_type(ptr))
|
||||
#define sk_CONF_VALUE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_type(ptr), pnum)
|
||||
#define sk_CONF_VALUE_sort(sk) OPENSSL_sk_sort(ossl_check_CONF_VALUE_sk_type(sk))
|
||||
#define sk_CONF_VALUE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_CONF_VALUE_sk_type(sk))
|
||||
#define sk_CONF_VALUE_dup(sk) ((STACK_OF(CONF_VALUE) *)OPENSSL_sk_dup(ossl_check_const_CONF_VALUE_sk_type(sk)))
|
||||
#define sk_CONF_VALUE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(CONF_VALUE) *)OPENSSL_sk_deep_copy(ossl_check_const_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_copyfunc_type(copyfunc), ossl_check_CONF_VALUE_freefunc_type(freefunc)))
|
||||
#define sk_CONF_VALUE_set_cmp_func(sk, cmp) ((sk_CONF_VALUE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_compfunc_type(cmp)))
|
||||
DEFINE_LHASH_OF_INTERNAL(CONF_VALUE);
|
||||
#define lh_CONF_VALUE_new(hfn, cmp) ((LHASH_OF(CONF_VALUE) *)OPENSSL_LH_set_thunks(OPENSSL_LH_new(ossl_check_CONF_VALUE_lh_hashfunc_type(hfn), ossl_check_CONF_VALUE_lh_compfunc_type(cmp)), lh_CONF_VALUE_hash_thunk, lh_CONF_VALUE_comp_thunk, lh_CONF_VALUE_doall_thunk, lh_CONF_VALUE_doall_arg_thunk))
|
||||
#define lh_CONF_VALUE_free(lh) OPENSSL_LH_free(ossl_check_CONF_VALUE_lh_type(lh))
|
||||
#define lh_CONF_VALUE_flush(lh) OPENSSL_LH_flush(ossl_check_CONF_VALUE_lh_type(lh))
|
||||
#define lh_CONF_VALUE_insert(lh, ptr) ((CONF_VALUE *)OPENSSL_LH_insert(ossl_check_CONF_VALUE_lh_type(lh), ossl_check_CONF_VALUE_lh_plain_type(ptr)))
|
||||
#define lh_CONF_VALUE_delete(lh, ptr) ((CONF_VALUE *)OPENSSL_LH_delete(ossl_check_CONF_VALUE_lh_type(lh), ossl_check_const_CONF_VALUE_lh_plain_type(ptr)))
|
||||
#define lh_CONF_VALUE_retrieve(lh, ptr) ((CONF_VALUE *)OPENSSL_LH_retrieve(ossl_check_CONF_VALUE_lh_type(lh), ossl_check_const_CONF_VALUE_lh_plain_type(ptr)))
|
||||
#define lh_CONF_VALUE_error(lh) OPENSSL_LH_error(ossl_check_CONF_VALUE_lh_type(lh))
|
||||
#define lh_CONF_VALUE_num_items(lh) OPENSSL_LH_num_items(ossl_check_CONF_VALUE_lh_type(lh))
|
||||
#define lh_CONF_VALUE_node_stats_bio(lh, out) OPENSSL_LH_node_stats_bio(ossl_check_const_CONF_VALUE_lh_type(lh), out)
|
||||
#define lh_CONF_VALUE_node_usage_stats_bio(lh, out) OPENSSL_LH_node_usage_stats_bio(ossl_check_const_CONF_VALUE_lh_type(lh), out)
|
||||
#define lh_CONF_VALUE_stats_bio(lh, out) OPENSSL_LH_stats_bio(ossl_check_const_CONF_VALUE_lh_type(lh), out)
|
||||
#define lh_CONF_VALUE_get_down_load(lh) OPENSSL_LH_get_down_load(ossl_check_CONF_VALUE_lh_type(lh))
|
||||
#define lh_CONF_VALUE_set_down_load(lh, dl) OPENSSL_LH_set_down_load(ossl_check_CONF_VALUE_lh_type(lh), dl)
|
||||
#define lh_CONF_VALUE_doall(lh, dfn) OPENSSL_LH_doall(ossl_check_CONF_VALUE_lh_type(lh), ossl_check_CONF_VALUE_lh_doallfunc_type(dfn))
|
||||
|
||||
|
||||
struct conf_st;
|
||||
struct conf_method_st;
|
||||
typedef struct conf_method_st CONF_METHOD;
|
||||
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
# include <openssl/conftypes.h>
|
||||
# endif
|
||||
|
||||
/* Module definitions */
|
||||
typedef struct conf_imodule_st CONF_IMODULE;
|
||||
typedef struct conf_module_st CONF_MODULE;
|
||||
|
||||
STACK_OF(CONF_MODULE);
|
||||
STACK_OF(CONF_IMODULE);
|
||||
|
||||
/* DSO module function typedefs */
|
||||
typedef int conf_init_func (CONF_IMODULE *md, const CONF *cnf);
|
||||
typedef void conf_finish_func (CONF_IMODULE *md);
|
||||
|
||||
# define CONF_MFLAGS_IGNORE_ERRORS 0x1
|
||||
# define CONF_MFLAGS_IGNORE_RETURN_CODES 0x2
|
||||
# define CONF_MFLAGS_SILENT 0x4
|
||||
# define CONF_MFLAGS_NO_DSO 0x8
|
||||
# define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10
|
||||
# define CONF_MFLAGS_DEFAULT_SECTION 0x20
|
||||
|
||||
int CONF_set_default_method(CONF_METHOD *meth);
|
||||
void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash);
|
||||
LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file,
|
||||
long *eline);
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp,
|
||||
long *eline);
|
||||
# endif
|
||||
LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp,
|
||||
long *eline);
|
||||
STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf,
|
||||
const char *section);
|
||||
char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group,
|
||||
const char *name);
|
||||
long CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group,
|
||||
const char *name);
|
||||
void CONF_free(LHASH_OF(CONF_VALUE) *conf);
|
||||
#ifndef OPENSSL_NO_STDIO
|
||||
int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out);
|
||||
#endif
|
||||
int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out);
|
||||
#ifndef OPENSSL_NO_DEPRECATED_1_1_0
|
||||
OSSL_DEPRECATEDIN_1_1_0 void OPENSSL_config(const char *config_name);
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_DEPRECATED_1_1_0
|
||||
# define OPENSSL_no_config() \
|
||||
OPENSSL_init_crypto(OPENSSL_INIT_NO_LOAD_CONFIG, NULL)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* New conf code. The semantics are different from the functions above. If
|
||||
* that wasn't the case, the above functions would have been replaced
|
||||
*/
|
||||
|
||||
CONF *NCONF_new_ex(OSSL_LIB_CTX *libctx, CONF_METHOD *meth);
|
||||
OSSL_LIB_CTX *NCONF_get0_libctx(const CONF *conf);
|
||||
CONF *NCONF_new(CONF_METHOD *meth);
|
||||
CONF_METHOD *NCONF_default(void);
|
||||
#ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
OSSL_DEPRECATEDIN_3_0 CONF_METHOD *NCONF_WIN32(void);
|
||||
#endif
|
||||
void NCONF_free(CONF *conf);
|
||||
void NCONF_free_data(CONF *conf);
|
||||
|
||||
int NCONF_load(CONF *conf, const char *file, long *eline);
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
int NCONF_load_fp(CONF *conf, FILE *fp, long *eline);
|
||||
# endif
|
||||
int NCONF_load_bio(CONF *conf, BIO *bp, long *eline);
|
||||
STACK_OF(OPENSSL_CSTRING) *NCONF_get_section_names(const CONF *conf);
|
||||
STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,
|
||||
const char *section);
|
||||
char *NCONF_get_string(const CONF *conf, const char *group, const char *name);
|
||||
int NCONF_get_number_e(const CONF *conf, const char *group, const char *name,
|
||||
long *result);
|
||||
#ifndef OPENSSL_NO_STDIO
|
||||
int NCONF_dump_fp(const CONF *conf, FILE *out);
|
||||
#endif
|
||||
int NCONF_dump_bio(const CONF *conf, BIO *out);
|
||||
|
||||
#define NCONF_get_number(c,g,n,r) NCONF_get_number_e(c,g,n,r)
|
||||
|
||||
/* Module functions */
|
||||
|
||||
int CONF_modules_load(const CONF *cnf, const char *appname,
|
||||
unsigned long flags);
|
||||
int CONF_modules_load_file_ex(OSSL_LIB_CTX *libctx, const char *filename,
|
||||
const char *appname, unsigned long flags);
|
||||
int CONF_modules_load_file(const char *filename, const char *appname,
|
||||
unsigned long flags);
|
||||
void CONF_modules_unload(int all);
|
||||
void CONF_modules_finish(void);
|
||||
#ifndef OPENSSL_NO_DEPRECATED_1_1_0
|
||||
# define CONF_modules_free() while(0) continue
|
||||
#endif
|
||||
int CONF_module_add(const char *name, conf_init_func *ifunc,
|
||||
conf_finish_func *ffunc);
|
||||
|
||||
const char *CONF_imodule_get_name(const CONF_IMODULE *md);
|
||||
const char *CONF_imodule_get_value(const CONF_IMODULE *md);
|
||||
void *CONF_imodule_get_usr_data(const CONF_IMODULE *md);
|
||||
void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data);
|
||||
CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md);
|
||||
unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md);
|
||||
void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags);
|
||||
void *CONF_module_get_usr_data(CONF_MODULE *pmod);
|
||||
void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data);
|
||||
|
||||
char *CONF_get1_default_config_file(void);
|
||||
|
||||
int CONF_parse_list(const char *list, int sep, int nospc,
|
||||
int (*list_cb) (const char *elem, int len, void *usr),
|
||||
void *arg);
|
||||
|
||||
void OPENSSL_load_builtin_modules(void);
|
||||
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
46
thirdparty/OpenSSL-3.5.3/include/openssl/conf_api.h
vendored
Normal file
46
thirdparty/OpenSSL-3.5.3/include/openssl/conf_api.h
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef OPENSSL_CONF_API_H
|
||||
# define OPENSSL_CONF_API_H
|
||||
# pragma once
|
||||
|
||||
# include <openssl/macros.h>
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
# define HEADER_CONF_API_H
|
||||
# endif
|
||||
|
||||
# include <openssl/lhash.h>
|
||||
# include <openssl/conf.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Up until OpenSSL 0.9.5a, this was new_section */
|
||||
CONF_VALUE *_CONF_new_section(CONF *conf, const char *section);
|
||||
/* Up until OpenSSL 0.9.5a, this was get_section */
|
||||
CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section);
|
||||
/* Up until OpenSSL 0.9.5a, this was CONF_get_section */
|
||||
STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf,
|
||||
const char *section);
|
||||
|
||||
int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value);
|
||||
char *_CONF_get_string(const CONF *conf, const char *section,
|
||||
const char *name);
|
||||
long _CONF_get_number(const CONF *conf, const char *section,
|
||||
const char *name);
|
||||
|
||||
int _CONF_new_data(CONF *conf);
|
||||
void _CONF_free_data(CONF *conf);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
52
thirdparty/OpenSSL-3.5.3/include/openssl/conferr.h
vendored
Normal file
52
thirdparty/OpenSSL-3.5.3/include/openssl/conferr.h
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef OPENSSL_CONFERR_H
|
||||
# define OPENSSL_CONFERR_H
|
||||
# pragma once
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
# include <openssl/symhacks.h>
|
||||
# include <openssl/cryptoerr_legacy.h>
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* CONF reason codes.
|
||||
*/
|
||||
# define CONF_R_ERROR_LOADING_DSO 110
|
||||
# define CONF_R_INVALID_PRAGMA 122
|
||||
# define CONF_R_LIST_CANNOT_BE_NULL 115
|
||||
# define CONF_R_MANDATORY_BRACES_IN_VARIABLE_EXPANSION 123
|
||||
# define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 100
|
||||
# define CONF_R_MISSING_EQUAL_SIGN 101
|
||||
# define CONF_R_MISSING_INIT_FUNCTION 112
|
||||
# define CONF_R_MODULE_INITIALIZATION_ERROR 109
|
||||
# define CONF_R_NO_CLOSE_BRACE 102
|
||||
# define CONF_R_NO_CONF 105
|
||||
# define CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE 106
|
||||
# define CONF_R_NO_SECTION 107
|
||||
# define CONF_R_NO_SUCH_FILE 114
|
||||
# define CONF_R_NO_VALUE 108
|
||||
# define CONF_R_NUMBER_TOO_LARGE 121
|
||||
# define CONF_R_OPENSSL_CONF_REFERENCES_MISSING_SECTION 124
|
||||
# define CONF_R_RECURSIVE_DIRECTORY_INCLUDE 111
|
||||
# define CONF_R_RECURSIVE_SECTION_REFERENCE 126
|
||||
# define CONF_R_RELATIVE_PATH 125
|
||||
# define CONF_R_SSL_COMMAND_SECTION_EMPTY 117
|
||||
# define CONF_R_SSL_COMMAND_SECTION_NOT_FOUND 118
|
||||
# define CONF_R_SSL_SECTION_EMPTY 119
|
||||
# define CONF_R_SSL_SECTION_NOT_FOUND 120
|
||||
# define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103
|
||||
# define CONF_R_UNKNOWN_MODULE_NAME 113
|
||||
# define CONF_R_VARIABLE_EXPANSION_TOO_LONG 116
|
||||
# define CONF_R_VARIABLE_HAS_NO_VALUE 104
|
||||
|
||||
#endif
|
||||
185
thirdparty/OpenSSL-3.5.3/include/openssl/configuration.h
vendored
Normal file
185
thirdparty/OpenSSL-3.5.3/include/openssl/configuration.h
vendored
Normal file
@@ -0,0 +1,185 @@
|
||||
/*
|
||||
* WARNING: do not edit!
|
||||
* Generated by configdata.pm from Configurations\common0.tmpl, Configurations\windows-makefile.tmpl
|
||||
* via makefile.in
|
||||
*
|
||||
* Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef OPENSSL_CONFIGURATION_H
|
||||
# define OPENSSL_CONFIGURATION_H
|
||||
# pragma once
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
# ifdef OPENSSL_ALGORITHM_DEFINES
|
||||
# error OPENSSL_ALGORITHM_DEFINES no longer supported
|
||||
# endif
|
||||
|
||||
/*
|
||||
* OpenSSL was configured with the following options:
|
||||
*/
|
||||
|
||||
# ifndef OPENSSL_SYS_WIN64A
|
||||
# define OPENSSL_SYS_WIN64A 1
|
||||
# endif
|
||||
# define OPENSSL_CONFIGURED_API 30500
|
||||
# ifndef OPENSSL_RAND_SEED_OS
|
||||
# define OPENSSL_RAND_SEED_OS
|
||||
# endif
|
||||
# ifndef OPENSSL_THREADS
|
||||
# define OPENSSL_THREADS
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_ACVP_TESTS
|
||||
# define OPENSSL_NO_ACVP_TESTS
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_AFALGENG
|
||||
# define OPENSSL_NO_AFALGENG
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_ASAN
|
||||
# define OPENSSL_NO_ASAN
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_BROTLI
|
||||
# define OPENSSL_NO_BROTLI
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_BROTLI_DYNAMIC
|
||||
# define OPENSSL_NO_BROTLI_DYNAMIC
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_CRYPTO_MDEBUG
|
||||
# define OPENSSL_NO_CRYPTO_MDEBUG
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE
|
||||
# define OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_DEMOS
|
||||
# define OPENSSL_NO_DEMOS
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_DEVCRYPTOENG
|
||||
# define OPENSSL_NO_DEVCRYPTOENG
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
|
||||
# define OPENSSL_NO_EC_NISTP_64_GCC_128
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_EGD
|
||||
# define OPENSSL_NO_EGD
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_EXTERNAL_TESTS
|
||||
# define OPENSSL_NO_EXTERNAL_TESTS
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_FIPS_JITTER
|
||||
# define OPENSSL_NO_FIPS_JITTER
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_FIPS_POST
|
||||
# define OPENSSL_NO_FIPS_POST
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_FIPS_SECURITYCHECKS
|
||||
# define OPENSSL_NO_FIPS_SECURITYCHECKS
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_FUZZ_AFL
|
||||
# define OPENSSL_NO_FUZZ_AFL
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_FUZZ_LIBFUZZER
|
||||
# define OPENSSL_NO_FUZZ_LIBFUZZER
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_H3DEMO
|
||||
# define OPENSSL_NO_H3DEMO
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_HQINTEROP
|
||||
# define OPENSSL_NO_HQINTEROP
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_JITTER
|
||||
# define OPENSSL_NO_JITTER
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_KTLS
|
||||
# define OPENSSL_NO_KTLS
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_MD2
|
||||
# define OPENSSL_NO_MD2
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_MSAN
|
||||
# define OPENSSL_NO_MSAN
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_PIE
|
||||
# define OPENSSL_NO_PIE
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_RC5
|
||||
# define OPENSSL_NO_RC5
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_SCTP
|
||||
# define OPENSSL_NO_SCTP
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_SSL3
|
||||
# define OPENSSL_NO_SSL3
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_SSL3_METHOD
|
||||
# define OPENSSL_NO_SSL3_METHOD
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_SSLKEYLOG
|
||||
# define OPENSSL_NO_SSLKEYLOG
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_TFO
|
||||
# define OPENSSL_NO_TFO
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_TRACE
|
||||
# define OPENSSL_NO_TRACE
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_UBSAN
|
||||
# define OPENSSL_NO_UBSAN
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_UNIT_TEST
|
||||
# define OPENSSL_NO_UNIT_TEST
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_WEAK_SSL_CIPHERS
|
||||
# define OPENSSL_NO_WEAK_SSL_CIPHERS
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_ZLIB
|
||||
# define OPENSSL_NO_ZLIB
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_ZLIB_DYNAMIC
|
||||
# define OPENSSL_NO_ZLIB_DYNAMIC
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_ZSTD
|
||||
# define OPENSSL_NO_ZSTD
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_ZSTD_DYNAMIC
|
||||
# define OPENSSL_NO_ZSTD_DYNAMIC
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_STATIC_ENGINE
|
||||
# define OPENSSL_NO_STATIC_ENGINE
|
||||
# endif
|
||||
|
||||
|
||||
/* Generate 80386 code? */
|
||||
# undef I386_ONLY
|
||||
|
||||
/*
|
||||
* The following are cipher-specific, but are part of the public API.
|
||||
*/
|
||||
# if !defined(OPENSSL_SYS_UEFI)
|
||||
# undef BN_LLONG
|
||||
/* Only one for the following should be defined */
|
||||
# undef SIXTY_FOUR_BIT_LONG
|
||||
# define SIXTY_FOUR_BIT
|
||||
# undef THIRTY_TWO_BIT
|
||||
# endif
|
||||
|
||||
# define RC4_INT unsigned int
|
||||
|
||||
# if defined(OPENSSL_NO_COMP) || (defined(OPENSSL_NO_BROTLI) && defined(OPENSSL_NO_ZSTD) && defined(OPENSSL_NO_ZLIB))
|
||||
# define OPENSSL_NO_COMP_ALG
|
||||
# else
|
||||
# undef OPENSSL_NO_COMP_ALG
|
||||
# endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
|
||||
#endif /* OPENSSL_CONFIGURATION_H */
|
||||
44
thirdparty/OpenSSL-3.5.3/include/openssl/conftypes.h
vendored
Normal file
44
thirdparty/OpenSSL-3.5.3/include/openssl/conftypes.h
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef OPENSSL_CONFTYPES_H
|
||||
# define OPENSSL_CONFTYPES_H
|
||||
# pragma once
|
||||
|
||||
#ifndef OPENSSL_CONF_H
|
||||
# include <openssl/conf.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The contents of this file are deprecated and will be made opaque
|
||||
*/
|
||||
struct conf_method_st {
|
||||
const char *name;
|
||||
CONF *(*create) (CONF_METHOD *meth);
|
||||
int (*init) (CONF *conf);
|
||||
int (*destroy) (CONF *conf);
|
||||
int (*destroy_data) (CONF *conf);
|
||||
int (*load_bio) (CONF *conf, BIO *bp, long *eline);
|
||||
int (*dump) (const CONF *conf, BIO *bp);
|
||||
int (*is_number) (const CONF *conf, char c);
|
||||
int (*to_int) (const CONF *conf, char c);
|
||||
int (*load) (CONF *conf, const char *name, long *eline);
|
||||
};
|
||||
|
||||
struct conf_st {
|
||||
CONF_METHOD *meth;
|
||||
void *meth_data;
|
||||
LHASH_OF(CONF_VALUE) *data;
|
||||
int flag_dollarid;
|
||||
int flag_abspath;
|
||||
char *includedir;
|
||||
OSSL_LIB_CTX *libctx;
|
||||
};
|
||||
|
||||
#endif
|
||||
236
thirdparty/OpenSSL-3.5.3/include/openssl/core.h
vendored
Normal file
236
thirdparty/OpenSSL-3.5.3/include/openssl/core.h
vendored
Normal file
@@ -0,0 +1,236 @@
|
||||
/*
|
||||
* Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef OPENSSL_CORE_H
|
||||
# define OPENSSL_CORE_H
|
||||
# pragma once
|
||||
|
||||
# include <stddef.h>
|
||||
# include <openssl/types.h>
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
/*-
|
||||
* Base types
|
||||
* ----------
|
||||
*
|
||||
* These are the types that the OpenSSL core and providers have in common
|
||||
* to communicate data between them.
|
||||
*/
|
||||
|
||||
/* Opaque handles to be used with core upcall functions from providers */
|
||||
typedef struct ossl_core_handle_st OSSL_CORE_HANDLE;
|
||||
typedef struct openssl_core_ctx_st OPENSSL_CORE_CTX;
|
||||
typedef struct ossl_core_bio_st OSSL_CORE_BIO;
|
||||
|
||||
/*
|
||||
* Dispatch table element. function_id numbers and the functions are defined
|
||||
* in core_dispatch.h, see macros with 'OSSL_CORE_MAKE_FUNC' in their names.
|
||||
*
|
||||
* An array of these is always terminated by function_id == 0
|
||||
*/
|
||||
struct ossl_dispatch_st {
|
||||
int function_id;
|
||||
void (*function)(void);
|
||||
};
|
||||
|
||||
# define OSSL_DISPATCH_END \
|
||||
{ 0, NULL }
|
||||
|
||||
/*
|
||||
* Other items, essentially an int<->pointer map element.
|
||||
*
|
||||
* We make this type distinct from OSSL_DISPATCH to ensure that dispatch
|
||||
* tables remain tables with function pointers only.
|
||||
*
|
||||
* This is used whenever we need to pass things like a table of error reason
|
||||
* codes <-> reason string maps, ...
|
||||
*
|
||||
* Usage determines which field works as key if any, rather than field order.
|
||||
*
|
||||
* An array of these is always terminated by id == 0 && ptr == NULL
|
||||
*/
|
||||
struct ossl_item_st {
|
||||
unsigned int id;
|
||||
void *ptr;
|
||||
};
|
||||
|
||||
/*
|
||||
* Type to tie together algorithm names, property definition string and
|
||||
* the algorithm implementation in the form of a dispatch table.
|
||||
*
|
||||
* An array of these is always terminated by algorithm_names == NULL
|
||||
*/
|
||||
struct ossl_algorithm_st {
|
||||
const char *algorithm_names; /* key */
|
||||
const char *property_definition; /* key */
|
||||
const OSSL_DISPATCH *implementation;
|
||||
const char *algorithm_description;
|
||||
};
|
||||
|
||||
/*
|
||||
* Type to pass object data in a uniform way, without exposing the object
|
||||
* structure.
|
||||
*
|
||||
* An array of these is always terminated by key == NULL
|
||||
*/
|
||||
struct ossl_param_st {
|
||||
const char *key; /* the name of the parameter */
|
||||
unsigned int data_type; /* declare what kind of content is in buffer */
|
||||
void *data; /* value being passed in or out */
|
||||
size_t data_size; /* data size */
|
||||
size_t return_size; /* returned content size */
|
||||
};
|
||||
|
||||
/* Currently supported OSSL_PARAM data types */
|
||||
/*
|
||||
* OSSL_PARAM_INTEGER and OSSL_PARAM_UNSIGNED_INTEGER
|
||||
* are arbitrary length and therefore require an arbitrarily sized buffer,
|
||||
* since they may be used to pass numbers larger than what is natively
|
||||
* available.
|
||||
*
|
||||
* The number must be buffered in native form, i.e. MSB first on B_ENDIAN
|
||||
* systems and LSB first on L_ENDIAN systems. This means that arbitrary
|
||||
* native integers can be stored in the buffer, just make sure that the
|
||||
* buffer size is correct and the buffer itself is properly aligned (for
|
||||
* example by having the buffer field point at a C integer).
|
||||
*/
|
||||
# define OSSL_PARAM_INTEGER 1
|
||||
# define OSSL_PARAM_UNSIGNED_INTEGER 2
|
||||
/*-
|
||||
* OSSL_PARAM_REAL
|
||||
* is a C binary floating point values in native form and alignment.
|
||||
*/
|
||||
# define OSSL_PARAM_REAL 3
|
||||
/*-
|
||||
* OSSL_PARAM_UTF8_STRING
|
||||
* is a printable string. It is expected to be printed as it is.
|
||||
*/
|
||||
# define OSSL_PARAM_UTF8_STRING 4
|
||||
/*-
|
||||
* OSSL_PARAM_OCTET_STRING
|
||||
* is a string of bytes with no further specification. It is expected to be
|
||||
* printed as a hexdump.
|
||||
*/
|
||||
# define OSSL_PARAM_OCTET_STRING 5
|
||||
/*-
|
||||
* OSSL_PARAM_UTF8_PTR
|
||||
* is a pointer to a printable string. It is expected to be printed as it is.
|
||||
*
|
||||
* The difference between this and OSSL_PARAM_UTF8_STRING is that only pointers
|
||||
* are manipulated for this type.
|
||||
*
|
||||
* This is more relevant for parameter requests, where the responding
|
||||
* function doesn't need to copy the data to the provided buffer, but
|
||||
* sets the provided buffer to point at the actual data instead.
|
||||
*
|
||||
* WARNING! Using these is FRAGILE, as it assumes that the actual
|
||||
* data and its location are constant.
|
||||
*
|
||||
* EXTRA WARNING! If you are not completely sure you most likely want
|
||||
* to use the OSSL_PARAM_UTF8_STRING type.
|
||||
*/
|
||||
# define OSSL_PARAM_UTF8_PTR 6
|
||||
/*-
|
||||
* OSSL_PARAM_OCTET_PTR
|
||||
* is a pointer to a string of bytes with no further specification. It is
|
||||
* expected to be printed as a hexdump.
|
||||
*
|
||||
* The difference between this and OSSL_PARAM_OCTET_STRING is that only pointers
|
||||
* are manipulated for this type.
|
||||
*
|
||||
* This is more relevant for parameter requests, where the responding
|
||||
* function doesn't need to copy the data to the provided buffer, but
|
||||
* sets the provided buffer to point at the actual data instead.
|
||||
*
|
||||
* WARNING! Using these is FRAGILE, as it assumes that the actual
|
||||
* data and its location are constant.
|
||||
*
|
||||
* EXTRA WARNING! If you are not completely sure you most likely want
|
||||
* to use the OSSL_PARAM_OCTET_STRING type.
|
||||
*/
|
||||
# define OSSL_PARAM_OCTET_PTR 7
|
||||
|
||||
/*
|
||||
* Typedef for the thread stop handling callback. Used both internally and by
|
||||
* providers.
|
||||
*
|
||||
* Providers may register for notifications about threads stopping by
|
||||
* registering a callback to hear about such events. Providers register the
|
||||
* callback using the OSSL_FUNC_CORE_THREAD_START function in the |in| dispatch
|
||||
* table passed to OSSL_provider_init(). The arg passed back to a provider will
|
||||
* be the provider side context object.
|
||||
*/
|
||||
typedef void (*OSSL_thread_stop_handler_fn)(void *arg);
|
||||
|
||||
|
||||
/*-
|
||||
* Provider entry point
|
||||
* --------------------
|
||||
*
|
||||
* This function is expected to be present in any dynamically loadable
|
||||
* provider module. By definition, if this function doesn't exist in a
|
||||
* module, that module is not an OpenSSL provider module.
|
||||
*/
|
||||
/*-
|
||||
* |handle| pointer to opaque type OSSL_CORE_HANDLE. This can be used
|
||||
* together with some functions passed via |in| to query data.
|
||||
* |in| is the array of functions that the Core passes to the provider.
|
||||
* |out| will be the array of base functions that the provider passes
|
||||
* back to the Core.
|
||||
* |provctx| a provider side context object, optionally created if the
|
||||
* provider needs it. This value is passed to other provider
|
||||
* functions, notably other context constructors.
|
||||
*/
|
||||
typedef int (OSSL_provider_init_fn)(const OSSL_CORE_HANDLE *handle,
|
||||
const OSSL_DISPATCH *in,
|
||||
const OSSL_DISPATCH **out,
|
||||
void **provctx);
|
||||
# ifdef __VMS
|
||||
# pragma names save
|
||||
# pragma names uppercase,truncated
|
||||
# endif
|
||||
OPENSSL_EXPORT OSSL_provider_init_fn OSSL_provider_init;
|
||||
# ifdef __VMS
|
||||
# pragma names restore
|
||||
# endif
|
||||
|
||||
/*
|
||||
* Generic callback function signature.
|
||||
*
|
||||
* The expectation is that any provider function that wants to offer
|
||||
* a callback / hook can do so by taking an argument with this type,
|
||||
* as well as a pointer to caller-specific data. When calling the
|
||||
* callback, the provider function can populate an OSSL_PARAM array
|
||||
* with data of its choice and pass that in the callback call, along
|
||||
* with the caller data argument.
|
||||
*
|
||||
* libcrypto may use the OSSL_PARAM array to create arguments for an
|
||||
* application callback it knows about.
|
||||
*/
|
||||
typedef int (OSSL_CALLBACK)(const OSSL_PARAM params[], void *arg);
|
||||
typedef int (OSSL_INOUT_CALLBACK)(const OSSL_PARAM in_params[],
|
||||
OSSL_PARAM out_params[], void *arg);
|
||||
/*
|
||||
* Passphrase callback function signature
|
||||
*
|
||||
* This is similar to the generic callback function above, but adds a
|
||||
* result parameter.
|
||||
*/
|
||||
typedef int (OSSL_PASSPHRASE_CALLBACK)(char *pass, size_t pass_size,
|
||||
size_t *pass_len,
|
||||
const OSSL_PARAM params[], void *arg);
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
|
||||
#endif
|
||||
1145
thirdparty/OpenSSL-3.5.3/include/openssl/core_dispatch.h
vendored
Normal file
1145
thirdparty/OpenSSL-3.5.3/include/openssl/core_dispatch.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
575
thirdparty/OpenSSL-3.5.3/include/openssl/core_names.h
vendored
Normal file
575
thirdparty/OpenSSL-3.5.3/include/openssl/core_names.h
vendored
Normal file
@@ -0,0 +1,575 @@
|
||||
/*
|
||||
* WARNING: do not edit!
|
||||
* Generated by makefile from include\openssl\core_names.h.in
|
||||
*
|
||||
* Copyright 2019-2025 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
|
||||
#ifndef OPENSSL_CORE_NAMES_H
|
||||
# define OPENSSL_CORE_NAMES_H
|
||||
# pragma once
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
/* OSSL_CIPHER_PARAM_CTS_MODE Values */
|
||||
# define OSSL_CIPHER_CTS_MODE_CS1 "CS1"
|
||||
# define OSSL_CIPHER_CTS_MODE_CS2 "CS2"
|
||||
# define OSSL_CIPHER_CTS_MODE_CS3 "CS3"
|
||||
|
||||
/* Known CIPHER names (not a complete list) */
|
||||
# define OSSL_CIPHER_NAME_AES_128_GCM_SIV "AES-128-GCM-SIV"
|
||||
# define OSSL_CIPHER_NAME_AES_192_GCM_SIV "AES-192-GCM-SIV"
|
||||
# define OSSL_CIPHER_NAME_AES_256_GCM_SIV "AES-256-GCM-SIV"
|
||||
|
||||
/* Known DIGEST names (not a complete list) */
|
||||
# define OSSL_DIGEST_NAME_MD5 "MD5"
|
||||
# define OSSL_DIGEST_NAME_MD5_SHA1 "MD5-SHA1"
|
||||
# define OSSL_DIGEST_NAME_SHA1 "SHA1"
|
||||
# define OSSL_DIGEST_NAME_SHA2_224 "SHA2-224"
|
||||
# define OSSL_DIGEST_NAME_SHA2_256 "SHA2-256"
|
||||
# define OSSL_DIGEST_NAME_SHA2_256_192 "SHA2-256/192"
|
||||
# define OSSL_DIGEST_NAME_SHA2_384 "SHA2-384"
|
||||
# define OSSL_DIGEST_NAME_SHA2_512 "SHA2-512"
|
||||
# define OSSL_DIGEST_NAME_SHA2_512_224 "SHA2-512/224"
|
||||
# define OSSL_DIGEST_NAME_SHA2_512_256 "SHA2-512/256"
|
||||
# define OSSL_DIGEST_NAME_MD2 "MD2"
|
||||
# define OSSL_DIGEST_NAME_MD4 "MD4"
|
||||
# define OSSL_DIGEST_NAME_MDC2 "MDC2"
|
||||
# define OSSL_DIGEST_NAME_RIPEMD160 "RIPEMD160"
|
||||
# define OSSL_DIGEST_NAME_SHA3_224 "SHA3-224"
|
||||
# define OSSL_DIGEST_NAME_SHA3_256 "SHA3-256"
|
||||
# define OSSL_DIGEST_NAME_SHA3_384 "SHA3-384"
|
||||
# define OSSL_DIGEST_NAME_SHA3_512 "SHA3-512"
|
||||
# define OSSL_DIGEST_NAME_KECCAK_KMAC128 "KECCAK-KMAC-128"
|
||||
# define OSSL_DIGEST_NAME_KECCAK_KMAC256 "KECCAK-KMAC-256"
|
||||
# define OSSL_DIGEST_NAME_SM3 "SM3"
|
||||
|
||||
/* Known MAC names */
|
||||
# define OSSL_MAC_NAME_BLAKE2BMAC "BLAKE2BMAC"
|
||||
# define OSSL_MAC_NAME_BLAKE2SMAC "BLAKE2SMAC"
|
||||
# define OSSL_MAC_NAME_CMAC "CMAC"
|
||||
# define OSSL_MAC_NAME_GMAC "GMAC"
|
||||
# define OSSL_MAC_NAME_HMAC "HMAC"
|
||||
# define OSSL_MAC_NAME_KMAC128 "KMAC128"
|
||||
# define OSSL_MAC_NAME_KMAC256 "KMAC256"
|
||||
# define OSSL_MAC_NAME_POLY1305 "POLY1305"
|
||||
# define OSSL_MAC_NAME_SIPHASH "SIPHASH"
|
||||
|
||||
/* Known KDF names */
|
||||
# define OSSL_KDF_NAME_HKDF "HKDF"
|
||||
# define OSSL_KDF_NAME_TLS1_3_KDF "TLS13-KDF"
|
||||
# define OSSL_KDF_NAME_PBKDF1 "PBKDF1"
|
||||
# define OSSL_KDF_NAME_PBKDF2 "PBKDF2"
|
||||
# define OSSL_KDF_NAME_SCRYPT "SCRYPT"
|
||||
# define OSSL_KDF_NAME_SSHKDF "SSHKDF"
|
||||
# define OSSL_KDF_NAME_SSKDF "SSKDF"
|
||||
# define OSSL_KDF_NAME_TLS1_PRF "TLS1-PRF"
|
||||
# define OSSL_KDF_NAME_X942KDF_ASN1 "X942KDF-ASN1"
|
||||
# define OSSL_KDF_NAME_X942KDF_CONCAT "X942KDF-CONCAT"
|
||||
# define OSSL_KDF_NAME_X963KDF "X963KDF"
|
||||
# define OSSL_KDF_NAME_KBKDF "KBKDF"
|
||||
# define OSSL_KDF_NAME_KRB5KDF "KRB5KDF"
|
||||
# define OSSL_KDF_NAME_HMACDRBGKDF "HMAC-DRBG-KDF"
|
||||
|
||||
/* RSA padding modes */
|
||||
# define OSSL_PKEY_RSA_PAD_MODE_NONE "none"
|
||||
# define OSSL_PKEY_RSA_PAD_MODE_PKCSV15 "pkcs1"
|
||||
# define OSSL_PKEY_RSA_PAD_MODE_OAEP "oaep"
|
||||
# define OSSL_PKEY_RSA_PAD_MODE_X931 "x931"
|
||||
# define OSSL_PKEY_RSA_PAD_MODE_PSS "pss"
|
||||
|
||||
/* RSA pss padding salt length */
|
||||
# define OSSL_PKEY_RSA_PSS_SALT_LEN_DIGEST "digest"
|
||||
# define OSSL_PKEY_RSA_PSS_SALT_LEN_MAX "max"
|
||||
# define OSSL_PKEY_RSA_PSS_SALT_LEN_AUTO "auto"
|
||||
# define OSSL_PKEY_RSA_PSS_SALT_LEN_AUTO_DIGEST_MAX "auto-digestmax"
|
||||
|
||||
/* OSSL_PKEY_PARAM_EC_ENCODING values */
|
||||
# define OSSL_PKEY_EC_ENCODING_EXPLICIT "explicit"
|
||||
# define OSSL_PKEY_EC_ENCODING_GROUP "named_curve"
|
||||
|
||||
# define OSSL_PKEY_EC_POINT_CONVERSION_FORMAT_UNCOMPRESSED "uncompressed"
|
||||
# define OSSL_PKEY_EC_POINT_CONVERSION_FORMAT_COMPRESSED "compressed"
|
||||
# define OSSL_PKEY_EC_POINT_CONVERSION_FORMAT_HYBRID "hybrid"
|
||||
|
||||
# define OSSL_PKEY_EC_GROUP_CHECK_DEFAULT "default"
|
||||
# define OSSL_PKEY_EC_GROUP_CHECK_NAMED "named"
|
||||
# define OSSL_PKEY_EC_GROUP_CHECK_NAMED_NIST "named-nist"
|
||||
|
||||
/* PROV_SKEY well known key types */
|
||||
# define OSSL_SKEY_TYPE_GENERIC "GENERIC-SECRET"
|
||||
# define OSSL_SKEY_TYPE_AES "AES"
|
||||
|
||||
/* OSSL_KEM_PARAM_OPERATION values */
|
||||
#define OSSL_KEM_PARAM_OPERATION_RSASVE "RSASVE"
|
||||
#define OSSL_KEM_PARAM_OPERATION_DHKEM "DHKEM"
|
||||
|
||||
/* Provider configuration variables */
|
||||
#define OSSL_PKEY_RETAIN_SEED "pkey_retain_seed"
|
||||
|
||||
/* Parameter name definitions - generated by util/perl/OpenSSL/paramnames.pm */
|
||||
# define OSSL_ALG_PARAM_ALGORITHM_ID "algorithm-id"
|
||||
# define OSSL_ALG_PARAM_ALGORITHM_ID_PARAMS "algorithm-id-params"
|
||||
# define OSSL_ALG_PARAM_CIPHER "cipher"
|
||||
# define OSSL_ALG_PARAM_DIGEST "digest"
|
||||
# define OSSL_ALG_PARAM_ENGINE "engine"
|
||||
# define OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR "fips-indicator"
|
||||
# define OSSL_ALG_PARAM_MAC "mac"
|
||||
# define OSSL_ALG_PARAM_PROPERTIES "properties"
|
||||
# define OSSL_ASYM_CIPHER_PARAM_DIGEST OSSL_PKEY_PARAM_DIGEST
|
||||
# define OSSL_ASYM_CIPHER_PARAM_ENGINE OSSL_PKEY_PARAM_ENGINE
|
||||
# define OSSL_ASYM_CIPHER_PARAM_FIPS_APPROVED_INDICATOR OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR
|
||||
# define OSSL_ASYM_CIPHER_PARAM_FIPS_KEY_CHECK OSSL_PKEY_PARAM_FIPS_KEY_CHECK
|
||||
# define OSSL_ASYM_CIPHER_PARAM_FIPS_RSA_PKCS15_PAD_DISABLED OSSL_PROV_PARAM_RSA_PKCS15_PAD_DISABLED
|
||||
# define OSSL_ASYM_CIPHER_PARAM_IMPLICIT_REJECTION "implicit-rejection"
|
||||
# define OSSL_ASYM_CIPHER_PARAM_MGF1_DIGEST OSSL_PKEY_PARAM_MGF1_DIGEST
|
||||
# define OSSL_ASYM_CIPHER_PARAM_MGF1_DIGEST_PROPS OSSL_PKEY_PARAM_MGF1_PROPERTIES
|
||||
# define OSSL_ASYM_CIPHER_PARAM_OAEP_DIGEST OSSL_ALG_PARAM_DIGEST
|
||||
# define OSSL_ASYM_CIPHER_PARAM_OAEP_DIGEST_PROPS "digest-props"
|
||||
# define OSSL_ASYM_CIPHER_PARAM_OAEP_LABEL "oaep-label"
|
||||
# define OSSL_ASYM_CIPHER_PARAM_PAD_MODE OSSL_PKEY_PARAM_PAD_MODE
|
||||
# define OSSL_ASYM_CIPHER_PARAM_PROPERTIES OSSL_PKEY_PARAM_PROPERTIES
|
||||
# define OSSL_ASYM_CIPHER_PARAM_TLS_CLIENT_VERSION "tls-client-version"
|
||||
# define OSSL_ASYM_CIPHER_PARAM_TLS_NEGOTIATED_VERSION "tls-negotiated-version"
|
||||
# define OSSL_CAPABILITY_TLS_GROUP_ALG "tls-group-alg"
|
||||
# define OSSL_CAPABILITY_TLS_GROUP_ID "tls-group-id"
|
||||
# define OSSL_CAPABILITY_TLS_GROUP_IS_KEM "tls-group-is-kem"
|
||||
# define OSSL_CAPABILITY_TLS_GROUP_MAX_DTLS "tls-max-dtls"
|
||||
# define OSSL_CAPABILITY_TLS_GROUP_MAX_TLS "tls-max-tls"
|
||||
# define OSSL_CAPABILITY_TLS_GROUP_MIN_DTLS "tls-min-dtls"
|
||||
# define OSSL_CAPABILITY_TLS_GROUP_MIN_TLS "tls-min-tls"
|
||||
# define OSSL_CAPABILITY_TLS_GROUP_NAME "tls-group-name"
|
||||
# define OSSL_CAPABILITY_TLS_GROUP_NAME_INTERNAL "tls-group-name-internal"
|
||||
# define OSSL_CAPABILITY_TLS_GROUP_SECURITY_BITS "tls-group-sec-bits"
|
||||
# define OSSL_CAPABILITY_TLS_SIGALG_CODE_POINT "tls-sigalg-code-point"
|
||||
# define OSSL_CAPABILITY_TLS_SIGALG_HASH_NAME "tls-sigalg-hash-name"
|
||||
# define OSSL_CAPABILITY_TLS_SIGALG_HASH_OID "tls-sigalg-hash-oid"
|
||||
# define OSSL_CAPABILITY_TLS_SIGALG_IANA_NAME "tls-sigalg-iana-name"
|
||||
# define OSSL_CAPABILITY_TLS_SIGALG_KEYTYPE "tls-sigalg-keytype"
|
||||
# define OSSL_CAPABILITY_TLS_SIGALG_KEYTYPE_OID "tls-sigalg-keytype-oid"
|
||||
# define OSSL_CAPABILITY_TLS_SIGALG_MAX_DTLS "tls-max-dtls"
|
||||
# define OSSL_CAPABILITY_TLS_SIGALG_MAX_TLS "tls-max-tls"
|
||||
# define OSSL_CAPABILITY_TLS_SIGALG_MIN_DTLS "tls-min-dtls"
|
||||
# define OSSL_CAPABILITY_TLS_SIGALG_MIN_TLS "tls-min-tls"
|
||||
# define OSSL_CAPABILITY_TLS_SIGALG_NAME "tls-sigalg-name"
|
||||
# define OSSL_CAPABILITY_TLS_SIGALG_OID "tls-sigalg-oid"
|
||||
# define OSSL_CAPABILITY_TLS_SIGALG_SECURITY_BITS "tls-sigalg-sec-bits"
|
||||
# define OSSL_CAPABILITY_TLS_SIGALG_SIG_NAME "tls-sigalg-sig-name"
|
||||
# define OSSL_CAPABILITY_TLS_SIGALG_SIG_OID "tls-sigalg-sig-oid"
|
||||
# define OSSL_CIPHER_PARAM_AEAD "aead"
|
||||
# define OSSL_CIPHER_PARAM_AEAD_IVLEN OSSL_CIPHER_PARAM_IVLEN
|
||||
# define OSSL_CIPHER_PARAM_AEAD_IV_GENERATED "iv-generated"
|
||||
# define OSSL_CIPHER_PARAM_AEAD_MAC_KEY "mackey"
|
||||
# define OSSL_CIPHER_PARAM_AEAD_TAG "tag"
|
||||
# define OSSL_CIPHER_PARAM_AEAD_TAGLEN "taglen"
|
||||
# define OSSL_CIPHER_PARAM_AEAD_TLS1_AAD "tlsaad"
|
||||
# define OSSL_CIPHER_PARAM_AEAD_TLS1_AAD_PAD "tlsaadpad"
|
||||
# define OSSL_CIPHER_PARAM_AEAD_TLS1_GET_IV_GEN "tlsivgen"
|
||||
# define OSSL_CIPHER_PARAM_AEAD_TLS1_IV_FIXED "tlsivfixed"
|
||||
# define OSSL_CIPHER_PARAM_AEAD_TLS1_SET_IV_INV "tlsivinv"
|
||||
# define OSSL_CIPHER_PARAM_ALGORITHM_ID OSSL_ALG_PARAM_ALGORITHM_ID
|
||||
# define OSSL_CIPHER_PARAM_ALGORITHM_ID_PARAMS OSSL_ALG_PARAM_ALGORITHM_ID_PARAMS
|
||||
# define OSSL_CIPHER_PARAM_ALGORITHM_ID_PARAMS_OLD "alg_id_param"
|
||||
# define OSSL_CIPHER_PARAM_BLOCK_SIZE "blocksize"
|
||||
# define OSSL_CIPHER_PARAM_CTS "cts"
|
||||
# define OSSL_CIPHER_PARAM_CTS_MODE "cts_mode"
|
||||
# define OSSL_CIPHER_PARAM_CUSTOM_IV "custom-iv"
|
||||
# define OSSL_CIPHER_PARAM_DECRYPT_ONLY "decrypt-only"
|
||||
# define OSSL_CIPHER_PARAM_FIPS_APPROVED_INDICATOR OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR
|
||||
# define OSSL_CIPHER_PARAM_FIPS_ENCRYPT_CHECK "encrypt-check"
|
||||
# define OSSL_CIPHER_PARAM_HAS_RAND_KEY "has-randkey"
|
||||
# define OSSL_CIPHER_PARAM_IV "iv"
|
||||
# define OSSL_CIPHER_PARAM_IVLEN "ivlen"
|
||||
# define OSSL_CIPHER_PARAM_KEYLEN "keylen"
|
||||
# define OSSL_CIPHER_PARAM_MODE "mode"
|
||||
# define OSSL_CIPHER_PARAM_NUM "num"
|
||||
# define OSSL_CIPHER_PARAM_PADDING "padding"
|
||||
# define OSSL_CIPHER_PARAM_PIPELINE_AEAD_TAG "pipeline-tag"
|
||||
# define OSSL_CIPHER_PARAM_RANDOM_KEY "randkey"
|
||||
# define OSSL_CIPHER_PARAM_RC2_KEYBITS "keybits"
|
||||
# define OSSL_CIPHER_PARAM_ROUNDS "rounds"
|
||||
# define OSSL_CIPHER_PARAM_SPEED "speed"
|
||||
# define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK "tls-multi"
|
||||
# define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_AAD "tls1multi_aad"
|
||||
# define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_AAD_PACKLEN "tls1multi_aadpacklen"
|
||||
# define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_ENC "tls1multi_enc"
|
||||
# define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_ENC_IN "tls1multi_encin"
|
||||
# define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_ENC_LEN "tls1multi_enclen"
|
||||
# define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_INTERLEAVE "tls1multi_interleave"
|
||||
# define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_MAX_BUFSIZE "tls1multi_maxbufsz"
|
||||
# define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_MAX_SEND_FRAGMENT "tls1multi_maxsndfrag"
|
||||
# define OSSL_CIPHER_PARAM_TLS_MAC "tls-mac"
|
||||
# define OSSL_CIPHER_PARAM_TLS_MAC_SIZE "tls-mac-size"
|
||||
# define OSSL_CIPHER_PARAM_TLS_VERSION "tls-version"
|
||||
# define OSSL_CIPHER_PARAM_UPDATED_IV "updated-iv"
|
||||
# define OSSL_CIPHER_PARAM_USE_BITS "use-bits"
|
||||
# define OSSL_CIPHER_PARAM_XTS_STANDARD "xts_standard"
|
||||
# define OSSL_DECODER_PARAM_PROPERTIES OSSL_ALG_PARAM_PROPERTIES
|
||||
# define OSSL_DIGEST_PARAM_ALGID_ABSENT "algid-absent"
|
||||
# define OSSL_DIGEST_PARAM_BLOCK_SIZE "blocksize"
|
||||
# define OSSL_DIGEST_PARAM_MICALG "micalg"
|
||||
# define OSSL_DIGEST_PARAM_PAD_TYPE "pad-type"
|
||||
# define OSSL_DIGEST_PARAM_SIZE "size"
|
||||
# define OSSL_DIGEST_PARAM_SSL3_MS "ssl3-ms"
|
||||
# define OSSL_DIGEST_PARAM_XOF "xof"
|
||||
# define OSSL_DIGEST_PARAM_XOFLEN "xoflen"
|
||||
# define OSSL_DRBG_PARAM_CIPHER OSSL_ALG_PARAM_CIPHER
|
||||
# define OSSL_DRBG_PARAM_DIGEST OSSL_ALG_PARAM_DIGEST
|
||||
# define OSSL_DRBG_PARAM_ENTROPY_REQUIRED "entropy_required"
|
||||
# define OSSL_DRBG_PARAM_FIPS_APPROVED_INDICATOR OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR
|
||||
# define OSSL_DRBG_PARAM_FIPS_DIGEST_CHECK OSSL_PKEY_PARAM_FIPS_DIGEST_CHECK
|
||||
# define OSSL_DRBG_PARAM_MAC OSSL_ALG_PARAM_MAC
|
||||
# define OSSL_DRBG_PARAM_MAX_ADINLEN "max_adinlen"
|
||||
# define OSSL_DRBG_PARAM_MAX_ENTROPYLEN "max_entropylen"
|
||||
# define OSSL_DRBG_PARAM_MAX_LENGTH "maxium_length"
|
||||
# define OSSL_DRBG_PARAM_MAX_NONCELEN "max_noncelen"
|
||||
# define OSSL_DRBG_PARAM_MAX_PERSLEN "max_perslen"
|
||||
# define OSSL_DRBG_PARAM_MIN_ENTROPYLEN "min_entropylen"
|
||||
# define OSSL_DRBG_PARAM_MIN_LENGTH "minium_length"
|
||||
# define OSSL_DRBG_PARAM_MIN_NONCELEN "min_noncelen"
|
||||
# define OSSL_DRBG_PARAM_PREDICTION_RESISTANCE "prediction_resistance"
|
||||
# define OSSL_DRBG_PARAM_PROPERTIES OSSL_ALG_PARAM_PROPERTIES
|
||||
# define OSSL_DRBG_PARAM_RANDOM_DATA "random_data"
|
||||
# define OSSL_DRBG_PARAM_RESEED_COUNTER "reseed_counter"
|
||||
# define OSSL_DRBG_PARAM_RESEED_REQUESTS "reseed_requests"
|
||||
# define OSSL_DRBG_PARAM_RESEED_TIME "reseed_time"
|
||||
# define OSSL_DRBG_PARAM_RESEED_TIME_INTERVAL "reseed_time_interval"
|
||||
# define OSSL_DRBG_PARAM_SIZE "size"
|
||||
# define OSSL_DRBG_PARAM_USE_DF "use_derivation_function"
|
||||
# define OSSL_ENCODER_PARAM_CIPHER OSSL_ALG_PARAM_CIPHER
|
||||
# define OSSL_ENCODER_PARAM_ENCRYPT_LEVEL "encrypt-level"
|
||||
# define OSSL_ENCODER_PARAM_PROPERTIES OSSL_ALG_PARAM_PROPERTIES
|
||||
# define OSSL_ENCODER_PARAM_SAVE_PARAMETERS "save-parameters"
|
||||
# define OSSL_EXCHANGE_PARAM_EC_ECDH_COFACTOR_MODE "ecdh-cofactor-mode"
|
||||
# define OSSL_EXCHANGE_PARAM_FIPS_APPROVED_INDICATOR OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR
|
||||
# define OSSL_EXCHANGE_PARAM_FIPS_DIGEST_CHECK OSSL_PKEY_PARAM_FIPS_DIGEST_CHECK
|
||||
# define OSSL_EXCHANGE_PARAM_FIPS_ECDH_COFACTOR_CHECK OSSL_PROV_PARAM_ECDH_COFACTOR_CHECK
|
||||
# define OSSL_EXCHANGE_PARAM_FIPS_KEY_CHECK OSSL_PKEY_PARAM_FIPS_KEY_CHECK
|
||||
# define OSSL_EXCHANGE_PARAM_KDF_DIGEST "kdf-digest"
|
||||
# define OSSL_EXCHANGE_PARAM_KDF_DIGEST_PROPS "kdf-digest-props"
|
||||
# define OSSL_EXCHANGE_PARAM_KDF_OUTLEN "kdf-outlen"
|
||||
# define OSSL_EXCHANGE_PARAM_KDF_TYPE "kdf-type"
|
||||
# define OSSL_EXCHANGE_PARAM_KDF_UKM "kdf-ukm"
|
||||
# define OSSL_EXCHANGE_PARAM_PAD "pad"
|
||||
# define OSSL_GEN_PARAM_ITERATION "iteration"
|
||||
# define OSSL_GEN_PARAM_POTENTIAL "potential"
|
||||
# define OSSL_KDF_PARAM_ARGON2_AD "ad"
|
||||
# define OSSL_KDF_PARAM_ARGON2_LANES "lanes"
|
||||
# define OSSL_KDF_PARAM_ARGON2_MEMCOST "memcost"
|
||||
# define OSSL_KDF_PARAM_ARGON2_VERSION "version"
|
||||
# define OSSL_KDF_PARAM_CEK_ALG "cekalg"
|
||||
# define OSSL_KDF_PARAM_CIPHER OSSL_ALG_PARAM_CIPHER
|
||||
# define OSSL_KDF_PARAM_CONSTANT "constant"
|
||||
# define OSSL_KDF_PARAM_DATA "data"
|
||||
# define OSSL_KDF_PARAM_DIGEST OSSL_ALG_PARAM_DIGEST
|
||||
# define OSSL_KDF_PARAM_EARLY_CLEAN "early_clean"
|
||||
# define OSSL_KDF_PARAM_FIPS_APPROVED_INDICATOR OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR
|
||||
# define OSSL_KDF_PARAM_FIPS_DIGEST_CHECK OSSL_PKEY_PARAM_FIPS_DIGEST_CHECK
|
||||
# define OSSL_KDF_PARAM_FIPS_EMS_CHECK "ems_check"
|
||||
# define OSSL_KDF_PARAM_FIPS_KEY_CHECK OSSL_PKEY_PARAM_FIPS_KEY_CHECK
|
||||
# define OSSL_KDF_PARAM_HMACDRBG_ENTROPY "entropy"
|
||||
# define OSSL_KDF_PARAM_HMACDRBG_NONCE "nonce"
|
||||
# define OSSL_KDF_PARAM_INFO "info"
|
||||
# define OSSL_KDF_PARAM_ITER "iter"
|
||||
# define OSSL_KDF_PARAM_KBKDF_R "r"
|
||||
# define OSSL_KDF_PARAM_KBKDF_USE_L "use-l"
|
||||
# define OSSL_KDF_PARAM_KBKDF_USE_SEPARATOR "use-separator"
|
||||
# define OSSL_KDF_PARAM_KEY "key"
|
||||
# define OSSL_KDF_PARAM_LABEL "label"
|
||||
# define OSSL_KDF_PARAM_MAC OSSL_ALG_PARAM_MAC
|
||||
# define OSSL_KDF_PARAM_MAC_SIZE "maclen"
|
||||
# define OSSL_KDF_PARAM_MODE "mode"
|
||||
# define OSSL_KDF_PARAM_PASSWORD "pass"
|
||||
# define OSSL_KDF_PARAM_PKCS12_ID "id"
|
||||
# define OSSL_KDF_PARAM_PKCS5 "pkcs5"
|
||||
# define OSSL_KDF_PARAM_PREFIX "prefix"
|
||||
# define OSSL_KDF_PARAM_PROPERTIES OSSL_ALG_PARAM_PROPERTIES
|
||||
# define OSSL_KDF_PARAM_SALT "salt"
|
||||
# define OSSL_KDF_PARAM_SCRYPT_MAXMEM "maxmem_bytes"
|
||||
# define OSSL_KDF_PARAM_SCRYPT_N "n"
|
||||
# define OSSL_KDF_PARAM_SCRYPT_P "p"
|
||||
# define OSSL_KDF_PARAM_SCRYPT_R "r"
|
||||
# define OSSL_KDF_PARAM_SECRET "secret"
|
||||
# define OSSL_KDF_PARAM_SEED "seed"
|
||||
# define OSSL_KDF_PARAM_SIZE "size"
|
||||
# define OSSL_KDF_PARAM_SSHKDF_SESSION_ID "session_id"
|
||||
# define OSSL_KDF_PARAM_SSHKDF_TYPE "type"
|
||||
# define OSSL_KDF_PARAM_SSHKDF_XCGHASH "xcghash"
|
||||
# define OSSL_KDF_PARAM_THREADS "threads"
|
||||
# define OSSL_KDF_PARAM_UKM "ukm"
|
||||
# define OSSL_KDF_PARAM_X942_ACVPINFO "acvp-info"
|
||||
# define OSSL_KDF_PARAM_X942_PARTYUINFO "partyu-info"
|
||||
# define OSSL_KDF_PARAM_X942_PARTYVINFO "partyv-info"
|
||||
# define OSSL_KDF_PARAM_X942_SUPP_PRIVINFO "supp-privinfo"
|
||||
# define OSSL_KDF_PARAM_X942_SUPP_PUBINFO "supp-pubinfo"
|
||||
# define OSSL_KDF_PARAM_X942_USE_KEYBITS "use-keybits"
|
||||
# define OSSL_KEM_PARAM_FIPS_APPROVED_INDICATOR OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR
|
||||
# define OSSL_KEM_PARAM_FIPS_KEY_CHECK OSSL_PKEY_PARAM_FIPS_KEY_CHECK
|
||||
# define OSSL_KEM_PARAM_IKME "ikme"
|
||||
# define OSSL_KEM_PARAM_OPERATION "operation"
|
||||
# define OSSL_LIBSSL_RECORD_LAYER_PARAM_BLOCK_PADDING "block_padding"
|
||||
# define OSSL_LIBSSL_RECORD_LAYER_PARAM_HS_PADDING "hs_padding"
|
||||
# define OSSL_LIBSSL_RECORD_LAYER_PARAM_MAX_EARLY_DATA "max_early_data"
|
||||
# define OSSL_LIBSSL_RECORD_LAYER_PARAM_MAX_FRAG_LEN "max_frag_len"
|
||||
# define OSSL_LIBSSL_RECORD_LAYER_PARAM_MODE "mode"
|
||||
# define OSSL_LIBSSL_RECORD_LAYER_PARAM_OPTIONS "options"
|
||||
# define OSSL_LIBSSL_RECORD_LAYER_PARAM_READ_AHEAD "read_ahead"
|
||||
# define OSSL_LIBSSL_RECORD_LAYER_PARAM_STREAM_MAC "stream_mac"
|
||||
# define OSSL_LIBSSL_RECORD_LAYER_PARAM_TLSTREE "tlstree"
|
||||
# define OSSL_LIBSSL_RECORD_LAYER_PARAM_USE_ETM "use_etm"
|
||||
# define OSSL_LIBSSL_RECORD_LAYER_READ_BUFFER_LEN "read_buffer_len"
|
||||
# define OSSL_MAC_PARAM_BLOCK_SIZE "block-size"
|
||||
# define OSSL_MAC_PARAM_CIPHER OSSL_ALG_PARAM_CIPHER
|
||||
# define OSSL_MAC_PARAM_CUSTOM "custom"
|
||||
# define OSSL_MAC_PARAM_C_ROUNDS "c-rounds"
|
||||
# define OSSL_MAC_PARAM_DIGEST OSSL_ALG_PARAM_DIGEST
|
||||
# define OSSL_MAC_PARAM_DIGEST_NOINIT "digest-noinit"
|
||||
# define OSSL_MAC_PARAM_DIGEST_ONESHOT "digest-oneshot"
|
||||
# define OSSL_MAC_PARAM_D_ROUNDS "d-rounds"
|
||||
# define OSSL_MAC_PARAM_FIPS_APPROVED_INDICATOR OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR
|
||||
# define OSSL_MAC_PARAM_FIPS_KEY_CHECK OSSL_PKEY_PARAM_FIPS_KEY_CHECK
|
||||
# define OSSL_MAC_PARAM_FIPS_NO_SHORT_MAC OSSL_PROV_PARAM_NO_SHORT_MAC
|
||||
# define OSSL_MAC_PARAM_IV "iv"
|
||||
# define OSSL_MAC_PARAM_KEY "key"
|
||||
# define OSSL_MAC_PARAM_PROPERTIES OSSL_ALG_PARAM_PROPERTIES
|
||||
# define OSSL_MAC_PARAM_SALT "salt"
|
||||
# define OSSL_MAC_PARAM_SIZE "size"
|
||||
# define OSSL_MAC_PARAM_TLS_DATA_SIZE "tls-data-size"
|
||||
# define OSSL_MAC_PARAM_XOF "xof"
|
||||
# define OSSL_OBJECT_PARAM_DATA "data"
|
||||
# define OSSL_OBJECT_PARAM_DATA_STRUCTURE "data-structure"
|
||||
# define OSSL_OBJECT_PARAM_DATA_TYPE "data-type"
|
||||
# define OSSL_OBJECT_PARAM_DESC "desc"
|
||||
# define OSSL_OBJECT_PARAM_INPUT_TYPE "input-type"
|
||||
# define OSSL_OBJECT_PARAM_REFERENCE "reference"
|
||||
# define OSSL_OBJECT_PARAM_TYPE "type"
|
||||
# define OSSL_PASSPHRASE_PARAM_INFO "info"
|
||||
# define OSSL_PKEY_PARAM_ALGORITHM_ID OSSL_ALG_PARAM_ALGORITHM_ID
|
||||
# define OSSL_PKEY_PARAM_ALGORITHM_ID_PARAMS OSSL_ALG_PARAM_ALGORITHM_ID_PARAMS
|
||||
# define OSSL_PKEY_PARAM_BITS "bits"
|
||||
# define OSSL_PKEY_PARAM_CIPHER OSSL_ALG_PARAM_CIPHER
|
||||
# define OSSL_PKEY_PARAM_DEFAULT_DIGEST "default-digest"
|
||||
# define OSSL_PKEY_PARAM_DHKEM_IKM "dhkem-ikm"
|
||||
# define OSSL_PKEY_PARAM_DH_GENERATOR "safeprime-generator"
|
||||
# define OSSL_PKEY_PARAM_DH_PRIV_LEN "priv_len"
|
||||
# define OSSL_PKEY_PARAM_DIGEST OSSL_ALG_PARAM_DIGEST
|
||||
# define OSSL_PKEY_PARAM_DIGEST_SIZE "digest-size"
|
||||
# define OSSL_PKEY_PARAM_DIST_ID "distid"
|
||||
# define OSSL_PKEY_PARAM_EC_A "a"
|
||||
# define OSSL_PKEY_PARAM_EC_B "b"
|
||||
# define OSSL_PKEY_PARAM_EC_CHAR2_M "m"
|
||||
# define OSSL_PKEY_PARAM_EC_CHAR2_PP_K1 "k1"
|
||||
# define OSSL_PKEY_PARAM_EC_CHAR2_PP_K2 "k2"
|
||||
# define OSSL_PKEY_PARAM_EC_CHAR2_PP_K3 "k3"
|
||||
# define OSSL_PKEY_PARAM_EC_CHAR2_TP_BASIS "tp"
|
||||
# define OSSL_PKEY_PARAM_EC_CHAR2_TYPE "basis-type"
|
||||
# define OSSL_PKEY_PARAM_EC_COFACTOR "cofactor"
|
||||
# define OSSL_PKEY_PARAM_EC_DECODED_FROM_EXPLICIT_PARAMS "decoded-from-explicit"
|
||||
# define OSSL_PKEY_PARAM_EC_ENCODING "encoding"
|
||||
# define OSSL_PKEY_PARAM_EC_FIELD_TYPE "field-type"
|
||||
# define OSSL_PKEY_PARAM_EC_GENERATOR "generator"
|
||||
# define OSSL_PKEY_PARAM_EC_GROUP_CHECK_TYPE "group-check"
|
||||
# define OSSL_PKEY_PARAM_EC_INCLUDE_PUBLIC "include-public"
|
||||
# define OSSL_PKEY_PARAM_EC_ORDER "order"
|
||||
# define OSSL_PKEY_PARAM_EC_P "p"
|
||||
# define OSSL_PKEY_PARAM_EC_POINT_CONVERSION_FORMAT "point-format"
|
||||
# define OSSL_PKEY_PARAM_EC_PUB_X "qx"
|
||||
# define OSSL_PKEY_PARAM_EC_PUB_Y "qy"
|
||||
# define OSSL_PKEY_PARAM_EC_SEED "seed"
|
||||
# define OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY "encoded-pub-key"
|
||||
# define OSSL_PKEY_PARAM_ENGINE OSSL_ALG_PARAM_ENGINE
|
||||
# define OSSL_PKEY_PARAM_FFC_COFACTOR "j"
|
||||
# define OSSL_PKEY_PARAM_FFC_DIGEST OSSL_PKEY_PARAM_DIGEST
|
||||
# define OSSL_PKEY_PARAM_FFC_DIGEST_PROPS OSSL_PKEY_PARAM_PROPERTIES
|
||||
# define OSSL_PKEY_PARAM_FFC_G "g"
|
||||
# define OSSL_PKEY_PARAM_FFC_GINDEX "gindex"
|
||||
# define OSSL_PKEY_PARAM_FFC_H "hindex"
|
||||
# define OSSL_PKEY_PARAM_FFC_P "p"
|
||||
# define OSSL_PKEY_PARAM_FFC_PBITS "pbits"
|
||||
# define OSSL_PKEY_PARAM_FFC_PCOUNTER "pcounter"
|
||||
# define OSSL_PKEY_PARAM_FFC_Q "q"
|
||||
# define OSSL_PKEY_PARAM_FFC_QBITS "qbits"
|
||||
# define OSSL_PKEY_PARAM_FFC_SEED "seed"
|
||||
# define OSSL_PKEY_PARAM_FFC_TYPE "type"
|
||||
# define OSSL_PKEY_PARAM_FFC_VALIDATE_G "validate-g"
|
||||
# define OSSL_PKEY_PARAM_FFC_VALIDATE_LEGACY "validate-legacy"
|
||||
# define OSSL_PKEY_PARAM_FFC_VALIDATE_PQ "validate-pq"
|
||||
# define OSSL_PKEY_PARAM_FIPS_APPROVED_INDICATOR OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR
|
||||
# define OSSL_PKEY_PARAM_FIPS_DIGEST_CHECK "digest-check"
|
||||
# define OSSL_PKEY_PARAM_FIPS_KEY_CHECK "key-check"
|
||||
# define OSSL_PKEY_PARAM_FIPS_SIGN_CHECK "sign-check"
|
||||
# define OSSL_PKEY_PARAM_GROUP_NAME "group"
|
||||
# define OSSL_PKEY_PARAM_IMPLICIT_REJECTION "implicit-rejection"
|
||||
# define OSSL_PKEY_PARAM_MANDATORY_DIGEST "mandatory-digest"
|
||||
# define OSSL_PKEY_PARAM_MASKGENFUNC "mgf"
|
||||
# define OSSL_PKEY_PARAM_MAX_SIZE "max-size"
|
||||
# define OSSL_PKEY_PARAM_MGF1_DIGEST "mgf1-digest"
|
||||
# define OSSL_PKEY_PARAM_MGF1_PROPERTIES "mgf1-properties"
|
||||
# define OSSL_PKEY_PARAM_ML_DSA_INPUT_FORMATS "ml-dsa.input_formats"
|
||||
# define OSSL_PKEY_PARAM_ML_DSA_OUTPUT_FORMATS "ml-dsa.output_formats"
|
||||
# define OSSL_PKEY_PARAM_ML_DSA_PREFER_SEED "ml-dsa.prefer_seed"
|
||||
# define OSSL_PKEY_PARAM_ML_DSA_RETAIN_SEED "ml-dsa.retain_seed"
|
||||
# define OSSL_PKEY_PARAM_ML_DSA_SEED "seed"
|
||||
# define OSSL_PKEY_PARAM_ML_KEM_IMPORT_PCT_TYPE "ml-kem.import_pct_type"
|
||||
# define OSSL_PKEY_PARAM_ML_KEM_INPUT_FORMATS "ml-kem.input_formats"
|
||||
# define OSSL_PKEY_PARAM_ML_KEM_OUTPUT_FORMATS "ml-kem.output_formats"
|
||||
# define OSSL_PKEY_PARAM_ML_KEM_PREFER_SEED "ml-kem.prefer_seed"
|
||||
# define OSSL_PKEY_PARAM_ML_KEM_RETAIN_SEED "ml-kem.retain_seed"
|
||||
# define OSSL_PKEY_PARAM_ML_KEM_SEED "seed"
|
||||
# define OSSL_PKEY_PARAM_PAD_MODE "pad-mode"
|
||||
# define OSSL_PKEY_PARAM_PRIV_KEY "priv"
|
||||
# define OSSL_PKEY_PARAM_PROPERTIES OSSL_ALG_PARAM_PROPERTIES
|
||||
# define OSSL_PKEY_PARAM_PUB_KEY "pub"
|
||||
# define OSSL_PKEY_PARAM_RSA_BITS OSSL_PKEY_PARAM_BITS
|
||||
# define OSSL_PKEY_PARAM_RSA_COEFFICIENT "rsa-coefficient"
|
||||
# define OSSL_PKEY_PARAM_RSA_COEFFICIENT1 "rsa-coefficient1"
|
||||
# define OSSL_PKEY_PARAM_RSA_COEFFICIENT2 "rsa-coefficient2"
|
||||
# define OSSL_PKEY_PARAM_RSA_COEFFICIENT3 "rsa-coefficient3"
|
||||
# define OSSL_PKEY_PARAM_RSA_COEFFICIENT4 "rsa-coefficient4"
|
||||
# define OSSL_PKEY_PARAM_RSA_COEFFICIENT5 "rsa-coefficient5"
|
||||
# define OSSL_PKEY_PARAM_RSA_COEFFICIENT6 "rsa-coefficient6"
|
||||
# define OSSL_PKEY_PARAM_RSA_COEFFICIENT7 "rsa-coefficient7"
|
||||
# define OSSL_PKEY_PARAM_RSA_COEFFICIENT8 "rsa-coefficient8"
|
||||
# define OSSL_PKEY_PARAM_RSA_COEFFICIENT9 "rsa-coefficient9"
|
||||
# define OSSL_PKEY_PARAM_RSA_D "d"
|
||||
# define OSSL_PKEY_PARAM_RSA_DERIVE_FROM_PQ "rsa-derive-from-pq"
|
||||
# define OSSL_PKEY_PARAM_RSA_DIGEST OSSL_PKEY_PARAM_DIGEST
|
||||
# define OSSL_PKEY_PARAM_RSA_DIGEST_PROPS OSSL_PKEY_PARAM_PROPERTIES
|
||||
# define OSSL_PKEY_PARAM_RSA_E "e"
|
||||
# define OSSL_PKEY_PARAM_RSA_EXPONENT "rsa-exponent"
|
||||
# define OSSL_PKEY_PARAM_RSA_EXPONENT1 "rsa-exponent1"
|
||||
# define OSSL_PKEY_PARAM_RSA_EXPONENT10 "rsa-exponent10"
|
||||
# define OSSL_PKEY_PARAM_RSA_EXPONENT2 "rsa-exponent2"
|
||||
# define OSSL_PKEY_PARAM_RSA_EXPONENT3 "rsa-exponent3"
|
||||
# define OSSL_PKEY_PARAM_RSA_EXPONENT4 "rsa-exponent4"
|
||||
# define OSSL_PKEY_PARAM_RSA_EXPONENT5 "rsa-exponent5"
|
||||
# define OSSL_PKEY_PARAM_RSA_EXPONENT6 "rsa-exponent6"
|
||||
# define OSSL_PKEY_PARAM_RSA_EXPONENT7 "rsa-exponent7"
|
||||
# define OSSL_PKEY_PARAM_RSA_EXPONENT8 "rsa-exponent8"
|
||||
# define OSSL_PKEY_PARAM_RSA_EXPONENT9 "rsa-exponent9"
|
||||
# define OSSL_PKEY_PARAM_RSA_FACTOR "rsa-factor"
|
||||
# define OSSL_PKEY_PARAM_RSA_FACTOR1 "rsa-factor1"
|
||||
# define OSSL_PKEY_PARAM_RSA_FACTOR10 "rsa-factor10"
|
||||
# define OSSL_PKEY_PARAM_RSA_FACTOR2 "rsa-factor2"
|
||||
# define OSSL_PKEY_PARAM_RSA_FACTOR3 "rsa-factor3"
|
||||
# define OSSL_PKEY_PARAM_RSA_FACTOR4 "rsa-factor4"
|
||||
# define OSSL_PKEY_PARAM_RSA_FACTOR5 "rsa-factor5"
|
||||
# define OSSL_PKEY_PARAM_RSA_FACTOR6 "rsa-factor6"
|
||||
# define OSSL_PKEY_PARAM_RSA_FACTOR7 "rsa-factor7"
|
||||
# define OSSL_PKEY_PARAM_RSA_FACTOR8 "rsa-factor8"
|
||||
# define OSSL_PKEY_PARAM_RSA_FACTOR9 "rsa-factor9"
|
||||
# define OSSL_PKEY_PARAM_RSA_MASKGENFUNC OSSL_PKEY_PARAM_MASKGENFUNC
|
||||
# define OSSL_PKEY_PARAM_RSA_MGF1_DIGEST OSSL_PKEY_PARAM_MGF1_DIGEST
|
||||
# define OSSL_PKEY_PARAM_RSA_N "n"
|
||||
# define OSSL_PKEY_PARAM_RSA_PRIMES "primes"
|
||||
# define OSSL_PKEY_PARAM_RSA_PSS_SALTLEN "saltlen"
|
||||
# define OSSL_PKEY_PARAM_RSA_TEST_P1 "p1"
|
||||
# define OSSL_PKEY_PARAM_RSA_TEST_P2 "p2"
|
||||
# define OSSL_PKEY_PARAM_RSA_TEST_Q1 "q1"
|
||||
# define OSSL_PKEY_PARAM_RSA_TEST_Q2 "q2"
|
||||
# define OSSL_PKEY_PARAM_RSA_TEST_XP "xp"
|
||||
# define OSSL_PKEY_PARAM_RSA_TEST_XP1 "xp1"
|
||||
# define OSSL_PKEY_PARAM_RSA_TEST_XP2 "xp2"
|
||||
# define OSSL_PKEY_PARAM_RSA_TEST_XQ "xq"
|
||||
# define OSSL_PKEY_PARAM_RSA_TEST_XQ1 "xq1"
|
||||
# define OSSL_PKEY_PARAM_RSA_TEST_XQ2 "xq2"
|
||||
# define OSSL_PKEY_PARAM_SECURITY_BITS "security-bits"
|
||||
# define OSSL_PKEY_PARAM_SLH_DSA_SEED "seed"
|
||||
# define OSSL_PKEY_PARAM_USE_COFACTOR_ECDH OSSL_PKEY_PARAM_USE_COFACTOR_FLAG
|
||||
# define OSSL_PKEY_PARAM_USE_COFACTOR_FLAG "use-cofactor-flag"
|
||||
# define OSSL_PROV_PARAM_BUILDINFO "buildinfo"
|
||||
# define OSSL_PROV_PARAM_CORE_MODULE_FILENAME "module-filename"
|
||||
# define OSSL_PROV_PARAM_CORE_PROV_NAME "provider-name"
|
||||
# define OSSL_PROV_PARAM_CORE_VERSION "openssl-version"
|
||||
# define OSSL_PROV_PARAM_DRBG_TRUNC_DIGEST "drbg-no-trunc-md"
|
||||
# define OSSL_PROV_PARAM_DSA_SIGN_DISABLED "dsa-sign-disabled"
|
||||
# define OSSL_PROV_PARAM_ECDH_COFACTOR_CHECK "ecdh-cofactor-check"
|
||||
# define OSSL_PROV_PARAM_HKDF_DIGEST_CHECK "hkdf-digest-check"
|
||||
# define OSSL_PROV_PARAM_HKDF_KEY_CHECK "hkdf-key-check"
|
||||
# define OSSL_PROV_PARAM_HMAC_KEY_CHECK "hmac-key-check"
|
||||
# define OSSL_PROV_PARAM_KBKDF_KEY_CHECK "kbkdf-key-check"
|
||||
# define OSSL_PROV_PARAM_KMAC_KEY_CHECK "kmac-key-check"
|
||||
# define OSSL_PROV_PARAM_NAME "name"
|
||||
# define OSSL_PROV_PARAM_NO_SHORT_MAC "no-short-mac"
|
||||
# define OSSL_PROV_PARAM_PBKDF2_LOWER_BOUND_CHECK "pbkdf2-lower-bound-check"
|
||||
# define OSSL_PROV_PARAM_RSA_PKCS15_PAD_DISABLED "rsa-pkcs15-pad-disabled"
|
||||
# define OSSL_PROV_PARAM_RSA_PSS_SALTLEN_CHECK "rsa-pss-saltlen-check"
|
||||
# define OSSL_PROV_PARAM_RSA_SIGN_X931_PAD_DISABLED "rsa-sign-x931-pad-disabled"
|
||||
# define OSSL_PROV_PARAM_SECURITY_CHECKS "security-checks"
|
||||
# define OSSL_PROV_PARAM_SELF_TEST_DESC "st-desc"
|
||||
# define OSSL_PROV_PARAM_SELF_TEST_PHASE "st-phase"
|
||||
# define OSSL_PROV_PARAM_SELF_TEST_TYPE "st-type"
|
||||
# define OSSL_PROV_PARAM_SIGNATURE_DIGEST_CHECK "signature-digest-check"
|
||||
# define OSSL_PROV_PARAM_SSHKDF_DIGEST_CHECK "sshkdf-digest-check"
|
||||
# define OSSL_PROV_PARAM_SSHKDF_KEY_CHECK "sshkdf-key-check"
|
||||
# define OSSL_PROV_PARAM_SSKDF_DIGEST_CHECK "sskdf-digest-check"
|
||||
# define OSSL_PROV_PARAM_SSKDF_KEY_CHECK "sskdf-key-check"
|
||||
# define OSSL_PROV_PARAM_STATUS "status"
|
||||
# define OSSL_PROV_PARAM_TDES_ENCRYPT_DISABLED "tdes-encrypt-disabled"
|
||||
# define OSSL_PROV_PARAM_TLS13_KDF_DIGEST_CHECK "tls13-kdf-digest-check"
|
||||
# define OSSL_PROV_PARAM_TLS13_KDF_KEY_CHECK "tls13-kdf-key-check"
|
||||
# define OSSL_PROV_PARAM_TLS1_PRF_DIGEST_CHECK "tls1-prf-digest-check"
|
||||
# define OSSL_PROV_PARAM_TLS1_PRF_EMS_CHECK "tls1-prf-ems-check"
|
||||
# define OSSL_PROV_PARAM_TLS1_PRF_KEY_CHECK "tls1-prf-key-check"
|
||||
# define OSSL_PROV_PARAM_VERSION "version"
|
||||
# define OSSL_PROV_PARAM_X942KDF_KEY_CHECK "x942kdf-key-check"
|
||||
# define OSSL_PROV_PARAM_X963KDF_DIGEST_CHECK "x963kdf-digest-check"
|
||||
# define OSSL_PROV_PARAM_X963KDF_KEY_CHECK "x963kdf-key-check"
|
||||
# define OSSL_RAND_PARAM_FIPS_APPROVED_INDICATOR OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR
|
||||
# define OSSL_RAND_PARAM_GENERATE "generate"
|
||||
# define OSSL_RAND_PARAM_MAX_REQUEST "max_request"
|
||||
# define OSSL_RAND_PARAM_STATE "state"
|
||||
# define OSSL_RAND_PARAM_STRENGTH "strength"
|
||||
# define OSSL_RAND_PARAM_TEST_ENTROPY "test_entropy"
|
||||
# define OSSL_RAND_PARAM_TEST_NONCE "test_nonce"
|
||||
# define OSSL_SIGNATURE_PARAM_ADD_RANDOM "additional-random"
|
||||
# define OSSL_SIGNATURE_PARAM_ALGORITHM_ID OSSL_PKEY_PARAM_ALGORITHM_ID
|
||||
# define OSSL_SIGNATURE_PARAM_ALGORITHM_ID_PARAMS OSSL_PKEY_PARAM_ALGORITHM_ID_PARAMS
|
||||
# define OSSL_SIGNATURE_PARAM_CONTEXT_STRING "context-string"
|
||||
# define OSSL_SIGNATURE_PARAM_DETERMINISTIC "deterministic"
|
||||
# define OSSL_SIGNATURE_PARAM_DIGEST OSSL_PKEY_PARAM_DIGEST
|
||||
# define OSSL_SIGNATURE_PARAM_DIGEST_SIZE OSSL_PKEY_PARAM_DIGEST_SIZE
|
||||
# define OSSL_SIGNATURE_PARAM_FIPS_APPROVED_INDICATOR OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR
|
||||
# define OSSL_SIGNATURE_PARAM_FIPS_DIGEST_CHECK OSSL_PKEY_PARAM_FIPS_DIGEST_CHECK
|
||||
# define OSSL_SIGNATURE_PARAM_FIPS_KEY_CHECK OSSL_PKEY_PARAM_FIPS_KEY_CHECK
|
||||
# define OSSL_SIGNATURE_PARAM_FIPS_RSA_PSS_SALTLEN_CHECK "rsa-pss-saltlen-check"
|
||||
# define OSSL_SIGNATURE_PARAM_FIPS_SIGN_CHECK OSSL_PKEY_PARAM_FIPS_SIGN_CHECK
|
||||
# define OSSL_SIGNATURE_PARAM_FIPS_SIGN_X931_PAD_CHECK "sign-x931-pad-check"
|
||||
# define OSSL_SIGNATURE_PARAM_FIPS_VERIFY_MESSAGE "verify-message"
|
||||
# define OSSL_SIGNATURE_PARAM_INSTANCE "instance"
|
||||
# define OSSL_SIGNATURE_PARAM_KAT "kat"
|
||||
# define OSSL_SIGNATURE_PARAM_MESSAGE_ENCODING "message-encoding"
|
||||
# define OSSL_SIGNATURE_PARAM_MGF1_DIGEST OSSL_PKEY_PARAM_MGF1_DIGEST
|
||||
# define OSSL_SIGNATURE_PARAM_MGF1_PROPERTIES OSSL_PKEY_PARAM_MGF1_PROPERTIES
|
||||
# define OSSL_SIGNATURE_PARAM_MU "mu"
|
||||
# define OSSL_SIGNATURE_PARAM_NONCE_TYPE "nonce-type"
|
||||
# define OSSL_SIGNATURE_PARAM_PAD_MODE OSSL_PKEY_PARAM_PAD_MODE
|
||||
# define OSSL_SIGNATURE_PARAM_PROPERTIES OSSL_PKEY_PARAM_PROPERTIES
|
||||
# define OSSL_SIGNATURE_PARAM_PSS_SALTLEN "saltlen"
|
||||
# define OSSL_SIGNATURE_PARAM_SIGNATURE "signature"
|
||||
# define OSSL_SIGNATURE_PARAM_TEST_ENTROPY "test-entropy"
|
||||
# define OSSL_SKEY_PARAM_KEY_LENGTH "key-length"
|
||||
# define OSSL_SKEY_PARAM_RAW_BYTES "raw-bytes"
|
||||
# define OSSL_STORE_PARAM_ALIAS "alias"
|
||||
# define OSSL_STORE_PARAM_DIGEST "digest"
|
||||
# define OSSL_STORE_PARAM_EXPECT "expect"
|
||||
# define OSSL_STORE_PARAM_FINGERPRINT "fingerprint"
|
||||
# define OSSL_STORE_PARAM_INPUT_TYPE "input-type"
|
||||
# define OSSL_STORE_PARAM_ISSUER "name"
|
||||
# define OSSL_STORE_PARAM_PROPERTIES "properties"
|
||||
# define OSSL_STORE_PARAM_SERIAL "serial"
|
||||
# define OSSL_STORE_PARAM_SUBJECT "subject"
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
|
||||
#endif
|
||||
41
thirdparty/OpenSSL-3.5.3/include/openssl/core_object.h
vendored
Normal file
41
thirdparty/OpenSSL-3.5.3/include/openssl/core_object.h
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef OPENSSL_CORE_OBJECT_H
|
||||
# define OPENSSL_CORE_OBJECT_H
|
||||
# pragma once
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
/*-
|
||||
* Known object types
|
||||
*
|
||||
* These numbers are used as values for the OSSL_PARAM parameter
|
||||
* OSSL_OBJECT_PARAM_TYPE.
|
||||
*
|
||||
* For most of these types, there's a corresponding libcrypto object type.
|
||||
* The corresponding type is indicated with a comment after the number.
|
||||
*/
|
||||
# define OSSL_OBJECT_UNKNOWN 0
|
||||
# define OSSL_OBJECT_NAME 1 /* char * */
|
||||
# define OSSL_OBJECT_PKEY 2 /* EVP_PKEY * */
|
||||
# define OSSL_OBJECT_CERT 3 /* X509 * */
|
||||
# define OSSL_OBJECT_CRL 4 /* X509_CRL * */
|
||||
|
||||
/*
|
||||
* The rest of the associated OSSL_PARAM elements is described in core_names.h
|
||||
*/
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
|
||||
#endif
|
||||
278
thirdparty/OpenSSL-3.5.3/include/openssl/crmf.h
vendored
Normal file
278
thirdparty/OpenSSL-3.5.3/include/openssl/crmf.h
vendored
Normal file
@@ -0,0 +1,278 @@
|
||||
/*-
|
||||
* WARNING: do not edit!
|
||||
* Generated by makefile from include\openssl\crmf.h.in
|
||||
*
|
||||
* Copyright 2007-2025 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright Nokia 2007-2019
|
||||
* Copyright Siemens AG 2015-2019
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*
|
||||
* CRMF (RFC 4211) implementation by M. Peylo, M. Viljanen, and D. von Oheimb.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef OPENSSL_CRMF_H
|
||||
# define OPENSSL_CRMF_H
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_CRMF
|
||||
# include <openssl/opensslv.h>
|
||||
# include <openssl/safestack.h>
|
||||
# include <openssl/crmferr.h>
|
||||
# include <openssl/x509v3.h> /* for GENERAL_NAME etc. */
|
||||
# include <openssl/cms.h>
|
||||
|
||||
/* explicit #includes not strictly needed since implied by the above: */
|
||||
# include <openssl/types.h>
|
||||
# include <openssl/x509.h>
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
# define OSSL_CRMF_POPOPRIVKEY_THISMESSAGE 0
|
||||
# define OSSL_CRMF_POPOPRIVKEY_SUBSEQUENTMESSAGE 1
|
||||
# define OSSL_CRMF_POPOPRIVKEY_DHMAC 2
|
||||
# define OSSL_CRMF_POPOPRIVKEY_AGREEMAC 3
|
||||
# define OSSL_CRMF_POPOPRIVKEY_ENCRYPTEDKEY 4
|
||||
|
||||
# define OSSL_CRMF_SUBSEQUENTMESSAGE_ENCRCERT 0
|
||||
# define OSSL_CRMF_SUBSEQUENTMESSAGE_CHALLENGERESP 1
|
||||
typedef struct ossl_crmf_encryptedvalue_st OSSL_CRMF_ENCRYPTEDVALUE;
|
||||
DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_ENCRYPTEDVALUE)
|
||||
|
||||
typedef struct ossl_crmf_encryptedkey_st OSSL_CRMF_ENCRYPTEDKEY;
|
||||
DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_ENCRYPTEDKEY)
|
||||
|
||||
typedef struct ossl_crmf_msg_st OSSL_CRMF_MSG;
|
||||
DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_MSG)
|
||||
DECLARE_ASN1_DUP_FUNCTION(OSSL_CRMF_MSG)
|
||||
SKM_DEFINE_STACK_OF_INTERNAL(OSSL_CRMF_MSG, OSSL_CRMF_MSG, OSSL_CRMF_MSG)
|
||||
#define sk_OSSL_CRMF_MSG_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_CRMF_MSG_sk_type(sk))
|
||||
#define sk_OSSL_CRMF_MSG_value(sk, idx) ((OSSL_CRMF_MSG *)OPENSSL_sk_value(ossl_check_const_OSSL_CRMF_MSG_sk_type(sk), (idx)))
|
||||
#define sk_OSSL_CRMF_MSG_new(cmp) ((STACK_OF(OSSL_CRMF_MSG) *)OPENSSL_sk_new(ossl_check_OSSL_CRMF_MSG_compfunc_type(cmp)))
|
||||
#define sk_OSSL_CRMF_MSG_new_null() ((STACK_OF(OSSL_CRMF_MSG) *)OPENSSL_sk_new_null())
|
||||
#define sk_OSSL_CRMF_MSG_new_reserve(cmp, n) ((STACK_OF(OSSL_CRMF_MSG) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_CRMF_MSG_compfunc_type(cmp), (n)))
|
||||
#define sk_OSSL_CRMF_MSG_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_CRMF_MSG_sk_type(sk), (n))
|
||||
#define sk_OSSL_CRMF_MSG_free(sk) OPENSSL_sk_free(ossl_check_OSSL_CRMF_MSG_sk_type(sk))
|
||||
#define sk_OSSL_CRMF_MSG_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_CRMF_MSG_sk_type(sk))
|
||||
#define sk_OSSL_CRMF_MSG_delete(sk, i) ((OSSL_CRMF_MSG *)OPENSSL_sk_delete(ossl_check_OSSL_CRMF_MSG_sk_type(sk), (i)))
|
||||
#define sk_OSSL_CRMF_MSG_delete_ptr(sk, ptr) ((OSSL_CRMF_MSG *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_CRMF_MSG_sk_type(sk), ossl_check_OSSL_CRMF_MSG_type(ptr)))
|
||||
#define sk_OSSL_CRMF_MSG_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_CRMF_MSG_sk_type(sk), ossl_check_OSSL_CRMF_MSG_type(ptr))
|
||||
#define sk_OSSL_CRMF_MSG_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_CRMF_MSG_sk_type(sk), ossl_check_OSSL_CRMF_MSG_type(ptr))
|
||||
#define sk_OSSL_CRMF_MSG_pop(sk) ((OSSL_CRMF_MSG *)OPENSSL_sk_pop(ossl_check_OSSL_CRMF_MSG_sk_type(sk)))
|
||||
#define sk_OSSL_CRMF_MSG_shift(sk) ((OSSL_CRMF_MSG *)OPENSSL_sk_shift(ossl_check_OSSL_CRMF_MSG_sk_type(sk)))
|
||||
#define sk_OSSL_CRMF_MSG_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_CRMF_MSG_sk_type(sk),ossl_check_OSSL_CRMF_MSG_freefunc_type(freefunc))
|
||||
#define sk_OSSL_CRMF_MSG_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_CRMF_MSG_sk_type(sk), ossl_check_OSSL_CRMF_MSG_type(ptr), (idx))
|
||||
#define sk_OSSL_CRMF_MSG_set(sk, idx, ptr) ((OSSL_CRMF_MSG *)OPENSSL_sk_set(ossl_check_OSSL_CRMF_MSG_sk_type(sk), (idx), ossl_check_OSSL_CRMF_MSG_type(ptr)))
|
||||
#define sk_OSSL_CRMF_MSG_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_CRMF_MSG_sk_type(sk), ossl_check_OSSL_CRMF_MSG_type(ptr))
|
||||
#define sk_OSSL_CRMF_MSG_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_CRMF_MSG_sk_type(sk), ossl_check_OSSL_CRMF_MSG_type(ptr))
|
||||
#define sk_OSSL_CRMF_MSG_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_CRMF_MSG_sk_type(sk), ossl_check_OSSL_CRMF_MSG_type(ptr), pnum)
|
||||
#define sk_OSSL_CRMF_MSG_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_CRMF_MSG_sk_type(sk))
|
||||
#define sk_OSSL_CRMF_MSG_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_CRMF_MSG_sk_type(sk))
|
||||
#define sk_OSSL_CRMF_MSG_dup(sk) ((STACK_OF(OSSL_CRMF_MSG) *)OPENSSL_sk_dup(ossl_check_const_OSSL_CRMF_MSG_sk_type(sk)))
|
||||
#define sk_OSSL_CRMF_MSG_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_CRMF_MSG) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_CRMF_MSG_sk_type(sk), ossl_check_OSSL_CRMF_MSG_copyfunc_type(copyfunc), ossl_check_OSSL_CRMF_MSG_freefunc_type(freefunc)))
|
||||
#define sk_OSSL_CRMF_MSG_set_cmp_func(sk, cmp) ((sk_OSSL_CRMF_MSG_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_CRMF_MSG_sk_type(sk), ossl_check_OSSL_CRMF_MSG_compfunc_type(cmp)))
|
||||
|
||||
typedef struct ossl_crmf_attributetypeandvalue_st OSSL_CRMF_ATTRIBUTETYPEANDVALUE;
|
||||
void OSSL_CRMF_ATTRIBUTETYPEANDVALUE_free(OSSL_CRMF_ATTRIBUTETYPEANDVALUE *v);
|
||||
DECLARE_ASN1_DUP_FUNCTION(OSSL_CRMF_ATTRIBUTETYPEANDVALUE)
|
||||
SKM_DEFINE_STACK_OF_INTERNAL(OSSL_CRMF_ATTRIBUTETYPEANDVALUE, OSSL_CRMF_ATTRIBUTETYPEANDVALUE, OSSL_CRMF_ATTRIBUTETYPEANDVALUE)
|
||||
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk))
|
||||
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_value(sk, idx) ((OSSL_CRMF_ATTRIBUTETYPEANDVALUE *)OPENSSL_sk_value(ossl_check_const_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), (idx)))
|
||||
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_new(cmp) ((STACK_OF(OSSL_CRMF_ATTRIBUTETYPEANDVALUE) *)OPENSSL_sk_new(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_compfunc_type(cmp)))
|
||||
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_new_null() ((STACK_OF(OSSL_CRMF_ATTRIBUTETYPEANDVALUE) *)OPENSSL_sk_new_null())
|
||||
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_new_reserve(cmp, n) ((STACK_OF(OSSL_CRMF_ATTRIBUTETYPEANDVALUE) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_compfunc_type(cmp), (n)))
|
||||
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), (n))
|
||||
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_free(sk) OPENSSL_sk_free(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk))
|
||||
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk))
|
||||
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_delete(sk, i) ((OSSL_CRMF_ATTRIBUTETYPEANDVALUE *)OPENSSL_sk_delete(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), (i)))
|
||||
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_delete_ptr(sk, ptr) ((OSSL_CRMF_ATTRIBUTETYPEANDVALUE *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_type(ptr)))
|
||||
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_type(ptr))
|
||||
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_type(ptr))
|
||||
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_pop(sk) ((OSSL_CRMF_ATTRIBUTETYPEANDVALUE *)OPENSSL_sk_pop(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk)))
|
||||
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_shift(sk) ((OSSL_CRMF_ATTRIBUTETYPEANDVALUE *)OPENSSL_sk_shift(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk)))
|
||||
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk),ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_freefunc_type(freefunc))
|
||||
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_type(ptr), (idx))
|
||||
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_set(sk, idx, ptr) ((OSSL_CRMF_ATTRIBUTETYPEANDVALUE *)OPENSSL_sk_set(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), (idx), ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_type(ptr)))
|
||||
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_type(ptr))
|
||||
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_type(ptr))
|
||||
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_type(ptr), pnum)
|
||||
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk))
|
||||
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk))
|
||||
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_dup(sk) ((STACK_OF(OSSL_CRMF_ATTRIBUTETYPEANDVALUE) *)OPENSSL_sk_dup(ossl_check_const_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk)))
|
||||
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_CRMF_ATTRIBUTETYPEANDVALUE) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_copyfunc_type(copyfunc), ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_freefunc_type(freefunc)))
|
||||
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_set_cmp_func(sk, cmp) ((sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_compfunc_type(cmp)))
|
||||
|
||||
|
||||
typedef struct ossl_crmf_pbmparameter_st OSSL_CRMF_PBMPARAMETER;
|
||||
DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_PBMPARAMETER)
|
||||
typedef struct ossl_crmf_poposigningkey_st OSSL_CRMF_POPOSIGNINGKEY;
|
||||
typedef struct ossl_crmf_certrequest_st OSSL_CRMF_CERTREQUEST;
|
||||
typedef struct ossl_crmf_certid_st OSSL_CRMF_CERTID;
|
||||
DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_CERTID)
|
||||
DECLARE_ASN1_DUP_FUNCTION(OSSL_CRMF_CERTID)
|
||||
SKM_DEFINE_STACK_OF_INTERNAL(OSSL_CRMF_CERTID, OSSL_CRMF_CERTID, OSSL_CRMF_CERTID)
|
||||
#define sk_OSSL_CRMF_CERTID_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_CRMF_CERTID_sk_type(sk))
|
||||
#define sk_OSSL_CRMF_CERTID_value(sk, idx) ((OSSL_CRMF_CERTID *)OPENSSL_sk_value(ossl_check_const_OSSL_CRMF_CERTID_sk_type(sk), (idx)))
|
||||
#define sk_OSSL_CRMF_CERTID_new(cmp) ((STACK_OF(OSSL_CRMF_CERTID) *)OPENSSL_sk_new(ossl_check_OSSL_CRMF_CERTID_compfunc_type(cmp)))
|
||||
#define sk_OSSL_CRMF_CERTID_new_null() ((STACK_OF(OSSL_CRMF_CERTID) *)OPENSSL_sk_new_null())
|
||||
#define sk_OSSL_CRMF_CERTID_new_reserve(cmp, n) ((STACK_OF(OSSL_CRMF_CERTID) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_CRMF_CERTID_compfunc_type(cmp), (n)))
|
||||
#define sk_OSSL_CRMF_CERTID_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_CRMF_CERTID_sk_type(sk), (n))
|
||||
#define sk_OSSL_CRMF_CERTID_free(sk) OPENSSL_sk_free(ossl_check_OSSL_CRMF_CERTID_sk_type(sk))
|
||||
#define sk_OSSL_CRMF_CERTID_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_CRMF_CERTID_sk_type(sk))
|
||||
#define sk_OSSL_CRMF_CERTID_delete(sk, i) ((OSSL_CRMF_CERTID *)OPENSSL_sk_delete(ossl_check_OSSL_CRMF_CERTID_sk_type(sk), (i)))
|
||||
#define sk_OSSL_CRMF_CERTID_delete_ptr(sk, ptr) ((OSSL_CRMF_CERTID *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_CRMF_CERTID_sk_type(sk), ossl_check_OSSL_CRMF_CERTID_type(ptr)))
|
||||
#define sk_OSSL_CRMF_CERTID_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_CRMF_CERTID_sk_type(sk), ossl_check_OSSL_CRMF_CERTID_type(ptr))
|
||||
#define sk_OSSL_CRMF_CERTID_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_CRMF_CERTID_sk_type(sk), ossl_check_OSSL_CRMF_CERTID_type(ptr))
|
||||
#define sk_OSSL_CRMF_CERTID_pop(sk) ((OSSL_CRMF_CERTID *)OPENSSL_sk_pop(ossl_check_OSSL_CRMF_CERTID_sk_type(sk)))
|
||||
#define sk_OSSL_CRMF_CERTID_shift(sk) ((OSSL_CRMF_CERTID *)OPENSSL_sk_shift(ossl_check_OSSL_CRMF_CERTID_sk_type(sk)))
|
||||
#define sk_OSSL_CRMF_CERTID_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_CRMF_CERTID_sk_type(sk),ossl_check_OSSL_CRMF_CERTID_freefunc_type(freefunc))
|
||||
#define sk_OSSL_CRMF_CERTID_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_CRMF_CERTID_sk_type(sk), ossl_check_OSSL_CRMF_CERTID_type(ptr), (idx))
|
||||
#define sk_OSSL_CRMF_CERTID_set(sk, idx, ptr) ((OSSL_CRMF_CERTID *)OPENSSL_sk_set(ossl_check_OSSL_CRMF_CERTID_sk_type(sk), (idx), ossl_check_OSSL_CRMF_CERTID_type(ptr)))
|
||||
#define sk_OSSL_CRMF_CERTID_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_CRMF_CERTID_sk_type(sk), ossl_check_OSSL_CRMF_CERTID_type(ptr))
|
||||
#define sk_OSSL_CRMF_CERTID_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_CRMF_CERTID_sk_type(sk), ossl_check_OSSL_CRMF_CERTID_type(ptr))
|
||||
#define sk_OSSL_CRMF_CERTID_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_CRMF_CERTID_sk_type(sk), ossl_check_OSSL_CRMF_CERTID_type(ptr), pnum)
|
||||
#define sk_OSSL_CRMF_CERTID_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_CRMF_CERTID_sk_type(sk))
|
||||
#define sk_OSSL_CRMF_CERTID_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_CRMF_CERTID_sk_type(sk))
|
||||
#define sk_OSSL_CRMF_CERTID_dup(sk) ((STACK_OF(OSSL_CRMF_CERTID) *)OPENSSL_sk_dup(ossl_check_const_OSSL_CRMF_CERTID_sk_type(sk)))
|
||||
#define sk_OSSL_CRMF_CERTID_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_CRMF_CERTID) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_CRMF_CERTID_sk_type(sk), ossl_check_OSSL_CRMF_CERTID_copyfunc_type(copyfunc), ossl_check_OSSL_CRMF_CERTID_freefunc_type(freefunc)))
|
||||
#define sk_OSSL_CRMF_CERTID_set_cmp_func(sk, cmp) ((sk_OSSL_CRMF_CERTID_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_CRMF_CERTID_sk_type(sk), ossl_check_OSSL_CRMF_CERTID_compfunc_type(cmp)))
|
||||
|
||||
|
||||
typedef struct ossl_crmf_pkipublicationinfo_st OSSL_CRMF_PKIPUBLICATIONINFO;
|
||||
DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_PKIPUBLICATIONINFO)
|
||||
typedef struct ossl_crmf_singlepubinfo_st OSSL_CRMF_SINGLEPUBINFO;
|
||||
DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_SINGLEPUBINFO)
|
||||
typedef struct ossl_crmf_certtemplate_st OSSL_CRMF_CERTTEMPLATE;
|
||||
DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_CERTTEMPLATE)
|
||||
DECLARE_ASN1_DUP_FUNCTION(OSSL_CRMF_CERTTEMPLATE)
|
||||
typedef STACK_OF(OSSL_CRMF_MSG) OSSL_CRMF_MSGS;
|
||||
DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_MSGS)
|
||||
|
||||
typedef struct ossl_crmf_optionalvalidity_st OSSL_CRMF_OPTIONALVALIDITY;
|
||||
|
||||
/* crmf_pbm.c */
|
||||
OSSL_CRMF_PBMPARAMETER *OSSL_CRMF_pbmp_new(OSSL_LIB_CTX *libctx, size_t slen,
|
||||
int owfnid, size_t itercnt,
|
||||
int macnid);
|
||||
int OSSL_CRMF_pbm_new(OSSL_LIB_CTX *libctx, const char *propq,
|
||||
const OSSL_CRMF_PBMPARAMETER *pbmp,
|
||||
const unsigned char *msg, size_t msglen,
|
||||
const unsigned char *sec, size_t seclen,
|
||||
unsigned char **mac, size_t *maclen);
|
||||
|
||||
/* crmf_lib.c */
|
||||
int OSSL_CRMF_MSG_set1_regCtrl_regToken(OSSL_CRMF_MSG *msg,
|
||||
const ASN1_UTF8STRING *tok);
|
||||
ASN1_UTF8STRING
|
||||
*OSSL_CRMF_MSG_get0_regCtrl_regToken(const OSSL_CRMF_MSG *msg);
|
||||
int OSSL_CRMF_MSG_set1_regCtrl_authenticator(OSSL_CRMF_MSG *msg,
|
||||
const ASN1_UTF8STRING *auth);
|
||||
ASN1_UTF8STRING
|
||||
*OSSL_CRMF_MSG_get0_regCtrl_authenticator(const OSSL_CRMF_MSG *msg);
|
||||
int
|
||||
OSSL_CRMF_MSG_PKIPublicationInfo_push0_SinglePubInfo(OSSL_CRMF_PKIPUBLICATIONINFO *pi,
|
||||
OSSL_CRMF_SINGLEPUBINFO *spi);
|
||||
# define OSSL_CRMF_PUB_METHOD_DONTCARE 0
|
||||
# define OSSL_CRMF_PUB_METHOD_X500 1
|
||||
# define OSSL_CRMF_PUB_METHOD_WEB 2
|
||||
# define OSSL_CRMF_PUB_METHOD_LDAP 3
|
||||
int OSSL_CRMF_MSG_set0_SinglePubInfo(OSSL_CRMF_SINGLEPUBINFO *spi,
|
||||
int method, GENERAL_NAME *nm);
|
||||
# define OSSL_CRMF_PUB_ACTION_DONTPUBLISH 0
|
||||
# define OSSL_CRMF_PUB_ACTION_PLEASEPUBLISH 1
|
||||
int OSSL_CRMF_MSG_set_PKIPublicationInfo_action(OSSL_CRMF_PKIPUBLICATIONINFO *pi,
|
||||
int action);
|
||||
int OSSL_CRMF_MSG_set1_regCtrl_pkiPublicationInfo(OSSL_CRMF_MSG *msg,
|
||||
const OSSL_CRMF_PKIPUBLICATIONINFO *pi);
|
||||
OSSL_CRMF_PKIPUBLICATIONINFO
|
||||
*OSSL_CRMF_MSG_get0_regCtrl_pkiPublicationInfo(const OSSL_CRMF_MSG *msg);
|
||||
int OSSL_CRMF_MSG_set1_regCtrl_protocolEncrKey(OSSL_CRMF_MSG *msg,
|
||||
const X509_PUBKEY *pubkey);
|
||||
X509_PUBKEY
|
||||
*OSSL_CRMF_MSG_get0_regCtrl_protocolEncrKey(const OSSL_CRMF_MSG *msg);
|
||||
int OSSL_CRMF_MSG_set1_regCtrl_oldCertID(OSSL_CRMF_MSG *msg,
|
||||
const OSSL_CRMF_CERTID *cid);
|
||||
OSSL_CRMF_CERTID
|
||||
*OSSL_CRMF_MSG_get0_regCtrl_oldCertID(const OSSL_CRMF_MSG *msg);
|
||||
OSSL_CRMF_CERTID *OSSL_CRMF_CERTID_gen(const X509_NAME *issuer,
|
||||
const ASN1_INTEGER *serial);
|
||||
|
||||
int OSSL_CRMF_MSG_set1_regInfo_utf8Pairs(OSSL_CRMF_MSG *msg,
|
||||
const ASN1_UTF8STRING *utf8pairs);
|
||||
ASN1_UTF8STRING
|
||||
*OSSL_CRMF_MSG_get0_regInfo_utf8Pairs(const OSSL_CRMF_MSG *msg);
|
||||
int OSSL_CRMF_MSG_set1_regInfo_certReq(OSSL_CRMF_MSG *msg,
|
||||
const OSSL_CRMF_CERTREQUEST *cr);
|
||||
OSSL_CRMF_CERTREQUEST
|
||||
*OSSL_CRMF_MSG_get0_regInfo_certReq(const OSSL_CRMF_MSG *msg);
|
||||
|
||||
int OSSL_CRMF_MSG_set0_validity(OSSL_CRMF_MSG *crm,
|
||||
ASN1_TIME *notBefore, ASN1_TIME *notAfter);
|
||||
int OSSL_CRMF_MSG_set_certReqId(OSSL_CRMF_MSG *crm, int rid);
|
||||
int OSSL_CRMF_MSG_get_certReqId(const OSSL_CRMF_MSG *crm);
|
||||
int OSSL_CRMF_MSG_set0_extensions(OSSL_CRMF_MSG *crm, X509_EXTENSIONS *exts);
|
||||
|
||||
int OSSL_CRMF_MSG_push0_extension(OSSL_CRMF_MSG *crm, X509_EXTENSION *ext);
|
||||
# define OSSL_CRMF_POPO_NONE -1
|
||||
# define OSSL_CRMF_POPO_RAVERIFIED 0
|
||||
# define OSSL_CRMF_POPO_SIGNATURE 1
|
||||
# define OSSL_CRMF_POPO_KEYENC 2
|
||||
# define OSSL_CRMF_POPO_KEYAGREE 3
|
||||
int OSSL_CRMF_MSG_create_popo(int meth, OSSL_CRMF_MSG *crm,
|
||||
EVP_PKEY *pkey, const EVP_MD *digest,
|
||||
OSSL_LIB_CTX *libctx, const char *propq);
|
||||
int OSSL_CRMF_MSGS_verify_popo(const OSSL_CRMF_MSGS *reqs,
|
||||
int rid, int acceptRAVerified,
|
||||
OSSL_LIB_CTX *libctx, const char *propq);
|
||||
OSSL_CRMF_CERTTEMPLATE *OSSL_CRMF_MSG_get0_tmpl(const OSSL_CRMF_MSG *crm);
|
||||
X509_PUBKEY
|
||||
*OSSL_CRMF_CERTTEMPLATE_get0_publicKey(const OSSL_CRMF_CERTTEMPLATE *tmpl);
|
||||
const X509_NAME
|
||||
*OSSL_CRMF_CERTTEMPLATE_get0_subject(const OSSL_CRMF_CERTTEMPLATE *tmpl);
|
||||
const X509_NAME
|
||||
*OSSL_CRMF_CERTTEMPLATE_get0_issuer(const OSSL_CRMF_CERTTEMPLATE *tmpl);
|
||||
const ASN1_INTEGER
|
||||
*OSSL_CRMF_CERTTEMPLATE_get0_serialNumber(const OSSL_CRMF_CERTTEMPLATE *tmpl);
|
||||
X509_EXTENSIONS
|
||||
*OSSL_CRMF_CERTTEMPLATE_get0_extensions(const OSSL_CRMF_CERTTEMPLATE *tmpl);
|
||||
const X509_NAME
|
||||
*OSSL_CRMF_CERTID_get0_issuer(const OSSL_CRMF_CERTID *cid);
|
||||
const ASN1_INTEGER
|
||||
*OSSL_CRMF_CERTID_get0_serialNumber(const OSSL_CRMF_CERTID *cid);
|
||||
int OSSL_CRMF_CERTTEMPLATE_fill(OSSL_CRMF_CERTTEMPLATE *tmpl,
|
||||
EVP_PKEY *pubkey,
|
||||
const X509_NAME *subject,
|
||||
const X509_NAME *issuer,
|
||||
const ASN1_INTEGER *serial);
|
||||
X509 *OSSL_CRMF_ENCRYPTEDVALUE_get1_encCert(const OSSL_CRMF_ENCRYPTEDVALUE *ecert,
|
||||
OSSL_LIB_CTX *libctx, const char *propq,
|
||||
EVP_PKEY *pkey);
|
||||
X509 *OSSL_CRMF_ENCRYPTEDKEY_get1_encCert(const OSSL_CRMF_ENCRYPTEDKEY *ecert,
|
||||
OSSL_LIB_CTX *libctx, const char *propq,
|
||||
EVP_PKEY *pkey, unsigned int flags);
|
||||
unsigned char
|
||||
*OSSL_CRMF_ENCRYPTEDVALUE_decrypt(const OSSL_CRMF_ENCRYPTEDVALUE *enc,
|
||||
OSSL_LIB_CTX *libctx, const char *propq,
|
||||
EVP_PKEY *pkey, int *outlen);
|
||||
EVP_PKEY *OSSL_CRMF_ENCRYPTEDKEY_get1_pkey(const OSSL_CRMF_ENCRYPTEDKEY *encryptedKey,
|
||||
X509_STORE *ts, STACK_OF(X509) *extra, EVP_PKEY *pkey,
|
||||
X509 *cert, ASN1_OCTET_STRING *secret,
|
||||
OSSL_LIB_CTX *libctx, const char *propq);
|
||||
int OSSL_CRMF_MSG_centralkeygen_requested(const OSSL_CRMF_MSG *crm, const X509_REQ *p10cr);
|
||||
# ifndef OPENSSL_NO_CMS
|
||||
OSSL_CRMF_ENCRYPTEDKEY *OSSL_CRMF_ENCRYPTEDKEY_init_envdata(CMS_EnvelopedData *envdata);
|
||||
# endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
# endif /* !defined(OPENSSL_NO_CRMF) */
|
||||
#endif /* !defined(OPENSSL_CRMF_H) */
|
||||
57
thirdparty/OpenSSL-3.5.3/include/openssl/crmferr.h
vendored
Normal file
57
thirdparty/OpenSSL-3.5.3/include/openssl/crmferr.h
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef OPENSSL_CRMFERR_H
|
||||
# define OPENSSL_CRMFERR_H
|
||||
# pragma once
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
# include <openssl/symhacks.h>
|
||||
# include <openssl/cryptoerr_legacy.h>
|
||||
|
||||
|
||||
# ifndef OPENSSL_NO_CRMF
|
||||
|
||||
|
||||
/*
|
||||
* CRMF reason codes.
|
||||
*/
|
||||
# define CRMF_R_BAD_PBM_ITERATIONCOUNT 100
|
||||
# define CRMF_R_CMS_NOT_SUPPORTED 122
|
||||
# define CRMF_R_CRMFERROR 102
|
||||
# define CRMF_R_ERROR 103
|
||||
# define CRMF_R_ERROR_DECODING_CERTIFICATE 104
|
||||
# define CRMF_R_ERROR_DECODING_ENCRYPTEDKEY 123
|
||||
# define CRMF_R_ERROR_DECRYPTING_CERTIFICATE 105
|
||||
# define CRMF_R_ERROR_DECRYPTING_ENCRYPTEDKEY 124
|
||||
# define CRMF_R_ERROR_DECRYPTING_ENCRYPTEDVALUE 125
|
||||
# define CRMF_R_ERROR_DECRYPTING_SYMMETRIC_KEY 106
|
||||
# define CRMF_R_ERROR_SETTING_PURPOSE 126
|
||||
# define CRMF_R_ERROR_VERIFYING_ENCRYPTEDKEY 127
|
||||
# define CRMF_R_FAILURE_OBTAINING_RANDOM 107
|
||||
# define CRMF_R_ITERATIONCOUNT_BELOW_100 108
|
||||
# define CRMF_R_MALFORMED_IV 101
|
||||
# define CRMF_R_NULL_ARGUMENT 109
|
||||
# define CRMF_R_POPOSKINPUT_NOT_SUPPORTED 113
|
||||
# define CRMF_R_POPO_INCONSISTENT_CENTRAL_KEYGEN 128
|
||||
# define CRMF_R_POPO_INCONSISTENT_PUBLIC_KEY 117
|
||||
# define CRMF_R_POPO_MISSING 121
|
||||
# define CRMF_R_POPO_MISSING_PUBLIC_KEY 118
|
||||
# define CRMF_R_POPO_MISSING_SUBJECT 119
|
||||
# define CRMF_R_POPO_RAVERIFIED_NOT_ACCEPTED 120
|
||||
# define CRMF_R_SETTING_MAC_ALGOR_FAILURE 110
|
||||
# define CRMF_R_SETTING_OWF_ALGOR_FAILURE 111
|
||||
# define CRMF_R_UNSUPPORTED_ALGORITHM 112
|
||||
# define CRMF_R_UNSUPPORTED_CIPHER 114
|
||||
# define CRMF_R_UNSUPPORTED_METHOD_FOR_CREATING_POPO 115
|
||||
# define CRMF_R_UNSUPPORTED_POPO_METHOD 116
|
||||
|
||||
# endif
|
||||
#endif
|
||||
583
thirdparty/OpenSSL-3.5.3/include/openssl/crypto.h
vendored
Normal file
583
thirdparty/OpenSSL-3.5.3/include/openssl/crypto.h
vendored
Normal file
@@ -0,0 +1,583 @@
|
||||
/*
|
||||
* WARNING: do not edit!
|
||||
* Generated by makefile from include\openssl\crypto.h.in
|
||||
*
|
||||
* Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef OPENSSL_CRYPTO_H
|
||||
# define OPENSSL_CRYPTO_H
|
||||
# pragma once
|
||||
|
||||
# include <openssl/macros.h>
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
# define HEADER_CRYPTO_H
|
||||
# endif
|
||||
|
||||
# include <stdlib.h>
|
||||
# include <time.h>
|
||||
|
||||
# include <openssl/e_os2.h>
|
||||
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
# include <stdio.h>
|
||||
# endif
|
||||
|
||||
# include <openssl/safestack.h>
|
||||
# include <openssl/opensslv.h>
|
||||
# include <openssl/types.h>
|
||||
# include <openssl/opensslconf.h>
|
||||
# include <openssl/cryptoerr.h>
|
||||
# include <openssl/core.h>
|
||||
|
||||
# ifdef CHARSET_EBCDIC
|
||||
# include <openssl/ebcdic.h>
|
||||
# endif
|
||||
|
||||
/*
|
||||
* Resolve problems on some operating systems with symbol names that clash
|
||||
* one way or another
|
||||
*/
|
||||
# include <openssl/symhacks.h>
|
||||
|
||||
# ifndef OPENSSL_NO_DEPRECATED_1_1_0
|
||||
# include <openssl/opensslv.h>
|
||||
# endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
# ifndef OPENSSL_NO_DEPRECATED_1_1_0
|
||||
# define SSLeay OpenSSL_version_num
|
||||
# define SSLeay_version OpenSSL_version
|
||||
# define SSLEAY_VERSION_NUMBER OPENSSL_VERSION_NUMBER
|
||||
# define SSLEAY_VERSION OPENSSL_VERSION
|
||||
# define SSLEAY_CFLAGS OPENSSL_CFLAGS
|
||||
# define SSLEAY_BUILT_ON OPENSSL_BUILT_ON
|
||||
# define SSLEAY_PLATFORM OPENSSL_PLATFORM
|
||||
# define SSLEAY_DIR OPENSSL_DIR
|
||||
|
||||
/*
|
||||
* Old type for allocating dynamic locks. No longer used. Use the new thread
|
||||
* API instead.
|
||||
*/
|
||||
typedef struct {
|
||||
int dummy;
|
||||
} CRYPTO_dynlock;
|
||||
|
||||
# endif /* OPENSSL_NO_DEPRECATED_1_1_0 */
|
||||
|
||||
typedef void CRYPTO_RWLOCK;
|
||||
|
||||
CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void);
|
||||
__owur int CRYPTO_THREAD_read_lock(CRYPTO_RWLOCK *lock);
|
||||
__owur int CRYPTO_THREAD_write_lock(CRYPTO_RWLOCK *lock);
|
||||
int CRYPTO_THREAD_unlock(CRYPTO_RWLOCK *lock);
|
||||
void CRYPTO_THREAD_lock_free(CRYPTO_RWLOCK *lock);
|
||||
|
||||
int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock);
|
||||
int CRYPTO_atomic_add64(uint64_t *val, uint64_t op, uint64_t *ret,
|
||||
CRYPTO_RWLOCK *lock);
|
||||
int CRYPTO_atomic_and(uint64_t *val, uint64_t op, uint64_t *ret,
|
||||
CRYPTO_RWLOCK *lock);
|
||||
int CRYPTO_atomic_or(uint64_t *val, uint64_t op, uint64_t *ret,
|
||||
CRYPTO_RWLOCK *lock);
|
||||
int CRYPTO_atomic_load(uint64_t *val, uint64_t *ret, CRYPTO_RWLOCK *lock);
|
||||
int CRYPTO_atomic_load_int(int *val, int *ret, CRYPTO_RWLOCK *lock);
|
||||
int CRYPTO_atomic_store(uint64_t *dst, uint64_t val, CRYPTO_RWLOCK *lock);
|
||||
|
||||
/* No longer needed, so this is a no-op */
|
||||
#define OPENSSL_malloc_init() while(0) continue
|
||||
|
||||
# define OPENSSL_malloc(num) \
|
||||
CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_zalloc(num) \
|
||||
CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_aligned_alloc(num, alignment, freeptr) \
|
||||
CRYPTO_aligned_alloc(num, alignment, freeptr, \
|
||||
OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_realloc(addr, num) \
|
||||
CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_clear_realloc(addr, old_num, num) \
|
||||
CRYPTO_clear_realloc(addr, old_num, num, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_clear_free(addr, num) \
|
||||
CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_free(addr) \
|
||||
CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_memdup(str, s) \
|
||||
CRYPTO_memdup((str), s, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_strdup(str) \
|
||||
CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_strndup(str, n) \
|
||||
CRYPTO_strndup(str, n, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_secure_malloc(num) \
|
||||
CRYPTO_secure_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_secure_zalloc(num) \
|
||||
CRYPTO_secure_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_secure_free(addr) \
|
||||
CRYPTO_secure_free(addr, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_secure_clear_free(addr, num) \
|
||||
CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_secure_actual_size(ptr) \
|
||||
CRYPTO_secure_actual_size(ptr)
|
||||
|
||||
size_t OPENSSL_strlcpy(char *dst, const char *src, size_t siz);
|
||||
size_t OPENSSL_strlcat(char *dst, const char *src, size_t siz);
|
||||
size_t OPENSSL_strnlen(const char *str, size_t maxlen);
|
||||
int OPENSSL_strtoul(const char *str, char **endptr, int base, unsigned long *num);
|
||||
int OPENSSL_buf2hexstr_ex(char *str, size_t str_n, size_t *strlength,
|
||||
const unsigned char *buf, size_t buflen,
|
||||
const char sep);
|
||||
char *OPENSSL_buf2hexstr(const unsigned char *buf, long buflen);
|
||||
int OPENSSL_hexstr2buf_ex(unsigned char *buf, size_t buf_n, size_t *buflen,
|
||||
const char *str, const char sep);
|
||||
unsigned char *OPENSSL_hexstr2buf(const char *str, long *buflen);
|
||||
int OPENSSL_hexchar2int(unsigned char c);
|
||||
int OPENSSL_strcasecmp(const char *s1, const char *s2);
|
||||
int OPENSSL_strncasecmp(const char *s1, const char *s2, size_t n);
|
||||
|
||||
# define OPENSSL_MALLOC_MAX_NELEMS(type) (((1U<<(sizeof(int)*8-1))-1)/sizeof(type))
|
||||
|
||||
/*
|
||||
* These functions return the values of OPENSSL_VERSION_MAJOR,
|
||||
* OPENSSL_VERSION_MINOR, OPENSSL_VERSION_PATCH, OPENSSL_VERSION_PRE_RELEASE
|
||||
* and OPENSSL_VERSION_BUILD_METADATA, respectively.
|
||||
*/
|
||||
unsigned int OPENSSL_version_major(void);
|
||||
unsigned int OPENSSL_version_minor(void);
|
||||
unsigned int OPENSSL_version_patch(void);
|
||||
const char *OPENSSL_version_pre_release(void);
|
||||
const char *OPENSSL_version_build_metadata(void);
|
||||
|
||||
unsigned long OpenSSL_version_num(void);
|
||||
const char *OpenSSL_version(int type);
|
||||
# define OPENSSL_VERSION 0
|
||||
# define OPENSSL_CFLAGS 1
|
||||
# define OPENSSL_BUILT_ON 2
|
||||
# define OPENSSL_PLATFORM 3
|
||||
# define OPENSSL_DIR 4
|
||||
# define OPENSSL_ENGINES_DIR 5
|
||||
# define OPENSSL_VERSION_STRING 6
|
||||
# define OPENSSL_FULL_VERSION_STRING 7
|
||||
# define OPENSSL_MODULES_DIR 8
|
||||
# define OPENSSL_CPU_INFO 9
|
||||
# define OPENSSL_WINCTX 10
|
||||
|
||||
const char *OPENSSL_info(int type);
|
||||
/*
|
||||
* The series starts at 1001 to avoid confusion with the OpenSSL_version
|
||||
* types.
|
||||
*/
|
||||
# define OPENSSL_INFO_CONFIG_DIR 1001
|
||||
# define OPENSSL_INFO_ENGINES_DIR 1002
|
||||
# define OPENSSL_INFO_MODULES_DIR 1003
|
||||
# define OPENSSL_INFO_DSO_EXTENSION 1004
|
||||
# define OPENSSL_INFO_DIR_FILENAME_SEPARATOR 1005
|
||||
# define OPENSSL_INFO_LIST_SEPARATOR 1006
|
||||
# define OPENSSL_INFO_SEED_SOURCE 1007
|
||||
# define OPENSSL_INFO_CPU_SETTINGS 1008
|
||||
# define OPENSSL_INFO_WINDOWS_CONTEXT 1009
|
||||
|
||||
int OPENSSL_issetugid(void);
|
||||
|
||||
struct crypto_ex_data_st {
|
||||
OSSL_LIB_CTX *ctx;
|
||||
STACK_OF(void) *sk;
|
||||
};
|
||||
|
||||
SKM_DEFINE_STACK_OF_INTERNAL(void, void, void)
|
||||
#define sk_void_num(sk) OPENSSL_sk_num(ossl_check_const_void_sk_type(sk))
|
||||
#define sk_void_value(sk, idx) ((void *)OPENSSL_sk_value(ossl_check_const_void_sk_type(sk), (idx)))
|
||||
#define sk_void_new(cmp) ((STACK_OF(void) *)OPENSSL_sk_new(ossl_check_void_compfunc_type(cmp)))
|
||||
#define sk_void_new_null() ((STACK_OF(void) *)OPENSSL_sk_new_null())
|
||||
#define sk_void_new_reserve(cmp, n) ((STACK_OF(void) *)OPENSSL_sk_new_reserve(ossl_check_void_compfunc_type(cmp), (n)))
|
||||
#define sk_void_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_void_sk_type(sk), (n))
|
||||
#define sk_void_free(sk) OPENSSL_sk_free(ossl_check_void_sk_type(sk))
|
||||
#define sk_void_zero(sk) OPENSSL_sk_zero(ossl_check_void_sk_type(sk))
|
||||
#define sk_void_delete(sk, i) ((void *)OPENSSL_sk_delete(ossl_check_void_sk_type(sk), (i)))
|
||||
#define sk_void_delete_ptr(sk, ptr) ((void *)OPENSSL_sk_delete_ptr(ossl_check_void_sk_type(sk), ossl_check_void_type(ptr)))
|
||||
#define sk_void_push(sk, ptr) OPENSSL_sk_push(ossl_check_void_sk_type(sk), ossl_check_void_type(ptr))
|
||||
#define sk_void_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_void_sk_type(sk), ossl_check_void_type(ptr))
|
||||
#define sk_void_pop(sk) ((void *)OPENSSL_sk_pop(ossl_check_void_sk_type(sk)))
|
||||
#define sk_void_shift(sk) ((void *)OPENSSL_sk_shift(ossl_check_void_sk_type(sk)))
|
||||
#define sk_void_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_void_sk_type(sk),ossl_check_void_freefunc_type(freefunc))
|
||||
#define sk_void_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_void_sk_type(sk), ossl_check_void_type(ptr), (idx))
|
||||
#define sk_void_set(sk, idx, ptr) ((void *)OPENSSL_sk_set(ossl_check_void_sk_type(sk), (idx), ossl_check_void_type(ptr)))
|
||||
#define sk_void_find(sk, ptr) OPENSSL_sk_find(ossl_check_void_sk_type(sk), ossl_check_void_type(ptr))
|
||||
#define sk_void_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_void_sk_type(sk), ossl_check_void_type(ptr))
|
||||
#define sk_void_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_void_sk_type(sk), ossl_check_void_type(ptr), pnum)
|
||||
#define sk_void_sort(sk) OPENSSL_sk_sort(ossl_check_void_sk_type(sk))
|
||||
#define sk_void_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_void_sk_type(sk))
|
||||
#define sk_void_dup(sk) ((STACK_OF(void) *)OPENSSL_sk_dup(ossl_check_const_void_sk_type(sk)))
|
||||
#define sk_void_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(void) *)OPENSSL_sk_deep_copy(ossl_check_const_void_sk_type(sk), ossl_check_void_copyfunc_type(copyfunc), ossl_check_void_freefunc_type(freefunc)))
|
||||
#define sk_void_set_cmp_func(sk, cmp) ((sk_void_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_void_sk_type(sk), ossl_check_void_compfunc_type(cmp)))
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Per class, we have a STACK of function pointers.
|
||||
*/
|
||||
# define CRYPTO_EX_INDEX_SSL 0
|
||||
# define CRYPTO_EX_INDEX_SSL_CTX 1
|
||||
# define CRYPTO_EX_INDEX_SSL_SESSION 2
|
||||
# define CRYPTO_EX_INDEX_X509 3
|
||||
# define CRYPTO_EX_INDEX_X509_STORE 4
|
||||
# define CRYPTO_EX_INDEX_X509_STORE_CTX 5
|
||||
# define CRYPTO_EX_INDEX_DH 6
|
||||
# define CRYPTO_EX_INDEX_DSA 7
|
||||
# define CRYPTO_EX_INDEX_EC_KEY 8
|
||||
# define CRYPTO_EX_INDEX_RSA 9
|
||||
# define CRYPTO_EX_INDEX_ENGINE 10
|
||||
# define CRYPTO_EX_INDEX_UI 11
|
||||
# define CRYPTO_EX_INDEX_BIO 12
|
||||
# define CRYPTO_EX_INDEX_APP 13
|
||||
# define CRYPTO_EX_INDEX_UI_METHOD 14
|
||||
# define CRYPTO_EX_INDEX_RAND_DRBG 15
|
||||
# define CRYPTO_EX_INDEX_DRBG CRYPTO_EX_INDEX_RAND_DRBG
|
||||
# define CRYPTO_EX_INDEX_OSSL_LIB_CTX 16
|
||||
# define CRYPTO_EX_INDEX_EVP_PKEY 17
|
||||
# define CRYPTO_EX_INDEX__COUNT 18
|
||||
|
||||
typedef void CRYPTO_EX_new (void *parent, void *ptr, CRYPTO_EX_DATA *ad,
|
||||
int idx, long argl, void *argp);
|
||||
typedef void CRYPTO_EX_free (void *parent, void *ptr, CRYPTO_EX_DATA *ad,
|
||||
int idx, long argl, void *argp);
|
||||
typedef int CRYPTO_EX_dup (CRYPTO_EX_DATA *to, const CRYPTO_EX_DATA *from,
|
||||
void **from_d, int idx, long argl, void *argp);
|
||||
__owur int CRYPTO_get_ex_new_index(int class_index, long argl, void *argp,
|
||||
CRYPTO_EX_new *new_func,
|
||||
CRYPTO_EX_dup *dup_func,
|
||||
CRYPTO_EX_free *free_func);
|
||||
/* No longer use an index. */
|
||||
int CRYPTO_free_ex_index(int class_index, int idx);
|
||||
|
||||
/*
|
||||
* Initialise/duplicate/free CRYPTO_EX_DATA variables corresponding to a
|
||||
* given class (invokes whatever per-class callbacks are applicable)
|
||||
*/
|
||||
int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad);
|
||||
int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to,
|
||||
const CRYPTO_EX_DATA *from);
|
||||
|
||||
void CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad);
|
||||
|
||||
/* Allocate a single item in the CRYPTO_EX_DATA variable */
|
||||
int CRYPTO_alloc_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad,
|
||||
int idx);
|
||||
|
||||
/*
|
||||
* Get/set data in a CRYPTO_EX_DATA variable corresponding to a particular
|
||||
* index (relative to the class type involved)
|
||||
*/
|
||||
int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val);
|
||||
void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx);
|
||||
|
||||
# ifndef OPENSSL_NO_DEPRECATED_1_1_0
|
||||
/*
|
||||
* This function cleans up all "ex_data" state. It mustn't be called under
|
||||
* potential race-conditions.
|
||||
*/
|
||||
# define CRYPTO_cleanup_all_ex_data() while(0) continue
|
||||
|
||||
/*
|
||||
* The old locking functions have been removed completely without compatibility
|
||||
* macros. This is because the old functions either could not properly report
|
||||
* errors, or the returned error values were not clearly documented.
|
||||
* Replacing the locking functions with no-ops would cause race condition
|
||||
* issues in the affected applications. It is far better for them to fail at
|
||||
* compile time.
|
||||
* On the other hand, the locking callbacks are no longer used. Consequently,
|
||||
* the callback management functions can be safely replaced with no-op macros.
|
||||
*/
|
||||
# define CRYPTO_num_locks() (1)
|
||||
# define CRYPTO_set_locking_callback(func)
|
||||
# define CRYPTO_get_locking_callback() (NULL)
|
||||
# define CRYPTO_set_add_lock_callback(func)
|
||||
# define CRYPTO_get_add_lock_callback() (NULL)
|
||||
|
||||
/*
|
||||
* These defines where used in combination with the old locking callbacks,
|
||||
* they are not called anymore, but old code that's not called might still
|
||||
* use them.
|
||||
*/
|
||||
# define CRYPTO_LOCK 1
|
||||
# define CRYPTO_UNLOCK 2
|
||||
# define CRYPTO_READ 4
|
||||
# define CRYPTO_WRITE 8
|
||||
|
||||
/* This structure is no longer used */
|
||||
typedef struct crypto_threadid_st {
|
||||
int dummy;
|
||||
} CRYPTO_THREADID;
|
||||
/* Only use CRYPTO_THREADID_set_[numeric|pointer]() within callbacks */
|
||||
# define CRYPTO_THREADID_set_numeric(id, val)
|
||||
# define CRYPTO_THREADID_set_pointer(id, ptr)
|
||||
# define CRYPTO_THREADID_set_callback(threadid_func) (0)
|
||||
# define CRYPTO_THREADID_get_callback() (NULL)
|
||||
# define CRYPTO_THREADID_current(id)
|
||||
# define CRYPTO_THREADID_cmp(a, b) (-1)
|
||||
# define CRYPTO_THREADID_cpy(dest, src)
|
||||
# define CRYPTO_THREADID_hash(id) (0UL)
|
||||
|
||||
# ifndef OPENSSL_NO_DEPRECATED_1_0_0
|
||||
# define CRYPTO_set_id_callback(func)
|
||||
# define CRYPTO_get_id_callback() (NULL)
|
||||
# define CRYPTO_thread_id() (0UL)
|
||||
# endif /* OPENSSL_NO_DEPRECATED_1_0_0 */
|
||||
|
||||
# define CRYPTO_set_dynlock_create_callback(dyn_create_function)
|
||||
# define CRYPTO_set_dynlock_lock_callback(dyn_lock_function)
|
||||
# define CRYPTO_set_dynlock_destroy_callback(dyn_destroy_function)
|
||||
# define CRYPTO_get_dynlock_create_callback() (NULL)
|
||||
# define CRYPTO_get_dynlock_lock_callback() (NULL)
|
||||
# define CRYPTO_get_dynlock_destroy_callback() (NULL)
|
||||
# endif /* OPENSSL_NO_DEPRECATED_1_1_0 */
|
||||
|
||||
typedef void *(*CRYPTO_malloc_fn)(size_t num, const char *file, int line);
|
||||
typedef void *(*CRYPTO_realloc_fn)(void *addr, size_t num, const char *file,
|
||||
int line);
|
||||
typedef void (*CRYPTO_free_fn)(void *addr, const char *file, int line);
|
||||
int CRYPTO_set_mem_functions(CRYPTO_malloc_fn malloc_fn,
|
||||
CRYPTO_realloc_fn realloc_fn,
|
||||
CRYPTO_free_fn free_fn);
|
||||
void CRYPTO_get_mem_functions(CRYPTO_malloc_fn *malloc_fn,
|
||||
CRYPTO_realloc_fn *realloc_fn,
|
||||
CRYPTO_free_fn *free_fn);
|
||||
|
||||
OSSL_CRYPTO_ALLOC void *CRYPTO_malloc(size_t num, const char *file, int line);
|
||||
OSSL_CRYPTO_ALLOC void *CRYPTO_zalloc(size_t num, const char *file, int line);
|
||||
OSSL_CRYPTO_ALLOC void *CRYPTO_aligned_alloc(size_t num, size_t align,
|
||||
void **freeptr, const char *file,
|
||||
int line);
|
||||
void *CRYPTO_memdup(const void *str, size_t siz, const char *file, int line);
|
||||
char *CRYPTO_strdup(const char *str, const char *file, int line);
|
||||
char *CRYPTO_strndup(const char *str, size_t s, const char *file, int line);
|
||||
void CRYPTO_free(void *ptr, const char *file, int line);
|
||||
void CRYPTO_clear_free(void *ptr, size_t num, const char *file, int line);
|
||||
void *CRYPTO_realloc(void *addr, size_t num, const char *file, int line);
|
||||
void *CRYPTO_clear_realloc(void *addr, size_t old_num, size_t num,
|
||||
const char *file, int line);
|
||||
|
||||
int CRYPTO_secure_malloc_init(size_t sz, size_t minsize);
|
||||
int CRYPTO_secure_malloc_done(void);
|
||||
OSSL_CRYPTO_ALLOC void *CRYPTO_secure_malloc(size_t num, const char *file, int line);
|
||||
OSSL_CRYPTO_ALLOC void *CRYPTO_secure_zalloc(size_t num, const char *file, int line);
|
||||
void CRYPTO_secure_free(void *ptr, const char *file, int line);
|
||||
void CRYPTO_secure_clear_free(void *ptr, size_t num,
|
||||
const char *file, int line);
|
||||
int CRYPTO_secure_allocated(const void *ptr);
|
||||
int CRYPTO_secure_malloc_initialized(void);
|
||||
size_t CRYPTO_secure_actual_size(void *ptr);
|
||||
size_t CRYPTO_secure_used(void);
|
||||
|
||||
void OPENSSL_cleanse(void *ptr, size_t len);
|
||||
|
||||
# ifndef OPENSSL_NO_CRYPTO_MDEBUG
|
||||
/*
|
||||
* The following can be used to detect memory leaks in the library. If
|
||||
* used, it turns on malloc checking
|
||||
*/
|
||||
# define CRYPTO_MEM_CHECK_OFF 0x0 /* Control only */
|
||||
# define CRYPTO_MEM_CHECK_ON 0x1 /* Control and mode bit */
|
||||
# define CRYPTO_MEM_CHECK_ENABLE 0x2 /* Control and mode bit */
|
||||
# define CRYPTO_MEM_CHECK_DISABLE 0x3 /* Control only */
|
||||
|
||||
/* max allowed length for value of OPENSSL_MALLOC_FAILURES env var. */
|
||||
# define CRYPTO_MEM_CHECK_MAX_FS 256
|
||||
|
||||
void CRYPTO_get_alloc_counts(int *mcount, int *rcount, int *fcount);
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
# define OPENSSL_mem_debug_push(info) \
|
||||
CRYPTO_mem_debug_push(info, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_mem_debug_pop() \
|
||||
CRYPTO_mem_debug_pop()
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
OSSL_DEPRECATEDIN_3_0 int CRYPTO_set_mem_debug(int flag);
|
||||
OSSL_DEPRECATEDIN_3_0 int CRYPTO_mem_ctrl(int mode);
|
||||
OSSL_DEPRECATEDIN_3_0 int CRYPTO_mem_debug_push(const char *info,
|
||||
const char *file, int line);
|
||||
OSSL_DEPRECATEDIN_3_0 int CRYPTO_mem_debug_pop(void);
|
||||
OSSL_DEPRECATEDIN_3_0 void CRYPTO_mem_debug_malloc(void *addr, size_t num,
|
||||
int flag,
|
||||
const char *file, int line);
|
||||
OSSL_DEPRECATEDIN_3_0 void CRYPTO_mem_debug_realloc(void *addr1, void *addr2,
|
||||
size_t num, int flag,
|
||||
const char *file, int line);
|
||||
OSSL_DEPRECATEDIN_3_0 void CRYPTO_mem_debug_free(void *addr, int flag,
|
||||
const char *file, int line);
|
||||
OSSL_DEPRECATEDIN_3_0
|
||||
int CRYPTO_mem_leaks_cb(int (*cb)(const char *str, size_t len, void *u),
|
||||
void *u);
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
OSSL_DEPRECATEDIN_3_0 int CRYPTO_mem_leaks_fp(FILE *);
|
||||
# endif
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
OSSL_DEPRECATEDIN_3_0 int CRYPTO_mem_leaks(BIO *bio);
|
||||
# endif
|
||||
# endif /* OPENSSL_NO_CRYPTO_MDEBUG */
|
||||
|
||||
/* die if we have to */
|
||||
ossl_noreturn void OPENSSL_die(const char *assertion, const char *file, int line);
|
||||
# ifndef OPENSSL_NO_DEPRECATED_1_1_0
|
||||
# define OpenSSLDie(f,l,a) OPENSSL_die((a),(f),(l))
|
||||
# endif
|
||||
# define OPENSSL_assert(e) \
|
||||
(void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1))
|
||||
|
||||
int OPENSSL_isservice(void);
|
||||
|
||||
void OPENSSL_init(void);
|
||||
# ifdef OPENSSL_SYS_UNIX
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
OSSL_DEPRECATEDIN_3_0 void OPENSSL_fork_prepare(void);
|
||||
OSSL_DEPRECATEDIN_3_0 void OPENSSL_fork_parent(void);
|
||||
OSSL_DEPRECATEDIN_3_0 void OPENSSL_fork_child(void);
|
||||
# endif
|
||||
# endif
|
||||
|
||||
struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result);
|
||||
int OPENSSL_gmtime_adj(struct tm *tm, int offset_day, long offset_sec);
|
||||
int OPENSSL_gmtime_diff(int *pday, int *psec,
|
||||
const struct tm *from, const struct tm *to);
|
||||
|
||||
/*
|
||||
* CRYPTO_memcmp returns zero iff the |len| bytes at |a| and |b| are equal.
|
||||
* It takes an amount of time dependent on |len|, but independent of the
|
||||
* contents of |a| and |b|. Unlike memcmp, it cannot be used to put elements
|
||||
* into a defined order as the return value when a != b is undefined, other
|
||||
* than to be non-zero.
|
||||
*/
|
||||
int CRYPTO_memcmp(const void * in_a, const void * in_b, size_t len);
|
||||
|
||||
/* Standard initialisation options */
|
||||
# define OPENSSL_INIT_NO_LOAD_CRYPTO_STRINGS 0x00000001L
|
||||
# define OPENSSL_INIT_LOAD_CRYPTO_STRINGS 0x00000002L
|
||||
# define OPENSSL_INIT_ADD_ALL_CIPHERS 0x00000004L
|
||||
# define OPENSSL_INIT_ADD_ALL_DIGESTS 0x00000008L
|
||||
# define OPENSSL_INIT_NO_ADD_ALL_CIPHERS 0x00000010L
|
||||
# define OPENSSL_INIT_NO_ADD_ALL_DIGESTS 0x00000020L
|
||||
# define OPENSSL_INIT_LOAD_CONFIG 0x00000040L
|
||||
# define OPENSSL_INIT_NO_LOAD_CONFIG 0x00000080L
|
||||
# define OPENSSL_INIT_ASYNC 0x00000100L
|
||||
# define OPENSSL_INIT_ENGINE_RDRAND 0x00000200L
|
||||
# define OPENSSL_INIT_ENGINE_DYNAMIC 0x00000400L
|
||||
# define OPENSSL_INIT_ENGINE_OPENSSL 0x00000800L
|
||||
# define OPENSSL_INIT_ENGINE_CRYPTODEV 0x00001000L
|
||||
# define OPENSSL_INIT_ENGINE_CAPI 0x00002000L
|
||||
# define OPENSSL_INIT_ENGINE_PADLOCK 0x00004000L
|
||||
# define OPENSSL_INIT_ENGINE_AFALG 0x00008000L
|
||||
/* FREE: 0x00010000L */
|
||||
# define OPENSSL_INIT_ATFORK 0x00020000L
|
||||
/* OPENSSL_INIT_BASE_ONLY 0x00040000L */
|
||||
# define OPENSSL_INIT_NO_ATEXIT 0x00080000L
|
||||
/* OPENSSL_INIT flag range 0x03f00000 reserved for OPENSSL_init_ssl() */
|
||||
/* FREE: 0x04000000L */
|
||||
/* FREE: 0x08000000L */
|
||||
/* FREE: 0x10000000L */
|
||||
/* FREE: 0x20000000L */
|
||||
/* FREE: 0x40000000L */
|
||||
/* FREE: 0x80000000L */
|
||||
/* Max OPENSSL_INIT flag value is 0x80000000 */
|
||||
|
||||
/* openssl and dasync not counted as builtin */
|
||||
# define OPENSSL_INIT_ENGINE_ALL_BUILTIN \
|
||||
(OPENSSL_INIT_ENGINE_RDRAND | OPENSSL_INIT_ENGINE_DYNAMIC \
|
||||
| OPENSSL_INIT_ENGINE_CRYPTODEV | OPENSSL_INIT_ENGINE_CAPI | \
|
||||
OPENSSL_INIT_ENGINE_PADLOCK)
|
||||
|
||||
/* Library initialisation functions */
|
||||
void OPENSSL_cleanup(void);
|
||||
int OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings);
|
||||
int OPENSSL_atexit(void (*handler)(void));
|
||||
void OPENSSL_thread_stop(void);
|
||||
void OPENSSL_thread_stop_ex(OSSL_LIB_CTX *ctx);
|
||||
|
||||
/* Low-level control of initialization */
|
||||
OPENSSL_INIT_SETTINGS *OPENSSL_INIT_new(void);
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
int OPENSSL_INIT_set_config_filename(OPENSSL_INIT_SETTINGS *settings,
|
||||
const char *config_filename);
|
||||
void OPENSSL_INIT_set_config_file_flags(OPENSSL_INIT_SETTINGS *settings,
|
||||
unsigned long flags);
|
||||
int OPENSSL_INIT_set_config_appname(OPENSSL_INIT_SETTINGS *settings,
|
||||
const char *config_appname);
|
||||
# endif
|
||||
void OPENSSL_INIT_free(OPENSSL_INIT_SETTINGS *settings);
|
||||
|
||||
# if defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG)
|
||||
# if defined(_WIN32)
|
||||
# if defined(BASETYPES) || defined(_WINDEF_H)
|
||||
/* application has to include <windows.h> in order to use this */
|
||||
typedef DWORD CRYPTO_THREAD_LOCAL;
|
||||
typedef DWORD CRYPTO_THREAD_ID;
|
||||
|
||||
typedef LONG CRYPTO_ONCE;
|
||||
# define CRYPTO_ONCE_STATIC_INIT 0
|
||||
# endif
|
||||
# else
|
||||
# if defined(__TANDEM) && defined(_SPT_MODEL_)
|
||||
# define SPT_THREAD_SIGNAL 1
|
||||
# define SPT_THREAD_AWARE 1
|
||||
# include <spthread.h>
|
||||
# else
|
||||
# include <pthread.h>
|
||||
# endif
|
||||
typedef pthread_once_t CRYPTO_ONCE;
|
||||
typedef pthread_key_t CRYPTO_THREAD_LOCAL;
|
||||
typedef pthread_t CRYPTO_THREAD_ID;
|
||||
|
||||
# define CRYPTO_ONCE_STATIC_INIT PTHREAD_ONCE_INIT
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if !defined(CRYPTO_ONCE_STATIC_INIT)
|
||||
typedef unsigned int CRYPTO_ONCE;
|
||||
typedef unsigned int CRYPTO_THREAD_LOCAL;
|
||||
typedef unsigned int CRYPTO_THREAD_ID;
|
||||
# define CRYPTO_ONCE_STATIC_INIT 0
|
||||
# endif
|
||||
|
||||
int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void));
|
||||
|
||||
int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *));
|
||||
void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key);
|
||||
int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val);
|
||||
int CRYPTO_THREAD_cleanup_local(CRYPTO_THREAD_LOCAL *key);
|
||||
|
||||
CRYPTO_THREAD_ID CRYPTO_THREAD_get_current_id(void);
|
||||
int CRYPTO_THREAD_compare_id(CRYPTO_THREAD_ID a, CRYPTO_THREAD_ID b);
|
||||
|
||||
OSSL_LIB_CTX *OSSL_LIB_CTX_new(void);
|
||||
OSSL_LIB_CTX *OSSL_LIB_CTX_new_from_dispatch(const OSSL_CORE_HANDLE *handle,
|
||||
const OSSL_DISPATCH *in);
|
||||
OSSL_LIB_CTX *OSSL_LIB_CTX_new_child(const OSSL_CORE_HANDLE *handle,
|
||||
const OSSL_DISPATCH *in);
|
||||
int OSSL_LIB_CTX_load_config(OSSL_LIB_CTX *ctx, const char *config_file);
|
||||
void OSSL_LIB_CTX_free(OSSL_LIB_CTX *);
|
||||
OSSL_LIB_CTX *OSSL_LIB_CTX_get0_global_default(void);
|
||||
OSSL_LIB_CTX *OSSL_LIB_CTX_set0_default(OSSL_LIB_CTX *libctx);
|
||||
int OSSL_LIB_CTX_get_conf_diagnostics(OSSL_LIB_CTX *ctx);
|
||||
void OSSL_LIB_CTX_set_conf_diagnostics(OSSL_LIB_CTX *ctx, int value);
|
||||
|
||||
void OSSL_sleep(uint64_t millis);
|
||||
|
||||
|
||||
void *OSSL_LIB_CTX_get_data(OSSL_LIB_CTX *ctx, int index);
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
56
thirdparty/OpenSSL-3.5.3/include/openssl/cryptoerr.h
vendored
Normal file
56
thirdparty/OpenSSL-3.5.3/include/openssl/cryptoerr.h
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2024 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef OPENSSL_CRYPTOERR_H
|
||||
# define OPENSSL_CRYPTOERR_H
|
||||
# pragma once
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
# include <openssl/symhacks.h>
|
||||
# include <openssl/cryptoerr_legacy.h>
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* CRYPTO reason codes.
|
||||
*/
|
||||
# define CRYPTO_R_BAD_ALGORITHM_NAME 117
|
||||
# define CRYPTO_R_CONFLICTING_NAMES 118
|
||||
# define CRYPTO_R_HEX_STRING_TOO_SHORT 121
|
||||
# define CRYPTO_R_ILLEGAL_HEX_DIGIT 102
|
||||
# define CRYPTO_R_INSUFFICIENT_DATA_SPACE 106
|
||||
# define CRYPTO_R_INSUFFICIENT_PARAM_SIZE 107
|
||||
# define CRYPTO_R_INSUFFICIENT_SECURE_DATA_SPACE 108
|
||||
# define CRYPTO_R_INTEGER_OVERFLOW 127
|
||||
# define CRYPTO_R_INVALID_NEGATIVE_VALUE 122
|
||||
# define CRYPTO_R_INVALID_NULL_ARGUMENT 109
|
||||
# define CRYPTO_R_INVALID_OSSL_PARAM_TYPE 110
|
||||
# define CRYPTO_R_NO_PARAMS_TO_MERGE 131
|
||||
# define CRYPTO_R_NO_SPACE_FOR_TERMINATING_NULL 128
|
||||
# define CRYPTO_R_ODD_NUMBER_OF_DIGITS 103
|
||||
# define CRYPTO_R_PARAM_CANNOT_BE_REPRESENTED_EXACTLY 123
|
||||
# define CRYPTO_R_PARAM_NOT_INTEGER_TYPE 124
|
||||
# define CRYPTO_R_PARAM_OF_INCOMPATIBLE_TYPE 129
|
||||
# define CRYPTO_R_PARAM_UNSIGNED_INTEGER_NEGATIVE_VALUE_UNSUPPORTED 125
|
||||
# define CRYPTO_R_PARAM_UNSUPPORTED_FLOATING_POINT_FORMAT 130
|
||||
# define CRYPTO_R_PARAM_VALUE_TOO_LARGE_FOR_DESTINATION 126
|
||||
# define CRYPTO_R_PROVIDER_ALREADY_EXISTS 104
|
||||
# define CRYPTO_R_PROVIDER_SECTION_ERROR 105
|
||||
# define CRYPTO_R_RANDOM_SECTION_ERROR 119
|
||||
# define CRYPTO_R_SECURE_MALLOC_FAILURE 111
|
||||
# define CRYPTO_R_STRING_TOO_LONG 112
|
||||
# define CRYPTO_R_TOO_MANY_BYTES 113
|
||||
# define CRYPTO_R_TOO_MANY_NAMES 132
|
||||
# define CRYPTO_R_TOO_MANY_RECORDS 114
|
||||
# define CRYPTO_R_TOO_SMALL_BUFFER 116
|
||||
# define CRYPTO_R_UNKNOWN_NAME_IN_RANDOM_SECTION 120
|
||||
# define CRYPTO_R_ZERO_LENGTH_NUMBER 115
|
||||
|
||||
#endif
|
||||
1466
thirdparty/OpenSSL-3.5.3/include/openssl/cryptoerr_legacy.h
vendored
Normal file
1466
thirdparty/OpenSSL-3.5.3/include/openssl/cryptoerr_legacy.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
573
thirdparty/OpenSSL-3.5.3/include/openssl/ct.h
vendored
Normal file
573
thirdparty/OpenSSL-3.5.3/include/openssl/ct.h
vendored
Normal file
@@ -0,0 +1,573 @@
|
||||
/*
|
||||
* WARNING: do not edit!
|
||||
* Generated by makefile from include\openssl\ct.h.in
|
||||
*
|
||||
* Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef OPENSSL_CT_H
|
||||
# define OPENSSL_CT_H
|
||||
# pragma once
|
||||
|
||||
# include <openssl/macros.h>
|
||||
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
# define HEADER_CT_H
|
||||
# endif
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_CT
|
||||
# include <openssl/types.h>
|
||||
# include <openssl/safestack.h>
|
||||
# include <openssl/x509.h>
|
||||
# include <openssl/cterr.h>
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
|
||||
/* Minimum RSA key size, from RFC6962 */
|
||||
# define SCT_MIN_RSA_BITS 2048
|
||||
|
||||
/* All hashes are SHA256 in v1 of Certificate Transparency */
|
||||
# define CT_V1_HASHLEN SHA256_DIGEST_LENGTH
|
||||
|
||||
SKM_DEFINE_STACK_OF_INTERNAL(SCT, SCT, SCT)
|
||||
#define sk_SCT_num(sk) OPENSSL_sk_num(ossl_check_const_SCT_sk_type(sk))
|
||||
#define sk_SCT_value(sk, idx) ((SCT *)OPENSSL_sk_value(ossl_check_const_SCT_sk_type(sk), (idx)))
|
||||
#define sk_SCT_new(cmp) ((STACK_OF(SCT) *)OPENSSL_sk_new(ossl_check_SCT_compfunc_type(cmp)))
|
||||
#define sk_SCT_new_null() ((STACK_OF(SCT) *)OPENSSL_sk_new_null())
|
||||
#define sk_SCT_new_reserve(cmp, n) ((STACK_OF(SCT) *)OPENSSL_sk_new_reserve(ossl_check_SCT_compfunc_type(cmp), (n)))
|
||||
#define sk_SCT_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_SCT_sk_type(sk), (n))
|
||||
#define sk_SCT_free(sk) OPENSSL_sk_free(ossl_check_SCT_sk_type(sk))
|
||||
#define sk_SCT_zero(sk) OPENSSL_sk_zero(ossl_check_SCT_sk_type(sk))
|
||||
#define sk_SCT_delete(sk, i) ((SCT *)OPENSSL_sk_delete(ossl_check_SCT_sk_type(sk), (i)))
|
||||
#define sk_SCT_delete_ptr(sk, ptr) ((SCT *)OPENSSL_sk_delete_ptr(ossl_check_SCT_sk_type(sk), ossl_check_SCT_type(ptr)))
|
||||
#define sk_SCT_push(sk, ptr) OPENSSL_sk_push(ossl_check_SCT_sk_type(sk), ossl_check_SCT_type(ptr))
|
||||
#define sk_SCT_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_SCT_sk_type(sk), ossl_check_SCT_type(ptr))
|
||||
#define sk_SCT_pop(sk) ((SCT *)OPENSSL_sk_pop(ossl_check_SCT_sk_type(sk)))
|
||||
#define sk_SCT_shift(sk) ((SCT *)OPENSSL_sk_shift(ossl_check_SCT_sk_type(sk)))
|
||||
#define sk_SCT_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_SCT_sk_type(sk),ossl_check_SCT_freefunc_type(freefunc))
|
||||
#define sk_SCT_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_SCT_sk_type(sk), ossl_check_SCT_type(ptr), (idx))
|
||||
#define sk_SCT_set(sk, idx, ptr) ((SCT *)OPENSSL_sk_set(ossl_check_SCT_sk_type(sk), (idx), ossl_check_SCT_type(ptr)))
|
||||
#define sk_SCT_find(sk, ptr) OPENSSL_sk_find(ossl_check_SCT_sk_type(sk), ossl_check_SCT_type(ptr))
|
||||
#define sk_SCT_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_SCT_sk_type(sk), ossl_check_SCT_type(ptr))
|
||||
#define sk_SCT_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_SCT_sk_type(sk), ossl_check_SCT_type(ptr), pnum)
|
||||
#define sk_SCT_sort(sk) OPENSSL_sk_sort(ossl_check_SCT_sk_type(sk))
|
||||
#define sk_SCT_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_SCT_sk_type(sk))
|
||||
#define sk_SCT_dup(sk) ((STACK_OF(SCT) *)OPENSSL_sk_dup(ossl_check_const_SCT_sk_type(sk)))
|
||||
#define sk_SCT_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(SCT) *)OPENSSL_sk_deep_copy(ossl_check_const_SCT_sk_type(sk), ossl_check_SCT_copyfunc_type(copyfunc), ossl_check_SCT_freefunc_type(freefunc)))
|
||||
#define sk_SCT_set_cmp_func(sk, cmp) ((sk_SCT_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_SCT_sk_type(sk), ossl_check_SCT_compfunc_type(cmp)))
|
||||
SKM_DEFINE_STACK_OF_INTERNAL(CTLOG, CTLOG, CTLOG)
|
||||
#define sk_CTLOG_num(sk) OPENSSL_sk_num(ossl_check_const_CTLOG_sk_type(sk))
|
||||
#define sk_CTLOG_value(sk, idx) ((CTLOG *)OPENSSL_sk_value(ossl_check_const_CTLOG_sk_type(sk), (idx)))
|
||||
#define sk_CTLOG_new(cmp) ((STACK_OF(CTLOG) *)OPENSSL_sk_new(ossl_check_CTLOG_compfunc_type(cmp)))
|
||||
#define sk_CTLOG_new_null() ((STACK_OF(CTLOG) *)OPENSSL_sk_new_null())
|
||||
#define sk_CTLOG_new_reserve(cmp, n) ((STACK_OF(CTLOG) *)OPENSSL_sk_new_reserve(ossl_check_CTLOG_compfunc_type(cmp), (n)))
|
||||
#define sk_CTLOG_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_CTLOG_sk_type(sk), (n))
|
||||
#define sk_CTLOG_free(sk) OPENSSL_sk_free(ossl_check_CTLOG_sk_type(sk))
|
||||
#define sk_CTLOG_zero(sk) OPENSSL_sk_zero(ossl_check_CTLOG_sk_type(sk))
|
||||
#define sk_CTLOG_delete(sk, i) ((CTLOG *)OPENSSL_sk_delete(ossl_check_CTLOG_sk_type(sk), (i)))
|
||||
#define sk_CTLOG_delete_ptr(sk, ptr) ((CTLOG *)OPENSSL_sk_delete_ptr(ossl_check_CTLOG_sk_type(sk), ossl_check_CTLOG_type(ptr)))
|
||||
#define sk_CTLOG_push(sk, ptr) OPENSSL_sk_push(ossl_check_CTLOG_sk_type(sk), ossl_check_CTLOG_type(ptr))
|
||||
#define sk_CTLOG_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_CTLOG_sk_type(sk), ossl_check_CTLOG_type(ptr))
|
||||
#define sk_CTLOG_pop(sk) ((CTLOG *)OPENSSL_sk_pop(ossl_check_CTLOG_sk_type(sk)))
|
||||
#define sk_CTLOG_shift(sk) ((CTLOG *)OPENSSL_sk_shift(ossl_check_CTLOG_sk_type(sk)))
|
||||
#define sk_CTLOG_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_CTLOG_sk_type(sk),ossl_check_CTLOG_freefunc_type(freefunc))
|
||||
#define sk_CTLOG_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_CTLOG_sk_type(sk), ossl_check_CTLOG_type(ptr), (idx))
|
||||
#define sk_CTLOG_set(sk, idx, ptr) ((CTLOG *)OPENSSL_sk_set(ossl_check_CTLOG_sk_type(sk), (idx), ossl_check_CTLOG_type(ptr)))
|
||||
#define sk_CTLOG_find(sk, ptr) OPENSSL_sk_find(ossl_check_CTLOG_sk_type(sk), ossl_check_CTLOG_type(ptr))
|
||||
#define sk_CTLOG_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_CTLOG_sk_type(sk), ossl_check_CTLOG_type(ptr))
|
||||
#define sk_CTLOG_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_CTLOG_sk_type(sk), ossl_check_CTLOG_type(ptr), pnum)
|
||||
#define sk_CTLOG_sort(sk) OPENSSL_sk_sort(ossl_check_CTLOG_sk_type(sk))
|
||||
#define sk_CTLOG_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_CTLOG_sk_type(sk))
|
||||
#define sk_CTLOG_dup(sk) ((STACK_OF(CTLOG) *)OPENSSL_sk_dup(ossl_check_const_CTLOG_sk_type(sk)))
|
||||
#define sk_CTLOG_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(CTLOG) *)OPENSSL_sk_deep_copy(ossl_check_const_CTLOG_sk_type(sk), ossl_check_CTLOG_copyfunc_type(copyfunc), ossl_check_CTLOG_freefunc_type(freefunc)))
|
||||
#define sk_CTLOG_set_cmp_func(sk, cmp) ((sk_CTLOG_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_CTLOG_sk_type(sk), ossl_check_CTLOG_compfunc_type(cmp)))
|
||||
|
||||
|
||||
|
||||
typedef enum {
|
||||
CT_LOG_ENTRY_TYPE_NOT_SET = -1,
|
||||
CT_LOG_ENTRY_TYPE_X509 = 0,
|
||||
CT_LOG_ENTRY_TYPE_PRECERT = 1
|
||||
} ct_log_entry_type_t;
|
||||
|
||||
typedef enum {
|
||||
SCT_VERSION_NOT_SET = -1,
|
||||
SCT_VERSION_V1 = 0
|
||||
} sct_version_t;
|
||||
|
||||
typedef enum {
|
||||
SCT_SOURCE_UNKNOWN,
|
||||
SCT_SOURCE_TLS_EXTENSION,
|
||||
SCT_SOURCE_X509V3_EXTENSION,
|
||||
SCT_SOURCE_OCSP_STAPLED_RESPONSE
|
||||
} sct_source_t;
|
||||
|
||||
typedef enum {
|
||||
SCT_VALIDATION_STATUS_NOT_SET,
|
||||
SCT_VALIDATION_STATUS_UNKNOWN_LOG,
|
||||
SCT_VALIDATION_STATUS_VALID,
|
||||
SCT_VALIDATION_STATUS_INVALID,
|
||||
SCT_VALIDATION_STATUS_UNVERIFIED,
|
||||
SCT_VALIDATION_STATUS_UNKNOWN_VERSION
|
||||
} sct_validation_status_t;
|
||||
|
||||
/******************************************
|
||||
* CT policy evaluation context functions *
|
||||
******************************************/
|
||||
|
||||
/*
|
||||
* Creates a new, empty policy evaluation context associated with the given
|
||||
* library context and property query string.
|
||||
* The caller is responsible for calling CT_POLICY_EVAL_CTX_free when finished
|
||||
* with the CT_POLICY_EVAL_CTX.
|
||||
*/
|
||||
CT_POLICY_EVAL_CTX *CT_POLICY_EVAL_CTX_new_ex(OSSL_LIB_CTX *libctx,
|
||||
const char *propq);
|
||||
|
||||
/*
|
||||
* The same as CT_POLICY_EVAL_CTX_new_ex() but the default library
|
||||
* context and property query string is used.
|
||||
*/
|
||||
CT_POLICY_EVAL_CTX *CT_POLICY_EVAL_CTX_new(void);
|
||||
|
||||
/* Deletes a policy evaluation context and anything it owns. */
|
||||
void CT_POLICY_EVAL_CTX_free(CT_POLICY_EVAL_CTX *ctx);
|
||||
|
||||
/* Gets the peer certificate that the SCTs are for */
|
||||
X509* CT_POLICY_EVAL_CTX_get0_cert(const CT_POLICY_EVAL_CTX *ctx);
|
||||
|
||||
/*
|
||||
* Sets the certificate associated with the received SCTs.
|
||||
* Increments the reference count of cert.
|
||||
* Returns 1 on success, 0 otherwise.
|
||||
*/
|
||||
int CT_POLICY_EVAL_CTX_set1_cert(CT_POLICY_EVAL_CTX *ctx, X509 *cert);
|
||||
|
||||
/* Gets the issuer of the aforementioned certificate */
|
||||
X509* CT_POLICY_EVAL_CTX_get0_issuer(const CT_POLICY_EVAL_CTX *ctx);
|
||||
|
||||
/*
|
||||
* Sets the issuer of the certificate associated with the received SCTs.
|
||||
* Increments the reference count of issuer.
|
||||
* Returns 1 on success, 0 otherwise.
|
||||
*/
|
||||
int CT_POLICY_EVAL_CTX_set1_issuer(CT_POLICY_EVAL_CTX *ctx, X509 *issuer);
|
||||
|
||||
/* Gets the CT logs that are trusted sources of SCTs */
|
||||
const CTLOG_STORE *CT_POLICY_EVAL_CTX_get0_log_store(const CT_POLICY_EVAL_CTX *ctx);
|
||||
|
||||
/* Sets the log store that is in use. It must outlive the CT_POLICY_EVAL_CTX. */
|
||||
void CT_POLICY_EVAL_CTX_set_shared_CTLOG_STORE(CT_POLICY_EVAL_CTX *ctx,
|
||||
CTLOG_STORE *log_store);
|
||||
|
||||
/*
|
||||
* Gets the time, in milliseconds since the Unix epoch, that will be used as the
|
||||
* current time when checking whether an SCT was issued in the future.
|
||||
* Such SCTs will fail validation, as required by RFC6962.
|
||||
*/
|
||||
uint64_t CT_POLICY_EVAL_CTX_get_time(const CT_POLICY_EVAL_CTX *ctx);
|
||||
|
||||
/*
|
||||
* Sets the time to evaluate SCTs against, in milliseconds since the Unix epoch.
|
||||
* If an SCT's timestamp is after this time, it will be interpreted as having
|
||||
* been issued in the future. RFC6962 states that "TLS clients MUST reject SCTs
|
||||
* whose timestamp is in the future", so an SCT will not validate in this case.
|
||||
*/
|
||||
void CT_POLICY_EVAL_CTX_set_time(CT_POLICY_EVAL_CTX *ctx, uint64_t time_in_ms);
|
||||
|
||||
/*****************
|
||||
* SCT functions *
|
||||
*****************/
|
||||
|
||||
/*
|
||||
* Creates a new, blank SCT.
|
||||
* The caller is responsible for calling SCT_free when finished with the SCT.
|
||||
*/
|
||||
SCT *SCT_new(void);
|
||||
|
||||
/*
|
||||
* Creates a new SCT from some base64-encoded strings.
|
||||
* The caller is responsible for calling SCT_free when finished with the SCT.
|
||||
*/
|
||||
SCT *SCT_new_from_base64(unsigned char version,
|
||||
const char *logid_base64,
|
||||
ct_log_entry_type_t entry_type,
|
||||
uint64_t timestamp,
|
||||
const char *extensions_base64,
|
||||
const char *signature_base64);
|
||||
|
||||
/*
|
||||
* Frees the SCT and the underlying data structures.
|
||||
*/
|
||||
void SCT_free(SCT *sct);
|
||||
|
||||
/*
|
||||
* Free a stack of SCTs, and the underlying SCTs themselves.
|
||||
* Intended to be compatible with X509V3_EXT_FREE.
|
||||
*/
|
||||
void SCT_LIST_free(STACK_OF(SCT) *a);
|
||||
|
||||
/*
|
||||
* Returns the version of the SCT.
|
||||
*/
|
||||
sct_version_t SCT_get_version(const SCT *sct);
|
||||
|
||||
/*
|
||||
* Set the version of an SCT.
|
||||
* Returns 1 on success, 0 if the version is unrecognized.
|
||||
*/
|
||||
__owur int SCT_set_version(SCT *sct, sct_version_t version);
|
||||
|
||||
/*
|
||||
* Returns the log entry type of the SCT.
|
||||
*/
|
||||
ct_log_entry_type_t SCT_get_log_entry_type(const SCT *sct);
|
||||
|
||||
/*
|
||||
* Set the log entry type of an SCT.
|
||||
* Returns 1 on success, 0 otherwise.
|
||||
*/
|
||||
__owur int SCT_set_log_entry_type(SCT *sct, ct_log_entry_type_t entry_type);
|
||||
|
||||
/*
|
||||
* Gets the ID of the log that an SCT came from.
|
||||
* Ownership of the log ID remains with the SCT.
|
||||
* Returns the length of the log ID.
|
||||
*/
|
||||
size_t SCT_get0_log_id(const SCT *sct, unsigned char **log_id);
|
||||
|
||||
/*
|
||||
* Set the log ID of an SCT to point directly to the *log_id specified.
|
||||
* The SCT takes ownership of the specified pointer.
|
||||
* Returns 1 on success, 0 otherwise.
|
||||
*/
|
||||
__owur int SCT_set0_log_id(SCT *sct, unsigned char *log_id, size_t log_id_len);
|
||||
|
||||
/*
|
||||
* Set the log ID of an SCT.
|
||||
* This makes a copy of the log_id.
|
||||
* Returns 1 on success, 0 otherwise.
|
||||
*/
|
||||
__owur int SCT_set1_log_id(SCT *sct, const unsigned char *log_id,
|
||||
size_t log_id_len);
|
||||
|
||||
/*
|
||||
* Returns the timestamp for the SCT (epoch time in milliseconds).
|
||||
*/
|
||||
uint64_t SCT_get_timestamp(const SCT *sct);
|
||||
|
||||
/*
|
||||
* Set the timestamp of an SCT (epoch time in milliseconds).
|
||||
*/
|
||||
void SCT_set_timestamp(SCT *sct, uint64_t timestamp);
|
||||
|
||||
/*
|
||||
* Return the NID for the signature used by the SCT.
|
||||
* For CT v1, this will be either NID_sha256WithRSAEncryption or
|
||||
* NID_ecdsa_with_SHA256 (or NID_undef if incorrect/unset).
|
||||
*/
|
||||
int SCT_get_signature_nid(const SCT *sct);
|
||||
|
||||
/*
|
||||
* Set the signature type of an SCT
|
||||
* For CT v1, this should be either NID_sha256WithRSAEncryption or
|
||||
* NID_ecdsa_with_SHA256.
|
||||
* Returns 1 on success, 0 otherwise.
|
||||
*/
|
||||
__owur int SCT_set_signature_nid(SCT *sct, int nid);
|
||||
|
||||
/*
|
||||
* Set *ext to point to the extension data for the SCT. ext must not be NULL.
|
||||
* The SCT retains ownership of this pointer.
|
||||
* Returns length of the data pointed to.
|
||||
*/
|
||||
size_t SCT_get0_extensions(const SCT *sct, unsigned char **ext);
|
||||
|
||||
/*
|
||||
* Set the extensions of an SCT to point directly to the *ext specified.
|
||||
* The SCT takes ownership of the specified pointer.
|
||||
*/
|
||||
void SCT_set0_extensions(SCT *sct, unsigned char *ext, size_t ext_len);
|
||||
|
||||
/*
|
||||
* Set the extensions of an SCT.
|
||||
* This takes a copy of the ext.
|
||||
* Returns 1 on success, 0 otherwise.
|
||||
*/
|
||||
__owur int SCT_set1_extensions(SCT *sct, const unsigned char *ext,
|
||||
size_t ext_len);
|
||||
|
||||
/*
|
||||
* Set *sig to point to the signature for the SCT. sig must not be NULL.
|
||||
* The SCT retains ownership of this pointer.
|
||||
* Returns length of the data pointed to.
|
||||
*/
|
||||
size_t SCT_get0_signature(const SCT *sct, unsigned char **sig);
|
||||
|
||||
/*
|
||||
* Set the signature of an SCT to point directly to the *sig specified.
|
||||
* The SCT takes ownership of the specified pointer.
|
||||
*/
|
||||
void SCT_set0_signature(SCT *sct, unsigned char *sig, size_t sig_len);
|
||||
|
||||
/*
|
||||
* Set the signature of an SCT to be a copy of the *sig specified.
|
||||
* Returns 1 on success, 0 otherwise.
|
||||
*/
|
||||
__owur int SCT_set1_signature(SCT *sct, const unsigned char *sig,
|
||||
size_t sig_len);
|
||||
|
||||
/*
|
||||
* The origin of this SCT, e.g. TLS extension, OCSP response, etc.
|
||||
*/
|
||||
sct_source_t SCT_get_source(const SCT *sct);
|
||||
|
||||
/*
|
||||
* Set the origin of this SCT, e.g. TLS extension, OCSP response, etc.
|
||||
* Returns 1 on success, 0 otherwise.
|
||||
*/
|
||||
__owur int SCT_set_source(SCT *sct, sct_source_t source);
|
||||
|
||||
/*
|
||||
* Returns a text string describing the validation status of |sct|.
|
||||
*/
|
||||
const char *SCT_validation_status_string(const SCT *sct);
|
||||
|
||||
/*
|
||||
* Pretty-prints an |sct| to |out|.
|
||||
* It will be indented by the number of spaces specified by |indent|.
|
||||
* If |logs| is not NULL, it will be used to lookup the CT log that the SCT came
|
||||
* from, so that the log name can be printed.
|
||||
*/
|
||||
void SCT_print(const SCT *sct, BIO *out, int indent, const CTLOG_STORE *logs);
|
||||
|
||||
/*
|
||||
* Pretty-prints an |sct_list| to |out|.
|
||||
* It will be indented by the number of spaces specified by |indent|.
|
||||
* SCTs will be delimited by |separator|.
|
||||
* If |logs| is not NULL, it will be used to lookup the CT log that each SCT
|
||||
* came from, so that the log names can be printed.
|
||||
*/
|
||||
void SCT_LIST_print(const STACK_OF(SCT) *sct_list, BIO *out, int indent,
|
||||
const char *separator, const CTLOG_STORE *logs);
|
||||
|
||||
/*
|
||||
* Gets the last result of validating this SCT.
|
||||
* If it has not been validated yet, returns SCT_VALIDATION_STATUS_NOT_SET.
|
||||
*/
|
||||
sct_validation_status_t SCT_get_validation_status(const SCT *sct);
|
||||
|
||||
/*
|
||||
* Validates the given SCT with the provided context.
|
||||
* Sets the "validation_status" field of the SCT.
|
||||
* Returns 1 if the SCT is valid and the signature verifies.
|
||||
* Returns 0 if the SCT is invalid or could not be verified.
|
||||
* Returns -1 if an error occurs.
|
||||
*/
|
||||
__owur int SCT_validate(SCT *sct, const CT_POLICY_EVAL_CTX *ctx);
|
||||
|
||||
/*
|
||||
* Validates the given list of SCTs with the provided context.
|
||||
* Sets the "validation_status" field of each SCT.
|
||||
* Returns 1 if there are no invalid SCTs and all signatures verify.
|
||||
* Returns 0 if at least one SCT is invalid or could not be verified.
|
||||
* Returns a negative integer if an error occurs.
|
||||
*/
|
||||
__owur int SCT_LIST_validate(const STACK_OF(SCT) *scts,
|
||||
CT_POLICY_EVAL_CTX *ctx);
|
||||
|
||||
|
||||
/*********************************
|
||||
* SCT parsing and serialization *
|
||||
*********************************/
|
||||
|
||||
/*
|
||||
* Serialize (to TLS format) a stack of SCTs and return the length.
|
||||
* "a" must not be NULL.
|
||||
* If "pp" is NULL, just return the length of what would have been serialized.
|
||||
* If "pp" is not NULL and "*pp" is null, function will allocate a new pointer
|
||||
* for data that caller is responsible for freeing (only if function returns
|
||||
* successfully).
|
||||
* If "pp" is NULL and "*pp" is not NULL, caller is responsible for ensuring
|
||||
* that "*pp" is large enough to accept all of the serialized data.
|
||||
* Returns < 0 on error, >= 0 indicating bytes written (or would have been)
|
||||
* on success.
|
||||
*/
|
||||
__owur int i2o_SCT_LIST(const STACK_OF(SCT) *a, unsigned char **pp);
|
||||
|
||||
/*
|
||||
* Convert TLS format SCT list to a stack of SCTs.
|
||||
* If "a" or "*a" is NULL, a new stack will be created that the caller is
|
||||
* responsible for freeing (by calling SCT_LIST_free).
|
||||
* "**pp" and "*pp" must not be NULL.
|
||||
* Upon success, "*pp" will point to after the last bytes read, and a stack
|
||||
* will be returned.
|
||||
* Upon failure, a NULL pointer will be returned, and the position of "*pp" is
|
||||
* not defined.
|
||||
*/
|
||||
STACK_OF(SCT) *o2i_SCT_LIST(STACK_OF(SCT) **a, const unsigned char **pp,
|
||||
size_t len);
|
||||
|
||||
/*
|
||||
* Serialize (to DER format) a stack of SCTs and return the length.
|
||||
* "a" must not be NULL.
|
||||
* If "pp" is NULL, just returns the length of what would have been serialized.
|
||||
* If "pp" is not NULL and "*pp" is null, function will allocate a new pointer
|
||||
* for data that caller is responsible for freeing (only if function returns
|
||||
* successfully).
|
||||
* If "pp" is NULL and "*pp" is not NULL, caller is responsible for ensuring
|
||||
* that "*pp" is large enough to accept all of the serialized data.
|
||||
* Returns < 0 on error, >= 0 indicating bytes written (or would have been)
|
||||
* on success.
|
||||
*/
|
||||
__owur int i2d_SCT_LIST(const STACK_OF(SCT) *a, unsigned char **pp);
|
||||
|
||||
/*
|
||||
* Parses an SCT list in DER format and returns it.
|
||||
* If "a" or "*a" is NULL, a new stack will be created that the caller is
|
||||
* responsible for freeing (by calling SCT_LIST_free).
|
||||
* "**pp" and "*pp" must not be NULL.
|
||||
* Upon success, "*pp" will point to after the last bytes read, and a stack
|
||||
* will be returned.
|
||||
* Upon failure, a NULL pointer will be returned, and the position of "*pp" is
|
||||
* not defined.
|
||||
*/
|
||||
STACK_OF(SCT) *d2i_SCT_LIST(STACK_OF(SCT) **a, const unsigned char **pp,
|
||||
long len);
|
||||
|
||||
/*
|
||||
* Serialize (to TLS format) an |sct| and write it to |out|.
|
||||
* If |out| is null, no SCT will be output but the length will still be returned.
|
||||
* If |out| points to a null pointer, a string will be allocated to hold the
|
||||
* TLS-format SCT. It is the responsibility of the caller to free it.
|
||||
* If |out| points to an allocated string, the TLS-format SCT will be written
|
||||
* to it.
|
||||
* The length of the SCT in TLS format will be returned.
|
||||
*/
|
||||
__owur int i2o_SCT(const SCT *sct, unsigned char **out);
|
||||
|
||||
/*
|
||||
* Parses an SCT in TLS format and returns it.
|
||||
* If |psct| is not null, it will end up pointing to the parsed SCT. If it
|
||||
* already points to a non-null pointer, the pointer will be free'd.
|
||||
* |in| should be a pointer to a string containing the TLS-format SCT.
|
||||
* |in| will be advanced to the end of the SCT if parsing succeeds.
|
||||
* |len| should be the length of the SCT in |in|.
|
||||
* Returns NULL if an error occurs.
|
||||
* If the SCT is an unsupported version, only the SCT's 'sct' and 'sct_len'
|
||||
* fields will be populated (with |in| and |len| respectively).
|
||||
*/
|
||||
SCT *o2i_SCT(SCT **psct, const unsigned char **in, size_t len);
|
||||
|
||||
/********************
|
||||
* CT log functions *
|
||||
********************/
|
||||
|
||||
/*
|
||||
* Creates a new CT log instance with the given |public_key| and |name| and
|
||||
* associates it with the give library context |libctx| and property query
|
||||
* string |propq|.
|
||||
* Takes ownership of |public_key| but copies |name|.
|
||||
* Returns NULL if malloc fails or if |public_key| cannot be converted to DER.
|
||||
* Should be deleted by the caller using CTLOG_free when no longer needed.
|
||||
*/
|
||||
CTLOG *CTLOG_new_ex(EVP_PKEY *public_key, const char *name, OSSL_LIB_CTX *libctx,
|
||||
const char *propq);
|
||||
|
||||
/*
|
||||
* The same as CTLOG_new_ex except that the default library context and
|
||||
* property query string are used.
|
||||
*/
|
||||
CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name);
|
||||
|
||||
/*
|
||||
* Creates a new CTLOG instance with the base64-encoded SubjectPublicKeyInfo DER
|
||||
* in |pkey_base64| and associated with the given library context |libctx| and
|
||||
* property query string |propq|. The |name| is a string to help users identify
|
||||
* this log.
|
||||
* Returns 1 on success, 0 on failure.
|
||||
* Should be deleted by the caller using CTLOG_free when no longer needed.
|
||||
*/
|
||||
int CTLOG_new_from_base64_ex(CTLOG **ct_log, const char *pkey_base64,
|
||||
const char *name, OSSL_LIB_CTX *libctx,
|
||||
const char *propq);
|
||||
|
||||
/*
|
||||
* The same as CTLOG_new_from_base64_ex() except that the default
|
||||
* library context and property query string are used.
|
||||
* Returns 1 on success, 0 on failure.
|
||||
*/
|
||||
int CTLOG_new_from_base64(CTLOG ** ct_log,
|
||||
const char *pkey_base64, const char *name);
|
||||
|
||||
/*
|
||||
* Deletes a CT log instance and its fields.
|
||||
*/
|
||||
void CTLOG_free(CTLOG *log);
|
||||
|
||||
/* Gets the name of the CT log */
|
||||
const char *CTLOG_get0_name(const CTLOG *log);
|
||||
/* Gets the ID of the CT log */
|
||||
void CTLOG_get0_log_id(const CTLOG *log, const uint8_t **log_id,
|
||||
size_t *log_id_len);
|
||||
/* Gets the public key of the CT log */
|
||||
EVP_PKEY *CTLOG_get0_public_key(const CTLOG *log);
|
||||
|
||||
/**************************
|
||||
* CT log store functions *
|
||||
**************************/
|
||||
|
||||
/*
|
||||
* Creates a new CT log store and associates it with the given libctx and
|
||||
* property query string.
|
||||
* Should be deleted by the caller using CTLOG_STORE_free when no longer needed.
|
||||
*/
|
||||
CTLOG_STORE *CTLOG_STORE_new_ex(OSSL_LIB_CTX *libctx, const char *propq);
|
||||
|
||||
/*
|
||||
* Same as CTLOG_STORE_new_ex except that the default libctx and
|
||||
* property query string are used.
|
||||
* Should be deleted by the caller using CTLOG_STORE_free when no longer needed.
|
||||
*/
|
||||
CTLOG_STORE *CTLOG_STORE_new(void);
|
||||
|
||||
/*
|
||||
* Deletes a CT log store and all of the CT log instances held within.
|
||||
*/
|
||||
void CTLOG_STORE_free(CTLOG_STORE *store);
|
||||
|
||||
/*
|
||||
* Finds a CT log in the store based on its log ID.
|
||||
* Returns the CT log, or NULL if no match is found.
|
||||
*/
|
||||
const CTLOG *CTLOG_STORE_get0_log_by_id(const CTLOG_STORE *store,
|
||||
const uint8_t *log_id,
|
||||
size_t log_id_len);
|
||||
|
||||
/*
|
||||
* Loads a CT log list into a |store| from a |file|.
|
||||
* Returns 1 if loading is successful, or 0 otherwise.
|
||||
*/
|
||||
__owur int CTLOG_STORE_load_file(CTLOG_STORE *store, const char *file);
|
||||
|
||||
/*
|
||||
* Loads the default CT log list into a |store|.
|
||||
* Returns 1 if loading is successful, or 0 otherwise.
|
||||
*/
|
||||
__owur int CTLOG_STORE_load_default_file(CTLOG_STORE *store);
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
45
thirdparty/OpenSSL-3.5.3/include/openssl/cterr.h
vendored
Normal file
45
thirdparty/OpenSSL-3.5.3/include/openssl/cterr.h
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef OPENSSL_CTERR_H
|
||||
# define OPENSSL_CTERR_H
|
||||
# pragma once
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
# include <openssl/symhacks.h>
|
||||
# include <openssl/cryptoerr_legacy.h>
|
||||
|
||||
|
||||
# ifndef OPENSSL_NO_CT
|
||||
|
||||
|
||||
/*
|
||||
* CT reason codes.
|
||||
*/
|
||||
# define CT_R_BASE64_DECODE_ERROR 108
|
||||
# define CT_R_INVALID_LOG_ID_LENGTH 100
|
||||
# define CT_R_LOG_CONF_INVALID 109
|
||||
# define CT_R_LOG_CONF_INVALID_KEY 110
|
||||
# define CT_R_LOG_CONF_MISSING_DESCRIPTION 111
|
||||
# define CT_R_LOG_CONF_MISSING_KEY 112
|
||||
# define CT_R_LOG_KEY_INVALID 113
|
||||
# define CT_R_SCT_FUTURE_TIMESTAMP 116
|
||||
# define CT_R_SCT_INVALID 104
|
||||
# define CT_R_SCT_INVALID_SIGNATURE 107
|
||||
# define CT_R_SCT_LIST_INVALID 105
|
||||
# define CT_R_SCT_LOG_ID_MISMATCH 114
|
||||
# define CT_R_SCT_NOT_SET 106
|
||||
# define CT_R_SCT_UNSUPPORTED_VERSION 115
|
||||
# define CT_R_UNRECOGNIZED_SIGNATURE_NID 101
|
||||
# define CT_R_UNSUPPORTED_ENTRY_TYPE 102
|
||||
# define CT_R_UNSUPPORTED_VERSION 103
|
||||
|
||||
# endif
|
||||
#endif
|
||||
133
thirdparty/OpenSSL-3.5.3/include/openssl/decoder.h
vendored
Normal file
133
thirdparty/OpenSSL-3.5.3/include/openssl/decoder.h
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef OPENSSL_DECODER_H
|
||||
# define OPENSSL_DECODER_H
|
||||
# pragma once
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
# include <stdio.h>
|
||||
# endif
|
||||
# include <stdarg.h>
|
||||
# include <stddef.h>
|
||||
# include <openssl/decodererr.h>
|
||||
# include <openssl/types.h>
|
||||
# include <openssl/core.h>
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
OSSL_DECODER *OSSL_DECODER_fetch(OSSL_LIB_CTX *libctx, const char *name,
|
||||
const char *properties);
|
||||
int OSSL_DECODER_up_ref(OSSL_DECODER *encoder);
|
||||
void OSSL_DECODER_free(OSSL_DECODER *encoder);
|
||||
|
||||
const OSSL_PROVIDER *OSSL_DECODER_get0_provider(const OSSL_DECODER *encoder);
|
||||
const char *OSSL_DECODER_get0_properties(const OSSL_DECODER *encoder);
|
||||
const char *OSSL_DECODER_get0_name(const OSSL_DECODER *decoder);
|
||||
const char *OSSL_DECODER_get0_description(const OSSL_DECODER *decoder);
|
||||
int OSSL_DECODER_is_a(const OSSL_DECODER *encoder, const char *name);
|
||||
|
||||
void OSSL_DECODER_do_all_provided(OSSL_LIB_CTX *libctx,
|
||||
void (*fn)(OSSL_DECODER *encoder, void *arg),
|
||||
void *arg);
|
||||
int OSSL_DECODER_names_do_all(const OSSL_DECODER *encoder,
|
||||
void (*fn)(const char *name, void *data),
|
||||
void *data);
|
||||
const OSSL_PARAM *OSSL_DECODER_gettable_params(OSSL_DECODER *decoder);
|
||||
int OSSL_DECODER_get_params(OSSL_DECODER *decoder, OSSL_PARAM params[]);
|
||||
|
||||
const OSSL_PARAM *OSSL_DECODER_settable_ctx_params(OSSL_DECODER *encoder);
|
||||
OSSL_DECODER_CTX *OSSL_DECODER_CTX_new(void);
|
||||
int OSSL_DECODER_CTX_set_params(OSSL_DECODER_CTX *ctx,
|
||||
const OSSL_PARAM params[]);
|
||||
void OSSL_DECODER_CTX_free(OSSL_DECODER_CTX *ctx);
|
||||
|
||||
/* Utilities that help set specific parameters */
|
||||
int OSSL_DECODER_CTX_set_passphrase(OSSL_DECODER_CTX *ctx,
|
||||
const unsigned char *kstr, size_t klen);
|
||||
int OSSL_DECODER_CTX_set_pem_password_cb(OSSL_DECODER_CTX *ctx,
|
||||
pem_password_cb *cb, void *cbarg);
|
||||
int OSSL_DECODER_CTX_set_passphrase_cb(OSSL_DECODER_CTX *ctx,
|
||||
OSSL_PASSPHRASE_CALLBACK *cb,
|
||||
void *cbarg);
|
||||
int OSSL_DECODER_CTX_set_passphrase_ui(OSSL_DECODER_CTX *ctx,
|
||||
const UI_METHOD *ui_method,
|
||||
void *ui_data);
|
||||
|
||||
/*
|
||||
* Utilities to read the object to decode, with the result sent to cb.
|
||||
* These will discover all provided methods
|
||||
*/
|
||||
|
||||
int OSSL_DECODER_CTX_set_selection(OSSL_DECODER_CTX *ctx, int selection);
|
||||
int OSSL_DECODER_CTX_set_input_type(OSSL_DECODER_CTX *ctx,
|
||||
const char *input_type);
|
||||
int OSSL_DECODER_CTX_set_input_structure(OSSL_DECODER_CTX *ctx,
|
||||
const char *input_structure);
|
||||
int OSSL_DECODER_CTX_add_decoder(OSSL_DECODER_CTX *ctx, OSSL_DECODER *decoder);
|
||||
int OSSL_DECODER_CTX_add_extra(OSSL_DECODER_CTX *ctx,
|
||||
OSSL_LIB_CTX *libctx, const char *propq);
|
||||
int OSSL_DECODER_CTX_get_num_decoders(OSSL_DECODER_CTX *ctx);
|
||||
|
||||
typedef struct ossl_decoder_instance_st OSSL_DECODER_INSTANCE;
|
||||
OSSL_DECODER *
|
||||
OSSL_DECODER_INSTANCE_get_decoder(OSSL_DECODER_INSTANCE *decoder_inst);
|
||||
void *
|
||||
OSSL_DECODER_INSTANCE_get_decoder_ctx(OSSL_DECODER_INSTANCE *decoder_inst);
|
||||
const char *
|
||||
OSSL_DECODER_INSTANCE_get_input_type(OSSL_DECODER_INSTANCE *decoder_inst);
|
||||
const char *
|
||||
OSSL_DECODER_INSTANCE_get_input_structure(OSSL_DECODER_INSTANCE *decoder_inst,
|
||||
int *was_set);
|
||||
|
||||
typedef int OSSL_DECODER_CONSTRUCT(OSSL_DECODER_INSTANCE *decoder_inst,
|
||||
const OSSL_PARAM *params,
|
||||
void *construct_data);
|
||||
typedef void OSSL_DECODER_CLEANUP(void *construct_data);
|
||||
|
||||
int OSSL_DECODER_CTX_set_construct(OSSL_DECODER_CTX *ctx,
|
||||
OSSL_DECODER_CONSTRUCT *construct);
|
||||
int OSSL_DECODER_CTX_set_construct_data(OSSL_DECODER_CTX *ctx,
|
||||
void *construct_data);
|
||||
int OSSL_DECODER_CTX_set_cleanup(OSSL_DECODER_CTX *ctx,
|
||||
OSSL_DECODER_CLEANUP *cleanup);
|
||||
OSSL_DECODER_CONSTRUCT *OSSL_DECODER_CTX_get_construct(OSSL_DECODER_CTX *ctx);
|
||||
void *OSSL_DECODER_CTX_get_construct_data(OSSL_DECODER_CTX *ctx);
|
||||
OSSL_DECODER_CLEANUP *OSSL_DECODER_CTX_get_cleanup(OSSL_DECODER_CTX *ctx);
|
||||
|
||||
int OSSL_DECODER_export(OSSL_DECODER_INSTANCE *decoder_inst,
|
||||
void *reference, size_t reference_sz,
|
||||
OSSL_CALLBACK *export_cb, void *export_cbarg);
|
||||
|
||||
int OSSL_DECODER_from_bio(OSSL_DECODER_CTX *ctx, BIO *in);
|
||||
#ifndef OPENSSL_NO_STDIO
|
||||
int OSSL_DECODER_from_fp(OSSL_DECODER_CTX *ctx, FILE *in);
|
||||
#endif
|
||||
int OSSL_DECODER_from_data(OSSL_DECODER_CTX *ctx, const unsigned char **pdata,
|
||||
size_t *pdata_len);
|
||||
|
||||
/*
|
||||
* Create the OSSL_DECODER_CTX with an associated type. This will perform
|
||||
* an implicit OSSL_DECODER_fetch(), suitable for the object of that type.
|
||||
*/
|
||||
OSSL_DECODER_CTX *
|
||||
OSSL_DECODER_CTX_new_for_pkey(EVP_PKEY **pkey,
|
||||
const char *input_type,
|
||||
const char *input_struct,
|
||||
const char *keytype, int selection,
|
||||
OSSL_LIB_CTX *libctx, const char *propquery);
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
28
thirdparty/OpenSSL-3.5.3/include/openssl/decodererr.h
vendored
Normal file
28
thirdparty/OpenSSL-3.5.3/include/openssl/decodererr.h
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef OPENSSL_DECODERERR_H
|
||||
# define OPENSSL_DECODERERR_H
|
||||
# pragma once
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
# include <openssl/symhacks.h>
|
||||
# include <openssl/cryptoerr_legacy.h>
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* OSSL_DECODER reason codes.
|
||||
*/
|
||||
# define OSSL_DECODER_R_COULD_NOT_DECODE_OBJECT 101
|
||||
# define OSSL_DECODER_R_DECODER_NOT_FOUND 102
|
||||
# define OSSL_DECODER_R_MISSING_GET_PARAMS 100
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user