Skip to content

Commit

Permalink
openssl, refactor: support sm tls in openssl.
Browse files Browse the repository at this point in the history
  • Loading branch information
xicilion committed Jul 21, 2024
1 parent 3eda7cd commit 21b1a9c
Show file tree
Hide file tree
Showing 1,531 changed files with 78,096 additions and 698,502 deletions.
195 changes: 24 additions & 171 deletions openssl/cmake/darwin_arm64.cmake

Large diffs are not rendered by default.

192 changes: 27 additions & 165 deletions openssl/cmake/darwin_x64.cmake

Large diffs are not rendered by default.

184 changes: 23 additions & 161 deletions openssl/cmake/linux_arm.cmake

Large diffs are not rendered by default.

197 changes: 25 additions & 172 deletions openssl/cmake/linux_arm64.cmake

Large diffs are not rendered by default.

220 changes: 40 additions & 180 deletions openssl/cmake/linux_ia32.cmake

Large diffs are not rendered by default.

193 changes: 26 additions & 167 deletions openssl/cmake/linux_loong64.cmake

Large diffs are not rendered by default.

183 changes: 22 additions & 161 deletions openssl/cmake/linux_mips64.cmake

Large diffs are not rendered by default.

186 changes: 23 additions & 163 deletions openssl/cmake/linux_ppc64.cmake

Large diffs are not rendered by default.

207 changes: 26 additions & 181 deletions openssl/cmake/linux_riscv64.cmake

Large diffs are not rendered by default.

192 changes: 27 additions & 165 deletions openssl/cmake/linux_x64.cmake

Large diffs are not rendered by default.

185 changes: 23 additions & 162 deletions openssl/cmake/windows_arm64.cmake

Large diffs are not rendered by default.

183 changes: 21 additions & 162 deletions openssl/cmake/windows_ia32.cmake

Large diffs are not rendered by default.

193 changes: 27 additions & 166 deletions openssl/cmake/windows_x64.cmake

Large diffs are not rendered by default.

16 changes: 0 additions & 16 deletions openssl/include/crypto/__DECC_INCLUDE_EPILOGUE.H

This file was deleted.

20 changes: 0 additions & 20 deletions openssl/include/crypto/__DECC_INCLUDE_PROLOGUE.H

This file was deleted.

328 changes: 94 additions & 234 deletions openssl/include/crypto/aes_platform.h

Large diffs are not rendered by default.

51 changes: 0 additions & 51 deletions openssl/include/crypto/aria.h

This file was deleted.

13 changes: 5 additions & 8 deletions openssl/include/crypto/asn1.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2023 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2015-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
Expand Down Expand Up @@ -102,6 +102,7 @@ extern const EVP_PKEY_ASN1_METHOD ossl_sm2_asn1_meth;

extern const EVP_PKEY_ASN1_METHOD ossl_rsa_asn1_meths[2];
extern const EVP_PKEY_ASN1_METHOD ossl_rsa_pss_asn1_meth;
extern const EVP_PKEY_ASN1_METHOD ossl_eia3_asn1_meth;

/*
* These are used internally in the ASN1_OBJECT to keep track of whether the
Expand Down Expand Up @@ -142,12 +143,8 @@ X509_ALGOR *ossl_x509_algor_mgf1_decode(X509_ALGOR *alg);
int ossl_x509_algor_md_to_mgf1(X509_ALGOR **palg, const EVP_MD *mgf1md);
int ossl_asn1_time_print_ex(BIO *bp, const ASN1_TIME *tm, unsigned long flags);

EVP_PKEY *ossl_d2i_PrivateKey_legacy(int keytype, EVP_PKEY **a,
const unsigned char **pp, long length,
OSSL_LIB_CTX *libctx, const char *propq);
X509_ALGOR *ossl_X509_ALGOR_from_nid(int nid, int ptype, void *pval);

time_t ossl_asn1_string_to_time_t(const char *asn1_string);
void ossl_asn1_string_set_bits_left(ASN1_STRING *str, unsigned int num);
EVP_PKEY * ossl_d2i_PrivateKey_legacy(int keytype, EVP_PKEY **a,
const unsigned char **pp, long length,
OSSL_LIB_CTX *libctx, const char *propq);

#endif /* ndef OSSL_CRYPTO_ASN1_H */
2 changes: 1 addition & 1 deletion openssl/include/crypto/bioerr.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Generated by util/mkerr.pl DO NOT EDIT
* Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.
* 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
Expand Down
26 changes: 6 additions & 20 deletions openssl/include/crypto/bn.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014-2024 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2014-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
Expand Down Expand Up @@ -87,14 +87,6 @@ int bn_lshift_fixed_top(BIGNUM *r, const BIGNUM *a, int n);
int bn_rshift_fixed_top(BIGNUM *r, const BIGNUM *a, int n);
int bn_div_fixed_top(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m,
const BIGNUM *d, BN_CTX *ctx);
int ossl_bn_mask_bits_fixed_top(BIGNUM *a, int n);
int ossl_bn_is_word_fixed_top(const BIGNUM *a, BN_ULONG w);
int ossl_bn_priv_rand_range_fixed_top(BIGNUM *r, const BIGNUM *range,
unsigned int strength, BN_CTX *ctx);
int ossl_bn_gen_dsa_nonce_fixed_top(BIGNUM *out, const BIGNUM *range,
const BIGNUM *priv,
const unsigned char *message,
size_t message_len, BN_CTX *ctx);

