Macros have been added to generate the simple legacy methods. Engines and EVP_MD_METH_get methods still require access to the old legacy methods, so they needed to be added back in. They may only be removed after engines are deprecated and removed. Removed some unnecessary #includes and #ifndef guards (which are done in build.info instead). Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10602)master
parent
1ac7e15375
commit
b2055d67f0
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#define IMPLEMENT_LEGACY_EVP_MD_METH(nm, fn) \
|
||||
static int nm##_init(EVP_MD_CTX *ctx) \
|
||||
{ \
|
||||
return fn##_Init(EVP_MD_CTX_md_data(ctx)); \
|
||||
} \
|
||||
static int nm##_update(EVP_MD_CTX *ctx, const void *data, size_t count) \
|
||||
{ \
|
||||
return fn##_Update(EVP_MD_CTX_md_data(ctx), data, count); \
|
||||
} \
|
||||
static int nm##_final(EVP_MD_CTX *ctx, unsigned char *md) \
|
||||
{ \
|
||||
return fn##_Final(md, EVP_MD_CTX_md_data(ctx)); \
|
||||
}
|
||||
|
||||
#define IMPLEMENT_LEGACY_EVP_MD_METH_LC(nm, fn) \
|
||||
static int nm##_init(EVP_MD_CTX *ctx) \
|
||||
{ \
|
||||
return fn##_init(EVP_MD_CTX_md_data(ctx)); \
|
||||
} \
|
||||
static int nm##_update(EVP_MD_CTX *ctx, const void *data, size_t count) \
|
||||
{ \
|
||||
return fn##_update(EVP_MD_CTX_md_data(ctx), data, count); \
|
||||
} \
|
||||
static int nm##_final(EVP_MD_CTX *ctx, unsigned char *md) \
|
||||
{ \
|
||||
return fn##_final(md, EVP_MD_CTX_md_data(ctx)); \
|
||||
}
|
||||
|
||||
|
||||
#define LEGACY_EVP_MD_METH_TABLE(init, update, final, ctrl, blksz) \
|
||||
init, update, final, NULL, NULL, blksz, 0, ctrl
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#include <openssl/ripemd.h>
|
||||
#include "crypto/evp.h"
|
||||
#include "legacy_meth.h"
|
||||
|
||||
IMPLEMENT_LEGACY_EVP_MD_METH(ripe, RIPEMD160)
|
||||
|
||||
static const EVP_MD ripemd160_md = {
|
||||
NID_ripemd160,
|
||||
NID_ripemd160WithRSA,
|
||||
RIPEMD160_DIGEST_LENGTH,
|
||||
0,
|
||||
LEGACY_EVP_MD_METH_TABLE(ripe_init, ripe_update, ripe_final, NULL,
|
||||
RIPEMD160_CBLOCK),
|
||||
};
|
||||
|
||||
const EVP_MD *EVP_ripemd160(void)
|
||||
{
|
||||
return &ripemd160_md;
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright 2005-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
|
||||
*/
|
||||
|
||||
#include <openssl/whrlpool.h>
|
||||
#include "crypto/evp.h"
|
||||
#include "legacy_meth.h"
|
||||
|
||||
IMPLEMENT_LEGACY_EVP_MD_METH(wp, WHIRLPOOL)
|
||||
|
||||
static const EVP_MD whirlpool_md = {
|
||||
NID_whirlpool,
|
||||
0,
|
||||
WHIRLPOOL_DIGEST_LENGTH,
|
||||
0,
|
||||
LEGACY_EVP_MD_METH_TABLE(wp_init, wp_update, wp_final, NULL,
|
||||
WHIRLPOOL_BBLOCK / 8),
|
||||
};
|
||||
|
||||
const EVP_MD *EVP_whirlpool(void)
|
||||
{
|
||||
return &whirlpool_md;
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "internal/cryptlib.h"
|
||||
|
||||
#ifndef OPENSSL_NO_RMD160
|
||||
|
||||
# include <openssl/ripemd.h>
|
||||
# include <openssl/evp.h>
|
||||
# include <openssl/objects.h>
|
||||
# include <openssl/x509.h>
|
||||
# include <openssl/rsa.h>
|
||||
# include "crypto/evp.h"
|
||||
|
||||
static int init(EVP_MD_CTX *ctx)
|
||||
{
|
||||
return RIPEMD160_Init(EVP_MD_CTX_md_data(ctx));
|
||||
}
|
||||
|
||||
static int update(EVP_MD_CTX *ctx, const void *data, size_t count)
|
||||
{
|
||||
return RIPEMD160_Update(EVP_MD_CTX_md_data(ctx), data, count);
|
||||
}
|
||||
|
||||
static int final(EVP_MD_CTX *ctx, unsigned char *md)
|
||||
{
|
||||
return RIPEMD160_Final(md, EVP_MD_CTX_md_data(ctx));
|
||||
}
|
||||
|
||||
static const EVP_MD ripemd160_md = {
|
||||
NID_ripemd160,
|
||||
NID_ripemd160WithRSA,
|
||||
RIPEMD160_DIGEST_LENGTH,
|
||||
0,
|
||||
init,
|
||||
update,
|
||||
final,
|
||||
NULL,
|
||||
NULL,
|
||||
RIPEMD160_CBLOCK,
|
||||
sizeof(EVP_MD *) + sizeof(RIPEMD160_CTX),
|
||||
};
|
||||
|
||||
const EVP_MD *EVP_ripemd160(void)
|
||||
{
|
||||
return &ripemd160_md;
|
||||
}
|
||||
#endif
|
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright 2005-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
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "internal/cryptlib.h"
|
||||
|
||||
#ifndef OPENSSL_NO_WHIRLPOOL
|
||||
|
||||
# include <openssl/evp.h>
|
||||
# include <openssl/objects.h>
|
||||
# include <openssl/x509.h>
|
||||
# include <openssl/whrlpool.h>
|
||||
# include "crypto/evp.h"
|
||||
|
||||
static int init(EVP_MD_CTX *ctx)
|
||||
{
|
||||
return WHIRLPOOL_Init(EVP_MD_CTX_md_data(ctx));
|
||||
}
|
||||
|
||||
static int update(EVP_MD_CTX *ctx, const void *data, size_t count)
|
||||
{
|
||||
return WHIRLPOOL_Update(EVP_MD_CTX_md_data(ctx), data, count);
|
||||
}
|
||||
|
||||
static int final(EVP_MD_CTX *ctx, unsigned char *md)
|
||||
{
|
||||
return WHIRLPOOL_Final(md, EVP_MD_CTX_md_data(ctx));
|
||||
}
|
||||
|
||||
static const EVP_MD whirlpool_md = {
|
||||
NID_whirlpool,
|
||||
0,
|
||||
WHIRLPOOL_DIGEST_LENGTH,
|
||||
0,
|
||||
init,
|
||||
update,
|
||||
final,
|
||||
NULL,
|
||||
NULL,
|
||||
WHIRLPOOL_BBLOCK / 8,
|
||||
sizeof(EVP_MD *) + sizeof(WHIRLPOOL_CTX),
|
||||
};
|
||||
|
||||
const EVP_MD *EVP_whirlpool(void)
|
||||
{
|
||||
return &whirlpool_md;
|
||||
}
|
||||
#endif
|
@ -1,2 +1,5 @@
|
||||
LIBS=../../libcrypto
|
||||
SOURCE[../../libcrypto]=sm3.c m_sm3.c
|
||||
|
||||
IF[{- !$disabled{sm3} -}]
|
||||
SOURCE[../../libcrypto]=sm3.c legacy_sm3.c
|
||||
ENDIF
|
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2017 Ribose Inc. 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 "crypto/evp.h"
|
||||
#include "../evp/legacy_meth.h"
|
||||
#include "internal/sm3.h"
|
||||
|
||||
IMPLEMENT_LEGACY_EVP_MD_METH_LC(sm3_int, sm3)
|
||||
|
||||
static const EVP_MD sm3_md = {
|
||||
NID_sm3,
|
||||
NID_sm3WithRSAEncryption,
|
||||
SM3_DIGEST_LENGTH,
|
||||
0,
|
||||
LEGACY_EVP_MD_METH_TABLE(sm3_int_init, sm3_int_update, sm3_int_final, NULL,
|
||||
SM3_CBLOCK),
|
||||
};
|
||||
|
||||
const EVP_MD *EVP_sm3(void)
|
||||
{
|
||||
return &sm3_md;
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2017 Ribose Inc. 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 "internal/cryptlib.h"
|
||||
|
||||
#ifndef OPENSSL_NO_SM3
|
||||
# include <openssl/evp.h>
|
||||
# include "internal/sm3.h"
|
||||
# include "crypto/evp.h"
|
||||
|
||||
static int init(EVP_MD_CTX *ctx)
|
||||
{
|
||||
return sm3_init(EVP_MD_CTX_md_data(ctx));
|
||||
}
|
||||
|
||||
static int update(EVP_MD_CTX *ctx, const void *data, size_t count)
|
||||
{
|
||||
return sm3_update(EVP_MD_CTX_md_data(ctx), data, count);
|
||||
}
|
||||
|
||||
static int final(EVP_MD_CTX *ctx, unsigned char *md)
|
||||
{
|
||||
return sm3_final(md, EVP_MD_CTX_md_data(ctx));
|
||||
}
|
||||
|
||||
static const EVP_MD sm3_md = {
|
||||
NID_sm3,
|
||||
NID_sm3WithRSAEncryption,
|
||||
SM3_DIGEST_LENGTH,
|
||||
0,
|
||||
init,
|
||||
update,
|
||||
final,
|
||||
NULL,
|
||||
NULL,
|
||||
SM3_CBLOCK,
|
||||
sizeof(EVP_MD *) + sizeof(SM3_CTX),
|
||||
};
|
||||
|
||||
const EVP_MD *EVP_sm3(void)
|
||||
{
|
||||
return &sm3_md;
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in new issue