Coder Social home page Coder Social logo

microsoft / electionguard-c Goto Github PK

View Code? Open in Web Editor NEW
52.0 18.0 57.0 732 KB

This repository implements the ElectionGuard API using C. It includes all major functions of the ElectionGuard SDK, including key ceremony, ballot encryption, encrypted ballot tally, and partial decryptions for knowledge proofs of trustees.

License: MIT License

CMake 1.57% Nix 0.13% C 97.67% C++ 0.20% Makefile 0.43%

electionguard-c's Introduction

image

🗳️ ElectionGuard SDK C Implementation

Release License


Note: This repository has been deprecated & transitioned

As of 06/15/2020, this repository is no longer being actively maintained. ElectionGuard development has transitioned to the ElectionGuard-Python Repo.

This repository will remain open sourced and available, but will no longer be actively maintained or updated. Development is underway for a replacement low-level language repository (C/C++) and updates will be posted here and on our Main repository Page. This URL will become archived and read-only in Summer of 2020.


This is the core SDK that performs election functions such as vote encryption, decryption, key generation, and tallying. This code is meant to be run on voting system hardware and to be integrated into existing (or new) voting system software. The ElectionGuard SDK is written in C and is meant to add end-to-end verifiability and encryption into 3rd party comprehensive voting systems. There is also a simplistic, proof-of-concept C application to understand how the API should be called.

This implementation of the ElectionGuard SDK serves to showcase the API provided by the SDK. It focuses on specifying and fixing the API so programming against the header files presented in the include document should allow you to develop a voting system that is automatically improved as the development of the ElectionGuard SDK continues.

This repository is pre-release. We look forward to engaging with the elections, security, and software engineering communities to continue to improve it as we move towards a full release.

For Documentation on how to use this API, visit ElectionGuard C Documentation. Docs can also be compiled from this repository, see the "Documentation" section below.

For more details about the API, see the include.

Building

Windows

A file describing the build process for Windows can be found here.

Unix-like Systems

First create a build directory and configure the build.

mkdir build
cmake -S . -B build

To build the SDK static library libelectionguard.a, run

cmake --build build

Alternatively there is a Makefile to wrap the cmake commands:

make build

Testing

Currently you can exercise the SDK by running the api client <examples/api>. We include a cmake test to do so automatically. You can also execute the client directly to better examine the output it produces.

Warning

The current implementation allocates many things statically, leading to a large stack. This can cause stack-overflows as the size of elections grows.

The size of the stack mostly depends on the value of MAX_TRUSTEES in include/max_trustees.h, so one way to fix the problem is to reduce that number and recompile.

You can also increase the stack size, for example using ulimit.

In addition, this causes issues with valgrind. The error messages are usually pretty helpful, and setting --main-stacksize and --main-stackframe according to its reccomendations usually fixes the issue.

Windows

A file describing the build process for Windows can be found here.

Unix-like Systems

To build and run an example client of the SDK, run the tests:

cmake --build build --target test

Alternatively you can build the client as a stand-alone project. Create a separate build directory for the client, configure the build to refer to the built library, and build the client.

mkdir api_build
ElectionGuard_DIR="$PWD/build/ElectionGuard" cmake -S examples/api -B api_build
cmake --build api_build --target api

The built binary should be located at api_build/api.

alternatively, you can use the convenience Makefile

make run-api

Debugging

To enable debug builds suitable for running with debuggers like lldb, set the CMAKE_BUILD_TYPE cmake variable to Debug when configuring. From the command-line, this looks like

cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug

Developing

Some development tools like ccls or cquery use a JSON file called compile_commands.json to lookup which build flags are used to build different files. To produce such a file while compiling, set the CMAKE_EXPORT_COMPILE_COMMANDS cmake variable. From the command-line, this looks like

cmake -S . -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON

Documentation

To build the HTML documentation, you will need to have doxygen installed, as well as python with the sphinx and breathe packages. Then configure your build with the BUILD_DOCUMENTATION variable set and rebuild.

Note

Make sure that you've initialized git submodules correctly. The theme used for the documentation is in a submodule.

git submodule update --init --recursive
cmake -S . -B build -DBUILD_DOCUMENTATION=ON
cmake --build build

and the documentation will be built in the build/docs/html directory. You can browse it locally by opening build/docs/html/index.html, or by running a local server

