Accepting request 1130982 from home:polslinux:teststuff

This library is needed to enable post quantum cryptography in bctoolbox, bzrtp and linphone.

OBS-URL: https://build.opensuse.org/request/show/1130982
OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/decaf?expand=0&rev=1
This commit is contained in:
Jan Engelhardt 2023-12-06 10:58:43 +00:00 committed by Git OBS Bridge
commit a9789e45bf
5 changed files with 206 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

3
decaf-1.0.2.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:37848412ce39159d6678e354bcb3e4967766af455dbd484e64a623fb21122b24
size 1136640

5
decaf.changes Normal file
View File

@ -0,0 +1,5 @@
-------------------------------------------------------------------
Thu Nov 9 06:59:27 UTC 2023 - Paolo Stivanin <info@paolostivanin.com>
- Initial OBS release.
- Add remove_unsafe_methods.patch.

89
decaf.spec Normal file
View File

@ -0,0 +1,89 @@
#
# spec file for package decaf
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define sover 0
Name: decaf
Version: 1.0.2
Release: 0
Summary: Ed448-Goldilocks-based elliptic curve cryptography library
License: MIT
URL: https://ed448goldilocks.sourceforge.io/
Source: %{name}-%{version}.tar.xz
Patch0: remove_unsafe_methods.patch
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: python3
%description
Ed448-Goldilocks is an Edwards-form elliptic curve proposed by
Michael Hamburg in 2015 and is suitable for fast cryptographic
operation with small keysizes
%package -n lib%{name}%{sover}
Summary: Ed448-Goldilocks-based elliptic curve cryptography library
Group: Development/Libraries/C and C++
%description -n lib%{name}%{sover}
Ed448-Goldilocks is an Edwards-form elliptic curve proposed by
Michael Hamburg in 2015 and is suitable for fast cryptographic
operation with small keysizes
%package -n lib%{name}-devel
Summary: Development files for libdecaf
Group: Development/Libraries/C and C++
Requires: lib%{name}%{sover} = %{version}
%description -n lib%{name}-devel
Development files for Ed448-Goldilocks, an Edwards-form elliptic
curve proposed by Michael Hamburg in 2015 and is suitable for
fast cryptographic operation with small keysizes
%prep
%autosetup -p1
%build
%cmake \
-DCMAKE_C_FLAGS="-Wno-sizeof-array-div -Wno-array-parameter" \
-DENABLE_STATIC=OFF \
-DENABLE_STRICT=OFF \
-Wno-dev
%cmake_build
%install
%cmake_install
%post -n lib%{name}%{sover} -p /sbin/ldconfig
%postun -n lib%{name}%{sover} -p /sbin/ldconfig
%files
%license LICENSE.txt
%doc HISTORY.txt README.md
%files -n lib%{name}%{sover}
%{_libdir}/lib%{name}.so.%{sover}
%files -n lib%{name}-devel
%{_libdir}/libdecaf.so
%dir %{_datadir}/decaf
%dir %{_datadir}/decaf/cmake
%{_datadir}/decaf/cmake/*
%dir %{_includedir}/%{name}
%{_includedir}/%{name}/*
%changelog

View File

@ -0,0 +1,86 @@
--- decaf-1.0.2/src/per_curve/eddsa.tmpl.h.orig 2022-07-13 14:44:55.000000000 +0200
+++ decaf-1.0.2/src/per_curve/eddsa.tmpl.h 2023-11-09 08:28:59.348542846 +0100
@@ -44,11 +44,6 @@
/** EdDSA decoding ratio. */
#define $(C_NS)_EDDSA_DECODE_RATIO ($(cofactor) / $(eddsa_encode_ratio))
-#ifndef DECAF_EDDSA_NON_KEYPAIR_API_IS_DEPRECATED
-/** If 1, add deprecation attribute to non-keypair API functions. Now deprecated. */
-#define DECAF_EDDSA_NON_KEYPAIR_API_IS_DEPRECATED 1
-#endif
-
/** @cond internal */
/** @brief Scheduled EdDSA keypair */
typedef struct decaf_eddsa_$(gf_shortname)_keypair_s {
@@ -112,71 +107,6 @@
) DECAF_NONNULL DECAF_NOINLINE;
/**
- * @brief EdDSA signing. However, this API is deprecated because it isn't safe: if the wrong
- * public key is passed, it would reveal the private key. Instead, this function checks that
- * the public key is correct, and otherwise aborts.
- *
- * @deprecated Use DECAF_API_VIS decaf_ed$(gf_shortname)_keypair_sign instead.
- *
- * @param [out] signature The signature.
- * @param [in] privkey The private key.
- * @param [in] pubkey The public key.
- * @param [in] message The message to sign.
- * @param [in] message_len The length of the message.
- * @param [in] prehashed Nonzero if the message is actually the hash of something you want to sign.
- * @param [in] context A "context" for this signature of up to 255 bytes.
- * @param [in] context_len Length of the context.
- *
- * @warning For Ed25519, it is unsafe to use the same key for both prehashed and non-prehashed
- * messages, at least without some very careful protocol-level disambiguation. For Ed448 it is
- * safe. The C++ wrapper is designed to make it harder to screw this up, but this C code gives
- * you no seat belt.
- */
-void DECAF_API_VIS decaf_ed$(gf_shortname)_sign (
- uint8_t signature[DECAF_EDDSA_$(gf_shortname)_SIGNATURE_BYTES],
- const uint8_t privkey[DECAF_EDDSA_$(gf_shortname)_PRIVATE_BYTES],
- const uint8_t pubkey[DECAF_EDDSA_$(gf_shortname)_PUBLIC_BYTES],
- const uint8_t *message,
- size_t message_len,
- uint8_t prehashed,
- const uint8_t *context,
- uint8_t context_len
-) __attribute__((nonnull(1,2,3))) DECAF_NOINLINE
-#if DECAF_EDDSA_NON_KEYPAIR_API_IS_DEPRECATED
- __attribute__((deprecated("Passing the pubkey and privkey separately is unsafe",
- "decaf_ed$(gf_shortname)_keypair_sign")))
-#endif
-;
-
-/**
- * @brief EdDSA signing with prehash. However, this API is deprecated because it isn't safe: if the wrong
- * public key is passed, it would reveal the private key. Instead, this function checks that
- * the public key is correct, and otherwise aborts.
- *
- * @deprecated Use DECAF_API_VIS decaf_ed$(gf_shortname)_keypair_sign_prehash instead.
- *
- * @param [out] signature The signature.
- * @param [in] privkey The private key.
- * @param [in] pubkey The public key.
- * @param [in] hash The hash of the message. This object will not be modified by the call.
- * @param [in] context A "context" for this signature of up to 255 bytes. Must be the same as what was used for the prehash.
- * @param [in] context_len Length of the context.
- */
-void DECAF_API_VIS decaf_ed$(gf_shortname)_sign_prehash (
- uint8_t signature[DECAF_EDDSA_$(gf_shortname)_SIGNATURE_BYTES],
- const uint8_t privkey[DECAF_EDDSA_$(gf_shortname)_PRIVATE_BYTES],
- const uint8_t pubkey[DECAF_EDDSA_$(gf_shortname)_PUBLIC_BYTES],
- const decaf_ed$(gf_shortname)_prehash_ctx_t hash,
- const uint8_t *context,
- uint8_t context_len
-) __attribute__((nonnull(1,2,3,4))) DECAF_NOINLINE
-#if DECAF_EDDSA_NON_KEYPAIR_API_IS_DEPRECATED
- __attribute__((deprecated("Passing the pubkey and privkey separately is unsafe",
- "decaf_ed$(gf_shortname)_keypair_sign_prehash")))
-#endif
-;
-
-/**
* @brief EdDSA signing.
*
* @param [out] signature The signature.