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

Cleanup header includes #392

Merged
merged 5 commits into from
Feb 28, 2019
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion jni/themis_keygen.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include <jni.h>
#include <themis/themis_error.h>
#include <themis/secure_message.h>
#include <themis/secure_keygen.h>

/* Should be same as in AsymmetricKey.java */
#define KEYTYPE_EC 0
Expand Down
11 changes: 6 additions & 5 deletions src/soter/boringssl/soter_asym_cipher.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@
* limitations under the License.
*/

#include <soter/soter.h>
#include <soter/soter_rsa_key.h>
#include "soter_engine.h"
#include "soter/soter_asym_cipher.h"

#include <openssl/evp.h>
#include <openssl/rsa.h>

#define OAEP_HASH_SIZE 20
#include "soter/soter_rsa_key.h"
#include "soter/boringssl/soter_engine.h"

#define OAEP_HASH_SIZE 20

#ifndef SOTER_RSA_KEY_LENGTH
#define SOTER_RSA_KEY_LENGTH 2048
Expand Down Expand Up @@ -317,4 +318,4 @@ soter_status_t soter_asym_cipher_destroy(soter_asym_cipher_t* asym_cipher)
{
return status;
}
}
}
8 changes: 5 additions & 3 deletions src/soter/boringssl/soter_asym_ka.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
* limitations under the License.
*/

#include <soter/soter_error.h>
#include "soter_engine.h"
#include <soter/soter_ec_key.h>
#include "soter/soter_asym_ka.h"

#include <openssl/ec.h>

#include "soter/soter_ec_key.h"
#include "soter/boringssl/soter_engine.h"

