Functions | Variables
evp_extra_test.cc File Reference
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <utility>
#include <vector>
#include <gtest/gtest.h>
#include <openssl/bytestring.h>
#include <openssl/crypto.h>
#include <openssl/digest.h>
#include <openssl/err.h>
#include <openssl/pkcs8.h>
#include <openssl/rsa.h>
#include "../internal.h"
#include "../test/test_util.h"
Include dependency graph for evp_extra_test.cc:

Go to the source code of this file.

Functions

static void ExpectECGroupAndKey (const EVP_PKEY *pkey, int nid)
 
static void ExpectECGroupOnly (const EVP_PKEY *pkey, int nid)
 
static bssl::UniquePtr< EVP_PKEYLoadExampleRSAKey ()
 
static bssl::UniquePtr< EVP_PKEYParsePrivateKey (int type, const uint8_t *in, size_t len)
 
 TEST (EVPExtraTest, BadECKey)
 
 TEST (EVPExtraTest, d2i_AutoPrivateKey)
 
 TEST (EVPExtraTest, d2i_PrivateKey)
 
 TEST (EVPExtraTest, DigestSignInit)
 
 TEST (EVPExtraTest, DigestVerifyInit)
 
 TEST (EVPExtraTest, ECKeygen)
 
 TEST (EVPExtraTest, Ed25519)
 
 TEST (EVPExtraTest, Ed25519Keygen)
 
 TEST (EVPExtraTest, MarshalEmptyPublicKey)
 
 TEST (EVPExtraTest, VerifyRecover)
 
static void TestValidPrivateKey (const uint8_t *input, size_t input_len, int expected_id)
 

Variables

static const uint8_t kExampleBadECKeyDER []
 
static const uint8_t kExampleBadECKeyDER2 []
 
static const uint8_t kExampleDSAKeyDER []
 
static const uint8_t kExampleECKeyDER []
 
static const uint8_t kExampleECKeyPKCS8 []
 
static const uint8_t kExampleECKeySpecifiedCurvePKCS8 []
 
static const uint8_t kExampleRSAKeyDER []
 
static const uint8_t kExampleRSAKeyPKCS8 []
 
static const uint8_t kInvalidPrivateKey []
 
static const uint8_t kMsg [] = {1, 2, 3, 4}
 
static const uint8_t kSignature []
 

Function Documentation

◆ ExpectECGroupAndKey()

static void ExpectECGroupAndKey ( const EVP_PKEY pkey,
int  nid 
)
static

Definition at line 713 of file evp_extra_test.cc.

◆ ExpectECGroupOnly()

static void ExpectECGroupOnly ( const EVP_PKEY pkey,
int  nid 
)
static

Definition at line 703 of file evp_extra_test.cc.

◆ LoadExampleRSAKey()

static bssl::UniquePtr<EVP_PKEY> LoadExampleRSAKey ( )
static

Definition at line 363 of file evp_extra_test.cc.

◆ ParsePrivateKey()

static bssl::UniquePtr<EVP_PKEY> ParsePrivateKey ( int  type,
const uint8_t in,
size_t  len 
)
static

Definition at line 505 of file evp_extra_test.cc.

◆ TEST() [1/10]

TEST ( EVPExtraTest  ,
BadECKey   
)

Definition at line 482 of file evp_extra_test.cc.

◆ TEST() [2/10]

TEST ( EVPExtraTest  ,
d2i_AutoPrivateKey   
)

Definition at line 461 of file evp_extra_test.cc.

◆ TEST() [3/10]

TEST ( EVPExtraTest  ,
d2i_PrivateKey   
)

Definition at line 517 of file evp_extra_test.cc.

◆ TEST() [4/10]

TEST ( EVPExtraTest  ,
DigestSignInit   
)

Definition at line 376 of file evp_extra_test.cc.

◆ TEST() [5/10]

TEST ( EVPExtraTest  ,
DigestVerifyInit   
)

Definition at line 404 of file evp_extra_test.cc.

◆ TEST() [6/10]

TEST ( EVPExtraTest  ,
ECKeygen   
)

