lin
2025-03-22 34bf7c4dd3c00c587f836898977857f2fe9bac74
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
**********************************************************************************************************************
*                                                    eGon
*                                   the Embedded GO-ON Bootloader System
*                                           eGON arm boot sub-system
*
*                          Copyright(C), 2006-2014, Allwinner Technology Co., Ltd.
*                                           All Rights Reserved
*
* File    :
*
* By      : Jerry
*
* Version : V2.00
*
* Date      :
*
* Descript:
**********************************************************************************************************************
*/
#ifndef  _SUNXI_OPENSSL_EXT_H__
#define  _SUNXI_OPENSSL_EXT_H__
 
#include "x509.h"
#include "bn.h"
 
#define  SUNXI_EXTENSION_ITEM_MAX   (8)
 
typedef struct
{
   int  extension_num;
   u8   *name[SUNXI_EXTENSION_ITEM_MAX];
   uint name_len[SUNXI_EXTENSION_ITEM_MAX];
   u8   *value[SUNXI_EXTENSION_ITEM_MAX];
   uint value_len[SUNXI_EXTENSION_ITEM_MAX];
}
sunxi_extension_t;
 
 
typedef struct
{
   u8 *n;
   u32 n_len;
   u8 *e;
   u32 e_len;
}
sunxi_key_t;
 
 
typedef struct
{
   long version;
   long serial_num;
   sunxi_key_t        pubkey;
   sunxi_extension_t  extension;
}
sunxi_certif_info_t;
 
 
typedef struct
{
   int head;
   int head_len;
   u8 *data;
   int data_len;
}
sunxi_asn1_t;
 
int sunxi_certif_create(X509 **certif, u8 *buf, int len);
int sunxi_certif_free(X509 *certif);
int sunxi_certif_probe_serial_num(X509 *x);
int sunxi_certif_probe_version(X509 *x);
int sunxi_certif_probe_extension(X509 *x, sunxi_certif_info_t *sunxi_certif);
int sunxi_certif_probe_pubkey(X509 *x, sunxi_key_t *pubkey);
 
int sunxi_bytes_merge(u8 *dst, u32 dst_len, u8 *src, uint src_len);
 
int sunxi_certif_probe_ext(sunxi_certif_info_t *sunxi_certif, u8 *buf, u32 len);
int sunxi_certif_verify_itself(sunxi_certif_info_t *sunxi_certif, u8 *buf, u32 len);
 
int OBJ_obj2name(char *dst_buf, int buf_len, const ASN1_OBJECT *a);
int ASN1_STRING_mem(char *bp, const ASN1_STRING *v);
 
void sunxi_certif_mem_reset(void);
 
void reset_BIO_reset(void);
void reset_OBJ_nid2ln_reset(void);
void reset_CRYPTO_reset(void);
void reset_D2I_reset(void);
 
#endif