TianoCore EDK2 master
Loading...
Searching...
No Matches
BaseCryptLib.h
Go to the documentation of this file.
1
13#ifndef __BASE_CRYPT_LIB_H__
14#define __BASE_CRYPT_LIB_H__
15
16#include <Uefi/UefiBaseType.h>
17
18#define CRYPTO_NID_NULL 0x0000
19
20// Hash
21#define CRYPTO_NID_SHA256 0x0001
22#define CRYPTO_NID_SHA384 0x0002
23#define CRYPTO_NID_SHA512 0x0003
24
25// Key Exchange
26#define CRYPTO_NID_SECP256R1 0x0204
27#define CRYPTO_NID_SECP384R1 0x0205
28#define CRYPTO_NID_SECP521R1 0x0206
29#define CRYPTO_NID_BRAINPOOLP512R1 0x03A5
30
34#define MD5_DIGEST_SIZE 16
35
39#define SHA1_DIGEST_SIZE 20
40
44#define SHA256_DIGEST_SIZE 32
45
49#define SHA384_DIGEST_SIZE 48
50
54#define SHA512_DIGEST_SIZE 64
55
59#define SM3_256_DIGEST_SIZE 32
60
64#define TDES_BLOCK_SIZE 8
65
69#define AES_BLOCK_SIZE 16
70
74typedef enum {
84
85// =====================================================================================
86// One-Way Cryptographic Hash Primitives
87// =====================================================================================
88
89#ifdef ENABLE_MD5_DEPRECATED_INTERFACES
90
100UINTN
101EFIAPI
103 VOID
104 );
105
120BOOLEAN
121EFIAPI
122Md5Init (
123 OUT VOID *Md5Context
124 );
125
141BOOLEAN
142EFIAPI
144 IN CONST VOID *Md5Context,
145 OUT VOID *NewMd5Context
146 );
147
168BOOLEAN
169EFIAPI
170Md5Update (
171 IN OUT VOID *Md5Context,
172 IN CONST VOID *Data,
173 IN UINTN DataSize
174 );
175
198BOOLEAN
199EFIAPI
200Md5Final (
201 IN OUT VOID *Md5Context,
202 OUT UINT8 *HashValue
203 );
204
223BOOLEAN
224EFIAPI
226 IN CONST VOID *Data,
227 IN UINTN DataSize,
228 OUT UINT8 *HashValue
229 );
230
231#endif
232
233#ifndef DISABLE_SHA1_DEPRECATED_INTERFACES
234
244UINTN
245EFIAPI
247 VOID
248 );
249
264BOOLEAN
265EFIAPI
266Sha1Init (
267 OUT VOID *Sha1Context
268 );
269
285BOOLEAN
286EFIAPI
288 IN CONST VOID *Sha1Context,
289 OUT VOID *NewSha1Context
290 );
291
312BOOLEAN
313EFIAPI
315 IN OUT VOID *Sha1Context,
316 IN CONST VOID *Data,
317 IN UINTN DataSize
318 );
319
342BOOLEAN
343EFIAPI
344Sha1Final (
345 IN OUT VOID *Sha1Context,
346 OUT UINT8 *HashValue
347 );
348
367BOOLEAN
368EFIAPI
370 IN CONST VOID *Data,
371 IN UINTN DataSize,
372 OUT UINT8 *HashValue
373 );
374
375#endif
376
383UINTN
384EFIAPI
386 VOID
387 );
388
401BOOLEAN
402EFIAPI
404 OUT VOID *Sha256Context
405 );
406
422BOOLEAN
423EFIAPI
425 IN CONST VOID *Sha256Context,
426 OUT VOID *NewSha256Context
427 );
428
447BOOLEAN
448EFIAPI
450 IN OUT VOID *Sha256Context,
451 IN CONST VOID *Data,
452 IN UINTN DataSize
453 );
454
475BOOLEAN
476EFIAPI
478 IN OUT VOID *Sha256Context,
479 OUT UINT8 *HashValue
480 );
481
500BOOLEAN
501EFIAPI
503 IN CONST VOID *Data,
504 IN UINTN DataSize,
505 OUT UINT8 *HashValue
506 );
507
514UINTN
515EFIAPI
517 VOID
518 );
519
532BOOLEAN
533EFIAPI
535 OUT VOID *Sha384Context
536 );
537
553BOOLEAN
554EFIAPI
556 IN CONST VOID *Sha384Context,
557 OUT VOID *NewSha384Context
558 );
559
578BOOLEAN
579EFIAPI
581 IN OUT VOID *Sha384Context,
582 IN CONST VOID *Data,
583 IN UINTN DataSize
584 );
585
606BOOLEAN
607EFIAPI
609 IN OUT VOID *Sha384Context,
610 OUT UINT8 *HashValue
611 );
612
631BOOLEAN
632EFIAPI
634 IN CONST VOID *Data,
635 IN UINTN DataSize,
636 OUT UINT8 *HashValue
637 );
638
645UINTN
646EFIAPI
648 VOID
649 );
650
663BOOLEAN
664EFIAPI
666 OUT VOID *Sha512Context
667 );
668
684BOOLEAN
685EFIAPI
687 IN CONST VOID *Sha512Context,
688 OUT VOID *NewSha512Context
689 );
690
709BOOLEAN
710EFIAPI
712 IN OUT VOID *Sha512Context,
713 IN CONST VOID *Data,
714 IN UINTN DataSize
715 );
716
737BOOLEAN
738EFIAPI
740 IN OUT VOID *Sha512Context,
741 OUT UINT8 *HashValue
742 );
743
762BOOLEAN
763EFIAPI
765 IN CONST VOID *Data,
766 IN UINTN DataSize,
767 OUT UINT8 *HashValue
768 );
769
787BOOLEAN
788EFIAPI
790 IN CONST VOID *Input,
791 IN UINTN InputByteLen,
792 IN UINTN BlockSize,
793 OUT VOID *Output,
794 IN UINTN OutputByteLen,
795 IN CONST VOID *Customization,
796 IN UINTN CustomByteLen
797 );
798
805UINTN
806EFIAPI
808 VOID
809 );
810
823BOOLEAN
824EFIAPI
825Sm3Init (
826 OUT VOID *Sm3Context
827 );
828
844BOOLEAN
845EFIAPI
847 IN CONST VOID *Sm3Context,
848 OUT VOID *NewSm3Context
849 );
850
869BOOLEAN
870EFIAPI
871Sm3Update (
872 IN OUT VOID *Sm3Context,
873 IN CONST VOID *Data,
874 IN UINTN DataSize
875 );
876
897BOOLEAN
898EFIAPI
899Sm3Final (
900 IN OUT VOID *Sm3Context,
901 OUT UINT8 *HashValue
902 );
903
922BOOLEAN
923EFIAPI
925 IN CONST VOID *Data,
926 IN UINTN DataSize,
927 OUT UINT8 *HashValue
928 );
929
930// =====================================================================================
931// MAC (Message Authentication Code) Primitive
932// =====================================================================================
933
941VOID *
942EFIAPI
944 VOID
945 );
946
953VOID
954EFIAPI
956 IN VOID *HmacSha256Ctx
957 );
958
975BOOLEAN
976EFIAPI
978 OUT VOID *HmacSha256Context,
979 IN CONST UINT8 *Key,
980 IN UINTN KeySize
981 );
982
998BOOLEAN
999EFIAPI
1001 IN CONST VOID *HmacSha256Context,
1002 OUT VOID *NewHmacSha256Context
1003 );
1004
1025BOOLEAN
1026EFIAPI
1028 IN OUT VOID *HmacSha256Context,
1029 IN CONST VOID *Data,
1030 IN UINTN DataSize
1031 );
1032
1055BOOLEAN
1056EFIAPI
1058 IN OUT VOID *HmacSha256Context,
1059 OUT UINT8 *HmacValue
1060 );
1061
1082BOOLEAN
1083EFIAPI
1085 IN CONST VOID *Data,
1086 IN UINTN DataSize,
1087 IN CONST UINT8 *Key,
1088 IN UINTN KeySize,
1089 OUT UINT8 *HmacValue
1090 );
1091
1099VOID *
1100EFIAPI
1102 VOID
1103 );
1104
1111VOID
1112EFIAPI
1114 IN VOID *HmacSha384Ctx
1115 );
1116
1133BOOLEAN
1134EFIAPI
1136 OUT VOID *HmacSha384Context,
1137 IN CONST UINT8 *Key,
1138 IN UINTN KeySize
1139 );
1140
1156BOOLEAN
1157EFIAPI
1159 IN CONST VOID *HmacSha384Context,
1160 OUT VOID *NewHmacSha384Context
1161 );
1162
1183BOOLEAN
1184EFIAPI
1186 IN OUT VOID *HmacSha384Context,
1187 IN CONST VOID *Data,
1188 IN UINTN DataSize
1189 );
1190
1213BOOLEAN
1214EFIAPI
1216 IN OUT VOID *HmacSha384Context,
1217 OUT UINT8 *HmacValue
1218 );
1219
1240BOOLEAN
1241EFIAPI
1243 IN CONST VOID *Data,
1244 IN UINTN DataSize,
1245 IN CONST UINT8 *Key,
1246 IN UINTN KeySize,
1247 OUT UINT8 *HmacValue
1248 );
1249
1250// =====================================================================================
1251// Symmetric Cryptography Primitive
1252// =====================================================================================
1253
1263UINTN
1264EFIAPI
1266 VOID
1267 );
1268
1291BOOLEAN
1292EFIAPI
1293AesInit (
1294 OUT VOID *AesContext,
1295 IN CONST UINT8 *Key,
1296 IN UINTN KeyLength
1297 );
1298
1328BOOLEAN
1329EFIAPI
1331 IN VOID *AesContext,
1332 IN CONST UINT8 *Input,
1333 IN UINTN InputSize,
1334 IN CONST UINT8 *Ivec,
1335 OUT UINT8 *Output
1336 );
1337
1367BOOLEAN
1368EFIAPI
1370 IN VOID *AesContext,
1371 IN CONST UINT8 *Input,
1372 IN UINTN InputSize,
1373 IN CONST UINT8 *Ivec,
1374 OUT UINT8 *Output
1375 );
1376
1377// =====================================================================================
1378// Authenticated Encryption with Associated Data (AEAD) Cryptography Primitive
1379// =====================================================================================
1380
1405BOOLEAN
1406EFIAPI
1408 IN CONST UINT8 *Key,
1409 IN UINTN KeySize,
1410 IN CONST UINT8 *Iv,
1411 IN UINTN IvSize,
1412 IN CONST UINT8 *AData,
1413 IN UINTN ADataSize,
1414 IN CONST UINT8 *DataIn,
1415 IN UINTN DataInSize,
1416 OUT UINT8 *TagOut,
1417 IN UINTN TagSize,
1418 OUT UINT8 *DataOut,
1419 OUT UINTN *DataOutSize
1420 );
1421
1447BOOLEAN
1448EFIAPI
1450 IN CONST UINT8 *Key,
1451 IN UINTN KeySize,
1452 IN CONST UINT8 *Iv,
1453 IN UINTN IvSize,
1454 IN CONST UINT8 *AData,
1455 IN UINTN ADataSize,
1456 IN CONST UINT8 *DataIn,
1457 IN UINTN DataInSize,
1458 IN CONST UINT8 *Tag,
1459 IN UINTN TagSize,
1460 OUT UINT8 *DataOut,
1461 OUT UINTN *DataOutSize
1462 );
1463
1464// =====================================================================================
1465// Asymmetric Cryptography Primitive
1466// =====================================================================================
1467
1475VOID *
1476EFIAPI
1477RsaNew (
1478 VOID
1479 );
1480
1489VOID
1490EFIAPI
1491RsaFree (
1492 IN VOID *RsaContext
1493 );
1494
1517BOOLEAN
1518EFIAPI
1519RsaSetKey (
1520 IN OUT VOID *RsaContext,
1521 IN RSA_KEY_TAG KeyTag,
1522 IN CONST UINT8 *BigNumber,
1523 IN UINTN BnSize
1524 );
1525
1554BOOLEAN
1555EFIAPI
1556RsaGetKey (
1557 IN OUT VOID *RsaContext,
1558 IN RSA_KEY_TAG KeyTag,
1559 OUT UINT8 *BigNumber,
1560 IN OUT UINTN *BnSize
1561 );
1562
1586BOOLEAN
1587EFIAPI
1589 IN OUT VOID *RsaContext,
1590 IN UINTN ModulusLength,
1591 IN CONST UINT8 *PublicExponent,
1592 IN UINTN PublicExponentSize
1593 );
1594
1616BOOLEAN
1617EFIAPI
1619 IN VOID *RsaContext
1620 );
1621
1649BOOLEAN
1650EFIAPI
1652 IN VOID *RsaContext,
1653 IN CONST UINT8 *MessageHash,
1654 IN UINTN HashSize,
1655 OUT UINT8 *Signature,
1656 IN OUT UINTN *SigSize
1657 );
1658
1678BOOLEAN
1679EFIAPI
1681 IN VOID *RsaContext,
1682 IN CONST UINT8 *MessageHash,
1683 IN UINTN HashSize,
1684 IN CONST UINT8 *Signature,
1685 IN UINTN SigSize
1686 );
1687
1720BOOLEAN
1721EFIAPI
1722RsaPssSign (
1723 IN VOID *RsaContext,
1724 IN CONST UINT8 *Message,
1725 IN UINTN MsgSize,
1726 IN UINT16 DigestLen,
1727 IN UINT16 SaltLen,
1728 OUT UINT8 *Signature,
1729 IN OUT UINTN *SigSize
1730 );
1731
1750BOOLEAN
1751EFIAPI
1753 IN VOID *RsaContext,
1754 IN CONST UINT8 *Message,
1755 IN UINTN MsgSize,
1756 IN CONST UINT8 *Signature,
1757 IN UINTN SigSize,
1758 IN UINT16 DigestLen,
1759 IN UINT16 SaltLen
1760 );
1761
1781BOOLEAN
1782EFIAPI
1784 IN CONST UINT8 *PemData,
1785 IN UINTN PemSize,
1786 IN CONST CHAR8 *Password,
1787 OUT VOID **RsaContext
1788 );
1789
1808BOOLEAN
1809EFIAPI
1811 IN CONST UINT8 *Cert,
1812 IN UINTN CertSize,
1813 OUT VOID **RsaContext
1814 );
1815
1835BOOLEAN
1836EFIAPI
1838 IN CONST UINT8 *Cert,
1839 IN UINTN CertSize,
1840 OUT UINT8 *CertSubject,
1841 IN OUT UINTN *SubjectSize
1842 );
1843
1870RETURN_STATUS
1871EFIAPI
1873 IN CONST UINT8 *Cert,
1874 IN UINTN CertSize,
1875 OUT CHAR8 *CommonName OPTIONAL,
1876 IN OUT UINTN *CommonNameSize
1877 );
1878
1905RETURN_STATUS
1906EFIAPI
1908 IN CONST UINT8 *Cert,
1909 IN UINTN CertSize,
1910 OUT CHAR8 *NameBuffer OPTIONAL,
1911 IN OUT UINTN *NameBufferSize
1912 );
1913
1932BOOLEAN
1933EFIAPI
1935 IN CONST UINT8 *Cert,
1936 IN UINTN CertSize,
1937 IN CONST UINT8 *CACert,
1938 IN UINTN CACertSize
1939 );
1940
1957BOOLEAN
1958EFIAPI
1960 IN CONST UINT8 *Cert,
1961 IN UINTN CertSize,
1962 OUT UINT8 **SingleX509Cert
1963 );
1964
1984BOOLEAN
1985EFIAPI
1987 IN OUT UINT8 **X509Stack,
1988 IN VA_LIST Args
1989 );
1990
2009BOOLEAN
2010EFIAPI
2012 IN OUT UINT8 **X509Stack,
2013 ...
2014 );
2015
2024VOID
2025EFIAPI
2026X509Free (
2027 IN VOID *X509Cert
2028 );
2029
2038VOID
2039EFIAPI
2041 IN VOID *X509Stack
2042 );
2043
2061BOOLEAN
2062EFIAPI
2064 IN CONST UINT8 *Cert,
2065 IN UINTN CertSize,
2066 OUT UINT8 **TBSCert,
2067 OUT UINTN *TBSCertSize
2068 );
2069
2097BOOLEAN
2098EFIAPI
2100 IN UINTN PasswordLength,
2101 IN CONST CHAR8 *Password,
2102 IN UINTN SaltLength,
2103 IN CONST UINT8 *Salt,
2104 IN UINTN IterationCount,
2105 IN UINTN DigestSize,
2106 IN UINTN KeyLength,
2107 OUT UINT8 *OutKey
2108 );
2109
2139BOOLEAN
2140EFIAPI
2142 IN CONST UINT8 *PublicKey,
2143 IN UINTN PublicKeySize,
2144 IN UINT8 *InData,
2145 IN UINTN InDataSize,
2146 IN CONST UINT8 *PrngSeed OPTIONAL,
2147 IN UINTN PrngSeedSize OPTIONAL,
2148 OUT UINT8 **EncryptedData,
2149 OUT UINTN *EncryptedDataSize
2150 );
2151
2185BOOLEAN
2186EFIAPI
2188 IN VOID *RsaContext,
2189 IN UINT8 *InData,
2190 IN UINTN InDataSize,
2191 IN CONST UINT8 *PrngSeed OPTIONAL,
2192 IN UINTN PrngSeedSize OPTIONAL,
2193 IN UINT16 DigestLen OPTIONAL,
2194 OUT UINT8 **EncryptedData,
2195 OUT UINTN *EncryptedDataSize
2196 );
2197
2219BOOLEAN
2220EFIAPI
2222 IN CONST UINT8 *PrivateKey,
2223 IN UINTN PrivateKeySize,
2224 IN UINT8 *EncryptedData,
2225 IN UINTN EncryptedDataSize,
2226 OUT UINT8 **OutData,
2227 OUT UINTN *OutDataSize
2228 );
2229
2257BOOLEAN
2258EFIAPI
2260 IN VOID *RsaContext,
2261 IN UINT8 *EncryptedData,
2262 IN UINTN EncryptedDataSize,
2263 IN UINT16 DigestLen OPTIONAL,
2264 OUT UINT8 **OutData,
2265 OUT UINTN *OutDataSize
2266 );
2267
2284#pragma pack(1)
2285
2286typedef struct {
2287 UINT32 CertDataLength; // The length in bytes of X.509 certificate.
2288 UINT8 CertDataBuffer[0]; // The X.509 certificate content (DER).
2290
2291typedef struct {
2292 UINT8 CertNumber; // Number of X.509 certificate.
2293 // EFI_CERT_DATA CertArray[]; // An array of X.509 certificate.
2295
2296#pragma pack()
2297
2324BOOLEAN
2325EFIAPI
2327 IN CONST UINT8 *P7Data,
2328 IN UINTN P7Length,
2329 OUT UINT8 **CertStack,
2330 OUT UINTN *StackLength,
2331 OUT UINT8 **TrustedCert,
2332 OUT UINTN *CertLength
2333 );
2334
2343VOID
2344EFIAPI
2346 IN UINT8 *Certs
2347 );
2348
2373BOOLEAN
2374EFIAPI
2376 IN CONST UINT8 *P7Data,
2377 IN UINTN P7Length,
2378 OUT UINT8 **SignerChainCerts,
2379 OUT UINTN *ChainLength,
2380 OUT UINT8 **UnchainCerts,
2381 OUT UINTN *UnchainLength
2382 );
2383
2411BOOLEAN
2412EFIAPI
2413Pkcs7Sign (
2414 IN CONST UINT8 *PrivateKey,
2415 IN UINTN PrivateKeySize,
2416 IN CONST UINT8 *KeyPassword,
2417 IN UINT8 *InData,
2418 IN UINTN InDataSize,
2419 IN UINT8 *SignCert,
2420 IN UINT8 *OtherCerts OPTIONAL,
2421 OUT UINT8 **SignedData,
2422 OUT UINTN *SignedDataSize
2423 );
2424
2447BOOLEAN
2448EFIAPI
2450 IN CONST UINT8 *P7Data,
2451 IN UINTN P7Length,
2452 IN CONST UINT8 *TrustedCert,
2453 IN UINTN CertLength,
2454 IN CONST UINT8 *InData,
2455 IN UINTN DataLength
2456 );
2457
2490RETURN_STATUS
2491EFIAPI
2493 IN CONST UINT8 *Pkcs7Signature,
2494 IN CONST UINT32 SignatureSize,
2495 IN CONST CHAR8 *RequiredEKUs[],
2496 IN CONST UINT32 RequiredEKUsSize,
2497 IN BOOLEAN RequireAllPresent
2498 );
2499
2520BOOLEAN
2521EFIAPI
2523 IN CONST UINT8 *P7Data,
2524 IN UINTN P7Length,
2525 OUT VOID **Content,
2526 OUT UINTN *ContentSize
2527 );
2528
2553BOOLEAN
2554EFIAPI
2556 IN CONST UINT8 *AuthData,
2557 IN UINTN DataSize,
2558 IN CONST UINT8 *TrustedCert,
2559 IN UINTN CertSize,
2560 IN CONST UINT8 *ImageHash,
2561 IN UINTN HashSize
2562 );
2563
2584BOOLEAN
2585EFIAPI
2587 IN CONST UINT8 *AuthData,
2588 IN UINTN DataSize,
2589 IN CONST UINT8 *TsaCert,
2590 IN UINTN CertSize,
2591 OUT EFI_TIME *SigningTime
2592 );
2593
2610BOOLEAN
2611EFIAPI
2613 IN CONST UINT8 *Cert,
2614 IN UINTN CertSize,
2615 OUT UINTN *Version
2616 );
2617
2641BOOLEAN
2642EFIAPI
2644 IN CONST UINT8 *Cert,
2645 IN UINTN CertSize,
2646 OUT UINT8 *SerialNumber, OPTIONAL
2647 IN OUT UINTN *SerialNumberSize
2648 );
2649
2669BOOLEAN
2670EFIAPI
2672 IN CONST UINT8 *Cert,
2673 IN UINTN CertSize,
2674 OUT UINT8 *CertIssuer,
2675 IN OUT UINTN *CertIssuerSize
2676 );
2677
2696BOOLEAN
2697EFIAPI
2699 IN CONST UINT8 *Cert,
2700 IN UINTN CertSize,
2701 OUT UINT8 *Oid, OPTIONAL
2702 IN OUT UINTN *OidSize
2703 );
2704
2725BOOLEAN
2726EFIAPI
2728 IN CONST UINT8 *Cert,
2729 IN UINTN CertSize,
2730 IN CONST UINT8 *Oid,
2731 IN UINTN OidSize,
2732 OUT UINT8 *ExtensionData,
2733 IN OUT UINTN *ExtensionDataSize
2734 );
2735
2757BOOLEAN
2758EFIAPI
2760 IN CONST UINT8 *Cert,
2761 IN UINTN CertSize,
2762 IN UINT8 *From,
2763 IN OUT UINTN *FromSize,
2764 IN UINT8 *To,
2765 IN OUT UINTN *ToSize
2766 );
2767
2791BOOLEAN
2792EFIAPI
2794 IN CONST CHAR8 *DateTimeStr,
2795 OUT VOID *DateTime,
2796 IN OUT UINTN *DateTimeSize
2797 );
2798
2815INT32
2816EFIAPI
2818 IN CONST VOID *DateTime1,
2819 IN CONST VOID *DateTime2
2820 );
2821
2833BOOLEAN
2834EFIAPI
2836 IN CONST UINT8 *Cert,
2837 IN UINTN CertSize,
2838 OUT UINTN *Usage
2839 );
2840
2858BOOLEAN
2859EFIAPI
2861 IN CONST UINT8 *Cert,
2862 IN UINTN CertSize,
2863 OUT UINT8 *Usage,
2864 IN OUT UINTN *UsageSize
2865 );
2866
2883BOOLEAN
2884EFIAPI
2886 IN CONST UINT8 *RootCert,
2887 IN UINTN RootCertLength,
2888 IN CONST UINT8 *CertChain,
2889 IN UINTN CertChainLength
2890 );
2891
2911BOOLEAN
2912EFIAPI
2914 IN CONST UINT8 *CertChain,
2915 IN UINTN CertChainLength,
2916 IN CONST INT32 CertIndex,
2917 OUT CONST UINT8 **Cert,
2918 OUT UINTN *CertLength
2919 );
2920
2932BOOLEAN
2933EFIAPI
2934Asn1GetTag (
2935 IN OUT UINT8 **Ptr,
2936 IN CONST UINT8 *End,
2937 OUT UINTN *Length,
2938 IN UINT32 Tag
2939 );
2940
2959BOOLEAN
2960EFIAPI
2962 CONST UINT8 *Cert,
2963 UINTN CertSize,
2964 UINT8 *BasicConstraints,
2965 UINTN *BasicConstraintsSize
2966 );
2967
2968// =====================================================================================
2969// DH Key Exchange Primitive
2970// =====================================================================================
2971
2980VOID *
2981EFIAPI
2982DhNew (
2983 VOID
2984 );
2985
2994VOID
2995EFIAPI
2996DhFree (
2997 IN VOID *DhContext
2998 );
2999
3024BOOLEAN
3025EFIAPI
3027 IN OUT VOID *DhContext,
3029 IN UINTN PrimeLength,
3030 OUT UINT8 *Prime
3031 );
3032
3056BOOLEAN
3057EFIAPI
3059 IN OUT VOID *DhContext,
3061 IN UINTN PrimeLength,
3062 IN CONST UINT8 *Prime
3063 );
3064
3089BOOLEAN
3090EFIAPI
3092 IN OUT VOID *DhContext,
3093 OUT UINT8 *PublicKey,
3094 IN OUT UINTN *PublicKeySize
3095 );
3096
3123BOOLEAN
3124EFIAPI
3126 IN OUT VOID *DhContext,
3127 IN CONST UINT8 *PeerPublicKey,
3128 IN UINTN PeerPublicKeySize,
3129 OUT UINT8 *Key,
3130 IN OUT UINTN *KeySize
3131 );
3132
3133// =====================================================================================
3134// Pseudo-Random Generation Primitive
3135// =====================================================================================
3136
3157BOOLEAN
3158EFIAPI
3159RandomSeed (
3160 IN CONST UINT8 *Seed OPTIONAL,
3161 IN UINTN SeedSize
3162 );
3163
3178BOOLEAN
3179EFIAPI
3181 OUT UINT8 *Output,
3182 IN UINTN Size
3183 );
3184
3185// =====================================================================================
3186// Key Derivation Function Primitive
3187// =====================================================================================
3188
3205BOOLEAN
3206EFIAPI
3208 IN CONST UINT8 *Key,
3209 IN UINTN KeySize,
3210 IN CONST UINT8 *Salt,
3211 IN UINTN SaltSize,
3212 IN CONST UINT8 *Info,
3213 IN UINTN InfoSize,
3214 OUT UINT8 *Out,
3215 IN UINTN OutSize
3216 );
3217
3232BOOLEAN
3233EFIAPI
3235 IN CONST UINT8 *Key,
3236 IN UINTN KeySize,
3237 IN CONST UINT8 *Salt,
3238 IN UINTN SaltSize,
3239 OUT UINT8 *PrkOut,
3240 UINTN PrkOutSize
3241 );
3242
3257BOOLEAN
3258EFIAPI
3260 IN CONST UINT8 *Prk,
3261 IN UINTN PrkSize,
3262 IN CONST UINT8 *Info,
3263 IN UINTN InfoSize,
3264 OUT UINT8 *Out,
3265 IN UINTN OutSize
3266 );
3267
3284BOOLEAN
3285EFIAPI
3287 IN CONST UINT8 *Key,
3288 IN UINTN KeySize,
3289 IN CONST UINT8 *Salt,
3290 IN UINTN SaltSize,
3291 IN CONST UINT8 *Info,
3292 IN UINTN InfoSize,
3293 OUT UINT8 *Out,
3294 IN UINTN OutSize
3295 );
3296
3311BOOLEAN
3312EFIAPI
3314 IN CONST UINT8 *Key,
3315 IN UINTN KeySize,
3316 IN CONST UINT8 *Salt,
3317 IN UINTN SaltSize,
3318 OUT UINT8 *PrkOut,
3319 UINTN PrkOutSize
3320 );
3321
3336BOOLEAN
3337EFIAPI
3339 IN CONST UINT8 *Prk,
3340 IN UINTN PrkSize,
3341 IN CONST UINT8 *Info,
3342 IN UINTN InfoSize,
3343 OUT UINT8 *Out,
3344 IN UINTN OutSize
3345 );
3346
3347// =====================================================================================
3348// Big number primitives
3349// =====================================================================================
3350
3356VOID *
3357EFIAPI
3358BigNumInit (
3359 VOID
3360 );
3361
3370VOID *
3371EFIAPI
3373 IN CONST UINT8 *Buf,
3374 IN UINTN Len
3375 );
3376
3386INTN
3387EFIAPI
3389 IN CONST VOID *Bn,
3390 OUT UINT8 *Buf
3391 );
3392
3399VOID
3400EFIAPI
3401BigNumFree (
3402 IN VOID *Bn,
3403 IN BOOLEAN Clear
3404 );
3405
3418BOOLEAN
3419EFIAPI
3420BigNumAdd (
3421 IN CONST VOID *BnA,
3422 IN CONST VOID *BnB,
3423 OUT VOID *BnRes
3424 );
3425
3438BOOLEAN
3439EFIAPI
3440BigNumSub (
3441 IN CONST VOID *BnA,
3442 IN CONST VOID *BnB,
3443 OUT VOID *BnRes
3444 );
3445
3458BOOLEAN
3459EFIAPI
3460BigNumMod (
3461 IN CONST VOID *BnA,
3462 IN CONST VOID *BnB,
3463 OUT VOID *BnRes
3464 );
3465
3479BOOLEAN
3480EFIAPI
3482 IN CONST VOID *BnA,
3483 IN CONST VOID *BnP,
3484 IN CONST VOID *BnM,
3485 OUT VOID *BnRes
3486 );
3487
3500BOOLEAN
3501EFIAPI
3503 IN CONST VOID *BnA,
3504 IN CONST VOID *BnM,
3505 OUT VOID *BnRes
3506 );
3507
3520BOOLEAN
3521EFIAPI
3522BigNumDiv (
3523 IN CONST VOID *BnA,
3524 IN CONST VOID *BnB,
3525 OUT VOID *BnRes
3526 );
3527
3541BOOLEAN
3542EFIAPI
3544 IN CONST VOID *BnA,
3545 IN CONST VOID *BnB,
3546 IN CONST VOID *BnM,
3547 OUT VOID *BnRes
3548 );
3549
3560INTN
3561EFIAPI
3562BigNumCmp (
3563 IN CONST VOID *BnA,
3564 IN CONST VOID *BnB
3565 );
3566
3575UINTN
3576EFIAPI
3577BigNumBits (
3578 IN CONST VOID *Bn
3579 );
3580
3588UINTN
3589EFIAPI
3591 IN CONST VOID *Bn
3592 );
3593
3603BOOLEAN
3604EFIAPI
3606 IN CONST VOID *Bn,
3607 IN UINTN Num
3608 );
3609
3618BOOLEAN
3619EFIAPI
3621 IN CONST VOID *Bn
3622 );
3623
3633VOID *
3634EFIAPI
3635BigNumCopy (
3636 OUT VOID *BnDst,
3637 IN CONST VOID *BnSrc
3638 );
3639
3646CONST VOID *
3647EFIAPI
3649 VOID
3650 );
3651
3664BOOLEAN
3665EFIAPI
3667 IN CONST VOID *Bn,
3668 IN UINTN N,
3669 OUT VOID *BnRes
3670 );
3671
3679VOID
3680EFIAPI
3682 IN VOID *Bn
3683 );
3684
3697BOOLEAN
3698EFIAPI
3700 IN CONST VOID *BnA,
3701 IN CONST VOID *BnM,
3702 OUT VOID *BnRes
3703 );
3704
3712VOID *
3713EFIAPI
3715 VOID
3716 );
3717
3723VOID
3724EFIAPI
3726 IN VOID *BnCtx
3727 );
3728
3738BOOLEAN
3739EFIAPI
3741 IN VOID *Bn,
3742 IN UINTN Val
3743 );
3744
3756BOOLEAN
3757EFIAPI
3759 IN CONST VOID *BnA,
3760 IN CONST VOID *BnB,
3761 IN CONST VOID *BnM,
3762 OUT VOID *BnRes
3763 );
3764
3765// =====================================================================================
3766// Basic Elliptic Curve Primitives
3767// =====================================================================================
3768
3780VOID *
3781EFIAPI
3783 IN UINTN CryptoNid
3784 );
3785
3801BOOLEAN
3802EFIAPI
3804 IN CONST VOID *EcGroup,
3805 OUT VOID *BnPrime,
3806 OUT VOID *BnA,
3807 OUT VOID *BnB,
3808 IN VOID *BnCtx
3809 );
3810
3823BOOLEAN
3824EFIAPI
3826 IN VOID *EcGroup,
3827 OUT VOID *BnOrder
3828 );
3829
3835VOID
3836EFIAPI
3838 IN VOID *EcGroup
3839 );
3840
3850VOID *
3851EFIAPI
3853 IN CONST VOID *EcGroup
3854 );
3855
3862VOID
3863EFIAPI
3865 IN VOID *EcPoint,
3866 IN BOOLEAN Clear
3867 );
3868
3884BOOLEAN
3885EFIAPI
3887 IN CONST VOID *EcGroup,
3888 IN CONST VOID *EcPoint,
3889 OUT VOID *BnX,
3890 OUT VOID *BnY,
3891 IN VOID *BnCtx
3892 );
3893
3906BOOLEAN
3907EFIAPI
3909 IN CONST VOID *EcGroup,
3910 IN VOID *EcPoint,
3911 IN CONST VOID *BnX,
3912 IN CONST VOID *BnY,
3913 IN VOID *BnCtx
3914 );
3915
3929BOOLEAN
3930EFIAPI
3931EcPointAdd (
3932 IN CONST VOID *EcGroup,
3933 OUT VOID *EcPointResult,
3934 IN CONST VOID *EcPointA,
3935 IN CONST VOID *EcPointB,
3936 IN VOID *BnCtx
3937 );
3938
3952BOOLEAN
3953EFIAPI
3954EcPointMul (
3955 IN CONST VOID *EcGroup,
3956 OUT VOID *EcPointResult,
3957 IN CONST VOID *EcPoint,
3958 IN CONST VOID *BnPScalar,
3959 IN VOID *BnCtx
3960 );
3961
3972BOOLEAN
3973EFIAPI
3975 IN CONST VOID *EcGroup,
3976 IN OUT VOID *EcPoint,
3977 IN VOID *BnCtx
3978 );
3979
3990BOOLEAN
3991EFIAPI
3993 IN CONST VOID *EcGroup,
3994 IN CONST VOID *EcPoint,
3995 IN VOID *BnCtx
3996 );
3997
4007BOOLEAN
4008EFIAPI
4010 IN CONST VOID *EcGroup,
4011 IN CONST VOID *EcPoint
4012 );
4013
4025BOOLEAN
4026EFIAPI
4028 IN CONST VOID *EcGroup,
4029 IN CONST VOID *EcPointA,
4030 IN CONST VOID *EcPointB,
4031 IN VOID *BnCtx
4032 );
4033
4051BOOLEAN
4052EFIAPI
4054 IN CONST VOID *EcGroup,
4055 IN VOID *EcPoint,
4056 IN CONST VOID *BnX,
4057 IN UINT8 YBit,
4058 IN VOID *BnCtx
4059 );
4060
4061// =====================================================================================
4062// Elliptic Curve Diffie Hellman Primitives
4063// =====================================================================================
4064
4073VOID *
4074EFIAPI
4075EcNewByNid (
4076 IN UINTN Nid
4077 );
4078
4084VOID
4085EFIAPI
4086EcFree (
4087 IN VOID *EcContext
4088 );
4089
4116BOOLEAN
4117EFIAPI
4119 IN OUT VOID *EcContext,
4120 OUT UINT8 *PublicKey,
4121 IN OUT UINTN *PublicKeySize
4122 );
4123
4138BOOLEAN
4139EFIAPI
4141 IN OUT VOID *EcContext,
4142 OUT UINT8 *PublicKey,
4143 IN OUT UINTN *PublicKeySize
4144 );
4145
4171BOOLEAN
4172EFIAPI
4174 IN OUT VOID *EcContext,
4175 IN CONST UINT8 *PeerPublic,
4176 IN UINTN PeerPublicSize,
4177 IN CONST INT32 *CompressFlag,
4178 OUT UINT8 *Key,
4179 IN OUT UINTN *KeySize
4180 );
4181
4199BOOLEAN
4200EFIAPI
4202 IN CONST UINT8 *PemData,
4203 IN UINTN PemSize,
4204 IN CONST CHAR8 *Password,
4205 OUT VOID **EcContext
4206 );
4207
4224BOOLEAN
4225EFIAPI
4227 IN CONST UINT8 *Cert,
4228 IN UINTN CertSize,
4229 OUT VOID **EcContext
4230 );
4231
4261BOOLEAN
4262EFIAPI
4263EcDsaSign (
4264 IN VOID *EcContext,
4265 IN UINTN HashNid,
4266 IN CONST UINT8 *MessageHash,
4267 IN UINTN HashSize,
4268 OUT UINT8 *Signature,
4269 IN OUT UINTN *SigSize
4270 );
4271
4295BOOLEAN
4296EFIAPI
4298 IN VOID *EcContext,
4299 IN UINTN HashNid,
4300 IN CONST UINT8 *MessageHash,
4301 IN UINTN HashSize,
4302 IN CONST UINT8 *Signature,
4303 IN UINTN SigSize
4304 );
4305
4306#endif // __BASE_CRYPT_LIB_H__
UINT64 UINTN
INT64 INTN
BOOLEAN EFIAPI RsaPssSign(IN VOID *RsaContext, IN CONST UINT8 *Message, IN UINTN MsgSize, IN UINT16 DigestLen, IN UINT16 SaltLen, OUT UINT8 *Signature, IN OUT UINTN *SigSize)
BOOLEAN EFIAPI X509GetSerialNumber(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT UINT8 *SerialNumber, OPTIONAL IN OUT UINTN *SerialNumberSize)
Definition: CryptX509.c:1011
BOOLEAN EFIAPI HmacSha384Update(IN OUT VOID *HmacSha384Context, IN CONST VOID *Data, IN UINTN DataSize)
Definition: CryptHmac.c:564
BOOLEAN EFIAPI EcPointInvert(IN CONST VOID *EcGroup, IN OUT VOID *EcPoint, IN VOID *BnCtx)
Definition: CryptEc.c:302
BOOLEAN EFIAPI RsaCheckKey(IN VOID *RsaContext)
Definition: CryptRsaExt.c:243
BOOLEAN EFIAPI EcPointSetCompressedCoordinates(IN CONST VOID *EcGroup, IN VOID *EcPoint, IN CONST VOID *BnX, IN UINT8 YBit, IN VOID *BnCtx)
Definition: CryptEc.c:393
BOOLEAN EFIAPI BigNumExpMod(IN CONST VOID *BnA, IN CONST VOID *BnP, IN CONST VOID *BnM, OUT VOID *BnRes)
Definition: CryptBn.c:177
INT32 EFIAPI X509CompareDateTime(IN CONST VOID *DateTime1, IN CONST VOID *DateTime2)
Definition: CryptX509.c:1618
RSA_KEY_TAG
Definition: BaseCryptLib.h:74
@ RsaKeyDq
q's CRT exponent (== d mod (q - 1))
Definition: BaseCryptLib.h:81
@ RsaKeyD
RSA Private exponent (d)
Definition: BaseCryptLib.h:77
@ RsaKeyDp
p's CRT exponent (== d mod (p - 1))
Definition: BaseCryptLib.h:80
@ RsaKeyP
RSA secret prime factor of Modulus (p)
Definition: BaseCryptLib.h:78
@ RsaKeyN
RSA public Modulus (N)
Definition: BaseCryptLib.h:75
@ RsaKeyQ
RSA secret prime factor of Modules (q)
Definition: BaseCryptLib.h:79
@ RsaKeyQInv
The CRT coefficient (== 1/q mod p)
Definition: BaseCryptLib.h:82
@ RsaKeyE
RSA Public exponent (e)
Definition: BaseCryptLib.h:76
BOOLEAN EFIAPI AesInit(OUT VOID *AesContext, IN CONST UINT8 *Key, IN UINTN KeyLength)
Definition: CryptAes.c:53
BOOLEAN EFIAPI EcPointMul(IN CONST VOID *EcGroup, OUT VOID *EcPointResult, IN CONST VOID *EcPoint, IN CONST VOID *BnPScalar, IN VOID *BnCtx)
Definition: CryptEc.c:279
UINTN EFIAPI Sha256GetContextSize(VOID)
Definition: CryptSha256.c:20
BOOLEAN EFIAPI HmacSha384SetKey(OUT VOID *HmacSha384Context, IN CONST UINT8 *Key, IN UINTN KeySize)
Definition: CryptHmac.c:508
BOOLEAN EFIAPI HkdfSha256Extract(IN CONST UINT8 *Key, IN UINTN KeySize, IN CONST UINT8 *Salt, IN UINTN SaltSize, OUT UINT8 *PrkOut, UINTN PrkOutSize)
Definition: CryptHkdf.c:279
BOOLEAN EFIAPI EcPointAdd(IN CONST VOID *EcGroup, OUT VOID *EcPointResult, IN CONST VOID *EcPointA, IN CONST VOID *EcPointB, IN VOID *BnCtx)
Definition: CryptEc.c:253
BOOLEAN EFIAPI EcGenerateKey(IN OUT VOID *EcContext, OUT UINT8 *PublicKey, IN OUT UINTN *PublicKeySize)
Definition: CryptEc.c:475
BOOLEAN EFIAPI EcPointIsOnCurve(IN CONST VOID *EcGroup, IN CONST VOID *EcPoint, IN VOID *BnCtx)
Definition: CryptEc.c:323
BOOLEAN EFIAPI DhGenerateParameter(IN OUT VOID *DhContext, IN UINTN Generator, IN UINTN PrimeLength, OUT UINT8 *Prime)
Definition: CryptDh.c:76
BOOLEAN EFIAPI Pkcs5HashPassword(IN UINTN PasswordLength, IN CONST CHAR8 *Password, IN UINTN SaltLength, IN CONST UINT8 *Salt, IN UINTN IterationCount, IN UINTN DigestSize, IN UINTN KeyLength, OUT UINT8 *OutKey)
VOID *EFIAPI HmacSha256New(VOID)
Definition: CryptHmac.c:297
BOOLEAN EFIAPI BigNumMulMod(IN CONST VOID *BnA, IN CONST VOID *BnB, IN CONST VOID *BnM, OUT VOID *BnRes)
Definition: CryptBn.c:284
UINTN EFIAPI Sha384GetContextSize(VOID)
Definition: CryptSha512.c:20
BOOLEAN EFIAPI Sha512HashAll(IN CONST VOID *Data, IN UINTN DataSize, OUT UINT8 *HashValue)
Definition: CryptSha512.c:427
BOOLEAN EFIAPI Sm3Duplicate(IN CONST VOID *Sm3Context, OUT VOID *NewSm3Context)
Definition: CryptSm3.c:79
BOOLEAN EFIAPI HmacSha256Duplicate(IN CONST VOID *HmacSha256Context, OUT VOID *NewHmacSha256Context)
Definition: CryptHmac.c:359
BOOLEAN EFIAPI Sha512Final(IN OUT VOID *Sha512Context, OUT UINT8 *HashValue)
Definition: CryptSha512.c:389
BOOLEAN EFIAPI BigNumInverseMod(IN CONST VOID *BnA, IN CONST VOID *BnM, OUT VOID *BnRes)
Definition: CryptBn.c:212
VOID *EFIAPI HmacSha384New(VOID)
Definition: CryptHmac.c:468
VOID *EFIAPI BigNumFromBin(IN CONST UINT8 *Buf, IN UINTN Len)
Definition: CryptBn.c:35
BOOLEAN EFIAPI X509GetVersion(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT UINTN *Version)
Definition: CryptX509.c:957
BOOLEAN EFIAPI X509GetExtensionData(IN CONST UINT8 *Cert, IN UINTN CertSize, IN CONST UINT8 *Oid, IN UINTN OidSize, OUT UINT8 *ExtensionData, IN OUT UINTN *ExtensionDataSize)
Definition: CryptX509.c:1274
BOOLEAN EFIAPI BigNumDiv(IN CONST VOID *BnA, IN CONST VOID *BnB, OUT VOID *BnRes)
Definition: CryptBn.c:249
BOOLEAN EFIAPI EcPointIsAtInfinity(IN CONST VOID *EcGroup, IN CONST VOID *EcPoint)
Definition: CryptEc.c:343
BOOLEAN EFIAPI EcGetPubKey(IN OUT VOID *EcContext, OUT UINT8 *PublicKey, IN OUT UINTN *PublicKeySize)
Definition: CryptEc.c:567
BOOLEAN EFIAPI Pkcs7Sign(IN CONST UINT8 *PrivateKey, IN UINTN PrivateKeySize, IN CONST UINT8 *KeyPassword, IN UINT8 *InData, IN UINTN InDataSize, IN UINT8 *SignCert, IN UINT8 *OtherCerts OPTIONAL, OUT UINT8 **SignedData, OUT UINTN *SignedDataSize)
BOOLEAN EFIAPI Sha384Duplicate(IN CONST VOID *Sha384Context, OUT VOID *NewSha384Context)
Definition: CryptSha512.c:78
BOOLEAN EFIAPI X509ConstructCertificateStack(IN OUT UINT8 **X509Stack,...)
Definition: CryptX509.c:190
BOOLEAN EFIAPI HmacSha384All(IN CONST VOID *Data, IN UINTN DataSize, IN CONST UINT8 *Key, IN UINTN KeySize, OUT UINT8 *HmacValue)
Definition: CryptHmac.c:627
VOID *EFIAPI DhNew(VOID)
Definition: CryptDh.c:22
UINTN EFIAPI Sm3GetContextSize(VOID)
Definition: CryptSm3.c:20
BOOLEAN EFIAPI X509GetIssuerName(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT UINT8 *CertIssuer, IN OUT UINTN *CertIssuerSize)
Definition: CryptX509.c:1097
VOID *EFIAPI RsaNew(VOID)
Definition: CryptRsaBasic.c:30
BOOLEAN EFIAPI AeadAesGcmDecrypt(IN CONST UINT8 *Key, IN UINTN KeySize, IN CONST UINT8 *Iv, IN UINTN IvSize, IN CONST UINT8 *AData, IN UINTN ADataSize, IN CONST UINT8 *DataIn, IN UINTN DataInSize, IN CONST UINT8 *Tag, IN UINTN TagSize, OUT UINT8 *DataOut, OUT UINTN *DataOutSize)
BOOLEAN EFIAPI RsaGetPrivateKeyFromPem(IN CONST UINT8 *PemData, IN UINTN PemSize, IN CONST CHAR8 *Password, OUT VOID **RsaContext)
Definition: CryptPem.c:66
BOOLEAN EFIAPI BigNumSqrMod(IN CONST VOID *BnA, IN CONST VOID *BnM, OUT VOID *BnRes)
Definition: CryptBn.c:480
UINTN EFIAPI BigNumBits(IN CONST VOID *Bn)
Definition: CryptBn.c:334
UINTN EFIAPI Sha512GetContextSize(VOID)
Definition: CryptSha512.c:246
BOOLEAN EFIAPI Sha1Final(IN OUT VOID *Sha1Context, OUT UINT8 *HashValue)
Definition: CryptSha1.c:163
BOOLEAN EFIAPI Sm3Update(IN OUT VOID *Sm3Context, IN CONST VOID *Data, IN UINTN DataSize)
Definition: CryptSm3.c:116
BOOLEAN EFIAPI EcDsaSign(IN VOID *EcContext, IN UINTN HashNid, IN CONST UINT8 *MessageHash, IN UINTN HashSize, OUT UINT8 *Signature, IN OUT UINTN *SigSize)
Definition: CryptEc.c:801
VOID EFIAPI HmacSha384Free(IN VOID *HmacSha384Ctx)
Definition: CryptHmac.c:483
BOOLEAN EFIAPI DhGenerateKey(IN OUT VOID *DhContext, OUT UINT8 *PublicKey, IN OUT UINTN *PublicKeySize)
Definition: CryptDh.c:196
BOOLEAN EFIAPI X509FormatDateTime(IN CONST CHAR8 *DateTimeStr, OUT VOID *DateTime, IN OUT UINTN *DateTimeSize)
Definition: CryptX509.c:1550
BOOLEAN EFIAPI X509VerifyCert(IN CONST UINT8 *Cert, IN UINTN CertSize, IN CONST UINT8 *CACert, IN UINTN CACertSize)
Definition: CryptX509.c:659
VOID EFIAPI HmacSha256Free(IN VOID *HmacSha256Ctx)
Definition: CryptHmac.c:312
VOID EFIAPI DhFree(IN VOID *DhContext)
Definition: CryptDh.c:42
BOOLEAN EFIAPI Sha512Init(OUT VOID *Sha512Context)
Definition: CryptSha512.c:270
BOOLEAN EFIAPI DhSetParameter(IN OUT VOID *DhContext, IN UINTN Generator, IN UINTN PrimeLength, IN CONST UINT8 *Prime)
Definition: CryptDh.c:131
BOOLEAN EFIAPI Sm3Final(IN OUT VOID *Sm3Context, OUT UINT8 *HashValue)
Definition: CryptSm3.c:166
BOOLEAN EFIAPI HmacSha384Duplicate(IN CONST VOID *HmacSha384Context, OUT VOID *NewHmacSha384Context)
Definition: CryptHmac.c:534
BOOLEAN EFIAPI RandomBytes(OUT UINT8 *Output, IN UINTN Size)
Definition: CryptRand.c:76
UINTN EFIAPI AesGetContextSize(VOID)
Definition: CryptAes.c:20
BOOLEAN EFIAPI Sha256Init(OUT VOID *Sha256Context)
Definition: CryptSha256.c:44
VOID *EFIAPI BigNumNewContext(VOID)
Definition: CryptBn.c:509
BOOLEAN EFIAPI X509GetSignatureAlgorithm(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT UINT8 *Oid, OPTIONAL IN OUT UINTN *OidSize)
Definition: CryptX509.c:1180
BOOLEAN EFIAPI RsaGetPublicKeyFromX509(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT VOID **RsaContext)
Definition: CryptX509.c:580
RETURN_STATUS EFIAPI X509GetOrganizationName(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT CHAR8 *NameBuffer OPTIONAL, IN OUT UINTN *NameBufferSize)
Definition: CryptX509.c:552
VOID EFIAPI X509StackFree(IN VOID *X509Stack)
Definition: CryptX509.c:241
VOID EFIAPI BigNumFree(IN VOID *Bn, IN BOOLEAN Clear)
Definition: CryptBn.c:70
BOOLEAN EFIAPI Pkcs7GetSigners(IN CONST UINT8 *P7Data, IN UINTN P7Length, OUT UINT8 **CertStack, OUT UINTN *StackLength, OUT UINT8 **TrustedCert, OUT UINTN *CertLength)
BOOLEAN EFIAPI Sha1Duplicate(IN CONST VOID *Sha1Context, OUT VOID *NewSha1Context)
Definition: CryptSha1.c:78
BOOLEAN EFIAPI ParallelHash256HashAll(IN CONST VOID *Input, IN UINTN InputByteLen, IN UINTN BlockSize, OUT VOID *Output, IN UINTN OutputByteLen, IN CONST VOID *Customization, IN UINTN CustomByteLen)
BOOLEAN EFIAPI AuthenticodeVerify(IN CONST UINT8 *AuthData, IN UINTN DataSize, IN CONST UINT8 *TrustedCert, IN UINTN CertSize, IN CONST UINT8 *ImageHash, IN UINTN HashSize)
BOOLEAN EFIAPI X509GetExtendedKeyUsage(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT UINT8 *Usage, IN OUT UINTN *UsageSize)
Definition: CryptX509.c:1406
BOOLEAN EFIAPI Sha384HashAll(IN CONST VOID *Data, IN UINTN DataSize, OUT UINT8 *HashValue)
Definition: CryptSha512.c:201
VOID *EFIAPI EcNewByNid(IN UINTN Nid)
Definition: CryptEc.c:419
BOOLEAN EFIAPI Sha256Final(IN OUT VOID *Sha256Context, OUT UINT8 *HashValue)
Definition: CryptSha256.c:161
BOOLEAN EFIAPI HkdfSha384ExtractAndExpand(IN CONST UINT8 *Key, IN UINTN KeySize, IN CONST UINT8 *Salt, IN UINTN SaltSize, IN CONST UINT8 *Info, IN UINTN InfoSize, OUT UINT8 *Out, IN UINTN OutSize)
Definition: CryptHkdf.c:345
BOOLEAN EFIAPI Pkcs1v2Encrypt(IN CONST UINT8 *PublicKey, IN UINTN PublicKeySize, IN UINT8 *InData, IN UINTN InDataSize, IN CONST UINT8 *PrngSeed OPTIONAL, IN UINTN PrngSeedSize OPTIONAL, OUT UINT8 **EncryptedData, OUT UINTN *EncryptedDataSize)
BOOLEAN EFIAPI X509GetValidity(IN CONST UINT8 *Cert, IN UINTN CertSize, IN UINT8 *From, IN OUT UINTN *FromSize, IN UINT8 *To, IN OUT UINTN *ToSize)
Definition: CryptX509.c:1442
BOOLEAN EFIAPI HmacSha384Final(IN OUT VOID *HmacSha384Context, OUT UINT8 *HmacValue)
Definition: CryptHmac.c:597
BOOLEAN EFIAPI Sm3HashAll(IN CONST VOID *Data, IN UINTN DataSize, OUT UINT8 *HashValue)
Definition: CryptSm3.c:206
BOOLEAN EFIAPI BigNumIsWord(IN CONST VOID *Bn, IN UINTN Num)
Definition: CryptBn.c:368
INTN EFIAPI BigNumCmp(IN CONST VOID *BnA, IN CONST VOID *BnB)
Definition: CryptBn.c:317
VOID *EFIAPI EcPointInit(IN CONST VOID *EcGroup)
Definition: CryptEc.c:158
VOID *EFIAPI EcGroupInit(IN UINTN CryptoNid)
Definition: CryptEc.c:68
BOOLEAN EFIAPI Sha384Update(IN OUT VOID *Sha384Context, IN CONST VOID *Data, IN UINTN DataSize)
Definition: CryptSha512.c:115
BOOLEAN EFIAPI BigNumAdd(IN CONST VOID *BnA, IN CONST VOID *BnB, OUT VOID *BnRes)
Definition: CryptBn.c:96
BOOLEAN EFIAPI Sha256Duplicate(IN CONST VOID *Sha256Context, OUT VOID *NewSha256Context)
Definition: CryptSha256.c:76
BOOLEAN EFIAPI HmacSha256SetKey(OUT VOID *HmacSha256Context, IN CONST UINT8 *Key, IN UINTN KeySize)
Definition: CryptHmac.c:335
BOOLEAN EFIAPI EcGetPrivateKeyFromPem(IN CONST UINT8 *PemData, IN UINTN PemSize, IN CONST CHAR8 *Password, OUT VOID **EcContext)
Definition: CryptPem.c:149
BOOLEAN EFIAPI Sm3Init(OUT VOID *Sm3Context)
Definition: CryptSm3.c:44
BOOLEAN EFIAPI HmacSha256Update(IN OUT VOID *HmacSha256Context, IN CONST VOID *Data, IN UINTN DataSize)
Definition: CryptHmac.c:387
BOOLEAN EFIAPI DhComputeKey(IN OUT VOID *DhContext, IN CONST UINT8 *PeerPublicKey, IN UINTN PeerPublicKeySize, OUT UINT8 *Key, IN OUT UINTN *KeySize)
Definition: CryptDh.c:265
BOOLEAN EFIAPI Sha1Init(OUT VOID *Sha1Context)
Definition: CryptSha1.c:46
BOOLEAN EFIAPI HkdfSha384Extract(IN CONST UINT8 *Key, IN UINTN KeySize, IN CONST UINT8 *Salt, IN UINTN SaltSize, OUT UINT8 *PrkOut, UINTN PrkOutSize)
Definition: CryptHkdf.c:375
BOOLEAN EFIAPI Sha256HashAll(IN CONST VOID *Data, IN UINTN DataSize, OUT UINT8 *HashValue)
Definition: CryptSha256.c:199
VOID EFIAPI BigNumConstTime(IN VOID *Bn)
Definition: CryptBn.c:459
CONST VOID *EFIAPI BigNumValueOne(VOID)
Definition: CryptBn.c:420
BOOLEAN EFIAPI Sha512Duplicate(IN CONST VOID *Sha512Context, OUT VOID *NewSha512Context)
Definition: CryptSha512.c:304
BOOLEAN EFIAPI Asn1GetTag(IN OUT UINT8 **Ptr, IN CONST UINT8 *End, OUT UINTN *Length, IN UINT32 Tag)
Definition: CryptX509.c:1884
BOOLEAN EFIAPI RsaGetKey(IN OUT VOID *RsaContext, IN RSA_KEY_TAG KeyTag, OUT UINT8 *BigNumber, IN OUT UINTN *BnSize)
Definition: CryptRsaExt.c:50
BOOLEAN EFIAPI BigNumSetUint(IN VOID *Bn, IN UINTN Val)
Definition: CryptBn.c:541
VOID EFIAPI BigNumContextFree(IN VOID *BnCtx)
Definition: CryptBn.c:523
BOOLEAN EFIAPI EcPointEqual(IN CONST VOID *EcGroup, IN CONST VOID *EcPointA, IN CONST VOID *EcPointB, IN VOID *BnCtx)
Definition: CryptEc.c:364
BOOLEAN EFIAPI BigNumIsOdd(IN CONST VOID *Bn)
Definition: CryptBn.c:386
BOOLEAN EFIAPI BigNumSub(IN CONST VOID *BnA, IN CONST VOID *BnB, OUT VOID *BnRes)
Definition: CryptBn.c:119
BOOLEAN EFIAPI RandomSeed(IN CONST UINT8 *Seed OPTIONAL, IN UINTN SeedSize)
Definition: CryptRand.c:36
BOOLEAN EFIAPI RsaOaepEncrypt(IN VOID *RsaContext, IN UINT8 *InData, IN UINTN InDataSize, IN CONST UINT8 *PrngSeed OPTIONAL, IN UINTN PrngSeedSize OPTIONAL, IN UINT16 DigestLen OPTIONAL, OUT UINT8 **EncryptedData, OUT UINTN *EncryptedDataSize)
BOOLEAN EFIAPI RsaOaepDecrypt(IN VOID *RsaContext, IN UINT8 *EncryptedData, IN UINTN EncryptedDataSize, IN UINT16 DigestLen OPTIONAL, OUT UINT8 **OutData, OUT UINTN *OutDataSize)
BOOLEAN EFIAPI RsaSetKey(IN OUT VOID *RsaContext, IN RSA_KEY_TAG KeyTag, IN CONST UINT8 *BigNumber, IN UINTN BnSize)
Definition: CryptRsaBasic.c:82
BOOLEAN EFIAPI Pkcs7Verify(IN CONST UINT8 *P7Data, IN UINTN P7Length, IN CONST UINT8 *TrustedCert, IN UINTN CertLength, IN CONST UINT8 *InData, IN UINTN DataLength)
RETURN_STATUS EFIAPI VerifyEKUsInPkcs7Signature(IN CONST UINT8 *Pkcs7Signature, IN CONST UINT32 SignatureSize, IN CONST CHAR8 *RequiredEKUs[], IN CONST UINT32 RequiredEKUsSize, IN BOOLEAN RequireAllPresent)
BOOLEAN EFIAPI Sha256Update(IN OUT VOID *Sha256Context, IN CONST VOID *Data, IN UINTN DataSize)
Definition: CryptSha256.c:113
VOID *EFIAPI BigNumCopy(OUT VOID *BnDst, IN CONST VOID *BnSrc)
Definition: CryptBn.c:404
BOOLEAN EFIAPI EcGroupGetCurve(IN CONST VOID *EcGroup, OUT VOID *BnPrime, OUT VOID *BnA, OUT VOID *BnB, IN VOID *BnCtx)
Definition: CryptEc.c:100
BOOLEAN EFIAPI HmacSha256All(IN CONST VOID *Data, IN UINTN DataSize, IN CONST UINT8 *Key, IN UINTN KeySize, OUT UINT8 *HmacValue)
Definition: CryptHmac.c:448
BOOLEAN EFIAPI BigNumAddMod(IN CONST VOID *BnA, IN CONST VOID *BnB, IN CONST VOID *BnM, OUT VOID *BnRes)
Definition: CryptBn.c:562
BOOLEAN EFIAPI EcGetPublicKeyFromX509(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT VOID **EcContext)
Definition: CryptX509.c:878
BOOLEAN EFIAPI HkdfSha256Expand(IN CONST UINT8 *Prk, IN UINTN PrkSize, IN CONST UINT8 *Info, IN UINTN InfoSize, OUT UINT8 *Out, IN UINTN OutSize)
Definition: CryptHkdf.c:315
VOID EFIAPI RsaFree(IN VOID *RsaContext)
Definition: CryptRsaBasic.c:48
BOOLEAN EFIAPI HkdfSha256ExtractAndExpand(IN CONST UINT8 *Key, IN UINTN KeySize, IN CONST UINT8 *Salt, IN UINTN SaltSize, IN CONST UINT8 *Info, IN UINTN InfoSize, OUT UINT8 *Out, IN UINTN OutSize)
Definition: CryptHkdf.c:249
VOID EFIAPI Pkcs7FreeSigners(IN UINT8 *Certs)
BOOLEAN EFIAPI BigNumMod(IN CONST VOID *BnA, IN CONST VOID *BnB, OUT VOID *BnRes)
Definition: CryptBn.c:142
BOOLEAN EFIAPI Pkcs7GetAttachedContent(IN CONST UINT8 *P7Data, IN UINTN P7Length, OUT VOID **Content, OUT UINTN *ContentSize)
VOID EFIAPI EcPointDeInit(IN VOID *EcPoint, IN BOOLEAN Clear)
Definition: CryptEc.c:173
BOOLEAN EFIAPI EcDsaVerify(IN VOID *EcContext, IN UINTN HashNid, IN CONST UINT8 *MessageHash, IN UINTN HashSize, IN CONST UINT8 *Signature, IN UINTN SigSize)
Definition: CryptEc.c:933
BOOLEAN EFIAPI Sha1HashAll(IN CONST VOID *Data, IN UINTN DataSize, OUT UINT8 *HashValue)
Definition: CryptSha1.c:201
BOOLEAN EFIAPI ImageTimestampVerify(IN CONST UINT8 *AuthData, IN UINTN DataSize, IN CONST UINT8 *TsaCert, IN UINTN CertSize, OUT EFI_TIME *SigningTime)
Definition: CryptTs.c:555
VOID EFIAPI X509Free(IN VOID *X509Cert)
Definition: CryptX509.c:214
VOID *EFIAPI BigNumInit(VOID)
Definition: CryptBn.c:18
UINTN EFIAPI Sha1GetContextSize(VOID)
Definition: CryptSha1.c:22
BOOLEAN EFIAPI BigNumRShift(IN CONST VOID *Bn, IN UINTN N, OUT VOID *BnRes)
Definition: CryptBn.c:441
BOOLEAN EFIAPI Sha384Final(IN OUT VOID *Sha384Context, OUT UINT8 *HashValue)
Definition: CryptSha512.c:163
BOOLEAN EFIAPI X509ConstructCertificateStackV(IN OUT UINT8 **X509Stack, IN VA_LIST Args)
Definition: CryptX509.c:94
BOOLEAN EFIAPI Pkcs1v2Decrypt(IN CONST UINT8 *PrivateKey, IN UINTN PrivateKeySize, IN UINT8 *EncryptedData, IN UINTN EncryptedDataSize, OUT UINT8 **OutData, OUT UINTN *OutDataSize)
BOOLEAN EFIAPI X509GetCertFromCertChain(IN CONST UINT8 *CertChain, IN UINTN CertChainLength, IN CONST INT32 CertIndex, OUT CONST UINT8 **Cert, OUT UINTN *CertLength)
Definition: CryptX509.c:1792
BOOLEAN EFIAPI EcGroupGetOrder(IN VOID *EcGroup, OUT VOID *BnOrder)
Definition: CryptEc.c:125
UINTN EFIAPI BigNumBytes(IN CONST VOID *Bn)
Definition: CryptBn.c:350
BOOLEAN EFIAPI X509GetSubjectName(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT UINT8 *CertSubject, IN OUT UINTN *SubjectSize)
Definition: CryptX509.c:277
BOOLEAN EFIAPI AeadAesGcmEncrypt(IN CONST UINT8 *Key, IN UINTN KeySize, IN CONST UINT8 *Iv, IN UINTN IvSize, IN CONST UINT8 *AData, IN UINTN ADataSize, IN CONST UINT8 *DataIn, IN UINTN DataInSize, OUT UINT8 *TagOut, IN UINTN TagSize, OUT UINT8 *DataOut, OUT UINTN *DataOutSize)
BOOLEAN EFIAPI RsaPssVerify(IN VOID *RsaContext, IN CONST UINT8 *Message, IN UINTN MsgSize, IN CONST UINT8 *Signature, IN UINTN SigSize, IN UINT16 DigestLen, IN UINT16 SaltLen)
Definition: CryptRsaPss.c:67
BOOLEAN EFIAPI EcDhComputeKey(IN OUT VOID *EcContext, IN CONST UINT8 *PeerPublic, IN UINTN PeerPublicSize, IN CONST INT32 *CompressFlag, OUT UINT8 *Key, IN OUT UINTN *KeySize)
Definition: CryptEc.c:667
BOOLEAN EFIAPI Sha384Init(OUT VOID *Sha384Context)
Definition: CryptSha512.c:44
BOOLEAN EFIAPI X509GetKeyUsage(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT UINTN *Usage)
Definition: CryptX509.c:1639
BOOLEAN EFIAPI Pkcs7GetCertificatesList(IN CONST UINT8 *P7Data, IN UINTN P7Length, OUT UINT8 **SignerChainCerts, OUT UINTN *ChainLength, OUT UINT8 **UnchainCerts, OUT UINTN *UnchainLength)
VOID EFIAPI EcGroupFree(IN VOID *EcGroup)
Definition: CryptEc.c:140
BOOLEAN EFIAPI AesCbcEncrypt(IN VOID *AesContext, IN CONST UINT8 *Input, IN UINTN InputSize, IN CONST UINT8 *Ivec, OUT UINT8 *Output)
Definition: CryptAes.c:112
BOOLEAN EFIAPI RsaPkcs1Verify(IN VOID *RsaContext, IN CONST UINT8 *MessageHash, IN UINTN HashSize, IN CONST UINT8 *Signature, IN UINTN SigSize)
BOOLEAN EFIAPI X509GetTBSCert(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT UINT8 **TBSCert, OUT UINTN *TBSCertSize)
Definition: CryptX509.c:798
BOOLEAN EFIAPI X509GetExtendedBasicConstraints(CONST UINT8 *Cert, UINTN CertSize, UINT8 *BasicConstraints, UINTN *BasicConstraintsSize)
Definition: CryptX509.c:1938
BOOLEAN EFIAPI Sha512Update(IN OUT VOID *Sha512Context, IN CONST VOID *Data, IN UINTN DataSize)
Definition: CryptSha512.c:341
RETURN_STATUS EFIAPI X509GetCommonName(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT CHAR8 *CommonName OPTIONAL, IN OUT UINTN *CommonNameSize)
Definition: CryptX509.c:514
BOOLEAN EFIAPI HmacSha256Final(IN OUT VOID *HmacSha256Context, OUT UINT8 *HmacValue)
Definition: CryptHmac.c:418
BOOLEAN EFIAPI HkdfSha384Expand(IN CONST UINT8 *Prk, IN UINTN PrkSize, IN CONST UINT8 *Info, IN UINTN InfoSize, OUT UINT8 *Out, IN UINTN OutSize)
Definition: CryptHkdf.c:411
BOOLEAN EFIAPI EcPointGetAffineCoordinates(IN CONST VOID *EcGroup, IN CONST VOID *EcPoint, OUT VOID *BnX, OUT VOID *BnY, IN VOID *BnCtx)
Definition: CryptEc.c:202
BOOLEAN EFIAPI Sha1Update(IN OUT VOID *Sha1Context, IN CONST VOID *Data, IN UINTN DataSize)
Definition: CryptSha1.c:115
BOOLEAN EFIAPI EcPointSetAffineCoordinates(IN CONST VOID *EcGroup, IN VOID *EcPoint, IN CONST VOID *BnX, IN CONST VOID *BnY, IN VOID *BnCtx)
Definition: CryptEc.c:227
INTN EFIAPI BigNumToBin(IN CONST VOID *Bn, OUT UINT8 *Buf)
Definition: CryptBn.c:54
BOOLEAN EFIAPI RsaGenerateKey(IN OUT VOID *RsaContext, IN UINTN ModulusLength, IN CONST UINT8 *PublicExponent, IN UINTN PublicExponentSize)
Definition: CryptRsaExt.c:179
BOOLEAN EFIAPI X509VerifyCertChain(IN CONST UINT8 *RootCert, IN UINTN RootCertLength, IN CONST UINT8 *CertChain, IN UINTN CertChainLength)
Definition: CryptX509.c:1705
BOOLEAN EFIAPI X509ConstructCertificate(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT UINT8 **SingleX509Cert)
Definition: CryptX509.c:43
BOOLEAN EFIAPI RsaPkcs1Sign(IN VOID *RsaContext, IN CONST UINT8 *MessageHash, IN UINTN HashSize, OUT UINT8 *Signature, IN OUT UINTN *SigSize)
Definition: CryptRsaExt.c:297
VOID EFIAPI EcFree(IN VOID *EcContext)
Definition: CryptEc.c:440
BOOLEAN EFIAPI AesCbcDecrypt(IN VOID *AesContext, IN CONST UINT8 *Input, IN UINTN InputSize, IN CONST UINT8 *Ivec, OUT UINT8 *Output)
Definition: CryptAes.c:174
VOID EFIAPI Input(IN CHAR16 *Prompt OPTIONAL, OUT CHAR16 *InStr, IN UINTN StrLen)
Definition: EdbSupportUI.c:187
BOOLEAN EFIAPI Md5Duplicate(IN CONST VOID *Md5Context, OUT VOID *NewMd5Context)
Definition: CryptMd5Null.c:65
BOOLEAN EFIAPI Md5Final(IN OUT VOID *Md5Context, OUT UINT8 *HashValue)
Definition: CryptMd5Null.c:126
BOOLEAN EFIAPI Md5Update(IN OUT VOID *Md5Context, IN CONST VOID *Data, IN UINTN DataSize)
Definition: CryptMd5Null.c:94
BOOLEAN EFIAPI Md5Init(OUT VOID *Md5Context)
Definition: CryptMd5Null.c:42
BOOLEAN EFIAPI Md5HashAll(IN CONST VOID *Data, IN UINTN DataSize, OUT UINT8 *HashValue)
Definition: CryptMd5Null.c:155
UINTN EFIAPI Md5GetContextSize(VOID)
Definition: CryptMd5Null.c:20
#define CONST
Definition: Base.h:259
CHAR8 * VA_LIST
Definition: Base.h:643
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284