RELATIVE_DIRECTORY=. AR=ar r BASENAME=SSLeay BF_ENC=bf_enc.o BN_MULW=bn_mulw.o CC=cc CFLAG=-O -DNOPROTO DES_ENC=des_enc.o fcrypt_b.o DIRS=crypto ssl rsaref apps test tools EDIRS=times doc bugs util include certs ms shlib mt demos EX_HEADER= EX_LIBS= GENERAL=Makefile HEADER=e_os.h INSTALLTOP=/usr/local/ssl LIBS=libcrypto.a libssl.a MAKE=make -f Makefile.ssl MAKEFILE=Makefile.ssl MAN1=1 MAN3=3 MISC=COPYRIGHT Configure HISTORY.066 INSTALL Makefile.ssl Makefile README TODO HISTORY README.066 README.080 VERSION PROBLEMS MINFO makefile.one e_os.h MICROSOFT makevms.com NAME=SSLeay-0.8.1 ONEDIRS=out tmp PEX_LIBS=-L. -L.. -L../.. -L../../.. SDIRS=md sha mdc2 des rc4 rc2 idea bf bn rsa dsa dh buffer bio stack lhash rand err objects evp pem asn1 x509 conf txt_db pkcs7 SHELL=/bin/sh TARFILE=SSLeay-0.8.1.tar TOP=. VERSION=0.8.1 WDIRS=windows WTARFILE=SSLeay-0.8.1-win.tar RELATIVE_DIRECTORY= RELATIVE_DIRECTORY=crypto ALL=Makefile README cryptlib.c mem.c cversion.c cryptlib.h date.h crypto.h cryptall.h AR=ar r CC=cc CFLAG=-g CFLAGS=-I. -I../include -g -DCFLAGS=" \"cc -g\" " DIR=crypto EXHEADER=crypto.h cryptall.h EX_LIBS= GENERAL=Makefile README HEADER=cryptlib.h date.h crypto.h cryptall.h INCLUDE=-I. -I../include INCLUDES=-I.. -I../../include INSTALLTOP=/usr/local/ssl LIB=../libcrypto.a LIBOBJ=cryptlib.o mem.o cversion.o LIBS= LIBSRC=cryptlib.c mem.c cversion.c MAKE=make -f Makefile.ssl MAKEDEPEND=makedepend -f Makefile.ssl MAKEFILE=Makefile.ssl PEX_LIBS= RM=/bin/rm -f SDIRS=md sha mdc2 des rc4 rc2 idea bf bn rsa dsa dh buffer bio stack lhash rand err objects evp pem x509 asn1 conf txt_db pkcs7 SRC=cryptlib.c mem.c cversion.c TOP=.. RELATIVE_DIRECTORY= RELATIVE_DIRECTORY=crypto/md ALL=Makefile md2_dgst.c md5_dgst.c md2_one.c md5_one.c md5_locl.h md2.h md5.h APPS= AR=ar r CC=cc CFLAG=-g CFLAGS= -g DIR=md EXHEADER=md2.h md5.h GENERAL=Makefile HEADER=md5_locl.h md2.h md5.h INCLUDES= INSTALLTOP=/usr/local/ssl LIB=../../libcrypto.a LIBOBJ=md2_dgst.o md5_dgst.o md2_one.o md5_one.o LIBSRC=md2_dgst.c md5_dgst.c md2_one.c md5_one.c MAKE=make -f Makefile.ssl MAKEDEPEND=makedepend -f Makefile.ssl MAKEFILE=Makefile.ssl SRC=md2_dgst.c md5_dgst.c md2_one.c md5_one.c TEST=md2test.c md5test.c TOP=../.. RELATIVE_DIRECTORY= RELATIVE_DIRECTORY=crypto/sha ALL=Makefile sha_dgst.c sha1dgst.c sha_one.c sha1_one.c sha_locl.h sha.h APPS= AR=ar r CC=cc CFLAG=-g CFLAGS= -g DIR=sha EXHEADER=sha.h GENERAL=Makefile HEADER=sha_locl.h sha.h INCLUDES= INSTALLTOP=/usr/local/ssl LIB=../../libcrypto.a LIBOBJ=sha_dgst.o sha1dgst.o sha_one.o sha1_one.o LIBSRC=sha_dgst.c sha1dgst.c sha_one.c sha1_one.c MAKE=make -f Makefile.ssl MAKEDEPEND=makedepend -f Makefile.ssl MAKEFILE=Makefile.ssl SRC=sha_dgst.c sha1dgst.c sha_one.c sha1_one.c TEST=shatest.c sha1test.c TOP=../.. RELATIVE_DIRECTORY= RELATIVE_DIRECTORY=crypto/mdc2 ALL=Makefile mdc2dgst.c mdc2_one.c mdc2.h APPS= AR=ar r CC=cc CFLAG=-g CFLAGS= -g DIR=mdc2 EXHEADER=mdc2.h GENERAL=Makefile HEADER=mdc2.h INCLUDES= INSTALLTOP=/usr/local/ssl LIB=../../libcrypto.a LIBOBJ=mdc2dgst.o mdc2_one.o LIBSRC=mdc2dgst.c mdc2_one.c MAKE=make -f Makefile.ssl MAKEDEPEND=makedepend -f Makefile.ssl MAKEFILE=Makefile.ssl SRC=mdc2dgst.c mdc2_one.c TEST=mdc2test.c TOP=../.. RELATIVE_DIRECTORY= RELATIVE_DIRECTORY=crypto/des ALL=Makefile des.org des_locl.org cbc3_enc.c cbc_cksm.c cbc_enc.c cfb64enc.c cfb_enc.c ecb3_enc.c ecb_enc.c ede_enc.c enc_read.c enc_writ.c fcrypt.c ncbc_enc.c ofb64enc.c ofb_enc.c pcbc_enc.c qud_cksm.c rand_key.c read_pwd.c rpc_enc.c set_key.c des_enc.c fcrypt_b.c read2pwd.c fcrypt.c xcbc_enc.c str2key.c cfb64ede.c ofb64ede.c supp.c des_locl.h rpc_des.h podd.h sk.h spr.h des_ver.h des.h APPS= AR=ar r CC=cc CFLAG=-g CFLAGS= -g CPP=cc -E DES_ENC=des_enc.o fcrypt_b.o DIR=des EXHEADER=des.h GENERAL=Makefile des.org des_locl.org HEADER=des_locl.h rpc_des.h podd.h sk.h spr.h des_ver.h des.h INCLUDES= INSTALLTOP=/usr/local/ssl LIB=../../libcrypto.a LIBOBJ=set_key.o ecb_enc.o ede_enc.o cbc_enc.o cbc3_enc.o ecb3_enc.o cfb64enc.o cfb64ede.o cfb_enc.o ofb64ede.o enc_read.o enc_writ.o ncbc_enc.o ofb64enc.o ofb_enc.o str2key.o pcbc_enc.o qud_cksm.o rand_key.o des_enc.o fcrypt_b.o read2pwd.o fcrypt.o xcbc_enc.o read_pwd.o rpc_enc.o cbc_cksm.o supp.o LIBSRC=cbc3_enc.c cbc_cksm.c cbc_enc.c cfb64enc.c cfb_enc.c ecb3_enc.c ecb_enc.c ede_enc.c enc_read.c enc_writ.c fcrypt.c ncbc_enc.c ofb64enc.c ofb_enc.c pcbc_enc.c qud_cksm.c rand_key.c read_pwd.c rpc_enc.c set_key.c des_enc.c fcrypt_b.c read2pwd.c fcrypt.c xcbc_enc.c str2key.c cfb64ede.c ofb64ede.c supp.c MAKE=make -f Makefile.ssl MAKEDEPEND=makedepend -f Makefile.ssl MAKEFILE=Makefile.ssl SRC=cbc3_enc.c cbc_cksm.c cbc_enc.c cfb64enc.c cfb_enc.c ecb3_enc.c ecb_enc.c ede_enc.c enc_read.c enc_writ.c fcrypt.c ncbc_enc.c ofb64enc.c ofb_enc.c pcbc_enc.c qud_cksm.c rand_key.c read_pwd.c rpc_enc.c set_key.c des_enc.c fcrypt_b.c read2pwd.c fcrypt.c xcbc_enc.c str2key.c cfb64ede.c ofb64ede.c supp.c TEST=destest.c TOP=../.. RELATIVE_DIRECTORY= RELATIVE_DIRECTORY=crypto/rc4 ALL=Makefile rc4_enc.c rc4.h APPS= AR=ar r CC=cc CFLAG=-g CFLAGS= -g DIR=rc4 EXHEADER=rc4.h GENERAL=Makefile HEADER=rc4.h INCLUDES= INSTALLTOP=/usr/local/ssl LIB=../../libcrypto.a LIBOBJ=rc4_enc.o LIBSRC=rc4_enc.c MAKE=make -f Makefile.ssl MAKEDEPEND=makedepend -f Makefile.ssl MAKEFILE=Makefile.ssl SRC=rc4_enc.c TEST=rc4test.c TOP=../.. RELATIVE_DIRECTORY= RELATIVE_DIRECTORY=crypto/rc2 ALL=Makefile rc2_ecb.c rc2_skey.c rc2_cbc.c rc2cfb64.c rc2ofb64.c rc2_locl.h rc2.h APPS= AR=ar r CC=cc CFLAG=-g CFLAGS= -g DIR=rc2 EXHEADER=rc2.h GENERAL=Makefile HEADER=rc2_locl.h rc2.h INCLUDES= INSTALLTOP=/usr/local/ssl LIB=../../libcrypto.a LIBOBJ=rc2_ecb.o rc2_skey.o rc2_cbc.o rc2cfb64.o rc2ofb64.o LIBSRC=rc2_ecb.c rc2_skey.c rc2_cbc.c rc2cfb64.c rc2ofb64.c MAKE=make -f Makefile.ssl MAKEDEPEND=makedepend -f Makefile.ssl MAKEFILE=Makefile.ssl SRC=rc2_ecb.c rc2_skey.c rc2_cbc.c rc2cfb64.c rc2ofb64.c TEST=rc2test.c TOP=../.. RELATIVE_DIRECTORY= RELATIVE_DIRECTORY=crypto/idea ALL=Makefile i_cbc.c i_cfb64.c i_ofb64.c i_ecb.c i_skey.c idea_lcl.h idea.h APPS= AR=ar r CC=cc CFLAG=-g CFLAGS= -g DIR=idea EXHEADER=idea.h GENERAL=Makefile HEADER=idea_lcl.h idea.h INCLUDES= INSTALLTOP=/usr/local/ssl LIB=../../libcrypto.a LIBOBJ=i_cbc.o i_cfb64.o i_ofb64.o i_ecb.o i_skey.o LIBSRC=i_cbc.c i_cfb64.c i_ofb64.c i_ecb.c i_skey.c MAKE=make -f Makefile.ssl MAKEDEPEND=makedepend -f Makefile.ssl MAKEFILE=Makefile.ssl SRC=i_cbc.c i_cfb64.c i_ofb64.c i_ecb.c i_skey.c TEST=ideatest.c TOP=../.. RELATIVE_DIRECTORY= RELATIVE_DIRECTORY=crypto/bf ALL=Makefile bf_skey.c bf_ecb.c bf_enc.c bf_cbc.c bf_cfb64.c bf_ofb64.c bf_pi.h bf_locl.h blowfish.h APPS= AR=ar r BF_ENC=bf_enc.o CC=cc CFLAG=-g CFLAGS= -g CPP=cc -E DIR=bf EXHEADER=blowfish.h GENERAL=Makefile HEADER=bf_pi.h bf_locl.h blowfish.h INCLUDES= INSTALLTOP=/usr/local/ssl LIB=../../libcrypto.a LIBOBJ=bf_skey.o bf_ecb.o bf_enc.o bf_cbc.o bf_cfb64.o bf_ofb64.o LIBSRC=bf_skey.c bf_ecb.c bf_enc.c bf_cbc.c bf_cfb64.c bf_ofb64.c MAKE=make -f Makefile.ssl MAKEDEPEND=makedepend -f Makefile.ssl MAKEFILE=Makefile.ssl SRC=bf_skey.c bf_ecb.c bf_enc.c bf_cbc.c bf_cfb64.c bf_ofb64.c TEST=bftest.c TOP=../.. RELATIVE_DIRECTORY= RELATIVE_DIRECTORY=crypto/bn ALL=Makefile bn_add.c bn_div.c bn_exp.c bn_lib.c bn_mod.c bn_mul.c bn_print.c bn_rand.c bn_shift.c bn_sub.c bn_word.c bn_gcd.c bn_prime.c bn_err.c bn_sqr.c bn_mulw.c bn_recp.c bn_mont.c bn_lcl.h bn_prime.h bn.h APPS= AR=ar r BN_MULW=bn_mulw.o CC=cc CFLAG=-g CFLAGS=-I.. -I../../include -g DIR=bn ERR=bn ERRC=bn_err EXHEADER=bn.h GENERAL=Makefile HEADER=bn_lcl.h bn_prime.h bn.h INCLUDES=-I.. -I../../include INSTALLTOP=/usr/local/ssl LIB=../../libcrypto.a LIBOBJ=bn_add.o bn_div.o bn_exp.o bn_lib.o bn_mod.o bn_mul.o bn_print.o bn_rand.o bn_shift.o bn_sub.o bn_word.o bn_gcd.o bn_prime.o bn_err.o bn_sqr.o bn_mulw.o bn_recp.o bn_mont.o LIBSRC=bn_add.c bn_div.c bn_exp.c bn_lib.c bn_mod.c bn_mul.c bn_print.c bn_rand.c bn_shift.c bn_sub.c bn_word.c bn_gcd.c bn_prime.c bn_err.c bn_sqr.c bn_mulw.c bn_recp.c bn_mont.c MAKE=make -f Makefile.ssl MAKEDEPEND=makedepend -f Makefile.ssl MAKEFILE=Makefile.ssl SRC=bn_add.c bn_div.c bn_exp.c bn_lib.c bn_mod.c bn_mul.c bn_print.c bn_rand.c bn_shift.c bn_sub.c bn_word.c bn_gcd.c bn_prime.c bn_err.c bn_sqr.c bn_mulw.c bn_recp.c bn_mont.c TEST=bntest.c exptest.c TOP=../.. RELATIVE_DIRECTORY= RELATIVE_DIRECTORY=crypto/rsa ALL=Makefile rsa_enc.c rsa_gen.c rsa_lib.c rsa_sign.c rsa_saos.c rsa_err.c rsa.h APPS= AR=ar r CC=cc CFLAG=-g CFLAGS=-I.. -I../../include -g DIR=rsa ERR=rsa ERRC=rsa_err EXHEADER=rsa.h GENERAL=Makefile HEADER=rsa.h INCLUDES=-I.. -I../../include INSTALLTOP=/usr/local/ssl LIB=../../libcrypto.a LIBOBJ=rsa_enc.o rsa_gen.o rsa_lib.o rsa_sign.o rsa_saos.
// SPDX-License-Identifier: GPL-2.0 OR MIT
/*
* Copyright (C) 2015-2019 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
*/
#include <crypto/internal/blake2s.h>
#include <crypto/internal/simd.h>
#include <crypto/internal/hash.h>
#include <linux/types.h>
#include <linux/jump_label.h>
#include <linux/kernel.h>
#include <linux/module.h>
static int crypto_blake2s_setkey(struct crypto_shash *tfm, const u8 *key,
unsigned int keylen)
{
struct blake2s_tfm_ctx *tctx = crypto_shash_ctx(tfm);
if (keylen == 0 || keylen > BLAKE2S_KEY_SIZE)
return -EINVAL;
memcpy(tctx->key, key, keylen);
tctx->keylen = keylen;
return 0;
}
static int crypto_blake2s_init(struct shash_desc *desc)
{
struct blake2s_tfm_ctx *tctx = crypto_shash_ctx(desc->tfm);
struct blake2s_state *state = shash_desc_ctx(desc);
const int outlen = crypto_shash_digestsize(desc->tfm);
if (tctx->keylen)
blake2s_init_key(state, outlen, tctx->key, tctx->keylen);
else
blake2s_init(state, outlen);
return 0;
}
static int crypto_blake2s_update(struct shash_desc *desc, const u8 *in,
unsigned int inlen)
{
struct blake2s_state *state = shash_desc_ctx(desc);
const size_t fill = BLAKE2S_BLOCK_SIZE - state->buflen;
if (unlikely(!inlen))
return 0;
if (inlen > fill) {
memcpy(state->buf + state->buflen, in, fill);
blake2s_compress_generic(state, state->buf, 1, BLAKE2S_BLOCK_SIZE);
state->buflen = 0;
in += fill;
inlen -= fill;
}
if (inlen > BLAKE2S_BLOCK_SIZE) {
const size_t nblocks = DIV_ROUND_UP(inlen, BLAKE2S_BLOCK_SIZE);
/* Hash one less (full) block than strictly possible */
blake2s_compress_generic(state, in, nblocks - 1, BLAKE2S_BLOCK_SIZE);
in += BLAKE2S_BLOCK_SIZE * (nblocks - 1);
inlen -= BLAKE2S_BLOCK_SIZE * (nblocks - 1);
}
memcpy(state->buf + state->buflen, in, inlen);
state->buflen += inlen;
return 0;
}
static int crypto_blake2s_final(struct shash_desc *desc, u8 *out)
{
struct blake2s_state *state = shash_desc_ctx(desc);
blake2s_set_lastblock(state);
memset(state->buf