/* * Copyright 2002-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */#include<string.h>#include"ec_local.h"#include<openssl/err.h>#include<openssl/asn1t.h>#include<openssl/objects.h>#include"internal/nelem.h"intEC_GROUP_get_basis_type(constEC_GROUP*group){inti;if(EC_METHOD_get_field_type(EC_GROUP_method_of(group))!=NID_X9_62_characteristic_two_field)/* everything else is currently not supported */return0;/* Find the last non-zero element of group->poly[] */for(i=0;i<(int)OSSL_NELEM(group->poly)&&group->poly[i]!=0;i++)continue;if(i==4)returnNID_X9_62_ppBasis;elseif(i==2)returnNID_X9_62_tpBasis;else/* everything else is currently not supported */return0;}#ifndef OPENSSL_NO_EC2MintEC_GROUP_get_trinomial_basis(constEC_GROUP*group,unsignedint*k){if(group==NULL)return0;if(EC_METHOD_get_field_type(EC_GROUP_method_of(group))!=NID_X9_62_characteristic_two_field||!((group->poly[0]!=0)&&(group->poly[1]!=0)&&(group->poly[2]==0))){ECerr(EC_F_EC_GROUP_GET_TRINOMIAL_BASIS,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);return0;}if(k)*k=group->poly[1];return1;}intEC_GROUP_get_pentanomial_basis