Latest update.

This commit is contained in:
2019-10-17 23:54:38 +09:00
parent 41a23ae6f6
commit ee84d0dd84
1357 changed files with 41111 additions and 9603 deletions
@@ -0,0 +1,116 @@
/*
* Copyright 2019 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
*/
/* TODO(3.0) Move this header into provider when dependencies are removed */
#ifndef OSSL_PROVIDERS_DEFAULT_INCLUDE_INTERNAL_BLAKE2_H
# define OSSL_PROVIDERS_DEFAULT_INCLUDE_INTERNAL_BLAKE2_H
# include <openssl/opensslconf.h>
# include <openssl/e_os2.h>
# include <stddef.h>
# define BLAKE2S_BLOCKBYTES 64
# define BLAKE2S_OUTBYTES 32
# define BLAKE2S_KEYBYTES 32
# define BLAKE2S_SALTBYTES 8
# define BLAKE2S_PERSONALBYTES 8
# define BLAKE2B_BLOCKBYTES 128
# define BLAKE2B_OUTBYTES 64
# define BLAKE2B_KEYBYTES 64
# define BLAKE2B_SALTBYTES 16
# define BLAKE2B_PERSONALBYTES 16
struct blake2s_param_st {
uint8_t digest_length; /* 1 */
uint8_t key_length; /* 2 */
uint8_t fanout; /* 3 */
uint8_t depth; /* 4 */
uint8_t leaf_length[4];/* 8 */
uint8_t node_offset[6];/* 14 */
uint8_t node_depth; /* 15 */
uint8_t inner_length; /* 16 */
uint8_t salt[BLAKE2S_SALTBYTES]; /* 24 */
uint8_t personal[BLAKE2S_PERSONALBYTES]; /* 32 */
};
typedef struct blake2s_param_st BLAKE2S_PARAM;
struct blake2s_ctx_st {
uint32_t h[8];
uint32_t t[2];
uint32_t f[2];
uint8_t buf[BLAKE2S_BLOCKBYTES];
size_t buflen;
size_t outlen;
};
struct blake2b_param_st {
uint8_t digest_length; /* 1 */
uint8_t key_length; /* 2 */
uint8_t fanout; /* 3 */
uint8_t depth; /* 4 */
uint8_t leaf_length[4];/* 8 */
uint8_t node_offset[8];/* 16 */
uint8_t node_depth; /* 17 */
uint8_t inner_length; /* 18 */
uint8_t reserved[14]; /* 32 */
uint8_t salt[BLAKE2B_SALTBYTES]; /* 48 */
uint8_t personal[BLAKE2B_PERSONALBYTES]; /* 64 */
};
typedef struct blake2b_param_st BLAKE2B_PARAM;
struct blake2b_ctx_st {
uint64_t h[8];
uint64_t t[2];
uint64_t f[2];
uint8_t buf[BLAKE2B_BLOCKBYTES];
size_t buflen;
size_t outlen;
};
#define BLAKE2B_DIGEST_LENGTH 64
#define BLAKE2S_DIGEST_LENGTH 32
typedef struct blake2s_ctx_st BLAKE2S_CTX;
typedef struct blake2b_ctx_st BLAKE2B_CTX;
int blake2s256_init(void *ctx);
int blake2b512_init(void *ctx);
int blake2b_init(BLAKE2B_CTX *c, const BLAKE2B_PARAM *P);
int blake2b_init_key(BLAKE2B_CTX *c, const BLAKE2B_PARAM *P, const void *key);
int blake2b_update(BLAKE2B_CTX *c, const void *data, size_t datalen);
int blake2b_final(unsigned char *md, BLAKE2B_CTX *c);
/*
* These setters are internal and do not check the validity of their parameters.
* See blake2b_mac_ctrl for validation logic.
*/
void blake2b_param_init(BLAKE2B_PARAM *P);
void blake2b_param_set_digest_length(BLAKE2B_PARAM *P, uint8_t outlen);
void blake2b_param_set_key_length(BLAKE2B_PARAM *P, uint8_t keylen);
void blake2b_param_set_personal(BLAKE2B_PARAM *P, const uint8_t *personal, size_t length);
void blake2b_param_set_salt(BLAKE2B_PARAM *P, const uint8_t *salt, size_t length);
int blake2s_init(BLAKE2S_CTX *c, const BLAKE2S_PARAM *P);
int blake2s_init_key(BLAKE2S_CTX *c, const BLAKE2S_PARAM *P, const void *key);
int blake2s_update(BLAKE2S_CTX *c, const void *data, size_t datalen);
int blake2s_final(unsigned char *md, BLAKE2S_CTX *c);
void blake2s_param_init(BLAKE2S_PARAM *P);
void blake2s_param_set_digest_length(BLAKE2S_PARAM *P, uint8_t outlen);
void blake2s_param_set_key_length(BLAKE2S_PARAM *P, uint8_t keylen);
void blake2s_param_set_personal(BLAKE2S_PARAM *P, const uint8_t *personal, size_t length);
void blake2s_param_set_salt(BLAKE2S_PARAM *P, const uint8_t *salt, size_t length);
#endif /* OSSL_PROVIDERS_DEFAULT_INCLUDE_INTERNAL_BLAKE2_H */
@@ -0,0 +1,249 @@
/*
* Copyright 2019 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
*/
/* Digests */
extern const OSSL_DISPATCH sha1_functions[];
extern const OSSL_DISPATCH sha224_functions[];
extern const OSSL_DISPATCH sha256_functions[];
extern const OSSL_DISPATCH sha384_functions[];
extern const OSSL_DISPATCH sha512_functions[];
extern const OSSL_DISPATCH sha512_224_functions[];
extern const OSSL_DISPATCH sha512_256_functions[];
extern const OSSL_DISPATCH sha3_224_functions[];
extern const OSSL_DISPATCH sha3_256_functions[];
extern const OSSL_DISPATCH sha3_384_functions[];
extern const OSSL_DISPATCH sha3_512_functions[];
extern const OSSL_DISPATCH keccak_kmac_128_functions[];
extern const OSSL_DISPATCH keccak_kmac_256_functions[];
extern const OSSL_DISPATCH shake_128_functions[];
extern const OSSL_DISPATCH shake_256_functions[];
extern const OSSL_DISPATCH blake2s256_functions[];
extern const OSSL_DISPATCH blake2b512_functions[];
extern const OSSL_DISPATCH md5_functions[];
extern const OSSL_DISPATCH md5_sha1_functions[];
extern const OSSL_DISPATCH sm3_functions[];
extern const OSSL_DISPATCH md2_functions[];
extern const OSSL_DISPATCH md4_functions[];
extern const OSSL_DISPATCH mdc2_functions[];
extern const OSSL_DISPATCH wp_functions[];
extern const OSSL_DISPATCH ripemd160_functions[];
/* Ciphers */
extern const OSSL_DISPATCH aes256ecb_functions[];
extern const OSSL_DISPATCH aes192ecb_functions[];
extern const OSSL_DISPATCH aes128ecb_functions[];
extern const OSSL_DISPATCH aes256cbc_functions[];
extern const OSSL_DISPATCH aes192cbc_functions[];
extern const OSSL_DISPATCH aes128cbc_functions[];
extern const OSSL_DISPATCH aes256ofb_functions[];
extern const OSSL_DISPATCH aes192ofb_functions[];
extern const OSSL_DISPATCH aes128ofb_functions[];
extern const OSSL_DISPATCH aes256cfb_functions[];
extern const OSSL_DISPATCH aes192cfb_functions[];
extern const OSSL_DISPATCH aes128cfb_functions[];
extern const OSSL_DISPATCH aes256cfb1_functions[];
extern const OSSL_DISPATCH aes192cfb1_functions[];
extern const OSSL_DISPATCH aes128cfb1_functions[];
extern const OSSL_DISPATCH aes256cfb8_functions[];
extern const OSSL_DISPATCH aes192cfb8_functions[];
extern const OSSL_DISPATCH aes128cfb8_functions[];
extern const OSSL_DISPATCH aes256ctr_functions[];
extern const OSSL_DISPATCH aes192ctr_functions[];
extern const OSSL_DISPATCH aes128ctr_functions[];
extern const OSSL_DISPATCH aes256xts_functions[];
extern const OSSL_DISPATCH aes128xts_functions[];
#ifndef OPENSSL_NO_OCB
extern const OSSL_DISPATCH aes256ocb_functions[];
extern const OSSL_DISPATCH aes192ocb_functions[];
extern const OSSL_DISPATCH aes128ocb_functions[];
#endif /* OPENSSL_NO_OCB */
extern const OSSL_DISPATCH aes256gcm_functions[];
extern const OSSL_DISPATCH aes192gcm_functions[];
extern const OSSL_DISPATCH aes128gcm_functions[];
extern const OSSL_DISPATCH aes256ccm_functions[];
extern const OSSL_DISPATCH aes192ccm_functions[];
extern const OSSL_DISPATCH aes128ccm_functions[];
extern const OSSL_DISPATCH aes256wrap_functions[];
extern const OSSL_DISPATCH aes192wrap_functions[];
extern const OSSL_DISPATCH aes128wrap_functions[];
extern const OSSL_DISPATCH aes256wrappad_functions[];
extern const OSSL_DISPATCH aes192wrappad_functions[];
extern const OSSL_DISPATCH aes128wrappad_functions[];
#ifndef OPENSSL_NO_ARIA
extern const OSSL_DISPATCH aria256gcm_functions[];
extern const OSSL_DISPATCH aria192gcm_functions[];
extern const OSSL_DISPATCH aria128gcm_functions[];
extern const OSSL_DISPATCH aria256ccm_functions[];
extern const OSSL_DISPATCH aria192ccm_functions[];
extern const OSSL_DISPATCH aria128ccm_functions[];
extern const OSSL_DISPATCH aria256ecb_functions[];
extern const OSSL_DISPATCH aria192ecb_functions[];
extern const OSSL_DISPATCH aria128ecb_functions[];
extern const OSSL_DISPATCH aria256cbc_functions[];
extern const OSSL_DISPATCH aria192cbc_functions[];
extern const OSSL_DISPATCH aria128cbc_functions[];
extern const OSSL_DISPATCH aria256ofb_functions[];
extern const OSSL_DISPATCH aria192ofb_functions[];
extern const OSSL_DISPATCH aria128ofb_functions[];
extern const OSSL_DISPATCH aria256cfb_functions[];
extern const OSSL_DISPATCH aria192cfb_functions[];
extern const OSSL_DISPATCH aria128cfb_functions[];
extern const OSSL_DISPATCH aria256cfb1_functions[];
extern const OSSL_DISPATCH aria192cfb1_functions[];
extern const OSSL_DISPATCH aria128cfb1_functions[];
extern const OSSL_DISPATCH aria256cfb8_functions[];
extern const OSSL_DISPATCH aria192cfb8_functions[];
extern const OSSL_DISPATCH aria128cfb8_functions[];
extern const OSSL_DISPATCH aria256ctr_functions[];
extern const OSSL_DISPATCH aria192ctr_functions[];
extern const OSSL_DISPATCH aria128ctr_functions[];
#endif /* OPENSSL_NO_ARIA */
#ifndef OPENSSL_NO_CAMELLIA
extern const OSSL_DISPATCH camellia256ecb_functions[];
extern const OSSL_DISPATCH camellia192ecb_functions[];
extern const OSSL_DISPATCH camellia128ecb_functions[];
extern const OSSL_DISPATCH camellia256cbc_functions[];
extern const OSSL_DISPATCH camellia192cbc_functions[];
extern const OSSL_DISPATCH camellia128cbc_functions[];
extern const OSSL_DISPATCH camellia256ofb_functions[];
extern const OSSL_DISPATCH camellia192ofb_functions[];
extern const OSSL_DISPATCH camellia128ofb_functions[];
extern const OSSL_DISPATCH camellia256cfb_functions[];
extern const OSSL_DISPATCH camellia192cfb_functions[];
extern const OSSL_DISPATCH camellia128cfb_functions[];
extern const OSSL_DISPATCH camellia256cfb1_functions[];
extern const OSSL_DISPATCH camellia192cfb1_functions[];
extern const OSSL_DISPATCH camellia128cfb1_functions[];
extern const OSSL_DISPATCH camellia256cfb8_functions[];
extern const OSSL_DISPATCH camellia192cfb8_functions[];
extern const OSSL_DISPATCH camellia128cfb8_functions[];
extern const OSSL_DISPATCH camellia256ctr_functions[];
extern const OSSL_DISPATCH camellia192ctr_functions[];
extern const OSSL_DISPATCH camellia128ctr_functions[];
#endif /* OPENSSL_NO_CAMELLIA */
#ifndef OPENSSL_NO_BF
extern const OSSL_DISPATCH blowfish128ecb_functions[];
extern const OSSL_DISPATCH blowfish128cbc_functions[];
extern const OSSL_DISPATCH blowfish64ofb64_functions[];
extern const OSSL_DISPATCH blowfish64cfb64_functions[];
#endif /* OPENSSL_NO_BF */
#ifndef OPENSSL_NO_IDEA
extern const OSSL_DISPATCH idea128ecb_functions[];
extern const OSSL_DISPATCH idea128cbc_functions[];
extern const OSSL_DISPATCH idea128ofb64_functions[];
extern const OSSL_DISPATCH idea128cfb64_functions[];
#endif /* OPENSSL_NO_IDEA */
#ifndef OPENSSL_NO_CAST
extern const OSSL_DISPATCH cast5128ecb_functions[];
extern const OSSL_DISPATCH cast5128cbc_functions[];
extern const OSSL_DISPATCH cast564ofb64_functions[];
extern const OSSL_DISPATCH cast564cfb64_functions[];
#endif /* OPENSSL_NO_CAST */
#ifndef OPENSSL_NO_SEED
extern const OSSL_DISPATCH seed128ecb_functions[];
extern const OSSL_DISPATCH seed128cbc_functions[];
extern const OSSL_DISPATCH seed128ofb128_functions[];
extern const OSSL_DISPATCH seed128cfb128_functions[];
#endif /* OPENSSL_NO_SEED */
#ifndef OPENSSL_NO_SM4
extern const OSSL_DISPATCH sm4128ecb_functions[];
extern const OSSL_DISPATCH sm4128cbc_functions[];
extern const OSSL_DISPATCH sm4128ctr_functions[];
extern const OSSL_DISPATCH sm4128ofb128_functions[];
extern const OSSL_DISPATCH sm4128cfb128_functions[];
#endif /* OPENSSL_NO_SM4 */
#ifndef OPENSSL_NO_RC5
extern const OSSL_DISPATCH rc5128ecb_functions[];
extern const OSSL_DISPATCH rc5128cbc_functions[];
extern const OSSL_DISPATCH rc5128ofb64_functions[];
extern const OSSL_DISPATCH rc5128cfb64_functions[];
#endif /* OPENSSL_NO_RC5 */
#ifndef OPENSSL_NO_RC2
extern const OSSL_DISPATCH rc2128ecb_functions[];
extern const OSSL_DISPATCH rc2128cbc_functions[];
extern const OSSL_DISPATCH rc240cbc_functions[];
extern const OSSL_DISPATCH rc264cbc_functions[];
extern const OSSL_DISPATCH rc2128cfb128_functions[];
extern const OSSL_DISPATCH rc2128ofb128_functions[];
#endif /* OPENSSL_NO_RC2 */
#ifndef OPENSSL_NO_DES
extern const OSSL_DISPATCH tdes_ede3_ecb_functions[];
extern const OSSL_DISPATCH tdes_ede3_cbc_functions[];
# ifndef FIPS_MODE
extern const OSSL_DISPATCH tdes_ede3_ofb_functions[];
extern const OSSL_DISPATCH tdes_ede3_cfb_functions[];
extern const OSSL_DISPATCH tdes_ede3_cfb8_functions[];
extern const OSSL_DISPATCH tdes_ede3_cfb1_functions[];
extern const OSSL_DISPATCH tdes_ede2_ecb_functions[];
extern const OSSL_DISPATCH tdes_ede2_cbc_functions[];
extern const OSSL_DISPATCH tdes_ede2_ofb_functions[];
extern const OSSL_DISPATCH tdes_ede2_cfb_functions[];
extern const OSSL_DISPATCH tdes_desx_cbc_functions[];
extern const OSSL_DISPATCH tdes_wrap_cbc_functions[];
extern const OSSL_DISPATCH des_ecb_functions[];
extern const OSSL_DISPATCH des_cbc_functions[];
extern const OSSL_DISPATCH des_ofb64_functions[];
extern const OSSL_DISPATCH des_cfb64_functions[];
extern const OSSL_DISPATCH des_cfb1_functions[];
extern const OSSL_DISPATCH des_cfb8_functions[];
# endif /* FIPS_MODE */
#endif /* OPENSSL_NO_DES */
#ifndef OPENSSL_NO_RC4
extern const OSSL_DISPATCH rc440_functions[];
extern const OSSL_DISPATCH rc4128_functions[];
#endif /* OPENSSL_NO_RC4 */
#ifndef OPENSSL_NO_CHACHA
extern const OSSL_DISPATCH chacha20_functions[];
# ifndef OPENSSL_NO_POLY1305
extern const OSSL_DISPATCH chacha20_poly1305_functions[];
# endif /* OPENSSL_NO_POLY1305 */
#endif /* OPENSSL_NO_CHACHA */
/* MACs */
extern const OSSL_DISPATCH blake2bmac_functions[];
extern const OSSL_DISPATCH blake2smac_functions[];
extern const OSSL_DISPATCH cmac_functions[];
extern const OSSL_DISPATCH gmac_functions[];
extern const OSSL_DISPATCH hmac_functions[];
extern const OSSL_DISPATCH kmac128_functions[];
extern const OSSL_DISPATCH kmac256_functions[];
extern const OSSL_DISPATCH siphash_functions[];
extern const OSSL_DISPATCH poly1305_functions[];
/* KDFs / PRFs */
extern const OSSL_DISPATCH kdf_pbkdf2_functions[];
#ifndef OPENSSL_NO_SCRYPT
extern const OSSL_DISPATCH kdf_scrypt_functions[];
#endif
extern const OSSL_DISPATCH kdf_tls1_prf_functions[];
extern const OSSL_DISPATCH kdf_hkdf_functions[];
extern const OSSL_DISPATCH kdf_sshkdf_functions[];
extern const OSSL_DISPATCH kdf_sskdf_functions[];
extern const OSSL_DISPATCH kdf_x963_kdf_functions[];
extern const OSSL_DISPATCH kdf_kbkdf_functions[];
#ifndef OPENSSL_NO_CMS
extern const OSSL_DISPATCH kdf_x942_kdf_functions[];
#endif
/* Key management */
extern const OSSL_DISPATCH dh_keymgmt_functions[];
extern const OSSL_DISPATCH dsa_keymgmt_functions[];
/* Key Exchange */
extern const OSSL_DISPATCH dh_keyexch_functions[];
/* Signature */
extern const OSSL_DISPATCH dsa_signature_functions[];
@@ -0,0 +1,37 @@
/*
* Copyright 1995-2019 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
*/
/* TODO(3.0) Move this header into provider when dependencies are removed */
#ifndef OSSL_INTERNAL_MD5_SHA1_H
# define OSSL_INTERNAL_MD5_SHA1_H
# include <openssl/opensslconf.h>
# ifndef OPENSSL_NO_MD5
# include <openssl/e_os2.h>
# include <stddef.h>
# include <openssl/md5.h>
# include <openssl/sha.h>
# define MD5_SHA1_DIGEST_LENGTH (MD5_DIGEST_LENGTH + SHA_DIGEST_LENGTH)
# define MD5_SHA1_CBLOCK MD5_CBLOCK
typedef struct md5_sha1_st {
MD5_CTX md5;
SHA_CTX sha1;
} MD5_SHA1_CTX;
int md5_sha1_init(MD5_SHA1_CTX *mctx);
int md5_sha1_update(MD5_SHA1_CTX *mctx, const void *data, size_t count);
int md5_sha1_final(unsigned char *md, MD5_SHA1_CTX *mctx);
int md5_sha1_ctrl(MD5_SHA1_CTX *mctx, int cmd, int mslen, void *ms);
# endif /* OPENSSL_NO_MD5 */
#endif /* OSSL_INTERNAL_MD5_SHA1_H */