Definition at line 723 of file evp_extra_test.cc.

◆ TEST() [7/10]

TEST ( EVPExtraTest  ,
Ed25519   
)

Definition at line 544 of file evp_extra_test.cc.

◆ TEST() [8/10]

TEST ( EVPExtraTest  ,
Ed25519Keygen   
)

Definition at line 761 of file evp_extra_test.cc.

◆ TEST() [9/10]

TEST ( EVPExtraTest  ,
MarshalEmptyPublicKey   
)

Definition at line 495 of file evp_extra_test.cc.

◆ TEST() [10/10]

TEST ( EVPExtraTest  ,
VerifyRecover   
)

Definition at line 415 of file evp_extra_test.cc.

◆ TestValidPrivateKey()

static void TestValidPrivateKey ( const uint8_t input,
size_t  input_len,
int  expected_id 
)
static

Definition at line 452 of file evp_extra_test.cc.

Variable Documentation

◆ kExampleBadECKeyDER

const uint8_t kExampleBadECKeyDER[]
static
Initial value:
= {
0x30, 0x66, 0x02, 0x01, 0x00, 0x30, 0x13, 0x06, 0x07, 0x2A, 0x86, 0x48,
0xCE, 0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03,
0x01, 0x07, 0x04, 0x4C, 0x30, 0x4A, 0x02, 0x01, 0x01, 0x04, 0x20, 0xFF,
0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xBC, 0xE6, 0xFA, 0xAD, 0xA7, 0x17, 0x9E, 0x84, 0xF3,
0xB9, 0xCA, 0xC2, 0xFC, 0x63, 0x25, 0x51, 0xA1, 0x23, 0x03, 0x21, 0x00,
0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xBC, 0xE6, 0xFA, 0xAD, 0xA7, 0x17, 0x9E, 0x84,
0xF3, 0xB9, 0xCA, 0xC2, 0xFC, 0x63, 0x25, 0x51
}

Definition at line 314 of file evp_extra_test.cc.

◆ kExampleBadECKeyDER2

const uint8_t kExampleBadECKeyDER2[]
static
Initial value:
= {
0x30, 0x77, 0x02, 0x01, 0x01, 0x04, 0x20, 0x07, 0x0f, 0x08, 0x72, 0x7a,
0xd4, 0xa0, 0x4a, 0x9c, 0xdd, 0x59, 0xc9, 0x4d, 0x89, 0x68, 0x77, 0x08,
0xb5, 0x6f, 0xc9, 0x5d, 0x30, 0x77, 0x0e, 0xe8, 0xd1, 0xc9, 0xce, 0x0a,
0x8b, 0xb4, 0x6a, 0xa0, 0x0a, 0x06, 0x08, 0x29, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0xa1, 0x44, 0x03, 0x42, 0x00, 0x04, 0xe6, 0x2b, 0x69,
0xe2, 0xbf, 0x65, 0x9f, 0x97, 0xbe, 0x2f, 0x1e, 0x0d, 0x94, 0x8a, 0x4c,
0xd5, 0x97, 0x6b, 0xb7, 0xa9, 0x1e, 0x0d, 0x46, 0xfb, 0xdd, 0xa9, 0xa9,
0x1e, 0x9d, 0xdc, 0xba, 0x5a, 0x01, 0xe7, 0xd6, 0x97, 0xa8, 0x0a, 0x18,
0xf9, 0xc3, 0xc4, 0xa3, 0x1e, 0x56, 0xe2, 0x7c, 0x83, 0x48, 0xdb, 0x16,
0x1a, 0x1c, 0xf5, 0x1d, 0x7e, 0xf1, 0x94, 0x2d, 0x4b, 0xcf, 0x72, 0x22,
0xc1, 0x30, 0x41, 0x02, 0x01, 0x00, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86,
0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d,
0x03, 0x01, 0x07, 0x04, 0x27, 0x30, 0x25, 0x02, 0x01, 0x01, 0x04, 0x20,
0x07,
}

Definition at line 330 of file evp_extra_test.cc.

