Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor key generation classes #2284

Merged
merged 15 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -364,16 +364,15 @@ 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
utils.cpp
pass-provider.cpp
sig_subpacket.cpp
key_material.cpp
keygen.cpp
pgp-key.cpp
rnp.cpp
)
Expand Down
116 changes: 0 additions & 116 deletions src/lib/crypto.cpp

This file was deleted.

107 changes: 0 additions & 107 deletions src/lib/crypto.h

This file was deleted.

4 changes: 3 additions & 1 deletion src/lib/crypto/dsa_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#include "crypto.h"
#include "config.h"
#include "defaults.h"
#include "repgp/repgp_def.h"
#include "dsa_common.h"
#include "dsa.h"
#include <cstddef>

pgp_hash_alg_t
dsa_get_min_hash(size_t qsize)
Expand Down
62 changes: 19 additions & 43 deletions src/lib/crypto/symmetric.cpp
Original file line number Diff line number Diff line change
@@ -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 ([email protected]), 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"

Expand All @@ -59,6 +33,8 @@
#include <botan/ffi.h>
#include <botan/build.h>
#include "utils.h"
#include "repgp/repgp_def.h"
#include "symmetric.h"

static const char *
pgp_sa_to_botan_string(int alg, bool silent = false)
Expand Down
3 changes: 2 additions & 1 deletion src/lib/crypto/symmetric_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#include "crypto.h"
#include "config.h"
#include "defaults.h"
#include "symmetric.h"
#include <cstring>

void
pgp_cipher_cfb_resync(pgp_crypt_t *crypt, const uint8_t *buf)
Expand Down
3 changes: 2 additions & 1 deletion src/lib/crypto/symmetric_ossl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#include "crypto.h"
#include "config.h"
#include "defaults.h"

Expand All @@ -35,6 +34,8 @@
#include <openssl/err.h>
#include "mem.h"
#include "utils.h"
#include "repgp/repgp_def.h"
#include "symmetric.h"

static const char *
pgp_sa_to_openssl_string(int alg, bool silent = false)
Expand Down
Loading
Loading