# python2
(cd build/docs/html && python -m SimpleHTTPServer)

# python3
python3 -m http.server --directory build/docs/html

Memory Management/Ownership: Who frees what?

Any pointers returned by functions in the SDK are considered to be owned by the caller. This means that the SDK will retain no references to them, and that the caller must free them when they are done.

Any pointers passed to functions in the SDK as arguments are considered to be borrowed by the function, which means that they will not be freed by that function, and it is still the responsibility of the caller to free the pointer. This of course excludes functions whose purpose is to free an opaque data type, like KeyCeremony_Trustee_free().

This only applies when functions return with a successful status. If a function returns with an error status, the client does not need to free any memory that may have been allocated by the function; it will clean up after itself.

Naming Conventions

All public functions are prefixed with the name of their “class” or module, capitalized.

There are a few different kinds of types, and they each have their own naming conventions. The rationale is that for types that we rely on the fact that they are enums or structs, we should not typedef them so that it is clear that they are enums and structs. If that changes, we will have to go fix it everywhere, which is good, because now we cannot rely on their representation anymore. Abstract types should be typedefed because we don’t rely on their implementation.

Abstract Type

A type whose implementation we want to be hidden from clients. This means that it must be hidden behind a pointer so its size doesn’t need to be known.

Naming convention: uppercase, with their structs suffixed with _s.

typedef struct Car_s *Car;

Status Enum

A enum whose values represent possible statuses that we want to return.

Naming convention: prefixed by module or scope, then lowercase, and no typedef.

enum Car_status {
  CAR_SUCCESS,
  CAR_ON_FIRE,
};

Return Struct

A struct whose sole purpose is to allow us to return multiple values, often a status enum and a payload.

Naming convention: prefixed by module or scope, then lowercase, then _r, and no typedef. If only used for a single function, make the name identical to the function name, then _r. You can forward declare in the return type.

struct Car_drive_r Car_drive(Car c);

struct Car_drive_r {
  enum Car_status status;
  int x;
  int y;
};

Internal Struct

A type we want to name, but whose implementation need not be hidden. In fact, we might rely on the details of its representation.

Naming convention: all lowercase, no typedef.

struct model {
  int year;
  enum color color;
};

Current Limitations

  • Elections configurations are hard-coded. Later versions will be dynamically configurable by JSON input.
  • Proof checks are sanity checks only, they are suitable to double check output from a trustworthy source, but not for a verifier.
  • Election output is not yet structured for JSON output. Future versions will output data that will be compatible with our verifier specifications.
  • The code is tested to be memory safe, however there are known memory leaks, these will be fixed in the next versions
  • Decryption works by loading the entire election into memory. Due to the size of elections, this will not be desirable for larger elections.
  • We use a dummy hash for the base hash, when JSON input is enabled, that must feed into the base hash
  • We use RSA for sharing key-shares. Ideally ElGamal would be used, however it requires different parameters than the rest of the election.

Contributing

Help defend democracy and contribute to the project.

electionguard-c's People

Contributors

addressxception avatar dmwit avatar echumley-msft avatar electionguard avatar jldodds avatar justinleet avatar keithrfung avatar pamtaro avatar raulgarciamsft avatar stock1218 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

electionguard-c's Issues

Standardize message serialization

Feature Request

Is your feature request related to a problem? Please describe.
Currently message serialization is done using a proprietary (but lightweight) mechanism for allocating memory and serializing objects into the memory space. While this is useful for working with the library internally, it requires consumers to implement the serialization protocol manually.

Describe the solution you'd like
Serialize messages internally and externally to a standardized format that can be easily consumed from other languages. Ideally serialization should be lightweight and fast.

Some alternatives include: messagepack, protobuf, BSON, etc.

Describe alternatives you've considered
building a custom serializer & implementations in common languages

Demonstrate Error case handling

Feature Request

Is your feature request related to a problem? Please describe.
Error cases when interacting with the library are not shown in the api sample

Describe the solution you'd like
add example tests that show error cases and what to do

Passing only Threshold amount of Trustees causes crash

Bug Report

Current Behavior
If only the threshold amount of trustees is passed in, application crashes.

The call to the tallyvotes method needs to send over all the trusteeKeys in the 2nd parameter (not just the ones that are present) and the 3rd parameter represents the number of trustees that are actually present for the decryption. (w/ threshold already set in the api config sent in the 1st parameter) So with this set up, the an API will have to do the actual validation that the number of trustees announced has reached the appropriate threshold number before calling the TallyVotes method

