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

Support 16kb page sizes #25

Merged
merged 3 commits into from
Mar 4, 2025
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
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (©) 2016-2024 Jeff Harris <[email protected]>
* Copyright (©) 2016-2025 Jeff Harris <[email protected]>
* All rights reserved. Use of the code is allowed under the
* Artistic License 2.0 terms, as specified in the LICENSE file
* distributed with this code, or available from
Expand All @@ -14,7 +14,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.8.0'
classpath 'com.android.tools.build:gradle:8.8.2'

// From https://github.com/google/secrets-gradle-plugin
classpath "com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:2.0.1"
Expand Down
4 changes: 2 additions & 2 deletions passwdsafe/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (©) 2016-2024 Jeff Harris <[email protected]>
* Copyright (©) 2016-2025 Jeff Harris <[email protected]>
* All rights reserved. Use of the code is allowed under the
* Artistic License 2.0 terms, as specified in the LICENSE file
* distributed with this code, or available from
Expand Down Expand Up @@ -68,7 +68,7 @@ android {
path 'src/main/cpp/CMakeLists.txt'
}
}
ndkVersion = '26.1.10909125'
ndkVersion = '28.0.13004108'
packagingOptions {
jniLibs {
useLegacyPackaging false
Expand Down
7 changes: 4 additions & 3 deletions passwdsafe/src/main/cpp/Util.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
/*
*
* Copyright (c) 2003-2014 Rony Shapiro <[email protected]>.
* Copyright (c) 2025 Jeff Harris <[email protected]>
* All rights reserved. Use of the code is allowed under the
* Artistic License 2.0 terms, as specified in the LICENSE file
* distributed with this code, or available from
* http://www.opensource.org/licenses/artistic-license-2.0.php
*/
#ifndef __UTIL_H
#define __UTIL_H
#ifndef INCLUDE_UTIL_H
#define INCLUDE_UTIL_H

// Util.h
//-----------------------------------------------------------------------------

[[gnu::noinline]] extern void trashMemory(void *buffer, size_t length);
[[gnu::noinline]] extern void burnStack(size_t len); // borrowed from libtomcrypt
#endif /* __UTIL_H */
#endif /* INCLUDE_UTIL_H */
//-----------------------------------------------------------------------------
4 changes: 2 additions & 2 deletions passwdsafe/src/main/cpp/org_pwsafe_lib_crypto_SHA256Pws.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 24 additions & 10 deletions passwdsafe/src/main/cpp/sha256.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2003-2014 Rony Shapiro <[email protected]>.
* Copyright (c) 2019 Jeff Harris <[email protected]>
* Copyright (c) 2019-2025 Jeff Harris <[email protected]>
* All rights reserved. Use of the code is allowed under the
* Artistic License 2.0 terms, as specified in the LICENSE file
* distributed with this code, or available from
Expand All @@ -11,13 +11,17 @@
// Tom St Denis, [email protected], http://libtomcrypt.org
// Rewritten for C++14 by Jeff Harris
//-----------------------------------------------------------------------------
#ifndef __SHA256_H
#define __SHA256_H
#ifndef INCLUDE_SHA256_H
#define INCLUDE_SHA256_H

#include <array>
#include <cstddef>
#include <cstdint>

#pragma clang diagnostic push
#pragma ide diagnostic ignored "cppcoreguidelines-avoid-magic-numbers"
#pragma ide diagnostic ignored "cppcoreguidelines-use-default-member-init"

class SHA256
{
public:
Expand All @@ -27,8 +31,20 @@ class SHA256
/// Constructor
SHA256();

/// Copy constructor (disallowed)
SHA256(const SHA256&) = delete;

/// Move constructor (disallowed)
SHA256(SHA256&&) = delete;

/// Destructor
~SHA256();
~SHA256() = default;

/// Assignment operator (disallowed)
SHA256& operator=(const SHA256&) = delete;

/// Move assignment operator (disallowed)
SHA256& operator=(SHA256&&) = delete;

/// Process a block of memory though the hash
void update(const unsigned char* inbuf, size_t inlen);
Expand Down Expand Up @@ -63,13 +79,11 @@ inline SHA256::SHA256() :
itsLength(0),
itsState{0x6A09E667U, 0xBB67AE85U, 0x3C6EF372U, 0xA54FF53AU,
0x510E527FU, 0x9B05688CU, 0x1F83D9ABU, 0x5BE0CD19U},
itsCurlen(0)
itsCurlen(0),
itsBuf{}
{
}

/**
* Destructor
*/
inline SHA256::~SHA256() = default;
#pragma clang diagnostic pop

#endif /* __SHA256_H */
#endif /* INCLUDE_SHA256_H */
Loading