Path: blob/main/crypto/libecc/src/wycheproof_tests/libecc_wycheproof.h
34879 views
/*1* Copyright (C) 2021 - This file is part of libecc project2*3* Authors:4* Ryad BENADJILA <[email protected]>5* Arnaud EBALARD <[email protected]>6*7* This software is licensed under a dual BSD and GPL v2 license.8* See LICENSE file at the root folder of the project.9*/1011/*12* Source code for handling tests imported from the wycheproof project:13* https://github.com/google/wycheproof14*15* As this project primarily targets java cryptographic libraries, the16* json test files have been parsed to generate libecc friendly test cases.17*18* NOTE: we skip here all the tests related to ASN.1 format errors as libecc19* does not handle ASN.1 parsing at all. This explains the "skipped" tests from20* the wycheproof project.21*22*/2324#include <libecc/libsig.h>2526typedef struct {27/* Test case name */28const char *name;2930ec_alg_type sig_alg;3132hash_alg_type hash;3334/* Curve params */35const ec_str_params *curve;3637const unsigned char *pubkey;38unsigned int pubkeylen;3940const unsigned char *msg;41unsigned int msglen;4243const unsigned char *sig;44unsigned int siglen;4546int result;4748const char *comment;49} wycheproof_ecdsa_test;5051typedef struct {52/* Test case name */53const char *name;5455ec_alg_type sig_alg;5657hash_alg_type hash;5859/* Curve params */60const ec_str_params *curve;6162const unsigned char *pubkey;63unsigned int pubkeylen;6465const unsigned char *privkey;66unsigned int privkeylen;6768const unsigned char *msg;69unsigned int msglen;7071const unsigned char *sig;72unsigned int siglen;7374int result;7576const char *comment;77} wycheproof_eddsa_test;7879typedef struct {80/* Test case name */81const char *name;8283ec_alg_type xdh_alg;8485/* Curve params */86const ec_str_params *curve;8788const unsigned char *peerpubkey;89unsigned int peerpubkeylen;9091const unsigned char *ourpubkey;92unsigned int ourpubkeylen;9394const unsigned char *privkey;95unsigned int privkeylen;9697const unsigned char *sharedsecret;98unsigned int sharedsecretlen;99100int result;101102const char *comment;103} wycheproof_xdh_test;104105typedef struct {106/* Test case name */107const char *name;108109ec_alg_type ecdh_alg;110111/* Curve params */112const ec_str_params *curve;113114const unsigned char *peerpubkey;115unsigned int peerpubkeylen;116int compressed;117118const unsigned char *ourpubkey;119unsigned int ourpubkeylen;120121const unsigned char *privkey;122unsigned int privkeylen;123124const unsigned char *sharedsecret;125unsigned int sharedsecretlen;126127int result;128129const char *comment;130} wycheproof_ecdh_test;131132typedef struct {133/* Test case name */134const char *name;135136hash_alg_type hash;137138const unsigned char *key;139unsigned int keylen;140141const unsigned char *msg;142unsigned int msglen;143144const unsigned char *tag;145unsigned int taglen;146147int result;148149const char *comment;150} wycheproof_hmac_test;151152153