Expected behavior/code
Only the threshold amount of trustees should be necessary for encryption and application should not crash.

Expose a create election function

This is to resolve CSharp issue with Mac and Linux.

create_election or similar named function should complete the entire key_ceremony and return all the details of the election.
Parameters
Configuration containing:
Number of Trustees
Threshold
Other Election Metadata

Return
Number of Trustees (optional)
Threshold (optional)
Array of Serialized Private Trustee Keys w/ RSA keys
Serialized Joint Public Key
BaseHash

Encrypt Multiple Ballot Styles

Feature Request

Is your feature request related to a problem? Please describe.

As an Encrypter I would like to encrypt multiple ballot styles. While theoretically support for multiple ballot styles already exists, it is likely that the api example and current workflow do not support multiple ballot styles. Currently there are places in the code that require num_selections to be provided for comparison operations on encrypted ballots.

Describe the solution you'd like

This issue is to verify that an encrypter can encrypt multiple ballot styles and that the decryption ceremony can decrypt multiple ballot styles correctly.

Acceptance Criteria

  1. Create an election with multiple ballot styles
  2. encrypt ballots of style 1, 2 .. n, ensuring that at least once contest is present on more than one style
  3. Decrypt all ballots

Expected: the tally matches the expected tally

Handling Absentee Ballot

When id's are brought in, there should be an array of cast absentee ballots. These ballots should then return a denotation on the tracker or a list of the absentee trackers to ensure that there is a way to denote an absentee tracker as an absentee ballot.

Version should be settable

Generic Issue

Description
Version is not settable in project.

Possible Solution

  • VERSION file should exist in source
  • CMakeLists should use said VERSION file to set the version of the project
  • GitHub Release workflow should use this to set the Release tag

Additional context/Screenshots

Windows build fails to install make

Bug Report

Current Behavior
GitHub Workflow fails to install make

Expected behavior/code
make is already pre-installed so make should not be installed.

Environment

  • OS: Windows
  • Version: 0.0.1

Possible Solution
Remove make at the end of gcc and gmp install on Windows workflow

Add Code Style Guidelines and Linter/Formatter

Feature Request

Is your feature request related to a problem? Please describe.
File formatting is inconsistent in the code which reduces readability. We should enforce code style guidelines with a tool

Describe the solution you'd like
Adding a linter or formatter to the CI pipeline and that can be executed locally.

Binaries committed to repository

The repository has several compiled binaries committed including:
src/electionguard/a.out
src/electionguard/voting/a.out
src/electionguard/uint4096.h.gch

Additionally generated header
src/electionguard/random_source.h is included.

Suspect if statement

if(mpz_cmp(a,max_decryption) == 0){
return false;
}

The tabbing of these lines seems weird. Here they are in context.

while (!(0 == mpz_cmp(powmod, a)))
{
mpz_add_ui(result, result, 1);
mul_mod_p(powmod, powmod, generator);
#ifdef DEBUG_PRINT
print_base16(powmod);
#endif
if(mpz_cmp(a,max_decryption) == 0){
return false;
}
}

You'll also notice that the while loop does not modify either a or max_decryption, making these lines of code even more suspect.

Expose ballot function(s) for printer

Expose ballot functions that can be used by printer/encrypter to get necessary information for ballot.

These can be seperate calls or combined into a single one if the Test Case passes.

  • Encrypt Ballot - Call the encrypt ballot function
  • CreateId - Create a unique id for the ballot that is not the tracker
  • GetTracker - Get the tracker id for the ballot

The encrypted ballot will have to work with card #35

Test
Ensure that if new encrypters are made per call that two encrypters can't create the same exact tracker.

Add Unit Test Framework

Feature Request

Is your feature request related to a problem? Please describe.
The current testing pattern involves using cmake test to execute the examples/simple and examples/api programs respectively. While this is useful for demonstrating the workflow of executing an election, it does not easily demonstrate the expectations of individual functions, particularly the encryption and decryption processes.

Describe the solution you'd like
Choose a common, actively maintained, and lightweight unit testing framework for C and add initial unit tests to test both high level and low level API's that demonstrate a pattern contributors should use when adding tests. A sufficient unit test framework should demonstrate a common testing paradigm such as setup, teardown, and test_<description>

