forked from cory/tildefriends
		
	Android OpenSSL => 3.2.0.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4643 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
		| @@ -90,7 +90,7 @@ void gcm_ghash_p8(u64 Xi[2],const u128 Htable[16],const u8 *inp, size_t len); | ||||
| #   endif /* OPENSSL_SYS_AIX || OPENSSL_SYS_MACOSX */ | ||||
| #  endif /* PPC */ | ||||
|  | ||||
| #  if (defined(__arm__) || defined(__arm) || defined(__aarch64__)) | ||||
| #  if (defined(__arm__) || defined(__arm) || defined(__aarch64__) || defined(_M_ARM64))  | ||||
| #   include "arm_arch.h" | ||||
| #   if __ARM_MAX_ARCH__>=7 | ||||
| #    if defined(BSAES_ASM) | ||||
| @@ -106,7 +106,7 @@ void gcm_ghash_p8(u64 Xi[2],const u128 Htable[16],const u8 *inp, size_t len); | ||||
| #    define HWAES_decrypt aes_v8_decrypt | ||||
| #    define HWAES_cbc_encrypt aes_v8_cbc_encrypt | ||||
| #    define HWAES_ecb_encrypt aes_v8_ecb_encrypt | ||||
| #    if __ARM_MAX_ARCH__>=8 && defined(__aarch64__) | ||||
| #    if __ARM_MAX_ARCH__>=8 && (defined(__aarch64__) || defined(_M_ARM64)) | ||||
| #     define HWAES_xts_encrypt aes_v8_xts_encrypt | ||||
| #     define HWAES_xts_decrypt aes_v8_xts_decrypt | ||||
| #    endif | ||||
| @@ -114,36 +114,36 @@ void gcm_ghash_p8(u64 Xi[2],const u128 Htable[16],const u8 *inp, size_t len); | ||||
| #    define AES_PMULL_CAPABLE ((OPENSSL_armcap_P & ARMV8_PMULL) && (OPENSSL_armcap_P & ARMV8_AES)) | ||||
| #    define AES_GCM_ENC_BYTES 512 | ||||
| #    define AES_GCM_DEC_BYTES 512 | ||||
| #    if __ARM_MAX_ARCH__>=8 && defined(__aarch64__) | ||||
| #    if __ARM_MAX_ARCH__>=8 && (defined(__aarch64__) || defined(_M_ARM64)) | ||||
| #     define AES_gcm_encrypt armv8_aes_gcm_encrypt | ||||
| #     define AES_gcm_decrypt armv8_aes_gcm_decrypt | ||||
| #     define AES_GCM_ASM(gctx) ((gctx)->ctr==aes_v8_ctr32_encrypt_blocks && \ | ||||
|                                 (gctx)->gcm.funcs.ghash==gcm_ghash_v8) | ||||
| /* The [unroll8_eor3_]aes_gcm_(enc|dec)_(128|192|256)_kernel() functions | ||||
|  * take input length in BITS and return number of BYTES processed */ | ||||
| size_t aes_gcm_enc_128_kernel(const uint8_t * plaintext, uint64_t plaintext_length, uint8_t * ciphertext, | ||||
| size_t aes_gcm_enc_128_kernel(const uint8_t *plaintext, uint64_t plaintext_length, uint8_t *ciphertext, | ||||
|                               uint64_t *Xi, unsigned char ivec[16], const void *key); | ||||
| size_t aes_gcm_enc_192_kernel(const uint8_t * plaintext, uint64_t plaintext_length, uint8_t * ciphertext, | ||||
| size_t aes_gcm_enc_192_kernel(const uint8_t *plaintext, uint64_t plaintext_length, uint8_t *ciphertext, | ||||
|                               uint64_t *Xi, unsigned char ivec[16], const void *key); | ||||
| size_t aes_gcm_enc_256_kernel(const uint8_t * plaintext, uint64_t plaintext_length, uint8_t * ciphertext, | ||||
| size_t aes_gcm_enc_256_kernel(const uint8_t *plaintext, uint64_t plaintext_length, uint8_t *ciphertext, | ||||
|                               uint64_t *Xi, unsigned char ivec[16], const void *key); | ||||
| size_t aes_gcm_dec_128_kernel(const uint8_t * ciphertext, uint64_t plaintext_length, uint8_t * plaintext, | ||||
| size_t aes_gcm_dec_128_kernel(const uint8_t *ciphertext, uint64_t plaintext_length, uint8_t *plaintext, | ||||
|                               uint64_t *Xi, unsigned char ivec[16], const void *key); | ||||
| size_t aes_gcm_dec_192_kernel(const uint8_t * ciphertext, uint64_t plaintext_length, uint8_t * plaintext, | ||||
| size_t aes_gcm_dec_192_kernel(const uint8_t *ciphertext, uint64_t plaintext_length, uint8_t *plaintext, | ||||
|                               uint64_t *Xi, unsigned char ivec[16], const void *key); | ||||
| size_t aes_gcm_dec_256_kernel(const uint8_t * ciphertext, uint64_t plaintext_length, uint8_t * plaintext, | ||||
| size_t aes_gcm_dec_256_kernel(const uint8_t *ciphertext, uint64_t plaintext_length, uint8_t *plaintext, | ||||
|                               uint64_t *Xi, unsigned char ivec[16], const void *key); | ||||
| size_t unroll8_eor3_aes_gcm_enc_128_kernel(const uint8_t * plaintext, uint64_t plaintext_length, uint8_t * ciphertext, | ||||
| size_t unroll8_eor3_aes_gcm_enc_128_kernel(const uint8_t *plaintext, uint64_t plaintext_length, uint8_t *ciphertext, | ||||
|                               uint64_t *Xi, unsigned char ivec[16], const void *key); | ||||
| size_t unroll8_eor3_aes_gcm_enc_192_kernel(const uint8_t * plaintext, uint64_t plaintext_length, uint8_t * ciphertext, | ||||
| size_t unroll8_eor3_aes_gcm_enc_192_kernel(const uint8_t *plaintext, uint64_t plaintext_length, uint8_t *ciphertext, | ||||
|                               uint64_t *Xi, unsigned char ivec[16], const void *key); | ||||
| size_t unroll8_eor3_aes_gcm_enc_256_kernel(const uint8_t * plaintext, uint64_t plaintext_length, uint8_t * ciphertext, | ||||
| size_t unroll8_eor3_aes_gcm_enc_256_kernel(const uint8_t *plaintext, uint64_t plaintext_length, uint8_t *ciphertext, | ||||
|                               uint64_t *Xi, unsigned char ivec[16], const void *key); | ||||
| size_t unroll8_eor3_aes_gcm_dec_128_kernel(const uint8_t * ciphertext, uint64_t plaintext_length, uint8_t * plaintext, | ||||
| size_t unroll8_eor3_aes_gcm_dec_128_kernel(const uint8_t *ciphertext, uint64_t plaintext_length, uint8_t *plaintext, | ||||
|                               uint64_t *Xi, unsigned char ivec[16], const void *key); | ||||
| size_t unroll8_eor3_aes_gcm_dec_192_kernel(const uint8_t * ciphertext, uint64_t plaintext_length, uint8_t * plaintext, | ||||
| size_t unroll8_eor3_aes_gcm_dec_192_kernel(const uint8_t *ciphertext, uint64_t plaintext_length, uint8_t *plaintext, | ||||
|                               uint64_t *Xi, unsigned char ivec[16], const void *key); | ||||
| size_t unroll8_eor3_aes_gcm_dec_256_kernel(const uint8_t * ciphertext, uint64_t plaintext_length, uint8_t * plaintext, | ||||
| size_t unroll8_eor3_aes_gcm_dec_256_kernel(const uint8_t *ciphertext, uint64_t plaintext_length, uint8_t *plaintext, | ||||
|                               uint64_t *Xi, unsigned char ivec[16], const void *key); | ||||
| size_t armv8_aes_gcm_encrypt(const unsigned char *in, unsigned char *out, size_t len, const void *key, | ||||
|                              unsigned char ivec[16], u64 *Xi); | ||||
| @@ -434,7 +434,6 @@ void aes256_t4_xts_decrypt(const unsigned char *in, unsigned char *out, | ||||
| # elif defined(OPENSSL_CPUID_OBJ) && defined(__riscv) && __riscv_xlen == 64 | ||||
| /* RISC-V 64 support */ | ||||
| #  include "riscv_arch.h" | ||||
| #  define RV64I_ZKND_ZKNE_CAPABLE   (RISCV_HAS_ZKND() && RISCV_HAS_ZKNE()) | ||||
|  | ||||
| int rv64i_zkne_set_encrypt_key(const unsigned char *userKey, const int bits, | ||||
|                           AES_KEY *key); | ||||
| @@ -447,8 +446,6 @@ void rv64i_zknd_decrypt(const unsigned char *in, unsigned char *out, | ||||
| # elif defined(OPENSSL_CPUID_OBJ) && defined(__riscv) && __riscv_xlen == 32 | ||||
| /* RISC-V 32 support */ | ||||
| #  include "riscv_arch.h" | ||||
| #  define RV32I_ZKND_ZKNE_CAPABLE   (RISCV_HAS_ZKND() && RISCV_HAS_ZKNE()) | ||||
| #  define RV32I_ZBKB_ZKND_ZKNE_CAPABLE   (RV32I_ZKND_ZKNE_CAPABLE && RISCV_HAS_ZBKB()) | ||||
|  | ||||
| int rv32i_zkne_set_encrypt_key(const unsigned char *userKey, const int bits, | ||||
|                                AES_KEY *key); | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved. | ||||
|  * Copyright 2015-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 | ||||
| @@ -142,8 +142,12 @@ 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); | ||||
| 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); | ||||
|  | ||||
| #endif /* ndef OSSL_CRYPTO_ASN1_H */ | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| /* | ||||
|  * Generated by util/mkerr.pl DO NOT EDIT | ||||
|  * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved. | ||||
|  * Copyright 2020-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 | ||||
|   | ||||
| @@ -116,4 +116,13 @@ 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__) | ||||
| # 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); | ||||
|  | ||||
| #endif | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| /* | ||||
|  * Generated by util/mkerr.pl DO NOT EDIT | ||||
|  * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved. | ||||
|  * Copyright 2020-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 | ||||
|   | ||||
| @@ -24,6 +24,9 @@ void *ossl_rand_crng_ctx_new(OSSL_LIB_CTX *); | ||||
| int ossl_thread_register_fips(OSSL_LIB_CTX *); | ||||
| void *ossl_thread_event_ctx_new(OSSL_LIB_CTX *); | ||||
| void *ossl_fips_prov_ossl_ctx_new(OSSL_LIB_CTX *); | ||||
| #if defined(OPENSSL_THREADS) | ||||
| void *ossl_threads_ctx_new(OSSL_LIB_CTX *); | ||||
| #endif | ||||
|  | ||||
| void ossl_provider_store_free(void *); | ||||
| void ossl_property_string_data_free(void *); | ||||
| @@ -40,3 +43,6 @@ void ossl_rand_crng_ctx_free(void *); | ||||
| void ossl_thread_event_ctx_free(void *); | ||||
| void ossl_fips_prov_ossl_ctx_free(void *); | ||||
| void ossl_release_default_drbg_ctx(void); | ||||
| #if defined(OPENSSL_THREADS) | ||||
| void ossl_threads_ctx_free(void *); | ||||
| #endif | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved. | ||||
|  * Copyright 2020-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 | ||||
| @@ -25,16 +25,16 @@ 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_ctx_setup_for_pkey(OSSL_DECODER_CTX *ctx, | ||||
|                                     EVP_PKEY **pkey, const char *keytype, | ||||
|                                     OSSL_LIB_CTX *libctx, | ||||
|                                     const char *propquery); | ||||
|  | ||||
| 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); | ||||
|  | ||||
| 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); | ||||
|  | ||||
| #endif | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| /* | ||||
|  * Generated by util/mkerr.pl DO NOT EDIT | ||||
|  * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved. | ||||
|  * Copyright 2020-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 | ||||
|   | ||||
| @@ -26,7 +26,9 @@ int ossl_dsa_generate_ffc_parameters(DSA *dsa, int type, int pbits, int qbits, | ||||
|                                      BN_GENCB *cb); | ||||
|  | ||||
| int ossl_dsa_sign_int(int type, const unsigned char *dgst, int dlen, | ||||
|                       unsigned char *sig, unsigned int *siglen, DSA *dsa); | ||||
|                       unsigned char *sig, unsigned int *siglen, DSA *dsa, | ||||
|                       unsigned int nonce_type, const char *digestname, | ||||
|                       OSSL_LIB_CTX *libctx, const char *propq); | ||||
|  | ||||
| FFC_PARAMS *ossl_dsa_get0_params(DSA *dsa); | ||||
| int ossl_dsa_ffc_params_fromdata(DSA *dsa, const OSSL_PARAM params[]); | ||||
|   | ||||
| @@ -95,6 +95,12 @@ char *ossl_ec_pt_format_id2name(int id); | ||||
|  | ||||
| char *ossl_ec_check_group_type_id2name(int flags); | ||||
| int ossl_ec_set_check_group_type_from_name(EC_KEY *ec, const char *name); | ||||
|  | ||||
| int ossl_ec_generate_key_dhkem(EC_KEY *eckey, | ||||
|                                const unsigned char *ikm, size_t ikmlen); | ||||
| int ossl_ecdsa_deterministic_sign(const unsigned char *dgst, int dlen, | ||||
|                                   unsigned char *sig, unsigned int *siglen, | ||||
|                                   EC_KEY *eckey, unsigned int nonce_type, | ||||
|                                   const char *digestname, | ||||
|                                   OSSL_LIB_CTX *libctx, const char *propq); | ||||
| # endif /* OPENSSL_NO_EC */ | ||||
| #endif | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved. | ||||
|  * Copyright 2020-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 | ||||
| @@ -15,7 +15,7 @@ | ||||
|  | ||||
| # include <openssl/opensslconf.h> | ||||
|  | ||||
| # ifndef OPENSSL_NO_EC | ||||
| # ifndef OPENSSL_NO_ECX | ||||
|  | ||||
| #  include <openssl/core.h> | ||||
| #  include <openssl/e_os2.h> | ||||
| @@ -72,7 +72,6 @@ struct ecx_key_st { | ||||
|     size_t keylen; | ||||
|     ECX_KEY_TYPE type; | ||||
|     CRYPTO_REF_COUNT references; | ||||
|     CRYPTO_RWLOCK *lock; | ||||
| }; | ||||
|  | ||||
| size_t ossl_ecx_key_length(ECX_KEY_TYPE type); | ||||
| @@ -83,6 +82,9 @@ unsigned char *ossl_ecx_key_allocate_privkey(ECX_KEY *key); | ||||
| void ossl_ecx_key_free(ECX_KEY *key); | ||||
| int ossl_ecx_key_up_ref(ECX_KEY *key); | ||||
| ECX_KEY *ossl_ecx_key_dup(const ECX_KEY *key, int selection); | ||||
| int ossl_ecx_compute_key(ECX_KEY *peer, ECX_KEY *priv, size_t keylen, | ||||
|                          unsigned char *secret, size_t *secretlen, | ||||
|                          size_t outlen); | ||||
|  | ||||
| int ossl_x25519(uint8_t out_shared_key[32], const uint8_t private_key[32], | ||||
|                 const uint8_t peer_public_value[32]); | ||||
| @@ -94,27 +96,33 @@ ossl_ed25519_public_from_private(OSSL_LIB_CTX *ctx, uint8_t out_public_key[32], | ||||
|                                  const uint8_t private_key[32], | ||||
|                                  const char *propq); | ||||
| int | ||||
| ossl_ed25519_sign(uint8_t *out_sig, const uint8_t *message, size_t message_len, | ||||
| ossl_ed25519_sign(uint8_t *out_sig, const uint8_t *tbs, size_t tbs_len, | ||||
|                   const uint8_t public_key[32], const uint8_t private_key[32], | ||||
|                   const uint8_t dom2flag, const uint8_t phflag, const uint8_t csflag, | ||||
|                   const uint8_t *context, size_t context_len, | ||||
|                   OSSL_LIB_CTX *libctx, const char *propq); | ||||
| int | ||||
| ossl_ed25519_verify(const uint8_t *message, size_t message_len, | ||||
| ossl_ed25519_verify(const uint8_t *tbs, size_t tbs_len, | ||||
|                     const uint8_t signature[64], const uint8_t public_key[32], | ||||
|                     const uint8_t dom2flag, const uint8_t phflag, const uint8_t csflag, | ||||
|                     const uint8_t *context, size_t context_len, | ||||
|                     OSSL_LIB_CTX *libctx, const char *propq); | ||||
|  | ||||
| int | ||||
| ossl_ed448_public_from_private(OSSL_LIB_CTX *ctx, uint8_t out_public_key[57], | ||||
|                                const uint8_t private_key[57], const char *propq); | ||||
| int | ||||
| ossl_ed448_sign(OSSL_LIB_CTX *ctx, uint8_t *out_sig, const uint8_t *message, | ||||
|                 size_t message_len, const uint8_t public_key[57], | ||||
|                 const uint8_t private_key[57], const uint8_t *context, | ||||
|                 size_t context_len, const char *propq); | ||||
| ossl_ed448_sign(OSSL_LIB_CTX *ctx, uint8_t *out_sig, | ||||
|                 const uint8_t *message, size_t message_len, | ||||
|                 const uint8_t public_key[57], const uint8_t private_key[57], | ||||
|                 const uint8_t *context, size_t context_len, | ||||
|                 const uint8_t phflag, const char *propq); | ||||
|  | ||||
| int | ||||
| ossl_ed448_verify(OSSL_LIB_CTX *ctx, const uint8_t *message, size_t message_len, | ||||
| ossl_ed448_verify(OSSL_LIB_CTX *ctx, | ||||
|                   const uint8_t *message, size_t message_len, | ||||
|                   const uint8_t signature[114], const uint8_t public_key[57], | ||||
|                   const uint8_t *context, size_t context_len, const char *propq); | ||||
|                   const uint8_t *context, size_t context_len, | ||||
|                   const uint8_t phflag, const char *propq); | ||||
|  | ||||
| int | ||||
| ossl_x448(uint8_t out_shared_key[56], const uint8_t private_key[56], | ||||
| @@ -146,5 +154,5 @@ ECX_KEY *ossl_evp_pkey_get1_X25519(EVP_PKEY *pkey); | ||||
| ECX_KEY *ossl_evp_pkey_get1_X448(EVP_PKEY *pkey); | ||||
| ECX_KEY *ossl_evp_pkey_get1_ED25519(EVP_PKEY *pkey); | ||||
| ECX_KEY *ossl_evp_pkey_get1_ED448(EVP_PKEY *pkey); | ||||
| # endif /* OPENSSL_NO_EC */ | ||||
| # endif /* OPENSSL_NO_ECX */ | ||||
| #endif | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved. | ||||
|  * Copyright 2019-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 | ||||
|   | ||||
| @@ -16,11 +16,21 @@ | ||||
| # include "internal/refcount.h" | ||||
| # include "crypto/ecx.h" | ||||
|  | ||||
| /* | ||||
|  * Default PKCS5 PBE KDF salt lengths | ||||
|  * In RFC 8018, PBE1 uses 8 bytes (64 bits) for its salt length. | ||||
|  * It also specifies to use at least 8 bytes for PBES2. | ||||
|  * The NIST requirement for PBKDF2 is 128 bits so we use this as the | ||||
|  * default for PBE2 (scrypt and HKDF2) | ||||
|  */ | ||||
| # define PKCS5_DEFAULT_PBE1_SALT_LEN     PKCS5_SALT_LEN | ||||
| # define PKCS5_DEFAULT_PBE2_SALT_LEN     16 | ||||
| /* | ||||
|  * Don't free up md_ctx->pctx in EVP_MD_CTX_reset, use the reserved flag | ||||
|  * values in evp.h | ||||
|  */ | ||||
| #define EVP_MD_CTX_FLAG_KEEP_PKEY_CTX   0x0400 | ||||
| #define EVP_MD_CTX_FLAG_FINALISED       0x0800 | ||||
|  | ||||
| #define evp_pkey_ctx_is_legacy(ctx)                             \ | ||||
|     ((ctx)->keymgmt == NULL) | ||||
| @@ -203,7 +213,6 @@ struct evp_mac_st { | ||||
|     const char *description; | ||||
|  | ||||
|     CRYPTO_REF_COUNT refcnt; | ||||
|     CRYPTO_RWLOCK *lock; | ||||
|  | ||||
|     OSSL_FUNC_mac_newctx_fn *newctx; | ||||
|     OSSL_FUNC_mac_dupctx_fn *dupctx; | ||||
| @@ -225,7 +234,6 @@ struct evp_kdf_st { | ||||
|     char *type_name; | ||||
|     const char *description; | ||||
|     CRYPTO_REF_COUNT refcnt; | ||||
|     CRYPTO_RWLOCK *lock; | ||||
|  | ||||
|     OSSL_FUNC_kdf_newctx_fn *newctx; | ||||
|     OSSL_FUNC_kdf_dupctx_fn *dupctx; | ||||
| @@ -270,7 +278,6 @@ struct evp_md_st { | ||||
|     const char *description; | ||||
|     OSSL_PROVIDER *prov; | ||||
|     CRYPTO_REF_COUNT refcnt; | ||||
|     CRYPTO_RWLOCK *lock; | ||||
|     OSSL_FUNC_digest_newctx_fn *newctx; | ||||
|     OSSL_FUNC_digest_init_fn *dinit; | ||||
|     OSSL_FUNC_digest_update_fn *dupdate; | ||||
| @@ -326,7 +333,6 @@ struct evp_cipher_st { | ||||
|     const char *description; | ||||
|     OSSL_PROVIDER *prov; | ||||
|     CRYPTO_REF_COUNT refcnt; | ||||
|     CRYPTO_RWLOCK *lock; | ||||
|     OSSL_FUNC_cipher_newctx_fn *newctx; | ||||
|     OSSL_FUNC_cipher_encrypt_init_fn *einit; | ||||
|     OSSL_FUNC_cipher_decrypt_init_fn *dinit; | ||||
| @@ -646,7 +652,9 @@ union legacy_pkey_st { | ||||
| #  endif | ||||
| #  ifndef OPENSSL_NO_EC | ||||
|     struct ec_key_st *ec;   /* ECC */ | ||||
| #   ifndef OPENSSL_NO_ECX | ||||
|     ECX_KEY *ecx;           /* X25519, X448, Ed25519, Ed448 */ | ||||
| #   endif | ||||
| #  endif | ||||
| }; | ||||
|  | ||||
| @@ -784,7 +792,7 @@ void *evp_keymgmt_util_export_to_provider(EVP_PKEY *pk, EVP_KEYMGMT *keymgmt, | ||||
| OP_CACHE_ELEM *evp_keymgmt_util_find_operation_cache(EVP_PKEY *pk, | ||||
|                                                      EVP_KEYMGMT *keymgmt, | ||||
|                                                      int selection); | ||||
| int evp_keymgmt_util_clear_operation_cache(EVP_PKEY *pk, int locking); | ||||
| int evp_keymgmt_util_clear_operation_cache(EVP_PKEY *pk); | ||||
| int evp_keymgmt_util_cache_keydata(EVP_PKEY *pk, EVP_KEYMGMT *keymgmt, | ||||
|                                    void *keydata, int selection); | ||||
| void evp_keymgmt_util_cache_keyinfo(EVP_PKEY *pk); | ||||
| @@ -813,7 +821,7 @@ int evp_keymgmt_set_params(const EVP_KEYMGMT *keymgmt, | ||||
| void *evp_keymgmt_gen_init(const EVP_KEYMGMT *keymgmt, int selection, | ||||
|                            const OSSL_PARAM params[]); | ||||
| int evp_keymgmt_gen_set_template(const EVP_KEYMGMT *keymgmt, void *genctx, | ||||
|                                  void *template); | ||||
|                                  void *templ); | ||||
| int evp_keymgmt_gen_set_params(const EVP_KEYMGMT *keymgmt, void *genctx, | ||||
|                                const OSSL_PARAM params[]); | ||||
| void *evp_keymgmt_gen(const EVP_KEYMGMT *keymgmt, void *genctx, | ||||
| @@ -892,10 +900,6 @@ EVP_MD_CTX *evp_md_ctx_new_ex(EVP_PKEY *pkey, const ASN1_OCTET_STRING *id, | ||||
| int evp_pkey_name2type(const char *name); | ||||
| const char *evp_pkey_type2name(int type); | ||||
|  | ||||
| int evp_pkey_ctx_set1_id_prov(EVP_PKEY_CTX *ctx, const void *id, int len); | ||||
| int evp_pkey_ctx_get1_id_prov(EVP_PKEY_CTX *ctx, void *id); | ||||
| int evp_pkey_ctx_get1_id_len_prov(EVP_PKEY_CTX *ctx, size_t *id_len); | ||||
|  | ||||
| int evp_pkey_ctx_use_cached_data(EVP_PKEY_CTX *ctx); | ||||
| # endif /* !defined(FIPS_MODULE) */ | ||||
|  | ||||
| @@ -959,4 +963,8 @@ void evp_rand_clear_seed(EVP_RAND_CTX *ctx, | ||||
|                          unsigned char *buffer, size_t b_len); | ||||
| int evp_signature_get_number(const EVP_SIGNATURE *signature); | ||||
|  | ||||
| int evp_pkey_decrypt_alloc(EVP_PKEY_CTX *ctx, unsigned char **outp, | ||||
|                            size_t *outlenp, size_t expected_outlen, | ||||
|                            const unsigned char *in, size_t inlen); | ||||
|  | ||||
| #endif /* OSSL_CRYPTO_EVP_H */ | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| /* | ||||
|  * Generated by util/mkerr.pl DO NOT EDIT | ||||
|  * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved. | ||||
|  * Copyright 2020-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 | ||||
|   | ||||
| @@ -63,37 +63,41 @@ | ||||
|  *      #define HASH_BLOCK_DATA_ORDER   md5_block_data_order | ||||
|  */ | ||||
|  | ||||
| #include <openssl/crypto.h> | ||||
| #ifndef OSSL_CRYPTO_MD32_COMMON_H | ||||
| # define OSSL_CRYPTO_MD32_COMMON_H | ||||
| # pragma once | ||||
|  | ||||
| #if !defined(DATA_ORDER_IS_BIG_ENDIAN) && !defined(DATA_ORDER_IS_LITTLE_ENDIAN) | ||||
| # error "DATA_ORDER must be defined!" | ||||
| #endif | ||||
| # include <openssl/crypto.h> | ||||
|  | ||||
| #ifndef HASH_CBLOCK | ||||
| # error "HASH_CBLOCK must be defined!" | ||||
| #endif | ||||
| #ifndef HASH_LONG | ||||
| # error "HASH_LONG must be defined!" | ||||
| #endif | ||||
| #ifndef HASH_CTX | ||||
| # error "HASH_CTX must be defined!" | ||||
| #endif | ||||
| # if !defined(DATA_ORDER_IS_BIG_ENDIAN) && !defined(DATA_ORDER_IS_LITTLE_ENDIAN) | ||||
| #  error "DATA_ORDER must be defined!" | ||||
| # endif | ||||
|  | ||||
| #ifndef HASH_UPDATE | ||||
| # error "HASH_UPDATE must be defined!" | ||||
| #endif | ||||
| #ifndef HASH_TRANSFORM | ||||
| # error "HASH_TRANSFORM must be defined!" | ||||
| #endif | ||||
| #ifndef HASH_FINAL | ||||
| # error "HASH_FINAL must be defined!" | ||||
| #endif | ||||
| # ifndef HASH_CBLOCK | ||||
| #  error "HASH_CBLOCK must be defined!" | ||||
| # endif | ||||
| # ifndef HASH_LONG | ||||
| #  error "HASH_LONG must be defined!" | ||||
| # endif | ||||
| # ifndef HASH_CTX | ||||
| #  error "HASH_CTX must be defined!" | ||||
| # endif | ||||
|  | ||||
| #ifndef HASH_BLOCK_DATA_ORDER | ||||
| # error "HASH_BLOCK_DATA_ORDER must be defined!" | ||||
| #endif | ||||
| # ifndef HASH_UPDATE | ||||
| #  error "HASH_UPDATE must be defined!" | ||||
| # endif | ||||
| # ifndef HASH_TRANSFORM | ||||
| #  error "HASH_TRANSFORM must be defined!" | ||||
| # endif | ||||
| # ifndef HASH_FINAL | ||||
| #  error "HASH_FINAL must be defined!" | ||||
| # endif | ||||
|  | ||||
| #define ROTATE(a,n)     (((a)<<(n))|(((a)&0xffffffff)>>(32-(n)))) | ||||
| # ifndef HASH_BLOCK_DATA_ORDER | ||||
| #  error "HASH_BLOCK_DATA_ORDER must be defined!" | ||||
| # endif | ||||
|  | ||||
| # define ROTATE(a,n)     (((a)<<(n))|(((a)&0xffffffff)>>(32-(n)))) | ||||
|  | ||||
| #ifndef PEDANTIC | ||||
| # if defined(__GNUC__) && __GNUC__>=2 && \ | ||||
| @@ -117,31 +121,31 @@ | ||||
| # endif | ||||
| #endif | ||||
|  | ||||
| #if defined(DATA_ORDER_IS_BIG_ENDIAN) | ||||
| # if defined(DATA_ORDER_IS_BIG_ENDIAN) | ||||
|  | ||||
| # define HOST_c2l(c,l)  (l =(((unsigned long)(*((c)++)))<<24),          \ | ||||
| #  define HOST_c2l(c,l)  (l =(((unsigned long)(*((c)++)))<<24),          \ | ||||
|                          l|=(((unsigned long)(*((c)++)))<<16),          \ | ||||
|                          l|=(((unsigned long)(*((c)++)))<< 8),          \ | ||||
|                          l|=(((unsigned long)(*((c)++)))    )           ) | ||||
| # define HOST_l2c(l,c)  (*((c)++)=(unsigned char)(((l)>>24)&0xff),      \ | ||||
| #  define HOST_l2c(l,c)  (*((c)++)=(unsigned char)(((l)>>24)&0xff),      \ | ||||
|                          *((c)++)=(unsigned char)(((l)>>16)&0xff),      \ | ||||
|                          *((c)++)=(unsigned char)(((l)>> 8)&0xff),      \ | ||||
|                          *((c)++)=(unsigned char)(((l)    )&0xff),      \ | ||||
|                          l) | ||||
|  | ||||
| #elif defined(DATA_ORDER_IS_LITTLE_ENDIAN) | ||||
| # elif defined(DATA_ORDER_IS_LITTLE_ENDIAN) | ||||
|  | ||||
| # define HOST_c2l(c,l)  (l =(((unsigned long)(*((c)++)))    ),          \ | ||||
| #  define HOST_c2l(c,l)  (l =(((unsigned long)(*((c)++)))    ),          \ | ||||
|                          l|=(((unsigned long)(*((c)++)))<< 8),          \ | ||||
|                          l|=(((unsigned long)(*((c)++)))<<16),          \ | ||||
|                          l|=(((unsigned long)(*((c)++)))<<24)           ) | ||||
| # define HOST_l2c(l,c)  (*((c)++)=(unsigned char)(((l)    )&0xff),      \ | ||||
| #  define HOST_l2c(l,c)  (*((c)++)=(unsigned char)(((l)    )&0xff),      \ | ||||
|                          *((c)++)=(unsigned char)(((l)>> 8)&0xff),      \ | ||||
|                          *((c)++)=(unsigned char)(((l)>>16)&0xff),      \ | ||||
|                          *((c)++)=(unsigned char)(((l)>>24)&0xff),      \ | ||||
|                          l) | ||||
|  | ||||
| #endif | ||||
| # endif | ||||
|  | ||||
| /* | ||||
|  * Time for some action :-) | ||||
| @@ -226,30 +230,30 @@ int HASH_FINAL(unsigned char *md, HASH_CTX *c) | ||||
|     memset(p + n, 0, HASH_CBLOCK - 8 - n); | ||||
|  | ||||
|     p += HASH_CBLOCK - 8; | ||||
| #if   defined(DATA_ORDER_IS_BIG_ENDIAN) | ||||
| # if   defined(DATA_ORDER_IS_BIG_ENDIAN) | ||||
|     (void)HOST_l2c(c->Nh, p); | ||||
|     (void)HOST_l2c(c->Nl, p); | ||||
| #elif defined(DATA_ORDER_IS_LITTLE_ENDIAN) | ||||
| # elif defined(DATA_ORDER_IS_LITTLE_ENDIAN) | ||||
|     (void)HOST_l2c(c->Nl, p); | ||||
|     (void)HOST_l2c(c->Nh, p); | ||||
| #endif | ||||
| # endif | ||||
|     p -= HASH_CBLOCK; | ||||
|     HASH_BLOCK_DATA_ORDER(c, p, 1); | ||||
|     c->num = 0; | ||||
|     OPENSSL_cleanse(p, HASH_CBLOCK); | ||||
|  | ||||
| #ifndef HASH_MAKE_STRING | ||||
| # error "HASH_MAKE_STRING must be defined!" | ||||
| #else | ||||
| # ifndef HASH_MAKE_STRING | ||||
| #  error "HASH_MAKE_STRING must be defined!" | ||||
| # else | ||||
|     HASH_MAKE_STRING(c, md); | ||||
| #endif | ||||
| # endif | ||||
|  | ||||
|     return 1; | ||||
| } | ||||
|  | ||||
| #ifndef MD32_REG_T | ||||
| # if defined(__alpha) || defined(__sparcv9) || defined(__mips) | ||||
| #  define MD32_REG_T long | ||||
| # ifndef MD32_REG_T | ||||
| #  if defined(__alpha) || defined(__sparcv9) || defined(__mips) | ||||
| #   define MD32_REG_T long | ||||
| /* | ||||
|  * This comment was originally written for MD5, which is why it | ||||
|  * discusses A-D. But it basically applies to all 32-bit digests, | ||||
| @@ -266,13 +270,15 @@ int HASH_FINAL(unsigned char *md, HASH_CTX *c) | ||||
|  * Well, to be honest it should say that this *prevents* | ||||
|  * performance degradation. | ||||
|  */ | ||||
| # else | ||||
| #  else | ||||
| /* | ||||
|  * Above is not absolute and there are LP64 compilers that | ||||
|  * generate better code if MD32_REG_T is defined int. The above | ||||
|  * pre-processor condition reflects the circumstances under which | ||||
|  * the conclusion was made and is subject to further extension. | ||||
|  */ | ||||
| #  define MD32_REG_T int | ||||
| #   define MD32_REG_T int | ||||
| #  endif | ||||
| # endif | ||||
|  | ||||
| #endif | ||||
|   | ||||
| @@ -138,6 +138,12 @@ struct gcm128_context { | ||||
| #endif | ||||
| }; | ||||
|  | ||||
| /* GHASH functions */ | ||||
| void ossl_gcm_init_4bit(u128 Htable[16], const u64 H[2]); | ||||
| void ossl_gcm_ghash_4bit(u64 Xi[2], const u128 Htable[16], | ||||
|                          const u8 *inp, size_t len); | ||||
| void ossl_gcm_gmult_4bit(u64 Xi[2], const u128 Htable[16]); | ||||
|  | ||||
| /* | ||||
|  * The maximum permitted number of cipher blocks per data unit in XTS mode. | ||||
|  * Reference IEEE Std 1619-2018. | ||||
| @@ -149,6 +155,12 @@ struct xts128_context { | ||||
|     block128_f block1, block2; | ||||
| }; | ||||
|  | ||||
| /* XTS mode for SM4 algorithm specified by GB/T 17964-2021 */ | ||||
| int ossl_crypto_xts128gb_encrypt(const XTS128_CONTEXT *ctx, | ||||
|                                  const unsigned char iv[16], | ||||
|                                  const unsigned char *inp, unsigned char *out, | ||||
|                                  size_t len, int enc); | ||||
|  | ||||
| struct ccm128_context { | ||||
|     union { | ||||
|         u64 u[2]; | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| /* | ||||
|  * Generated by util/mkerr.pl DO NOT EDIT | ||||
|  * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved. | ||||
|  * Copyright 2020-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 | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved. | ||||
|  * 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 | ||||
| @@ -22,6 +22,4 @@ int ossl_punycode_decode ( | ||||
|  | ||||
| int ossl_a2ulabel(const char *in, char *out, size_t outlen); | ||||
|  | ||||
| int ossl_a2ucompare(const char *a, const char *u); | ||||
|  | ||||
| #endif | ||||
|   | ||||
| @@ -140,4 +140,15 @@ EVP_RAND_CTX *ossl_rand_get0_private_noncreating(OSSL_LIB_CTX *ctx); | ||||
| # else | ||||
| EVP_RAND_CTX *ossl_rand_get0_seed_noncreating(OSSL_LIB_CTX *ctx); | ||||
| # endif | ||||
|  | ||||
| /* Generate a uniformly distributed random integer in the interval [0, upper) */ | ||||
| uint32_t ossl_rand_uniform_uint32(OSSL_LIB_CTX *ctx, uint32_t upper, int *err); | ||||
|  | ||||
| /* | ||||
|  * Generate a uniformly distributed random integer in the interval | ||||
|  * [lower, upper). | ||||
|  */ | ||||
| uint32_t ossl_rand_range_uint32(OSSL_LIB_CTX *ctx, uint32_t lower, uint32_t upper, | ||||
|                                 int *err); | ||||
|  | ||||
| #endif | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright 2022 The OpenSSL Project Authors. All Rights Reserved. | ||||
|  * Copyright 2022-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 | ||||
| @@ -56,4 +56,9 @@ static const size_t kRISCVNumCaps = | ||||
| # include "riscv_arch.def" | ||||
| ; | ||||
|  | ||||
| /* Extension combination tests. */ | ||||
| #define RISCV_HAS_ZBB_AND_ZBC() (RISCV_HAS_ZBB() && RISCV_HAS_ZBC()) | ||||
| #define RISCV_HAS_ZBKB_AND_ZKND_AND_ZKNE() (RISCV_HAS_ZBKB() && RISCV_HAS_ZKND() && RISCV_HAS_ZKNE()) | ||||
| #define RISCV_HAS_ZKND_AND_ZKNE() (RISCV_HAS_ZKND() && RISCV_HAS_ZKNE()) | ||||
|  | ||||
| #endif | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved. | ||||
|  * 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 | ||||
| @@ -34,8 +34,6 @@ int ossl_rsa_pss_params_30_copy(RSA_PSS_PARAMS_30 *to, | ||||
| int ossl_rsa_pss_params_30_is_unrestricted(const RSA_PSS_PARAMS_30 *rsa_pss_params); | ||||
| int ossl_rsa_pss_params_30_set_hashalg(RSA_PSS_PARAMS_30 *rsa_pss_params, | ||||
|                                        int hashalg_nid); | ||||
| int ossl_rsa_pss_params_30_set_maskgenalg(RSA_PSS_PARAMS_30 *rsa_pss_params, | ||||
|                                           int maskgenalg_nid); | ||||
| int ossl_rsa_pss_params_30_set_maskgenhashalg(RSA_PSS_PARAMS_30 *rsa_pss_params, | ||||
|                                               int maskgenhashalg_nid); | ||||
| int ossl_rsa_pss_params_30_set_saltlen(RSA_PSS_PARAMS_30 *rsa_pss_params, | ||||
| @@ -83,6 +81,10 @@ int ossl_rsa_param_decode(RSA *rsa, const X509_ALGOR *alg); | ||||
| RSA *ossl_rsa_key_from_pkcs8(const PKCS8_PRIV_KEY_INFO *p8inf, | ||||
|                              OSSL_LIB_CTX *libctx, const char *propq); | ||||
|  | ||||
| int ossl_rsa_padding_check_PKCS1_type_2(OSSL_LIB_CTX *ctx, | ||||
|                                         unsigned char *to, int tlen, | ||||
|                                         const unsigned char *from, int flen, | ||||
|                                         int num, unsigned char *kdk); | ||||
| int ossl_rsa_padding_check_PKCS1_type_2_TLS(OSSL_LIB_CTX *ctx, unsigned char *to, | ||||
|                                             size_t tlen, | ||||
|                                             const unsigned char *from, | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved. | ||||
|  * Copyright 2018-2023 The OpenSSL Project Authors. All Rights Reserved. | ||||
|  * Copyright (c) 2018, Oracle and/or its affiliates.  All rights reserved. | ||||
|  * | ||||
|  * Licensed under the Apache License 2.0 (the "License").  You may not use | ||||
| @@ -14,6 +14,7 @@ | ||||
|  | ||||
| # include <openssl/sha.h> | ||||
|  | ||||
| int ossl_sha256_192_init(SHA256_CTX *c); | ||||
| int sha512_224_init(SHA512_CTX *); | ||||
| int sha512_256_init(SHA512_CTX *); | ||||
| int ossl_sha1_ctrl(SHA_CTX *ctx, int cmd, int mslen, void *ms); | ||||
|   | ||||
| @@ -12,7 +12,7 @@ | ||||
| # pragma once | ||||
|  | ||||
| # if defined(OPENSSL_CPUID_OBJ) | ||||
| #  if defined(__aarch64__) | ||||
| #  if defined(__aarch64__) ||  defined (_M_ARM64) | ||||
| #   include "arm_arch.h" | ||||
| extern unsigned int OPENSSL_arm_midr; | ||||
| static inline int vpsm4_capable(void) | ||||
| @@ -21,8 +21,14 @@ static inline int vpsm4_capable(void) | ||||
|             (MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, ARM_CPU_IMP_ARM, ARM_CPU_PART_V1) || | ||||
|              MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, ARM_CPU_IMP_ARM, ARM_CPU_PART_N1)); | ||||
| } | ||||
| static inline int vpsm4_ex_capable(void) | ||||
| { | ||||
|     return (OPENSSL_armcap_P & ARMV8_CPUID) && | ||||
|             (MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, HISI_CPU_IMP, HISI_CPU_PART_KP920)); | ||||
| } | ||||
| #   if defined(VPSM4_ASM) | ||||
| #    define VPSM4_CAPABLE vpsm4_capable() | ||||
| #    define VPSM4_EX_CAPABLE vpsm4_ex_capable() | ||||
| #   endif | ||||
| #   define HWSM4_CAPABLE (OPENSSL_armcap_P & ARMV8_SM4) | ||||
| #   define HWSM4_set_encrypt_key sm4_v8_set_encrypt_key | ||||
| @@ -53,7 +59,7 @@ void HWSM4_ctr32_encrypt_blocks(const unsigned char *in, unsigned char *out, | ||||
|                                 const unsigned char ivec[16]); | ||||
| # endif /* HWSM4_CAPABLE */ | ||||
|  | ||||
| #ifdef VPSM4_CAPABLE | ||||
| # ifdef VPSM4_CAPABLE | ||||
| int vpsm4_set_encrypt_key(const unsigned char *userKey, SM4_KEY *key); | ||||
| int vpsm4_set_decrypt_key(const unsigned char *userKey, SM4_KEY *key); | ||||
| void vpsm4_encrypt(const unsigned char *in, unsigned char *out, | ||||
| @@ -69,7 +75,37 @@ void vpsm4_ecb_encrypt(const unsigned char *in, unsigned char *out, | ||||
| void vpsm4_ctr32_encrypt_blocks(const unsigned char *in, unsigned char *out, | ||||
|                                 size_t len, const void *key, | ||||
|                                 const unsigned char ivec[16]); | ||||
| void vpsm4_xts_encrypt(const unsigned char *in, unsigned char *out, | ||||
|                        size_t len, const SM4_KEY *key1, const SM4_KEY *key2, | ||||
|                        const unsigned char ivec[16], const int enc); | ||||
| void vpsm4_xts_encrypt_gb(const unsigned char *in, unsigned char *out, | ||||
|                           size_t len, const SM4_KEY *key1, const SM4_KEY *key2, | ||||
|                           const unsigned char ivec[16], const int enc); | ||||
| # endif /* VPSM4_CAPABLE */ | ||||
|  | ||||
| # ifdef VPSM4_EX_CAPABLE | ||||
| int vpsm4_ex_set_encrypt_key(const unsigned char *userKey, SM4_KEY *key); | ||||
| int vpsm4_ex_set_decrypt_key(const unsigned char *userKey, SM4_KEY *key); | ||||
| void vpsm4_ex_encrypt(const unsigned char *in, unsigned char *out, | ||||
|                       const SM4_KEY *key); | ||||
| void vpsm4_ex_decrypt(const unsigned char *in, unsigned char *out, | ||||
|                       const SM4_KEY *key); | ||||
| void vpsm4_ex_cbc_encrypt(const unsigned char *in, unsigned char *out, | ||||
|                           size_t length, const SM4_KEY *key, | ||||
|                           unsigned char *ivec, const int enc); | ||||
| void vpsm4_ex_ecb_encrypt(const unsigned char *in, unsigned char *out, | ||||
|                           size_t length, const SM4_KEY *key, | ||||
|                           const int enc); | ||||
| void vpsm4_ex_ctr32_encrypt_blocks(const unsigned char *in, unsigned char *out, | ||||
|                                    size_t len, const void *key, | ||||
|                                    const unsigned char ivec[16]); | ||||
| void vpsm4_ex_xts_encrypt(const unsigned char *in, unsigned char *out, | ||||
|                           size_t len, const SM4_KEY *key1, const SM4_KEY *key2, | ||||
|                           const unsigned char ivec[16], const int enc); | ||||
| void vpsm4_ex_xts_encrypt_gb(const unsigned char *in, unsigned char *out, | ||||
|                              size_t len, const SM4_KEY *key1, | ||||
|                              const SM4_KEY *key2, const unsigned char ivec[16], | ||||
|                              const int enc); | ||||
| # endif /* VPSM4_EX_CAPABLE */ | ||||
|  | ||||
| #endif /* OSSL_SM4_PLATFORM_H */ | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved. | ||||
|  * 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 | ||||
|   | ||||
| @@ -278,6 +278,8 @@ struct x509_store_ctx_st {      /* X509_STORE_CTX */ | ||||
|     SSL_DANE *dane; | ||||
|     /* signed via bare TA public key, rather than CA certificate */ | ||||
|     int bare_ta_signed; | ||||
|     /* Raw Public Key */ | ||||
|     EVP_PKEY *rpk; | ||||
|  | ||||
|     OSSL_LIB_CTX *libctx; | ||||
|     char *propq; | ||||
| @@ -309,7 +311,7 @@ struct x509_object_st { | ||||
| }; | ||||
|  | ||||
| int ossl_a2i_ipadd(unsigned char *ipout, const char *ipasc); | ||||
| int ossl_x509_set1_time(ASN1_TIME **ptm, const ASN1_TIME *tm); | ||||
| int ossl_x509_set1_time(int *modified, ASN1_TIME **ptm, const ASN1_TIME *tm); | ||||
| int ossl_x509_print_ex_brief(BIO *bio, X509 *cert, unsigned long neg_cflags); | ||||
| int ossl_x509v3_cache_extensions(X509 *x); | ||||
| int ossl_x509_init_sig_info(X509 *x); | ||||
| @@ -334,7 +336,8 @@ int ossl_x509_PUBKEY_get0_libctx(OSSL_LIB_CTX **plibctx, const char **ppropq, | ||||
| ASN1_OCTET_STRING *ossl_x509_pubkey_hash(X509_PUBKEY *pubkey); | ||||
|  | ||||
| X509_PUBKEY *ossl_d2i_X509_PUBKEY_INTERNAL(const unsigned char **pp, | ||||
|                                            long len, OSSL_LIB_CTX *libctx); | ||||
|                                            long len, OSSL_LIB_CTX *libctx, | ||||
|                                            const char *propq); | ||||
| void ossl_X509_PUBKEY_INTERNAL_free(X509_PUBKEY *xpub); | ||||
|  | ||||
| RSA *ossl_d2i_RSA_PSS_PUBKEY(RSA **a, const unsigned char **pp, long length); | ||||
| @@ -364,6 +367,7 @@ int ossl_i2d_X448_PUBKEY(const ECX_KEY *a, unsigned char **pp); | ||||
| # endif /* OPENSSL_NO_EC */ | ||||
| EVP_PKEY *ossl_d2i_PUBKEY_legacy(EVP_PKEY **a, const unsigned char **pp, | ||||
|                                  long length); | ||||
| int ossl_x509_check_private_key(const EVP_PKEY *k, const EVP_PKEY *pkey); | ||||
|  | ||||
| int x509v3_add_len_value_uchar(const char *name, const unsigned char *value, | ||||
|                                size_t vallen, STACK_OF(CONF_VALUE) **extlist); | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| /* | ||||
|  * Generated by util/mkerr.pl DO NOT EDIT | ||||
|  * Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved. | ||||
|  * Copyright 2020-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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user