From a56407d27da6ebf63ae9817dc19587a0ae98ef4a Mon Sep 17 00:00:00 2001 From: Bob Beck Date: Fri, 8 Mar 2024 23:40:19 +0000 Subject: Revert "Add a Dilithium implementation." This reverts commit 9b34a3224062c456ff0d0b77fd9a34c5ad08dfea. Sadly this blow's up google3 because of stack usage being higher than google3's limits Change-Id: I8f1493a158e5fcab508593841ac3a37eb8404dcc Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/66847 Auto-Submit: Bob Beck Reviewed-by: David Benjamin Commit-Queue: David Benjamin --- include/openssl/experimental/dilithium.h | 114 ------------------------------- 1 file changed, 114 deletions(-) delete mode 100644 include/openssl/experimental/dilithium.h (limited to 'include') diff --git a/include/openssl/experimental/dilithium.h b/include/openssl/experimental/dilithium.h deleted file mode 100644 index ec78596..0000000 --- a/include/openssl/experimental/dilithium.h +++ /dev/null @@ -1,114 +0,0 @@ -/* Copyright (c) 2023, Google LLC - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - -#ifndef OPENSSL_HEADER_DILITHIUM_H -#define OPENSSL_HEADER_DILITHIUM_H - -#include - -#if defined(__cplusplus) -extern "C" { -#endif - - -// Dilithium3. - - -// DILITHIUM_private_key contains a Dilithium3 private key. The contents of this -// object should never leave the address space since the format is unstable. -struct DILITHIUM_private_key { - union { - uint8_t bytes[32 + 32 + 64 + 256 * 4 * (5 + 6 + 6)]; - uint32_t alignment; - } opaque; -}; - -// DILITHIUM_public_key contains a Dilithium3 public key. The contents of this -// object should never leave the address space since the format is unstable. -struct DILITHIUM_public_key { - union { - uint8_t bytes[32 + 64 + 256 * 4 * 6]; - uint32_t alignment; - } opaque; -}; - -// DILITHIUM_PRIVATE_KEY_BYTES is the number of bytes in an encoded Dilithium3 -// private key. -#define DILITHIUM_PRIVATE_KEY_BYTES 4032 - -// DILITHIUM_PUBLIC_KEY_BYTES is the number of bytes in an encoded Dilithium3 -// public key. -#define DILITHIUM_PUBLIC_KEY_BYTES 1952 - -// DILITHIUM_SIGNATURE_BYTES is the number of bytes in an encoded Dilithium3 -// signature. -#define DILITHIUM_SIGNATURE_BYTES 3309 - -// DILITHIUM_generate_key generates a random public/private key pair, writes the -// encoded public key to |out_encoded_public_key| and sets |out_private_key| to -// the private key. -OPENSSL_EXPORT void DILITHIUM_generate_key( - uint8_t out_encoded_public_key[DILITHIUM_PUBLIC_KEY_BYTES], - struct DILITHIUM_private_key *out_private_key); - -// DILITHIUM_sign generates a signature for the message |msg| of length -// |msg_len| using |private_key| following the randomized algorithm, and writes -// the encoded signature to |out_encoded_signature|. -OPENSSL_EXPORT void DILITHIUM_sign( - uint8_t out_encoded_signature[DILITHIUM_SIGNATURE_BYTES], - const struct DILITHIUM_private_key *private_key, const uint8_t *msg, - size_t msg_len); - -// DILITHIUM_verify verifies that |encoded_signature| constitutes a valid -// signature for the message |msg| of length |msg_len| using |public_key|. -OPENSSL_EXPORT int DILITHIUM_verify( - const struct DILITHIUM_public_key *public_key, - const uint8_t encoded_signature[DILITHIUM_SIGNATURE_BYTES], - const uint8_t *msg, size_t msg_len); - - -// Serialisation of keys. - -// DILITHIUM_marshal_public_key serializes |public_key| to |out| in the standard -// format for Dilithium public keys. It returns one on success or zero on -// allocation error. -OPENSSL_EXPORT int DILITHIUM_marshal_public_key( - CBB *out, const struct DILITHIUM_public_key *public_key); - -// DILITHIUM_parse_public_key parses a public key, in the format generated by -// |DILITHIUM_marshal_public_key|, from |in| and writes the result to -// |out_public_key|. It returns one on success or zero on parse error or if -// there are trailing bytes in |in|. -OPENSSL_EXPORT int DILITHIUM_parse_public_key( - struct DILITHIUM_public_key *public_key, CBS *in); - -// DILITHIUM_marshal_private_key serializes |private_key| to |out| in the -// standard format for Dilithium private keys. It returns one on success or zero -// on allocation error. -OPENSSL_EXPORT int DILITHIUM_marshal_private_key( - CBB *out, const struct DILITHIUM_private_key *private_key); - -// DILITHIUM_parse_private_key parses a private key, in the format generated by -// |DILITHIUM_marshal_private_key|, from |in| and writes the result to -// |out_private_key|. It returns one on success or zero on parse error or if -// there are trailing bytes in |in|. -OPENSSL_EXPORT int DILITHIUM_parse_private_key( - struct DILITHIUM_private_key *private_key, CBS *in); - - -#if defined(__cplusplus) -} // extern C -#endif - -#endif // OPENSSL_HEADER_DILITHIUM_H -- cgit v1.1