Skip to content

Commit

Permalink
Make pk_ops.h public
Browse files Browse the repository at this point in the history
It used to be public in Botan 2.x but was removed from the public
interface in Botan 3.x. Though, this header is needed by applications
that wish to implement custom public-key algorithms.

Closes randombit#3878
  • Loading branch information
reneme committed Jan 10, 2024
1 parent 1e77255 commit 334c835
Show file tree
Hide file tree
Showing 14 changed files with 19 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/lib/prov/pkcs11/p11_ecdh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
#if defined(BOTAN_HAS_ECDH)

#include <botan/der_enc.h>
#include <botan/pk_ops.h>
#include <botan/rng.h>
#include <botan/internal/p11_mechanism.h>
#include <botan/internal/pk_ops.h>

namespace Botan::PKCS11 {

Expand Down
2 changes: 1 addition & 1 deletion src/lib/prov/pkcs11/p11_ecdsa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

#if defined(BOTAN_HAS_ECDSA)

#include <botan/pk_ops.h>
#include <botan/rng.h>
#include <botan/internal/keypair.h>
#include <botan/internal/p11_mechanism.h>
#include <botan/internal/pk_ops.h>

namespace Botan::PKCS11 {

Expand Down
1 change: 0 additions & 1 deletion src/lib/prov/pkcs11/p11_rsa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <botan/rng.h>
#include <botan/internal/blinding.h>
#include <botan/internal/p11_mechanism.h>
#include <botan/internal/pk_ops.h>
#include <botan/internal/pk_ops_impl.h>

namespace Botan::PKCS11 {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/prov/tpm/tpm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

#include <botan/der_enc.h>
#include <botan/hash.h>
#include <botan/pk_ops.h>
#include <botan/rsa.h>
#include <botan/internal/fmt.h>
#include <botan/internal/hash_id.h>
#include <botan/internal/pk_ops.h>
#include <botan/internal/workfactor.h>
#include <limits>

Expand Down
2 changes: 1 addition & 1 deletion src/lib/pubkey/info.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ brief -> "Implementations of public key schemes"
pk_algs.h
pk_keys.h
pk_ops_fwd.h
pk_ops.h
pkcs8.h
pubkey.h
x509_key.h
</header:public>

<header:internal>
blinding.h
pk_ops.h
pk_ops_impl.h
workfactor.h
</header:internal>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/pubkey/mce/mce_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#define BOTAN_MCELIECE_INTERNAL_H_

#include <botan/mceliece.h>
#include <botan/internal/pk_ops.h>
#include <botan/pk_ops.h>
#include <botan/internal/polyn_gf2m.h>

namespace Botan {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/pubkey/pk_keys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#include <botan/der_enc.h>
#include <botan/hash.h>
#include <botan/hex.h>
#include <botan/pk_ops.h>
#include <botan/internal/fmt.h>
#include <botan/internal/pk_ops.h>

namespace Botan {

Expand Down
14 changes: 7 additions & 7 deletions src/lib/pubkey/pk_ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace PK_Ops {
/**
* Public key encryption interface
*/
class Encryption {
class BOTAN_PUBLIC_API(3, 3) Encryption {
public:
virtual secure_vector<uint8_t> encrypt(const uint8_t msg[], size_t msg_len, RandomNumberGenerator& rng) = 0;

Expand All @@ -47,7 +47,7 @@ class Encryption {
/**
* Public key decryption interface
*/
class Decryption {
class BOTAN_PUBLIC_API(3, 3) Decryption {
public:
virtual secure_vector<uint8_t> decrypt(uint8_t& valid_mask,
const uint8_t ciphertext[],
Expand All @@ -61,7 +61,7 @@ class Decryption {
/**
* Public key signature verification interface
*/
class Verification {
class BOTAN_PUBLIC_API(3, 3) Verification {
public:
/**
* Add more data to the message currently being signed
Expand All @@ -86,7 +86,7 @@ class Verification {
/**
* Public key signature creation interface
*/
class Signature {
class BOTAN_PUBLIC_API(3, 3) Signature {
public:
/**
* Add more data to the message currently being signed
Expand Down Expand Up @@ -124,7 +124,7 @@ class Signature {
/**
* A generic key agreement operation (eg DH or ECDH)
*/
class Key_Agreement {
class BOTAN_PUBLIC_API(3, 3) Key_Agreement {
public:
virtual secure_vector<uint8_t> agree(
size_t key_len, const uint8_t other_key[], size_t other_key_len, const uint8_t salt[], size_t salt_len) = 0;
Expand All @@ -137,7 +137,7 @@ class Key_Agreement {
/**
* KEM (key encapsulation)
*/
class KEM_Encryption {
class BOTAN_PUBLIC_API(3, 3) KEM_Encryption {
public:
virtual void kem_encrypt(std::span<uint8_t> out_encapsulated_key,
std::span<uint8_t> out_shared_key,
Expand All @@ -152,7 +152,7 @@ class KEM_Encryption {
virtual ~KEM_Encryption() = default;
};

class KEM_Decryption {
class BOTAN_PUBLIC_API(3, 3) KEM_Decryption {
public:
virtual void kem_decrypt(std::span<uint8_t> out_shared_key,
std::span<const uint8_t> encapsulated_key,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/pubkey/pk_ops_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

#include <botan/hash.h>
#include <botan/kdf.h>
#include <botan/pk_ops.h>
#include <botan/internal/eme.h>
#include <botan/internal/pk_ops.h>

namespace Botan::PK_Ops {

Expand Down
2 changes: 1 addition & 1 deletion src/lib/pubkey/pubkey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
#include <botan/bigint.h>
#include <botan/der_enc.h>
#include <botan/mem_ops.h>
#include <botan/pk_ops.h>
#include <botan/rng.h>
#include <botan/internal/ct_utils.h>
#include <botan/internal/fmt.h>
#include <botan/internal/parsing.h>
#include <botan/internal/pk_ops.h>
#include <botan/internal/pss_params.h>

namespace Botan {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/pubkey/sm2/sm2_enc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
#include <botan/der_enc.h>
#include <botan/hash.h>
#include <botan/kdf.h>
#include <botan/pk_ops.h>
#include <botan/internal/ct_utils.h>
#include <botan/internal/fmt.h>
#include <botan/internal/pk_ops.h>
#include <botan/internal/point_mul.h>

namespace Botan {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* Botan is released under the Simplified BSD License (see license.txt)
**/

#include <botan/rng.h>
#include <botan/sphincsplus.h>

#include <botan/rng.h>
#include <botan/internal/pk_ops_impl.h>
#include <botan/internal/sp_fors.h>
#include <botan/internal/sp_hash.h>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/pubkey/xmss/xmss_signature_operation.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#ifndef BOTAN_XMSS_SIGNATURE_OPERATION_H_
#define BOTAN_XMSS_SIGNATURE_OPERATION_H_

#include <botan/pk_ops.h>
#include <botan/xmss.h>
#include <botan/internal/pk_ops.h>
#include <botan/internal/xmss_address.h>
#include <botan/internal/xmss_signature.h>
#include <botan/internal/xmss_wots.h>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/pubkey/xmss/xmss_verification_operation.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#ifndef BOTAN_XMSS_VERIFICATION_OPERATION_H_
#define BOTAN_XMSS_VERIFICATION_OPERATION_H_

#include <botan/pk_ops.h>
#include <botan/xmss.h>
#include <botan/internal/pk_ops.h>
#include <botan/internal/xmss_signature.h>

namespace Botan {
Expand Down

0 comments on commit 334c835

Please sign in to comment.