static int soter_alg_to_curve_nid(soter_asym_ka_alg_t alg)
{
switch (alg)
Expand Down
9 changes: 4 additions & 5 deletions src/soter/boringssl/soter_ec_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@
* limitations under the License.
*/

#include <soter/soter_error.h>
#include <soter/soter_ec_key.h>
#include "soter/soter_ec_key.h"

#include <string.h>

#include <openssl/evp.h>
#include <openssl/bn.h>
#include <openssl/ec.h>

#include <string.h>
#include <openssl/evp.h>

static bool is_curve_supported(int curve)
{
Expand Down
10 changes: 6 additions & 4 deletions src/soter/boringssl/soter_ecdsa_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
* limitations under the License.
*/

#include <soter/soter.h>
#include <soter/soter_ec_key.h>
#include "soter_engine.h"
#include <openssl/evp.h>
#include "soter/boringssl/soter_ecdsa_common.h"

#include <openssl/ec.h>
#include <openssl/evp.h>

#include "soter/soter_ec_key.h"
#include "soter/boringssl/soter_engine.h"

soter_status_t soter_ec_gen_key(EVP_PKEY_CTX *pkey_ctx)
{
Expand Down
13 changes: 6 additions & 7 deletions src/soter/boringssl/soter_ecdsa_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@
* limitations under the License.
*/

#ifndef SOTER_EC_COMMON_H
#define SOTER_EC_COMMON_H
#ifndef SOTER_BORINGSSL_ECDSA_COMMON_H
#define SOTER_BORINGSSL_ECDSA_COMMON_H

#include <soter/soter.h>
#include <soter/soter_ec_key.h>
#include "soter_engine.h"
#include "soter/soter_ec_key.h"
#include "soter/soter_error.h"
#include "soter/boringssl/soter_engine.h"

soter_status_t soter_ec_gen_key(EVP_PKEY_CTX *pkey_ctx);
soter_status_t soter_ec_import_key(EVP_PKEY *pkey, const void* key, const size_t key_length);
soter_status_t soter_ec_export_key(soter_sign_ctx_t* ctx, void* key, size_t* key_length, bool isprivate);

#endif

#endif /* SOTER_BORINGSSL_ECDSA_COMMON_H */
11 changes: 7 additions & 4 deletions src/soter/boringssl/soter_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@
* limitations under the License.
*/

#ifndef SOTER_ENGINE_H
#define SOTER_ENGINE_H
#ifndef SOTER_BORINGSSL_ENGINE_H
#define SOTER_BORINGSSL_ENGINE_H

#include <stdint.h>

#include <soter/soter.h>
#include <openssl/evp.h>

#include "soter/soter_asym_sign.h"

struct soter_hash_ctx_type
{
EVP_MD_CTX evp_md_ctx;
Expand Down Expand Up @@ -51,4 +54,4 @@ struct soter_sign_ctx_type{
soter_sign_alg_t alg;
};

#endif /* SOTER_ENGINE_H */
#endif /* SOTER_BORINGSSL_ENGINE_H */
5 changes: 3 additions & 2 deletions src/soter/boringssl/soter_hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
* limitations under the License.
*/

#include "soter/soter.h"
#include "soter_engine.h"
#include "soter/soter_hash.h"

#include <openssl/evp.h>

#include "soter/boringssl/soter_engine.h"

static const EVP_MD* soter_algo_to_evp_md(soter_hash_algo_t algo)
{
Expand Down
3 changes: 2 additions & 1 deletion src/soter/boringssl/soter_rand.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
* limitations under the License.
*/

#include "soter/soter.h"
#include "soter/soter_rand.h"

#include <openssl/rand.h>

soter_status_t soter_rand(uint8_t* buffer, size_t length)
Expand Down
8 changes: 3 additions & 5 deletions src/soter/boringssl/soter_rsa_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@
* limitations under the License.
*/

#include <soter/soter.h>
#include <soter/soter_rsa_key.h>
#include "soter_engine.h"
#include "soter/boringssl/soter_rsa_common.h"

#include <openssl/bn.h>
#include <openssl/evp.h>
#include <openssl/rsa.h>
#include <openssl/bn.h>

#ifndef SOTER_RSA_KEY_LENGTH
#define SOTER_RSA_KEY_LENGTH 2048
Expand Down Expand Up @@ -113,4 +112,3 @@ soter_status_t soter_rsa_export_key(soter_sign_ctx_t* ctx, void* key, size_t* ke
return soter_engine_specific_to_rsa_pub_key((const soter_engine_specific_rsa_key_t *)pkey, (soter_container_hdr_t *)key, key_length);
}
}

13 changes: 6 additions & 7 deletions src/soter/boringssl/soter_rsa_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,16 @@
* limitations under the License.
*/

#ifndef SOTER_RSA_COMMON_H
#define SOTER_RSA_COMMON_H
#ifndef SOTER_BORINGSSL_RSA_COMMON_H
#define SOTER_BORINGSSL_RSA_COMMON_H

#include <soter/soter.h>
#include <soter/soter_rsa_key.h>
#include "soter_engine.h"
#include "soter/soter_error.h"
#include "soter/soter_rsa_key.h"
#include "soter/boringssl/soter_engine.h"

unsigned rsa_key_length(const int size);
soter_status_t soter_rsa_gen_key(EVP_PKEY_CTX *pkey_ctx, const unsigned key_length);
soter_status_t soter_rsa_import_key(EVP_PKEY *pkey, const void* key, const size_t key_length);
soter_status_t soter_rsa_export_key(soter_sign_ctx_t* ctx, void* key, size_t* key_length, bool isprivate);

#endif

#endif /* SOTER_BORINGSSL_RSA_COMMON_H */
6 changes: 3 additions & 3 deletions src/soter/boringssl/soter_rsa_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
* limitations under the License.
*/

#include <soter/soter_error.h>
#include <soter/soter_rsa_key.h>
#include "soter/soter_rsa_key.h"

#include <string.h>

#include <openssl/bn.h>
#include <openssl/evp.h>
#include <openssl/rsa.h>
#include <string.h>

static size_t rsa_pub_key_size(int mod_size)
{
Expand Down
11 changes: 5 additions & 6 deletions src/soter/boringssl/soter_rsa_key_pair_gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@
* limitations under the License.
*/

#include <soter/soter_error.h>
#include "soter_engine.h"
#include "soter_rsa_common.h"
#include <soter/soter_rsa_key_pair_gen.h>
#include "soter/soter_rsa_key_pair_gen.h"

#include <string.h>

#include <openssl/evp.h>
#include <openssl/rsa.h>

#include <string.h>

#include "soter/boringssl/soter_engine.h"
#include "soter/boringssl/soter_rsa_common.h"

soter_rsa_key_pair_gen_t* soter_rsa_key_pair_gen_create(const unsigned key_length){
SOTER_CHECK_PARAM_(rsa_key_length(key_length)>0);
Expand Down
12 changes: 6 additions & 6 deletions src/soter/boringssl/soter_sign_ecdsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
* limitations under the License.
*/

#include <soter/soter_sign_ecdsa.h>
#include <soter/soter.h>
#include <soter/soter_ec_key.h>
#include "soter_engine.h"
#include "soter_ecdsa_common.h"
#include <openssl/evp.h>
#include "soter/soter_sign_ecdsa.h"

#include <openssl/ecdsa.h>
#include <openssl/err.h>
#include <openssl/evp.h>

#include "soter/soter_ec_key.h"
#include "soter/boringssl/soter_ecdsa_common.h"
#include "soter/boringssl/soter_engine.h"

soter_status_t soter_sign_init_ecdsa_none_pkcs8(soter_sign_ctx_t* ctx, const void* private_key, const size_t private_key_length, const void* public_key, const size_t public_key_length)
{
Expand Down
12 changes: 6 additions & 6 deletions src/soter/boringssl/soter_sign_rsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
* limitations under the License.
*/

#include <soter/soter_sign_rsa.h>
#include <soter/soter.h>
#include <soter/soter_rsa_key.h>
#include "soter_engine.h"
#include "soter_rsa_common.h"
#include "soter/soter_sign_rsa.h"

#include <openssl/evp.h>
#include <openssl/rsa.h>

#include "soter/soter_rsa_key.h"
#include "soter/boringssl/soter_engine.h"
#include "soter/boringssl/soter_rsa_common.h"

soter_status_t soter_sign_init_rsa_pss_pkcs8(soter_sign_ctx_t* ctx, const void* private_key, const size_t private_key_length, const void* public_key, const size_t public_key_length)
{
Expand Down Expand Up @@ -127,4 +127,4 @@ soter_status_t soter_sign_cleanup_rsa_pss_pkcs8(soter_sign_ctx_t* ctx)
ctx->md_ctx=NULL;
}
return SOTER_SUCCESS;
}
}
9 changes: 6 additions & 3 deletions src/soter/boringssl/soter_sym.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@
* limitations under the License.
*/

#include "soter/soter_sym.h"

#include <string.h>
#include "soter/soter.h"
#include "soter_engine.h"
#include <openssl/err.h>

#include <openssl/cipher.h>
#include <openssl/err.h>

#include "soter/boringssl/soter_engine.h"

#define SOTER_SYM_MAX_KEY_LENGTH 128
#define SOTER_SYM_MAX_IV_LENGTH 16
Expand Down
13 changes: 7 additions & 6 deletions src/soter/boringssl/soter_verify_ecdsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@
* limitations under the License.
*/

#include <soter/soter_sign_ecdsa.h>
#include <soter/soter.h>
#include <soter/soter_ec_key.h>
#include "soter_engine.h"
#include "soter_ecdsa_common.h"
#include <openssl/evp.h>
#include "soter/soter_sign_ecdsa.h"

#include <openssl/ecdsa.h>
#include <openssl/evp.h>

#include "soter/soter_ec_key.h"
#include "soter/boringssl/soter_ecdsa_common.h"
#include "soter/boringssl/soter_engine.h"

soter_status_t soter_verify_init_ecdsa_none_pkcs8(soter_sign_ctx_t* ctx, const void* private_key, const size_t private_key_length, const void* public_key, const size_t public_key_length)
{
Expand Down
11 changes: 6 additions & 5 deletions src/soter/boringssl/soter_verify_rsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@
* limitations under the License.
*/

#include <soter/soter_sign_rsa.h>
#include <soter/soter.h>
#include <soter/soter_rsa_key.h>
#include "soter_engine.h"
#include "soter_rsa_common.h"
#include "soter/soter_sign_rsa.h"

#include <openssl/evp.h>
#include <openssl/rsa.h>

#include "soter/soter_rsa_key.h"
#include "soter/boringssl/soter_engine.h"
#include "soter/boringssl/soter_rsa_common.h"

soter_status_t soter_verify_init_rsa_pss_pkcs8(soter_sign_ctx_t* ctx, const void* private_key, const size_t private_key_length, const void* public_key, const size_t public_key_length)
{
/* pkey_ctx init */
Expand Down
8 changes: 5 additions & 3 deletions src/soter/openssl/soter_asym_cipher.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
* limitations under the License.
*/

#include <soter/soter.h>
#include <soter/soter_rsa_key.h>
#include "soter_engine.h"
#include "soter/soter_asym_cipher.h"

#include <openssl/evp.h>
#include <openssl/rsa.h>

#include "soter/soter_rsa_key.h"
#include "soter/openssl/soter_engine.h"

/* We use only SHA1 for now */
#define OAEP_HASH_SIZE 20

Expand Down
8 changes: 5 additions & 3 deletions src/soter/openssl/soter_asym_ka.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
* limitations under the License.
*/

#include <soter/soter_error.h>
#include "soter_engine.h"
#include <soter/soter_ec_key.h>
#include "soter/soter_asym_ka.h"

#include <openssl/ec.h>

#include "soter/soter_ec_key.h"
#include "soter/openssl/soter_engine.h"

static int soter_alg_to_curve_nid(soter_asym_ka_alg_t alg)
{
switch (alg)
Expand Down
Loading