ECJPAKE.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017-2018, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
529 #ifndef ti_drivers_ECJPAKE__include
530 #define ti_drivers_ECJPAKE__include
531 
532 #ifdef __cplusplus
533 extern "C" {
534 #endif
535 
536 #include <stdbool.h>
537 #include <stddef.h>
538 #include <stdint.h>
539 
542 
555 #define ECJPAKE_STATUS_RESERVED (-32)
556 
563 #define ECJPAKE_STATUS_SUCCESS (0)
564 
571 #define ECJPAKE_STATUS_ERROR (-1)
572 
581 #define ECJPAKE_STATUS_RESOURCE_UNAVAILABLE (-2)
582 
588 #define ECJPAKE_STATUS_INVALID_PUBLIC_KEY (-3)
589 
596 #define ECJPAKE_STATUS_PUBLIC_KEY_NOT_ON_CURVE (-4)
597 
605 #define ECJPAKE_STATUS_PUBLIC_KEY_LARGER_THAN_PRIME (-5)
606 
613 #define ECJPAKE_STATUS_POINT_AT_INFINITY (-6)
614 
621 #define ECJPAKE_STATUS_INVALID_PRIVATE_KEY (-7)
622 
629 #define ECJPAKE_STATUS_INVALID_PRIVATE_V (-8)
630 
634 #define ECJPAKE_STATUS_CANCELED (-9)
635 
640 
678 
690 typedef struct ECJPAKE_Config_ {
692  void *object;
693 
695  void const *hwAttrs;
697 
756 
773  const uint8_t *hash;
777  uint8_t *r;
781 
802  const uint8_t *hash;
805  const uint8_t *r;
809 
879 
907 
908 
912 typedef union ECJPAKE_Operation_ {
919 
930 
949 typedef void (*ECJPAKE_CallbackFxn) (ECJPAKE_Handle handle,
950  int_fast16_t returnStatus,
951  ECJPAKE_Operation operation,
952  ECJPAKE_OperationType operationType);
953 
962 typedef struct ECJPAKE_Params_ {
965  uint32_t timeout;
968  void *custom;
972 
981 void ECJPAKE_init(void);
982 
992 
1002 
1012 
1022 
1023 
1033 
1043 void ECJPAKE_close(ECJPAKE_Handle handle);
1044 
1062 ECJPAKE_Handle ECJPAKE_open(uint_least8_t index, ECJPAKE_Params *params);
1063 
1076 void ECJPAKE_Params_init(ECJPAKE_Params *params);
1077 
1095 int_fast16_t ECJPAKE_roundOneGenerateKeys(ECJPAKE_Handle handle, ECJPAKE_OperationRoundOneGenerateKeys *operation);
1096 
1123 int_fast16_t ECJPAKE_generateZKP(ECJPAKE_Handle handle, ECJPAKE_OperationGenerateZKP *operation);
1124 
1141 int_fast16_t ECJPAKE_verifyZKP(ECJPAKE_Handle handle, ECJPAKE_OperationVerifyZKP *operation);
1142 
1160 int_fast16_t ECJPAKE_roundTwoGenerateKeys(ECJPAKE_Handle handle, ECJPAKE_OperationRoundTwoGenerateKeys *operation);
1161 
1182 int_fast16_t ECJPAKE_computeSharedSecret(ECJPAKE_Handle handle, ECJPAKE_OperationComputeSharedSecret *operation);
1183 
1196 int_fast16_t ECJPAKE_cancelOperation(ECJPAKE_Handle handle);
1197 
1198 #ifdef __cplusplus
1199 }
1200 #endif
1201 
1202 #endif /* ti_drivers_ECJPAKE__include */
const CryptoKey * myPrivateKey2
Definition: ECJPAKE.h:817
enum ECJPAKE_OperationType_ ECJPAKE_OperationType
Enum for the operation types supported by the driver.
CryptoKey * myPrivateV
Definition: ECJPAKE.h:862
ECJPAKE_OperationComputeSharedSecret * computeSharedSecret
Definition: ECJPAKE.h:917
ECJPAKE_OperationRoundOneGenerateKeys * generateRoundOneKeys
Definition: ECJPAKE.h:913
const CryptoKey * theirPublicKey2
Definition: ECJPAKE.h:894
const ECCParams_CurveParams * curve
Definition: ECJPAKE.h:786
The CryptoKey type is an opaque representation of a cryptographic key.
const uint8_t * hash
Definition: ECJPAKE.h:773
void * custom
Definition: ECJPAKE.h:968
CryptoKey * myCombinedPrivateKey
Definition: ECJPAKE.h:854
Struct containing the parameters required to generate a ZKP.
Definition: ECJPAKE.h:760
int_fast16_t ECJPAKE_computeSharedSecret(ECJPAKE_Handle handle, ECJPAKE_OperationComputeSharedSecret *operation)
Computes the shared secret.
void ECJPAKE_OperationVerifyZKP_init(ECJPAKE_OperationVerifyZKP *operation)
Function to initialize an ECJPAKE_OperationVerifyZKP struct to its defaults.
void ECJPAKE_close(ECJPAKE_Handle handle)
Function to close an ECJPAKE peripheral specified by the ECJPAKE handle.
struct ECJPAKE_OperationComputeSharedSecret_ ECJPAKE_OperationComputeSharedSecret
Struct containing the parameters required to compute the shared secret.
void ECJPAKE_OperationRoundOneGenerateKeys_init(ECJPAKE_OperationRoundOneGenerateKeys *operation)
Function to initialize an ECJPAKE_OperationRoundOneGenerateKeys struct to its defaults.
CryptoKey * myPublicV2
Definition: ECJPAKE.h:746
CryptoKey datastructure.
Definition: CryptoKey.h:210
Definition: ECJPAKE.h:673
struct ECJPAKE_OperationGenerateZKP_ ECJPAKE_OperationGenerateZKP
Struct containing the parameters required to generate a ZKP.
int_fast16_t ECJPAKE_roundTwoGenerateKeys(ECJPAKE_Handle handle, ECJPAKE_OperationRoundTwoGenerateKeys *operation)
Generates all public and private keying material for the first round of the EC-JPAKE scheme...
struct ECJPAKE_Config_ ECJPAKE_Config
ECJPAKE Global configuration.
void ECJPAKE_OperationRoundTwoGenerateKeys_init(ECJPAKE_OperationRoundTwoGenerateKeys *operation)
Function to initialize an ECJPAKE_OperationRoundTwoGenerateKeys struct to its defaults.
int_fast16_t ECJPAKE_cancelOperation(ECJPAKE_Handle handle)
Cancels an ongoing ECJPAKE operation.
const CryptoKey * myPublicKey1
Definition: ECJPAKE.h:821
const CryptoKey * myPrivateKey
Definition: ECJPAKE.h:764
CryptoKey * myPublicKey1
Definition: ECJPAKE.h:713
const CryptoKey * theirGenerator
Definition: ECJPAKE.h:789
ECJPAKE_OperationType_
Enum for the operation types supported by the driver.
Definition: ECJPAKE.h:923
ECJPAKE Parameters.
Definition: ECJPAKE.h:962
CryptoKey * myPublicV1
Definition: ECJPAKE.h:737
union ECJPAKE_Operation_ ECJPAKE_Operation
Union containing pointers to all supported operation structs.
const uint8_t * hash
Definition: ECJPAKE.h:802
void * object
Definition: ECJPAKE.h:692
CryptoKey * myPrivateV2
Definition: ECJPAKE.h:730
A structure containing the parameters of an elliptic curve in short Weierstrass form.
Definition: ECCParams.h:111
void(* ECJPAKE_CallbackFxn)(ECJPAKE_Handle handle, int_fast16_t returnStatus, ECJPAKE_Operation operation, ECJPAKE_OperationType operationType)
The definition of a callback function used by the ECJPAKE driver when used in ECJPAKE_RETURN_BEHAVIOR...
Definition: ECJPAKE.h:949
const ECCParams_CurveParams * curve
Definition: ECJPAKE.h:761
CryptoKey * myNewGenerator
Definition: ECJPAKE.h:848
uint32_t timeout
Definition: ECJPAKE.h:965
CryptoKey * theirNewGenerator
Definition: ECJPAKE.h:842
int_fast16_t ECJPAKE_verifyZKP(ECJPAKE_Handle handle, ECJPAKE_OperationVerifyZKP *operation)
Verifies a Schnorr Zero-Knowledge Proof (ZKP) signature.
void ECJPAKE_init(void)
This function initializes the ECJPAKE module.
Definition: ECJPAKE.h:669
CryptoKey * myCombinedPublicKey
Definition: ECJPAKE.h:859
uint8_t * r
Definition: ECJPAKE.h:777
const ECCParams_CurveParams * curve
Definition: ECJPAKE.h:884
Definition: ECJPAKE.h:663
struct ECJPAKE_OperationRoundOneGenerateKeys_ ECJPAKE_OperationRoundOneGenerateKeys
Struct containing the parameters required to generate the first round of keys.
int_fast16_t ECJPAKE_generateZKP(ECJPAKE_Handle handle, ECJPAKE_OperationGenerateZKP *operation)
Generates the r component of a Schnorr Zero-Knowledge Proof (ZKP) signature.
ECJPAKE Global configuration.
Definition: ECJPAKE.h:690
void const * hwAttrs
Definition: ECJPAKE.h:695
const CryptoKey * theirPublicKey1
Definition: ECJPAKE.h:827
const CryptoKey * preSharedSecret
Definition: ECJPAKE.h:833
const CryptoKey * myCombinedPrivateKey
Definition: ECJPAKE.h:887
Struct containing the parameters required to generate the second round keys.
Definition: ECJPAKE.h:813
const CryptoKey * myPrivateV
Definition: ECJPAKE.h:768
Struct containing the parameters required to compute the shared secret.
Definition: ECJPAKE.h:883
void ECJPAKE_Params_init(ECJPAKE_Params *params)
Function to initialize the ECJPAKE_Params struct to its defaults.
ECJPAKE_OperationVerifyZKP * verifyZKP
Definition: ECJPAKE.h:915
ECJPAKE_CallbackFxn callbackFxn
Definition: ECJPAKE.h:964
const ECCParams_CurveParams * curve
Definition: ECJPAKE.h:814
ECJPAKE_OperationRoundTwoGenerateKeys * generateRoundTwoKeys
Definition: ECJPAKE.h:916
Struct containing the parameters required to verify a ZKP.
Definition: ECJPAKE.h:785
ECJPAKE_ReturnBehavior_
The way in which ECJPAKE function calls return after performing an encryption + authentication or dec...
Definition: ECJPAKE.h:662
CryptoKey * myPublicKey2
Definition: ECJPAKE.h:718
int_fast16_t ECJPAKE_roundOneGenerateKeys(ECJPAKE_Handle handle, ECJPAKE_OperationRoundOneGenerateKeys *operation)
Generates all public and private keying material for the first round of the EC-JPAKE scheme...
enum ECJPAKE_ReturnBehavior_ ECJPAKE_ReturnBehavior
The way in which ECJPAKE function calls return after performing an encryption + authentication or dec...
struct ECJPAKE_OperationVerifyZKP_ ECJPAKE_OperationVerifyZKP
Struct containing the parameters required to verify a ZKP.
const uint8_t * r
Definition: ECJPAKE.h:805
const CryptoKey * myPublicKey2
Definition: ECJPAKE.h:824
Definition: ECJPAKE.h:926
struct ECJPAKE_Config_ * ECJPAKE_Handle
A handle that is returned from an ECJPAKE_open() call.
Definition: ECJPAKE.h:639
struct ECJPAKE_Params_ ECJPAKE_Params
ECJPAKE Parameters.
ECJPAKE_ReturnBehavior returnBehavior
Definition: ECJPAKE.h:963
const CryptoKey * myPrivateKey2
Definition: ECJPAKE.h:899
CryptoKey * sharedSecret
Definition: ECJPAKE.h:903
const ECCParams_CurveParams * curve
Definition: ECJPAKE.h:702
ECJPAKE_OperationGenerateZKP * generateZKP
Definition: ECJPAKE.h:914
Union containing pointers to all supported operation structs.
Definition: ECJPAKE.h:912
const CryptoKey * theirPublicKey2
Definition: ECJPAKE.h:830
CryptoKey * myPublicV
Definition: ECJPAKE.h:869
const CryptoKey * theirCombinedPublicKey
Definition: ECJPAKE.h:891
const CryptoKey * theirPublicV
Definition: ECJPAKE.h:799
const CryptoKey * theirPublicKey
Definition: ECJPAKE.h:795
CryptoKey * myPrivateKey1
Definition: ECJPAKE.h:705
Struct containing the parameters required to generate the first round of keys.
Definition: ECJPAKE.h:701
struct ECJPAKE_OperationRoundTwoGenerateKeys_ ECJPAKE_OperationRoundTwoGenerateKeys
Struct containing the parameters required to generate the second round keys.
CryptoKey * myPrivateKey2
Definition: ECJPAKE.h:709
CryptoKey * myPrivateV1
Definition: ECJPAKE.h:723
ECJPAKE_Handle ECJPAKE_open(uint_least8_t index, ECJPAKE_Params *params)
This function opens a given ECJPAKE peripheral.
void ECJPAKE_OperationGenerateZKP_init(ECJPAKE_OperationGenerateZKP *operation)
Function to initialize an ECJPAKE_OperationGenerateZKP struct to its defaults.
Definition: ECJPAKE.h:925
void ECJPAKE_OperationComputeSharedSecret_init(ECJPAKE_OperationComputeSharedSecret *operation)
Function to initialize an ECJPAKE_OperationComputeSharedSecret struct to its defaults.
© Copyright 1995-2018, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale