diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index e64703037e..3554f25578 100755 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -364,9 +364,7 @@ add_library(librnp-obj OBJECT # other sources sec_profile.cpp - crypto.cpp fingerprint.cpp - generate-key.cpp key-provider.cpp logging.cpp json-utils.cpp diff --git a/src/lib/crypto.cpp b/src/lib/crypto.cpp deleted file mode 100644 index 765018739c..0000000000 --- a/src/lib/crypto.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2017-2023, [Ribose Inc](https://www.ribose.com). - * Copyright (c) 2009 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is originally derived from software contributed to - * The NetBSD Foundation by Alistair Crooks (agc@netbsd.org), and - * carried further by Ribose Inc (https://www.ribose.com). - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -/* - * Copyright (c) 2005-2008 Nominet UK (www.nic.uk) - * All rights reserved. - * Contributors: Ben Laurie, Rachel Willmer. The Contributors have asserted - * their moral rights under the UK Copyright Design and Patents Act 1988 to - * be recorded as the authors of this copyright work. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. - * - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - */ diff --git a/src/lib/crypto.h b/src/lib/crypto.h deleted file mode 100644 index b8301938ad..0000000000 --- a/src/lib/crypto.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2017, [Ribose Inc](https://www.ribose.com). - * Copyright (c) 2009 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is originally derived from software contributed to - * The NetBSD Foundation by Alistair Crooks (agc@netbsd.org), and - * carried further by Ribose Inc (https://www.ribose.com). - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -/* - * Copyright (c) 2005-2008 Nominet UK (www.nic.uk) - * All rights reserved. - * Contributors: Ben Laurie, Rachel Willmer. The Contributors have asserted - * their moral rights under the UK Copyright Design and Patents Act 1988 to - * be recorded as the authors of this copyright work. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. - * - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** \file - */ - -#ifndef CRYPTO_H_ -#define CRYPTO_H_ - -#include -#include "crypto/common.h" -#include - -#endif /* CRYPTO_H_ */ diff --git a/src/lib/crypto/dsa_common.cpp b/src/lib/crypto/dsa_common.cpp index e32a206feb..962c1eaa69 100644 --- a/src/lib/crypto/dsa_common.cpp +++ b/src/lib/crypto/dsa_common.cpp @@ -24,10 +24,11 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "crypto.h" #include "config.h" #include "defaults.h" +#include "repgp/repgp_def.h" #include "dsa_common.h" +#include pgp_hash_alg_t dsa_get_min_hash(size_t qsize) diff --git a/src/lib/crypto/symmetric.cpp b/src/lib/crypto/symmetric.cpp index 8f713e0b58..e9e4ee8782 100644 --- a/src/lib/crypto/symmetric.cpp +++ b/src/lib/crypto/symmetric.cpp @@ -1,55 +1,29 @@ /* * Copyright (c) 2017-2024, [Ribose Inc](https://www.ribose.com). - * Copyright (c) 2009 The NetBSD Foundation, Inc. * All rights reserved. * - * This code is originally derived from software contributed to - * The NetBSD Foundation by Alistair Crooks (agc@netbsd.org), and - * carried further by Ribose Inc (https://www.ribose.com). + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -/* - * Copyright (c) 2005-2008 Nominet UK (www.nic.uk) - * All rights reserved. - * Contributors: Ben Laurie, Rachel Willmer. The Contributors have asserted - * their moral rights under the UK Copyright Design and Patents Act 1988 to - * be recorded as the authors of this copyright work. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. - * - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. * - * See the License for the specific language governing permissions and - * limitations under the License. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "crypto.h" #include "config.h" #include "defaults.h" @@ -59,6 +33,8 @@ #include #include #include "utils.h" +#include "repgp/repgp_def.h" +#include "symmetric.h" static const char * pgp_sa_to_botan_string(int alg, bool silent = false) diff --git a/src/lib/crypto/symmetric_common.cpp b/src/lib/crypto/symmetric_common.cpp index 608e6fe00e..3c3da1c938 100644 --- a/src/lib/crypto/symmetric_common.cpp +++ b/src/lib/crypto/symmetric_common.cpp @@ -24,9 +24,10 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "crypto.h" #include "config.h" #include "defaults.h" +#include "symmetric.h" +#include void pgp_cipher_cfb_resync(pgp_crypt_t *crypt, const uint8_t *buf) diff --git a/src/lib/crypto/symmetric_ossl.cpp b/src/lib/crypto/symmetric_ossl.cpp index e9a42aed91..d920c851e4 100644 --- a/src/lib/crypto/symmetric_ossl.cpp +++ b/src/lib/crypto/symmetric_ossl.cpp @@ -24,7 +24,6 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "crypto.h" #include "config.h" #include "defaults.h" diff --git a/src/lib/generate-key.cpp b/src/lib/generate-key.cpp deleted file mode 100644 index f8b159266f..0000000000 --- a/src/lib/generate-key.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2017, [Ribose Inc](https://www.ribose.com). - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ diff --git a/src/lib/pgp-key.cpp b/src/lib/pgp-key.cpp index 79f0c7ee81..ab1c96284c 100644 --- a/src/lib/pgp-key.cpp +++ b/src/lib/pgp-key.cpp @@ -52,7 +52,6 @@ #include "pgp-key.h" #include "utils.h" #include -#include "crypto.h" #include "crypto/s2k.h" #include "crypto/mem.h" #include "crypto/signatures.h" diff --git a/src/lib/rnp.cpp b/src/lib/rnp.cpp index 421a5f877c..94ba5d8edb 100644 --- a/src/lib/rnp.cpp +++ b/src/lib/rnp.cpp @@ -25,7 +25,6 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "crypto.h" #include "crypto/common.h" #include "pgp-key.h" #include "defaults.h" diff --git a/src/librepgp/stream-dump.cpp b/src/librepgp/stream-dump.cpp index 31f3d980e1..d500fa9819 100644 --- a/src/librepgp/stream-dump.cpp +++ b/src/librepgp/stream-dump.cpp @@ -46,7 +46,6 @@ #include "crypto/s2k.h" #include "fingerprint.h" #include "pgp-key.h" -#include "crypto.h" #include "json-utils.h" #include diff --git a/src/librepgp/stream-key.cpp b/src/librepgp/stream-key.cpp index 30fe3bf0fc..9e8fe9d013 100644 --- a/src/librepgp/stream-key.cpp +++ b/src/librepgp/stream-key.cpp @@ -44,7 +44,6 @@ #include "types.h" #include "fingerprint.h" #include "pgp-key.h" -#include "crypto.h" #include "crypto/signatures.h" #include "crypto/mem.h" #include "str-utils.h" diff --git a/src/librepgp/stream-packet.cpp b/src/librepgp/stream-packet.cpp index 4ad28dfe01..ef45a0df7f 100644 --- a/src/librepgp/stream-packet.cpp +++ b/src/librepgp/stream-packet.cpp @@ -37,7 +37,6 @@ #include #include #include "types.h" -#include "crypto.h" #include "crypto/mem.h" #include "stream-packet.h" #include "stream-key.h" diff --git a/src/librepgp/stream-parse.cpp b/src/librepgp/stream-parse.cpp index 0b98b4fa18..6569d1d510 100644 --- a/src/librepgp/stream-parse.cpp +++ b/src/librepgp/stream-parse.cpp @@ -44,7 +44,6 @@ #include "str-utils.h" #include "types.h" #include "crypto/s2k.h" -#include "crypto.h" #include "crypto/signatures.h" #include "fingerprint.h" #include "pgp-key.h" diff --git a/src/tests/cipher.cpp b/src/tests/cipher.cpp index 2f7bc1743c..e84a631741 100644 --- a/src/tests/cipher.cpp +++ b/src/tests/cipher.cpp @@ -25,7 +25,6 @@ */ #include -#include #include #include "rnp.h" #include diff --git a/src/tests/generatekey.cpp b/src/tests/generatekey.cpp index 442d85b020..9b02a7b01d 100644 --- a/src/tests/generatekey.cpp +++ b/src/tests/generatekey.cpp @@ -32,7 +32,6 @@ #include "rnp_tests.h" #include "support.h" #include "crypto/common.h" -#include "crypto.h" #include "pgp-key.h" #include "librepgp/stream-ctx.h" #include "librepgp/stream-sig.h" diff --git a/src/tests/key-protect.cpp b/src/tests/key-protect.cpp index 634b9609d2..16c488837f 100644 --- a/src/tests/key-protect.cpp +++ b/src/tests/key-protect.cpp @@ -28,7 +28,6 @@ #include "rnp_tests.h" #include "support.h" -#include "crypto.h" #include "keygen.hpp" bool diff --git a/src/tests/support.cpp b/src/tests/support.cpp index 1f6bc32bf2..e9eb7e7963 100644 --- a/src/tests/support.cpp +++ b/src/tests/support.cpp @@ -44,7 +44,6 @@ #include #include -#include #include #include #include