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
21 #include <epid/member/api.h>
22
23 #include <string.h>
24 #include "epid/common/types.h"
25 #include "epid/member/src/context.h"
26
EpidProvisionCompressed(MemberCtx * ctx,GroupPubKey const * pub_key,CompressedPrivKey const * compressed_privkey,MemberPrecomp const * precomp_str)27 EpidStatus EpidProvisionCompressed(MemberCtx* ctx, GroupPubKey const* pub_key,
28 CompressedPrivKey const* compressed_privkey,
29 MemberPrecomp const* precomp_str) {
30 EpidStatus sts = kEpidErr;
31 PrivKey priv_key;
32 if (!pub_key || !compressed_privkey || !ctx) {
33 return kEpidBadArgErr;
34 }
35 sts = EpidDecompressPrivKey(pub_key, compressed_privkey, &priv_key);
36 if (sts != kEpidNoErr) {
37 return sts;
38 }
39 sts = EpidProvisionKey(ctx, pub_key, &priv_key, precomp_str);
40 return sts;
41 }
42