#define BN_PRIMETEST_COMPOSITE 0
#define BN_PRIMETEST_COMPOSITE_WITH_FACTOR 1
Expand All @@ -103,8 +95,6 @@ int ossl_bn_gen_dsa_nonce_fixed_top(BIGNUM *out, const BIGNUM *range,

int ossl_bn_miller_rabin_is_prime(const BIGNUM *w, int iterations, BN_CTX *ctx,
BN_GENCB *cb, int enhanced, int *status);
int ossl_bn_check_generated_prime(const BIGNUM *w, int checks, BN_CTX *ctx,
BN_GENCB *cb);

const BIGNUM *ossl_bn_get0_small_factors(void);

Expand All @@ -124,14 +114,10 @@ OSSL_LIB_CTX *ossl_bn_get_libctx(BN_CTX *ctx);

extern const BIGNUM ossl_bn_inv_sqrt_2;

#if defined(OPENSSL_SYS_LINUX) && !defined(FIPS_MODULE) && defined (__s390x__) \
&& !defined (OPENSSL_NO_ASM)
# define S390X_MOD_EXP
#endif

int s390x_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
int s390x_crt(BIGNUM *r, const BIGNUM *i, const BIGNUM *p, const BIGNUM *q,
const BIGNUM *dmp, const BIGNUM *dmq, const BIGNUM *iqmp);
int ossl_bn_rsa_do_unblind(const BIGNUM *intermediate,
const BN_BLINDING *blinding,
const BIGNUM *possible_arg2,
const BIGNUM *to_mod, BN_CTX *ctx,
unsigned char *buf, int num);

#endif
11 changes: 3 additions & 8 deletions openssl/include/crypto/bn_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,8 @@
/* Should we define BN_DIV2W here? */

/* Only one for the following should be defined */

#ifdef _WIN64
# define SIXTY_FOUR_BIT
#elif defined(__i386__) || defined(_M_IX86) || defined(__arm__)
# define THIRTY_TWO_BIT
#else
# define SIXTY_FOUR_BIT_LONG
#endif
#define SIXTY_FOUR_BIT_LONG
#undef SIXTY_FOUR_BIT
#undef THIRTY_TWO_BIT

#endif
7 changes: 1 addition & 6 deletions openssl/include/crypto/chacha.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# pragma once

#include <stddef.h>
#include <openssl/opensslconf.h>

/*
* ChaCha20_ctr32 encrypts |len| bytes from |inp| with the given key and
Expand All @@ -27,12 +28,6 @@
void ChaCha20_ctr32(unsigned char *out, const unsigned char *inp,
size_t len, const unsigned int key[8],
const unsigned int counter[4]);
#ifdef INCLUDE_C_CHACHA20
/* The fallback implementation for `ChaCha20_ctr32`. */
void ChaCha20_ctr32_c(unsigned char *out, const unsigned char *inp, size_t len,
const unsigned int key[8], const unsigned int counter[4]);
#endif

/*
* You can notice that there is no key setup procedure. Because it's
* as trivial as collecting bytes into 32-bit elements, it's reckoned
Expand Down
37 changes: 0 additions & 37 deletions openssl/include/crypto/cmll_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,4 @@
# define OSSL_CMLL_PLATFORM_H
# pragma once

# if defined(CMLL_ASM) && (defined(__sparc) || defined(__sparc__))

/* Fujitsu SPARC64 X support */
# include "crypto/sparc_arch.h"

# ifndef OPENSSL_NO_CAMELLIA
# define SPARC_CMLL_CAPABLE (OPENSSL_sparcv9cap_P[1] & CFR_CAMELLIA)
# include <openssl/camellia.h>

void cmll_t4_set_key(const unsigned char *key, int bits, CAMELLIA_KEY *ks);
void cmll_t4_encrypt(const unsigned char *in, unsigned char *out,
const CAMELLIA_KEY *key);
void cmll_t4_decrypt(const unsigned char *in, unsigned char *out,
const CAMELLIA_KEY *key);

void cmll128_t4_cbc_encrypt(const unsigned char *in, unsigned char *out,
size_t len, const CAMELLIA_KEY *key,
unsigned char *ivec, int /*unused*/);
void cmll128_t4_cbc_decrypt(const unsigned char *in, unsigned char *out,
size_t len, const CAMELLIA_KEY *key,
unsigned char *ivec, int /*unused*/);
void cmll256_t4_cbc_encrypt(const unsigned char *in, unsigned char *out,
size_t len, const CAMELLIA_KEY *key,
unsigned char *ivec, int /*unused*/);
void cmll256_t4_cbc_decrypt(const unsigned char *in, unsigned char *out,
size_t len, const CAMELLIA_KEY *key,
unsigned char *ivec, int /*unused*/);
void cmll128_t4_ctr32_encrypt(const unsigned char *in, unsigned char *out,
size_t blocks, const CAMELLIA_KEY *key,
unsigned char *ivec);
void cmll256_t4_ctr32_encrypt(const unsigned char *in, unsigned char *out,
size_t blocks, const CAMELLIA_KEY *key,
unsigned char *ivec);
# endif /* OPENSSL_NO_CAMELLIA */

# endif /* CMLL_ASM && sparc */

#endif /* OSSL_CRYPTO_CIPHERMODE_PLATFORM_H */
2 changes: 1 addition & 1 deletion openssl/include/crypto/cmperr.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Generated by util/mkerr.pl DO NOT EDIT
* Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.
* 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
Expand Down
2 changes: 1 addition & 1 deletion openssl/include/crypto/cmserr.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Generated by util/mkerr.pl DO NOT EDIT
* Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.
* 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
Expand Down
2 changes: 1 addition & 1 deletion openssl/include/crypto/conferr.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Generated by util/mkerr.pl DO NOT EDIT
* Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.
* 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
Expand Down
48 changes: 0 additions & 48 deletions openssl/include/crypto/context.h

This file was deleted.

2 changes: 1 addition & 1 deletion openssl/include/crypto/cryptoerr.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Generated by util/mkerr.pl DO NOT EDIT
* Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.
* 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
Expand Down
5 changes: 0 additions & 5 deletions openssl/include/crypto/ctype.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,8 @@
*/
# define CTYPE_MASK_ascii (~0)

# ifdef CHARSET_EBCDIC
int ossl_toascii(int c);
int ossl_fromascii(int c);
# else
# define ossl_toascii(c) (c)
# define ossl_fromascii(c) (c)
# endif
int ossl_ctype_check(int c, unsigned int mask);

int ossl_tolower(int c);
Expand Down
18 changes: 10 additions & 8 deletions openssl/include/crypto/decoder.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.
* 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
Expand All @@ -13,6 +13,10 @@

# include <openssl/decoder.h>

OSSL_DECODER *ossl_decoder_fetch_by_number(OSSL_LIB_CTX *libctx,
int id,
const char *properties);

/*
* These are specially made for the 'file:' provider-native loader, which
* uses this to install a DER to anything decoder, which doesn't do much
Expand All @@ -25,16 +29,14 @@ void *ossl_decoder_from_algorithm(int id, const OSSL_ALGORITHM *algodef,
OSSL_DECODER_INSTANCE *
ossl_decoder_instance_new(OSSL_DECODER *decoder, void *decoderctx);
void ossl_decoder_instance_free(OSSL_DECODER_INSTANCE *decoder_inst);
OSSL_DECODER_INSTANCE *ossl_decoder_instance_dup(const OSSL_DECODER_INSTANCE *src);
int ossl_decoder_ctx_add_decoder_inst(OSSL_DECODER_CTX *ctx,
OSSL_DECODER_INSTANCE *di);

int ossl_decoder_get_number(const OSSL_DECODER *encoder);
int ossl_decoder_store_cache_flush(OSSL_LIB_CTX *libctx);
int ossl_decoder_store_remove_all_provided(const OSSL_PROVIDER *prov);
int ossl_decoder_ctx_setup_for_pkey(OSSL_DECODER_CTX *ctx,
EVP_PKEY **pkey, const char *keytype,
OSSL_LIB_CTX *libctx,
const char *propquery);

void *ossl_decoder_cache_new(OSSL_LIB_CTX *ctx);
void ossl_decoder_cache_free(void *vcache);
int ossl_decoder_cache_flush(OSSL_LIB_CTX *libctx);
int ossl_decoder_get_number(const OSSL_DECODER *encoder);

#endif
Loading

0 comments on commit 21b1a9c

Please sign in to comment.