Describe alternatives you've considered
Another alternative would be to build a basic testing framework from scratch. For a variety of reasons it may be better to source a solution from the community.

Teachability, Documentation, Adoption, Migration Strategy
Ideally consumers of this library would be able to execute the existing example applications to demonstrate a complete working sample; but also execute individual tests to verify specific steps of the process.

Interact with SDK without writing to file system

Generic Issue

  • Ensure this issue is not a bug report or feature request

Description

As a consumer of this library I would like to be able to conduct each of the election functions without having to store files on the file system. I would like to be able to handle data storage concerns in the application layer so that I can store my data in any format I like (such as in a database). I would like to know that the API's I call are not writing election state artifacts to disk.

Possible Solution

One possible solution is to provide alternative API's for any existing API that writes disk state. The existing api's should expect a file system path as a parameter, while the new api's could either expect a pointer to memory that can be populated with the state information, or they could return a representation of the state information that would have been written to disk.

Additional context/Screenshots

Additionally, the existing API's that use the file system could be deprecated

API_EncryptBallot accepts string identifier

Feature Request

Is your feature request related to a problem? Please describe.
Currently the API_EncryptBallot method expects a uint64. A uint64 is likely not sufficiently large enough to prevent collisions in an arbitrarily large election. Furthermore the context of this value is external to the library and is used only for associating an external unique identifier with the ballot tracking id.

Describe the solution you'd like
This identifier could be a string or byte array to improve flexibility of this field

Extracting the crypto library from EGuard

Hi Folks,

I want to extract the Beneloh cryptolibrary from your Election Guard. Basically, my final goal is to generate keys, encrypt a uint, do proofs, and decrypt the values. While for the encryption I think I have extracted the proper code, I am not able to do the same for the decryption. Can you please help me? The code I wrote 'till now is the following. Can you also check that I am on the right track. Thank you guys.

`

Crypto_parameters_new();
raw_hash initialized_hash = {0, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                             0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

struct KeyCeremony_Trustee_generate_key_r result;

// Generate the keypair
struct Crypto_gen_keypair_r crypto_result =
    Crypto_gen_keypair(THRESHOLD, initialized_hash);
result.status = KEYCEREMONY_TRUSTEE_SUCCESS;

// check that we generated good proofs (right now this call crashes if the proofs fail)
if (!Crypto_check_keypair_proof(crypto_result.public_key, base_hash_code))
{
    xprintf("\nKeyCeremony_Trustee_generate_key: Crypto_check_keypair_proof - FAILED!\n");
}
switch (crypto_result.status)
{
case CRYPTO_INSUFFICIENT_MEMORY:
    result.status = KEYCEREMONY_TRUSTEE_INSUFFICIENT_MEMORY;
    break;
case CRYPTO_IO_ERROR:
    result.status = KEYCEREMONY_TRUSTEE_IO_ERROR;
    break;
case CRYPTO_SUCCESS:
    break;
default:
    //@ assert false;
    xprintf("default");
};

Crypto_rsa_public_key_new(&rsa_pk);
Crypto_rsa_private_key_new(&rsa_vk);

// Generate the RSA keys
generate_keys(&rsa_vk, &rsa_pk);

if (result.status == KEYCEREMONY_TRUSTEE_SUCCESS)
{
    xprintf("Generated public key\n");
    xprintf("Generated private key\n");
}

mpz_t nonce, aggregate_nonce;
mpz_init(nonce);
mpz_init(aggregate_nonce);
struct encryption_rep encrypted_res;
Crypto_encryption_rep_new(&encrypted_res);

struct RandomSource_new_r rs = RandomSource_new();
RandomSource source = rs.source;

mpz_t num2enc;
mpz_init(num2enc);
mpz_set_ui(num2enc, 1234);

struct joint_public_key_rep joint_key;
Crypto_joint_public_key_init(&joint_key);
Crypto_generate_joint_public_key(&joint_key, &crypto_result.public_key, 1);

Crypto_encrypt(
    &encrypted_res,
    nonce,
    source,
    &joint_key,
    num2enc);

`

📃 Add valgrind to C library release workflow

We should incorporate valgrind into the CI/CD release workflow.