◆ kExampleDSAKeyDER

const uint8_t kExampleDSAKeyDER[]
static

Definition at line 92 of file evp_extra_test.cc.

◆ kExampleECKeyDER

const uint8_t kExampleECKeyDER[]
static
Initial value:
= {
0x30, 0x77, 0x02, 0x01, 0x01, 0x04, 0x20, 0x07, 0x0f, 0x08, 0x72, 0x7a,
0xd4, 0xa0, 0x4a, 0x9c, 0xdd, 0x59, 0xc9, 0x4d, 0x89, 0x68, 0x77, 0x08,
0xb5, 0x6f, 0xc9, 0x5d, 0x30, 0x77, 0x0e, 0xe8, 0xd1, 0xc9, 0xce, 0x0a,
0x8b, 0xb4, 0x6a, 0xa0, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d,
0x03, 0x01, 0x07, 0xa1, 0x44, 0x03, 0x42, 0x00, 0x04, 0xe6, 0x2b, 0x69,
0xe2, 0xbf, 0x65, 0x9f, 0x97, 0xbe, 0x2f, 0x1e, 0x0d, 0x94, 0x8a, 0x4c,
0xd5, 0x97, 0x6b, 0xb7, 0xa9, 0x1e, 0x0d, 0x46, 0xfb, 0xdd, 0xa9, 0xa9,
0x1e, 0x9d, 0xdc, 0xba, 0x5a, 0x01, 0xe7, 0xd6, 0x97, 0xa8, 0x0a, 0x18,
0xf9, 0xc3, 0xc4, 0xa3, 0x1e, 0x56, 0xe2, 0x7c, 0x83, 0x48, 0xdb, 0x16,
0x1a, 0x1c, 0xf5, 0x1d, 0x7e, 0xf1, 0x94, 0x2d, 0x4b, 0xcf, 0x72, 0x22,
0xc1,
}

Definition at line 243 of file evp_extra_test.cc.

◆ kExampleECKeyPKCS8

const uint8_t kExampleECKeyPKCS8[]
static
Initial value:
= {
0x30, 0x81, 0x87, 0x02, 0x01, 0x00, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86,
0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d,
0x03, 0x01, 0x07, 0x04, 0x6d, 0x30, 0x6b, 0x02, 0x01, 0x01, 0x04, 0x20,
0x43, 0x09, 0xc0, 0x67, 0x75, 0x21, 0x47, 0x9d, 0xa8, 0xfa, 0x16, 0xdf,
0x15, 0x73, 0x61, 0x34, 0x68, 0x6f, 0xe3, 0x8e, 0x47, 0x91, 0x95, 0xab,
0x79, 0x4a, 0x72, 0x14, 0xcb, 0xe2, 0x49, 0x4f, 0xa1, 0x44, 0x03, 0x42,
0x00, 0x04, 0xde, 0x09, 0x08, 0x07, 0x03, 0x2e, 0x8f, 0x37, 0x9a, 0xd5,
0xad, 0xe5, 0xc6, 0x9d, 0xd4, 0x63, 0xc7, 0x4a, 0xe7, 0x20, 0xcb, 0x90,
0xa0, 0x1f, 0x18, 0x18, 0x72, 0xb5, 0x21, 0x88, 0x38, 0xc0, 0xdb, 0xba,
0xf6, 0x99, 0xd8, 0xa5, 0x3b, 0x83, 0xe9, 0xe3, 0xd5, 0x61, 0x99, 0x73,
0x42, 0xc6, 0x6c, 0xe8, 0x0a, 0x95, 0x40, 0x41, 0x3b, 0x0d, 0x10, 0xa7,
0x4a, 0x93, 0xdb, 0x5a, 0xe7, 0xec,
}

Definition at line 259 of file evp_extra_test.cc.

◆ kExampleECKeySpecifiedCurvePKCS8

const uint8_t kExampleECKeySpecifiedCurvePKCS8[]
static

Definition at line 277 of file evp_extra_test.cc.

◆ kExampleRSAKeyDER

const uint8_t kExampleRSAKeyDER[]
static

