provision_compressed.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*############################################################################
  2. # Copyright 2017 Intel Corporation
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. ############################################################################*/
  16. /// EpidProvisionCompressed implementation.
  17. /*!
  18. * \file
  19. */
  20. #include <epid/member/api.h>
  21. #include <string.h>
  22. #include "epid/common/types.h"
  23. #include "epid/member/src/context.h"
  24. EpidStatus EpidProvisionCompressed(MemberCtx* ctx, GroupPubKey const* pub_key,
  25. CompressedPrivKey const* compressed_privkey,
  26. MemberPrecomp const* precomp_str) {
  27. EpidStatus sts = kEpidErr;
  28. PrivKey priv_key;
  29. if (!pub_key || !compressed_privkey || !ctx) {
  30. return kEpidBadArgErr;
  31. }
  32. sts = EpidDecompressPrivKey(pub_key, compressed_privkey, &priv_key);
  33. if (sts != kEpidNoErr) {
  34. return sts;
  35. }
  36. sts = EpidProvisionKey(ctx, pub_key, &priv_key, precomp_str);
  37. return sts;
  38. }