in order to keep the test short, it should run on a minimal data set (e.g. 2-3 ballots with 3-6 selections each

the output should be cached as a build artifact somewhere that is easy to access

Handling the Zero Tally test case

Feature Request

Is your feature request related to a problem? Please describe.
The file system needs to handle when there are zero files present or zero tallies present. This is a common test case. This effectively ripples through the repos in the ability to handle this.

pow_mod_q TRACE_PRINT is incorrect

Bug Report

Current Behavior
pow_mod_q uses p rather than q in two places. Clearly a copy/paste error.

Expected behavior/code

void pow_mod_q(mpz_t res, const mpz_t base, const mpz_t exp)
{
    mpz_powm(res, base, exp, q);

    TRACE_PRINT(("Performing operation powmod (base^exp)%%p"));
    TRACE_PRINT(("\nbase = "));
    print_base16(base);
    TRACE_PRINT(("\nexp = "));
    print_base16(exp);
    TRACE_PRINT(("\np = "));
    print_base16(p);
    TRACE_PRINT(("\nresult = "));
    print_base16(res);
    TRACE_PRINT(("\n"));
}

Should be

void pow_mod_q(mpz_t res, const mpz_t base, const mpz_t exp)
{
    mpz_powm(res, base, exp, q);

    TRACE_PRINT(("Performing operation powmod (base^exp)%%q"));
    TRACE_PRINT(("\nbase = "));
    print_base16(base);
    TRACE_PRINT(("\nexp = "));
    print_base16(exp);
    TRACE_PRINT(("\np = "));
    print_base16(q);
    TRACE_PRINT(("\nresult = "));
    print_base16(res);
    TRACE_PRINT(("\n"));
}

Expose record ballot function

At the top level, recordballot function will take an array of castBallotIds and an array of spoiltBallotIds and the encryptedBallots. This function will need to allow for the API to pass all these ballots in so they can be :

  • Registered
  • Cast or Spoiled Based on Id
    Then the Voting Results file can be exported at end of session

Return:

  • Success
  • Voting results file path
  • Voting results file name

Save Test Run artifacts

Feature Request

As a developer i would like artifacts generated from running the api example (encrypter ballots, registered ballots, tallies, and public keys, etc.) to be included in the build output so that i can process the results of a specific build out of band of executing the code.

This would support running validators and other consumers of test election data without having to manually run a build on a local machine

Cache encryption proofs for verification

Bug Report

Current Behavior
When provisioning trustees, encrypting ballots, and decrypting tallies, proofs are generated and checked in memory but they are not persisted for use when publishing for verification

Expected behavior/code
Proofs should be persisted for use with election verifiers

Environment
all

Possible Solution
cache the proofs using the same mechanism as used for each data type (e.g. the file system)

Nonce generation incorrect

I understand that this repository is deprecated, but we did find one last issue by using Cryptol and SAW, and I guess it's possible that the same issue exists in the newer Python code, but we don't have plans to analyze that. So, just in case, here is the bug --

The correctness of the ElectionGuard system relies on a random nonce being generated in Z q. Instead, the nonce that's generated is a random 4096-bit number.

Specifically, Crypto_encrypt in crypto.c generates the nonce using RandomSource_uniform_bignum_o when (we guess) it should be using RandomSource_uniform_bignum_o_q.

We've identified this issue, but we have not ruled out that this same kind of error isn't also happening elsewhere, so it might be worthwhile to take a second look at nonce generation over the whole codebase.

Frama-C Analyser revealed undefined behaviours in examples/api/main.c

Undefined behaviours: possible NULL pointer dereference and non-standard declaration of VLA of size 0.

Hello,

I ran electionguard-c under Frama-C today and the analyser has revealed two possible undefined behaviours and/or non-standard practices in examples/api/main.c that I would like to report to you.

Null pointer dereferenced

local_time = localtime(&now);
if (local_time == 0)
{
ok = false;
}
sprintf(encrypted_output_prefix, "%s_%d_%d_%d", "encrypted-ballots",
local_time->tm_year + 1900, local_time->tm_mon + 1, local_time->tm_mday);

Here you can see that localtime() function may return a NULL pointer that gets dereferenced in the next call to snprintf()

Possible patch

Adding a ternary operator for each dereferencing of variable local_time in the call to snprintf checking the validity of that pointer and, if it isn't, passing a default value to snprintf() instead of invalid local_time:

sprintf(encrypted_output_prefix, "%s_%d_%d_%d", "encrypted-ballots", 
        (local_time ? local_time->tm_year + 1900 : -1), 
             (local_time ? local_time->tm_mon + 1 : -1),
                   (local_time ? local_time->tm_mday : -1));

VLA of size 0 is non-standard

char *casted_trackers[current_cast_index];

The analyser has revealed that there exist execution traces where variable current_cast_index is equal to 0 when this statement is reached while ISO 9899:2011 6.7.6.2 states:

If the expression is a constant expression, it shall have a value greater than zero.

As I'm not very familiar with the code it would take me to much time to offer a decent possible fix, i felt you should know about it nevertheless.

RSA Key Resolution

Problem

The current SDK Implementation generates RSA Public and Private keys for Trustees. There is no way for a trustee to provide their own RSA Private key

Acceptance Criteria

A trustee is able to provide their own RSA security context instead of having one generated for them.

Sanity check file system artifacts

Feature Request

Is your feature request related to a problem? Please describe.

When writing encrypted ballots out to the file system, a ballot id is written along with the encrypted ballot representation. When importing this file into the ballot registration process it is possible that the file could be erroneously modified.

Similarly, when writing out cast/spoiled ballots to the file system, the records are written with a representation fo the cast or spoil state. When importing this file into the decryption/tally votes process the file could be modified.

Describe the solution you'd like

We could provide a check when loading ballots from the file system that verifies the integrity of the data. When saving an encrypted ballot to the file system, we can save a sha2 hash made from the external ballot id and the encrypted ballot representation. By saving the hash in the file, we can verify on import that the data imported matches the hash in the file. Similarly we can save a hash of the cast/spoil state when writing registered ballots out to the file system.

Teachability, Documentation, Adoption, Migration Strategy

This solution is designed to be a sanity check on data corruption and clerical errors.

Expose tally votes function

Function should load Voting Results file based on name passed in. This should decrypt and tally the votes.

This could be seperate functions or a single function

  • Start Decryption
  • TrusteePresent()
  • TallyVotes()

This could also be done so that all the trustees are gathered ahead of time and this is a single call with all the keys available.

Return

  • Success
  • Tally Array ?
  • Tally Results Location
  • Tally Results File

Unified Result Code Exception Handling

Feature Request / Bug report

Is your feature request related to a problem? Please describe.
Currently each Coordinator maintains it's own list of enum values representing result codes. Additionally, the API_ endpoints return boolean results. The differences in the enum return values of the coodinator api's can lead to unexpected results.

Additionally, use of assert within the library itself can lead to inconsistent behavior on different platforms due to causing an unrecoverable segmentation fault.

Describe the solution you'd like

We should implement an explicit pattern for return values at each level and unify common success and exception scenarios.

The use of assert within library functions should instead be replaced with the unified exception paradigm. Exception cases where assertions currently fail should be reviewed for inconsistent application state and previous changes in the same call stack should be unwound or rolled back.

please refer to the discussion here

Teachability, Documentation, Adoption, Migration Strategy
Consider that exception handling can work across interop boundaries on some platforms but cannot be consistently applied across all target architectures. The Mono Project has a good discussion why this is the case.

Mono suggests that C/C++ exception cases should be wrapped into an out parameter so that consumers can "propagate" the exception case.

Azure Pipeline is redundant with Github Action

Generic Issue

Description
Azure Pipeline is unnecessary with addition of Github Action workflows

Possible Solution

  • Remove Azure Pipeline file to remove confusion going forward

Additional context/Screenshots
N/A

Fix return on RandomSouce_get_byte function

Bug Report

The RandomSource_get_byte function

uint8_t RandomSource_get_byte(RandomSource source)

in electionguard-c always returns number "1" on the Windows platform.
It is used in generate_keys
buffer[i] = RandomSource_get_byte(source) % 0xFF;

And so on.
This issue possibly allows disclosing Trustees' RSA keys. The behavior of the RandomSource_get_byte is obviously invalid.
src/electionguard/random_source.c:61
https://github.com/microsoft/electionguard-c|microsoft/electionguard-cmicrosoft/electionguard-c | Added by GitHub
src/electionguard/rsa.c:40
https://github.com/microsoft/electionguard-c|microsoft/electionguard-cmicrosoft/electionguard-c | Added by GitHub

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.