Definition at line 38 of file evp_extra_test.cc.

◆ kExampleRSAKeyPKCS8

const uint8_t kExampleRSAKeyPKCS8[]
static

Definition at line 185 of file evp_extra_test.cc.

◆ kInvalidPrivateKey

const uint8_t kInvalidPrivateKey[]
static
Initial value:
= {
0x30, 0x39, 0x02, 0x01, 0x02, 0x30, 0x09, 0x06, 0x01, 0x38, 0x08,
0x04, 0x69, 0x30, 0x30, 0x80, 0x30, 0x19, 0x01, 0x02, 0x9f, 0xf8,
0x8b, 0x29, 0x80, 0x30, 0xb0, 0x1b, 0x06, 0x09, 0x22, 0xbe, 0x08,
0x04, 0xe9, 0x30, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x3a, 0x01, 0x80,
0x09, 0x30, 0x80, 0x06, 0x01, 0x02, 0x30, 0x80, 0x30, 0x01, 0x3b,
0x02, 0x00, 0x00, 0x04, 0x20, 0x30, 0x82, 0x04, 0xe9, 0x30, 0xc3,
0xe8, 0x30, 0x01, 0x05, 0x30, 0x80, 0x30, 0x01, 0x3b, 0x01, 0x04,
0x02, 0x02, 0xff, 0x00, 0x30, 0x29, 0x02, 0x11, 0x03, 0x29, 0x29,
0x02, 0x00, 0x99, 0x30, 0x80, 0x06, 0x21, 0x02, 0x24, 0x04, 0xe8,
0x30, 0x01, 0x01, 0x04, 0x30, 0x80, 0x1b, 0x06, 0x09, 0x2a, 0x86,
0x48, 0x30, 0x01, 0xaa, 0x02, 0x86, 0xc0, 0x30, 0xdf, 0xe9, 0x80,
}

Definition at line 349 of file evp_extra_test.cc.

◆ kMsg

const uint8_t kMsg[] = {1, 2, 3, 4}
static

Definition at line 167 of file evp_extra_test.cc.

◆ kSignature

const uint8_t kSignature[]
static
Initial value:
= {
0xa5, 0xf0, 0x8a, 0x47, 0x5d, 0x3c, 0xb3, 0xcc, 0xa9, 0x79, 0xaf, 0x4d,
0x8c, 0xae, 0x4c, 0x14, 0xef, 0xc2, 0x0b, 0x34, 0x36, 0xde, 0xf4, 0x3e,
0x3d, 0xbb, 0x4a, 0x60, 0x5c, 0xc8, 0x91, 0x28, 0xda, 0xfb, 0x7e, 0x04,
0x96, 0x7e, 0x63, 0x13, 0x90, 0xce, 0xb9, 0xb4, 0x62, 0x7a, 0xfd, 0x09,
0x3d, 0xc7, 0x67, 0x78, 0x54, 0x04, 0xeb, 0x52, 0x62, 0x6e, 0x24, 0x67,
0xb4, 0x40, 0xfc, 0x57, 0x62, 0xc6, 0xf1, 0x67, 0xc1, 0x97, 0x8f, 0x6a,
0xa8, 0xae, 0x44, 0x46, 0x5e, 0xab, 0x67, 0x17, 0x53, 0x19, 0x3a, 0xda,
0x5a, 0xc8, 0x16, 0x3e, 0x86, 0xd5, 0xc5, 0x71, 0x2f, 0xfc, 0x23, 0x48,
0xd9, 0x0b, 0x13, 0xdd, 0x7b, 0x5a, 0x25, 0x79, 0xef, 0xa5, 0x7b, 0x04,
0xed, 0x44, 0xf6, 0x18, 0x55, 0xe4, 0x0a, 0xe9, 0x57, 0x79, 0x5d, 0xd7,
0x55, 0xa7, 0xab, 0x45, 0x02, 0x97, 0x60, 0x42,
}

Definition at line 169 of file evp_extra_test.cc.



grpc
Author(s):
autogenerated on Fri May 16 2025 03:01:12