Skip to content

Commit

Permalink
Clean up code and header files for amalgamation
Browse files Browse the repository at this point in the history
  • Loading branch information
utelle committed Nov 23, 2023
1 parent bc722c6 commit 27d7f67
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 11 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Expand Up @@ -43,7 +43,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -54,7 +54,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -68,4 +68,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2
2 changes: 1 addition & 1 deletion src/ascon/pbkdf2.c
Expand Up @@ -35,7 +35,7 @@ void ascon_pbkdf2_init(ascon_state_t* state, const char* functionName,
}
else
{
ascon_hash(initial, functionName, fnLength);
ascon_hash(initial, (const uint8_t*) functionName, fnLength);
}

state->x[0] = ASCON_HASH_IV;
Expand Down
18 changes: 18 additions & 0 deletions src/ascon/prolog.h
@@ -0,0 +1,18 @@
/*
** Name: prolog.h
** Purpose: Include important header files, before
** Based on: Public domain Ascon reference implementation
** and optimized variants for 32- and 64-bit
** (see https://github.com/ascon/ascon-c)
** Remarks: API functions adapted for use in SQLite3 Multiple Ciphers
** Modified by: Ulrich Telle
** Copyright: (c) 2023-2023 Ulrich Telle
** License: MIT
*/

#ifndef PROLOG_H
#define PROLOG_H

#include "word.h"

#endif
2 changes: 2 additions & 0 deletions src/ascon/round.h
Expand Up @@ -13,6 +13,8 @@
#ifndef ROUND_H
#define ROUND_H

#include "forceinline.h"

#if defined(__LP64__) || defined(_WIN64)
/* 64-bit machine, Windows or Linux or OS X */
#include "round64.h"
Expand Down
6 changes: 3 additions & 3 deletions src/ascon/round32.h
@@ -1,5 +1,5 @@
#ifndef ROUND_H_
#define ROUND_H_
#ifndef ROUND32_H_
#define ROUND32_H_

#include "ascon.h"
#include "constants.h"
Expand Down Expand Up @@ -47,4 +47,4 @@ forceinline void ASCON_PROUNDS(ascon_state_t* s, int nr) {
} while (i != ASCON_END);
}

#endif /* ROUND_H_ */
#endif /* ROUND32_H_ */
6 changes: 3 additions & 3 deletions src/ascon/round64.h
@@ -1,5 +1,5 @@
#ifndef ROUND_H_
#define ROUND_H_
#ifndef ROUND64_H_
#define ROUND64_H_

#include "ascon.h"
#include "constants.h"
Expand Down Expand Up @@ -46,4 +46,4 @@ forceinline void ASCON_PROUNDS(ascon_state_t* s, int nr) {
} while (i != ASCON_END);
}

#endif /* ROUND_H_ */
#endif /* ROUND64_H_ */
3 changes: 2 additions & 1 deletion src/cipher_ascon.c
Expand Up @@ -22,6 +22,7 @@

#define ASCON128_KDF_ITER_DEFAULT 64007

#include "ascon/prolog.h"
#include "ascon/aead.c"
#include "ascon/hash.c"
#include "ascon/pbkdf2.c"
Expand Down Expand Up @@ -181,7 +182,7 @@ GenerateKeyAscon128Cipher(void* cipher, BtShared* pBt, char* userPassword, int p
if (!bypass)
{
ascon_pbkdf2(ascon128Cipher->m_key, KEYLENGTH_ASCON128,
userPassword, passwordLength,
(const uint8_t*) userPassword, passwordLength,
ascon128Cipher->m_salt, SALTLENGTH_ASCON128, ascon128Cipher->m_kdfIter);
}
SQLITE3MC_DEBUG_LOG("generate: codec=%p pFile=%p\n", ascon128Cipher, fd);
Expand Down

0 comments on commit 27d7f67

Please sign in to comment.