From d0a21970fdc0fbbfc7ad31bc135f5a8fde1d3d49 Mon Sep 17 00:00:00 2001 From: tb <> Date: Sat, 26 Nov 2022 16:08:57 +0000 Subject: Make internal header file names consistent Libcrypto currently has a mess of *_lcl.h, *_locl.h, and *_local.h names used for internal headers. Move all these headers we inherited from OpenSSL to *_local.h, reserving the name *_internal.h for our own code. Similarly, move dtls_locl.h and ssl_locl.h to dtls_local and ssl_local.h. constant_time_locl.h is moved to constant_time.h since it's special. Adjust all .c files in libcrypto, libssl and regress. The diff is mechanical with the exception of tls13_quic.c, where #include was fixed manually. discussed with jsing, no objection bcook --- src/lib/libcrypto/sm2/sm2_crypt.c | 4 ++-- src/lib/libcrypto/sm2/sm2_local.h | 43 +++++++++++++++++++++++++++++++++++++++ src/lib/libcrypto/sm2/sm2_locl.h | 43 --------------------------------------- src/lib/libcrypto/sm2/sm2_pmeth.c | 6 +++--- src/lib/libcrypto/sm2/sm2_sign.c | 6 +++--- 5 files changed, 51 insertions(+), 51 deletions(-) create mode 100644 src/lib/libcrypto/sm2/sm2_local.h delete mode 100644 src/lib/libcrypto/sm2/sm2_locl.h (limited to 'src/lib/libcrypto/sm2') diff --git a/src/lib/libcrypto/sm2/sm2_crypt.c b/src/lib/libcrypto/sm2/sm2_crypt.c index 2bb3b8ff63..b51161d640 100644 --- a/src/lib/libcrypto/sm2/sm2_crypt.c +++ b/src/lib/libcrypto/sm2/sm2_crypt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sm2_crypt.c,v 1.1.1.1 2021/08/18 16:04:32 tb Exp $ */ +/* $OpenBSD: sm2_crypt.c,v 1.2 2022/11/26 16:08:54 tb Exp $ */ /* * Copyright (c) 2017, 2019 Ribose Inc * @@ -26,7 +26,7 @@ #include #include -#include "sm2_locl.h" +#include "sm2_local.h" typedef struct SM2_Ciphertext_st SM2_Ciphertext; diff --git a/src/lib/libcrypto/sm2/sm2_local.h b/src/lib/libcrypto/sm2/sm2_local.h new file mode 100644 index 0000000000..c934263190 --- /dev/null +++ b/src/lib/libcrypto/sm2/sm2_local.h @@ -0,0 +1,43 @@ +/* $OpenBSD: sm2_local.h,v 1.1 2022/11/26 16:08:54 tb Exp $ */ +/* + * Copyright (c) 2017, 2019 Ribose Inc + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef HEADER_SM2_LOCL_H +#define HEADER_SM2_LOCL_H + +#include +#include + +__BEGIN_HIDDEN_DECLS + +int sm2_compute_userid_digest(uint8_t *out, const EVP_MD *digest, + const uint8_t *uid, size_t uid_len, const EC_KEY *key); + +/* + * SM2 signature operation. Computes ZA (user id digest) and then signs + * H(ZA || msg) using SM2 + */ +ECDSA_SIG *sm2_do_sign(const EC_KEY *key, const EVP_MD *digest, + const uint8_t *uid, size_t uid_len, const uint8_t *msg, size_t msg_len); + +int sm2_do_verify(const EC_KEY *key, const EVP_MD *digest, + const ECDSA_SIG *signature, const uint8_t *uid, size_t uid_len, + const uint8_t *msg, size_t msg_len); + +__END_HIDDEN_DECLS + +#endif + diff --git a/src/lib/libcrypto/sm2/sm2_locl.h b/src/lib/libcrypto/sm2/sm2_locl.h deleted file mode 100644 index 2e1626824f..0000000000 --- a/src/lib/libcrypto/sm2/sm2_locl.h +++ /dev/null @@ -1,43 +0,0 @@ -/* $OpenBSD: sm2_locl.h,v 1.1.1.1 2021/08/18 16:04:32 tb Exp $ */ -/* - * Copyright (c) 2017, 2019 Ribose Inc - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef HEADER_SM2_LOCL_H -#define HEADER_SM2_LOCL_H - -#include -#include - -__BEGIN_HIDDEN_DECLS - -int sm2_compute_userid_digest(uint8_t *out, const EVP_MD *digest, - const uint8_t *uid, size_t uid_len, const EC_KEY *key); - -/* - * SM2 signature operation. Computes ZA (user id digest) and then signs - * H(ZA || msg) using SM2 - */ -ECDSA_SIG *sm2_do_sign(const EC_KEY *key, const EVP_MD *digest, - const uint8_t *uid, size_t uid_len, const uint8_t *msg, size_t msg_len); - -int sm2_do_verify(const EC_KEY *key, const EVP_MD *digest, - const ECDSA_SIG *signature, const uint8_t *uid, size_t uid_len, - const uint8_t *msg, size_t msg_len); - -__END_HIDDEN_DECLS - -#endif - diff --git a/src/lib/libcrypto/sm2/sm2_pmeth.c b/src/lib/libcrypto/sm2/sm2_pmeth.c index af6e180a70..441f5475d1 100644 --- a/src/lib/libcrypto/sm2/sm2_pmeth.c +++ b/src/lib/libcrypto/sm2/sm2_pmeth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sm2_pmeth.c,v 1.1.1.1 2021/08/18 16:04:32 tb Exp $ */ +/* $OpenBSD: sm2_pmeth.c,v 1.2 2022/11/26 16:08:54 tb Exp $ */ /* * Copyright (c) 2017, 2019 Ribose Inc * @@ -25,8 +25,8 @@ #include #include -#include "evp_locl.h" -#include "sm2_locl.h" +#include "evp_local.h" +#include "sm2_local.h" /* SM2 pkey context structure */ diff --git a/src/lib/libcrypto/sm2/sm2_sign.c b/src/lib/libcrypto/sm2/sm2_sign.c index b35de841b1..5d929e57aa 100644 --- a/src/lib/libcrypto/sm2/sm2_sign.c +++ b/src/lib/libcrypto/sm2/sm2_sign.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sm2_sign.c,v 1.2 2022/01/20 11:12:14 inoguchi Exp $ */ +/* $OpenBSD: sm2_sign.c,v 1.3 2022/11/26 16:08:54 tb Exp $ */ /* * Copyright (c) 2017, 2019 Ribose Inc * @@ -24,8 +24,8 @@ #include #include -#include "bn_lcl.h" -#include "sm2_locl.h" +#include "bn_local.h" +#include "sm2_local.h" static BIGNUM * sm2_compute_msg_hash(const EVP_MD *digest, const EC_KEY *key, -- cgit v1.2.3-55-g6feb