mirror of
https://github.com/apple/swift-crypto
synced 2026-11-23 04:34:21 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8f4bfa5bc1 | ||
|
|
0effb70b52 | ||
|
|
6eee6ab1d9 | ||
|
|
8b1daa33f6 | ||
|
|
ef6f94da02 | ||
|
|
9680b7251c |
No files matched your search
+3
-1
@@ -10,4 +10,6 @@ Package.resolved
|
||||
.podspecs
|
||||
DerivedData
|
||||
.swiftpm
|
||||
**/gyb.pyc
|
||||
**/gyb.pyc
|
||||
|
||||
.*.sw[nop]
|
||||
+12
-2
@@ -20,7 +20,7 @@
|
||||
// Sources/CCryptoBoringSSL directory. The source repository is at
|
||||
// https://boringssl.googlesource.com/boringssl.
|
||||
//
|
||||
// BoringSSL Commit: 67818bea6690a230e2f42e8a588e0f54949bbbf1
|
||||
// BoringSSL Commit: 9dae0ac4f0ae18ebed988d36bfb4c4e4023fc574
|
||||
|
||||
import PackageDescription
|
||||
|
||||
@@ -46,7 +46,17 @@ let package = Package(
|
||||
],
|
||||
dependencies: [],
|
||||
targets: [
|
||||
.target(name: "CCryptoBoringSSL"),
|
||||
.target(
|
||||
name: "CCryptoBoringSSL",
|
||||
cSettings: [
|
||||
/*
|
||||
* This define is required on Windows, but because we need older
|
||||
* versions of SPM, we cannot conditionally define this on Windows
|
||||
* only. Unconditionally define it instead.
|
||||
*/
|
||||
.define("WIN32_LEAN_AND_MEAN"),
|
||||
]
|
||||
),
|
||||
.target(name: "CCryptoBoringSSLShims", dependencies: ["CCryptoBoringSSL"]),
|
||||
.target(name: "Crypto", dependencies: ["CCryptoBoringSSL", "CCryptoBoringSSLShims"], swiftSettings: swiftSettings),
|
||||
.target(name: "crypto-shasum", dependencies: ["Crypto"]),
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
|
||||
int ASN1_BIT_STRING_set(ASN1_BIT_STRING *x, unsigned char *d, int len)
|
||||
{
|
||||
return M_ASN1_BIT_STRING_set(x, d, len);
|
||||
return ASN1_STRING_set(x, d, len);
|
||||
}
|
||||
|
||||
int i2c_ASN1_BIT_STRING(const ASN1_BIT_STRING *a, unsigned char **pp)
|
||||
@@ -146,7 +146,7 @@ ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,
|
||||
}
|
||||
|
||||
if ((a == NULL) || ((*a) == NULL)) {
|
||||
if ((ret = M_ASN1_BIT_STRING_new()) == NULL)
|
||||
if ((ret = ASN1_BIT_STRING_new()) == NULL)
|
||||
return (NULL);
|
||||
} else
|
||||
ret = (*a);
|
||||
@@ -188,7 +188,7 @@ ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,
|
||||
return (ret);
|
||||
err:
|
||||
if ((ret != NULL) && ((a == NULL) || (*a != ret)))
|
||||
M_ASN1_BIT_STRING_free(ret);
|
||||
ASN1_BIT_STRING_free(ret);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(const BIGNUM *bn, ASN1_ENUMERATED *ai)
|
||||
int len, j;
|
||||
|
||||
if (ai == NULL)
|
||||
ret = M_ASN1_ENUMERATED_new();
|
||||
ret = ASN1_ENUMERATED_new();
|
||||
else
|
||||
ret = ai;
|
||||
if (ret == NULL) {
|
||||
@@ -179,7 +179,7 @@ ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(const BIGNUM *bn, ASN1_ENUMERATED *ai)
|
||||
return (ret);
|
||||
err:
|
||||
if (ret != ai)
|
||||
M_ASN1_ENUMERATED_free(ret);
|
||||
ASN1_ENUMERATED_free(ret);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
|
||||
ASN1_INTEGER *ASN1_INTEGER_dup(const ASN1_INTEGER *x)
|
||||
{
|
||||
return M_ASN1_INTEGER_dup(x);
|
||||
return ASN1_STRING_dup(x);
|
||||
}
|
||||
|
||||
int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y)
|
||||
@@ -206,7 +206,7 @@ ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp,
|
||||
}
|
||||
|
||||
if ((a == NULL) || ((*a) == NULL)) {
|
||||
if ((ret = M_ASN1_INTEGER_new()) == NULL)
|
||||
if ((ret = ASN1_INTEGER_new()) == NULL)
|
||||
return (NULL);
|
||||
ret->type = V_ASN1_INTEGER;
|
||||
} else
|
||||
@@ -282,7 +282,7 @@ ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp,
|
||||
err:
|
||||
OPENSSL_PUT_ERROR(ASN1, i);
|
||||
if ((ret != NULL) && ((a == NULL) || (*a != ret)))
|
||||
M_ASN1_INTEGER_free(ret);
|
||||
ASN1_INTEGER_free(ret);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@@ -374,7 +374,7 @@ ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai)
|
||||
int len, j;
|
||||
|
||||
if (ai == NULL)
|
||||
ret = M_ASN1_INTEGER_new();
|
||||
ret = ASN1_INTEGER_new();
|
||||
else
|
||||
ret = ai;
|
||||
if (ret == NULL) {
|
||||
@@ -404,7 +404,7 @@ ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai)
|
||||
return (ret);
|
||||
err:
|
||||
if (ret != ai)
|
||||
M_ASN1_INTEGER_free(ret);
|
||||
ASN1_INTEGER_free(ret);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -250,19 +250,12 @@ void ASN1_OBJECT_free(ASN1_OBJECT *a)
|
||||
if (a == NULL)
|
||||
return;
|
||||
if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC_STRINGS) {
|
||||
#ifndef CONST_STRICT /* disable purely for compile-time strict
|
||||
* const checking. Doing this on a "real"
|
||||
* compile will cause memory leaks */
|
||||
if (a->sn != NULL)
|
||||
OPENSSL_free((void *)a->sn);
|
||||
if (a->ln != NULL)
|
||||
OPENSSL_free((void *)a->ln);
|
||||
#endif
|
||||
OPENSSL_free((void *)a->sn);
|
||||
OPENSSL_free((void *)a->ln);
|
||||
a->sn = a->ln = NULL;
|
||||
}
|
||||
if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC_DATA) {
|
||||
if (a->data != NULL)
|
||||
OPENSSL_free((void *)a->data);
|
||||
OPENSSL_free((void *)a->data);
|
||||
a->data = NULL;
|
||||
a->length = 0;
|
||||
}
|
||||
|
||||
@@ -61,17 +61,17 @@
|
||||
|
||||
ASN1_OCTET_STRING *ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *x)
|
||||
{
|
||||
return M_ASN1_OCTET_STRING_dup(x);
|
||||
return ASN1_STRING_dup(x);
|
||||
}
|
||||
|
||||
int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a,
|
||||
const ASN1_OCTET_STRING *b)
|
||||
{
|
||||
return M_ASN1_OCTET_STRING_cmp(a, b);
|
||||
return ASN1_STRING_cmp(a, b);
|
||||
}
|
||||
|
||||
int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *x, const unsigned char *d,
|
||||
int len)
|
||||
{
|
||||
return M_ASN1_OCTET_STRING_set(x, d, len);
|
||||
return ASN1_STRING_set(x, d, len);
|
||||
}
|
||||
@@ -61,6 +61,9 @@
|
||||
#include <CCryptoBoringSSL_mem.h>
|
||||
#include <CCryptoBoringSSL_obj.h>
|
||||
|
||||
#include "asn1_locl.h"
|
||||
|
||||
|
||||
int ASN1_TYPE_get(const ASN1_TYPE *a)
|
||||
{
|
||||
if ((a->value.ptr != NULL) || (a->type == V_ASN1_NULL))
|
||||
@@ -142,8 +145,7 @@ int ASN1_TYPE_cmp(const ASN1_TYPE *a, const ASN1_TYPE *b)
|
||||
case V_ASN1_UTF8STRING:
|
||||
case V_ASN1_OTHER:
|
||||
default:
|
||||
result = ASN1_STRING_cmp((ASN1_STRING *)a->value.ptr,
|
||||
(ASN1_STRING *)b->value.ptr);
|
||||
result = ASN1_STRING_cmp(a->value.asn1_string, b->value.asn1_string);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@ ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t,
|
||||
|
||||
if (s == NULL) {
|
||||
free_s = 1;
|
||||
s = M_ASN1_UTCTIME_new();
|
||||
s = ASN1_UTCTIME_new();
|
||||
}
|
||||
if (s == NULL)
|
||||
goto err;
|
||||
@@ -234,7 +234,7 @@ ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t,
|
||||
return (s);
|
||||
err:
|
||||
if (free_s && s)
|
||||
M_ASN1_UTCTIME_free(s);
|
||||
ASN1_UTCTIME_free(s);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -251,6 +251,8 @@ void ASN1_put_object(unsigned char **pp, int constructed, int length, int tag,
|
||||
|
||||
int ASN1_put_eoc(unsigned char **pp)
|
||||
{
|
||||
/* This function is no longer used in the library, but some external code
|
||||
* uses it. */
|
||||
unsigned char *p = *pp;
|
||||
*p++ = 0;
|
||||
*p++ = 0;
|
||||
@@ -311,9 +313,9 @@ int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str)
|
||||
{
|
||||
if (str == NULL)
|
||||
return 0;
|
||||
dst->type = str->type;
|
||||
if (!ASN1_STRING_set(dst, str->data, str->length))
|
||||
return 0;
|
||||
dst->type = str->type;
|
||||
dst->flags = str->flags;
|
||||
return 1;
|
||||
}
|
||||
@@ -395,13 +397,12 @@ ASN1_STRING *ASN1_STRING_type_new(int type)
|
||||
return (ret);
|
||||
}
|
||||
|
||||
void ASN1_STRING_free(ASN1_STRING *a)
|
||||
void ASN1_STRING_free(ASN1_STRING *str)
|
||||
{
|
||||
if (a == NULL)
|
||||
if (str == NULL)
|
||||
return;
|
||||
if (a->data && !(a->flags & ASN1_STRING_FLAG_NDEF))
|
||||
OPENSSL_free(a->data);
|
||||
OPENSSL_free(a);
|
||||
OPENSSL_free(str->data);
|
||||
OPENSSL_free(str);
|
||||
}
|
||||
|
||||
int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b)
|
||||
@@ -419,22 +420,22 @@ int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b)
|
||||
return (i);
|
||||
}
|
||||
|
||||
int ASN1_STRING_length(const ASN1_STRING *x)
|
||||
int ASN1_STRING_length(const ASN1_STRING *str)
|
||||
{
|
||||
return M_ASN1_STRING_length(x);
|
||||
return str->length;
|
||||
}
|
||||
|
||||
int ASN1_STRING_type(const ASN1_STRING *x)
|
||||
int ASN1_STRING_type(const ASN1_STRING *str)
|
||||
{
|
||||
return M_ASN1_STRING_type(x);
|
||||
return str->type;
|
||||
}
|
||||
|
||||
unsigned char *ASN1_STRING_data(ASN1_STRING *x)
|
||||
unsigned char *ASN1_STRING_data(ASN1_STRING *str)
|
||||
{
|
||||
return M_ASN1_STRING_data(x);
|
||||
return str->data;
|
||||
}
|
||||
|
||||
const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *x)
|
||||
const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *str)
|
||||
{
|
||||
return x->data;
|
||||
return str->data;
|
||||
}
|
||||
@@ -96,6 +96,36 @@ void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it,
|
||||
int UTF8_getc(const unsigned char *str, int len, uint32_t *val);
|
||||
int UTF8_putc(unsigned char *str, int len, uint32_t value);
|
||||
|
||||
int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
|
||||
void ASN1_template_free(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);
|
||||
int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
|
||||
const ASN1_ITEM *it, int tag, int aclass, char opt,
|
||||
ASN1_TLC *ctx);
|
||||
|
||||
int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out,
|
||||
const ASN1_ITEM *it, int tag, int aclass);
|
||||
void ASN1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
|
||||
int asn1_get_choice_selector(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
int asn1_set_choice_selector(ASN1_VALUE **pval, int value, const ASN1_ITEM *it);
|
||||
|
||||
ASN1_VALUE **asn1_get_field_ptr(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);
|
||||
|
||||
const ASN1_TEMPLATE *asn1_do_adb(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt,
|
||||
int nullerr);
|
||||
|
||||
void asn1_refcount_set_one(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
int asn1_refcount_dec_and_test_zero(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
|
||||
void asn1_enc_init(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
void asn1_enc_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
int asn1_enc_restore(int *len, unsigned char **out, ASN1_VALUE **pval,
|
||||
const ASN1_ITEM *it);
|
||||
int asn1_enc_save(ASN1_VALUE **pval, const unsigned char *in, int inlen,
|
||||
const ASN1_ITEM *it);
|
||||
|
||||
|
||||
#if defined(__cplusplus)
|
||||
} /* extern C */
|
||||
|
||||
@@ -65,6 +65,7 @@
|
||||
#include <CCryptoBoringSSL_mem.h>
|
||||
|
||||
#include "../internal.h"
|
||||
#include "asn1_locl.h"
|
||||
|
||||
/*
|
||||
* Constructed types with a recursive definition (such as can be found in PKCS7)
|
||||
@@ -95,6 +96,8 @@ static int asn1_template_noexp_d2i(ASN1_VALUE **val,
|
||||
const unsigned char **in, long len,
|
||||
const ASN1_TEMPLATE *tt, char opt,
|
||||
ASN1_TLC *ctx, int depth);
|
||||
static int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len,
|
||||
int utype, char *free_cont, const ASN1_ITEM *it);
|
||||
static int asn1_d2i_ex_primitive(ASN1_VALUE **pval,
|
||||
const unsigned char **in, long len,
|
||||
const ASN1_ITEM *it,
|
||||
@@ -166,19 +169,16 @@ static int asn1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in,
|
||||
char opt, ASN1_TLC *ctx, int depth)
|
||||
{
|
||||
const ASN1_TEMPLATE *tt, *errtt = NULL;
|
||||
const ASN1_COMPAT_FUNCS *cf;
|
||||
const ASN1_EXTERN_FUNCS *ef;
|
||||
const ASN1_AUX *aux = it->funcs;
|
||||
ASN1_aux_cb *asn1_cb;
|
||||
const unsigned char *p = NULL, *q;
|
||||
unsigned char *wp = NULL; /* BIG FAT WARNING! BREAKS CONST WHERE USED */
|
||||
unsigned char imphack = 0, oclass;
|
||||
unsigned char oclass;
|
||||
char seq_eoc, seq_nolen, cst, isopt;
|
||||
long tmplen;
|
||||
int i;
|
||||
int otag;
|
||||
int ret = 0;
|
||||
ASN1_VALUE **pchptr, *ptmpval;
|
||||
ASN1_VALUE **pchptr;
|
||||
int combine = aclass & ASN1_TFLG_COMBINE;
|
||||
aclass &= ~ASN1_TFLG_COMBINE;
|
||||
if (!pval)
|
||||
@@ -255,66 +255,6 @@ static int asn1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in,
|
||||
ef = it->funcs;
|
||||
return ef->asn1_ex_d2i(pval, in, len, it, tag, aclass, opt, ctx);
|
||||
|
||||
case ASN1_ITYPE_COMPAT:
|
||||
/* we must resort to old style evil hackery */
|
||||
cf = it->funcs;
|
||||
|
||||
/* If OPTIONAL see if it is there */
|
||||
if (opt) {
|
||||
int exptag;
|
||||
p = *in;
|
||||
if (tag == -1)
|
||||
exptag = it->utype;
|
||||
else
|
||||
exptag = tag;
|
||||
/*
|
||||
* Don't care about anything other than presence of expected tag
|
||||
*/
|
||||
|
||||
ret = asn1_check_tlen(NULL, NULL, NULL, NULL, NULL,
|
||||
&p, len, exptag, aclass, 1, ctx);
|
||||
if (!ret) {
|
||||
OPENSSL_PUT_ERROR(ASN1, ASN1_R_NESTED_ASN1_ERROR);
|
||||
goto err;
|
||||
}
|
||||
if (ret == -1)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the old style evil hack IMPLICIT handling: since the
|
||||
* underlying code is expecting a tag and class other than the one
|
||||
* present we change the buffer temporarily then change it back
|
||||
* afterwards. This doesn't and never did work for tags > 30. Yes
|
||||
* this is *horrible* but it is only needed for old style d2i which
|
||||
* will hopefully not be around for much longer. FIXME: should copy
|
||||
* the buffer then modify it so the input buffer can be const: we
|
||||
* should *always* copy because the old style d2i might modify the
|
||||
* buffer.
|
||||
*/
|
||||
|
||||
if (tag != -1) {
|
||||
wp = *(unsigned char **)in;
|
||||
imphack = *wp;
|
||||
if (p == NULL) {
|
||||
OPENSSL_PUT_ERROR(ASN1, ASN1_R_NESTED_ASN1_ERROR);
|
||||
goto err;
|
||||
}
|
||||
*wp = (unsigned char)((*p & V_ASN1_CONSTRUCTED)
|
||||
| it->utype);
|
||||
}
|
||||
|
||||
ptmpval = cf->asn1_d2i(pval, in, len);
|
||||
|
||||
if (tag != -1)
|
||||
*wp = imphack;
|
||||
|
||||
if (ptmpval)
|
||||
return 1;
|
||||
|
||||
OPENSSL_PUT_ERROR(ASN1, ASN1_R_NESTED_ASN1_ERROR);
|
||||
goto err;
|
||||
|
||||
case ASN1_ITYPE_CHOICE:
|
||||
if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it, NULL))
|
||||
goto auxerr;
|
||||
@@ -370,10 +310,8 @@ static int asn1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in,
|
||||
*in = p;
|
||||
return 1;
|
||||
|
||||
case ASN1_ITYPE_NDEF_SEQUENCE:
|
||||
case ASN1_ITYPE_SEQUENCE:
|
||||
p = *in;
|
||||
tmplen = len;
|
||||
|
||||
/* If no IMPLICIT tagging set to SEQUENCE, UNIVERSAL */
|
||||
if (tag == -1) {
|
||||
@@ -388,13 +326,8 @@ static int asn1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in,
|
||||
goto err;
|
||||
} else if (ret == -1)
|
||||
return -1;
|
||||
if (aux && (aux->flags & ASN1_AFLG_BROKEN)) {
|
||||
len = tmplen - (p - *in);
|
||||
seq_nolen = 1;
|
||||
}
|
||||
/* If indefinite we don't do a length check */
|
||||
else
|
||||
seq_nolen = seq_eoc;
|
||||
seq_nolen = seq_eoc;
|
||||
if (!cst) {
|
||||
OPENSSL_PUT_ERROR(ASN1, ASN1_R_SEQUENCE_NOT_CONSTRUCTED);
|
||||
goto err;
|
||||
@@ -649,7 +582,7 @@ static int asn1_template_noexp_d2i(ASN1_VALUE **val,
|
||||
} else if (ret == -1)
|
||||
return -1;
|
||||
if (!*val)
|
||||
*val = (ASN1_VALUE *)sk_new_null();
|
||||
*val = (ASN1_VALUE *)sk_ASN1_VALUE_new_null();
|
||||
else {
|
||||
/*
|
||||
* We've got a valid STACK: free up any items present
|
||||
@@ -860,19 +793,19 @@ static int asn1_d2i_ex_primitive(ASN1_VALUE **pval,
|
||||
|
||||
/* Translate ASN1 content octets into a structure */
|
||||
|
||||
int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len,
|
||||
int utype, char *free_cont, const ASN1_ITEM *it)
|
||||
static int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len,
|
||||
int utype, char *free_cont, const ASN1_ITEM *it)
|
||||
{
|
||||
ASN1_VALUE **opval = NULL;
|
||||
ASN1_STRING *stmp;
|
||||
ASN1_TYPE *typ = NULL;
|
||||
int ret = 0;
|
||||
const ASN1_PRIMITIVE_FUNCS *pf;
|
||||
ASN1_INTEGER **tint;
|
||||
pf = it->funcs;
|
||||
|
||||
if (pf && pf->prim_c2i)
|
||||
return pf->prim_c2i(pval, cont, len, utype, free_cont, it);
|
||||
/* Historically, |it->funcs| for primitive types contained an
|
||||
* |ASN1_PRIMITIVE_FUNCS| table of callbacks. */
|
||||
assert(it->funcs == NULL);
|
||||
|
||||
/* If ANY type clear type and set pointer to internal value */
|
||||
if (it->utype == V_ASN1_ANY) {
|
||||
if (!*pval) {
|
||||
@@ -1055,15 +988,13 @@ static int asn1_find_end(const unsigned char **in, long len, char inf)
|
||||
* constructed type and 'inf' should be set if it is indefinite length.
|
||||
*/
|
||||
|
||||
#ifndef ASN1_MAX_STRING_NEST
|
||||
/*
|
||||
* This determines how many levels of recursion are permitted in ASN1 string
|
||||
* types. If it is not limited stack overflows can occur. If set to zero no
|
||||
* recursion is allowed at all. Although zero should be adequate examples
|
||||
* exist that require a value of 1. So 5 should be more than enough.
|
||||
*/
|
||||
# define ASN1_MAX_STRING_NEST 5
|
||||
#endif
|
||||
#define ASN1_MAX_STRING_NEST 5
|
||||
|
||||
static int asn1_collect(BUF_MEM *buf, const unsigned char **in, long len,
|
||||
char inf, int tag, int aclass, int depth)
|
||||
|
||||
@@ -63,10 +63,13 @@
|
||||
#include <CCryptoBoringSSL_mem.h>
|
||||
|
||||
#include "../internal.h"
|
||||
#include "asn1_locl.h"
|
||||
|
||||
|
||||
static int asn1_i2d_ex_primitive(ASN1_VALUE **pval, unsigned char **out,
|
||||
const ASN1_ITEM *it, int tag, int aclass);
|
||||
static int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype,
|
||||
const ASN1_ITEM *it);
|
||||
static int asn1_set_seq_out(STACK_OF(ASN1_VALUE) *sk, unsigned char **out,
|
||||
int skcontlen, const ASN1_ITEM *item,
|
||||
int do_sort, int iclass);
|
||||
@@ -76,16 +79,9 @@ static int asn1_item_flags_i2d(ASN1_VALUE *val, unsigned char **out,
|
||||
const ASN1_ITEM *it, int flags);
|
||||
|
||||
/*
|
||||
* Top level i2d equivalents: the 'ndef' variant instructs the encoder to use
|
||||
* indefinite length constructed encoding, where appropriate
|
||||
* Top level i2d equivalents
|
||||
*/
|
||||
|
||||
int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out,
|
||||
const ASN1_ITEM *it)
|
||||
{
|
||||
return asn1_item_flags_i2d(val, out, it, ASN1_TFLG_NDEF);
|
||||
}
|
||||
|
||||
int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it)
|
||||
{
|
||||
return asn1_item_flags_i2d(val, out, it, 0);
|
||||
@@ -128,9 +124,7 @@ int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out,
|
||||
const ASN1_ITEM *it, int tag, int aclass)
|
||||
{
|
||||
const ASN1_TEMPLATE *tt = NULL;
|
||||
unsigned char *p = NULL;
|
||||
int i, seqcontlen, seqlen, ndef = 1;
|
||||
const ASN1_COMPAT_FUNCS *cf;
|
||||
int i, seqcontlen, seqlen;
|
||||
const ASN1_EXTERN_FUNCS *ef;
|
||||
const ASN1_AUX *aux = it->funcs;
|
||||
ASN1_aux_cb *asn1_cb = 0;
|
||||
@@ -174,26 +168,6 @@ int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out,
|
||||
ef = it->funcs;
|
||||
return ef->asn1_ex_i2d(pval, out, it, tag, aclass);
|
||||
|
||||
case ASN1_ITYPE_COMPAT:
|
||||
/* old style hackery... */
|
||||
cf = it->funcs;
|
||||
if (out)
|
||||
p = *out;
|
||||
i = cf->asn1_i2d(*pval, out);
|
||||
/*
|
||||
* Fixup for IMPLICIT tag: note this messes up for tags > 30, but so
|
||||
* did the old code. Tags > 30 are very rare anyway.
|
||||
*/
|
||||
if (out && (tag != -1))
|
||||
*p = aclass | tag | (*p & V_ASN1_CONSTRUCTED);
|
||||
return i;
|
||||
|
||||
case ASN1_ITYPE_NDEF_SEQUENCE:
|
||||
/* Use indefinite length constructed if requested */
|
||||
if (aclass & ASN1_TFLG_NDEF)
|
||||
ndef = 2;
|
||||
OPENSSL_FALLTHROUGH;
|
||||
|
||||
case ASN1_ITYPE_SEQUENCE:
|
||||
i = asn1_enc_restore(&seqcontlen, out, pval, it);
|
||||
/* An error occurred */
|
||||
@@ -228,11 +202,11 @@ int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out,
|
||||
seqcontlen += tmplen;
|
||||
}
|
||||
|
||||
seqlen = ASN1_object_size(ndef, seqcontlen, tag);
|
||||
seqlen = ASN1_object_size(/*constructed=*/1, seqcontlen, tag);
|
||||
if (!out || seqlen == -1)
|
||||
return seqlen;
|
||||
/* Output SEQUENCE header */
|
||||
ASN1_put_object(out, ndef, seqcontlen, tag, aclass);
|
||||
ASN1_put_object(out, /*constructed=*/1, seqcontlen, tag, aclass);
|
||||
for (i = 0, tt = it->templates; i < it->tcount; tt++, i++) {
|
||||
const ASN1_TEMPLATE *seqtt;
|
||||
ASN1_VALUE **pseqval;
|
||||
@@ -243,8 +217,6 @@ int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out,
|
||||
/* FIXME: check for errors in enhanced version */
|
||||
asn1_template_ex_i2d(pseqval, out, seqtt, -1, aclass);
|
||||
}
|
||||
if (ndef == 2)
|
||||
ASN1_put_eoc(out);
|
||||
if (asn1_cb && !asn1_cb(ASN1_OP_I2D_POST, pval, it, NULL))
|
||||
return 0;
|
||||
return seqlen;
|
||||
@@ -259,7 +231,7 @@ int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out,
|
||||
static int asn1_template_ex_i2d(ASN1_VALUE **pval, unsigned char **out,
|
||||
const ASN1_TEMPLATE *tt, int tag, int iclass)
|
||||
{
|
||||
int i, ret, flags, ttag, tclass, ndef;
|
||||
int i, ret, flags, ttag, tclass;
|
||||
size_t j;
|
||||
flags = tt->flags;
|
||||
/*
|
||||
@@ -295,12 +267,6 @@ static int asn1_template_ex_i2d(ASN1_VALUE **pval, unsigned char **out,
|
||||
* class and iclass is any flags passed to this function.
|
||||
*/
|
||||
|
||||
/* if template and arguments require ndef, use it */
|
||||
if ((flags & ASN1_TFLG_NDEF) && (iclass & ASN1_TFLG_NDEF))
|
||||
ndef = 2;
|
||||
else
|
||||
ndef = 1;
|
||||
|
||||
if (flags & ASN1_TFLG_SK_MASK) {
|
||||
/* SET OF, SEQUENCE OF */
|
||||
STACK_OF(ASN1_VALUE) *sk = (STACK_OF(ASN1_VALUE) *)*pval;
|
||||
@@ -345,12 +311,12 @@ static int asn1_template_ex_i2d(ASN1_VALUE **pval, unsigned char **out,
|
||||
return -1;
|
||||
skcontlen += tmplen;
|
||||
}
|
||||
sklen = ASN1_object_size(ndef, skcontlen, sktag);
|
||||
sklen = ASN1_object_size(/*constructed=*/1, skcontlen, sktag);
|
||||
if (sklen == -1)
|
||||
return -1;
|
||||
/* If EXPLICIT need length of surrounding tag */
|
||||
if (flags & ASN1_TFLG_EXPTAG)
|
||||
ret = ASN1_object_size(ndef, sklen, ttag);
|
||||
ret = ASN1_object_size(/*constructed=*/1, sklen, ttag);
|
||||
else
|
||||
ret = sklen;
|
||||
|
||||
@@ -360,18 +326,12 @@ static int asn1_template_ex_i2d(ASN1_VALUE **pval, unsigned char **out,
|
||||
/* Now encode this lot... */
|
||||
/* EXPLICIT tag */
|
||||
if (flags & ASN1_TFLG_EXPTAG)
|
||||
ASN1_put_object(out, ndef, sklen, ttag, tclass);
|
||||
ASN1_put_object(out, /*constructed=*/1, sklen, ttag, tclass);
|
||||
/* SET or SEQUENCE and IMPLICIT tag */
|
||||
ASN1_put_object(out, ndef, skcontlen, sktag, skaclass);
|
||||
ASN1_put_object(out, /*constructed=*/1, skcontlen, sktag, skaclass);
|
||||
/* And the stuff itself */
|
||||
asn1_set_seq_out(sk, out, skcontlen, ASN1_ITEM_ptr(tt->item),
|
||||
isset, iclass);
|
||||
if (ndef == 2) {
|
||||
ASN1_put_eoc(out);
|
||||
if (flags & ASN1_TFLG_EXPTAG)
|
||||
ASN1_put_eoc(out);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -382,13 +342,11 @@ static int asn1_template_ex_i2d(ASN1_VALUE **pval, unsigned char **out,
|
||||
if (!i)
|
||||
return 0;
|
||||
/* Find length of EXPLICIT tag */
|
||||
ret = ASN1_object_size(ndef, i, ttag);
|
||||
ret = ASN1_object_size(/*constructed=*/1, i, ttag);
|
||||
if (out && ret != -1) {
|
||||
/* Output tag and item */
|
||||
ASN1_put_object(out, ndef, i, ttag, tclass);
|
||||
ASN1_put_object(out, /*constructed=*/1, i, ttag, tclass);
|
||||
ASN1_item_ex_i2d(pval, out, ASN1_ITEM_ptr(tt->item), -1, iclass);
|
||||
if (ndef == 2)
|
||||
ASN1_put_eoc(out);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -487,7 +445,6 @@ static int asn1_i2d_ex_primitive(ASN1_VALUE **pval, unsigned char **out,
|
||||
int len;
|
||||
int utype;
|
||||
int usetag;
|
||||
int ndef = 0;
|
||||
|
||||
utype = it->utype;
|
||||
|
||||
@@ -513,12 +470,6 @@ static int asn1_i2d_ex_primitive(ASN1_VALUE **pval, unsigned char **out,
|
||||
if (len == -1)
|
||||
return 0;
|
||||
|
||||
/* -2 return is special meaning use ndef */
|
||||
if (len == -2) {
|
||||
ndef = 2;
|
||||
len = 0;
|
||||
}
|
||||
|
||||
/* If not implicitly tagged get tag from underlying type */
|
||||
if (tag == -1)
|
||||
tag = utype;
|
||||
@@ -526,23 +477,20 @@ static int asn1_i2d_ex_primitive(ASN1_VALUE **pval, unsigned char **out,
|
||||
/* Output tag+length followed by content octets */
|
||||
if (out) {
|
||||
if (usetag)
|
||||
ASN1_put_object(out, ndef, len, tag, aclass);
|
||||
ASN1_put_object(out, /*constructed=*/0, len, tag, aclass);
|
||||
asn1_ex_i2c(pval, *out, &utype, it);
|
||||
if (ndef)
|
||||
ASN1_put_eoc(out);
|
||||
else
|
||||
*out += len;
|
||||
*out += len;
|
||||
}
|
||||
|
||||
if (usetag)
|
||||
return ASN1_object_size(ndef, len, tag);
|
||||
return ASN1_object_size(/*constructed=*/0, len, tag);
|
||||
return len;
|
||||
}
|
||||
|
||||
/* Produce content octets from a structure */
|
||||
|
||||
int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cout, int *putype,
|
||||
const ASN1_ITEM *it)
|
||||
static int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cout, int *putype,
|
||||
const ASN1_ITEM *it)
|
||||
{
|
||||
ASN1_BOOLEAN *tbool = NULL;
|
||||
ASN1_STRING *strtmp;
|
||||
@@ -551,10 +499,10 @@ int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cout, int *putype,
|
||||
const unsigned char *cont;
|
||||
unsigned char c;
|
||||
int len;
|
||||
const ASN1_PRIMITIVE_FUNCS *pf;
|
||||
pf = it->funcs;
|
||||
if (pf && pf->prim_i2c)
|
||||
return pf->prim_i2c(pval, cout, putype, it);
|
||||
|
||||
/* Historically, |it->funcs| for primitive types contained an
|
||||
* |ASN1_PRIMITIVE_FUNCS| table of callbacks. */
|
||||
assert(it->funcs == NULL);
|
||||
|
||||
/* Should type be omitted? */
|
||||
if ((it->itype != ASN1_ITYPE_PRIMITIVE)
|
||||
@@ -642,16 +590,6 @@ int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cout, int *putype,
|
||||
default:
|
||||
/* All based on ASN1_STRING and handled the same */
|
||||
strtmp = (ASN1_STRING *)*pval;
|
||||
/* Special handling for NDEF */
|
||||
if ((it->size == ASN1_TFLG_NDEF)
|
||||
&& (strtmp->flags & ASN1_STRING_FLAG_NDEF)) {
|
||||
if (cout) {
|
||||
strtmp->data = cout;
|
||||
strtmp->length = 0;
|
||||
}
|
||||
/* Special return code */
|
||||
return -2;
|
||||
}
|
||||
cont = strtmp->data;
|
||||
len = strtmp->length;
|
||||
|
||||
|
||||
@@ -56,6 +56,8 @@
|
||||
|
||||
#include <CCryptoBoringSSL_asn1.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <CCryptoBoringSSL_asn1t.h>
|
||||
#include <CCryptoBoringSSL_mem.h>
|
||||
|
||||
@@ -77,7 +79,6 @@ void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int combine)
|
||||
{
|
||||
const ASN1_TEMPLATE *tt = NULL, *seqtt;
|
||||
const ASN1_EXTERN_FUNCS *ef;
|
||||
const ASN1_COMPAT_FUNCS *cf;
|
||||
const ASN1_AUX *aux = it->funcs;
|
||||
ASN1_aux_cb *asn1_cb;
|
||||
int i;
|
||||
@@ -124,19 +125,12 @@ void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int combine)
|
||||
}
|
||||
break;
|
||||
|
||||
case ASN1_ITYPE_COMPAT:
|
||||
cf = it->funcs;
|
||||
if (cf && cf->asn1_free)
|
||||
cf->asn1_free(*pval);
|
||||
break;
|
||||
|
||||
case ASN1_ITYPE_EXTERN:
|
||||
ef = it->funcs;
|
||||
if (ef && ef->asn1_ex_free)
|
||||
ef->asn1_ex_free(pval, it);
|
||||
break;
|
||||
|
||||
case ASN1_ITYPE_NDEF_SEQUENCE:
|
||||
case ASN1_ITYPE_SEQUENCE:
|
||||
if (!asn1_refcount_dec_and_test_zero(pval, it))
|
||||
return;
|
||||
@@ -190,14 +184,9 @@ void ASN1_template_free(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
|
||||
void ASN1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
|
||||
{
|
||||
int utype;
|
||||
if (it) {
|
||||
const ASN1_PRIMITIVE_FUNCS *pf;
|
||||
pf = it->funcs;
|
||||
if (pf && pf->prim_free) {
|
||||
pf->prim_free(pval, it);
|
||||
return;
|
||||
}
|
||||
}
|
||||
/* Historically, |it->funcs| for primitive types contained an
|
||||
* |ASN1_PRIMITIVE_FUNCS| table of calbacks. */
|
||||
assert(it == NULL || it->funcs == NULL);
|
||||
/* Special case: if 'it' is NULL free contents of ASN1_TYPE */
|
||||
if (!it) {
|
||||
ASN1_TYPE *typ = (ASN1_TYPE *)*pval;
|
||||
|
||||
@@ -70,7 +70,9 @@
|
||||
static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
|
||||
int combine);
|
||||
static void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
static int ASN1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);
|
||||
static void asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);
|
||||
static int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
static void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
|
||||
ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it)
|
||||
@@ -92,7 +94,6 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
|
||||
int combine)
|
||||
{
|
||||
const ASN1_TEMPLATE *tt = NULL;
|
||||
const ASN1_COMPAT_FUNCS *cf;
|
||||
const ASN1_EXTERN_FUNCS *ef;
|
||||
const ASN1_AUX *aux = it->funcs;
|
||||
ASN1_aux_cb *asn1_cb;
|
||||
@@ -103,11 +104,6 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
|
||||
else
|
||||
asn1_cb = 0;
|
||||
|
||||
#ifdef CRYPTO_MDEBUG
|
||||
if (it->sname)
|
||||
CRYPTO_push_info(it->sname);
|
||||
#endif
|
||||
|
||||
switch (it->itype) {
|
||||
|
||||
case ASN1_ITYPE_EXTERN:
|
||||
@@ -118,15 +114,6 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
|
||||
}
|
||||
break;
|
||||
|
||||
case ASN1_ITYPE_COMPAT:
|
||||
cf = it->funcs;
|
||||
if (cf && cf->asn1_new) {
|
||||
*pval = cf->asn1_new();
|
||||
if (!*pval)
|
||||
goto memerr;
|
||||
}
|
||||
break;
|
||||
|
||||
case ASN1_ITYPE_PRIMITIVE:
|
||||
if (it->templates) {
|
||||
if (!ASN1_template_new(pval, it->templates))
|
||||
@@ -146,10 +133,6 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
|
||||
if (!i)
|
||||
goto auxerr;
|
||||
if (i == 2) {
|
||||
#ifdef CRYPTO_MDEBUG
|
||||
if (it->sname)
|
||||
CRYPTO_pop_info();
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -164,17 +147,12 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
|
||||
goto auxerr2;
|
||||
break;
|
||||
|
||||
case ASN1_ITYPE_NDEF_SEQUENCE:
|
||||
case ASN1_ITYPE_SEQUENCE:
|
||||
if (asn1_cb) {
|
||||
i = asn1_cb(ASN1_OP_NEW_PRE, pval, it, NULL);
|
||||
if (!i)
|
||||
goto auxerr;
|
||||
if (i == 2) {
|
||||
#ifdef CRYPTO_MDEBUG
|
||||
if (it->sname)
|
||||
CRYPTO_pop_info();
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -195,30 +173,18 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
|
||||
goto auxerr2;
|
||||
break;
|
||||
}
|
||||
#ifdef CRYPTO_MDEBUG
|
||||
if (it->sname)
|
||||
CRYPTO_pop_info();
|
||||
#endif
|
||||
return 1;
|
||||
|
||||
memerr2:
|
||||
asn1_item_combine_free(pval, it, combine);
|
||||
memerr:
|
||||
OPENSSL_PUT_ERROR(ASN1, ERR_R_MALLOC_FAILURE);
|
||||
#ifdef CRYPTO_MDEBUG
|
||||
if (it->sname)
|
||||
CRYPTO_pop_info();
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
auxerr2:
|
||||
asn1_item_combine_free(pval, it, combine);
|
||||
auxerr:
|
||||
OPENSSL_PUT_ERROR(ASN1, ASN1_R_AUX_ERROR);
|
||||
#ifdef CRYPTO_MDEBUG
|
||||
if (it->sname)
|
||||
CRYPTO_pop_info();
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
}
|
||||
@@ -248,16 +214,14 @@ static void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it)
|
||||
asn1_primitive_clear(pval, it);
|
||||
break;
|
||||
|
||||
case ASN1_ITYPE_COMPAT:
|
||||
case ASN1_ITYPE_CHOICE:
|
||||
case ASN1_ITYPE_SEQUENCE:
|
||||
case ASN1_ITYPE_NDEF_SEQUENCE:
|
||||
*pval = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int ASN1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
|
||||
static int ASN1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
|
||||
{
|
||||
const ASN1_ITEM *it = ASN1_ITEM_ptr(tt->item);
|
||||
int ret;
|
||||
@@ -271,10 +235,6 @@ int ASN1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
|
||||
*pval = NULL;
|
||||
return 1;
|
||||
}
|
||||
#ifdef CRYPTO_MDEBUG
|
||||
if (tt->field_name)
|
||||
CRYPTO_push_info(tt->field_name);
|
||||
#endif
|
||||
/* If SET OF or SEQUENCE OF, its a STACK */
|
||||
if (tt->flags & ASN1_TFLG_SK_MASK) {
|
||||
STACK_OF(ASN1_VALUE) *skval;
|
||||
@@ -291,10 +251,6 @@ int ASN1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
|
||||
/* Otherwise pass it back to the item routine */
|
||||
ret = asn1_item_ex_combine_new(pval, it, tt->flags & ASN1_TFLG_COMBINE);
|
||||
done:
|
||||
#ifdef CRYPTO_MDEBUG
|
||||
if (it->sname)
|
||||
CRYPTO_pop_info();
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -312,7 +268,7 @@ static void asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
|
||||
* all the old functions.
|
||||
*/
|
||||
|
||||
int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
|
||||
static int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
|
||||
{
|
||||
ASN1_TYPE *typ;
|
||||
ASN1_STRING *str;
|
||||
@@ -321,11 +277,9 @@ int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
|
||||
if (!it)
|
||||
return 0;
|
||||
|
||||
if (it->funcs) {
|
||||
const ASN1_PRIMITIVE_FUNCS *pf = it->funcs;
|
||||
if (pf->prim_new)
|
||||
return pf->prim_new(pval, it);
|
||||
}
|
||||
/* Historically, |it->funcs| for primitive types contained an
|
||||
* |ASN1_PRIMITIVE_FUNCS| table of calbacks. */
|
||||
assert(it->funcs == NULL);
|
||||
|
||||
if (it->itype == ASN1_ITYPE_MSTRING)
|
||||
utype = -1;
|
||||
@@ -368,14 +322,9 @@ int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
|
||||
static void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it)
|
||||
{
|
||||
int utype;
|
||||
if (it && it->funcs) {
|
||||
const ASN1_PRIMITIVE_FUNCS *pf = it->funcs;
|
||||
if (pf->prim_clear)
|
||||
pf->prim_clear(pval, it);
|
||||
else
|
||||
*pval = NULL;
|
||||
return;
|
||||
}
|
||||
/* Historically, |it->funcs| for primitive types contained an
|
||||
* |ASN1_PRIMITIVE_FUNCS| table of calbacks. */
|
||||
assert(it == NULL || it->funcs == NULL);
|
||||
if (!it || (it->itype == ASN1_ITYPE_MSTRING))
|
||||
utype = -1;
|
||||
else
|
||||
|
||||
@@ -117,8 +117,6 @@ IMPLEMENT_ASN1_TYPE_ex(ASN1_FBOOLEAN, ASN1_BOOLEAN, 0)
|
||||
|
||||
/* Special, OCTET STRING with indefinite length constructed support */
|
||||
|
||||
IMPLEMENT_ASN1_TYPE_ex(ASN1_OCTET_STRING_NDEF, ASN1_OCTET_STRING, ASN1_TFLG_NDEF)
|
||||
|
||||
ASN1_ITEM_TEMPLATE(ASN1_SEQUENCE_ANY) =
|
||||
ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, ASN1_SEQUENCE_ANY, ASN1_ANY)
|
||||
ASN1_ITEM_TEMPLATE_END(ASN1_SEQUENCE_ANY)
|
||||
|
||||
@@ -66,6 +66,7 @@
|
||||
#include <CCryptoBoringSSL_thread.h>
|
||||
|
||||
#include "../internal.h"
|
||||
#include "asn1_locl.h"
|
||||
|
||||
|
||||
/* Utility functions for manipulating fields and offsets */
|
||||
@@ -91,8 +92,7 @@ int asn1_set_choice_selector(ASN1_VALUE **pval, int value,
|
||||
|
||||
static CRYPTO_refcount_t *asn1_get_references(ASN1_VALUE **pval,
|
||||
const ASN1_ITEM *it) {
|
||||
if (it->itype != ASN1_ITYPE_SEQUENCE &&
|
||||
it->itype != ASN1_ITYPE_NDEF_SEQUENCE) {
|
||||
if (it->itype != ASN1_ITYPE_SEQUENCE) {
|
||||
return NULL;
|
||||
}
|
||||
const ASN1_AUX *aux = it->funcs;
|
||||
|
||||
@@ -262,6 +262,8 @@ int BIO_should_io_special(const BIO *bio) {
|
||||
|
||||
int BIO_get_retry_reason(const BIO *bio) { return bio->retry_reason; }
|
||||
|
||||
void BIO_set_retry_reason(BIO *bio, int reason) { bio->retry_reason = reason; }
|
||||
|
||||
void BIO_clear_flags(BIO *bio, int flags) {
|
||||
bio->flags &= ~flags;
|
||||
}
|
||||
|
||||
@@ -20,25 +20,18 @@
|
||||
|
||||
int BN_parse_asn1_unsigned(CBS *cbs, BIGNUM *ret) {
|
||||
CBS child;
|
||||
int is_negative;
|
||||
if (!CBS_get_asn1(cbs, &child, CBS_ASN1_INTEGER) ||
|
||||
CBS_len(&child) == 0) {
|
||||
!CBS_is_valid_asn1_integer(&child, &is_negative)) {
|
||||
OPENSSL_PUT_ERROR(BN, BN_R_BAD_ENCODING);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (CBS_data(&child)[0] & 0x80) {
|
||||
if (is_negative) {
|
||||
OPENSSL_PUT_ERROR(BN, BN_R_NEGATIVE_NUMBER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// INTEGERs must be minimal.
|
||||
if (CBS_data(&child)[0] == 0x00 &&
|
||||
CBS_len(&child) > 1 &&
|
||||
!(CBS_data(&child)[1] & 0x80)) {
|
||||
OPENSSL_PUT_ERROR(BN, BN_R_BAD_ENCODING);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return BN_bin2bn(CBS_data(&child), CBS_len(&child), ret) != NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -426,29 +426,14 @@ int CBS_peek_asn1_tag(const CBS *cbs, unsigned tag_value) {
|
||||
|
||||
int CBS_get_asn1_uint64(CBS *cbs, uint64_t *out) {
|
||||
CBS bytes;
|
||||
if (!CBS_get_asn1(cbs, &bytes, CBS_ASN1_INTEGER)) {
|
||||
if (!CBS_get_asn1(cbs, &bytes, CBS_ASN1_INTEGER) ||
|
||||
!CBS_is_unsigned_asn1_integer(&bytes)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
*out = 0;
|
||||
const uint8_t *data = CBS_data(&bytes);
|
||||
size_t len = CBS_len(&bytes);
|
||||
|
||||
if (len == 0) {
|
||||
// An INTEGER is encoded with at least one octet.
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((data[0] & 0x80) != 0) {
|
||||
// Negative number.
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (data[0] == 0 && len > 1 && (data[1] & 0x80) == 0) {
|
||||
// Extra leading zeros.
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < len; i++) {
|
||||
if ((*out >> 56) != 0) {
|
||||
// Too large to represent as a uint64_t.
|
||||
@@ -462,31 +447,21 @@ int CBS_get_asn1_uint64(CBS *cbs, uint64_t *out) {
|
||||
}
|
||||
|
||||
int CBS_get_asn1_int64(CBS *cbs, int64_t *out) {
|
||||
int is_negative;
|
||||
CBS bytes;
|
||||
if (!CBS_get_asn1(cbs, &bytes, CBS_ASN1_INTEGER)) {
|
||||
if (!CBS_get_asn1(cbs, &bytes, CBS_ASN1_INTEGER) ||
|
||||
!CBS_is_valid_asn1_integer(&bytes, &is_negative)) {
|
||||
return 0;
|
||||
}
|
||||
const uint8_t *data = CBS_data(&bytes);
|
||||
const size_t len = CBS_len(&bytes);
|
||||
|
||||
if (len == 0 || len > sizeof(int64_t)) {
|
||||
// An INTEGER is encoded with at least one octet.
|
||||
if (len > sizeof(int64_t)) {
|
||||
return 0;
|
||||
}
|
||||
if (len > 1) {
|
||||
if (data[0] == 0 && (data[1] & 0x80) == 0) {
|
||||
return 0; // Extra leading zeros.
|
||||
}
|
||||
if (data[0] == 0xff && (data[1] & 0x80) != 0) {
|
||||
return 0; // Extra leading 0xff.
|
||||
}
|
||||
}
|
||||
|
||||
union {
|
||||
int64_t i;
|
||||
uint8_t bytes[sizeof(int64_t)];
|
||||
} u;
|
||||
const int is_negative = (data[0] & 0x80);
|
||||
memset(u.bytes, is_negative ? 0xff : 0, sizeof(u.bytes)); // Sign-extend.
|
||||
for (size_t i = 0; i < len; i++) {
|
||||
u.bytes[i] = data[len - i - 1];
|
||||
@@ -635,6 +610,30 @@ int CBS_asn1_bitstring_has_bit(const CBS *cbs, unsigned bit) {
|
||||
(CBS_data(cbs)[byte_num] & (1 << bit_num)) != 0;
|
||||
}
|
||||
|
||||
int CBS_is_valid_asn1_integer(const CBS *cbs, int *out_is_negative) {
|
||||
CBS copy = *cbs;
|
||||
uint8_t first_byte, second_byte;
|
||||
if (!CBS_get_u8(©, &first_byte)) {
|
||||
return 0; // INTEGERs may not be empty.
|
||||
}
|
||||
if (out_is_negative != NULL) {
|
||||
*out_is_negative = (first_byte & 0x80) != 0;
|
||||
}
|
||||
if (!CBS_get_u8(©, &second_byte)) {
|
||||
return 1; // One byte INTEGERs are always minimal.
|
||||
}
|
||||
if ((first_byte == 0x00 && (second_byte & 0x80) == 0) ||
|
||||
(first_byte == 0xff && (second_byte & 0x80) != 0)) {
|
||||
return 0; // The value is minimal iff the first 9 bits are not all equal.
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int CBS_is_unsigned_asn1_integer(const CBS *cbs) {
|
||||
int is_negative;
|
||||
return CBS_is_valid_asn1_integer(cbs, &is_negative) && !is_negative;
|
||||
}
|
||||
|
||||
static int add_decimal(CBB *out, uint64_t v) {
|
||||
char buf[DECIMAL_SIZE(uint64_t) + 1];
|
||||
BIO_snprintf(buf, sizeof(buf), "%" PRIu64, v);
|
||||
|
||||
@@ -0,0 +1,979 @@
|
||||
#define BORINGSSL_PREFIX CCryptoBoringSSL
|
||||
#if defined(__i386__) && defined(_WIN32)
|
||||
# This file is generated from a similarly-named Perl script in the BoringSSL
|
||||
# source tree. Do not edit by hand.
|
||||
|
||||
#if defined(__i386__)
|
||||
#if defined(BORINGSSL_PREFIX)
|
||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||
#endif
|
||||
.text
|
||||
.globl _ChaCha20_ctr32
|
||||
.hidden _ChaCha20_ctr32
|
||||
.def _ChaCha20_ctr32; .scl 2; .type 32; .endef
|
||||
.align 16
|
||||
_ChaCha20_ctr32:
|
||||
.L_ChaCha20_ctr32_begin:
|
||||
pushl %ebp
|
||||
pushl %ebx
|
||||
pushl %esi
|
||||
pushl %edi
|
||||
xorl %eax,%eax
|
||||
cmpl 28(%esp),%eax
|
||||
je .L000no_data
|
||||
call .Lpic_point
|
||||
.Lpic_point:
|
||||
popl %eax
|
||||
leal _OPENSSL_ia32cap_P,%ebp
|
||||
testl $16777216,(%ebp)
|
||||
jz .L001x86
|
||||
testl $512,4(%ebp)
|
||||
jz .L001x86
|
||||
jmp .Lssse3_shortcut
|
||||
.L001x86:
|
||||
movl 32(%esp),%esi
|
||||
movl 36(%esp),%edi
|
||||
subl $132,%esp
|
||||
movl (%esi),%eax
|
||||
movl 4(%esi),%ebx
|
||||
movl 8(%esi),%ecx
|
||||
movl 12(%esi),%edx
|
||||
movl %eax,80(%esp)
|
||||
movl %ebx,84(%esp)
|
||||
movl %ecx,88(%esp)
|
||||
movl %edx,92(%esp)
|
||||
movl 16(%esi),%eax
|
||||
movl 20(%esi),%ebx
|
||||
movl 24(%esi),%ecx
|
||||
movl 28(%esi),%edx
|
||||
movl %eax,96(%esp)
|
||||
movl %ebx,100(%esp)
|
||||
movl %ecx,104(%esp)
|
||||
movl %edx,108(%esp)
|
||||
movl (%edi),%eax
|
||||
movl 4(%edi),%ebx
|
||||
movl 8(%edi),%ecx
|
||||
movl 12(%edi),%edx
|
||||
subl $1,%eax
|
||||
movl %eax,112(%esp)
|
||||
movl %ebx,116(%esp)
|
||||
movl %ecx,120(%esp)
|
||||
movl %edx,124(%esp)
|
||||
jmp .L002entry
|
||||
.align 16
|
||||
.L003outer_loop:
|
||||
movl %ebx,156(%esp)
|
||||
movl %eax,152(%esp)
|
||||
movl %ecx,160(%esp)
|
||||
.L002entry:
|
||||
movl $1634760805,%eax
|
||||
movl $857760878,4(%esp)
|
||||
movl $2036477234,8(%esp)
|
||||
movl $1797285236,12(%esp)
|
||||
movl 84(%esp),%ebx
|
||||
movl 88(%esp),%ebp
|
||||
movl 104(%esp),%ecx
|
||||
movl 108(%esp),%esi
|
||||
movl 116(%esp),%edx
|
||||
movl 120(%esp),%edi
|
||||
movl %ebx,20(%esp)
|
||||
movl %ebp,24(%esp)
|
||||
movl %ecx,40(%esp)
|
||||
movl %esi,44(%esp)
|
||||
movl %edx,52(%esp)
|
||||
movl %edi,56(%esp)
|
||||
movl 92(%esp),%ebx
|
||||
movl 124(%esp),%edi
|
||||
movl 112(%esp),%edx
|
||||
movl 80(%esp),%ebp
|
||||
movl 96(%esp),%ecx
|
||||
movl 100(%esp),%esi
|
||||
addl $1,%edx
|
||||
movl %ebx,28(%esp)
|
||||
movl %edi,60(%esp)
|
||||
movl %edx,112(%esp)
|
||||
movl $10,%ebx
|
||||
jmp .L004loop
|
||||
.align 16
|
||||
.L004loop:
|
||||
addl %ebp,%eax
|
||||
movl %ebx,128(%esp)
|
||||
movl %ebp,%ebx
|
||||
xorl %eax,%edx
|
||||
roll $16,%edx
|
||||
addl %edx,%ecx
|
||||
xorl %ecx,%ebx
|
||||
movl 52(%esp),%edi
|
||||
roll $12,%ebx
|
||||
movl 20(%esp),%ebp
|
||||
addl %ebx,%eax
|
||||
xorl %eax,%edx
|
||||
movl %eax,(%esp)
|
||||
roll $8,%edx
|
||||
movl 4(%esp),%eax
|
||||
addl %edx,%ecx
|
||||
movl %edx,48(%esp)
|
||||
xorl %ecx,%ebx
|
||||
addl %ebp,%eax
|
||||
roll $7,%ebx
|
||||
xorl %eax,%edi
|
||||
movl %ecx,32(%esp)
|
||||
roll $16,%edi
|
||||
movl %ebx,16(%esp)
|
||||
addl %edi,%esi
|
||||
movl 40(%esp),%ecx
|
||||
xorl %esi,%ebp
|
||||
movl 56(%esp),%edx
|
||||
roll $12,%ebp
|
||||
movl 24(%esp),%ebx
|
||||
addl %ebp,%eax
|
||||
xorl %eax,%edi
|
||||
movl %eax,4(%esp)
|
||||
roll $8,%edi
|
||||
movl 8(%esp),%eax
|
||||
addl %edi,%esi
|
||||
movl %edi,52(%esp)
|
||||
xorl %esi,%ebp
|
||||
addl %ebx,%eax
|
||||
roll $7,%ebp
|
||||
xorl %eax,%edx
|
||||
movl %esi,36(%esp)
|
||||
roll $16,%edx
|
||||
movl %ebp,20(%esp)
|
||||
addl %edx,%ecx
|
||||
movl 44(%esp),%esi
|
||||
xorl %ecx,%ebx
|
||||
movl 60(%esp),%edi
|
||||
roll $12,%ebx
|
||||
movl 28(%esp),%ebp
|
||||
addl %ebx,%eax
|
||||
xorl %eax,%edx
|
||||
movl %eax,8(%esp)
|
||||
roll $8,%edx
|
||||
movl 12(%esp),%eax
|
||||
addl %edx,%ecx
|
||||
movl %edx,56(%esp)
|
||||
xorl %ecx,%ebx
|
||||
addl %ebp,%eax
|
||||
roll $7,%ebx
|
||||
xorl %eax,%edi
|
||||
roll $16,%edi
|
||||
movl %ebx,24(%esp)
|
||||
addl %edi,%esi
|
||||
xorl %esi,%ebp
|
||||
roll $12,%ebp
|
||||
movl 20(%esp),%ebx
|
||||
addl %ebp,%eax
|
||||
xorl %eax,%edi
|
||||
movl %eax,12(%esp)
|
||||
roll $8,%edi
|
||||
movl (%esp),%eax
|
||||
addl %edi,%esi
|
||||
movl %edi,%edx
|
||||
xorl %esi,%ebp
|
||||
addl %ebx,%eax
|
||||
roll $7,%ebp
|
||||
xorl %eax,%edx
|
||||
roll $16,%edx
|
||||
movl %ebp,28(%esp)
|
||||
addl %edx,%ecx
|
||||
xorl %ecx,%ebx
|
||||
movl 48(%esp),%edi
|
||||
roll $12,%ebx
|
||||
movl 24(%esp),%ebp
|
||||
addl %ebx,%eax
|
||||
xorl %eax,%edx
|
||||
movl %eax,(%esp)
|
||||
roll $8,%edx
|
||||
movl 4(%esp),%eax
|
||||
addl %edx,%ecx
|
||||
movl %edx,60(%esp)
|
||||
xorl %ecx,%ebx
|
||||
addl %ebp,%eax
|
||||
roll $7,%ebx
|
||||
xorl %eax,%edi
|
||||
movl %ecx,40(%esp)
|
||||
roll $16,%edi
|
||||
movl %ebx,20(%esp)
|
||||
addl %edi,%esi
|
||||
movl 32(%esp),%ecx
|
||||
xorl %esi,%ebp
|
||||
movl 52(%esp),%edx
|
||||
roll $12,%ebp
|
||||
movl 28(%esp),%ebx
|
||||
addl %ebp,%eax
|
||||
xorl %eax,%edi
|
||||
movl %eax,4(%esp)
|
||||
roll $8,%edi
|
||||
movl 8(%esp),%eax
|
||||
addl %edi,%esi
|
||||
movl %edi,48(%esp)
|
||||
xorl %esi,%ebp
|
||||
addl %ebx,%eax
|
||||
roll $7,%ebp
|
||||
xorl %eax,%edx
|
||||
movl %esi,44(%esp)
|
||||
roll $16,%edx
|
||||
movl %ebp,24(%esp)
|
||||
addl %edx,%ecx
|
||||
movl 36(%esp),%esi
|
||||
xorl %ecx,%ebx
|
||||
movl 56(%esp),%edi
|
||||
roll $12,%ebx
|
||||
movl 16(%esp),%ebp
|
||||
addl %ebx,%eax
|
||||
xorl %eax,%edx
|
||||
movl %eax,8(%esp)
|
||||
roll $8,%edx
|
||||
movl 12(%esp),%eax
|
||||
addl %edx,%ecx
|
||||
movl %edx,52(%esp)
|
||||
xorl %ecx,%ebx
|
||||
addl %ebp,%eax
|
||||
roll $7,%ebx
|
||||
xorl %eax,%edi
|
||||
roll $16,%edi
|
||||
movl %ebx,28(%esp)
|
||||
addl %edi,%esi
|
||||
xorl %esi,%ebp
|
||||
movl 48(%esp),%edx
|
||||
roll $12,%ebp
|
||||
movl 128(%esp),%ebx
|
||||
addl %ebp,%eax
|
||||
xorl %eax,%edi
|
||||
movl %eax,12(%esp)
|
||||
roll $8,%edi
|
||||
movl (%esp),%eax
|
||||
addl %edi,%esi
|
||||
movl %edi,56(%esp)
|
||||
xorl %esi,%ebp
|
||||
roll $7,%ebp
|
||||
decl %ebx
|
||||
jnz .L004loop
|
||||
movl 160(%esp),%ebx
|
||||
addl $1634760805,%eax
|
||||
addl 80(%esp),%ebp
|
||||
addl 96(%esp),%ecx
|
||||
addl 100(%esp),%esi
|
||||
cmpl $64,%ebx
|
||||
jb .L005tail
|
||||
movl 156(%esp),%ebx
|
||||
addl 112(%esp),%edx
|
||||
addl 120(%esp),%edi
|
||||
xorl (%ebx),%eax
|
||||
xorl 16(%ebx),%ebp
|
||||
movl %eax,(%esp)
|
||||
movl 152(%esp),%eax
|
||||
xorl 32(%ebx),%ecx
|
||||
xorl 36(%ebx),%esi
|
||||
xorl 48(%ebx),%edx
|
||||
xorl 56(%ebx),%edi
|
||||
movl %ebp,16(%eax)
|
||||
movl %ecx,32(%eax)
|
||||
movl %esi,36(%eax)
|
||||
movl %edx,48(%eax)
|
||||
movl %edi,56(%eax)
|
||||
movl 4(%esp),%ebp
|
||||
movl 8(%esp),%ecx
|
||||
movl 12(%esp),%esi
|
||||
movl 20(%esp),%edx
|
||||
movl 24(%esp),%edi
|
||||
addl $857760878,%ebp
|
||||
addl $2036477234,%ecx
|
||||
addl $1797285236,%esi
|
||||
addl 84(%esp),%edx
|
||||
addl 88(%esp),%edi
|
||||
xorl 4(%ebx),%ebp
|
||||
xorl 8(%ebx),%ecx
|
||||
xorl 12(%ebx),%esi
|
||||
xorl 20(%ebx),%edx
|
||||
xorl 24(%ebx),%edi
|
||||
movl %ebp,4(%eax)
|
||||
movl %ecx,8(%eax)
|
||||
movl %esi,12(%eax)
|
||||
movl %edx,20(%eax)
|
||||
movl %edi,24(%eax)
|
||||
movl 28(%esp),%ebp
|
||||
movl 40(%esp),%ecx
|
||||
movl 44(%esp),%esi
|
||||
movl 52(%esp),%edx
|
||||
movl 60(%esp),%edi
|
||||
addl 92(%esp),%ebp
|
||||
addl 104(%esp),%ecx
|
||||
addl 108(%esp),%esi
|
||||
addl 116(%esp),%edx
|
||||
addl 124(%esp),%edi
|
||||
xorl 28(%ebx),%ebp
|
||||
xorl 40(%ebx),%ecx
|
||||
xorl 44(%ebx),%esi
|
||||
xorl 52(%ebx),%edx
|
||||
xorl 60(%ebx),%edi
|
||||
leal 64(%ebx),%ebx
|
||||
movl %ebp,28(%eax)
|
||||
movl (%esp),%ebp
|
||||
movl %ecx,40(%eax)
|
||||
movl 160(%esp),%ecx
|
||||
movl %esi,44(%eax)
|
||||
movl %edx,52(%eax)
|
||||
movl %edi,60(%eax)
|
||||
movl %ebp,(%eax)
|
||||
leal 64(%eax),%eax
|
||||
subl $64,%ecx
|
||||
jnz .L003outer_loop
|
||||
jmp .L006done
|
||||
.L005tail:
|
||||
addl 112(%esp),%edx
|
||||
addl 120(%esp),%edi
|
||||
movl %eax,(%esp)
|
||||
movl %ebp,16(%esp)
|
||||
movl %ecx,32(%esp)
|
||||
movl %esi,36(%esp)
|
||||
movl %edx,48(%esp)
|
||||
movl %edi,56(%esp)
|
||||
movl 4(%esp),%ebp
|
||||
movl 8(%esp),%ecx
|
||||
movl 12(%esp),%esi
|
||||
movl 20(%esp),%edx
|
||||
movl 24(%esp),%edi
|
||||
addl $857760878,%ebp
|
||||
addl $2036477234,%ecx
|
||||
addl $1797285236,%esi
|
||||
addl 84(%esp),%edx
|
||||
addl 88(%esp),%edi
|
||||
movl %ebp,4(%esp)
|
||||
movl %ecx,8(%esp)
|
||||
movl %esi,12(%esp)
|
||||
movl %edx,20(%esp)
|
||||
movl %edi,24(%esp)
|
||||
movl 28(%esp),%ebp
|
||||
movl 40(%esp),%ecx
|
||||
movl 44(%esp),%esi
|
||||
movl 52(%esp),%edx
|
||||
movl 60(%esp),%edi
|
||||
addl 92(%esp),%ebp
|
||||
addl 104(%esp),%ecx
|
||||
addl 108(%esp),%esi
|
||||
addl 116(%esp),%edx
|
||||
addl 124(%esp),%edi
|
||||
movl %ebp,28(%esp)
|
||||
movl 156(%esp),%ebp
|
||||
movl %ecx,40(%esp)
|
||||
movl 152(%esp),%ecx
|
||||
movl %esi,44(%esp)
|
||||
xorl %esi,%esi
|
||||
movl %edx,52(%esp)
|
||||
movl %edi,60(%esp)
|
||||
xorl %eax,%eax
|
||||
xorl %edx,%edx
|
||||
.L007tail_loop:
|
||||
movb (%esi,%ebp,1),%al
|
||||
movb (%esp,%esi,1),%dl
|
||||
leal 1(%esi),%esi
|
||||
xorb %dl,%al
|
||||
movb %al,-1(%ecx,%esi,1)
|
||||
decl %ebx
|
||||
jnz .L007tail_loop
|
||||
.L006done:
|
||||
addl $132,%esp
|
||||
.L000no_data:
|
||||
popl %edi
|
||||
popl %esi
|
||||
popl %ebx
|
||||
popl %ebp
|
||||
ret
|
||||
.globl _ChaCha20_ssse3
|
||||
.hidden _ChaCha20_ssse3
|
||||
.def _ChaCha20_ssse3; .scl 2; .type 32; .endef
|
||||
.align 16
|
||||
_ChaCha20_ssse3:
|
||||
.L_ChaCha20_ssse3_begin:
|
||||
pushl %ebp
|
||||
pushl %ebx
|
||||
pushl %esi
|
||||
pushl %edi
|
||||
.Lssse3_shortcut:
|
||||
movl 20(%esp),%edi
|
||||
movl 24(%esp),%esi
|
||||
movl 28(%esp),%ecx
|
||||
movl 32(%esp),%edx
|
||||
movl 36(%esp),%ebx
|
||||
movl %esp,%ebp
|
||||
subl $524,%esp
|
||||
andl $-64,%esp
|
||||
movl %ebp,512(%esp)
|
||||
leal .Lssse3_data-.Lpic_point(%eax),%eax
|
||||
movdqu (%ebx),%xmm3
|
||||
cmpl $256,%ecx
|
||||
jb .L0081x
|
||||
movl %edx,516(%esp)
|
||||
movl %ebx,520(%esp)
|
||||
subl $256,%ecx
|
||||
leal 384(%esp),%ebp
|
||||
movdqu (%edx),%xmm7
|
||||
pshufd $0,%xmm3,%xmm0
|
||||
pshufd $85,%xmm3,%xmm1
|
||||
pshufd $170,%xmm3,%xmm2
|
||||
pshufd $255,%xmm3,%xmm3
|
||||
paddd 48(%eax),%xmm0
|
||||
pshufd $0,%xmm7,%xmm4
|
||||
pshufd $85,%xmm7,%xmm5
|
||||
psubd 64(%eax),%xmm0
|
||||
pshufd $170,%xmm7,%xmm6
|
||||
pshufd $255,%xmm7,%xmm7
|
||||
movdqa %xmm0,64(%ebp)
|
||||
movdqa %xmm1,80(%ebp)
|
||||
movdqa %xmm2,96(%ebp)
|
||||
movdqa %xmm3,112(%ebp)
|
||||
movdqu 16(%edx),%xmm3
|
||||
movdqa %xmm4,-64(%ebp)
|
||||
movdqa %xmm5,-48(%ebp)
|
||||
movdqa %xmm6,-32(%ebp)
|
||||
movdqa %xmm7,-16(%ebp)
|
||||
movdqa 32(%eax),%xmm7
|
||||
leal 128(%esp),%ebx
|
||||
pshufd $0,%xmm3,%xmm0
|
||||
pshufd $85,%xmm3,%xmm1
|
||||
pshufd $170,%xmm3,%xmm2
|
||||
pshufd $255,%xmm3,%xmm3
|
||||
pshufd $0,%xmm7,%xmm4
|
||||
pshufd $85,%xmm7,%xmm5
|
||||
pshufd $170,%xmm7,%xmm6
|
||||
pshufd $255,%xmm7,%xmm7
|
||||
movdqa %xmm0,(%ebp)
|
||||
movdqa %xmm1,16(%ebp)
|
||||
movdqa %xmm2,32(%ebp)
|
||||
movdqa %xmm3,48(%ebp)
|
||||
movdqa %xmm4,-128(%ebp)
|
||||
movdqa %xmm5,-112(%ebp)
|
||||
movdqa %xmm6,-96(%ebp)
|
||||
movdqa %xmm7,-80(%ebp)
|
||||
leal 128(%esi),%esi
|
||||
leal 128(%edi),%edi
|
||||
jmp .L009outer_loop
|
||||
.align 16
|
||||
.L009outer_loop:
|
||||
movdqa -112(%ebp),%xmm1
|
||||
movdqa -96(%ebp),%xmm2
|
||||
movdqa -80(%ebp),%xmm3
|
||||
movdqa -48(%ebp),%xmm5
|
||||
movdqa -32(%ebp),%xmm6
|
||||
movdqa -16(%ebp),%xmm7
|
||||
movdqa %xmm1,-112(%ebx)
|
||||
movdqa %xmm2,-96(%ebx)
|
||||
movdqa %xmm3,-80(%ebx)
|
||||
movdqa %xmm5,-48(%ebx)
|
||||
movdqa %xmm6,-32(%ebx)
|
||||
movdqa %xmm7,-16(%ebx)
|
||||
movdqa 32(%ebp),%xmm2
|
||||
movdqa 48(%ebp),%xmm3
|
||||
movdqa 64(%ebp),%xmm4
|
||||
movdqa 80(%ebp),%xmm5
|
||||
movdqa 96(%ebp),%xmm6
|
||||
movdqa 112(%ebp),%xmm7
|
||||
paddd 64(%eax),%xmm4
|
||||
movdqa %xmm2,32(%ebx)
|
||||
movdqa %xmm3,48(%ebx)
|
||||
movdqa %xmm4,64(%ebx)
|
||||
movdqa %xmm5,80(%ebx)
|
||||
movdqa %xmm6,96(%ebx)
|
||||
movdqa %xmm7,112(%ebx)
|
||||
movdqa %xmm4,64(%ebp)
|
||||
movdqa -128(%ebp),%xmm0
|
||||
movdqa %xmm4,%xmm6
|
||||
movdqa -64(%ebp),%xmm3
|
||||
movdqa (%ebp),%xmm4
|
||||
movdqa 16(%ebp),%xmm5
|
||||
movl $10,%edx
|
||||
nop
|
||||
.align 16
|
||||
.L010loop:
|
||||
paddd %xmm3,%xmm0
|
||||
movdqa %xmm3,%xmm2
|
||||
pxor %xmm0,%xmm6
|
||||
pshufb (%eax),%xmm6
|
||||
paddd %xmm6,%xmm4
|
||||
pxor %xmm4,%xmm2
|
||||
movdqa -48(%ebx),%xmm3
|
||||
movdqa %xmm2,%xmm1
|
||||
pslld $12,%xmm2
|
||||
psrld $20,%xmm1
|
||||
por %xmm1,%xmm2
|
||||
movdqa -112(%ebx),%xmm1
|
||||
paddd %xmm2,%xmm0
|
||||
movdqa 80(%ebx),%xmm7
|
||||
pxor %xmm0,%xmm6
|
||||
movdqa %xmm0,-128(%ebx)
|
||||
pshufb 16(%eax),%xmm6
|
||||
paddd %xmm6,%xmm4
|
||||
movdqa %xmm6,64(%ebx)
|
||||
pxor %xmm4,%xmm2
|
||||
paddd %xmm3,%xmm1
|
||||
movdqa %xmm2,%xmm0
|
||||
pslld $7,%xmm2
|
||||
psrld $25,%xmm0
|
||||
pxor %xmm1,%xmm7
|
||||
por %xmm0,%xmm2
|
||||
movdqa %xmm4,(%ebx)
|
||||
pshufb (%eax),%xmm7
|
||||
movdqa %xmm2,-64(%ebx)
|
||||
paddd %xmm7,%xmm5
|
||||
movdqa 32(%ebx),%xmm4
|
||||
pxor %xmm5,%xmm3
|
||||
movdqa -32(%ebx),%xmm2
|
||||
movdqa %xmm3,%xmm0
|
||||
pslld $12,%xmm3
|
||||
psrld $20,%xmm0
|
||||
por %xmm0,%xmm3
|
||||
movdqa -96(%ebx),%xmm0
|
||||
paddd %xmm3,%xmm1
|
||||
movdqa 96(%ebx),%xmm6
|
||||
pxor %xmm1,%xmm7
|
||||
movdqa %xmm1,-112(%ebx)
|
||||
pshufb 16(%eax),%xmm7
|
||||
paddd %xmm7,%xmm5
|
||||
movdqa %xmm7,80(%ebx)
|
||||
pxor %xmm5,%xmm3
|
||||
paddd %xmm2,%xmm0
|
||||
movdqa %xmm3,%xmm1
|
||||
pslld $7,%xmm3
|
||||
psrld $25,%xmm1
|
||||
pxor %xmm0,%xmm6
|
||||
por %xmm1,%xmm3
|
||||
movdqa %xmm5,16(%ebx)
|
||||
pshufb (%eax),%xmm6
|
||||
movdqa %xmm3,-48(%ebx)
|
||||
paddd %xmm6,%xmm4
|
||||
movdqa 48(%ebx),%xmm5
|
||||
pxor %xmm4,%xmm2
|
||||
movdqa -16(%ebx),%xmm3
|
||||
movdqa %xmm2,%xmm1
|
||||
pslld $12,%xmm2
|
||||
psrld $20,%xmm1
|
||||
por %xmm1,%xmm2
|
||||
movdqa -80(%ebx),%xmm1
|
||||
paddd %xmm2,%xmm0
|
||||
movdqa 112(%ebx),%xmm7
|
||||
pxor %xmm0,%xmm6
|
||||
movdqa %xmm0,-96(%ebx)
|
||||
pshufb 16(%eax),%xmm6
|
||||
paddd %xmm6,%xmm4
|
||||
movdqa %xmm6,96(%ebx)
|
||||
pxor %xmm4,%xmm2
|
||||
paddd %xmm3,%xmm1
|
||||
movdqa %xmm2,%xmm0
|
||||
pslld $7,%xmm2
|
||||
psrld $25,%xmm0
|
||||
pxor %xmm1,%xmm7
|
||||
por %xmm0,%xmm2
|
||||
pshufb (%eax),%xmm7
|
||||
movdqa %xmm2,-32(%ebx)
|
||||
paddd %xmm7,%xmm5
|
||||
pxor %xmm5,%xmm3
|
||||
movdqa -48(%ebx),%xmm2
|
||||
movdqa %xmm3,%xmm0
|
||||
pslld $12,%xmm3
|
||||
psrld $20,%xmm0
|
||||
por %xmm0,%xmm3
|
||||
movdqa -128(%ebx),%xmm0
|
||||
paddd %xmm3,%xmm1
|
||||
pxor %xmm1,%xmm7
|
||||
movdqa %xmm1,-80(%ebx)
|
||||
pshufb 16(%eax),%xmm7
|
||||
paddd %xmm7,%xmm5
|
||||
movdqa %xmm7,%xmm6
|
||||
pxor %xmm5,%xmm3
|
||||
paddd %xmm2,%xmm0
|
||||
movdqa %xmm3,%xmm1
|
||||
pslld $7,%xmm3
|
||||
psrld $25,%xmm1
|
||||
pxor %xmm0,%xmm6
|
||||
por %xmm1,%xmm3
|
||||
pshufb (%eax),%xmm6
|
||||
movdqa %xmm3,-16(%ebx)
|
||||
paddd %xmm6,%xmm4
|
||||
pxor %xmm4,%xmm2
|
||||
movdqa -32(%ebx),%xmm3
|
||||
movdqa %xmm2,%xmm1
|
||||
pslld $12,%xmm2
|
||||
psrld $20,%xmm1
|
||||
por %xmm1,%xmm2
|
||||
movdqa -112(%ebx),%xmm1
|
||||
paddd %xmm2,%xmm0
|
||||
movdqa 64(%ebx),%xmm7
|
||||
pxor %xmm0,%xmm6
|
||||
movdqa %xmm0,-128(%ebx)
|
||||
pshufb 16(%eax),%xmm6
|
||||
paddd %xmm6,%xmm4
|
||||
movdqa %xmm6,112(%ebx)
|
||||
pxor %xmm4,%xmm2
|
||||
paddd %xmm3,%xmm1
|
||||
movdqa %xmm2,%xmm0
|
||||
pslld $7,%xmm2
|
||||
psrld $25,%xmm0
|
||||
pxor %xmm1,%xmm7
|
||||
por %xmm0,%xmm2
|
||||
movdqa %xmm4,32(%ebx)
|
||||
pshufb (%eax),%xmm7
|
||||
movdqa %xmm2,-48(%ebx)
|
||||
paddd %xmm7,%xmm5
|
||||
movdqa (%ebx),%xmm4
|
||||
pxor %xmm5,%xmm3
|
||||
movdqa -16(%ebx),%xmm2
|
||||
movdqa %xmm3,%xmm0
|
||||
pslld $12,%xmm3
|
||||
psrld $20,%xmm0
|
||||
por %xmm0,%xmm3
|
||||
movdqa -96(%ebx),%xmm0
|
||||
paddd %xmm3,%xmm1
|
||||
movdqa 80(%ebx),%xmm6
|
||||
pxor %xmm1,%xmm7
|
||||
movdqa %xmm1,-112(%ebx)
|
||||
pshufb 16(%eax),%xmm7
|
||||
paddd %xmm7,%xmm5
|
||||
movdqa %xmm7,64(%ebx)
|
||||
pxor %xmm5,%xmm3
|
||||
paddd %xmm2,%xmm0
|
||||
movdqa %xmm3,%xmm1
|
||||
pslld $7,%xmm3
|
||||
psrld $25,%xmm1
|
||||
pxor %xmm0,%xmm6
|
||||
por %xmm1,%xmm3
|
||||
movdqa %xmm5,48(%ebx)
|
||||
pshufb (%eax),%xmm6
|
||||
movdqa %xmm3,-32(%ebx)
|
||||
paddd %xmm6,%xmm4
|
||||
movdqa 16(%ebx),%xmm5
|
||||
pxor %xmm4,%xmm2
|
||||
movdqa -64(%ebx),%xmm3
|
||||
movdqa %xmm2,%xmm1
|
||||
pslld $12,%xmm2
|
||||
psrld $20,%xmm1
|
||||
por %xmm1,%xmm2
|
||||
movdqa -80(%ebx),%xmm1
|
||||
paddd %xmm2,%xmm0
|
||||
movdqa 96(%ebx),%xmm7
|
||||
pxor %xmm0,%xmm6
|
||||
movdqa %xmm0,-96(%ebx)
|
||||
pshufb 16(%eax),%xmm6
|
||||
paddd %xmm6,%xmm4
|
||||
movdqa %xmm6,80(%ebx)
|
||||
pxor %xmm4,%xmm2
|
||||
paddd %xmm3,%xmm1
|
||||
movdqa %xmm2,%xmm0
|
||||
pslld $7,%xmm2
|
||||
psrld $25,%xmm0
|
||||
pxor %xmm1,%xmm7
|
||||
por %xmm0,%xmm2
|
||||
pshufb (%eax),%xmm7
|
||||
movdqa %xmm2,-16(%ebx)
|
||||
paddd %xmm7,%xmm5
|
||||
pxor %xmm5,%xmm3
|
||||
movdqa %xmm3,%xmm0
|
||||
pslld $12,%xmm3
|
||||
psrld $20,%xmm0
|
||||
por %xmm0,%xmm3
|
||||
movdqa -128(%ebx),%xmm0
|
||||
paddd %xmm3,%xmm1
|
||||
movdqa 64(%ebx),%xmm6
|
||||
pxor %xmm1,%xmm7
|
||||
movdqa %xmm1,-80(%ebx)
|
||||
pshufb 16(%eax),%xmm7
|
||||
paddd %xmm7,%xmm5
|
||||
movdqa %xmm7,96(%ebx)
|
||||
pxor %xmm5,%xmm3
|
||||
movdqa %xmm3,%xmm1
|
||||
pslld $7,%xmm3
|
||||
psrld $25,%xmm1
|
||||
por %xmm1,%xmm3
|
||||
decl %edx
|
||||
jnz .L010loop
|
||||
movdqa %xmm3,-64(%ebx)
|
||||
movdqa %xmm4,(%ebx)
|
||||
movdqa %xmm5,16(%ebx)
|
||||
movdqa %xmm6,64(%ebx)
|
||||
movdqa %xmm7,96(%ebx)
|
||||
movdqa -112(%ebx),%xmm1
|
||||
movdqa -96(%ebx),%xmm2
|
||||
movdqa -80(%ebx),%xmm3
|
||||
paddd -128(%ebp),%xmm0
|
||||
paddd -112(%ebp),%xmm1
|
||||
paddd -96(%ebp),%xmm2
|
||||
paddd -80(%ebp),%xmm3
|
||||
movdqa %xmm0,%xmm6
|
||||
punpckldq %xmm1,%xmm0
|
||||
movdqa %xmm2,%xmm7
|
||||
punpckldq %xmm3,%xmm2
|
||||
punpckhdq %xmm1,%xmm6
|
||||
punpckhdq %xmm3,%xmm7
|
||||
movdqa %xmm0,%xmm1
|
||||
punpcklqdq %xmm2,%xmm0
|
||||
movdqa %xmm6,%xmm3
|
||||
punpcklqdq %xmm7,%xmm6
|
||||
punpckhqdq %xmm2,%xmm1
|
||||
punpckhqdq %xmm7,%xmm3
|
||||
movdqu -128(%esi),%xmm4
|
||||
movdqu -64(%esi),%xmm5
|
||||
movdqu (%esi),%xmm2
|
||||
movdqu 64(%esi),%xmm7
|
||||
leal 16(%esi),%esi
|
||||
pxor %xmm0,%xmm4
|
||||
movdqa -64(%ebx),%xmm0
|
||||
pxor %xmm1,%xmm5
|
||||
movdqa -48(%ebx),%xmm1
|
||||
pxor %xmm2,%xmm6
|
||||
movdqa -32(%ebx),%xmm2
|
||||
pxor %xmm3,%xmm7
|
||||
movdqa -16(%ebx),%xmm3
|
||||
movdqu %xmm4,-128(%edi)
|
||||
movdqu %xmm5,-64(%edi)
|
||||
movdqu %xmm6,(%edi)
|
||||
movdqu %xmm7,64(%edi)
|
||||
leal 16(%edi),%edi
|
||||
paddd -64(%ebp),%xmm0
|
||||
paddd -48(%ebp),%xmm1
|
||||
paddd -32(%ebp),%xmm2
|
||||
paddd -16(%ebp),%xmm3
|
||||
movdqa %xmm0,%xmm6
|
||||
punpckldq %xmm1,%xmm0
|
||||
movdqa %xmm2,%xmm7
|
||||
punpckldq %xmm3,%xmm2
|
||||
punpckhdq %xmm1,%xmm6
|
||||
punpckhdq %xmm3,%xmm7
|
||||
movdqa %xmm0,%xmm1
|
||||
punpcklqdq %xmm2,%xmm0
|
||||
movdqa %xmm6,%xmm3
|
||||
punpcklqdq %xmm7,%xmm6
|
||||
punpckhqdq %xmm2,%xmm1
|
||||
punpckhqdq %xmm7,%xmm3
|
||||
movdqu -128(%esi),%xmm4
|
||||
movdqu -64(%esi),%xmm5
|
||||
movdqu (%esi),%xmm2
|
||||
movdqu 64(%esi),%xmm7
|
||||
leal 16(%esi),%esi
|
||||
pxor %xmm0,%xmm4
|
||||
movdqa (%ebx),%xmm0
|
||||
pxor %xmm1,%xmm5
|
||||
movdqa 16(%ebx),%xmm1
|
||||
pxor %xmm2,%xmm6
|
||||
movdqa 32(%ebx),%xmm2
|
||||
pxor %xmm3,%xmm7
|
||||
movdqa 48(%ebx),%xmm3
|
||||
movdqu %xmm4,-128(%edi)
|
||||
movdqu %xmm5,-64(%edi)
|
||||
movdqu %xmm6,(%edi)
|
||||
movdqu %xmm7,64(%edi)
|
||||
leal 16(%edi),%edi
|
||||
paddd (%ebp),%xmm0
|
||||
paddd 16(%ebp),%xmm1
|
||||
paddd 32(%ebp),%xmm2
|
||||
paddd 48(%ebp),%xmm3
|
||||
movdqa %xmm0,%xmm6
|
||||
punpckldq %xmm1,%xmm0
|
||||
movdqa %xmm2,%xmm7
|
||||
punpckldq %xmm3,%xmm2
|
||||
punpckhdq %xmm1,%xmm6
|
||||
punpckhdq %xmm3,%xmm7
|
||||
movdqa %xmm0,%xmm1
|
||||
punpcklqdq %xmm2,%xmm0
|
||||
movdqa %xmm6,%xmm3
|
||||
punpcklqdq %xmm7,%xmm6
|
||||
punpckhqdq %xmm2,%xmm1
|
||||
punpckhqdq %xmm7,%xmm3
|
||||
movdqu -128(%esi),%xmm4
|
||||
movdqu -64(%esi),%xmm5
|
||||
movdqu (%esi),%xmm2
|
||||
movdqu 64(%esi),%xmm7
|
||||
leal 16(%esi),%esi
|
||||
pxor %xmm0,%xmm4
|
||||
movdqa 64(%ebx),%xmm0
|
||||
pxor %xmm1,%xmm5
|
||||
movdqa 80(%ebx),%xmm1
|
||||
pxor %xmm2,%xmm6
|
||||
movdqa 96(%ebx),%xmm2
|
||||
pxor %xmm3,%xmm7
|
||||
movdqa 112(%ebx),%xmm3
|
||||
movdqu %xmm4,-128(%edi)
|
||||
movdqu %xmm5,-64(%edi)
|
||||
movdqu %xmm6,(%edi)
|
||||
movdqu %xmm7,64(%edi)
|
||||
leal 16(%edi),%edi
|
||||
paddd 64(%ebp),%xmm0
|
||||
paddd 80(%ebp),%xmm1
|
||||
paddd 96(%ebp),%xmm2
|
||||
paddd 112(%ebp),%xmm3
|
||||
movdqa %xmm0,%xmm6
|
||||
punpckldq %xmm1,%xmm0
|
||||
movdqa %xmm2,%xmm7
|
||||
punpckldq %xmm3,%xmm2
|
||||
punpckhdq %xmm1,%xmm6
|
||||
punpckhdq %xmm3,%xmm7
|
||||
movdqa %xmm0,%xmm1
|
||||
punpcklqdq %xmm2,%xmm0
|
||||
movdqa %xmm6,%xmm3
|
||||
punpcklqdq %xmm7,%xmm6
|
||||
punpckhqdq %xmm2,%xmm1
|
||||
punpckhqdq %xmm7,%xmm3
|
||||
movdqu -128(%esi),%xmm4
|
||||
movdqu -64(%esi),%xmm5
|
||||
movdqu (%esi),%xmm2
|
||||
movdqu 64(%esi),%xmm7
|
||||
leal 208(%esi),%esi
|
||||
pxor %xmm0,%xmm4
|
||||
pxor %xmm1,%xmm5
|
||||
pxor %xmm2,%xmm6
|
||||
pxor %xmm3,%xmm7
|
||||
movdqu %xmm4,-128(%edi)
|
||||
movdqu %xmm5,-64(%edi)
|
||||
movdqu %xmm6,(%edi)
|
||||
movdqu %xmm7,64(%edi)
|
||||
leal 208(%edi),%edi
|
||||
subl $256,%ecx
|
||||
jnc .L009outer_loop
|
||||
addl $256,%ecx
|
||||
jz .L011done
|
||||
movl 520(%esp),%ebx
|
||||
leal -128(%esi),%esi
|
||||
movl 516(%esp),%edx
|
||||
leal -128(%edi),%edi
|
||||
movd 64(%ebp),%xmm2
|
||||
movdqu (%ebx),%xmm3
|
||||
paddd 96(%eax),%xmm2
|
||||
pand 112(%eax),%xmm3
|
||||
por %xmm2,%xmm3
|
||||
.L0081x:
|
||||
movdqa 32(%eax),%xmm0
|
||||
movdqu (%edx),%xmm1
|
||||
movdqu 16(%edx),%xmm2
|
||||
movdqa (%eax),%xmm6
|
||||
movdqa 16(%eax),%xmm7
|
||||
movl %ebp,48(%esp)
|
||||
movdqa %xmm0,(%esp)
|
||||
movdqa %xmm1,16(%esp)
|
||||
movdqa %xmm2,32(%esp)
|
||||
movdqa %xmm3,48(%esp)
|
||||
movl $10,%edx
|
||||
jmp .L012loop1x
|
||||
.align 16
|
||||
.L013outer1x:
|
||||
movdqa 80(%eax),%xmm3
|
||||
movdqa (%esp),%xmm0
|
||||
movdqa 16(%esp),%xmm1
|
||||
movdqa 32(%esp),%xmm2
|
||||
paddd 48(%esp),%xmm3
|
||||
movl $10,%edx
|
||||
movdqa %xmm3,48(%esp)
|
||||
jmp .L012loop1x
|
||||
.align 16
|
||||
.L012loop1x:
|
||||
paddd %xmm1,%xmm0
|
||||
pxor %xmm0,%xmm3
|
||||
.byte 102,15,56,0,222
|
||||
paddd %xmm3,%xmm2
|
||||
pxor %xmm2,%xmm1
|
||||
movdqa %xmm1,%xmm4
|
||||
psrld $20,%xmm1
|
||||
pslld $12,%xmm4
|
||||
por %xmm4,%xmm1
|
||||
paddd %xmm1,%xmm0
|
||||
pxor %xmm0,%xmm3
|
||||
.byte 102,15,56,0,223
|
||||
paddd %xmm3,%xmm2
|
||||
pxor %xmm2,%xmm1
|
||||
movdqa %xmm1,%xmm4
|
||||
psrld $25,%xmm1
|
||||
pslld $7,%xmm4
|
||||
por %xmm4,%xmm1
|
||||
pshufd $78,%xmm2,%xmm2
|
||||
pshufd $57,%xmm1,%xmm1
|
||||
pshufd $147,%xmm3,%xmm3
|
||||
nop
|
||||
paddd %xmm1,%xmm0
|
||||
pxor %xmm0,%xmm3
|
||||
.byte 102,15,56,0,222
|
||||
paddd %xmm3,%xmm2
|
||||
pxor %xmm2,%xmm1
|
||||
movdqa %xmm1,%xmm4
|
||||
psrld $20,%xmm1
|
||||
pslld $12,%xmm4
|
||||
por %xmm4,%xmm1
|
||||
paddd %xmm1,%xmm0
|
||||
pxor %xmm0,%xmm3
|
||||
.byte 102,15,56,0,223
|
||||
paddd %xmm3,%xmm2
|
||||
pxor %xmm2,%xmm1
|
||||
movdqa %xmm1,%xmm4
|
||||
psrld $25,%xmm1
|
||||
pslld $7,%xmm4
|
||||
por %xmm4,%xmm1
|
||||
pshufd $78,%xmm2,%xmm2
|
||||
pshufd $147,%xmm1,%xmm1
|
||||
pshufd $57,%xmm3,%xmm3
|
||||
decl %edx
|
||||
jnz .L012loop1x
|
||||
paddd (%esp),%xmm0
|
||||
paddd 16(%esp),%xmm1
|
||||
paddd 32(%esp),%xmm2
|
||||
paddd 48(%esp),%xmm3
|
||||
cmpl $64,%ecx
|
||||
jb .L014tail
|
||||
movdqu (%esi),%xmm4
|
||||
movdqu 16(%esi),%xmm5
|
||||
pxor %xmm4,%xmm0
|
||||
movdqu 32(%esi),%xmm4
|
||||
pxor %xmm5,%xmm1
|
||||
movdqu 48(%esi),%xmm5
|
||||
pxor %xmm4,%xmm2
|
||||
pxor %xmm5,%xmm3
|
||||
leal 64(%esi),%esi
|
||||
movdqu %xmm0,(%edi)
|
||||
movdqu %xmm1,16(%edi)
|
||||
movdqu %xmm2,32(%edi)
|
||||
movdqu %xmm3,48(%edi)
|
||||
leal 64(%edi),%edi
|
||||
subl $64,%ecx
|
||||
jnz .L013outer1x
|
||||
jmp .L011done
|
||||
.L014tail:
|
||||
movdqa %xmm0,(%esp)
|
||||
movdqa %xmm1,16(%esp)
|
||||
movdqa %xmm2,32(%esp)
|
||||
movdqa %xmm3,48(%esp)
|
||||
xorl %eax,%eax
|
||||
xorl %edx,%edx
|
||||
xorl %ebp,%ebp
|
||||
.L015tail_loop:
|
||||
movb (%esp,%ebp,1),%al
|
||||
movb (%esi,%ebp,1),%dl
|
||||
leal 1(%ebp),%ebp
|
||||
xorb %dl,%al
|
||||
movb %al,-1(%edi,%ebp,1)
|
||||
decl %ecx
|
||||
jnz .L015tail_loop
|
||||
.L011done:
|
||||
movl 512(%esp),%esp
|
||||
popl %edi
|
||||
popl %esi
|
||||
popl %ebx
|
||||
popl %ebp
|
||||
ret
|
||||
.align 64
|
||||
.Lssse3_data:
|
||||
.byte 2,3,0,1,6,7,4,5,10,11,8,9,14,15,12,13
|
||||
.byte 3,0,1,2,7,4,5,6,11,8,9,10,15,12,13,14
|
||||
.long 1634760805,857760878,2036477234,1797285236
|
||||
.long 0,1,2,3
|
||||
.long 4,4,4,4
|
||||
.long 1,0,0,0
|
||||
.long 4,0,0,0
|
||||
.long 0,-1,-1,-1
|
||||
.align 64
|
||||
.byte 67,104,97,67,104,97,50,48,32,102,111,114,32,120,56,54
|
||||
.byte 44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32
|
||||
.byte 60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111
|
||||
.byte 114,103,62,0
|
||||
#endif
|
||||
#endif // defined(__i386__) && defined(_WIN32)
|
||||
#if defined(__linux__) && defined(__ELF__)
|
||||
.section .note.GNU-stack,"",%progbits
|
||||
#endif
|
||||
|
||||
@@ -241,21 +241,6 @@ int EC_KEY_marshal_private_key(CBB *cbb, const EC_KEY *key,
|
||||
return 1;
|
||||
}
|
||||
|
||||
// is_unsigned_integer returns one if |cbs| is a valid unsigned DER INTEGER and
|
||||
// zero otherwise.
|
||||
static int is_unsigned_integer(const CBS *cbs) {
|
||||
if (CBS_len(cbs) == 0) {
|
||||
return 0;
|
||||
}
|
||||
uint8_t byte = CBS_data(cbs)[0];
|
||||
if ((byte & 0x80) ||
|
||||
(byte == 0 && CBS_len(cbs) > 1 && (CBS_data(cbs)[1] & 0x80) == 0)) {
|
||||
// Negative or not minimally-encoded.
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
// kPrimeFieldOID is the encoding of 1.2.840.10045.1.1.
|
||||
static const uint8_t kPrimeField[] = {0x2a, 0x86, 0x48, 0xce, 0x3d, 0x01, 0x01};
|
||||
|
||||
@@ -276,7 +261,7 @@ static int parse_explicit_prime_curve(CBS *in, CBS *out_prime, CBS *out_a,
|
||||
OPENSSL_memcmp(CBS_data(&field_type), kPrimeField, sizeof(kPrimeField)) !=
|
||||
0 ||
|
||||
!CBS_get_asn1(&field_id, out_prime, CBS_ASN1_INTEGER) ||
|
||||
!is_unsigned_integer(out_prime) ||
|
||||
!CBS_is_unsigned_asn1_integer(out_prime) ||
|
||||
CBS_len(&field_id) != 0 ||
|
||||
!CBS_get_asn1(¶ms, &curve, CBS_ASN1_SEQUENCE) ||
|
||||
!CBS_get_asn1(&curve, out_a, CBS_ASN1_OCTETSTRING) ||
|
||||
@@ -286,7 +271,7 @@ static int parse_explicit_prime_curve(CBS *in, CBS *out_prime, CBS *out_a,
|
||||
CBS_len(&curve) != 0 ||
|
||||
!CBS_get_asn1(¶ms, &base, CBS_ASN1_OCTETSTRING) ||
|
||||
!CBS_get_asn1(¶ms, out_order, CBS_ASN1_INTEGER) ||
|
||||
!is_unsigned_integer(out_order) ||
|
||||
!CBS_is_unsigned_asn1_integer(out_order) ||
|
||||
!CBS_get_optional_asn1(¶ms, &cofactor, &has_cofactor,
|
||||
CBS_ASN1_INTEGER) ||
|
||||
CBS_len(¶ms) != 0) {
|
||||
|
||||
@@ -192,47 +192,47 @@ const uint32_t kOpenSSLReasonValues[] = {
|
||||
0x283480ac,
|
||||
0x283500ea,
|
||||
0x28358c6c,
|
||||
0x2c323095,
|
||||
0x2c3230ce,
|
||||
0x2c3292f2,
|
||||
0x2c3330a3,
|
||||
0x2c33b0b5,
|
||||
0x2c3430c9,
|
||||
0x2c34b0db,
|
||||
0x2c3530f6,
|
||||
0x2c35b108,
|
||||
0x2c363138,
|
||||
0x2c3330dc,
|
||||
0x2c33b0ee,
|
||||
0x2c343102,
|
||||
0x2c34b114,
|
||||
0x2c35312f,
|
||||
0x2c35b141,
|
||||
0x2c363171,
|
||||
0x2c36832d,
|
||||
0x2c373145,
|
||||
0x2c37b171,
|
||||
0x2c383196,
|
||||
0x2c38b1ad,
|
||||
0x2c3931cb,
|
||||
0x2c39b1db,
|
||||
0x2c3a31ed,
|
||||
0x2c3ab201,
|
||||
0x2c3b3212,
|
||||
0x2c3bb231,
|
||||
0x2c37317e,
|
||||
0x2c37b1aa,
|
||||
0x2c3831cf,
|
||||
0x2c38b1e6,
|
||||
0x2c393204,
|
||||
0x2c39b214,
|
||||
0x2c3a3226,
|
||||
0x2c3ab23a,
|
||||
0x2c3b324b,
|
||||
0x2c3bb26a,
|
||||
0x2c3c1304,
|
||||
0x2c3c931a,
|
||||
0x2c3d3245,
|
||||
0x2c3d327e,
|
||||
0x2c3d9333,
|
||||
0x2c3e3262,
|
||||
0x2c3eb270,
|
||||
0x2c3f3288,
|
||||
0x2c3fb2a0,
|
||||
0x2c4032ca,
|
||||
0x2c3e329b,
|
||||
0x2c3eb2a9,
|
||||
0x2c3f32c1,
|
||||
0x2c3fb2d9,
|
||||
0x2c403303,
|
||||
0x2c409205,
|
||||
0x2c4132db,
|
||||
0x2c41b2ee,
|
||||
0x2c413314,
|
||||
0x2c41b327,
|
||||
0x2c4211cb,
|
||||
0x2c42b2ff,
|
||||
0x2c42b338,
|
||||
0x2c430722,
|
||||
0x2c43b223,
|
||||
0x2c443184,
|
||||
0x2c44b2ad,
|
||||
0x2c45311b,
|
||||
0x2c45b157,
|
||||
0x2c4631bb,
|
||||
0x2c43b25c,
|
||||
0x2c4431bd,
|
||||
0x2c44b2e6,
|
||||
0x2c453154,
|
||||
0x2c45b190,
|
||||
0x2c4631f4,
|
||||
0x30320000,
|
||||
0x30328015,
|
||||
0x3033001f,
|
||||
@@ -367,246 +367,248 @@ const uint32_t kOpenSSLReasonValues[] = {
|
||||
0x3c418d67,
|
||||
0x3c420e73,
|
||||
0x3c428dfd,
|
||||
0x4032197b,
|
||||
0x40329991,
|
||||
0x403319bf,
|
||||
0x403399c9,
|
||||
0x403419e0,
|
||||
0x403499fe,
|
||||
0x40351a0e,
|
||||
0x40359a20,
|
||||
0x40361a2d,
|
||||
0x40369a39,
|
||||
0x40371a4e,
|
||||
0x40379a60,
|
||||
0x40381a6b,
|
||||
0x40389a7d,
|
||||
0x40321997,
|
||||
0x403299ad,
|
||||
0x403319db,
|
||||
0x403399e5,
|
||||
0x403419fc,
|
||||
0x40349a1a,
|
||||
0x40351a2a,
|
||||
0x40359a3c,
|
||||
0x40361a49,
|
||||
0x40369a55,
|
||||
0x40371a6a,
|
||||
0x40379a7c,
|
||||
0x40381a87,
|
||||
0x40389a99,
|
||||
0x40390f27,
|
||||
0x40399a8d,
|
||||
0x403a1aa0,
|
||||
0x403a9ac1,
|
||||
0x403b1ad2,
|
||||
0x403b9ae2,
|
||||
0x40399aa9,
|
||||
0x403a1abc,
|
||||
0x403a9add,
|
||||
0x403b1aee,
|
||||
0x403b9afe,
|
||||
0x403c0064,
|
||||
0x403c8083,
|
||||
0x403d1b43,
|
||||
0x403d9b59,
|
||||
0x403e1b68,
|
||||
0x403e9ba0,
|
||||
0x403f1bba,
|
||||
0x403f9be2,
|
||||
0x40401bf7,
|
||||
0x40409c0b,
|
||||
0x40411c46,
|
||||
0x40419c61,
|
||||
0x40421c7a,
|
||||
0x40429c8d,
|
||||
0x40431ca1,
|
||||
0x40439cb9,
|
||||
0x40441cd0,
|
||||
0x403d1b5f,
|
||||
0x403d9b75,
|
||||
0x403e1b84,
|
||||
0x403e9bbc,
|
||||
0x403f1bd6,
|
||||
0x403f9bfe,
|
||||
0x40401c13,
|
||||
0x40409c27,
|
||||
0x40411c62,
|
||||
0x40419c7d,
|
||||
0x40421c96,
|
||||
0x40429ca9,
|
||||
0x40431cbd,
|
||||
0x40439cd5,
|
||||
0x40441cec,
|
||||
0x404480ac,
|
||||
0x40451ce5,
|
||||
0x40459cf7,
|
||||
0x40461d1b,
|
||||
0x40469d3b,
|
||||
0x40471d49,
|
||||
0x40479d70,
|
||||
0x40481de1,
|
||||
0x40489e14,
|
||||
0x40491e2b,
|
||||
0x40499e45,
|
||||
0x404a1e5c,
|
||||
0x404a9e7a,
|
||||
0x404b1e92,
|
||||
0x404b9ebf,
|
||||
0x404c1ed5,
|
||||
0x404c9ee7,
|
||||
0x404d1f08,
|
||||
0x404d9f41,
|
||||
0x404e1f55,
|
||||
0x404e9f62,
|
||||
0x404f1fa9,
|
||||
0x404f9fef,
|
||||
0x40502046,
|
||||
0x4050a05a,
|
||||
0x4051208d,
|
||||
0x405220aa,
|
||||
0x4052a0ce,
|
||||
0x405320e6,
|
||||
0x4053a0f9,
|
||||
0x4054210e,
|
||||
0x4054a131,
|
||||
0x4055213f,
|
||||
0x4055a17c,
|
||||
0x40562189,
|
||||
0x4056a1a2,
|
||||
0x405721ba,
|
||||
0x4057a1cd,
|
||||
0x405821e2,
|
||||
0x4058a209,
|
||||
0x40592238,
|
||||
0x4059a265,
|
||||
0x405a2279,
|
||||
0x405aa289,
|
||||
0x405b22a1,
|
||||
0x405ba2b2,
|
||||
0x405c22c5,
|
||||
0x405ca304,
|
||||
0x405d2311,
|
||||
0x405da336,
|
||||
0x405e2374,
|
||||
0x40451d01,
|
||||
0x40459d13,
|
||||
0x40461d37,
|
||||
0x40469d57,
|
||||
0x40471d65,
|
||||
0x40479d8c,
|
||||
0x40481dfd,
|
||||
0x40489e30,
|
||||
0x40491e47,
|
||||
0x40499e61,
|
||||
0x404a1e78,
|
||||
0x404a9e96,
|
||||
0x404b1eae,
|
||||
0x404b9edb,
|
||||
0x404c1ef1,
|
||||
0x404c9f03,
|
||||
0x404d1f24,
|
||||
0x404d9f5d,
|
||||
0x404e1f71,
|
||||
0x404e9f7e,
|
||||
0x404f1fc5,
|
||||
0x404fa00b,
|
||||
0x40502062,
|
||||
0x4050a076,
|
||||
0x405120a9,
|
||||
0x405220c6,
|
||||
0x4052a0ea,
|
||||
0x40532102,
|
||||
0x4053a115,
|
||||
0x4054212a,
|
||||
0x4054a14d,
|
||||
0x40552178,
|
||||
0x4055a1b5,
|
||||
0x405621c2,
|
||||
0x4056a1db,
|
||||
0x405721f3,
|
||||
0x4057a206,
|
||||
0x4058221b,
|
||||
0x4058a242,
|
||||
0x40592271,
|
||||
0x4059a29e,
|
||||
0x405a22b2,
|
||||
0x405aa2c2,
|
||||
0x405b22da,
|
||||
0x405ba2eb,
|
||||
0x405c22fe,
|
||||
0x405ca33d,
|
||||
0x405d234a,
|
||||
0x405da36f,
|
||||
0x405e23ad,
|
||||
0x405e8ab3,
|
||||
0x405f2395,
|
||||
0x405fa3a2,
|
||||
0x406023b0,
|
||||
0x4060a3d2,
|
||||
0x40612433,
|
||||
0x4061a46b,
|
||||
0x40622482,
|
||||
0x4062a493,
|
||||
0x406324e0,
|
||||
0x4063a4f5,
|
||||
0x4064250c,
|
||||
0x4064a538,
|
||||
0x40652553,
|
||||
0x4065a56a,
|
||||
0x40662582,
|
||||
0x4066a5ac,
|
||||
0x406725d7,
|
||||
0x4067a61c,
|
||||
0x40682664,
|
||||
0x4068a685,
|
||||
0x406926b7,
|
||||
0x4069a6e5,
|
||||
0x406a2706,
|
||||
0x406aa726,
|
||||
0x406b28ae,
|
||||
0x406ba8d1,
|
||||
0x406c28e7,
|
||||
0x406cabd8,
|
||||
0x406d2c07,
|
||||
0x406dac2f,
|
||||
0x406e2c5d,
|
||||
0x406eacaa,
|
||||
0x406f2d03,
|
||||
0x406fad3b,
|
||||
0x40702d4e,
|
||||
0x4070ad6b,
|
||||
0x405f23ce,
|
||||
0x405fa3db,
|
||||
0x406023e9,
|
||||
0x4060a40b,
|
||||
0x4061246c,
|
||||
0x4061a4a4,
|
||||
0x406224bb,
|
||||
0x4062a4cc,
|
||||
0x40632519,
|
||||
0x4063a52e,
|
||||
0x40642545,
|
||||
0x4064a571,
|
||||
0x4065258c,
|
||||
0x4065a5a3,
|
||||
0x406625bb,
|
||||
0x4066a5e5,
|
||||
0x40672610,
|
||||
0x4067a655,
|
||||
0x4068269d,
|
||||
0x4068a6be,
|
||||
0x406926f0,
|
||||
0x4069a71e,
|
||||
0x406a273f,
|
||||
0x406aa75f,
|
||||
0x406b28e7,
|
||||
0x406ba90a,
|
||||
0x406c2920,
|
||||
0x406cac11,
|
||||
0x406d2c40,
|
||||
0x406dac68,
|
||||
0x406e2c96,
|
||||
0x406eace3,
|
||||
0x406f2d3c,
|
||||
0x406fad74,
|
||||
0x40702d87,
|
||||
0x4070ada4,
|
||||
0x40710802,
|
||||
0x4071ad7d,
|
||||
0x40722d90,
|
||||
0x4072adc6,
|
||||
0x40732dde,
|
||||
0x4071adb6,
|
||||
0x40722dc9,
|
||||
0x4072adff,
|
||||
0x40732e17,
|
||||
0x40739504,
|
||||
0x40742df2,
|
||||
0x4074ae0c,
|
||||
0x40752e1d,
|
||||
0x4075ae31,
|
||||
0x40762e3f,
|
||||
0x40742e2b,
|
||||
0x4074ae45,
|
||||
0x40752e56,
|
||||
0x4075ae6a,
|
||||
0x40762e78,
|
||||
0x407692c8,
|
||||
0x40772e64,
|
||||
0x4077ae86,
|
||||
0x40782ea1,
|
||||
0x4078aeda,
|
||||
0x40792ef1,
|
||||
0x4079af07,
|
||||
0x407a2f33,
|
||||
0x407aaf46,
|
||||
0x407b2f5b,
|
||||
0x407baf6d,
|
||||
0x407c2f9e,
|
||||
0x407cafa7,
|
||||
0x407d26a0,
|
||||
0x407d9fff,
|
||||
0x407e2eb6,
|
||||
0x407ea219,
|
||||
0x407f1d5d,
|
||||
0x407f9ea9,
|
||||
0x40801fb9,
|
||||
0x40809d85,
|
||||
0x408120bc,
|
||||
0x40819f93,
|
||||
0x40822c48,
|
||||
0x40829aee,
|
||||
0x408321f4,
|
||||
0x4083a51d,
|
||||
0x40841d99,
|
||||
0x4084a251,
|
||||
0x408522d6,
|
||||
0x4085a3fa,
|
||||
0x40862356,
|
||||
0x4086a019,
|
||||
0x40872c8e,
|
||||
0x4087a448,
|
||||
0x40881b2c,
|
||||
0x4088a62f,
|
||||
0x40891b7b,
|
||||
0x40899b08,
|
||||
0x408a291f,
|
||||
0x40772e9d,
|
||||
0x4077aebf,
|
||||
0x40782eda,
|
||||
0x4078af13,
|
||||
0x40792f2a,
|
||||
0x4079af40,
|
||||
0x407a2f6c,
|
||||
0x407aaf7f,
|
||||
0x407b2f94,
|
||||
0x407bafa6,
|
||||
0x407c2fd7,
|
||||
0x407cafe0,
|
||||
0x407d26d9,
|
||||
0x407da01b,
|
||||
0x407e2eef,
|
||||
0x407ea252,
|
||||
0x407f1d79,
|
||||
0x407f9ec5,
|
||||
0x40801fd5,
|
||||
0x40809da1,
|
||||
0x408120d8,
|
||||
0x40819faf,
|
||||
0x40822c81,
|
||||
0x40829b0a,
|
||||
0x4083222d,
|
||||
0x4083a556,
|
||||
0x40841db5,
|
||||
0x4084a28a,
|
||||
0x4085230f,
|
||||
0x4085a433,
|
||||
0x4086238f,
|
||||
0x4086a035,
|
||||
0x40872cc7,
|
||||
0x4087a481,
|
||||
0x40881b48,
|
||||
0x4088a668,
|
||||
0x40891b97,
|
||||
0x40899b24,
|
||||
0x408a2958,
|
||||
0x408a991c,
|
||||
0x408b2f82,
|
||||
0x408bad18,
|
||||
0x408c22e6,
|
||||
0x408c9938,
|
||||
0x408d1dfa,
|
||||
0x408d9dcb,
|
||||
0x408e1f2a,
|
||||
0x408ea15c,
|
||||
0x408f2643,
|
||||
0x408fa416,
|
||||
0x409025f8,
|
||||
0x4090a328,
|
||||
0x40912907,
|
||||
0x4091995e,
|
||||
0x40921bc8,
|
||||
0x4092acc9,
|
||||
0x40932da9,
|
||||
0x4093a02a,
|
||||
0x40941dad,
|
||||
0x4094a938,
|
||||
0x409524a4,
|
||||
0x4095af13,
|
||||
0x40962c75,
|
||||
0x40969fd2,
|
||||
0x40972075,
|
||||
0x40979f79,
|
||||
0x40981c28,
|
||||
0x4098a4b8,
|
||||
0x40992ce5,
|
||||
0x4099a09d,
|
||||
0x41f427d9,
|
||||
0x41f9286b,
|
||||
0x41fe275e,
|
||||
0x41feaa14,
|
||||
0x41ff2b29,
|
||||
0x420327f2,
|
||||
0x42082814,
|
||||
0x4208a850,
|
||||
0x42092742,
|
||||
0x4209a88a,
|
||||
0x420a2799,
|
||||
0x420aa779,
|
||||
0x420b27b9,
|
||||
0x420ba832,
|
||||
0x420c2b45,
|
||||
0x420ca948,
|
||||
0x420d29fb,
|
||||
0x420daa32,
|
||||
0x42122a4c,
|
||||
0x42172b0c,
|
||||
0x4217aa8e,
|
||||
0x421c2ab0,
|
||||
0x421f2a6b,
|
||||
0x42212bbd,
|
||||
0x42262aef,
|
||||
0x422b2b9b,
|
||||
0x422ba9d6,
|
||||
0x422c2b7d,
|
||||
0x422ca989,
|
||||
0x422d2962,
|
||||
0x422dab5c,
|
||||
0x422e29b5,
|
||||
0x42302acb,
|
||||
0x408b2fbb,
|
||||
0x408bad51,
|
||||
0x408c231f,
|
||||
0x408c9954,
|
||||
0x408d1e16,
|
||||
0x408d9de7,
|
||||
0x408e1f46,
|
||||
0x408ea195,
|
||||
0x408f267c,
|
||||
0x408fa44f,
|
||||
0x40902631,
|
||||
0x4090a361,
|
||||
0x40912940,
|
||||
0x4091997a,
|
||||
0x40921be4,
|
||||
0x4092ad02,
|
||||
0x40932de2,
|
||||
0x4093a046,
|
||||
0x40941dc9,
|
||||
0x4094a971,
|
||||
0x409524dd,
|
||||
0x4095af4c,
|
||||
0x40962cae,
|
||||
0x40969fee,
|
||||
0x40972091,
|
||||
0x40979f95,
|
||||
0x40981c44,
|
||||
0x4098a4f1,
|
||||
0x40992d1e,
|
||||
0x4099a0b9,
|
||||
0x409a215b,
|
||||
0x409a9938,
|
||||
0x41f42812,
|
||||
0x41f928a4,
|
||||
0x41fe2797,
|
||||
0x41feaa4d,
|
||||
0x41ff2b62,
|
||||
0x4203282b,
|
||||
0x4208284d,
|
||||
0x4208a889,
|
||||
0x4209277b,
|
||||
0x4209a8c3,
|
||||
0x420a27d2,
|
||||
0x420aa7b2,
|
||||
0x420b27f2,
|
||||
0x420ba86b,
|
||||
0x420c2b7e,
|
||||
0x420ca981,
|
||||
0x420d2a34,
|
||||
0x420daa6b,
|
||||
0x42122a85,
|
||||
0x42172b45,
|
||||
0x4217aac7,
|
||||
0x421c2ae9,
|
||||
0x421f2aa4,
|
||||
0x42212bf6,
|
||||
0x42262b28,
|
||||
0x422b2bd4,
|
||||
0x422baa0f,
|
||||
0x422c2bb6,
|
||||
0x422ca9c2,
|
||||
0x422d299b,
|
||||
0x422dab95,
|
||||
0x422e29ee,
|
||||
0x42302b04,
|
||||
0x4432072d,
|
||||
0x4432873c,
|
||||
0x44330748,
|
||||
@@ -661,69 +663,69 @@ const uint32_t kOpenSSLReasonValues[] = {
|
||||
0x4c411561,
|
||||
0x4c4193e4,
|
||||
0x4c42154d,
|
||||
0x50323311,
|
||||
0x5032b320,
|
||||
0x5033332b,
|
||||
0x5033b33b,
|
||||
0x50343354,
|
||||
0x5034b36e,
|
||||
0x5035337c,
|
||||
0x5035b392,
|
||||
0x503633a4,
|
||||
0x5036b3ba,
|
||||
0x503733d3,
|
||||
0x5037b3e6,
|
||||
0x503833fe,
|
||||
0x5038b40f,
|
||||
0x50393424,
|
||||
0x5039b438,
|
||||
0x503a3458,
|
||||
0x503ab46e,
|
||||
0x503b3486,
|
||||
0x503bb498,
|
||||
0x503c34b4,
|
||||
0x503cb4cb,
|
||||
0x503d34e4,
|
||||
0x503db4fa,
|
||||
0x503e3507,
|
||||
0x503eb51d,
|
||||
0x503f352f,
|
||||
0x5032334a,
|
||||
0x5032b359,
|
||||
0x50333364,
|
||||
0x5033b374,
|
||||
0x5034338d,
|
||||
0x5034b3a7,
|
||||
0x503533b5,
|
||||
0x5035b3cb,
|
||||
0x503633dd,
|
||||
0x5036b3f3,
|
||||
0x5037340c,
|
||||
0x5037b41f,
|
||||
0x50383437,
|
||||
0x5038b448,
|
||||
0x5039345d,
|
||||
0x5039b471,
|
||||
0x503a3491,
|
||||
0x503ab4a7,
|
||||
0x503b34bf,
|
||||
0x503bb4d1,
|
||||
0x503c34ed,
|
||||
0x503cb504,
|
||||
0x503d351d,
|
||||
0x503db533,
|
||||
0x503e3540,
|
||||
0x503eb556,
|
||||
0x503f3568,
|
||||
0x503f837b,
|
||||
0x50403542,
|
||||
0x5040b552,
|
||||
0x5041356c,
|
||||
0x5041b57b,
|
||||
0x50423595,
|
||||
0x5042b5b2,
|
||||
0x504335c2,
|
||||
0x5043b5d2,
|
||||
0x504435e1,
|
||||
0x5040357b,
|
||||
0x5040b58b,
|
||||
0x504135a5,
|
||||
0x5041b5b4,
|
||||
0x504235ce,
|
||||
0x5042b5eb,
|
||||
0x504335fb,
|
||||
0x5043b60b,
|
||||
0x5044361a,
|
||||
0x50448431,
|
||||
0x504535f5,
|
||||
0x5045b613,
|
||||
0x50463626,
|
||||
0x5046b63c,
|
||||
0x5047364e,
|
||||
0x5047b663,
|
||||
0x50483689,
|
||||
0x5048b697,
|
||||
0x504936aa,
|
||||
0x5049b6bf,
|
||||
0x504a36d5,
|
||||
0x504ab6e5,
|
||||
0x504b3705,
|
||||
0x504bb718,
|
||||
0x504c373b,
|
||||
0x504cb769,
|
||||
0x504d377b,
|
||||
0x504db798,
|
||||
0x504e37b3,
|
||||
0x504eb7cf,
|
||||
0x504f37e1,
|
||||
0x504fb7f8,
|
||||
0x50503807,
|
||||
0x5045362e,
|
||||
0x5045b64c,
|
||||
0x5046365f,
|
||||
0x5046b675,
|
||||
0x50473687,
|
||||
0x5047b69c,
|
||||
0x504836c2,
|
||||
0x5048b6d0,
|
||||
0x504936e3,
|
||||
0x5049b6f8,
|
||||
0x504a370e,
|
||||
0x504ab71e,
|
||||
0x504b373e,
|
||||
0x504bb751,
|
||||
0x504c3774,
|
||||
0x504cb7a2,
|
||||
0x504d37b4,
|
||||
0x504db7d1,
|
||||
0x504e37ec,
|
||||
0x504eb808,
|
||||
0x504f381a,
|
||||
0x504fb831,
|
||||
0x50503840,
|
||||
0x505086f1,
|
||||
0x5051381a,
|
||||
0x50513853,
|
||||
0x58320f65,
|
||||
0x68320f27,
|
||||
0x68328c7f,
|
||||
@@ -767,19 +769,19 @@ const uint32_t kOpenSSLReasonValues[] = {
|
||||
0x7c3211e1,
|
||||
0x803213f7,
|
||||
0x80328083,
|
||||
0x80333064,
|
||||
0x8033309d,
|
||||
0x803380ac,
|
||||
0x80343073,
|
||||
0x8034afdb,
|
||||
0x80352ff9,
|
||||
0x8035b087,
|
||||
0x8036303b,
|
||||
0x8036afea,
|
||||
0x8037302d,
|
||||
0x8037afc8,
|
||||
0x8038304e,
|
||||
0x8038b00a,
|
||||
0x8039301f,
|
||||
0x803430ac,
|
||||
0x8034b014,
|
||||
0x80353032,
|
||||
0x8035b0c0,
|
||||
0x80363074,
|
||||
0x8036b023,
|
||||
0x80373066,
|
||||
0x8037b001,
|
||||
0x80383087,
|
||||
0x8038b043,
|
||||
0x80393058,
|
||||
};
|
||||
|
||||
const size_t kOpenSSLReasonValuesLen = sizeof(kOpenSSLReasonValues) / sizeof(kOpenSSLReasonValues[0]);
|
||||
@@ -1113,6 +1115,7 @@ const char kOpenSSLReasonStringData[] =
|
||||
"VALUE_MISSING\0"
|
||||
"WRONG_SIGNATURE_LENGTH\0"
|
||||
"ALPN_MISMATCH_ON_EARLY_DATA\0"
|
||||
"ALPS_MISMATCH_ON_EARLY_DATA\0"
|
||||
"APPLICATION_DATA_INSTEAD_OF_HANDSHAKE\0"
|
||||
"APPLICATION_DATA_ON_SHUTDOWN\0"
|
||||
"APP_DATA_IN_HANDSHAKE\0"
|
||||
@@ -1204,6 +1207,7 @@ const char kOpenSSLReasonStringData[] =
|
||||
"MISSING_TMP_ECDH_KEY\0"
|
||||
"MIXED_SPECIAL_OPERATOR_WITH_GROUPS\0"
|
||||
"MTU_TOO_SMALL\0"
|
||||
"NEGOTIATED_ALPS_WITHOUT_ALPN\0"
|
||||
"NEGOTIATED_BOTH_NPN_AND_ALPN\0"
|
||||
"NEGOTIATED_TB_WITHOUT_EMS_OR_RI\0"
|
||||
"NESTED_GROUP\0"
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -250,6 +250,7 @@ Ldec_key_abort:
|
||||
#endif
|
||||
.align 5
|
||||
_aes_hw_encrypt:
|
||||
AARCH64_VALID_CALL_TARGET
|
||||
ldr r3,[r2,#240]
|
||||
vld1.32 {q0},[r2]!
|
||||
vld1.8 {q2},[r0]
|
||||
@@ -282,6 +283,7 @@ Loop_enc:
|
||||
#endif
|
||||
.align 5
|
||||
_aes_hw_decrypt:
|
||||
AARCH64_VALID_CALL_TARGET
|
||||
ldr r3,[r2,#240]
|
||||
vld1.32 {q0},[r2]!
|
||||
vld1.8 {q2},[r0]
|
||||
|
||||
@@ -245,6 +245,7 @@ aes_hw_set_decrypt_key:
|
||||
.type aes_hw_encrypt,%function
|
||||
.align 5
|
||||
aes_hw_encrypt:
|
||||
AARCH64_VALID_CALL_TARGET
|
||||
ldr r3,[r2,#240]
|
||||
vld1.32 {q0},[r2]!
|
||||
vld1.8 {q2},[r0]
|
||||
@@ -275,6 +276,7 @@ aes_hw_encrypt:
|
||||
.type aes_hw_decrypt,%function
|
||||
.align 5
|
||||
aes_hw_decrypt:
|
||||
AARCH64_VALID_CALL_TARGET
|
||||
ldr r3,[r2,#240]
|
||||
vld1.32 {q0},[r2]!
|
||||
vld1.8 {q2},[r0]
|
||||
|
||||
@@ -0,0 +1,852 @@
|
||||
#define BORINGSSL_PREFIX CCryptoBoringSSL
|
||||
#if defined(__i386__) && defined(_WIN32)
|
||||
# This file is generated from a similarly-named Perl script in the BoringSSL
|
||||
# source tree. Do not edit by hand.
|
||||
|
||||
#if defined(__i386__)
|
||||
#if defined(BORINGSSL_PREFIX)
|
||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||
#endif
|
||||
.text
|
||||
.globl _bn_mul_add_words
|
||||
.hidden _bn_mul_add_words
|
||||
.def _bn_mul_add_words; .scl 2; .type 32; .endef
|
||||
.align 16
|
||||
_bn_mul_add_words:
|
||||
.L_bn_mul_add_words_begin:
|
||||
pushl %ebp
|
||||
pushl %ebx
|
||||
pushl %esi
|
||||
pushl %edi
|
||||
|
||||
xorl %esi,%esi
|
||||
movl 20(%esp),%edi
|
||||
movl 28(%esp),%ecx
|
||||
movl 24(%esp),%ebx
|
||||
andl $4294967288,%ecx
|
||||
movl 32(%esp),%ebp
|
||||
pushl %ecx
|
||||
jz .L000maw_finish
|
||||
.align 16
|
||||
.L001maw_loop:
|
||||
# Round 0
|
||||
movl (%ebx),%eax
|
||||
mull %ebp
|
||||
addl %esi,%eax
|
||||
adcl $0,%edx
|
||||
addl (%edi),%eax
|
||||
adcl $0,%edx
|
||||
movl %eax,(%edi)
|
||||
movl %edx,%esi
|
||||
# Round 4
|
||||
movl 4(%ebx),%eax
|
||||
mull %ebp
|
||||
addl %esi,%eax
|
||||
adcl $0,%edx
|
||||
addl 4(%edi),%eax
|
||||
adcl $0,%edx
|
||||
movl %eax,4(%edi)
|
||||
movl %edx,%esi
|
||||
# Round 8
|
||||
movl 8(%ebx),%eax
|
||||
mull %ebp
|
||||
addl %esi,%eax
|
||||
adcl $0,%edx
|
||||
addl 8(%edi),%eax
|
||||
adcl $0,%edx
|
||||
movl %eax,8(%edi)
|
||||
movl %edx,%esi
|
||||
# Round 12
|
||||
movl 12(%ebx),%eax
|
||||
mull %ebp
|
||||
addl %esi,%eax
|
||||
adcl $0,%edx
|
||||
addl 12(%edi),%eax
|
||||
adcl $0,%edx
|
||||
movl %eax,12(%edi)
|
||||
movl %edx,%esi
|
||||
# Round 16
|
||||
movl 16(%ebx),%eax
|
||||
mull %ebp
|
||||
addl %esi,%eax
|
||||
adcl $0,%edx
|
||||
addl 16(%edi),%eax
|
||||
adcl $0,%edx
|
||||
movl %eax,16(%edi)
|
||||
movl %edx,%esi
|
||||
# Round 20
|
||||
movl 20(%ebx),%eax
|
||||
mull %ebp
|
||||
addl %esi,%eax
|
||||
adcl $0,%edx
|
||||
addl 20(%edi),%eax
|
||||
adcl $0,%edx
|
||||
movl %eax,20(%edi)
|
||||
movl %edx,%esi
|
||||
# Round 24
|
||||
movl 24(%ebx),%eax
|
||||
mull %ebp
|
||||
addl %esi,%eax
|
||||
adcl $0,%edx
|
||||
addl 24(%edi),%eax
|
||||
adcl $0,%edx
|
||||
movl %eax,24(%edi)
|
||||
movl %edx,%esi
|
||||
# Round 28
|
||||
movl 28(%ebx),%eax
|
||||
mull %ebp
|
||||
addl %esi,%eax
|
||||
adcl $0,%edx
|
||||
addl 28(%edi),%eax
|
||||
adcl $0,%edx
|
||||
movl %eax,28(%edi)
|
||||
movl %edx,%esi
|
||||
|
||||
subl $8,%ecx
|
||||
leal 32(%ebx),%ebx
|
||||
leal 32(%edi),%edi
|
||||
jnz .L001maw_loop
|
||||
.L000maw_finish:
|
||||
movl 32(%esp),%ecx
|
||||
andl $7,%ecx
|
||||
jnz .L002maw_finish2
|
||||
jmp .L003maw_end
|
||||
.L002maw_finish2:
|
||||
# Tail Round 0
|
||||
movl (%ebx),%eax
|
||||
mull %ebp
|
||||
addl %esi,%eax
|
||||
adcl $0,%edx
|
||||
addl (%edi),%eax
|
||||
adcl $0,%edx
|
||||
decl %ecx
|
||||
movl %eax,(%edi)
|
||||
movl %edx,%esi
|
||||
jz .L003maw_end
|
||||
# Tail Round 1
|
||||
movl 4(%ebx),%eax
|
||||
mull %ebp
|
||||
addl %esi,%eax
|
||||
adcl $0,%edx
|
||||
addl 4(%edi),%eax
|
||||
adcl $0,%edx
|
||||
decl %ecx
|
||||
movl %eax,4(%edi)
|
||||
movl %edx,%esi
|
||||
jz .L003maw_end
|
||||
# Tail Round 2
|
||||
movl 8(%ebx),%eax
|
||||
mull %ebp
|
||||
addl %esi,%eax
|
||||
adcl $0,%edx
|
||||
addl 8(%edi),%eax
|
||||
adcl $0,%edx
|
||||
decl %ecx
|
||||
movl %eax,8(%edi)
|
||||
movl %edx,%esi
|
||||
jz .L003maw_end
|
||||
# Tail Round 3
|
||||
movl 12(%ebx),%eax
|
||||
mull %ebp
|
||||
addl %esi,%eax
|
||||
adcl $0,%edx
|
||||
addl 12(%edi),%eax
|
||||
adcl $0,%edx
|
||||
decl %ecx
|
||||
movl %eax,12(%edi)
|
||||
movl %edx,%esi
|
||||
jz .L003maw_end
|
||||
# Tail Round 4
|
||||
movl 16(%ebx),%eax
|
||||
mull %ebp
|
||||
addl %esi,%eax
|
||||
adcl $0,%edx
|
||||
addl 16(%edi),%eax
|
||||
adcl $0,%edx
|
||||
decl %ecx
|
||||
movl %eax,16(%edi)
|
||||
movl %edx,%esi
|
||||
jz .L003maw_end
|
||||
# Tail Round 5
|
||||
movl 20(%ebx),%eax
|
||||
mull %ebp
|
||||
addl %esi,%eax
|
||||
adcl $0,%edx
|
||||
addl 20(%edi),%eax
|
||||
adcl $0,%edx
|
||||
decl %ecx
|
||||
movl %eax,20(%edi)
|
||||
movl %edx,%esi
|
||||
jz .L003maw_end
|
||||
# Tail Round 6
|
||||
movl 24(%ebx),%eax
|
||||
mull %ebp
|
||||
addl %esi,%eax
|
||||
adcl $0,%edx
|
||||
addl 24(%edi),%eax
|
||||
adcl $0,%edx
|
||||
movl %eax,24(%edi)
|
||||
movl %edx,%esi
|
||||
.L003maw_end:
|
||||
movl %esi,%eax
|
||||
popl %ecx
|
||||
popl %edi
|
||||
popl %esi
|
||||
popl %ebx
|
||||
popl %ebp
|
||||
ret
|
||||
.globl _bn_mul_words
|
||||
.hidden _bn_mul_words
|
||||
.def _bn_mul_words; .scl 2; .type 32; .endef
|
||||
.align 16
|
||||
_bn_mul_words:
|
||||
.L_bn_mul_words_begin:
|
||||
pushl %ebp
|
||||
pushl %ebx
|
||||
pushl %esi
|
||||
pushl %edi
|
||||
|
||||
xorl %esi,%esi
|
||||
movl 20(%esp),%edi
|
||||
movl 24(%esp),%ebx
|
||||
movl 28(%esp),%ebp
|
||||
movl 32(%esp),%ecx
|
||||
andl $4294967288,%ebp
|
||||
jz .L004mw_finish
|
||||
.L005mw_loop:
|
||||
# Round 0
|
||||
movl (%ebx),%eax
|
||||
mull %ecx
|
||||
addl %esi,%eax
|
||||
adcl $0,%edx
|
||||
movl %eax,(%edi)
|
||||
movl %edx,%esi
|
||||
# Round 4
|
||||
movl 4(%ebx),%eax
|
||||
mull %ecx
|
||||
addl %esi,%eax
|
||||
adcl $0,%edx
|
||||
movl %eax,4(%edi)
|
||||
movl %edx,%esi
|
||||
# Round 8
|
||||
movl 8(%ebx),%eax
|
||||
mull %ecx
|
||||
addl %esi,%eax
|
||||
adcl $0,%edx
|
||||
movl %eax,8(%edi)
|
||||
movl %edx,%esi
|
||||
# Round 12
|
||||
movl 12(%ebx),%eax
|
||||
mull %ecx
|
||||
addl %esi,%eax
|
||||
adcl $0,%edx
|
||||
movl %eax,12(%edi)
|
||||
movl %edx,%esi
|
||||
# Round 16
|
||||
movl 16(%ebx),%eax
|
||||
mull %ecx
|
||||
addl %esi,%eax
|
||||
adcl $0,%edx
|
||||
movl %eax,16(%edi)
|
||||
movl %edx,%esi
|
||||
# Round 20
|
||||
movl 20(%ebx),%eax
|
||||
mull %ecx
|
||||
addl %esi,%eax
|
||||
adcl $0,%edx
|
||||
movl %eax,20(%edi)
|
||||
movl %edx,%esi
|
||||
# Round 24
|
||||
movl 24(%ebx),%eax
|
||||
mull %ecx
|
||||
addl %esi,%eax
|
||||
adcl $0,%edx
|
||||
movl %eax,24(%edi)
|
||||
movl %edx,%esi
|
||||
# Round 28
|
||||
movl 28(%ebx),%eax
|
||||
mull %ecx
|
||||
addl %esi,%eax
|
||||
adcl $0,%edx
|
||||
movl %eax,28(%edi)
|
||||
movl %edx,%esi
|
||||
|
||||
addl $32,%ebx
|
||||
addl $32,%edi
|
||||
subl $8,%ebp
|
||||
jz .L004mw_finish
|
||||
jmp .L005mw_loop
|
||||
.L004mw_finish:
|
||||
movl 28(%esp),%ebp
|
||||
andl $7,%ebp
|
||||
jnz .L006mw_finish2
|
||||
jmp .L007mw_end
|
||||
.L006mw_finish2:
|
||||
# Tail Round 0
|
||||
movl (%ebx),%eax
|
||||
mull %ecx
|
||||
addl %esi,%eax
|
||||
adcl $0,%edx
|
||||
movl %eax,(%edi)
|
||||
movl %edx,%esi
|
||||
decl %ebp
|
||||
jz .L007mw_end
|
||||
# Tail Round 1
|
||||
movl 4(%ebx),%eax
|
||||
mull %ecx
|
||||
addl %esi,%eax
|
||||
adcl $0,%edx
|
||||
movl %eax,4(%edi)
|
||||
movl %edx,%esi
|
||||
decl %ebp
|
||||
jz .L007mw_end
|
||||
# Tail Round 2
|
||||
movl 8(%ebx),%eax
|
||||
mull %ecx
|
||||
addl %esi,%eax
|
||||
adcl $0,%edx
|
||||
movl %eax,8(%edi)
|
||||
movl %edx,%esi
|
||||
decl %ebp
|
||||
jz .L007mw_end
|
||||
# Tail Round 3
|
||||
movl 12(%ebx),%eax
|
||||
mull %ecx
|
||||
addl %esi,%eax
|
||||
adcl $0,%edx
|
||||
movl %eax,12(%edi)
|
||||
movl %edx,%esi
|
||||
decl %ebp
|
||||
jz .L007mw_end
|
||||
# Tail Round 4
|
||||
movl 16(%ebx),%eax
|
||||
mull %ecx
|
||||
addl %esi,%eax
|
||||
adcl $0,%edx
|
||||
movl %eax,16(%edi)
|
||||
movl %edx,%esi
|
||||
decl %ebp
|
||||
jz .L007mw_end
|
||||
# Tail Round 5
|
||||
movl 20(%ebx),%eax
|
||||
mull %ecx
|
||||
addl %esi,%eax
|
||||
adcl $0,%edx
|
||||
movl %eax,20(%edi)
|
||||
movl %edx,%esi
|
||||
decl %ebp
|
||||
jz .L007mw_end
|
||||
# Tail Round 6
|
||||
movl 24(%ebx),%eax
|
||||
mull %ecx
|
||||
addl %esi,%eax
|
||||
adcl $0,%edx
|
||||
movl %eax,24(%edi)
|
||||
movl %edx,%esi
|
||||
.L007mw_end:
|
||||
movl %esi,%eax
|
||||
popl %edi
|
||||
popl %esi
|
||||
popl %ebx
|
||||
popl %ebp
|
||||
ret
|
||||
.globl _bn_sqr_words
|
||||
.hidden _bn_sqr_words
|
||||
.def _bn_sqr_words; .scl 2; .type 32; .endef
|
||||
.align 16
|
||||
_bn_sqr_words:
|
||||
.L_bn_sqr_words_begin:
|
||||
pushl %ebp
|
||||
pushl %ebx
|
||||
pushl %esi
|
||||
pushl %edi
|
||||
|
||||
movl 20(%esp),%esi
|
||||
movl 24(%esp),%edi
|
||||
movl 28(%esp),%ebx
|
||||
andl $4294967288,%ebx
|
||||
jz .L008sw_finish
|
||||
.L009sw_loop:
|
||||
# Round 0
|
||||
movl (%edi),%eax
|
||||
mull %eax
|
||||
movl %eax,(%esi)
|
||||
movl %edx,4(%esi)
|
||||
# Round 4
|
||||
movl 4(%edi),%eax
|
||||
mull %eax
|
||||
movl %eax,8(%esi)
|
||||
movl %edx,12(%esi)
|
||||
# Round 8
|
||||
movl 8(%edi),%eax
|
||||
mull %eax
|
||||
movl %eax,16(%esi)
|
||||
movl %edx,20(%esi)
|
||||
# Round 12
|
||||
movl 12(%edi),%eax
|
||||
mull %eax
|
||||
movl %eax,24(%esi)
|
||||
movl %edx,28(%esi)
|
||||
# Round 16
|
||||
movl 16(%edi),%eax
|
||||
mull %eax
|
||||
movl %eax,32(%esi)
|
||||
movl %edx,36(%esi)
|
||||
# Round 20
|
||||
movl 20(%edi),%eax
|
||||
mull %eax
|
||||
movl %eax,40(%esi)
|
||||
movl %edx,44(%esi)
|
||||
# Round 24
|
||||
movl 24(%edi),%eax
|
||||
mull %eax
|
||||
movl %eax,48(%esi)
|
||||
movl %edx,52(%esi)
|
||||
# Round 28
|
||||
movl 28(%edi),%eax
|
||||
mull %eax
|
||||
movl %eax,56(%esi)
|
||||
movl %edx,60(%esi)
|
||||
|
||||
addl $32,%edi
|
||||
addl $64,%esi
|
||||
subl $8,%ebx
|
||||
jnz .L009sw_loop
|
||||
.L008sw_finish:
|
||||
movl 28(%esp),%ebx
|
||||
andl $7,%ebx
|
||||
jz .L010sw_end
|
||||
# Tail Round 0
|
||||
movl (%edi),%eax
|
||||
mull %eax
|
||||
movl %eax,(%esi)
|
||||
decl %ebx
|
||||
movl %edx,4(%esi)
|
||||
jz .L010sw_end
|
||||
# Tail Round 1
|
||||
movl 4(%edi),%eax
|
||||
mull %eax
|
||||
movl %eax,8(%esi)
|
||||
decl %ebx
|
||||
movl %edx,12(%esi)
|
||||
jz .L010sw_end
|
||||
# Tail Round 2
|
||||
movl 8(%edi),%eax
|
||||
mull %eax
|
||||
movl %eax,16(%esi)
|
||||
decl %ebx
|
||||
movl %edx,20(%esi)
|
||||
jz .L010sw_end
|
||||
# Tail Round 3
|
||||
movl 12(%edi),%eax
|
||||
mull %eax
|
||||
movl %eax,24(%esi)
|
||||
decl %ebx
|
||||
movl %edx,28(%esi)
|
||||
jz .L010sw_end
|
||||
# Tail Round 4
|
||||
movl 16(%edi),%eax
|
||||
mull %eax
|
||||
movl %eax,32(%esi)
|
||||
decl %ebx
|
||||
movl %edx,36(%esi)
|
||||
jz .L010sw_end
|
||||
# Tail Round 5
|
||||
movl 20(%edi),%eax
|
||||
mull %eax
|
||||
movl %eax,40(%esi)
|
||||
decl %ebx
|
||||
movl %edx,44(%esi)
|
||||
jz .L010sw_end
|
||||
# Tail Round 6
|
||||
movl 24(%edi),%eax
|
||||
mull %eax
|
||||
movl %eax,48(%esi)
|
||||
movl %edx,52(%esi)
|
||||
.L010sw_end:
|
||||
popl %edi
|
||||
popl %esi
|
||||
popl %ebx
|
||||
popl %ebp
|
||||
ret
|
||||
.globl _bn_div_words
|
||||
.hidden _bn_div_words
|
||||
.def _bn_div_words; .scl 2; .type 32; .endef
|
||||
.align 16
|
||||
_bn_div_words:
|
||||
.L_bn_div_words_begin:
|
||||
movl 4(%esp),%edx
|
||||
movl 8(%esp),%eax
|
||||
movl 12(%esp),%ecx
|
||||
divl %ecx
|
||||
ret
|
||||
.globl _bn_add_words
|
||||
.hidden _bn_add_words
|
||||
.def _bn_add_words; .scl 2; .type 32; .endef
|
||||
.align 16
|
||||
_bn_add_words:
|
||||
.L_bn_add_words_begin:
|
||||
pushl %ebp
|
||||
pushl %ebx
|
||||
pushl %esi
|
||||
pushl %edi
|
||||
|
||||
movl 20(%esp),%ebx
|
||||
movl 24(%esp),%esi
|
||||
movl 28(%esp),%edi
|
||||
movl 32(%esp),%ebp
|
||||
xorl %eax,%eax
|
||||
andl $4294967288,%ebp
|
||||
jz .L011aw_finish
|
||||
.L012aw_loop:
|
||||
# Round 0
|
||||
movl (%esi),%ecx
|
||||
movl (%edi),%edx
|
||||
addl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
addl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,(%ebx)
|
||||
# Round 1
|
||||
movl 4(%esi),%ecx
|
||||
movl 4(%edi),%edx
|
||||
addl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
addl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,4(%ebx)
|
||||
# Round 2
|
||||
movl 8(%esi),%ecx
|
||||
movl 8(%edi),%edx
|
||||
addl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
addl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,8(%ebx)
|
||||
# Round 3
|
||||
movl 12(%esi),%ecx
|
||||
movl 12(%edi),%edx
|
||||
addl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
addl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,12(%ebx)
|
||||
# Round 4
|
||||
movl 16(%esi),%ecx
|
||||
movl 16(%edi),%edx
|
||||
addl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
addl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,16(%ebx)
|
||||
# Round 5
|
||||
movl 20(%esi),%ecx
|
||||
movl 20(%edi),%edx
|
||||
addl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
addl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,20(%ebx)
|
||||
# Round 6
|
||||
movl 24(%esi),%ecx
|
||||
movl 24(%edi),%edx
|
||||
addl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
addl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,24(%ebx)
|
||||
# Round 7
|
||||
movl 28(%esi),%ecx
|
||||
movl 28(%edi),%edx
|
||||
addl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
addl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,28(%ebx)
|
||||
|
||||
addl $32,%esi
|
||||
addl $32,%edi
|
||||
addl $32,%ebx
|
||||
subl $8,%ebp
|
||||
jnz .L012aw_loop
|
||||
.L011aw_finish:
|
||||
movl 32(%esp),%ebp
|
||||
andl $7,%ebp
|
||||
jz .L013aw_end
|
||||
# Tail Round 0
|
||||
movl (%esi),%ecx
|
||||
movl (%edi),%edx
|
||||
addl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
addl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
decl %ebp
|
||||
movl %ecx,(%ebx)
|
||||
jz .L013aw_end
|
||||
# Tail Round 1
|
||||
movl 4(%esi),%ecx
|
||||
movl 4(%edi),%edx
|
||||
addl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
addl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
decl %ebp
|
||||
movl %ecx,4(%ebx)
|
||||
jz .L013aw_end
|
||||
# Tail Round 2
|
||||
movl 8(%esi),%ecx
|
||||
movl 8(%edi),%edx
|
||||
addl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
addl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
decl %ebp
|
||||
movl %ecx,8(%ebx)
|
||||
jz .L013aw_end
|
||||
# Tail Round 3
|
||||
movl 12(%esi),%ecx
|
||||
movl 12(%edi),%edx
|
||||
addl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
addl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
decl %ebp
|
||||
movl %ecx,12(%ebx)
|
||||
jz .L013aw_end
|
||||
# Tail Round 4
|
||||
movl 16(%esi),%ecx
|
||||
movl 16(%edi),%edx
|
||||
addl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
addl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
decl %ebp
|
||||
movl %ecx,16(%ebx)
|
||||
jz .L013aw_end
|
||||
# Tail Round 5
|
||||
movl 20(%esi),%ecx
|
||||
movl 20(%edi),%edx
|
||||
addl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
addl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
decl %ebp
|
||||
movl %ecx,20(%ebx)
|
||||
jz .L013aw_end
|
||||
# Tail Round 6
|
||||
movl 24(%esi),%ecx
|
||||
movl 24(%edi),%edx
|
||||
addl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
addl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,24(%ebx)
|
||||
.L013aw_end:
|
||||
popl %edi
|
||||
popl %esi
|
||||
popl %ebx
|
||||
popl %ebp
|
||||
ret
|
||||
.globl _bn_sub_words
|
||||
.hidden _bn_sub_words
|
||||
.def _bn_sub_words; .scl 2; .type 32; .endef
|
||||
.align 16
|
||||
_bn_sub_words:
|
||||
.L_bn_sub_words_begin:
|
||||
pushl %ebp
|
||||
pushl %ebx
|
||||
pushl %esi
|
||||
pushl %edi
|
||||
|
||||
movl 20(%esp),%ebx
|
||||
movl 24(%esp),%esi
|
||||
movl 28(%esp),%edi
|
||||
movl 32(%esp),%ebp
|
||||
xorl %eax,%eax
|
||||
andl $4294967288,%ebp
|
||||
jz .L014aw_finish
|
||||
.L015aw_loop:
|
||||
# Round 0
|
||||
movl (%esi),%ecx
|
||||
movl (%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,(%ebx)
|
||||
# Round 1
|
||||
movl 4(%esi),%ecx
|
||||
movl 4(%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,4(%ebx)
|
||||
# Round 2
|
||||
movl 8(%esi),%ecx
|
||||
movl 8(%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,8(%ebx)
|
||||
# Round 3
|
||||
movl 12(%esi),%ecx
|
||||
movl 12(%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,12(%ebx)
|
||||
# Round 4
|
||||
movl 16(%esi),%ecx
|
||||
movl 16(%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,16(%ebx)
|
||||
# Round 5
|
||||
movl 20(%esi),%ecx
|
||||
movl 20(%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,20(%ebx)
|
||||
# Round 6
|
||||
movl 24(%esi),%ecx
|
||||
movl 24(%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,24(%ebx)
|
||||
# Round 7
|
||||
movl 28(%esi),%ecx
|
||||
movl 28(%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,28(%ebx)
|
||||
|
||||
addl $32,%esi
|
||||
addl $32,%edi
|
||||
addl $32,%ebx
|
||||
subl $8,%ebp
|
||||
jnz .L015aw_loop
|
||||
.L014aw_finish:
|
||||
movl 32(%esp),%ebp
|
||||
andl $7,%ebp
|
||||
jz .L016aw_end
|
||||
# Tail Round 0
|
||||
movl (%esi),%ecx
|
||||
movl (%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
decl %ebp
|
||||
movl %ecx,(%ebx)
|
||||
jz .L016aw_end
|
||||
# Tail Round 1
|
||||
movl 4(%esi),%ecx
|
||||
movl 4(%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
decl %ebp
|
||||
movl %ecx,4(%ebx)
|
||||
jz .L016aw_end
|
||||
# Tail Round 2
|
||||
movl 8(%esi),%ecx
|
||||
movl 8(%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
decl %ebp
|
||||
movl %ecx,8(%ebx)
|
||||
jz .L016aw_end
|
||||
# Tail Round 3
|
||||
movl 12(%esi),%ecx
|
||||
movl 12(%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
decl %ebp
|
||||
movl %ecx,12(%ebx)
|
||||
jz .L016aw_end
|
||||
# Tail Round 4
|
||||
movl 16(%esi),%ecx
|
||||
movl 16(%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
decl %ebp
|
||||
movl %ecx,16(%ebx)
|
||||
jz .L016aw_end
|
||||
# Tail Round 5
|
||||
movl 20(%esi),%ecx
|
||||
movl 20(%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
decl %ebp
|
||||
movl %ecx,20(%ebx)
|
||||
jz .L016aw_end
|
||||
# Tail Round 6
|
||||
movl 24(%esi),%ecx
|
||||
movl 24(%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,24(%ebx)
|
||||
.L016aw_end:
|
||||
popl %edi
|
||||
popl %esi
|
||||
popl %ebx
|
||||
popl %ebp
|
||||
ret
|
||||
#endif
|
||||
#endif // defined(__i386__) && defined(_WIN32)
|
||||
#if defined(__linux__) && defined(__ELF__)
|
||||
.section .note.GNU-stack,"",%progbits
|
||||
#endif
|
||||
|
||||
@@ -68,6 +68,8 @@
|
||||
OPENSSL_MSVC_PRAGMA(warning(push))
|
||||
OPENSSL_MSVC_PRAGMA(warning(disable: 4702)) // Unreachable code.
|
||||
|
||||
#define AES_GCM_NONCE_LENGTH 12
|
||||
|
||||
#if defined(BSAES)
|
||||
static void vpaes_ctr32_encrypt_blocks_with_bsaes(const uint8_t *in,
|
||||
uint8_t *out, size_t blocks,
|
||||
@@ -630,7 +632,7 @@ DEFINE_LOCAL_DATA(EVP_CIPHER, aes_128_gcm_generic) {
|
||||
out->nid = NID_aes_128_gcm;
|
||||
out->block_size = 1;
|
||||
out->key_len = 16;
|
||||
out->iv_len = 12;
|
||||
out->iv_len = AES_GCM_NONCE_LENGTH;
|
||||
out->ctx_size = sizeof(EVP_AES_GCM_CTX) + EVP_AES_GCM_CTX_PADDING;
|
||||
out->flags = EVP_CIPH_GCM_MODE | EVP_CIPH_CUSTOM_IV | EVP_CIPH_CUSTOM_COPY |
|
||||
EVP_CIPH_FLAG_CUSTOM_CIPHER | EVP_CIPH_ALWAYS_CALL_INIT |
|
||||
@@ -698,7 +700,7 @@ DEFINE_LOCAL_DATA(EVP_CIPHER, aes_192_gcm_generic) {
|
||||
out->nid = NID_aes_192_gcm;
|
||||
out->block_size = 1;
|
||||
out->key_len = 24;
|
||||
out->iv_len = 12;
|
||||
out->iv_len = AES_GCM_NONCE_LENGTH;
|
||||
out->ctx_size = sizeof(EVP_AES_GCM_CTX) + EVP_AES_GCM_CTX_PADDING;
|
||||
out->flags = EVP_CIPH_GCM_MODE | EVP_CIPH_CUSTOM_IV | EVP_CIPH_CUSTOM_COPY |
|
||||
EVP_CIPH_FLAG_CUSTOM_CIPHER | EVP_CIPH_ALWAYS_CALL_INIT |
|
||||
@@ -766,7 +768,7 @@ DEFINE_LOCAL_DATA(EVP_CIPHER, aes_256_gcm_generic) {
|
||||
out->nid = NID_aes_256_gcm;
|
||||
out->block_size = 1;
|
||||
out->key_len = 32;
|
||||
out->iv_len = 12;
|
||||
out->iv_len = AES_GCM_NONCE_LENGTH;
|
||||
out->ctx_size = sizeof(EVP_AES_GCM_CTX) + EVP_AES_GCM_CTX_PADDING;
|
||||
out->flags = EVP_CIPH_GCM_MODE | EVP_CIPH_CUSTOM_IV | EVP_CIPH_CUSTOM_COPY |
|
||||
EVP_CIPH_FLAG_CUSTOM_CIPHER | EVP_CIPH_ALWAYS_CALL_INIT |
|
||||
@@ -931,21 +933,19 @@ static int aead_aes_gcm_init(EVP_AEAD_CTX *ctx, const uint8_t *key,
|
||||
|
||||
static void aead_aes_gcm_cleanup(EVP_AEAD_CTX *ctx) {}
|
||||
|
||||
static int aead_aes_gcm_seal_scatter(const EVP_AEAD_CTX *ctx, uint8_t *out,
|
||||
uint8_t *out_tag, size_t *out_tag_len,
|
||||
size_t max_out_tag_len,
|
||||
const uint8_t *nonce, size_t nonce_len,
|
||||
const uint8_t *in, size_t in_len,
|
||||
const uint8_t *extra_in,
|
||||
size_t extra_in_len,
|
||||
const uint8_t *ad, size_t ad_len) {
|
||||
struct aead_aes_gcm_ctx *gcm_ctx = (struct aead_aes_gcm_ctx *) &ctx->state;
|
||||
|
||||
if (extra_in_len + ctx->tag_len < ctx->tag_len) {
|
||||
static int aead_aes_gcm_seal_scatter_impl(
|
||||
const struct aead_aes_gcm_ctx *gcm_ctx,
|
||||
uint8_t *out, uint8_t *out_tag, size_t *out_tag_len, size_t max_out_tag_len,
|
||||
const uint8_t *nonce, size_t nonce_len,
|
||||
const uint8_t *in, size_t in_len,
|
||||
const uint8_t *extra_in, size_t extra_in_len,
|
||||
const uint8_t *ad, size_t ad_len,
|
||||
size_t tag_len) {
|
||||
if (extra_in_len + tag_len < tag_len) {
|
||||
OPENSSL_PUT_ERROR(CIPHER, CIPHER_R_TOO_LARGE);
|
||||
return 0;
|
||||
}
|
||||
if (max_out_tag_len < extra_in_len + ctx->tag_len) {
|
||||
if (max_out_tag_len < extra_in_len + tag_len) {
|
||||
OPENSSL_PUT_ERROR(CIPHER, CIPHER_R_BUFFER_TOO_SMALL);
|
||||
return 0;
|
||||
}
|
||||
@@ -989,18 +989,35 @@ static int aead_aes_gcm_seal_scatter(const EVP_AEAD_CTX *ctx, uint8_t *out,
|
||||
}
|
||||
}
|
||||
|
||||
CRYPTO_gcm128_tag(&gcm, out_tag + extra_in_len, ctx->tag_len);
|
||||
*out_tag_len = ctx->tag_len + extra_in_len;
|
||||
CRYPTO_gcm128_tag(&gcm, out_tag + extra_in_len, tag_len);
|
||||
*out_tag_len = tag_len + extra_in_len;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int aead_aes_gcm_open_gather(const EVP_AEAD_CTX *ctx, uint8_t *out,
|
||||
const uint8_t *nonce, size_t nonce_len,
|
||||
const uint8_t *in, size_t in_len,
|
||||
const uint8_t *in_tag, size_t in_tag_len,
|
||||
const uint8_t *ad, size_t ad_len) {
|
||||
struct aead_aes_gcm_ctx *gcm_ctx = (struct aead_aes_gcm_ctx *) &ctx->state;
|
||||
static int aead_aes_gcm_seal_scatter(const EVP_AEAD_CTX *ctx, uint8_t *out,
|
||||
uint8_t *out_tag, size_t *out_tag_len,
|
||||
size_t max_out_tag_len,
|
||||
const uint8_t *nonce, size_t nonce_len,
|
||||
const uint8_t *in, size_t in_len,
|
||||
const uint8_t *extra_in,
|
||||
size_t extra_in_len,
|
||||
const uint8_t *ad, size_t ad_len) {
|
||||
const struct aead_aes_gcm_ctx *gcm_ctx =
|
||||
(const struct aead_aes_gcm_ctx *)&ctx->state;
|
||||
return aead_aes_gcm_seal_scatter_impl(
|
||||
gcm_ctx, out, out_tag, out_tag_len, max_out_tag_len, nonce, nonce_len, in,
|
||||
in_len, extra_in, extra_in_len, ad, ad_len, ctx->tag_len);
|
||||
}
|
||||
|
||||
static int aead_aes_gcm_open_gather_impl(const struct aead_aes_gcm_ctx *gcm_ctx,
|
||||
uint8_t *out,
|
||||
const uint8_t *nonce, size_t nonce_len,
|
||||
const uint8_t *in, size_t in_len,
|
||||
const uint8_t *in_tag,
|
||||
size_t in_tag_len,
|
||||
const uint8_t *ad, size_t ad_len,
|
||||
size_t tag_len) {
|
||||
uint8_t tag[EVP_AEAD_AES_GCM_TAG_LEN];
|
||||
|
||||
if (nonce_len == 0) {
|
||||
@@ -1008,7 +1025,7 @@ static int aead_aes_gcm_open_gather(const EVP_AEAD_CTX *ctx, uint8_t *out,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (in_tag_len != ctx->tag_len) {
|
||||
if (in_tag_len != tag_len) {
|
||||
OPENSSL_PUT_ERROR(CIPHER, CIPHER_R_BAD_DECRYPT);
|
||||
return 0;
|
||||
}
|
||||
@@ -1035,8 +1052,8 @@ static int aead_aes_gcm_open_gather(const EVP_AEAD_CTX *ctx, uint8_t *out,
|
||||
}
|
||||
}
|
||||
|
||||
CRYPTO_gcm128_tag(&gcm, tag, ctx->tag_len);
|
||||
if (CRYPTO_memcmp(tag, in_tag, ctx->tag_len) != 0) {
|
||||
CRYPTO_gcm128_tag(&gcm, tag, tag_len);
|
||||
if (CRYPTO_memcmp(tag, in_tag, tag_len) != 0) {
|
||||
OPENSSL_PUT_ERROR(CIPHER, CIPHER_R_BAD_DECRYPT);
|
||||
return 0;
|
||||
}
|
||||
@@ -1044,11 +1061,22 @@ static int aead_aes_gcm_open_gather(const EVP_AEAD_CTX *ctx, uint8_t *out,
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int aead_aes_gcm_open_gather(const EVP_AEAD_CTX *ctx, uint8_t *out,
|
||||
const uint8_t *nonce, size_t nonce_len,
|
||||
const uint8_t *in, size_t in_len,
|
||||
const uint8_t *in_tag, size_t in_tag_len,
|
||||
const uint8_t *ad, size_t ad_len) {
|
||||
struct aead_aes_gcm_ctx *gcm_ctx = (struct aead_aes_gcm_ctx *)&ctx->state;
|
||||
return aead_aes_gcm_open_gather_impl(gcm_ctx, out, nonce, nonce_len, in,
|
||||
in_len, in_tag, in_tag_len, ad, ad_len,
|
||||
ctx->tag_len);
|
||||
}
|
||||
|
||||
DEFINE_METHOD_FUNCTION(EVP_AEAD, EVP_aead_aes_128_gcm) {
|
||||
memset(out, 0, sizeof(EVP_AEAD));
|
||||
|
||||
out->key_len = 16;
|
||||
out->nonce_len = 12;
|
||||
out->nonce_len = AES_GCM_NONCE_LENGTH;
|
||||
out->overhead = EVP_AEAD_AES_GCM_TAG_LEN;
|
||||
out->max_tag_len = EVP_AEAD_AES_GCM_TAG_LEN;
|
||||
out->seal_scatter_supports_extra_in = 1;
|
||||
@@ -1063,7 +1091,7 @@ DEFINE_METHOD_FUNCTION(EVP_AEAD, EVP_aead_aes_192_gcm) {
|
||||
memset(out, 0, sizeof(EVP_AEAD));
|
||||
|
||||
out->key_len = 24;
|
||||
out->nonce_len = 12;
|
||||
out->nonce_len = AES_GCM_NONCE_LENGTH;
|
||||
out->overhead = EVP_AEAD_AES_GCM_TAG_LEN;
|
||||
out->max_tag_len = EVP_AEAD_AES_GCM_TAG_LEN;
|
||||
out->seal_scatter_supports_extra_in = 1;
|
||||
@@ -1078,7 +1106,7 @@ DEFINE_METHOD_FUNCTION(EVP_AEAD, EVP_aead_aes_256_gcm) {
|
||||
memset(out, 0, sizeof(EVP_AEAD));
|
||||
|
||||
out->key_len = 32;
|
||||
out->nonce_len = 12;
|
||||
out->nonce_len = AES_GCM_NONCE_LENGTH;
|
||||
out->overhead = EVP_AEAD_AES_GCM_TAG_LEN;
|
||||
out->max_tag_len = EVP_AEAD_AES_GCM_TAG_LEN;
|
||||
out->seal_scatter_supports_extra_in = 1;
|
||||
@@ -1089,6 +1117,116 @@ DEFINE_METHOD_FUNCTION(EVP_AEAD, EVP_aead_aes_256_gcm) {
|
||||
out->open_gather = aead_aes_gcm_open_gather;
|
||||
}
|
||||
|
||||
static int aead_aes_gcm_init_randnonce(EVP_AEAD_CTX *ctx, const uint8_t *key,
|
||||
size_t key_len,
|
||||
size_t requested_tag_len) {
|
||||
if (requested_tag_len != EVP_AEAD_DEFAULT_TAG_LENGTH) {
|
||||
if (requested_tag_len < AES_GCM_NONCE_LENGTH) {
|
||||
OPENSSL_PUT_ERROR(CIPHER, CIPHER_R_BUFFER_TOO_SMALL);
|
||||
return 0;
|
||||
}
|
||||
requested_tag_len -= AES_GCM_NONCE_LENGTH;
|
||||
}
|
||||
|
||||
if (!aead_aes_gcm_init(ctx, key, key_len, requested_tag_len)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ctx->tag_len += AES_GCM_NONCE_LENGTH;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int aead_aes_gcm_seal_scatter_randnonce(
|
||||
const EVP_AEAD_CTX *ctx,
|
||||
uint8_t *out, uint8_t *out_tag, size_t *out_tag_len, size_t max_out_tag_len,
|
||||
const uint8_t *external_nonce, size_t external_nonce_len,
|
||||
const uint8_t *in, size_t in_len,
|
||||
const uint8_t *extra_in, size_t extra_in_len,
|
||||
const uint8_t *ad, size_t ad_len) {
|
||||
if (external_nonce_len != 0) {
|
||||
OPENSSL_PUT_ERROR(CIPHER, CIPHER_R_INVALID_NONCE_SIZE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t nonce[AES_GCM_NONCE_LENGTH];
|
||||
if (max_out_tag_len < sizeof(nonce)) {
|
||||
OPENSSL_PUT_ERROR(CIPHER, CIPHER_R_BUFFER_TOO_SMALL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
RAND_bytes(nonce, sizeof(nonce));
|
||||
const struct aead_aes_gcm_ctx *gcm_ctx =
|
||||
(const struct aead_aes_gcm_ctx *)&ctx->state;
|
||||
if (!aead_aes_gcm_seal_scatter_impl(gcm_ctx, out, out_tag, out_tag_len,
|
||||
max_out_tag_len - AES_GCM_NONCE_LENGTH,
|
||||
nonce, sizeof(nonce), in, in_len,
|
||||
extra_in, extra_in_len, ad, ad_len,
|
||||
ctx->tag_len - AES_GCM_NONCE_LENGTH)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
assert(*out_tag_len + sizeof(nonce) <= max_out_tag_len);
|
||||
memcpy(out_tag + *out_tag_len, nonce, sizeof(nonce));
|
||||
*out_tag_len += sizeof(nonce);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int aead_aes_gcm_open_gather_randnonce(
|
||||
const EVP_AEAD_CTX *ctx, uint8_t *out,
|
||||
const uint8_t *external_nonce, size_t external_nonce_len,
|
||||
const uint8_t *in, size_t in_len,
|
||||
const uint8_t *in_tag, size_t in_tag_len,
|
||||
const uint8_t *ad, size_t ad_len) {
|
||||
if (external_nonce_len != 0) {
|
||||
OPENSSL_PUT_ERROR(CIPHER, CIPHER_R_INVALID_NONCE_SIZE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (in_tag_len < AES_GCM_NONCE_LENGTH) {
|
||||
OPENSSL_PUT_ERROR(CIPHER, CIPHER_R_BAD_DECRYPT);
|
||||
return 0;
|
||||
}
|
||||
const uint8_t *nonce = in_tag + in_tag_len - AES_GCM_NONCE_LENGTH;
|
||||
|
||||
const struct aead_aes_gcm_ctx *gcm_ctx =
|
||||
(const struct aead_aes_gcm_ctx *)&ctx->state;
|
||||
return aead_aes_gcm_open_gather_impl(
|
||||
gcm_ctx, out, nonce, AES_GCM_NONCE_LENGTH, in, in_len, in_tag,
|
||||
in_tag_len - AES_GCM_NONCE_LENGTH, ad, ad_len,
|
||||
ctx->tag_len - AES_GCM_NONCE_LENGTH);
|
||||
}
|
||||
|
||||
DEFINE_METHOD_FUNCTION(EVP_AEAD, EVP_aead_aes_128_gcm_randnonce) {
|
||||
memset(out, 0, sizeof(EVP_AEAD));
|
||||
|
||||
out->key_len = 16;
|
||||
out->nonce_len = 0;
|
||||
out->overhead = EVP_AEAD_AES_GCM_TAG_LEN + AES_GCM_NONCE_LENGTH;
|
||||
out->max_tag_len = EVP_AEAD_AES_GCM_TAG_LEN + AES_GCM_NONCE_LENGTH;
|
||||
out->seal_scatter_supports_extra_in = 1;
|
||||
|
||||
out->init = aead_aes_gcm_init_randnonce;
|
||||
out->cleanup = aead_aes_gcm_cleanup;
|
||||
out->seal_scatter = aead_aes_gcm_seal_scatter_randnonce;
|
||||
out->open_gather = aead_aes_gcm_open_gather_randnonce;
|
||||
}
|
||||
|
||||
DEFINE_METHOD_FUNCTION(EVP_AEAD, EVP_aead_aes_256_gcm_randnonce) {
|
||||
memset(out, 0, sizeof(EVP_AEAD));
|
||||
|
||||
out->key_len = 32;
|
||||
out->nonce_len = 0;
|
||||
out->overhead = EVP_AEAD_AES_GCM_TAG_LEN + AES_GCM_NONCE_LENGTH;
|
||||
out->max_tag_len = EVP_AEAD_AES_GCM_TAG_LEN + AES_GCM_NONCE_LENGTH;
|
||||
out->seal_scatter_supports_extra_in = 1;
|
||||
|
||||
out->init = aead_aes_gcm_init_randnonce;
|
||||
out->cleanup = aead_aes_gcm_cleanup;
|
||||
out->seal_scatter = aead_aes_gcm_seal_scatter_randnonce;
|
||||
out->open_gather = aead_aes_gcm_open_gather_randnonce;
|
||||
}
|
||||
|
||||
struct aead_aes_gcm_tls12_ctx {
|
||||
struct aead_aes_gcm_ctx gcm_ctx;
|
||||
uint64_t min_next_nonce;
|
||||
@@ -1128,7 +1266,7 @@ static int aead_aes_gcm_tls12_seal_scatter(
|
||||
struct aead_aes_gcm_tls12_ctx *gcm_ctx =
|
||||
(struct aead_aes_gcm_tls12_ctx *) &ctx->state;
|
||||
|
||||
if (nonce_len != 12) {
|
||||
if (nonce_len != AES_GCM_NONCE_LENGTH) {
|
||||
OPENSSL_PUT_ERROR(CIPHER, CIPHER_R_UNSUPPORTED_NONCE_SIZE);
|
||||
return 0;
|
||||
}
|
||||
@@ -1155,7 +1293,7 @@ DEFINE_METHOD_FUNCTION(EVP_AEAD, EVP_aead_aes_128_gcm_tls12) {
|
||||
memset(out, 0, sizeof(EVP_AEAD));
|
||||
|
||||
out->key_len = 16;
|
||||
out->nonce_len = 12;
|
||||
out->nonce_len = AES_GCM_NONCE_LENGTH;
|
||||
out->overhead = EVP_AEAD_AES_GCM_TAG_LEN;
|
||||
out->max_tag_len = EVP_AEAD_AES_GCM_TAG_LEN;
|
||||
out->seal_scatter_supports_extra_in = 1;
|
||||
@@ -1170,7 +1308,7 @@ DEFINE_METHOD_FUNCTION(EVP_AEAD, EVP_aead_aes_256_gcm_tls12) {
|
||||
memset(out, 0, sizeof(EVP_AEAD));
|
||||
|
||||
out->key_len = 32;
|
||||
out->nonce_len = 12;
|
||||
out->nonce_len = AES_GCM_NONCE_LENGTH;
|
||||
out->overhead = EVP_AEAD_AES_GCM_TAG_LEN;
|
||||
out->max_tag_len = EVP_AEAD_AES_GCM_TAG_LEN;
|
||||
out->seal_scatter_supports_extra_in = 1;
|
||||
@@ -1223,7 +1361,7 @@ static int aead_aes_gcm_tls13_seal_scatter(
|
||||
struct aead_aes_gcm_tls13_ctx *gcm_ctx =
|
||||
(struct aead_aes_gcm_tls13_ctx *) &ctx->state;
|
||||
|
||||
if (nonce_len != 12) {
|
||||
if (nonce_len != AES_GCM_NONCE_LENGTH) {
|
||||
OPENSSL_PUT_ERROR(CIPHER, CIPHER_R_UNSUPPORTED_NONCE_SIZE);
|
||||
return 0;
|
||||
}
|
||||
@@ -1261,7 +1399,7 @@ DEFINE_METHOD_FUNCTION(EVP_AEAD, EVP_aead_aes_128_gcm_tls13) {
|
||||
memset(out, 0, sizeof(EVP_AEAD));
|
||||
|
||||
out->key_len = 16;
|
||||
out->nonce_len = 12;
|
||||
out->nonce_len = AES_GCM_NONCE_LENGTH;
|
||||
out->overhead = EVP_AEAD_AES_GCM_TAG_LEN;
|
||||
out->max_tag_len = EVP_AEAD_AES_GCM_TAG_LEN;
|
||||
out->seal_scatter_supports_extra_in = 1;
|
||||
@@ -1276,7 +1414,7 @@ DEFINE_METHOD_FUNCTION(EVP_AEAD, EVP_aead_aes_256_gcm_tls13) {
|
||||
memset(out, 0, sizeof(EVP_AEAD));
|
||||
|
||||
out->key_len = 32;
|
||||
out->nonce_len = 12;
|
||||
out->nonce_len = AES_GCM_NONCE_LENGTH;
|
||||
out->overhead = EVP_AEAD_AES_GCM_TAG_LEN;
|
||||
out->max_tag_len = EVP_AEAD_AES_GCM_TAG_LEN;
|
||||
out->seal_scatter_supports_extra_in = 1;
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,298 @@
|
||||
#define BORINGSSL_PREFIX CCryptoBoringSSL
|
||||
#if defined(__i386__) && defined(_WIN32)
|
||||
# This file is generated from a similarly-named Perl script in the BoringSSL
|
||||
# source tree. Do not edit by hand.
|
||||
|
||||
#if defined(__i386__)
|
||||
#if defined(BORINGSSL_PREFIX)
|
||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||
#endif
|
||||
.text
|
||||
.globl _gcm_gmult_ssse3
|
||||
.hidden _gcm_gmult_ssse3
|
||||
.def _gcm_gmult_ssse3; .scl 2; .type 32; .endef
|
||||
.align 16
|
||||
_gcm_gmult_ssse3:
|
||||
.L_gcm_gmult_ssse3_begin:
|
||||
pushl %ebp
|
||||
pushl %ebx
|
||||
pushl %esi
|
||||
pushl %edi
|
||||
movl 20(%esp),%edi
|
||||
movl 24(%esp),%esi
|
||||
movdqu (%edi),%xmm0
|
||||
call .L000pic_point
|
||||
.L000pic_point:
|
||||
popl %eax
|
||||
movdqa .Lreverse_bytes-.L000pic_point(%eax),%xmm7
|
||||
movdqa .Llow4_mask-.L000pic_point(%eax),%xmm2
|
||||
.byte 102,15,56,0,199
|
||||
movdqa %xmm2,%xmm1
|
||||
pandn %xmm0,%xmm1
|
||||
psrld $4,%xmm1
|
||||
pand %xmm2,%xmm0
|
||||
pxor %xmm2,%xmm2
|
||||
pxor %xmm3,%xmm3
|
||||
movl $5,%eax
|
||||
.L001loop_row_1:
|
||||
movdqa (%esi),%xmm4
|
||||
leal 16(%esi),%esi
|
||||
movdqa %xmm2,%xmm6
|
||||
.byte 102,15,58,15,243,1
|
||||
movdqa %xmm6,%xmm3
|
||||
psrldq $1,%xmm2
|
||||
movdqa %xmm4,%xmm5
|
||||
.byte 102,15,56,0,224
|
||||
.byte 102,15,56,0,233
|
||||
pxor %xmm5,%xmm2
|
||||
movdqa %xmm4,%xmm5
|
||||
psllq $60,%xmm5
|
||||
movdqa %xmm5,%xmm6
|
||||
pslldq $8,%xmm6
|
||||
pxor %xmm6,%xmm3
|
||||
psrldq $8,%xmm5
|
||||
pxor %xmm5,%xmm2
|
||||
psrlq $4,%xmm4
|
||||
pxor %xmm4,%xmm2
|
||||
subl $1,%eax
|
||||
jnz .L001loop_row_1
|
||||
pxor %xmm3,%xmm2
|
||||
psrlq $1,%xmm3
|
||||
pxor %xmm3,%xmm2
|
||||
psrlq $1,%xmm3
|
||||
pxor %xmm3,%xmm2
|
||||
psrlq $5,%xmm3
|
||||
pxor %xmm3,%xmm2
|
||||
pxor %xmm3,%xmm3
|
||||
movl $5,%eax
|
||||
.L002loop_row_2:
|
||||
movdqa (%esi),%xmm4
|
||||
leal 16(%esi),%esi
|
||||
movdqa %xmm2,%xmm6
|
||||
.byte 102,15,58,15,243,1
|
||||
movdqa %xmm6,%xmm3
|
||||
psrldq $1,%xmm2
|
||||
movdqa %xmm4,%xmm5
|
||||
.byte 102,15,56,0,224
|
||||
.byte 102,15,56,0,233
|
||||
pxor %xmm5,%xmm2
|
||||
movdqa %xmm4,%xmm5
|
||||
psllq $60,%xmm5
|
||||
movdqa %xmm5,%xmm6
|
||||
pslldq $8,%xmm6
|
||||
pxor %xmm6,%xmm3
|
||||
psrldq $8,%xmm5
|
||||
pxor %xmm5,%xmm2
|
||||
psrlq $4,%xmm4
|
||||
pxor %xmm4,%xmm2
|
||||
subl $1,%eax
|
||||
jnz .L002loop_row_2
|
||||
pxor %xmm3,%xmm2
|
||||
psrlq $1,%xmm3
|
||||
pxor %xmm3,%xmm2
|
||||
psrlq $1,%xmm3
|
||||
pxor %xmm3,%xmm2
|
||||
psrlq $5,%xmm3
|
||||
pxor %xmm3,%xmm2
|
||||
pxor %xmm3,%xmm3
|
||||
movl $6,%eax
|
||||
.L003loop_row_3:
|
||||
movdqa (%esi),%xmm4
|
||||
leal 16(%esi),%esi
|
||||
movdqa %xmm2,%xmm6
|
||||
.byte 102,15,58,15,243,1
|
||||
movdqa %xmm6,%xmm3
|
||||
psrldq $1,%xmm2
|
||||
movdqa %xmm4,%xmm5
|
||||
.byte 102,15,56,0,224
|
||||
.byte 102,15,56,0,233
|
||||
pxor %xmm5,%xmm2
|
||||
movdqa %xmm4,%xmm5
|
||||
psllq $60,%xmm5
|
||||
movdqa %xmm5,%xmm6
|
||||
pslldq $8,%xmm6
|
||||
pxor %xmm6,%xmm3
|
||||
psrldq $8,%xmm5
|
||||
pxor %xmm5,%xmm2
|
||||
psrlq $4,%xmm4
|
||||
pxor %xmm4,%xmm2
|
||||
subl $1,%eax
|
||||
jnz .L003loop_row_3
|
||||
pxor %xmm3,%xmm2
|
||||
psrlq $1,%xmm3
|
||||
pxor %xmm3,%xmm2
|
||||
psrlq $1,%xmm3
|
||||
pxor %xmm3,%xmm2
|
||||
psrlq $5,%xmm3
|
||||
pxor %xmm3,%xmm2
|
||||
pxor %xmm3,%xmm3
|
||||
.byte 102,15,56,0,215
|
||||
movdqu %xmm2,(%edi)
|
||||
pxor %xmm0,%xmm0
|
||||
pxor %xmm1,%xmm1
|
||||
pxor %xmm2,%xmm2
|
||||
pxor %xmm3,%xmm3
|
||||
pxor %xmm4,%xmm4
|
||||
pxor %xmm5,%xmm5
|
||||
pxor %xmm6,%xmm6
|
||||
popl %edi
|
||||
popl %esi
|
||||
popl %ebx
|
||||
popl %ebp
|
||||
ret
|
||||
.globl _gcm_ghash_ssse3
|
||||
.hidden _gcm_ghash_ssse3
|
||||
.def _gcm_ghash_ssse3; .scl 2; .type 32; .endef
|
||||
.align 16
|
||||
_gcm_ghash_ssse3:
|
||||
.L_gcm_ghash_ssse3_begin:
|
||||
pushl %ebp
|
||||
pushl %ebx
|
||||
pushl %esi
|
||||
pushl %edi
|
||||
movl 20(%esp),%edi
|
||||
movl 24(%esp),%esi
|
||||
movl 28(%esp),%edx
|
||||
movl 32(%esp),%ecx
|
||||
movdqu (%edi),%xmm0
|
||||
call .L004pic_point
|
||||
.L004pic_point:
|
||||
popl %ebx
|
||||
movdqa .Lreverse_bytes-.L004pic_point(%ebx),%xmm7
|
||||
andl $-16,%ecx
|
||||
.byte 102,15,56,0,199
|
||||
pxor %xmm3,%xmm3
|
||||
.L005loop_ghash:
|
||||
movdqa .Llow4_mask-.L004pic_point(%ebx),%xmm2
|
||||
movdqu (%edx),%xmm1
|
||||
.byte 102,15,56,0,207
|
||||
pxor %xmm1,%xmm0
|
||||
movdqa %xmm2,%xmm1
|
||||
pandn %xmm0,%xmm1
|
||||
psrld $4,%xmm1
|
||||
pand %xmm2,%xmm0
|
||||
pxor %xmm2,%xmm2
|
||||
movl $5,%eax
|
||||
.L006loop_row_4:
|
||||
movdqa (%esi),%xmm4
|
||||
leal 16(%esi),%esi
|
||||
movdqa %xmm2,%xmm6
|
||||
.byte 102,15,58,15,243,1
|
||||
movdqa %xmm6,%xmm3
|
||||
psrldq $1,%xmm2
|
||||
movdqa %xmm4,%xmm5
|
||||
.byte 102,15,56,0,224
|
||||
.byte 102,15,56,0,233
|
||||
pxor %xmm5,%xmm2
|
||||
movdqa %xmm4,%xmm5
|
||||
psllq $60,%xmm5
|
||||
movdqa %xmm5,%xmm6
|
||||
pslldq $8,%xmm6
|
||||
pxor %xmm6,%xmm3
|
||||
psrldq $8,%xmm5
|
||||
pxor %xmm5,%xmm2
|
||||
psrlq $4,%xmm4
|
||||
pxor %xmm4,%xmm2
|
||||
subl $1,%eax
|
||||
jnz .L006loop_row_4
|
||||
pxor %xmm3,%xmm2
|
||||
psrlq $1,%xmm3
|
||||
pxor %xmm3,%xmm2
|
||||
psrlq $1,%xmm3
|
||||
pxor %xmm3,%xmm2
|
||||
psrlq $5,%xmm3
|
||||
pxor %xmm3,%xmm2
|
||||
pxor %xmm3,%xmm3
|
||||
movl $5,%eax
|
||||
.L007loop_row_5:
|
||||
movdqa (%esi),%xmm4
|
||||
leal 16(%esi),%esi
|
||||
movdqa %xmm2,%xmm6
|
||||
.byte 102,15,58,15,243,1
|
||||
movdqa %xmm6,%xmm3
|
||||
psrldq $1,%xmm2
|
||||
movdqa %xmm4,%xmm5
|
||||
.byte 102,15,56,0,224
|
||||
.byte 102,15,56,0,233
|
||||
pxor %xmm5,%xmm2
|
||||
movdqa %xmm4,%xmm5
|
||||
psllq $60,%xmm5
|
||||
movdqa %xmm5,%xmm6
|
||||
pslldq $8,%xmm6
|
||||
pxor %xmm6,%xmm3
|
||||
psrldq $8,%xmm5
|
||||
pxor %xmm5,%xmm2
|
||||
psrlq $4,%xmm4
|
||||
pxor %xmm4,%xmm2
|
||||
subl $1,%eax
|
||||
jnz .L007loop_row_5
|
||||
pxor %xmm3,%xmm2
|
||||
psrlq $1,%xmm3
|
||||
pxor %xmm3,%xmm2
|
||||
psrlq $1,%xmm3
|
||||
pxor %xmm3,%xmm2
|
||||
psrlq $5,%xmm3
|
||||
pxor %xmm3,%xmm2
|
||||
pxor %xmm3,%xmm3
|
||||
movl $6,%eax
|
||||
.L008loop_row_6:
|
||||
movdqa (%esi),%xmm4
|
||||
leal 16(%esi),%esi
|
||||
movdqa %xmm2,%xmm6
|
||||
.byte 102,15,58,15,243,1
|
||||
movdqa %xmm6,%xmm3
|
||||
psrldq $1,%xmm2
|
||||
movdqa %xmm4,%xmm5
|
||||
.byte 102,15,56,0,224
|
||||
.byte 102,15,56,0,233
|
||||
pxor %xmm5,%xmm2
|
||||
movdqa %xmm4,%xmm5
|
||||
psllq $60,%xmm5
|
||||
movdqa %xmm5,%xmm6
|
||||
pslldq $8,%xmm6
|
||||
pxor %xmm6,%xmm3
|
||||
psrldq $8,%xmm5
|
||||
pxor %xmm5,%xmm2
|
||||
psrlq $4,%xmm4
|
||||
pxor %xmm4,%xmm2
|
||||
subl $1,%eax
|
||||
jnz .L008loop_row_6
|
||||
pxor %xmm3,%xmm2
|
||||
psrlq $1,%xmm3
|
||||
pxor %xmm3,%xmm2
|
||||
psrlq $1,%xmm3
|
||||
pxor %xmm3,%xmm2
|
||||
psrlq $5,%xmm3
|
||||
pxor %xmm3,%xmm2
|
||||
pxor %xmm3,%xmm3
|
||||
movdqa %xmm2,%xmm0
|
||||
leal -256(%esi),%esi
|
||||
leal 16(%edx),%edx
|
||||
subl $16,%ecx
|
||||
jnz .L005loop_ghash
|
||||
.byte 102,15,56,0,199
|
||||
movdqu %xmm0,(%edi)
|
||||
pxor %xmm0,%xmm0
|
||||
pxor %xmm1,%xmm1
|
||||
pxor %xmm2,%xmm2
|
||||
pxor %xmm3,%xmm3
|
||||
pxor %xmm4,%xmm4
|
||||
pxor %xmm5,%xmm5
|
||||
pxor %xmm6,%xmm6
|
||||
popl %edi
|
||||
popl %esi
|
||||
popl %ebx
|
||||
popl %ebp
|
||||
ret
|
||||
.align 16
|
||||
.Lreverse_bytes:
|
||||
.byte 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
|
||||
.align 16
|
||||
.Llow4_mask:
|
||||
.long 252645135,252645135,252645135,252645135
|
||||
#endif
|
||||
#endif // defined(__i386__) && defined(_WIN32)
|
||||
#if defined(__linux__) && defined(__ELF__)
|
||||
.section .note.GNU-stack,"",%progbits
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
#define BORINGSSL_PREFIX CCryptoBoringSSL
|
||||
#if defined(__i386__) && defined(_WIN32)
|
||||
# This file is generated from a similarly-named Perl script in the BoringSSL
|
||||
# source tree. Do not edit by hand.
|
||||
|
||||
#if defined(__i386__)
|
||||
#if defined(BORINGSSL_PREFIX)
|
||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||
#endif
|
||||
.text
|
||||
.byte 71,72,65,83,72,32,102,111,114,32,120,56,54,44,32,67
|
||||
.byte 82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112
|
||||
.byte 112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62
|
||||
.byte 0
|
||||
#endif
|
||||
#endif // defined(__i386__) && defined(_WIN32)
|
||||
#if defined(__linux__) && defined(__ELF__)
|
||||
.section .note.GNU-stack,"",%progbits
|
||||
#endif
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#endif
|
||||
.align 4
|
||||
_gcm_init_v8:
|
||||
AARCH64_VALID_CALL_TARGET
|
||||
vld1.64 {q9},[r1] @ load input H
|
||||
vmov.i8 q11,#0xe1
|
||||
vshl.i64 q11,q11,#57 @ 0xc2.0
|
||||
@@ -80,6 +81,7 @@ _gcm_init_v8:
|
||||
#endif
|
||||
.align 4
|
||||
_gcm_gmult_v8:
|
||||
AARCH64_VALID_CALL_TARGET
|
||||
vld1.64 {q9},[r0] @ load Xi
|
||||
vmov.i8 q11,#0xe1
|
||||
vld1.64 {q12,q13},[r1] @ load twisted H, ...
|
||||
@@ -124,6 +126,7 @@ _gcm_gmult_v8:
|
||||
#endif
|
||||
.align 4
|
||||
_gcm_ghash_v8:
|
||||
AARCH64_VALID_CALL_TARGET
|
||||
vstmdb sp!,{d8,d9,d10,d11,d12,d13,d14,d15} @ 32-bit ABI says so
|
||||
vld1.64 {q0},[r0] @ load [rotated] Xi
|
||||
@ "[rotated]" means that
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
.type gcm_init_v8,%function
|
||||
.align 4
|
||||
gcm_init_v8:
|
||||
AARCH64_VALID_CALL_TARGET
|
||||
vld1.64 {q9},[r1] @ load input H
|
||||
vmov.i8 q11,#0xe1
|
||||
vshl.i64 q11,q11,#57 @ 0xc2.0
|
||||
@@ -77,6 +78,7 @@ gcm_init_v8:
|
||||
.type gcm_gmult_v8,%function
|
||||
.align 4
|
||||
gcm_gmult_v8:
|
||||
AARCH64_VALID_CALL_TARGET
|
||||
vld1.64 {q9},[r0] @ load Xi
|
||||
vmov.i8 q11,#0xe1
|
||||
vld1.64 {q12,q13},[r1] @ load twisted H, ...
|
||||
@@ -119,6 +121,7 @@ gcm_gmult_v8:
|
||||
.type gcm_ghash_v8,%function
|
||||
.align 4
|
||||
gcm_ghash_v8:
|
||||
AARCH64_VALID_CALL_TARGET
|
||||
vstmdb sp!,{d8,d9,d10,d11,d12,d13,d14,d15} @ 32-bit ABI says so
|
||||
vld1.64 {q0},[r0] @ load [rotated] Xi
|
||||
@ "[rotated]" means that
|
||||
|
||||
@@ -0,0 +1,693 @@
|
||||
#define BORINGSSL_PREFIX CCryptoBoringSSL
|
||||
#if defined(__i386__) && defined(_WIN32)
|
||||
# This file is generated from a similarly-named Perl script in the BoringSSL
|
||||
# source tree. Do not edit by hand.
|
||||
|
||||
#if defined(__i386__)
|
||||
#if defined(BORINGSSL_PREFIX)
|
||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||
#endif
|
||||
.text
|
||||
.globl _md5_block_asm_data_order
|
||||
.hidden _md5_block_asm_data_order
|
||||
.def _md5_block_asm_data_order; .scl 2; .type 32; .endef
|
||||
.align 16
|
||||
_md5_block_asm_data_order:
|
||||
.L_md5_block_asm_data_order_begin:
|
||||
pushl %esi
|
||||
pushl %edi
|
||||
movl 12(%esp),%edi
|
||||
movl 16(%esp),%esi
|
||||
movl 20(%esp),%ecx
|
||||
pushl %ebp
|
||||
shll $6,%ecx
|
||||
pushl %ebx
|
||||
addl %esi,%ecx
|
||||
subl $64,%ecx
|
||||
movl (%edi),%eax
|
||||
pushl %ecx
|
||||
movl 4(%edi),%ebx
|
||||
movl 8(%edi),%ecx
|
||||
movl 12(%edi),%edx
|
||||
.L000start:
|
||||
|
||||
# R0 section
|
||||
movl %ecx,%edi
|
||||
movl (%esi),%ebp
|
||||
# R0 0
|
||||
xorl %edx,%edi
|
||||
andl %ebx,%edi
|
||||
leal 3614090360(%eax,%ebp,1),%eax
|
||||
xorl %edx,%edi
|
||||
addl %edi,%eax
|
||||
movl %ebx,%edi
|
||||
roll $7,%eax
|
||||
movl 4(%esi),%ebp
|
||||
addl %ebx,%eax
|
||||
# R0 1
|
||||
xorl %ecx,%edi
|
||||
andl %eax,%edi
|
||||
leal 3905402710(%edx,%ebp,1),%edx
|
||||
xorl %ecx,%edi
|
||||
addl %edi,%edx
|
||||
movl %eax,%edi
|
||||
roll $12,%edx
|
||||
movl 8(%esi),%ebp
|
||||
addl %eax,%edx
|
||||
# R0 2
|
||||
xorl %ebx,%edi
|
||||
andl %edx,%edi
|
||||
leal 606105819(%ecx,%ebp,1),%ecx
|
||||
xorl %ebx,%edi
|
||||
addl %edi,%ecx
|
||||
movl %edx,%edi
|
||||
roll $17,%ecx
|
||||
movl 12(%esi),%ebp
|
||||
addl %edx,%ecx
|
||||
# R0 3
|
||||
xorl %eax,%edi
|
||||
andl %ecx,%edi
|
||||
leal 3250441966(%ebx,%ebp,1),%ebx
|
||||
xorl %eax,%edi
|
||||
addl %edi,%ebx
|
||||
movl %ecx,%edi
|
||||
roll $22,%ebx
|
||||
movl 16(%esi),%ebp
|
||||
addl %ecx,%ebx
|
||||
# R0 4
|
||||
xorl %edx,%edi
|
||||
andl %ebx,%edi
|
||||
leal 4118548399(%eax,%ebp,1),%eax
|
||||
xorl %edx,%edi
|
||||
addl %edi,%eax
|
||||
movl %ebx,%edi
|
||||
roll $7,%eax
|
||||
movl 20(%esi),%ebp
|
||||
addl %ebx,%eax
|
||||
# R0 5
|
||||
xorl %ecx,%edi
|
||||
andl %eax,%edi
|
||||
leal 1200080426(%edx,%ebp,1),%edx
|
||||
xorl %ecx,%edi
|
||||
addl %edi,%edx
|
||||
movl %eax,%edi
|
||||
roll $12,%edx
|
||||
movl 24(%esi),%ebp
|
||||
addl %eax,%edx
|
||||
# R0 6
|
||||
xorl %ebx,%edi
|
||||
andl %edx,%edi
|
||||
leal 2821735955(%ecx,%ebp,1),%ecx
|
||||
xorl %ebx,%edi
|
||||
addl %edi,%ecx
|
||||
movl %edx,%edi
|
||||
roll $17,%ecx
|
||||
movl 28(%esi),%ebp
|
||||
addl %edx,%ecx
|
||||
# R0 7
|
||||
xorl %eax,%edi
|
||||
andl %ecx,%edi
|
||||
leal 4249261313(%ebx,%ebp,1),%ebx
|
||||
xorl %eax,%edi
|
||||
addl %edi,%ebx
|
||||
movl %ecx,%edi
|
||||
roll $22,%ebx
|
||||
movl 32(%esi),%ebp
|
||||
addl %ecx,%ebx
|
||||
# R0 8
|
||||
xorl %edx,%edi
|
||||
andl %ebx,%edi
|
||||
leal 1770035416(%eax,%ebp,1),%eax
|
||||
xorl %edx,%edi
|
||||
addl %edi,%eax
|
||||
movl %ebx,%edi
|
||||
roll $7,%eax
|
||||
movl 36(%esi),%ebp
|
||||
addl %ebx,%eax
|
||||
# R0 9
|
||||
xorl %ecx,%edi
|
||||
andl %eax,%edi
|
||||
leal 2336552879(%edx,%ebp,1),%edx
|
||||
xorl %ecx,%edi
|
||||
addl %edi,%edx
|
||||
movl %eax,%edi
|
||||
roll $12,%edx
|
||||
movl 40(%esi),%ebp
|
||||
addl %eax,%edx
|
||||
# R0 10
|
||||
xorl %ebx,%edi
|
||||
andl %edx,%edi
|
||||
leal 4294925233(%ecx,%ebp,1),%ecx
|
||||
xorl %ebx,%edi
|
||||
addl %edi,%ecx
|
||||
movl %edx,%edi
|
||||
roll $17,%ecx
|
||||
movl 44(%esi),%ebp
|
||||
addl %edx,%ecx
|
||||
# R0 11
|
||||
xorl %eax,%edi
|
||||
andl %ecx,%edi
|
||||
leal 2304563134(%ebx,%ebp,1),%ebx
|
||||
xorl %eax,%edi
|
||||
addl %edi,%ebx
|
||||
movl %ecx,%edi
|
||||
roll $22,%ebx
|
||||
movl 48(%esi),%ebp
|
||||
addl %ecx,%ebx
|
||||
# R0 12
|
||||
xorl %edx,%edi
|
||||
andl %ebx,%edi
|
||||
leal 1804603682(%eax,%ebp,1),%eax
|
||||
xorl %edx,%edi
|
||||
addl %edi,%eax
|
||||
movl %ebx,%edi
|
||||
roll $7,%eax
|
||||
movl 52(%esi),%ebp
|
||||
addl %ebx,%eax
|
||||
# R0 13
|
||||
xorl %ecx,%edi
|
||||
andl %eax,%edi
|
||||
leal 4254626195(%edx,%ebp,1),%edx
|
||||
xorl %ecx,%edi
|
||||
addl %edi,%edx
|
||||
movl %eax,%edi
|
||||
roll $12,%edx
|
||||
movl 56(%esi),%ebp
|
||||
addl %eax,%edx
|
||||
# R0 14
|
||||
xorl %ebx,%edi
|
||||
andl %edx,%edi
|
||||
leal 2792965006(%ecx,%ebp,1),%ecx
|
||||
xorl %ebx,%edi
|
||||
addl %edi,%ecx
|
||||
movl %edx,%edi
|
||||
roll $17,%ecx
|
||||
movl 60(%esi),%ebp
|
||||
addl %edx,%ecx
|
||||
# R0 15
|
||||
xorl %eax,%edi
|
||||
andl %ecx,%edi
|
||||
leal 1236535329(%ebx,%ebp,1),%ebx
|
||||
xorl %eax,%edi
|
||||
addl %edi,%ebx
|
||||
movl %ecx,%edi
|
||||
roll $22,%ebx
|
||||
movl 4(%esi),%ebp
|
||||
addl %ecx,%ebx
|
||||
|
||||
# R1 section
|
||||
# R1 16
|
||||
leal 4129170786(%eax,%ebp,1),%eax
|
||||
xorl %ebx,%edi
|
||||
andl %edx,%edi
|
||||
movl 24(%esi),%ebp
|
||||
xorl %ecx,%edi
|
||||
addl %edi,%eax
|
||||
movl %ebx,%edi
|
||||
roll $5,%eax
|
||||
addl %ebx,%eax
|
||||
# R1 17
|
||||
leal 3225465664(%edx,%ebp,1),%edx
|
||||
xorl %eax,%edi
|
||||
andl %ecx,%edi
|
||||
movl 44(%esi),%ebp
|
||||
xorl %ebx,%edi
|
||||
addl %edi,%edx
|
||||
movl %eax,%edi
|
||||
roll $9,%edx
|
||||
addl %eax,%edx
|
||||
# R1 18
|
||||
leal 643717713(%ecx,%ebp,1),%ecx
|
||||
xorl %edx,%edi
|
||||
andl %ebx,%edi
|
||||
movl (%esi),%ebp
|
||||
xorl %eax,%edi
|
||||
addl %edi,%ecx
|
||||
movl %edx,%edi
|
||||
roll $14,%ecx
|
||||
addl %edx,%ecx
|
||||
# R1 19
|
||||
leal 3921069994(%ebx,%ebp,1),%ebx
|
||||
xorl %ecx,%edi
|
||||
andl %eax,%edi
|
||||
movl 20(%esi),%ebp
|
||||
xorl %edx,%edi
|
||||
addl %edi,%ebx
|
||||
movl %ecx,%edi
|
||||
roll $20,%ebx
|
||||
addl %ecx,%ebx
|
||||
# R1 20
|
||||
leal 3593408605(%eax,%ebp,1),%eax
|
||||
xorl %ebx,%edi
|
||||
andl %edx,%edi
|
||||
movl 40(%esi),%ebp
|
||||
xorl %ecx,%edi
|
||||
addl %edi,%eax
|
||||
movl %ebx,%edi
|
||||
roll $5,%eax
|
||||
addl %ebx,%eax
|
||||
# R1 21
|
||||
leal 38016083(%edx,%ebp,1),%edx
|
||||
xorl %eax,%edi
|
||||
andl %ecx,%edi
|
||||
movl 60(%esi),%ebp
|
||||
xorl %ebx,%edi
|
||||
addl %edi,%edx
|
||||
movl %eax,%edi
|
||||
roll $9,%edx
|
||||
addl %eax,%edx
|
||||
# R1 22
|
||||
leal 3634488961(%ecx,%ebp,1),%ecx
|
||||
xorl %edx,%edi
|
||||
andl %ebx,%edi
|
||||
movl 16(%esi),%ebp
|
||||
xorl %eax,%edi
|
||||
addl %edi,%ecx
|
||||
movl %edx,%edi
|
||||
roll $14,%ecx
|
||||
addl %edx,%ecx
|
||||
# R1 23
|
||||
leal 3889429448(%ebx,%ebp,1),%ebx
|
||||
xorl %ecx,%edi
|
||||
andl %eax,%edi
|
||||
movl 36(%esi),%ebp
|
||||
xorl %edx,%edi
|
||||
addl %edi,%ebx
|
||||
movl %ecx,%edi
|
||||
roll $20,%ebx
|
||||
addl %ecx,%ebx
|
||||
# R1 24
|
||||
leal 568446438(%eax,%ebp,1),%eax
|
||||
xorl %ebx,%edi
|
||||
andl %edx,%edi
|
||||
movl 56(%esi),%ebp
|
||||
xorl %ecx,%edi
|
||||
addl %edi,%eax
|
||||
movl %ebx,%edi
|
||||
roll $5,%eax
|
||||
addl %ebx,%eax
|
||||
# R1 25
|
||||
leal 3275163606(%edx,%ebp,1),%edx
|
||||
xorl %eax,%edi
|
||||
andl %ecx,%edi
|
||||
movl 12(%esi),%ebp
|
||||
xorl %ebx,%edi
|
||||
addl %edi,%edx
|
||||
movl %eax,%edi
|
||||
roll $9,%edx
|
||||
addl %eax,%edx
|
||||
# R1 26
|
||||
leal 4107603335(%ecx,%ebp,1),%ecx
|
||||
xorl %edx,%edi
|
||||
andl %ebx,%edi
|
||||
movl 32(%esi),%ebp
|
||||
xorl %eax,%edi
|
||||
addl %edi,%ecx
|
||||
movl %edx,%edi
|
||||
roll $14,%ecx
|
||||
addl %edx,%ecx
|
||||
# R1 27
|
||||
leal 1163531501(%ebx,%ebp,1),%ebx
|
||||
xorl %ecx,%edi
|
||||
andl %eax,%edi
|
||||
movl 52(%esi),%ebp
|
||||
xorl %edx,%edi
|
||||
addl %edi,%ebx
|
||||
movl %ecx,%edi
|
||||
roll $20,%ebx
|
||||
addl %ecx,%ebx
|
||||
# R1 28
|
||||
leal 2850285829(%eax,%ebp,1),%eax
|
||||
xorl %ebx,%edi
|
||||
andl %edx,%edi
|
||||
movl 8(%esi),%ebp
|
||||
xorl %ecx,%edi
|
||||
addl %edi,%eax
|
||||
movl %ebx,%edi
|
||||
roll $5,%eax
|
||||
addl %ebx,%eax
|
||||
# R1 29
|
||||
leal 4243563512(%edx,%ebp,1),%edx
|
||||
xorl %eax,%edi
|
||||
andl %ecx,%edi
|
||||
movl 28(%esi),%ebp
|
||||
xorl %ebx,%edi
|
||||
addl %edi,%edx
|
||||
movl %eax,%edi
|
||||
roll $9,%edx
|
||||
addl %eax,%edx
|
||||
# R1 30
|
||||
leal 1735328473(%ecx,%ebp,1),%ecx
|
||||
xorl %edx,%edi
|
||||
andl %ebx,%edi
|
||||
movl 48(%esi),%ebp
|
||||
xorl %eax,%edi
|
||||
addl %edi,%ecx
|
||||
movl %edx,%edi
|
||||
roll $14,%ecx
|
||||
addl %edx,%ecx
|
||||
# R1 31
|
||||
leal 2368359562(%ebx,%ebp,1),%ebx
|
||||
xorl %ecx,%edi
|
||||
andl %eax,%edi
|
||||
movl 20(%esi),%ebp
|
||||
xorl %edx,%edi
|
||||
addl %edi,%ebx
|
||||
movl %ecx,%edi
|
||||
roll $20,%ebx
|
||||
addl %ecx,%ebx
|
||||
|
||||
# R2 section
|
||||
# R2 32
|
||||
xorl %edx,%edi
|
||||
xorl %ebx,%edi
|
||||
leal 4294588738(%eax,%ebp,1),%eax
|
||||
addl %edi,%eax
|
||||
roll $4,%eax
|
||||
movl 32(%esi),%ebp
|
||||
movl %ebx,%edi
|
||||
# R2 33
|
||||
leal 2272392833(%edx,%ebp,1),%edx
|
||||
addl %ebx,%eax
|
||||
xorl %ecx,%edi
|
||||
xorl %eax,%edi
|
||||
movl 44(%esi),%ebp
|
||||
addl %edi,%edx
|
||||
movl %eax,%edi
|
||||
roll $11,%edx
|
||||
addl %eax,%edx
|
||||
# R2 34
|
||||
xorl %ebx,%edi
|
||||
xorl %edx,%edi
|
||||
leal 1839030562(%ecx,%ebp,1),%ecx
|
||||
addl %edi,%ecx
|
||||
roll $16,%ecx
|
||||
movl 56(%esi),%ebp
|
||||
movl %edx,%edi
|
||||
# R2 35
|
||||
leal 4259657740(%ebx,%ebp,1),%ebx
|
||||
addl %edx,%ecx
|
||||
xorl %eax,%edi
|
||||
xorl %ecx,%edi
|
||||
movl 4(%esi),%ebp
|
||||
addl %edi,%ebx
|
||||
movl %ecx,%edi
|
||||
roll $23,%ebx
|
||||
addl %ecx,%ebx
|
||||
# R2 36
|
||||
xorl %edx,%edi
|
||||
xorl %ebx,%edi
|
||||
leal 2763975236(%eax,%ebp,1),%eax
|
||||
addl %edi,%eax
|
||||
roll $4,%eax
|
||||
movl 16(%esi),%ebp
|
||||
movl %ebx,%edi
|
||||
# R2 37
|
||||
leal 1272893353(%edx,%ebp,1),%edx
|
||||
addl %ebx,%eax
|
||||
xorl %ecx,%edi
|
||||
xorl %eax,%edi
|
||||
movl 28(%esi),%ebp
|
||||
addl %edi,%edx
|
||||
movl %eax,%edi
|
||||
roll $11,%edx
|
||||
addl %eax,%edx
|
||||
# R2 38
|
||||
xorl %ebx,%edi
|
||||
xorl %edx,%edi
|
||||
leal 4139469664(%ecx,%ebp,1),%ecx
|
||||
addl %edi,%ecx
|
||||
roll $16,%ecx
|
||||
movl 40(%esi),%ebp
|
||||
movl %edx,%edi
|
||||
# R2 39
|
||||
leal 3200236656(%ebx,%ebp,1),%ebx
|
||||
addl %edx,%ecx
|
||||
xorl %eax,%edi
|
||||
xorl %ecx,%edi
|
||||
movl 52(%esi),%ebp
|
||||
addl %edi,%ebx
|
||||
movl %ecx,%edi
|
||||
roll $23,%ebx
|
||||
addl %ecx,%ebx
|
||||
# R2 40
|
||||
xorl %edx,%edi
|
||||
xorl %ebx,%edi
|
||||
leal 681279174(%eax,%ebp,1),%eax
|
||||
addl %edi,%eax
|
||||
roll $4,%eax
|
||||
movl (%esi),%ebp
|
||||
movl %ebx,%edi
|
||||
# R2 41
|
||||
leal 3936430074(%edx,%ebp,1),%edx
|
||||
addl %ebx,%eax
|
||||
xorl %ecx,%edi
|
||||
xorl %eax,%edi
|
||||
movl 12(%esi),%ebp
|
||||
addl %edi,%edx
|
||||
movl %eax,%edi
|
||||
roll $11,%edx
|
||||
addl %eax,%edx
|
||||
# R2 42
|
||||
xorl %ebx,%edi
|
||||
xorl %edx,%edi
|
||||
leal 3572445317(%ecx,%ebp,1),%ecx
|
||||
addl %edi,%ecx
|
||||
roll $16,%ecx
|
||||
movl 24(%esi),%ebp
|
||||
movl %edx,%edi
|
||||
# R2 43
|
||||
leal 76029189(%ebx,%ebp,1),%ebx
|
||||
addl %edx,%ecx
|
||||
xorl %eax,%edi
|
||||
xorl %ecx,%edi
|
||||
movl 36(%esi),%ebp
|
||||
addl %edi,%ebx
|
||||
movl %ecx,%edi
|
||||
roll $23,%ebx
|
||||
addl %ecx,%ebx
|
||||
# R2 44
|
||||
xorl %edx,%edi
|
||||
xorl %ebx,%edi
|
||||
leal 3654602809(%eax,%ebp,1),%eax
|
||||
addl %edi,%eax
|
||||
roll $4,%eax
|
||||
movl 48(%esi),%ebp
|
||||
movl %ebx,%edi
|
||||
# R2 45
|
||||
leal 3873151461(%edx,%ebp,1),%edx
|
||||
addl %ebx,%eax
|
||||
xorl %ecx,%edi
|
||||
xorl %eax,%edi
|
||||
movl 60(%esi),%ebp
|
||||
addl %edi,%edx
|
||||
movl %eax,%edi
|
||||
roll $11,%edx
|
||||
addl %eax,%edx
|
||||
# R2 46
|
||||
xorl %ebx,%edi
|
||||
xorl %edx,%edi
|
||||
leal 530742520(%ecx,%ebp,1),%ecx
|
||||
addl %edi,%ecx
|
||||
roll $16,%ecx
|
||||
movl 8(%esi),%ebp
|
||||
movl %edx,%edi
|
||||
# R2 47
|
||||
leal 3299628645(%ebx,%ebp,1),%ebx
|
||||
addl %edx,%ecx
|
||||
xorl %eax,%edi
|
||||
xorl %ecx,%edi
|
||||
movl (%esi),%ebp
|
||||
addl %edi,%ebx
|
||||
movl $-1,%edi
|
||||
roll $23,%ebx
|
||||
addl %ecx,%ebx
|
||||
|
||||
# R3 section
|
||||
# R3 48
|
||||
xorl %edx,%edi
|
||||
orl %ebx,%edi
|
||||
leal 4096336452(%eax,%ebp,1),%eax
|
||||
xorl %ecx,%edi
|
||||
movl 28(%esi),%ebp
|
||||
addl %edi,%eax
|
||||
movl $-1,%edi
|
||||
roll $6,%eax
|
||||
xorl %ecx,%edi
|
||||
addl %ebx,%eax
|
||||
# R3 49
|
||||
orl %eax,%edi
|
||||
leal 1126891415(%edx,%ebp,1),%edx
|
||||
xorl %ebx,%edi
|
||||
movl 56(%esi),%ebp
|
||||
addl %edi,%edx
|
||||
movl $-1,%edi
|
||||
roll $10,%edx
|
||||
xorl %ebx,%edi
|
||||
addl %eax,%edx
|
||||
# R3 50
|
||||
orl %edx,%edi
|
||||
leal 2878612391(%ecx,%ebp,1),%ecx
|
||||
xorl %eax,%edi
|
||||
movl 20(%esi),%ebp
|
||||
addl %edi,%ecx
|
||||
movl $-1,%edi
|
||||
roll $15,%ecx
|
||||
xorl %eax,%edi
|
||||
addl %edx,%ecx
|
||||
# R3 51
|
||||
orl %ecx,%edi
|
||||
leal 4237533241(%ebx,%ebp,1),%ebx
|
||||
xorl %edx,%edi
|
||||
movl 48(%esi),%ebp
|
||||
addl %edi,%ebx
|
||||
movl $-1,%edi
|
||||
roll $21,%ebx
|
||||
xorl %edx,%edi
|
||||
addl %ecx,%ebx
|
||||
# R3 52
|
||||
orl %ebx,%edi
|
||||
leal 1700485571(%eax,%ebp,1),%eax
|
||||
xorl %ecx,%edi
|
||||
movl 12(%esi),%ebp
|
||||
addl %edi,%eax
|
||||
movl $-1,%edi
|
||||
roll $6,%eax
|
||||
xorl %ecx,%edi
|
||||
addl %ebx,%eax
|
||||
# R3 53
|
||||
orl %eax,%edi
|
||||
leal 2399980690(%edx,%ebp,1),%edx
|
||||
xorl %ebx,%edi
|
||||
movl 40(%esi),%ebp
|
||||
addl %edi,%edx
|
||||
movl $-1,%edi
|
||||
roll $10,%edx
|
||||
xorl %ebx,%edi
|
||||
addl %eax,%edx
|
||||
# R3 54
|
||||
orl %edx,%edi
|
||||
leal 4293915773(%ecx,%ebp,1),%ecx
|
||||
xorl %eax,%edi
|
||||
movl 4(%esi),%ebp
|
||||
addl %edi,%ecx
|
||||
movl $-1,%edi
|
||||
roll $15,%ecx
|
||||
xorl %eax,%edi
|
||||
addl %edx,%ecx
|
||||
# R3 55
|
||||
orl %ecx,%edi
|
||||
leal 2240044497(%ebx,%ebp,1),%ebx
|
||||
xorl %edx,%edi
|
||||
movl 32(%esi),%ebp
|
||||
addl %edi,%ebx
|
||||
movl $-1,%edi
|
||||
roll $21,%ebx
|
||||
xorl %edx,%edi
|
||||
addl %ecx,%ebx
|
||||
# R3 56
|
||||
orl %ebx,%edi
|
||||
leal 1873313359(%eax,%ebp,1),%eax
|
||||
xorl %ecx,%edi
|
||||
movl 60(%esi),%ebp
|
||||
addl %edi,%eax
|
||||
movl $-1,%edi
|
||||
roll $6,%eax
|
||||
xorl %ecx,%edi
|
||||
addl %ebx,%eax
|
||||
# R3 57
|
||||
orl %eax,%edi
|
||||
leal 4264355552(%edx,%ebp,1),%edx
|
||||
xorl %ebx,%edi
|
||||
movl 24(%esi),%ebp
|
||||
addl %edi,%edx
|
||||
movl $-1,%edi
|
||||
roll $10,%edx
|
||||
xorl %ebx,%edi
|
||||
addl %eax,%edx
|
||||
# R3 58
|
||||
orl %edx,%edi
|
||||
leal 2734768916(%ecx,%ebp,1),%ecx
|
||||
xorl %eax,%edi
|
||||
movl 52(%esi),%ebp
|
||||
addl %edi,%ecx
|
||||
movl $-1,%edi
|
||||
roll $15,%ecx
|
||||
xorl %eax,%edi
|
||||
addl %edx,%ecx
|
||||
# R3 59
|
||||
orl %ecx,%edi
|
||||
leal 1309151649(%ebx,%ebp,1),%ebx
|
||||
xorl %edx,%edi
|
||||
movl 16(%esi),%ebp
|
||||
addl %edi,%ebx
|
||||
movl $-1,%edi
|
||||
roll $21,%ebx
|
||||
xorl %edx,%edi
|
||||
addl %ecx,%ebx
|
||||
# R3 60
|
||||
orl %ebx,%edi
|
||||
leal 4149444226(%eax,%ebp,1),%eax
|
||||
xorl %ecx,%edi
|
||||
movl 44(%esi),%ebp
|
||||
addl %edi,%eax
|
||||
movl $-1,%edi
|
||||
roll $6,%eax
|
||||
xorl %ecx,%edi
|
||||
addl %ebx,%eax
|
||||
# R3 61
|
||||
orl %eax,%edi
|
||||
leal 3174756917(%edx,%ebp,1),%edx
|
||||
xorl %ebx,%edi
|
||||
movl 8(%esi),%ebp
|
||||
addl %edi,%edx
|
||||
movl $-1,%edi
|
||||
roll $10,%edx
|
||||
xorl %ebx,%edi
|
||||
addl %eax,%edx
|
||||
# R3 62
|
||||
orl %edx,%edi
|
||||
leal 718787259(%ecx,%ebp,1),%ecx
|
||||
xorl %eax,%edi
|
||||
movl 36(%esi),%ebp
|
||||
addl %edi,%ecx
|
||||
movl $-1,%edi
|
||||
roll $15,%ecx
|
||||
xorl %eax,%edi
|
||||
addl %edx,%ecx
|
||||
# R3 63
|
||||
orl %ecx,%edi
|
||||
leal 3951481745(%ebx,%ebp,1),%ebx
|
||||
xorl %edx,%edi
|
||||
movl 24(%esp),%ebp
|
||||
addl %edi,%ebx
|
||||
addl $64,%esi
|
||||
roll $21,%ebx
|
||||
movl (%ebp),%edi
|
||||
addl %ecx,%ebx
|
||||
addl %edi,%eax
|
||||
movl 4(%ebp),%edi
|
||||
addl %edi,%ebx
|
||||
movl 8(%ebp),%edi
|
||||
addl %edi,%ecx
|
||||
movl 12(%ebp),%edi
|
||||
addl %edi,%edx
|
||||
movl %eax,(%ebp)
|
||||
movl %ebx,4(%ebp)
|
||||
movl (%esp),%edi
|
||||
movl %ecx,8(%ebp)
|
||||
movl %edx,12(%ebp)
|
||||
cmpl %esi,%edi
|
||||
jae .L000start
|
||||
popl %eax
|
||||
popl %ebx
|
||||
popl %ebp
|
||||
popl %edi
|
||||
popl %esi
|
||||
ret
|
||||
#endif
|
||||
#endif // defined(__i386__) && defined(_WIN32)
|
||||
#if defined(__linux__) && defined(__ELF__)
|
||||
.section .note.GNU-stack,"",%progbits
|
||||
#endif
|
||||
|
||||
@@ -933,20 +933,57 @@ static int ensure_bignum(BIGNUM **out) {
|
||||
return *out != NULL;
|
||||
}
|
||||
|
||||
// kBoringSSLRSASqrtTwo is the BIGNUM representation of ⌊2¹⁵³⁵×√2⌋. This is
|
||||
// chosen to give enough precision for 3072-bit RSA, the largest key size FIPS
|
||||
// kBoringSSLRSASqrtTwo is the BIGNUM representation of ⌊2²⁰⁴⁷×√2⌋. This is
|
||||
// chosen to give enough precision for 4096-bit RSA, the largest key size FIPS
|
||||
// specifies. Key sizes beyond this will round up.
|
||||
//
|
||||
// To verify this number, check that n² < 2³⁰⁷¹ < (n+1)², where n is value
|
||||
// To calculate, use the following Haskell code:
|
||||
//
|
||||
// import Text.Printf (printf)
|
||||
// import Data.List (intercalate)
|
||||
//
|
||||
// pow2 = 4095
|
||||
// target = 2^pow2
|
||||
//
|
||||
// f x = x*x - (toRational target)
|
||||
//
|
||||
// fprime x = 2*x
|
||||
//
|
||||
// newtonIteration x = x - (f x) / (fprime x)
|
||||
//
|
||||
// converge x =
|
||||
// let n = floor x in
|
||||
// if n*n - target < 0 && (n+1)*(n+1) - target > 0
|
||||
// then n
|
||||
// else converge (newtonIteration x)
|
||||
//
|
||||
// divrem bits x = (x `div` (2^bits), x `rem` (2^bits))
|
||||
//
|
||||
// bnWords :: Integer -> [Integer]
|
||||
// bnWords x =
|
||||
// if x == 0
|
||||
// then []
|
||||
// else let (high, low) = divrem 64 x in low : bnWords high
|
||||
//
|
||||
// showWord x = let (high, low) = divrem 32 x in printf "TOBN(0x%08x, 0x%08x)" high low
|
||||
//
|
||||
// output :: String
|
||||
// output = intercalate ", " $ map showWord $ bnWords $ converge (2 ^ (pow2 `div` 2))
|
||||
//
|
||||
// To verify this number, check that n² < 2⁴⁰⁹⁵ < (n+1)², where n is value
|
||||
// represented here. Note the components are listed in little-endian order. Here
|
||||
// is some sample Python code to check:
|
||||
//
|
||||
// >>> TOBN = lambda a, b: a << 32 | b
|
||||
// >>> l = [ <paste the contents of kSqrtTwo> ]
|
||||
// >>> n = sum(a * 2**(64*i) for i, a in enumerate(l))
|
||||
// >>> n**2 < 2**3071 < (n+1)**2
|
||||
// >>> n**2 < 2**4095 < (n+1)**2
|
||||
// True
|
||||
const BN_ULONG kBoringSSLRSASqrtTwo[] = {
|
||||
TOBN(0x4d7c60a5, 0xe633e3e1), TOBN(0x5fcf8f7b, 0xca3ea33b),
|
||||
TOBN(0xc246785e, 0x92957023), TOBN(0xf9acce41, 0x797f2805),
|
||||
TOBN(0xfdfe170f, 0xd3b1f780), TOBN(0xd24f4a76, 0x3facb882),
|
||||
TOBN(0x18838a2e, 0xaff5f3b2), TOBN(0xc1fcbdde, 0xa2f7dc33),
|
||||
TOBN(0xdea06241, 0xf7aa81c2), TOBN(0xf6a1be3f, 0xca221307),
|
||||
TOBN(0x332a5e9f, 0x7bda1ebf), TOBN(0x0104dc01, 0xfe32352f),
|
||||
TOBN(0xb8cf341b, 0x6f8236c7), TOBN(0x4264dabc, 0xd528b651),
|
||||
@@ -1167,13 +1204,13 @@ static int rsa_generate_key_impl(RSA *rsa, int bits, const BIGNUM *e_value,
|
||||
int sqrt2_bits = kBoringSSLRSASqrtTwoLen * BN_BITS2;
|
||||
assert(sqrt2_bits == (int)BN_num_bits(sqrt2));
|
||||
if (sqrt2_bits > prime_bits) {
|
||||
// For key sizes up to 3072 (prime_bits = 1536), this is exactly
|
||||
// For key sizes up to 4096 (prime_bits = 2048), this is exactly
|
||||
// ⌊2^(prime_bits-1)×√2⌋.
|
||||
if (!BN_rshift(sqrt2, sqrt2, sqrt2_bits - prime_bits)) {
|
||||
goto bn_err;
|
||||
}
|
||||
} else if (prime_bits > sqrt2_bits) {
|
||||
// For key sizes beyond 3072, this is approximate. We err towards retrying
|
||||
// For key sizes beyond 4096, this is approximate. We err towards retrying
|
||||
// to ensure our key is the right size and round up.
|
||||
if (!BN_add_word(sqrt2, 1) ||
|
||||
!BN_lshift(sqrt2, sqrt2, prime_bits - sqrt2_bits)) {
|
||||
@@ -1330,7 +1367,9 @@ int RSA_generate_key_ex(RSA *rsa, int bits, const BIGNUM *e_value,
|
||||
int RSA_generate_key_fips(RSA *rsa, int bits, BN_GENCB *cb) {
|
||||
// FIPS 186-4 allows 2048-bit and 3072-bit RSA keys (1024-bit and 1536-bit
|
||||
// primes, respectively) with the prime generation method we use.
|
||||
if (bits != 2048 && bits != 3072) {
|
||||
// Subsequently, IG A.14 stated that larger modulus sizes can be used and ACVP
|
||||
// testing supports 4096 bits.
|
||||
if (bits != 2048 && bits != 3072 && bits != 4096) {
|
||||
OPENSSL_PUT_ERROR(RSA, RSA_R_BAD_RSA_PARAMETERS);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <CCryptoBoringSSL_aes.h>
|
||||
#include <CCryptoBoringSSL_bn.h>
|
||||
#include <CCryptoBoringSSL_des.h>
|
||||
#include <CCryptoBoringSSL_digest.h>
|
||||
#include <CCryptoBoringSSL_ec.h>
|
||||
#include <CCryptoBoringSSL_ecdsa.h>
|
||||
#include <CCryptoBoringSSL_ec_key.h>
|
||||
@@ -31,6 +32,7 @@
|
||||
#include "../../internal.h"
|
||||
#include "../ec/internal.h"
|
||||
#include "../rand/internal.h"
|
||||
#include "../tls/internal.h"
|
||||
|
||||
|
||||
// MSVC wants to put a NUL byte at the end of non-char arrays and so cannot
|
||||
@@ -460,6 +462,30 @@ int boringssl_fips_self_test(
|
||||
0x00,
|
||||
#endif
|
||||
};
|
||||
const uint8_t kTLSOutput[32] = {
|
||||
0x67, 0x85, 0xde, 0x60, 0xfc, 0x0a, 0x83, 0xe9, 0xa2, 0x2a, 0xb3,
|
||||
0xf0, 0x27, 0x0c, 0xba, 0xf7, 0xfa, 0x82, 0x3d, 0x14, 0x77, 0x1d,
|
||||
0x86, 0x29, 0x79, 0x39, 0x77, 0x8a, 0xd5, 0x0e, 0x9d,
|
||||
#if !defined(BORINGSSL_FIPS_BREAK_TLS_KDF)
|
||||
0x32,
|
||||
#else
|
||||
0x00,
|
||||
#endif
|
||||
};
|
||||
const uint8_t kTLSSecret[32] = {
|
||||
0xbf, 0xe4, 0xb7, 0xe0, 0x26, 0x55, 0x5f, 0x6a, 0xdf, 0x5d, 0x27,
|
||||
0xd6, 0x89, 0x99, 0x2a, 0xd6, 0xf7, 0x65, 0x66, 0x07, 0x4b, 0x55,
|
||||
0x5f, 0x64, 0x55, 0xcd, 0xd5, 0x77, 0xa4, 0xc7, 0x09, 0x61,
|
||||
};
|
||||
const char kTLSLabel[] = "FIPS self test";
|
||||
const uint8_t kTLSSeed1[16] = {
|
||||
0x8f, 0x0d, 0xe8, 0xb6, 0x90, 0x8f, 0xb1, 0xd2,
|
||||
0x6d, 0x51, 0xf4, 0x79, 0x18, 0x63, 0x51, 0x65,
|
||||
};
|
||||
const uint8_t kTLSSeed2[16] = {
|
||||
0x7d, 0x24, 0x1a, 0x9d, 0x3c, 0x59, 0xbf, 0x3c,
|
||||
0x31, 0x1e, 0x2b, 0x21, 0x41, 0x8d, 0x32, 0x81,
|
||||
};
|
||||
|
||||
EVP_AEAD_CTX aead_ctx;
|
||||
EVP_AEAD_CTX_zero(&aead_ctx);
|
||||
@@ -611,7 +637,7 @@ int boringssl_fips_self_test(
|
||||
goto err;
|
||||
}
|
||||
|
||||
// ECDSA Sign/Verify PWCT
|
||||
// ECDSA Sign/Verify KAT
|
||||
|
||||
// The 'k' value for ECDSA is fixed to avoid an entropy draw.
|
||||
ec_key->fixed_k = BN_new();
|
||||
@@ -632,7 +658,13 @@ int boringssl_fips_self_test(
|
||||
!BN_bn2bin(sig->s, ecdsa_s_bytes) ||
|
||||
!check_test(kECDSASigR, ecdsa_r_bytes, sizeof(kECDSASigR), "ECDSA R") ||
|
||||
!check_test(kECDSASigS, ecdsa_s_bytes, sizeof(kECDSASigS), "ECDSA S")) {
|
||||
fprintf(stderr, "ECDSA KAT failed.\n");
|
||||
fprintf(stderr, "ECDSA signature KAT failed.\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (!ECDSA_do_verify(kPlaintextSHA256, sizeof(kPlaintextSHA256), sig,
|
||||
ec_key)) {
|
||||
fprintf(stderr, "ECDSA verification KAT failed.\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -684,6 +716,17 @@ int boringssl_fips_self_test(
|
||||
goto err;
|
||||
}
|
||||
|
||||
// TLS KDF KAT
|
||||
uint8_t tls_output[sizeof(kTLSOutput)];
|
||||
if (!CRYPTO_tls1_prf(EVP_sha256(), tls_output, sizeof(tls_output), kTLSSecret,
|
||||
sizeof(kTLSSecret), kTLSLabel, sizeof(kTLSLabel),
|
||||
kTLSSeed1, sizeof(kTLSSeed1), kTLSSeed2,
|
||||
sizeof(kTLSSeed2)) ||
|
||||
!check_test(kTLSOutput, tls_output, sizeof(kTLSOutput), "TLS KDF KAT")) {
|
||||
fprintf(stderr, "TLS KDF failed.\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = 1;
|
||||
|
||||
#if defined(BORINGSSL_FIPS_SELF_TEST_FLAG_FILE)
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,579 @@
|
||||
#define BORINGSSL_PREFIX CCryptoBoringSSL
|
||||
#if defined(__i386__) && defined(_WIN32)
|
||||
# This file is generated from a similarly-named Perl script in the BoringSSL
|
||||
# source tree. Do not edit by hand.
|
||||
|
||||
#if defined(__i386__)
|
||||
#if defined(BORINGSSL_PREFIX)
|
||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||
#endif
|
||||
.text
|
||||
.globl _sha512_block_data_order
|
||||
.hidden _sha512_block_data_order
|
||||
.def _sha512_block_data_order; .scl 2; .type 32; .endef
|
||||
.align 16
|
||||
_sha512_block_data_order:
|
||||
.L_sha512_block_data_order_begin:
|
||||
pushl %ebp
|
||||
pushl %ebx
|
||||
pushl %esi
|
||||
pushl %edi
|
||||
movl 20(%esp),%esi
|
||||
movl 24(%esp),%edi
|
||||
movl 28(%esp),%eax
|
||||
movl %esp,%ebx
|
||||
call .L000pic_point
|
||||
.L000pic_point:
|
||||
popl %ebp
|
||||
leal .L001K512-.L000pic_point(%ebp),%ebp
|
||||
subl $16,%esp
|
||||
andl $-64,%esp
|
||||
shll $7,%eax
|
||||
addl %edi,%eax
|
||||
movl %esi,(%esp)
|
||||
movl %edi,4(%esp)
|
||||
movl %eax,8(%esp)
|
||||
movl %ebx,12(%esp)
|
||||
.align 16
|
||||
.L002loop_x86:
|
||||
movl (%edi),%eax
|
||||
movl 4(%edi),%ebx
|
||||
movl 8(%edi),%ecx
|
||||
movl 12(%edi),%edx
|
||||
bswap %eax
|
||||
bswap %ebx
|
||||
bswap %ecx
|
||||
bswap %edx
|
||||
pushl %eax
|
||||
pushl %ebx
|
||||
pushl %ecx
|
||||
pushl %edx
|
||||
movl 16(%edi),%eax
|
||||
movl 20(%edi),%ebx
|
||||
movl 24(%edi),%ecx
|
||||
movl 28(%edi),%edx
|
||||
bswap %eax
|
||||
bswap %ebx
|
||||
bswap %ecx
|
||||
bswap %edx
|
||||
pushl %eax
|
||||
pushl %ebx
|
||||
pushl %ecx
|
||||
pushl %edx
|
||||
movl 32(%edi),%eax
|
||||
movl 36(%edi),%ebx
|
||||
movl 40(%edi),%ecx
|
||||
movl 44(%edi),%edx
|
||||
bswap %eax
|
||||
bswap %ebx
|
||||
bswap %ecx
|
||||
bswap %edx
|
||||
pushl %eax
|
||||
pushl %ebx
|
||||
pushl %ecx
|
||||
pushl %edx
|
||||
movl 48(%edi),%eax
|
||||
movl 52(%edi),%ebx
|
||||
movl 56(%edi),%ecx
|
||||
movl 60(%edi),%edx
|
||||
bswap %eax
|
||||
bswap %ebx
|
||||
bswap %ecx
|
||||
bswap %edx
|
||||
pushl %eax
|
||||
pushl %ebx
|
||||
pushl %ecx
|
||||
pushl %edx
|
||||
movl 64(%edi),%eax
|
||||
movl 68(%edi),%ebx
|
||||
movl 72(%edi),%ecx
|
||||
movl 76(%edi),%edx
|
||||
bswap %eax
|
||||
bswap %ebx
|
||||
bswap %ecx
|
||||
bswap %edx
|
||||
pushl %eax
|
||||
pushl %ebx
|
||||
pushl %ecx
|
||||
pushl %edx
|
||||
movl 80(%edi),%eax
|
||||
movl 84(%edi),%ebx
|
||||
movl 88(%edi),%ecx
|
||||
movl 92(%edi),%edx
|
||||
bswap %eax
|
||||
bswap %ebx
|
||||
bswap %ecx
|
||||
bswap %edx
|
||||
pushl %eax
|
||||
pushl %ebx
|
||||
pushl %ecx
|
||||
pushl %edx
|
||||
movl 96(%edi),%eax
|
||||
movl 100(%edi),%ebx
|
||||
movl 104(%edi),%ecx
|
||||
movl 108(%edi),%edx
|
||||
bswap %eax
|
||||
bswap %ebx
|
||||
bswap %ecx
|
||||
bswap %edx
|
||||
pushl %eax
|
||||
pushl %ebx
|
||||
pushl %ecx
|
||||
pushl %edx
|
||||
movl 112(%edi),%eax
|
||||
movl 116(%edi),%ebx
|
||||
movl 120(%edi),%ecx
|
||||
movl 124(%edi),%edx
|
||||
bswap %eax
|
||||
bswap %ebx
|
||||
bswap %ecx
|
||||
bswap %edx
|
||||
pushl %eax
|
||||
pushl %ebx
|
||||
pushl %ecx
|
||||
pushl %edx
|
||||
addl $128,%edi
|
||||
subl $72,%esp
|
||||
movl %edi,204(%esp)
|
||||
leal 8(%esp),%edi
|
||||
movl $16,%ecx
|
||||
.long 2784229001
|
||||
.align 16
|
||||
.L00300_15_x86:
|
||||
movl 40(%esp),%ecx
|
||||
movl 44(%esp),%edx
|
||||
movl %ecx,%esi
|
||||
shrl $9,%ecx
|
||||
movl %edx,%edi
|
||||
shrl $9,%edx
|
||||
movl %ecx,%ebx
|
||||
shll $14,%esi
|
||||
movl %edx,%eax
|
||||
shll $14,%edi
|
||||
xorl %esi,%ebx
|
||||
shrl $5,%ecx
|
||||
xorl %edi,%eax
|
||||
shrl $5,%edx
|
||||
xorl %ecx,%eax
|
||||
shll $4,%esi
|
||||
xorl %edx,%ebx
|
||||
shll $4,%edi
|
||||
xorl %esi,%ebx
|
||||
shrl $4,%ecx
|
||||
xorl %edi,%eax
|
||||
shrl $4,%edx
|
||||
xorl %ecx,%eax
|
||||
shll $5,%esi
|
||||
xorl %edx,%ebx
|
||||
shll $5,%edi
|
||||
xorl %esi,%eax
|
||||
xorl %edi,%ebx
|
||||
movl 48(%esp),%ecx
|
||||
movl 52(%esp),%edx
|
||||
movl 56(%esp),%esi
|
||||
movl 60(%esp),%edi
|
||||
addl 64(%esp),%eax
|
||||
adcl 68(%esp),%ebx
|
||||
xorl %esi,%ecx
|
||||
xorl %edi,%edx
|
||||
andl 40(%esp),%ecx
|
||||
andl 44(%esp),%edx
|
||||
addl 192(%esp),%eax
|
||||
adcl 196(%esp),%ebx
|
||||
xorl %esi,%ecx
|
||||
xorl %edi,%edx
|
||||
movl (%ebp),%esi
|
||||
movl 4(%ebp),%edi
|
||||
addl %ecx,%eax
|
||||
adcl %edx,%ebx
|
||||
movl 32(%esp),%ecx
|
||||
movl 36(%esp),%edx
|
||||
addl %esi,%eax
|
||||
adcl %edi,%ebx
|
||||
movl %eax,(%esp)
|
||||
movl %ebx,4(%esp)
|
||||
addl %ecx,%eax
|
||||
adcl %edx,%ebx
|
||||
movl 8(%esp),%ecx
|
||||
movl 12(%esp),%edx
|
||||
movl %eax,32(%esp)
|
||||
movl %ebx,36(%esp)
|
||||
movl %ecx,%esi
|
||||
shrl $2,%ecx
|
||||
movl %edx,%edi
|
||||
shrl $2,%edx
|
||||
movl %ecx,%ebx
|
||||
shll $4,%esi
|
||||
movl %edx,%eax
|
||||
shll $4,%edi
|
||||
xorl %esi,%ebx
|
||||
shrl $5,%ecx
|
||||
xorl %edi,%eax
|
||||
shrl $5,%edx
|
||||
xorl %ecx,%ebx
|
||||
shll $21,%esi
|
||||
xorl %edx,%eax
|
||||
shll $21,%edi
|
||||
xorl %esi,%eax
|
||||
shrl $21,%ecx
|
||||
xorl %edi,%ebx
|
||||
shrl $21,%edx
|
||||
xorl %ecx,%eax
|
||||
shll $5,%esi
|
||||
xorl %edx,%ebx
|
||||
shll $5,%edi
|
||||
xorl %esi,%eax
|
||||
xorl %edi,%ebx
|
||||
movl 8(%esp),%ecx
|
||||
movl 12(%esp),%edx
|
||||
movl 16(%esp),%esi
|
||||
movl 20(%esp),%edi
|
||||
addl (%esp),%eax
|
||||
adcl 4(%esp),%ebx
|
||||
orl %esi,%ecx
|
||||
orl %edi,%edx
|
||||
andl 24(%esp),%ecx
|
||||
andl 28(%esp),%edx
|
||||
andl 8(%esp),%esi
|
||||
andl 12(%esp),%edi
|
||||
orl %esi,%ecx
|
||||
orl %edi,%edx
|
||||
addl %ecx,%eax
|
||||
adcl %edx,%ebx
|
||||
movl %eax,(%esp)
|
||||
movl %ebx,4(%esp)
|
||||
movb (%ebp),%dl
|
||||
subl $8,%esp
|
||||
leal 8(%ebp),%ebp
|
||||
cmpb $148,%dl
|
||||
jne .L00300_15_x86
|
||||
.align 16
|
||||
.L00416_79_x86:
|
||||
movl 312(%esp),%ecx
|
||||
movl 316(%esp),%edx
|
||||
movl %ecx,%esi
|
||||
shrl $1,%ecx
|
||||
movl %edx,%edi
|
||||
shrl $1,%edx
|
||||
movl %ecx,%eax
|
||||
shll $24,%esi
|
||||
movl %edx,%ebx
|
||||
shll $24,%edi
|
||||
xorl %esi,%ebx
|
||||
shrl $6,%ecx
|
||||
xorl %edi,%eax
|
||||
shrl $6,%edx
|
||||
xorl %ecx,%eax
|
||||
shll $7,%esi
|
||||
xorl %edx,%ebx
|
||||
shll $1,%edi
|
||||
xorl %esi,%ebx
|
||||
shrl $1,%ecx
|
||||
xorl %edi,%eax
|
||||
shrl $1,%edx
|
||||
xorl %ecx,%eax
|
||||
shll $6,%edi
|
||||
xorl %edx,%ebx
|
||||
xorl %edi,%eax
|
||||
movl %eax,(%esp)
|
||||
movl %ebx,4(%esp)
|
||||
movl 208(%esp),%ecx
|
||||
movl 212(%esp),%edx
|
||||
movl %ecx,%esi
|
||||
shrl $6,%ecx
|
||||
movl %edx,%edi
|
||||
shrl $6,%edx
|
||||
movl %ecx,%eax
|
||||
shll $3,%esi
|
||||
movl %edx,%ebx
|
||||
shll $3,%edi
|
||||
xorl %esi,%eax
|
||||
shrl $13,%ecx
|
||||
xorl %edi,%ebx
|
||||
shrl $13,%edx
|
||||
xorl %ecx,%eax
|
||||
shll $10,%esi
|
||||
xorl %edx,%ebx
|
||||
shll $10,%edi
|
||||
xorl %esi,%ebx
|
||||
shrl $10,%ecx
|
||||
xorl %edi,%eax
|
||||
shrl $10,%edx
|
||||
xorl %ecx,%ebx
|
||||
shll $13,%edi
|
||||
xorl %edx,%eax
|
||||
xorl %edi,%eax
|
||||
movl 320(%esp),%ecx
|
||||
movl 324(%esp),%edx
|
||||
addl (%esp),%eax
|
||||
adcl 4(%esp),%ebx
|
||||
movl 248(%esp),%esi
|
||||
movl 252(%esp),%edi
|
||||
addl %ecx,%eax
|
||||
adcl %edx,%ebx
|
||||
addl %esi,%eax
|
||||
adcl %edi,%ebx
|
||||
movl %eax,192(%esp)
|
||||
movl %ebx,196(%esp)
|
||||
movl 40(%esp),%ecx
|
||||
movl 44(%esp),%edx
|
||||
movl %ecx,%esi
|
||||
shrl $9,%ecx
|
||||
movl %edx,%edi
|
||||
shrl $9,%edx
|
||||
movl %ecx,%ebx
|
||||
shll $14,%esi
|
||||
movl %edx,%eax
|
||||
shll $14,%edi
|
||||
xorl %esi,%ebx
|
||||
shrl $5,%ecx
|
||||
xorl %edi,%eax
|
||||
shrl $5,%edx
|
||||
xorl %ecx,%eax
|
||||
shll $4,%esi
|
||||
xorl %edx,%ebx
|
||||
shll $4,%edi
|
||||
xorl %esi,%ebx
|
||||
shrl $4,%ecx
|
||||
xorl %edi,%eax
|
||||
shrl $4,%edx
|
||||
xorl %ecx,%eax
|
||||
shll $5,%esi
|
||||
xorl %edx,%ebx
|
||||
shll $5,%edi
|
||||
xorl %esi,%eax
|
||||
xorl %edi,%ebx
|
||||
movl 48(%esp),%ecx
|
||||
movl 52(%esp),%edx
|
||||
movl 56(%esp),%esi
|
||||
movl 60(%esp),%edi
|
||||
addl 64(%esp),%eax
|
||||
adcl 68(%esp),%ebx
|
||||
xorl %esi,%ecx
|
||||
xorl %edi,%edx
|
||||
andl 40(%esp),%ecx
|
||||
andl 44(%esp),%edx
|
||||
addl 192(%esp),%eax
|
||||
adcl 196(%esp),%ebx
|
||||
xorl %esi,%ecx
|
||||
xorl %edi,%edx
|
||||
movl (%ebp),%esi
|
||||
movl 4(%ebp),%edi
|
||||
addl %ecx,%eax
|
||||
adcl %edx,%ebx
|
||||
movl 32(%esp),%ecx
|
||||
movl 36(%esp),%edx
|
||||
addl %esi,%eax
|
||||
adcl %edi,%ebx
|
||||
movl %eax,(%esp)
|
||||
movl %ebx,4(%esp)
|
||||
addl %ecx,%eax
|
||||
adcl %edx,%ebx
|
||||
movl 8(%esp),%ecx
|
||||
movl 12(%esp),%edx
|
||||
movl %eax,32(%esp)
|
||||
movl %ebx,36(%esp)
|
||||
movl %ecx,%esi
|
||||
shrl $2,%ecx
|
||||
movl %edx,%edi
|
||||
shrl $2,%edx
|
||||
movl %ecx,%ebx
|
||||
shll $4,%esi
|
||||
movl %edx,%eax
|
||||
shll $4,%edi
|
||||
xorl %esi,%ebx
|
||||
shrl $5,%ecx
|
||||
xorl %edi,%eax
|
||||
shrl $5,%edx
|
||||
xorl %ecx,%ebx
|
||||
shll $21,%esi
|
||||
xorl %edx,%eax
|
||||
shll $21,%edi
|
||||
xorl %esi,%eax
|
||||
shrl $21,%ecx
|
||||
xorl %edi,%ebx
|
||||
shrl $21,%edx
|
||||
xorl %ecx,%eax
|
||||
shll $5,%esi
|
||||
xorl %edx,%ebx
|
||||
shll $5,%edi
|
||||
xorl %esi,%eax
|
||||
xorl %edi,%ebx
|
||||
movl 8(%esp),%ecx
|
||||
movl 12(%esp),%edx
|
||||
movl 16(%esp),%esi
|
||||
movl 20(%esp),%edi
|
||||
addl (%esp),%eax
|
||||
adcl 4(%esp),%ebx
|
||||
orl %esi,%ecx
|
||||
orl %edi,%edx
|
||||
andl 24(%esp),%ecx
|
||||
andl 28(%esp),%edx
|
||||
andl 8(%esp),%esi
|
||||
andl 12(%esp),%edi
|
||||
orl %esi,%ecx
|
||||
orl %edi,%edx
|
||||
addl %ecx,%eax
|
||||
adcl %edx,%ebx
|
||||
movl %eax,(%esp)
|
||||
movl %ebx,4(%esp)
|
||||
movb (%ebp),%dl
|
||||
subl $8,%esp
|
||||
leal 8(%ebp),%ebp
|
||||
cmpb $23,%dl
|
||||
jne .L00416_79_x86
|
||||
movl 840(%esp),%esi
|
||||
movl 844(%esp),%edi
|
||||
movl (%esi),%eax
|
||||
movl 4(%esi),%ebx
|
||||
movl 8(%esi),%ecx
|
||||
movl 12(%esi),%edx
|
||||
addl 8(%esp),%eax
|
||||
adcl 12(%esp),%ebx
|
||||
movl %eax,(%esi)
|
||||
movl %ebx,4(%esi)
|
||||
addl 16(%esp),%ecx
|
||||
adcl 20(%esp),%edx
|
||||
movl %ecx,8(%esi)
|
||||
movl %edx,12(%esi)
|
||||
movl 16(%esi),%eax
|
||||
movl 20(%esi),%ebx
|
||||
movl 24(%esi),%ecx
|
||||
movl 28(%esi),%edx
|
||||
addl 24(%esp),%eax
|
||||
adcl 28(%esp),%ebx
|
||||
movl %eax,16(%esi)
|
||||
movl %ebx,20(%esi)
|
||||
addl 32(%esp),%ecx
|
||||
adcl 36(%esp),%edx
|
||||
movl %ecx,24(%esi)
|
||||
movl %edx,28(%esi)
|
||||
movl 32(%esi),%eax
|
||||
movl 36(%esi),%ebx
|
||||
movl 40(%esi),%ecx
|
||||
movl 44(%esi),%edx
|
||||
addl 40(%esp),%eax
|
||||
adcl 44(%esp),%ebx
|
||||
movl %eax,32(%esi)
|
||||
movl %ebx,36(%esi)
|
||||
addl 48(%esp),%ecx
|
||||
adcl 52(%esp),%edx
|
||||
movl %ecx,40(%esi)
|
||||
movl %edx,44(%esi)
|
||||
movl 48(%esi),%eax
|
||||
movl 52(%esi),%ebx
|
||||
movl 56(%esi),%ecx
|
||||
movl 60(%esi),%edx
|
||||
addl 56(%esp),%eax
|
||||
adcl 60(%esp),%ebx
|
||||
movl %eax,48(%esi)
|
||||
movl %ebx,52(%esi)
|
||||
addl 64(%esp),%ecx
|
||||
adcl 68(%esp),%edx
|
||||
movl %ecx,56(%esi)
|
||||
movl %edx,60(%esi)
|
||||
addl $840,%esp
|
||||
subl $640,%ebp
|
||||
cmpl 8(%esp),%edi
|
||||
jb .L002loop_x86
|
||||
movl 12(%esp),%esp
|
||||
popl %edi
|
||||
popl %esi
|
||||
popl %ebx
|
||||
popl %ebp
|
||||
ret
|
||||
.align 64
|
||||
.L001K512:
|
||||
.long 3609767458,1116352408
|
||||
.long 602891725,1899447441
|
||||
.long 3964484399,3049323471
|
||||
.long 2173295548,3921009573
|
||||
.long 4081628472,961987163
|
||||
.long 3053834265,1508970993
|
||||
.long 2937671579,2453635748
|
||||
.long 3664609560,2870763221
|
||||
.long 2734883394,3624381080
|
||||
.long 1164996542,310598401
|
||||
.long 1323610764,607225278
|
||||
.long 3590304994,1426881987
|
||||
.long 4068182383,1925078388
|
||||
.long 991336113,2162078206
|
||||
.long 633803317,2614888103
|
||||
.long 3479774868,3248222580
|
||||
.long 2666613458,3835390401
|
||||
.long 944711139,4022224774
|
||||
.long 2341262773,264347078
|
||||
.long 2007800933,604807628
|
||||
.long 1495990901,770255983
|
||||
.long 1856431235,1249150122
|
||||
.long 3175218132,1555081692
|
||||
.long 2198950837,1996064986
|
||||
.long 3999719339,2554220882
|
||||
.long 766784016,2821834349
|
||||
.long 2566594879,2952996808
|
||||
.long 3203337956,3210313671
|
||||
.long 1034457026,3336571891
|
||||
.long 2466948901,3584528711
|
||||
.long 3758326383,113926993
|
||||
.long 168717936,338241895
|
||||
.long 1188179964,666307205
|
||||
.long 1546045734,773529912
|
||||
.long 1522805485,1294757372
|
||||
.long 2643833823,1396182291
|
||||
.long 2343527390,1695183700
|
||||
.long 1014477480,1986661051
|
||||
.long 1206759142,2177026350
|
||||
.long 344077627,2456956037
|
||||
.long 1290863460,2730485921
|
||||
.long 3158454273,2820302411
|
||||
.long 3505952657,3259730800
|
||||
.long 106217008,3345764771
|
||||
.long 3606008344,3516065817
|
||||
.long 1432725776,3600352804
|
||||
.long 1467031594,4094571909
|
||||
.long 851169720,275423344
|
||||
.long 3100823752,430227734
|
||||
.long 1363258195,506948616
|
||||
.long 3750685593,659060556
|
||||
.long 3785050280,883997877
|
||||
.long 3318307427,958139571
|
||||
.long 3812723403,1322822218
|
||||
.long 2003034995,1537002063
|
||||
.long 3602036899,1747873779
|
||||
.long 1575990012,1955562222
|
||||
.long 1125592928,2024104815
|
||||
.long 2716904306,2227730452
|
||||
.long 442776044,2361852424
|
||||
.long 593698344,2428436474
|
||||
.long 3733110249,2756734187
|
||||
.long 2999351573,3204031479
|
||||
.long 3815920427,3329325298
|
||||
.long 3928383900,3391569614
|
||||
.long 566280711,3515267271
|
||||
.long 3454069534,3940187606
|
||||
.long 4000239992,4118630271
|
||||
.long 1914138554,116418474
|
||||
.long 2731055270,174292421
|
||||
.long 3203993006,289380356
|
||||
.long 320620315,460393269
|
||||
.long 587496836,685471733
|
||||
.long 1086792851,852142971
|
||||
.long 365543100,1017036298
|
||||
.long 2618297676,1126000580
|
||||
.long 3409855158,1288033470
|
||||
.long 4234509866,1501505948
|
||||
.long 987167468,1607167915
|
||||
.long 1246189591,1816402316
|
||||
.long 67438087,66051
|
||||
.long 202182159,134810123
|
||||
.byte 83,72,65,53,49,50,32,98,108,111,99,107,32,116,114,97
|
||||
.byte 110,115,102,111,114,109,32,102,111,114,32,120,56,54,44,32
|
||||
.byte 67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97
|
||||
.byte 112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103
|
||||
.byte 62,0
|
||||
#endif
|
||||
#endif // defined(__i386__) && defined(_WIN32)
|
||||
#if defined(__linux__) && defined(__ELF__)
|
||||
.section .note.GNU-stack,"",%progbits
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,701 @@
|
||||
#define BORINGSSL_PREFIX CCryptoBoringSSL
|
||||
#if defined(__i386__) && defined(_WIN32)
|
||||
# This file is generated from a similarly-named Perl script in the BoringSSL
|
||||
# source tree. Do not edit by hand.
|
||||
|
||||
#if defined(__i386__)
|
||||
#if defined(BORINGSSL_PREFIX)
|
||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||
#endif
|
||||
.text
|
||||
#ifdef BORINGSSL_DISPATCH_TEST
|
||||
#endif
|
||||
.align 64
|
||||
.L_vpaes_consts:
|
||||
.long 218628480,235210255,168496130,67568393
|
||||
.long 252381056,17041926,33884169,51187212
|
||||
.long 252645135,252645135,252645135,252645135
|
||||
.long 1512730624,3266504856,1377990664,3401244816
|
||||
.long 830229760,1275146365,2969422977,3447763452
|
||||
.long 3411033600,2979783055,338359620,2782886510
|
||||
.long 4209124096,907596821,221174255,1006095553
|
||||
.long 191964160,3799684038,3164090317,1589111125
|
||||
.long 182528256,1777043520,2877432650,3265356744
|
||||
.long 1874708224,3503451415,3305285752,363511674
|
||||
.long 1606117888,3487855781,1093350906,2384367825
|
||||
.long 197121,67569157,134941193,202313229
|
||||
.long 67569157,134941193,202313229,197121
|
||||
.long 134941193,202313229,197121,67569157
|
||||
.long 202313229,197121,67569157,134941193
|
||||
.long 33619971,100992007,168364043,235736079
|
||||
.long 235736079,33619971,100992007,168364043
|
||||
.long 168364043,235736079,33619971,100992007
|
||||
.long 100992007,168364043,235736079,33619971
|
||||
.long 50462976,117835012,185207048,252579084
|
||||
.long 252314880,51251460,117574920,184942860
|
||||
.long 184682752,252054788,50987272,118359308
|
||||
.long 118099200,185467140,251790600,50727180
|
||||
.long 2946363062,528716217,1300004225,1881839624
|
||||
.long 1532713819,1532713819,1532713819,1532713819
|
||||
.long 3602276352,4288629033,3737020424,4153884961
|
||||
.long 1354558464,32357713,2958822624,3775749553
|
||||
.long 1201988352,132424512,1572796698,503232858
|
||||
.long 2213177600,1597421020,4103937655,675398315
|
||||
.long 2749646592,4273543773,1511898873,121693092
|
||||
.long 3040248576,1103263732,2871565598,1608280554
|
||||
.long 2236667136,2588920351,482954393,64377734
|
||||
.long 3069987328,291237287,2117370568,3650299247
|
||||
.long 533321216,3573750986,2572112006,1401264716
|
||||
.long 1339849704,2721158661,548607111,3445553514
|
||||
.long 2128193280,3054596040,2183486460,1257083700
|
||||
.long 655635200,1165381986,3923443150,2344132524
|
||||
.long 190078720,256924420,290342170,357187870
|
||||
.long 1610966272,2263057382,4103205268,309794674
|
||||
.long 2592527872,2233205587,1335446729,3402964816
|
||||
.long 3973531904,3225098121,3002836325,1918774430
|
||||
.long 3870401024,2102906079,2284471353,4117666579
|
||||
.long 617007872,1021508343,366931923,691083277
|
||||
.long 2528395776,3491914898,2968704004,1613121270
|
||||
.long 3445188352,3247741094,844474987,4093578302
|
||||
.long 651481088,1190302358,1689581232,574775300
|
||||
.long 4289380608,206939853,2555985458,2489840491
|
||||
.long 2130264064,327674451,3566485037,3349835193
|
||||
.long 2470714624,316102159,3636825756,3393945945
|
||||
.byte 86,101,99,116,111,114,32,80,101,114,109,117,116,97,116,105
|
||||
.byte 111,110,32,65,69,83,32,102,111,114,32,120,56,54,47,83
|
||||
.byte 83,83,69,51,44,32,77,105,107,101,32,72,97,109,98,117
|
||||
.byte 114,103,32,40,83,116,97,110,102,111,114,100,32,85,110,105
|
||||
.byte 118,101,114,115,105,116,121,41,0
|
||||
.align 64
|
||||
.hidden __vpaes_preheat
|
||||
.def __vpaes_preheat; .scl 3; .type 32; .endef
|
||||
.align 16
|
||||
__vpaes_preheat:
|
||||
addl (%esp),%ebp
|
||||
movdqa -48(%ebp),%xmm7
|
||||
movdqa -16(%ebp),%xmm6
|
||||
ret
|
||||
.hidden __vpaes_encrypt_core
|
||||
.def __vpaes_encrypt_core; .scl 3; .type 32; .endef
|
||||
.align 16
|
||||
__vpaes_encrypt_core:
|
||||
movl $16,%ecx
|
||||
movl 240(%edx),%eax
|
||||
movdqa %xmm6,%xmm1
|
||||
movdqa (%ebp),%xmm2
|
||||
pandn %xmm0,%xmm1
|
||||
pand %xmm6,%xmm0
|
||||
movdqu (%edx),%xmm5
|
||||
.byte 102,15,56,0,208
|
||||
movdqa 16(%ebp),%xmm0
|
||||
pxor %xmm5,%xmm2
|
||||
psrld $4,%xmm1
|
||||
addl $16,%edx
|
||||
.byte 102,15,56,0,193
|
||||
leal 192(%ebp),%ebx
|
||||
pxor %xmm2,%xmm0
|
||||
jmp .L000enc_entry
|
||||
.align 16
|
||||
.L001enc_loop:
|
||||
movdqa 32(%ebp),%xmm4
|
||||
movdqa 48(%ebp),%xmm0
|
||||
.byte 102,15,56,0,226
|
||||
.byte 102,15,56,0,195
|
||||
pxor %xmm5,%xmm4
|
||||
movdqa 64(%ebp),%xmm5
|
||||
pxor %xmm4,%xmm0
|
||||
movdqa -64(%ebx,%ecx,1),%xmm1
|
||||
.byte 102,15,56,0,234
|
||||
movdqa 80(%ebp),%xmm2
|
||||
movdqa (%ebx,%ecx,1),%xmm4
|
||||
.byte 102,15,56,0,211
|
||||
movdqa %xmm0,%xmm3
|
||||
pxor %xmm5,%xmm2
|
||||
.byte 102,15,56,0,193
|
||||
addl $16,%edx
|
||||
pxor %xmm2,%xmm0
|
||||
.byte 102,15,56,0,220
|
||||
addl $16,%ecx
|
||||
pxor %xmm0,%xmm3
|
||||
.byte 102,15,56,0,193
|
||||
andl $48,%ecx
|
||||
subl $1,%eax
|
||||
pxor %xmm3,%xmm0
|
||||
.L000enc_entry:
|
||||
movdqa %xmm6,%xmm1
|
||||
movdqa -32(%ebp),%xmm5
|
||||
pandn %xmm0,%xmm1
|
||||
psrld $4,%xmm1
|
||||
pand %xmm6,%xmm0
|
||||
.byte 102,15,56,0,232
|
||||
movdqa %xmm7,%xmm3
|
||||
pxor %xmm1,%xmm0
|
||||
.byte 102,15,56,0,217
|
||||
movdqa %xmm7,%xmm4
|
||||
pxor %xmm5,%xmm3
|
||||
.byte 102,15,56,0,224
|
||||
movdqa %xmm7,%xmm2
|
||||
pxor %xmm5,%xmm4
|
||||
.byte 102,15,56,0,211
|
||||
movdqa %xmm7,%xmm3
|
||||
pxor %xmm0,%xmm2
|
||||
.byte 102,15,56,0,220
|
||||
movdqu (%edx),%xmm5
|
||||
pxor %xmm1,%xmm3
|
||||
jnz .L001enc_loop
|
||||
movdqa 96(%ebp),%xmm4
|
||||
movdqa 112(%ebp),%xmm0
|
||||
.byte 102,15,56,0,226
|
||||
pxor %xmm5,%xmm4
|
||||
.byte 102,15,56,0,195
|
||||
movdqa 64(%ebx,%ecx,1),%xmm1
|
||||
pxor %xmm4,%xmm0
|
||||
.byte 102,15,56,0,193
|
||||
ret
|
||||
.hidden __vpaes_decrypt_core
|
||||
.def __vpaes_decrypt_core; .scl 3; .type 32; .endef
|
||||
.align 16
|
||||
__vpaes_decrypt_core:
|
||||
leal 608(%ebp),%ebx
|
||||
movl 240(%edx),%eax
|
||||
movdqa %xmm6,%xmm1
|
||||
movdqa -64(%ebx),%xmm2
|
||||
pandn %xmm0,%xmm1
|
||||
movl %eax,%ecx
|
||||
psrld $4,%xmm1
|
||||
movdqu (%edx),%xmm5
|
||||
shll $4,%ecx
|
||||
pand %xmm6,%xmm0
|
||||
.byte 102,15,56,0,208
|
||||
movdqa -48(%ebx),%xmm0
|
||||
xorl $48,%ecx
|
||||
.byte 102,15,56,0,193
|
||||
andl $48,%ecx
|
||||
pxor %xmm5,%xmm2
|
||||
movdqa 176(%ebp),%xmm5
|
||||
pxor %xmm2,%xmm0
|
||||
addl $16,%edx
|
||||
leal -352(%ebx,%ecx,1),%ecx
|
||||
jmp .L002dec_entry
|
||||
.align 16
|
||||
.L003dec_loop:
|
||||
movdqa -32(%ebx),%xmm4
|
||||
movdqa -16(%ebx),%xmm1
|
||||
.byte 102,15,56,0,226
|
||||
.byte 102,15,56,0,203
|
||||
pxor %xmm4,%xmm0
|
||||
movdqa (%ebx),%xmm4
|
||||
pxor %xmm1,%xmm0
|
||||
movdqa 16(%ebx),%xmm1
|
||||
.byte 102,15,56,0,226
|
||||
.byte 102,15,56,0,197
|
||||
.byte 102,15,56,0,203
|
||||
pxor %xmm4,%xmm0
|
||||
movdqa 32(%ebx),%xmm4
|
||||
pxor %xmm1,%xmm0
|
||||
movdqa 48(%ebx),%xmm1
|
||||
.byte 102,15,56,0,226
|
||||
.byte 102,15,56,0,197
|
||||
.byte 102,15,56,0,203
|
||||
pxor %xmm4,%xmm0
|
||||
movdqa 64(%ebx),%xmm4
|
||||
pxor %xmm1,%xmm0
|
||||
movdqa 80(%ebx),%xmm1
|
||||
.byte 102,15,56,0,226
|
||||
.byte 102,15,56,0,197
|
||||
.byte 102,15,56,0,203
|
||||
pxor %xmm4,%xmm0
|
||||
addl $16,%edx
|
||||
.byte 102,15,58,15,237,12
|
||||
pxor %xmm1,%xmm0
|
||||
subl $1,%eax
|
||||
.L002dec_entry:
|
||||
movdqa %xmm6,%xmm1
|
||||
movdqa -32(%ebp),%xmm2
|
||||
pandn %xmm0,%xmm1
|
||||
pand %xmm6,%xmm0
|
||||
psrld $4,%xmm1
|
||||
.byte 102,15,56,0,208
|
||||
movdqa %xmm7,%xmm3
|
||||
pxor %xmm1,%xmm0
|
||||
.byte 102,15,56,0,217
|
||||
movdqa %xmm7,%xmm4
|
||||
pxor %xmm2,%xmm3
|
||||
.byte 102,15,56,0,224
|
||||
pxor %xmm2,%xmm4
|
||||
movdqa %xmm7,%xmm2
|
||||
.byte 102,15,56,0,211
|
||||
movdqa %xmm7,%xmm3
|
||||
pxor %xmm0,%xmm2
|
||||
.byte 102,15,56,0,220
|
||||
movdqu (%edx),%xmm0
|
||||
pxor %xmm1,%xmm3
|
||||
jnz .L003dec_loop
|
||||
movdqa 96(%ebx),%xmm4
|
||||
.byte 102,15,56,0,226
|
||||
pxor %xmm0,%xmm4
|
||||
movdqa 112(%ebx),%xmm0
|
||||
movdqa (%ecx),%xmm2
|
||||
.byte 102,15,56,0,195
|
||||
pxor %xmm4,%xmm0
|
||||
.byte 102,15,56,0,194
|
||||
ret
|
||||
.hidden __vpaes_schedule_core
|
||||
.def __vpaes_schedule_core; .scl 3; .type 32; .endef
|
||||
.align 16
|
||||
__vpaes_schedule_core:
|
||||
addl (%esp),%ebp
|
||||
movdqu (%esi),%xmm0
|
||||
movdqa 320(%ebp),%xmm2
|
||||
movdqa %xmm0,%xmm3
|
||||
leal (%ebp),%ebx
|
||||
movdqa %xmm2,4(%esp)
|
||||
call __vpaes_schedule_transform
|
||||
movdqa %xmm0,%xmm7
|
||||
testl %edi,%edi
|
||||
jnz .L004schedule_am_decrypting
|
||||
movdqu %xmm0,(%edx)
|
||||
jmp .L005schedule_go
|
||||
.L004schedule_am_decrypting:
|
||||
movdqa 256(%ebp,%ecx,1),%xmm1
|
||||
.byte 102,15,56,0,217
|
||||
movdqu %xmm3,(%edx)
|
||||
xorl $48,%ecx
|
||||
.L005schedule_go:
|
||||
cmpl $192,%eax
|
||||
ja .L006schedule_256
|
||||
je .L007schedule_192
|
||||
.L008schedule_128:
|
||||
movl $10,%eax
|
||||
.L009loop_schedule_128:
|
||||
call __vpaes_schedule_round
|
||||
decl %eax
|
||||
jz .L010schedule_mangle_last
|
||||
call __vpaes_schedule_mangle
|
||||
jmp .L009loop_schedule_128
|
||||
.align 16
|
||||
.L007schedule_192:
|
||||
movdqu 8(%esi),%xmm0
|
||||
call __vpaes_schedule_transform
|
||||
movdqa %xmm0,%xmm6
|
||||
pxor %xmm4,%xmm4
|
||||
movhlps %xmm4,%xmm6
|
||||
movl $4,%eax
|
||||
.L011loop_schedule_192:
|
||||
call __vpaes_schedule_round
|
||||
.byte 102,15,58,15,198,8
|
||||
call __vpaes_schedule_mangle
|
||||
call __vpaes_schedule_192_smear
|
||||
call __vpaes_schedule_mangle
|
||||
call __vpaes_schedule_round
|
||||
decl %eax
|
||||
jz .L010schedule_mangle_last
|
||||
call __vpaes_schedule_mangle
|
||||
call __vpaes_schedule_192_smear
|
||||
jmp .L011loop_schedule_192
|
||||
.align 16
|
||||
.L006schedule_256:
|
||||
movdqu 16(%esi),%xmm0
|
||||
call __vpaes_schedule_transform
|
||||
movl $7,%eax
|
||||
.L012loop_schedule_256:
|
||||
call __vpaes_schedule_mangle
|
||||
movdqa %xmm0,%xmm6
|
||||
call __vpaes_schedule_round
|
||||
decl %eax
|
||||
jz .L010schedule_mangle_last
|
||||
call __vpaes_schedule_mangle
|
||||
pshufd $255,%xmm0,%xmm0
|
||||
movdqa %xmm7,20(%esp)
|
||||
movdqa %xmm6,%xmm7
|
||||
call .L_vpaes_schedule_low_round
|
||||
movdqa 20(%esp),%xmm7
|
||||
jmp .L012loop_schedule_256
|
||||
.align 16
|
||||
.L010schedule_mangle_last:
|
||||
leal 384(%ebp),%ebx
|
||||
testl %edi,%edi
|
||||
jnz .L013schedule_mangle_last_dec
|
||||
movdqa 256(%ebp,%ecx,1),%xmm1
|
||||
.byte 102,15,56,0,193
|
||||
leal 352(%ebp),%ebx
|
||||
addl $32,%edx
|
||||
.L013schedule_mangle_last_dec:
|
||||
addl $-16,%edx
|
||||
pxor 336(%ebp),%xmm0
|
||||
call __vpaes_schedule_transform
|
||||
movdqu %xmm0,(%edx)
|
||||
pxor %xmm0,%xmm0
|
||||
pxor %xmm1,%xmm1
|
||||
pxor %xmm2,%xmm2
|
||||
pxor %xmm3,%xmm3
|
||||
pxor %xmm4,%xmm4
|
||||
pxor %xmm5,%xmm5
|
||||
pxor %xmm6,%xmm6
|
||||
pxor %xmm7,%xmm7
|
||||
ret
|
||||
.hidden __vpaes_schedule_192_smear
|
||||
.def __vpaes_schedule_192_smear; .scl 3; .type 32; .endef
|
||||
.align 16
|
||||
__vpaes_schedule_192_smear:
|
||||
pshufd $128,%xmm6,%xmm1
|
||||
pshufd $254,%xmm7,%xmm0
|
||||
pxor %xmm1,%xmm6
|
||||
pxor %xmm1,%xmm1
|
||||
pxor %xmm0,%xmm6
|
||||
movdqa %xmm6,%xmm0
|
||||
movhlps %xmm1,%xmm6
|
||||
ret
|
||||
.hidden __vpaes_schedule_round
|
||||
.def __vpaes_schedule_round; .scl 3; .type 32; .endef
|
||||
.align 16
|
||||
__vpaes_schedule_round:
|
||||
movdqa 8(%esp),%xmm2
|
||||
pxor %xmm1,%xmm1
|
||||
.byte 102,15,58,15,202,15
|
||||
.byte 102,15,58,15,210,15
|
||||
pxor %xmm1,%xmm7
|
||||
pshufd $255,%xmm0,%xmm0
|
||||
.byte 102,15,58,15,192,1
|
||||
movdqa %xmm2,8(%esp)
|
||||
.L_vpaes_schedule_low_round:
|
||||
movdqa %xmm7,%xmm1
|
||||
pslldq $4,%xmm7
|
||||
pxor %xmm1,%xmm7
|
||||
movdqa %xmm7,%xmm1
|
||||
pslldq $8,%xmm7
|
||||
pxor %xmm1,%xmm7
|
||||
pxor 336(%ebp),%xmm7
|
||||
movdqa -16(%ebp),%xmm4
|
||||
movdqa -48(%ebp),%xmm5
|
||||
movdqa %xmm4,%xmm1
|
||||
pandn %xmm0,%xmm1
|
||||
psrld $4,%xmm1
|
||||
pand %xmm4,%xmm0
|
||||
movdqa -32(%ebp),%xmm2
|
||||
.byte 102,15,56,0,208
|
||||
pxor %xmm1,%xmm0
|
||||
movdqa %xmm5,%xmm3
|
||||
.byte 102,15,56,0,217
|
||||
pxor %xmm2,%xmm3
|
||||
movdqa %xmm5,%xmm4
|
||||
.byte 102,15,56,0,224
|
||||
pxor %xmm2,%xmm4
|
||||
movdqa %xmm5,%xmm2
|
||||
.byte 102,15,56,0,211
|
||||
pxor %xmm0,%xmm2
|
||||
movdqa %xmm5,%xmm3
|
||||
.byte 102,15,56,0,220
|
||||
pxor %xmm1,%xmm3
|
||||
movdqa 32(%ebp),%xmm4
|
||||
.byte 102,15,56,0,226
|
||||
movdqa 48(%ebp),%xmm0
|
||||
.byte 102,15,56,0,195
|
||||
pxor %xmm4,%xmm0
|
||||
pxor %xmm7,%xmm0
|
||||
movdqa %xmm0,%xmm7
|
||||
ret
|
||||
.hidden __vpaes_schedule_transform
|
||||
.def __vpaes_schedule_transform; .scl 3; .type 32; .endef
|
||||
.align 16
|
||||
__vpaes_schedule_transform:
|
||||
movdqa -16(%ebp),%xmm2
|
||||
movdqa %xmm2,%xmm1
|
||||
pandn %xmm0,%xmm1
|
||||
psrld $4,%xmm1
|
||||
pand %xmm2,%xmm0
|
||||
movdqa (%ebx),%xmm2
|
||||
.byte 102,15,56,0,208
|
||||
movdqa 16(%ebx),%xmm0
|
||||
.byte 102,15,56,0,193
|
||||
pxor %xmm2,%xmm0
|
||||
ret
|
||||
.hidden __vpaes_schedule_mangle
|
||||
.def __vpaes_schedule_mangle; .scl 3; .type 32; .endef
|
||||
.align 16
|
||||
__vpaes_schedule_mangle:
|
||||
movdqa %xmm0,%xmm4
|
||||
movdqa 128(%ebp),%xmm5
|
||||
testl %edi,%edi
|
||||
jnz .L014schedule_mangle_dec
|
||||
addl $16,%edx
|
||||
pxor 336(%ebp),%xmm4
|
||||
.byte 102,15,56,0,229
|
||||
movdqa %xmm4,%xmm3
|
||||
.byte 102,15,56,0,229
|
||||
pxor %xmm4,%xmm3
|
||||
.byte 102,15,56,0,229
|
||||
pxor %xmm4,%xmm3
|
||||
jmp .L015schedule_mangle_both
|
||||
.align 16
|
||||
.L014schedule_mangle_dec:
|
||||
movdqa -16(%ebp),%xmm2
|
||||
leal 416(%ebp),%esi
|
||||
movdqa %xmm2,%xmm1
|
||||
pandn %xmm4,%xmm1
|
||||
psrld $4,%xmm1
|
||||
pand %xmm2,%xmm4
|
||||
movdqa (%esi),%xmm2
|
||||
.byte 102,15,56,0,212
|
||||
movdqa 16(%esi),%xmm3
|
||||
.byte 102,15,56,0,217
|
||||
pxor %xmm2,%xmm3
|
||||
.byte 102,15,56,0,221
|
||||
movdqa 32(%esi),%xmm2
|
||||
.byte 102,15,56,0,212
|
||||
pxor %xmm3,%xmm2
|
||||
movdqa 48(%esi),%xmm3
|
||||
.byte 102,15,56,0,217
|
||||
pxor %xmm2,%xmm3
|
||||
.byte 102,15,56,0,221
|
||||
movdqa 64(%esi),%xmm2
|
||||
.byte 102,15,56,0,212
|
||||
pxor %xmm3,%xmm2
|
||||
movdqa 80(%esi),%xmm3
|
||||
.byte 102,15,56,0,217
|
||||
pxor %xmm2,%xmm3
|
||||
.byte 102,15,56,0,221
|
||||
movdqa 96(%esi),%xmm2
|
||||
.byte 102,15,56,0,212
|
||||
pxor %xmm3,%xmm2
|
||||
movdqa 112(%esi),%xmm3
|
||||
.byte 102,15,56,0,217
|
||||
pxor %xmm2,%xmm3
|
||||
addl $-16,%edx
|
||||
.L015schedule_mangle_both:
|
||||
movdqa 256(%ebp,%ecx,1),%xmm1
|
||||
.byte 102,15,56,0,217
|
||||
addl $-16,%ecx
|
||||
andl $48,%ecx
|
||||
movdqu %xmm3,(%edx)
|
||||
ret
|
||||
.globl _vpaes_set_encrypt_key
|
||||
.hidden _vpaes_set_encrypt_key
|
||||
.def _vpaes_set_encrypt_key; .scl 2; .type 32; .endef
|
||||
.align 16
|
||||
_vpaes_set_encrypt_key:
|
||||
.L_vpaes_set_encrypt_key_begin:
|
||||
pushl %ebp
|
||||
pushl %ebx
|
||||
pushl %esi
|
||||
pushl %edi
|
||||
#ifdef BORINGSSL_DISPATCH_TEST
|
||||
pushl %ebx
|
||||
pushl %edx
|
||||
call .L016pic
|
||||
.L016pic:
|
||||
popl %ebx
|
||||
leal _BORINGSSL_function_hit+5-.L016pic(%ebx),%ebx
|
||||
movl $1,%edx
|
||||
movb %dl,(%ebx)
|
||||
popl %edx
|
||||
popl %ebx
|
||||
#endif
|
||||
movl 20(%esp),%esi
|
||||
leal -56(%esp),%ebx
|
||||
movl 24(%esp),%eax
|
||||
andl $-16,%ebx
|
||||
movl 28(%esp),%edx
|
||||
xchgl %esp,%ebx
|
||||
movl %ebx,48(%esp)
|
||||
movl %eax,%ebx
|
||||
shrl $5,%ebx
|
||||
addl $5,%ebx
|
||||
movl %ebx,240(%edx)
|
||||
movl $48,%ecx
|
||||
movl $0,%edi
|
||||
leal .L_vpaes_consts+0x30-.L017pic_point,%ebp
|
||||
call __vpaes_schedule_core
|
||||
.L017pic_point:
|
||||
movl 48(%esp),%esp
|
||||
xorl %eax,%eax
|
||||
popl %edi
|
||||
popl %esi
|
||||
popl %ebx
|
||||
popl %ebp
|
||||
ret
|
||||
.globl _vpaes_set_decrypt_key
|
||||
.hidden _vpaes_set_decrypt_key
|
||||
.def _vpaes_set_decrypt_key; .scl 2; .type 32; .endef
|
||||
.align 16
|
||||
_vpaes_set_decrypt_key:
|
||||
.L_vpaes_set_decrypt_key_begin:
|
||||
pushl %ebp
|
||||
pushl %ebx
|
||||
pushl %esi
|
||||
pushl %edi
|
||||
movl 20(%esp),%esi
|
||||
leal -56(%esp),%ebx
|
||||
movl 24(%esp),%eax
|
||||
andl $-16,%ebx
|
||||
movl 28(%esp),%edx
|
||||
xchgl %esp,%ebx
|
||||
movl %ebx,48(%esp)
|
||||
movl %eax,%ebx
|
||||
shrl $5,%ebx
|
||||
addl $5,%ebx
|
||||
movl %ebx,240(%edx)
|
||||
shll $4,%ebx
|
||||
leal 16(%edx,%ebx,1),%edx
|
||||
movl $1,%edi
|
||||
movl %eax,%ecx
|
||||
shrl $1,%ecx
|
||||
andl $32,%ecx
|
||||
xorl $32,%ecx
|
||||
leal .L_vpaes_consts+0x30-.L018pic_point,%ebp
|
||||
call __vpaes_schedule_core
|
||||
.L018pic_point:
|
||||
movl 48(%esp),%esp
|
||||
xorl %eax,%eax
|
||||
popl %edi
|
||||
popl %esi
|
||||
popl %ebx
|
||||
popl %ebp
|
||||
ret
|
||||
.globl _vpaes_encrypt
|
||||
.hidden _vpaes_encrypt
|
||||
.def _vpaes_encrypt; .scl 2; .type 32; .endef
|
||||
.align 16
|
||||
_vpaes_encrypt:
|
||||
.L_vpaes_encrypt_begin:
|
||||
pushl %ebp
|
||||
pushl %ebx
|
||||
pushl %esi
|
||||
pushl %edi
|
||||
#ifdef BORINGSSL_DISPATCH_TEST
|
||||
pushl %ebx
|
||||
pushl %edx
|
||||
call .L019pic
|
||||
.L019pic:
|
||||
popl %ebx
|
||||
leal _BORINGSSL_function_hit+4-.L019pic(%ebx),%ebx
|
||||
movl $1,%edx
|
||||
movb %dl,(%ebx)
|
||||
popl %edx
|
||||
popl %ebx
|
||||
#endif
|
||||
leal .L_vpaes_consts+0x30-.L020pic_point,%ebp
|
||||
call __vpaes_preheat
|
||||
.L020pic_point:
|
||||
movl 20(%esp),%esi
|
||||
leal -56(%esp),%ebx
|
||||
movl 24(%esp),%edi
|
||||
andl $-16,%ebx
|
||||
movl 28(%esp),%edx
|
||||
xchgl %esp,%ebx
|
||||
movl %ebx,48(%esp)
|
||||
movdqu (%esi),%xmm0
|
||||
call __vpaes_encrypt_core
|
||||
movdqu %xmm0,(%edi)
|
||||
movl 48(%esp),%esp
|
||||
popl %edi
|
||||
popl %esi
|
||||
popl %ebx
|
||||
popl %ebp
|
||||
ret
|
||||
.globl _vpaes_decrypt
|
||||
.hidden _vpaes_decrypt
|
||||
.def _vpaes_decrypt; .scl 2; .type 32; .endef
|
||||
.align 16
|
||||
_vpaes_decrypt:
|
||||
.L_vpaes_decrypt_begin:
|
||||
pushl %ebp
|
||||
pushl %ebx
|
||||
pushl %esi
|
||||
pushl %edi
|
||||
leal .L_vpaes_consts+0x30-.L021pic_point,%ebp
|
||||
call __vpaes_preheat
|
||||
.L021pic_point:
|
||||
movl 20(%esp),%esi
|
||||
leal -56(%esp),%ebx
|
||||
movl 24(%esp),%edi
|
||||
andl $-16,%ebx
|
||||
movl 28(%esp),%edx
|
||||
xchgl %esp,%ebx
|
||||
movl %ebx,48(%esp)
|
||||
movdqu (%esi),%xmm0
|
||||
call __vpaes_decrypt_core
|
||||
movdqu %xmm0,(%edi)
|
||||
movl 48(%esp),%esp
|
||||
popl %edi
|
||||
popl %esi
|
||||
popl %ebx
|
||||
popl %ebp
|
||||
ret
|
||||
.globl _vpaes_cbc_encrypt
|
||||
.hidden _vpaes_cbc_encrypt
|
||||
.def _vpaes_cbc_encrypt; .scl 2; .type 32; .endef
|
||||
.align 16
|
||||
_vpaes_cbc_encrypt:
|
||||
.L_vpaes_cbc_encrypt_begin:
|
||||
pushl %ebp
|
||||
pushl %ebx
|
||||
pushl %esi
|
||||
pushl %edi
|
||||
movl 20(%esp),%esi
|
||||
movl 24(%esp),%edi
|
||||
movl 28(%esp),%eax
|
||||
movl 32(%esp),%edx
|
||||
subl $16,%eax
|
||||
jc .L022cbc_abort
|
||||
leal -56(%esp),%ebx
|
||||
movl 36(%esp),%ebp
|
||||
andl $-16,%ebx
|
||||
movl 40(%esp),%ecx
|
||||
xchgl %esp,%ebx
|
||||
movdqu (%ebp),%xmm1
|
||||
subl %esi,%edi
|
||||
movl %ebx,48(%esp)
|
||||
movl %edi,(%esp)
|
||||
movl %edx,4(%esp)
|
||||
movl %ebp,8(%esp)
|
||||
movl %eax,%edi
|
||||
leal .L_vpaes_consts+0x30-.L023pic_point,%ebp
|
||||
call __vpaes_preheat
|
||||
.L023pic_point:
|
||||
cmpl $0,%ecx
|
||||
je .L024cbc_dec_loop
|
||||
jmp .L025cbc_enc_loop
|
||||
.align 16
|
||||
.L025cbc_enc_loop:
|
||||
movdqu (%esi),%xmm0
|
||||
pxor %xmm1,%xmm0
|
||||
call __vpaes_encrypt_core
|
||||
movl (%esp),%ebx
|
||||
movl 4(%esp),%edx
|
||||
movdqa %xmm0,%xmm1
|
||||
movdqu %xmm0,(%ebx,%esi,1)
|
||||
leal 16(%esi),%esi
|
||||
subl $16,%edi
|
||||
jnc .L025cbc_enc_loop
|
||||
jmp .L026cbc_done
|
||||
.align 16
|
||||
.L024cbc_dec_loop:
|
||||
movdqu (%esi),%xmm0
|
||||
movdqa %xmm1,16(%esp)
|
||||
movdqa %xmm0,32(%esp)
|
||||
call __vpaes_decrypt_core
|
||||
movl (%esp),%ebx
|
||||
movl 4(%esp),%edx
|
||||
pxor 16(%esp),%xmm0
|
||||
movdqa 32(%esp),%xmm1
|
||||
movdqu %xmm0,(%ebx,%esi,1)
|
||||
leal 16(%esi),%esi
|
||||
subl $16,%edi
|
||||
jnc .L024cbc_dec_loop
|
||||
.L026cbc_done:
|
||||
movl 8(%esp),%ebx
|
||||
movl 48(%esp),%esp
|
||||
movdqu %xmm1,(%ebx)
|
||||
.L022cbc_abort:
|
||||
popl %edi
|
||||
popl %esi
|
||||
popl %ebx
|
||||
popl %ebp
|
||||
ret
|
||||
#endif
|
||||
#endif // defined(__i386__) && defined(_WIN32)
|
||||
#if defined(__linux__) && defined(__ELF__)
|
||||
.section .note.GNU-stack,"",%progbits
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,369 @@
|
||||
#define BORINGSSL_PREFIX CCryptoBoringSSL
|
||||
#if defined(__i386__) && defined(_WIN32)
|
||||
# This file is generated from a similarly-named Perl script in the BoringSSL
|
||||
# source tree. Do not edit by hand.
|
||||
|
||||
#if defined(__i386__)
|
||||
#if defined(BORINGSSL_PREFIX)
|
||||
#include <CCryptoBoringSSL_boringssl_prefix_symbols_asm.h>
|
||||
#endif
|
||||
.text
|
||||
.globl _bn_mul_mont
|
||||
.hidden _bn_mul_mont
|
||||
.def _bn_mul_mont; .scl 2; .type 32; .endef
|
||||
.align 16
|
||||
_bn_mul_mont:
|
||||
.L_bn_mul_mont_begin:
|
||||
pushl %ebp
|
||||
pushl %ebx
|
||||
pushl %esi
|
||||
pushl %edi
|
||||
xorl %eax,%eax
|
||||
movl 40(%esp),%edi
|
||||
cmpl $4,%edi
|
||||
jl .L000just_leave
|
||||
leal 20(%esp),%esi
|
||||
leal 24(%esp),%edx
|
||||
addl $2,%edi
|
||||
negl %edi
|
||||
leal -32(%esp,%edi,4),%ebp
|
||||
negl %edi
|
||||
movl %ebp,%eax
|
||||
subl %edx,%eax
|
||||
andl $2047,%eax
|
||||
subl %eax,%ebp
|
||||
xorl %ebp,%edx
|
||||
andl $2048,%edx
|
||||
xorl $2048,%edx
|
||||
subl %edx,%ebp
|
||||
andl $-64,%ebp
|
||||
movl %esp,%eax
|
||||
subl %ebp,%eax
|
||||
andl $-4096,%eax
|
||||
movl %esp,%edx
|
||||
leal (%ebp,%eax,1),%esp
|
||||
movl (%esp),%eax
|
||||
cmpl %ebp,%esp
|
||||
ja .L001page_walk
|
||||
jmp .L002page_walk_done
|
||||
.align 16
|
||||
.L001page_walk:
|
||||
leal -4096(%esp),%esp
|
||||
movl (%esp),%eax
|
||||
cmpl %ebp,%esp
|
||||
ja .L001page_walk
|
||||
.L002page_walk_done:
|
||||
movl (%esi),%eax
|
||||
movl 4(%esi),%ebx
|
||||
movl 8(%esi),%ecx
|
||||
movl 12(%esi),%ebp
|
||||
movl 16(%esi),%esi
|
||||
movl (%esi),%esi
|
||||
movl %eax,4(%esp)
|
||||
movl %ebx,8(%esp)
|
||||
movl %ecx,12(%esp)
|
||||
movl %ebp,16(%esp)
|
||||
movl %esi,20(%esp)
|
||||
leal -3(%edi),%ebx
|
||||
movl %edx,24(%esp)
|
||||
movl 8(%esp),%esi
|
||||
leal 1(%ebx),%ebp
|
||||
movl 12(%esp),%edi
|
||||
xorl %ecx,%ecx
|
||||
movl %esi,%edx
|
||||
andl $1,%ebp
|
||||
subl %edi,%edx
|
||||
leal 4(%edi,%ebx,4),%eax
|
||||
orl %edx,%ebp
|
||||
movl (%edi),%edi
|
||||
jz .L003bn_sqr_mont
|
||||
movl %eax,28(%esp)
|
||||
movl (%esi),%eax
|
||||
xorl %edx,%edx
|
||||
.align 16
|
||||
.L004mull:
|
||||
movl %edx,%ebp
|
||||
mull %edi
|
||||
addl %eax,%ebp
|
||||
leal 1(%ecx),%ecx
|
||||
adcl $0,%edx
|
||||
movl (%esi,%ecx,4),%eax
|
||||
cmpl %ebx,%ecx
|
||||
movl %ebp,28(%esp,%ecx,4)
|
||||
jl .L004mull
|
||||
movl %edx,%ebp
|
||||
mull %edi
|
||||
movl 20(%esp),%edi
|
||||
addl %ebp,%eax
|
||||
movl 16(%esp),%esi
|
||||
adcl $0,%edx
|
||||
imull 32(%esp),%edi
|
||||
movl %eax,32(%esp,%ebx,4)
|
||||
xorl %ecx,%ecx
|
||||
movl %edx,36(%esp,%ebx,4)
|
||||
movl %ecx,40(%esp,%ebx,4)
|
||||
movl (%esi),%eax
|
||||
mull %edi
|
||||
addl 32(%esp),%eax
|
||||
movl 4(%esi),%eax
|
||||
adcl $0,%edx
|
||||
incl %ecx
|
||||
jmp .L0052ndmadd
|
||||
.align 16
|
||||
.L0061stmadd:
|
||||
movl %edx,%ebp
|
||||
mull %edi
|
||||
addl 32(%esp,%ecx,4),%ebp
|
||||
leal 1(%ecx),%ecx
|
||||
adcl $0,%edx
|
||||
addl %eax,%ebp
|
||||
movl (%esi,%ecx,4),%eax
|
||||
adcl $0,%edx
|
||||
cmpl %ebx,%ecx
|
||||
movl %ebp,28(%esp,%ecx,4)
|
||||
jl .L0061stmadd
|
||||
movl %edx,%ebp
|
||||
mull %edi
|
||||
addl 32(%esp,%ebx,4),%eax
|
||||
movl 20(%esp),%edi
|
||||
adcl $0,%edx
|
||||
movl 16(%esp),%esi
|
||||
addl %eax,%ebp
|
||||
adcl $0,%edx
|
||||
imull 32(%esp),%edi
|
||||
xorl %ecx,%ecx
|
||||
addl 36(%esp,%ebx,4),%edx
|
||||
movl %ebp,32(%esp,%ebx,4)
|
||||
adcl $0,%ecx
|
||||
movl (%esi),%eax
|
||||
movl %edx,36(%esp,%ebx,4)
|
||||
movl %ecx,40(%esp,%ebx,4)
|
||||
mull %edi
|
||||
addl 32(%esp),%eax
|
||||
movl 4(%esi),%eax
|
||||
adcl $0,%edx
|
||||
movl $1,%ecx
|
||||
.align 16
|
||||
.L0052ndmadd:
|
||||
movl %edx,%ebp
|
||||
mull %edi
|
||||
addl 32(%esp,%ecx,4),%ebp
|
||||
leal 1(%ecx),%ecx
|
||||
adcl $0,%edx
|
||||
addl %eax,%ebp
|
||||
movl (%esi,%ecx,4),%eax
|
||||
adcl $0,%edx
|
||||
cmpl %ebx,%ecx
|
||||
movl %ebp,24(%esp,%ecx,4)
|
||||
jl .L0052ndmadd
|
||||
movl %edx,%ebp
|
||||
mull %edi
|
||||
addl 32(%esp,%ebx,4),%ebp
|
||||
adcl $0,%edx
|
||||
addl %eax,%ebp
|
||||
adcl $0,%edx
|
||||
movl %ebp,28(%esp,%ebx,4)
|
||||
xorl %eax,%eax
|
||||
movl 12(%esp),%ecx
|
||||
addl 36(%esp,%ebx,4),%edx
|
||||
adcl 40(%esp,%ebx,4),%eax
|
||||
leal 4(%ecx),%ecx
|
||||
movl %edx,32(%esp,%ebx,4)
|
||||
cmpl 28(%esp),%ecx
|
||||
movl %eax,36(%esp,%ebx,4)
|
||||
je .L007common_tail
|
||||
movl (%ecx),%edi
|
||||
movl 8(%esp),%esi
|
||||
movl %ecx,12(%esp)
|
||||
xorl %ecx,%ecx
|
||||
xorl %edx,%edx
|
||||
movl (%esi),%eax
|
||||
jmp .L0061stmadd
|
||||
.align 16
|
||||
.L003bn_sqr_mont:
|
||||
movl %ebx,(%esp)
|
||||
movl %ecx,12(%esp)
|
||||
movl %edi,%eax
|
||||
mull %edi
|
||||
movl %eax,32(%esp)
|
||||
movl %edx,%ebx
|
||||
shrl $1,%edx
|
||||
andl $1,%ebx
|
||||
incl %ecx
|
||||
.align 16
|
||||
.L008sqr:
|
||||
movl (%esi,%ecx,4),%eax
|
||||
movl %edx,%ebp
|
||||
mull %edi
|
||||
addl %ebp,%eax
|
||||
leal 1(%ecx),%ecx
|
||||
adcl $0,%edx
|
||||
leal (%ebx,%eax,2),%ebp
|
||||
shrl $31,%eax
|
||||
cmpl (%esp),%ecx
|
||||
movl %eax,%ebx
|
||||
movl %ebp,28(%esp,%ecx,4)
|
||||
jl .L008sqr
|
||||
movl (%esi,%ecx,4),%eax
|
||||
movl %edx,%ebp
|
||||
mull %edi
|
||||
addl %ebp,%eax
|
||||
movl 20(%esp),%edi
|
||||
adcl $0,%edx
|
||||
movl 16(%esp),%esi
|
||||
leal (%ebx,%eax,2),%ebp
|
||||
imull 32(%esp),%edi
|
||||
shrl $31,%eax
|
||||
movl %ebp,32(%esp,%ecx,4)
|
||||
leal (%eax,%edx,2),%ebp
|
||||
movl (%esi),%eax
|
||||
shrl $31,%edx
|
||||
movl %ebp,36(%esp,%ecx,4)
|
||||
movl %edx,40(%esp,%ecx,4)
|
||||
mull %edi
|
||||
addl 32(%esp),%eax
|
||||
movl %ecx,%ebx
|
||||
adcl $0,%edx
|
||||
movl 4(%esi),%eax
|
||||
movl $1,%ecx
|
||||
.align 16
|
||||
.L0093rdmadd:
|
||||
movl %edx,%ebp
|
||||
mull %edi
|
||||
addl 32(%esp,%ecx,4),%ebp
|
||||
adcl $0,%edx
|
||||
addl %eax,%ebp
|
||||
movl 4(%esi,%ecx,4),%eax
|
||||
adcl $0,%edx
|
||||
movl %ebp,28(%esp,%ecx,4)
|
||||
movl %edx,%ebp
|
||||
mull %edi
|
||||
addl 36(%esp,%ecx,4),%ebp
|
||||
leal 2(%ecx),%ecx
|
||||
adcl $0,%edx
|
||||
addl %eax,%ebp
|
||||
movl (%esi,%ecx,4),%eax
|
||||
adcl $0,%edx
|
||||
cmpl %ebx,%ecx
|
||||
movl %ebp,24(%esp,%ecx,4)
|
||||
jl .L0093rdmadd
|
||||
movl %edx,%ebp
|
||||
mull %edi
|
||||
addl 32(%esp,%ebx,4),%ebp
|
||||
adcl $0,%edx
|
||||
addl %eax,%ebp
|
||||
adcl $0,%edx
|
||||
movl %ebp,28(%esp,%ebx,4)
|
||||
movl 12(%esp),%ecx
|
||||
xorl %eax,%eax
|
||||
movl 8(%esp),%esi
|
||||
addl 36(%esp,%ebx,4),%edx
|
||||
adcl 40(%esp,%ebx,4),%eax
|
||||
movl %edx,32(%esp,%ebx,4)
|
||||
cmpl %ebx,%ecx
|
||||
movl %eax,36(%esp,%ebx,4)
|
||||
je .L007common_tail
|
||||
movl 4(%esi,%ecx,4),%edi
|
||||
leal 1(%ecx),%ecx
|
||||
movl %edi,%eax
|
||||
movl %ecx,12(%esp)
|
||||
mull %edi
|
||||
addl 32(%esp,%ecx,4),%eax
|
||||
adcl $0,%edx
|
||||
movl %eax,32(%esp,%ecx,4)
|
||||
xorl %ebp,%ebp
|
||||
cmpl %ebx,%ecx
|
||||
leal 1(%ecx),%ecx
|
||||
je .L010sqrlast
|
||||
movl %edx,%ebx
|
||||
shrl $1,%edx
|
||||
andl $1,%ebx
|
||||
.align 16
|
||||
.L011sqradd:
|
||||
movl (%esi,%ecx,4),%eax
|
||||
movl %edx,%ebp
|
||||
mull %edi
|
||||
addl %ebp,%eax
|
||||
leal (%eax,%eax,1),%ebp
|
||||
adcl $0,%edx
|
||||
shrl $31,%eax
|
||||
addl 32(%esp,%ecx,4),%ebp
|
||||
leal 1(%ecx),%ecx
|
||||
adcl $0,%eax
|
||||
addl %ebx,%ebp
|
||||
adcl $0,%eax
|
||||
cmpl (%esp),%ecx
|
||||
movl %ebp,28(%esp,%ecx,4)
|
||||
movl %eax,%ebx
|
||||
jle .L011sqradd
|
||||
movl %edx,%ebp
|
||||
addl %edx,%edx
|
||||
shrl $31,%ebp
|
||||
addl %ebx,%edx
|
||||
adcl $0,%ebp
|
||||
.L010sqrlast:
|
||||
movl 20(%esp),%edi
|
||||
movl 16(%esp),%esi
|
||||
imull 32(%esp),%edi
|
||||
addl 32(%esp,%ecx,4),%edx
|
||||
movl (%esi),%eax
|
||||
adcl $0,%ebp
|
||||
movl %edx,32(%esp,%ecx,4)
|
||||
movl %ebp,36(%esp,%ecx,4)
|
||||
mull %edi
|
||||
addl 32(%esp),%eax
|
||||
leal -1(%ecx),%ebx
|
||||
adcl $0,%edx
|
||||
movl $1,%ecx
|
||||
movl 4(%esi),%eax
|
||||
jmp .L0093rdmadd
|
||||
.align 16
|
||||
.L007common_tail:
|
||||
movl 16(%esp),%ebp
|
||||
movl 4(%esp),%edi
|
||||
leal 32(%esp),%esi
|
||||
movl (%esi),%eax
|
||||
movl %ebx,%ecx
|
||||
xorl %edx,%edx
|
||||
.align 16
|
||||
.L012sub:
|
||||
sbbl (%ebp,%edx,4),%eax
|
||||
movl %eax,(%edi,%edx,4)
|
||||
decl %ecx
|
||||
movl 4(%esi,%edx,4),%eax
|
||||
leal 1(%edx),%edx
|
||||
jge .L012sub
|
||||
sbbl $0,%eax
|
||||
movl $-1,%edx
|
||||
xorl %eax,%edx
|
||||
jmp .L013copy
|
||||
.align 16
|
||||
.L013copy:
|
||||
movl 32(%esp,%ebx,4),%esi
|
||||
movl (%edi,%ebx,4),%ebp
|
||||
movl %ecx,32(%esp,%ebx,4)
|
||||
andl %eax,%esi
|
||||
andl %edx,%ebp
|
||||
orl %esi,%ebp
|
||||
movl %ebp,(%edi,%ebx,4)
|
||||
decl %ebx
|
||||
jge .L013copy
|
||||
movl 24(%esp),%esp
|
||||
movl $1,%eax
|
||||
.L000just_leave:
|
||||
popl %edi
|
||||
popl %esi
|
||||
popl %ebx
|
||||
popl %ebp
|
||||
ret
|
||||
.byte 77,111,110,116,103,111,109,101,114,121,32,77,117,108,116,105
|
||||
.byte 112,108,105,99,97,116,105,111,110,32,102,111,114,32,120,56
|
||||
.byte 54,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121
|
||||
.byte 32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46
|
||||
.byte 111,114,103,62,0
|
||||
#endif
|
||||
#endif // defined(__i386__) && defined(_WIN32)
|
||||
#if defined(__linux__) && defined(__ELF__)
|
||||
.section .note.GNU-stack,"",%progbits
|
||||
#endif
|
||||
|
||||
@@ -30,16 +30,20 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
// PMBTokens.
|
||||
//
|
||||
// PMBTokens is described in https://eprint.iacr.org/2020/072/20200324:214215
|
||||
// and provides anonymous tokens with private metadata. We implement the
|
||||
// construction with validity verification, described in appendix H,
|
||||
// construction 6.
|
||||
// For the following cryptographic schemes, we use P-384 instead of our usual
|
||||
// choice of P-256. See Appendix I of
|
||||
// https://eprint.iacr.org/2020/072/20200324:214215 which describes two attacks
|
||||
// which may affect smaller curves. In particular, p-1 for P-256 is smooth,
|
||||
// giving a low complexity for the p-1 attack. P-384's p-1 has a 281-bit prime
|
||||
// factor,
|
||||
// 3055465788140352002733946906144561090641249606160407884365391979704929268480326390471.
|
||||
// This lower-bounds the p-1 attack at O(2^140). The p+1 attack is lower-bounded
|
||||
// by O(p^(1/3)) or O(2^128), so we do not need to check the smoothness of p+1.
|
||||
|
||||
// PMBTOKEN_NONCE_SIZE is the size of nonces used as part of the PMBToken
|
||||
|
||||
// TRUST_TOKEN_NONCE_SIZE is the size of nonces used as part of the Trust_Token
|
||||
// protocol.
|
||||
#define PMBTOKEN_NONCE_SIZE 64
|
||||
#define TRUST_TOKEN_NONCE_SIZE 64
|
||||
|
||||
typedef struct {
|
||||
// TODO(https://crbug.com/boringssl/334): These should store |EC_PRECOMP| so
|
||||
@@ -47,7 +51,7 @@ typedef struct {
|
||||
EC_AFFINE pub0;
|
||||
EC_AFFINE pub1;
|
||||
EC_AFFINE pubs;
|
||||
} PMBTOKEN_CLIENT_KEY;
|
||||
} TRUST_TOKEN_CLIENT_KEY;
|
||||
|
||||
typedef struct {
|
||||
EC_SCALAR x0;
|
||||
@@ -62,47 +66,47 @@ typedef struct {
|
||||
EC_PRECOMP pub1_precomp;
|
||||
EC_AFFINE pubs;
|
||||
EC_PRECOMP pubs_precomp;
|
||||
} PMBTOKEN_ISSUER_KEY;
|
||||
} TRUST_TOKEN_ISSUER_KEY;
|
||||
|
||||
// PMBTOKEN_PRETOKEN represents the intermediate state a client keeps during a
|
||||
// PMBToken issuance operation.
|
||||
// TRUST_TOKEN_PRETOKEN represents the intermediate state a client keeps during
|
||||
// a Trust_Token issuance operation.
|
||||
typedef struct pmb_pretoken_st {
|
||||
uint8_t t[PMBTOKEN_NONCE_SIZE];
|
||||
uint8_t t[TRUST_TOKEN_NONCE_SIZE];
|
||||
EC_SCALAR r;
|
||||
EC_AFFINE Tp;
|
||||
} PMBTOKEN_PRETOKEN;
|
||||
} TRUST_TOKEN_PRETOKEN;
|
||||
|
||||
// PMBTOKEN_PRETOKEN_free releases the memory associated with |token|.
|
||||
OPENSSL_EXPORT void PMBTOKEN_PRETOKEN_free(PMBTOKEN_PRETOKEN *token);
|
||||
// TRUST_TOKEN_PRETOKEN_free releases the memory associated with |token|.
|
||||
OPENSSL_EXPORT void TRUST_TOKEN_PRETOKEN_free(TRUST_TOKEN_PRETOKEN *token);
|
||||
|
||||
DEFINE_STACK_OF(PMBTOKEN_PRETOKEN)
|
||||
DEFINE_STACK_OF(TRUST_TOKEN_PRETOKEN)
|
||||
|
||||
|
||||
// PMBTokens.
|
||||
//
|
||||
// PMBTokens is described in https://eprint.iacr.org/2020/072/20200324:214215
|
||||
// and provides anonymous tokens with private metadata. We implement the
|
||||
// construction with validity verification, described in appendix H,
|
||||
// construction 6.
|
||||
|
||||
// The following functions implement the corresponding |TRUST_TOKENS_METHOD|
|
||||
// functions for |TRUST_TOKENS_experiment_v1|'s PMBTokens construction which
|
||||
// uses P-384.
|
||||
//
|
||||
// We use P-384 instead of our usual choice of P-256. See Appendix I which
|
||||
// describes two attacks which may affect smaller curves. In particular, p-1 for
|
||||
// P-256 is smooth, giving a low complexity for the p-1 attack. P-384's p-1 has
|
||||
// a 281-bit prime factor,
|
||||
// 3055465788140352002733946906144561090641249606160407884365391979704929268480326390471.
|
||||
// This lower-bounds the p-1 attack at O(2^140). The p+1 attack is lower-bounded
|
||||
// by O(p^(1/3)) or O(2^128), so we do not need to check the smoothness of p+1.
|
||||
int pmbtoken_exp1_generate_key(CBB *out_private, CBB *out_public);
|
||||
int pmbtoken_exp1_client_key_from_bytes(PMBTOKEN_CLIENT_KEY *key,
|
||||
int pmbtoken_exp1_client_key_from_bytes(TRUST_TOKEN_CLIENT_KEY *key,
|
||||
const uint8_t *in, size_t len);
|
||||
int pmbtoken_exp1_issuer_key_from_bytes(PMBTOKEN_ISSUER_KEY *key,
|
||||
int pmbtoken_exp1_issuer_key_from_bytes(TRUST_TOKEN_ISSUER_KEY *key,
|
||||
const uint8_t *in, size_t len);
|
||||
STACK_OF(PMBTOKEN_PRETOKEN) * pmbtoken_exp1_blind(CBB *cbb, size_t count);
|
||||
int pmbtoken_exp1_sign(const PMBTOKEN_ISSUER_KEY *key, CBB *cbb, CBS *cbs,
|
||||
STACK_OF(TRUST_TOKEN_PRETOKEN) * pmbtoken_exp1_blind(CBB *cbb, size_t count);
|
||||
int pmbtoken_exp1_sign(const TRUST_TOKEN_ISSUER_KEY *key, CBB *cbb, CBS *cbs,
|
||||
size_t num_requested, size_t num_to_issue,
|
||||
uint8_t private_metadata);
|
||||
STACK_OF(TRUST_TOKEN) *
|
||||
pmbtoken_exp1_unblind(const PMBTOKEN_CLIENT_KEY *key,
|
||||
const STACK_OF(PMBTOKEN_PRETOKEN) * pretokens,
|
||||
pmbtoken_exp1_unblind(const TRUST_TOKEN_CLIENT_KEY *key,
|
||||
const STACK_OF(TRUST_TOKEN_PRETOKEN) * pretokens,
|
||||
CBS *cbs, size_t count, uint32_t key_id);
|
||||
int pmbtoken_exp1_read(const PMBTOKEN_ISSUER_KEY *key,
|
||||
uint8_t out_nonce[PMBTOKEN_NONCE_SIZE],
|
||||
int pmbtoken_exp1_read(const TRUST_TOKEN_ISSUER_KEY *key,
|
||||
uint8_t out_nonce[TRUST_TOKEN_NONCE_SIZE],
|
||||
uint8_t *out_private_metadata, const uint8_t *token,
|
||||
size_t token_len);
|
||||
|
||||
@@ -113,29 +117,21 @@ OPENSSL_EXPORT int pmbtoken_exp1_get_h_for_testing(uint8_t out[97]);
|
||||
// The following functions implement the corresponding |TRUST_TOKENS_METHOD|
|
||||
// functions for |TRUST_TOKENS_experiment_v2|'s PMBTokens construction which
|
||||
// uses P-384.
|
||||
//
|
||||
// We use P-384 instead of our usual choice of P-256. See Appendix I which
|
||||
// describes two attacks which may affect smaller curves. In particular, p-1 for
|
||||
// P-256 is smooth, giving a low complexity for the p-1 attack. P-384's p-1 has
|
||||
// a 281-bit prime factor,
|
||||
// 3055465788140352002733946906144561090641249606160407884365391979704929268480326390471.
|
||||
// This lower-bounds the p-1 attack at O(2^140). The p+1 attack is lower-bounded
|
||||
// by O(p^(1/3)) or O(2^128), so we do not need to check the smoothness of p+1.
|
||||
int pmbtoken_exp2_generate_key(CBB *out_private, CBB *out_public);
|
||||
int pmbtoken_exp2_client_key_from_bytes(PMBTOKEN_CLIENT_KEY *key,
|
||||
int pmbtoken_exp2_client_key_from_bytes(TRUST_TOKEN_CLIENT_KEY *key,
|
||||
const uint8_t *in, size_t len);
|
||||
int pmbtoken_exp2_issuer_key_from_bytes(PMBTOKEN_ISSUER_KEY *key,
|
||||
int pmbtoken_exp2_issuer_key_from_bytes(TRUST_TOKEN_ISSUER_KEY *key,
|
||||
const uint8_t *in, size_t len);
|
||||
STACK_OF(PMBTOKEN_PRETOKEN) * pmbtoken_exp2_blind(CBB *cbb, size_t count);
|
||||
int pmbtoken_exp2_sign(const PMBTOKEN_ISSUER_KEY *key, CBB *cbb, CBS *cbs,
|
||||
STACK_OF(TRUST_TOKEN_PRETOKEN) * pmbtoken_exp2_blind(CBB *cbb, size_t count);
|
||||
int pmbtoken_exp2_sign(const TRUST_TOKEN_ISSUER_KEY *key, CBB *cbb, CBS *cbs,
|
||||
size_t num_requested, size_t num_to_issue,
|
||||
uint8_t private_metadata);
|
||||
STACK_OF(TRUST_TOKEN) *
|
||||
pmbtoken_exp2_unblind(const PMBTOKEN_CLIENT_KEY *key,
|
||||
const STACK_OF(PMBTOKEN_PRETOKEN) * pretokens,
|
||||
pmbtoken_exp2_unblind(const TRUST_TOKEN_CLIENT_KEY *key,
|
||||
const STACK_OF(TRUST_TOKEN_PRETOKEN) * pretokens,
|
||||
CBS *cbs, size_t count, uint32_t key_id);
|
||||
int pmbtoken_exp2_read(const PMBTOKEN_ISSUER_KEY *key,
|
||||
uint8_t out_nonce[PMBTOKEN_NONCE_SIZE],
|
||||
int pmbtoken_exp2_read(const TRUST_TOKEN_ISSUER_KEY *key,
|
||||
uint8_t out_nonce[TRUST_TOKEN_NONCE_SIZE],
|
||||
uint8_t *out_private_metadata, const uint8_t *token,
|
||||
size_t token_len);
|
||||
|
||||
@@ -144,6 +140,37 @@ int pmbtoken_exp2_read(const PMBTOKEN_ISSUER_KEY *key,
|
||||
OPENSSL_EXPORT int pmbtoken_exp2_get_h_for_testing(uint8_t out[97]);
|
||||
|
||||
|
||||
// VOPRF.
|
||||
//
|
||||
// VOPRFs are described in https://tools.ietf.org/html/draft-irtf-cfrg-voprf-04
|
||||
// and provide anonymous tokens. This implementation uses TrustToken DSTs and
|
||||
// the DLEQ batching primitive from
|
||||
// https://eprint.iacr.org/2020/072/20200324:214215.
|
||||
// VOPRF only uses the |pub|' field of the TRUST_TOKEN_CLIENT_KEY and
|
||||
// |xs|/|pubs| fields of the TRUST_TOKEN_ISSUER_KEY.
|
||||
|
||||
// The following functions implement the corresponding |TRUST_TOKENS_METHOD|
|
||||
// functions for |TRUST_TOKENS_experiment_v2|'s VOPRF construction which uses
|
||||
// P-384.
|
||||
int voprf_exp2_generate_key(CBB *out_private, CBB *out_public);
|
||||
int voprf_exp2_client_key_from_bytes(TRUST_TOKEN_CLIENT_KEY *key,
|
||||
const uint8_t *in, size_t len);
|
||||
int voprf_exp2_issuer_key_from_bytes(TRUST_TOKEN_ISSUER_KEY *key,
|
||||
const uint8_t *in, size_t len);
|
||||
STACK_OF(TRUST_TOKEN_PRETOKEN) * voprf_exp2_blind(CBB *cbb, size_t count);
|
||||
int voprf_exp2_sign(const TRUST_TOKEN_ISSUER_KEY *key, CBB *cbb, CBS *cbs,
|
||||
size_t num_requested, size_t num_to_issue,
|
||||
uint8_t private_metadata);
|
||||
STACK_OF(TRUST_TOKEN) *
|
||||
voprf_exp2_unblind(const TRUST_TOKEN_CLIENT_KEY *key,
|
||||
const STACK_OF(TRUST_TOKEN_PRETOKEN) * pretokens,
|
||||
CBS *cbs, size_t count, uint32_t key_id);
|
||||
int voprf_exp2_read(const TRUST_TOKEN_ISSUER_KEY *key,
|
||||
uint8_t out_nonce[TRUST_TOKEN_NONCE_SIZE],
|
||||
uint8_t *out_private_metadata, const uint8_t *token,
|
||||
size_t token_len);
|
||||
|
||||
|
||||
// Trust Tokens internals.
|
||||
|
||||
struct trust_token_method_st {
|
||||
@@ -155,23 +182,23 @@ struct trust_token_method_st {
|
||||
// client_key_from_bytes decodes a client key from |in| and sets |key|
|
||||
// to the resulting key. It returns one on success and zero
|
||||
// on failure.
|
||||
int (*client_key_from_bytes)(PMBTOKEN_CLIENT_KEY *key, const uint8_t *in,
|
||||
int (*client_key_from_bytes)(TRUST_TOKEN_CLIENT_KEY *key, const uint8_t *in,
|
||||
size_t len);
|
||||
|
||||
// issuer_key_from_bytes decodes a issuer key from |in| and sets |key|
|
||||
// to the resulting key. It returns one on success and zero
|
||||
// on failure.
|
||||
int (*issuer_key_from_bytes)(PMBTOKEN_ISSUER_KEY *key, const uint8_t *in,
|
||||
int (*issuer_key_from_bytes)(TRUST_TOKEN_ISSUER_KEY *key, const uint8_t *in,
|
||||
size_t len);
|
||||
|
||||
// blind generates a new issuance request for |count| tokens. On
|
||||
// success, it returns a newly-allocated |STACK_OF(PMBTOKEN_PRETOKEN)| and
|
||||
// success, it returns a newly-allocated |STACK_OF(TRUST_TOKEN_PRETOKEN)| and
|
||||
// writes a request to the issuer to |cbb|. On failure, it returns NULL. The
|
||||
// |STACK_OF(PMBTOKEN_PRETOKEN)|s should be passed to |pmbtoken_unblind| when
|
||||
// |STACK_OF(TRUST_TOKEN_PRETOKEN)|s should be passed to |pmbtoken_unblind| when
|
||||
// the server responds.
|
||||
//
|
||||
// This function implements the AT.Usr0 operation.
|
||||
STACK_OF(PMBTOKEN_PRETOKEN) *(*blind)(CBB *cbb, size_t count);
|
||||
STACK_OF(TRUST_TOKEN_PRETOKEN) * (*blind)(CBB *cbb, size_t count);
|
||||
|
||||
// sign parses a request for |num_requested| tokens from |cbs| and
|
||||
// issues |num_to_issue| tokens with |key| and a private metadata value of
|
||||
@@ -179,7 +206,7 @@ struct trust_token_method_st {
|
||||
// success and zero on failure.
|
||||
//
|
||||
// This function implements the AT.Sig operation.
|
||||
int (*sign)(const PMBTOKEN_ISSUER_KEY *key, CBB *cbb, CBS *cbs,
|
||||
int (*sign)(const TRUST_TOKEN_ISSUER_KEY *key, CBB *cbb, CBS *cbs,
|
||||
size_t num_requested, size_t num_to_issue,
|
||||
uint8_t private_metadata);
|
||||
|
||||
@@ -192,8 +219,8 @@ struct trust_token_method_st {
|
||||
//
|
||||
// This function implements the AT.Usr1 operation.
|
||||
STACK_OF(TRUST_TOKEN) *
|
||||
(*unblind)(const PMBTOKEN_CLIENT_KEY *key,
|
||||
const STACK_OF(PMBTOKEN_PRETOKEN) * pretokens, CBS *cbs,
|
||||
(*unblind)(const TRUST_TOKEN_CLIENT_KEY *key,
|
||||
const STACK_OF(TRUST_TOKEN_PRETOKEN) * pretokens, CBS *cbs,
|
||||
size_t count, uint32_t key_id);
|
||||
|
||||
// read parses a PMBToken from |token| and verifies it using |key|. On
|
||||
@@ -201,8 +228,8 @@ struct trust_token_method_st {
|
||||
// |out_nonce| and |*out_private_metadata|. Otherwise, it returns zero. Note
|
||||
// that, unlike the output of |unblind|, |token| does not have a
|
||||
// four-byte key ID prepended.
|
||||
int (*read)(const PMBTOKEN_ISSUER_KEY *key,
|
||||
uint8_t out_nonce[PMBTOKEN_NONCE_SIZE],
|
||||
int (*read)(const TRUST_TOKEN_ISSUER_KEY *key,
|
||||
uint8_t out_nonce[TRUST_TOKEN_NONCE_SIZE],
|
||||
uint8_t *out_private_metadata, const uint8_t *token,
|
||||
size_t token_len);
|
||||
|
||||
@@ -219,14 +246,14 @@ struct trust_token_method_st {
|
||||
// Structure representing a single Trust Token public key with the specified ID.
|
||||
struct trust_token_client_key_st {
|
||||
uint32_t id;
|
||||
PMBTOKEN_CLIENT_KEY key;
|
||||
TRUST_TOKEN_CLIENT_KEY key;
|
||||
};
|
||||
|
||||
// Structure representing a single Trust Token private key with the specified
|
||||
// ID.
|
||||
struct trust_token_issuer_key_st {
|
||||
uint32_t id;
|
||||
PMBTOKEN_ISSUER_KEY key;
|
||||
TRUST_TOKEN_ISSUER_KEY key;
|
||||
};
|
||||
|
||||
struct trust_token_client_st {
|
||||
@@ -243,7 +270,7 @@ struct trust_token_client_st {
|
||||
size_t num_keys;
|
||||
|
||||
// pretokens is the intermediate state during an active issuance.
|
||||
STACK_OF(PMBTOKEN_PRETOKEN)* pretokens;
|
||||
STACK_OF(TRUST_TOKEN_PRETOKEN)* pretokens;
|
||||
|
||||
// srr_key is the public key used to verify the signature of the SRR.
|
||||
EVP_PKEY *srr_key;
|
||||
@@ -281,7 +308,7 @@ extern "C++" {
|
||||
|
||||
BSSL_NAMESPACE_BEGIN
|
||||
|
||||
BORINGSSL_MAKE_DELETER(PMBTOKEN_PRETOKEN, PMBTOKEN_PRETOKEN_free)
|
||||
BORINGSSL_MAKE_DELETER(TRUST_TOKEN_PRETOKEN, TRUST_TOKEN_PRETOKEN_free)
|
||||
|
||||
BSSL_NAMESPACE_END
|
||||
|
||||
|
||||
@@ -31,10 +31,10 @@
|
||||
|
||||
|
||||
typedef int (*hash_t_func_t)(const EC_GROUP *group, EC_RAW_POINT *out,
|
||||
const uint8_t t[PMBTOKEN_NONCE_SIZE]);
|
||||
const uint8_t t[TRUST_TOKEN_NONCE_SIZE]);
|
||||
typedef int (*hash_s_func_t)(const EC_GROUP *group, EC_RAW_POINT *out,
|
||||
const EC_AFFINE *t,
|
||||
const uint8_t s[PMBTOKEN_NONCE_SIZE]);
|
||||
const uint8_t s[TRUST_TOKEN_NONCE_SIZE]);
|
||||
typedef int (*hash_c_func_t)(const EC_GROUP *group, EC_SCALAR *out,
|
||||
uint8_t *buf, size_t len);
|
||||
|
||||
@@ -165,10 +165,6 @@ static int mul_public_3(const EC_GROUP *group, EC_RAW_POINT *out,
|
||||
scalars, 3);
|
||||
}
|
||||
|
||||
void PMBTOKEN_PRETOKEN_free(PMBTOKEN_PRETOKEN *pretoken) {
|
||||
OPENSSL_free(pretoken);
|
||||
}
|
||||
|
||||
static int pmbtoken_generate_key(const PMBTOKEN_METHOD *method,
|
||||
CBB *out_private, CBB *out_public) {
|
||||
const EC_GROUP *group = method->group;
|
||||
@@ -211,7 +207,7 @@ static int pmbtoken_generate_key(const PMBTOKEN_METHOD *method,
|
||||
}
|
||||
|
||||
static int pmbtoken_client_key_from_bytes(const PMBTOKEN_METHOD *method,
|
||||
PMBTOKEN_CLIENT_KEY *key,
|
||||
TRUST_TOKEN_CLIENT_KEY *key,
|
||||
const uint8_t *in, size_t len) {
|
||||
CBS cbs;
|
||||
CBS_init(&cbs, in, len);
|
||||
@@ -230,7 +226,7 @@ static int pmbtoken_client_key_from_bytes(const PMBTOKEN_METHOD *method,
|
||||
}
|
||||
|
||||
static int pmbtoken_issuer_key_from_bytes(const PMBTOKEN_METHOD *method,
|
||||
PMBTOKEN_ISSUER_KEY *key,
|
||||
TRUST_TOKEN_ISSUER_KEY *key,
|
||||
const uint8_t *in, size_t len) {
|
||||
const EC_GROUP *group = method->group;
|
||||
CBS cbs, tmp;
|
||||
@@ -269,10 +265,10 @@ static int pmbtoken_issuer_key_from_bytes(const PMBTOKEN_METHOD *method,
|
||||
return 1;
|
||||
}
|
||||
|
||||
static STACK_OF(PMBTOKEN_PRETOKEN) *
|
||||
static STACK_OF(TRUST_TOKEN_PRETOKEN) *
|
||||
pmbtoken_blind(const PMBTOKEN_METHOD *method, CBB *cbb, size_t count) {
|
||||
const EC_GROUP *group = method->group;
|
||||
STACK_OF(PMBTOKEN_PRETOKEN) *pretokens = sk_PMBTOKEN_PRETOKEN_new_null();
|
||||
STACK_OF(TRUST_TOKEN_PRETOKEN) *pretokens = sk_TRUST_TOKEN_PRETOKEN_new_null();
|
||||
if (pretokens == NULL) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
@@ -280,11 +276,11 @@ static STACK_OF(PMBTOKEN_PRETOKEN) *
|
||||
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
// Insert |pretoken| into |pretokens| early to simplify error-handling.
|
||||
PMBTOKEN_PRETOKEN *pretoken = OPENSSL_malloc(sizeof(PMBTOKEN_PRETOKEN));
|
||||
TRUST_TOKEN_PRETOKEN *pretoken = OPENSSL_malloc(sizeof(TRUST_TOKEN_PRETOKEN));
|
||||
if (pretoken == NULL ||
|
||||
!sk_PMBTOKEN_PRETOKEN_push(pretokens, pretoken)) {
|
||||
!sk_TRUST_TOKEN_PRETOKEN_push(pretokens, pretoken)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, ERR_R_MALLOC_FAILURE);
|
||||
PMBTOKEN_PRETOKEN_free(pretoken);
|
||||
TRUST_TOKEN_PRETOKEN_free(pretoken);
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -319,7 +315,7 @@ static STACK_OF(PMBTOKEN_PRETOKEN) *
|
||||
return pretokens;
|
||||
|
||||
err:
|
||||
sk_PMBTOKEN_PRETOKEN_pop_free(pretokens, PMBTOKEN_PRETOKEN_free);
|
||||
sk_TRUST_TOKEN_PRETOKEN_pop_free(pretokens, TRUST_TOKEN_PRETOKEN_free);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -455,9 +451,10 @@ err:
|
||||
// DLEQOR2 with only one value (n=1).
|
||||
|
||||
static int dleq_generate(const PMBTOKEN_METHOD *method, CBB *cbb,
|
||||
const PMBTOKEN_ISSUER_KEY *priv, const EC_RAW_POINT *T,
|
||||
const EC_RAW_POINT *S, const EC_RAW_POINT *W,
|
||||
const EC_RAW_POINT *Ws, uint8_t private_metadata) {
|
||||
const TRUST_TOKEN_ISSUER_KEY *priv,
|
||||
const EC_RAW_POINT *T, const EC_RAW_POINT *S,
|
||||
const EC_RAW_POINT *W, const EC_RAW_POINT *Ws,
|
||||
uint8_t private_metadata) {
|
||||
const EC_GROUP *group = method->group;
|
||||
|
||||
// We generate a DLEQ proof for the validity token and a DLEQOR2 proof for the
|
||||
@@ -616,7 +613,7 @@ static int dleq_generate(const PMBTOKEN_METHOD *method, CBB *cbb,
|
||||
}
|
||||
|
||||
static int dleq_verify(const PMBTOKEN_METHOD *method, CBS *cbs,
|
||||
const PMBTOKEN_CLIENT_KEY *pub, const EC_RAW_POINT *T,
|
||||
const TRUST_TOKEN_CLIENT_KEY *pub, const EC_RAW_POINT *T,
|
||||
const EC_RAW_POINT *S, const EC_RAW_POINT *W,
|
||||
const EC_RAW_POINT *Ws) {
|
||||
const EC_GROUP *group = method->group;
|
||||
@@ -735,7 +732,7 @@ static int dleq_verify(const PMBTOKEN_METHOD *method, CBS *cbs,
|
||||
}
|
||||
|
||||
static int pmbtoken_sign(const PMBTOKEN_METHOD *method,
|
||||
const PMBTOKEN_ISSUER_KEY *key, CBB *cbb, CBS *cbs,
|
||||
const TRUST_TOKEN_ISSUER_KEY *key, CBB *cbb, CBS *cbs,
|
||||
size_t num_requested, size_t num_to_issue,
|
||||
uint8_t private_metadata) {
|
||||
const EC_GROUP *group = method->group;
|
||||
@@ -785,8 +782,8 @@ static int pmbtoken_sign(const PMBTOKEN_METHOD *method,
|
||||
ec_scalar_select(group, &xb, mask, &key->x1, &key->x0);
|
||||
ec_scalar_select(group, &yb, mask, &key->y1, &key->y0);
|
||||
|
||||
uint8_t s[PMBTOKEN_NONCE_SIZE];
|
||||
RAND_bytes(s, PMBTOKEN_NONCE_SIZE);
|
||||
uint8_t s[TRUST_TOKEN_NONCE_SIZE];
|
||||
RAND_bytes(s, TRUST_TOKEN_NONCE_SIZE);
|
||||
// The |jacobians| and |affines| contain Sp, Wp, and Wsp.
|
||||
EC_RAW_POINT jacobians[3];
|
||||
EC_AFFINE affines[3];
|
||||
@@ -796,9 +793,11 @@ static int pmbtoken_sign(const PMBTOKEN_METHOD *method,
|
||||
!ec_point_mul_scalar_batch(group, &jacobians[2], &Tp, &key->xs,
|
||||
&jacobians[0], &key->ys, NULL, NULL) ||
|
||||
!ec_jacobian_to_affine_batch(group, affines, jacobians, 3) ||
|
||||
!CBB_add_bytes(cbb, s, PMBTOKEN_NONCE_SIZE) ||
|
||||
!cbb_add_prefixed_point(cbb, group, &affines[1], method->prefix_point) ||
|
||||
!cbb_add_prefixed_point(cbb, group, &affines[2], method->prefix_point)) {
|
||||
!CBB_add_bytes(cbb, s, TRUST_TOKEN_NONCE_SIZE) ||
|
||||
!cbb_add_prefixed_point(cbb, group, &affines[1],
|
||||
method->prefix_point) ||
|
||||
!cbb_add_prefixed_point(cbb, group, &affines[2],
|
||||
method->prefix_point)) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -877,11 +876,11 @@ err:
|
||||
|
||||
static STACK_OF(TRUST_TOKEN) *
|
||||
pmbtoken_unblind(const PMBTOKEN_METHOD *method,
|
||||
const PMBTOKEN_CLIENT_KEY *key,
|
||||
const STACK_OF(PMBTOKEN_PRETOKEN) * pretokens, CBS *cbs,
|
||||
const TRUST_TOKEN_CLIENT_KEY *key,
|
||||
const STACK_OF(TRUST_TOKEN_PRETOKEN) * pretokens, CBS *cbs,
|
||||
size_t count, uint32_t key_id) {
|
||||
const EC_GROUP *group = method->group;
|
||||
if (count > sk_PMBTOKEN_PRETOKEN_num(pretokens)) {
|
||||
if (count > sk_TRUST_TOKEN_PRETOKEN_num(pretokens)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, TRUST_TOKEN_R_DECODE_FAILURE);
|
||||
return NULL;
|
||||
}
|
||||
@@ -919,12 +918,12 @@ static STACK_OF(TRUST_TOKEN) *
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
const PMBTOKEN_PRETOKEN *pretoken =
|
||||
sk_PMBTOKEN_PRETOKEN_value(pretokens, i);
|
||||
const TRUST_TOKEN_PRETOKEN *pretoken =
|
||||
sk_TRUST_TOKEN_PRETOKEN_value(pretokens, i);
|
||||
|
||||
uint8_t s[PMBTOKEN_NONCE_SIZE];
|
||||
uint8_t s[TRUST_TOKEN_NONCE_SIZE];
|
||||
EC_AFFINE Wp_affine, Wsp_affine;
|
||||
if (!CBS_copy_bytes(cbs, s, PMBTOKEN_NONCE_SIZE) ||
|
||||
if (!CBS_copy_bytes(cbs, s, TRUST_TOKEN_NONCE_SIZE) ||
|
||||
!cbs_get_prefixed_point(cbs, group, &Wp_affine, method->prefix_point) ||
|
||||
!cbs_get_prefixed_point(cbs, group, &Wsp_affine,
|
||||
method->prefix_point)) {
|
||||
@@ -963,9 +962,10 @@ static STACK_OF(TRUST_TOKEN) *
|
||||
// above.
|
||||
CBB token_cbb;
|
||||
size_t point_len = 1 + 2 * BN_num_bytes(&group->field);
|
||||
if (!CBB_init(&token_cbb, 4 + PMBTOKEN_NONCE_SIZE + 3 * (2 + point_len)) ||
|
||||
if (!CBB_init(&token_cbb,
|
||||
4 + TRUST_TOKEN_NONCE_SIZE + 3 * (2 + point_len)) ||
|
||||
!CBB_add_u32(&token_cbb, key_id) ||
|
||||
!CBB_add_bytes(&token_cbb, pretoken->t, PMBTOKEN_NONCE_SIZE) ||
|
||||
!CBB_add_bytes(&token_cbb, pretoken->t, TRUST_TOKEN_NONCE_SIZE) ||
|
||||
!cbb_add_prefixed_point(&token_cbb, group, &affines[0],
|
||||
method->prefix_point) ||
|
||||
!cbb_add_prefixed_point(&token_cbb, group, &affines[1],
|
||||
@@ -1034,15 +1034,15 @@ err:
|
||||
}
|
||||
|
||||
static int pmbtoken_read(const PMBTOKEN_METHOD *method,
|
||||
const PMBTOKEN_ISSUER_KEY *key,
|
||||
uint8_t out_nonce[PMBTOKEN_NONCE_SIZE],
|
||||
const TRUST_TOKEN_ISSUER_KEY *key,
|
||||
uint8_t out_nonce[TRUST_TOKEN_NONCE_SIZE],
|
||||
uint8_t *out_private_metadata, const uint8_t *token,
|
||||
size_t token_len) {
|
||||
const EC_GROUP *group = method->group;
|
||||
CBS cbs;
|
||||
CBS_init(&cbs, token, token_len);
|
||||
EC_AFFINE S, W, Ws;
|
||||
if (!CBS_copy_bytes(&cbs, out_nonce, PMBTOKEN_NONCE_SIZE) ||
|
||||
if (!CBS_copy_bytes(&cbs, out_nonce, TRUST_TOKEN_NONCE_SIZE) ||
|
||||
!cbs_get_prefixed_point(&cbs, group, &S, method->prefix_point) ||
|
||||
!cbs_get_prefixed_point(&cbs, group, &W, method->prefix_point) ||
|
||||
!cbs_get_prefixed_point(&cbs, group, &Ws, method->prefix_point) ||
|
||||
@@ -1101,15 +1101,15 @@ static int pmbtoken_read(const PMBTOKEN_METHOD *method,
|
||||
// PMBTokens experiment v1.
|
||||
|
||||
static int pmbtoken_exp1_hash_t(const EC_GROUP *group, EC_RAW_POINT *out,
|
||||
const uint8_t t[PMBTOKEN_NONCE_SIZE]) {
|
||||
const uint8_t t[TRUST_TOKEN_NONCE_SIZE]) {
|
||||
const uint8_t kHashTLabel[] = "PMBTokens Experiment V1 HashT";
|
||||
return ec_hash_to_curve_p384_xmd_sha512_sswu_draft07(
|
||||
group, out, kHashTLabel, sizeof(kHashTLabel), t, PMBTOKEN_NONCE_SIZE);
|
||||
group, out, kHashTLabel, sizeof(kHashTLabel), t, TRUST_TOKEN_NONCE_SIZE);
|
||||
}
|
||||
|
||||
static int pmbtoken_exp1_hash_s(const EC_GROUP *group, EC_RAW_POINT *out,
|
||||
const EC_AFFINE *t,
|
||||
const uint8_t s[PMBTOKEN_NONCE_SIZE]) {
|
||||
const uint8_t s[TRUST_TOKEN_NONCE_SIZE]) {
|
||||
const uint8_t kHashSLabel[] = "PMBTokens Experiment V1 HashS";
|
||||
int ret = 0;
|
||||
CBB cbb;
|
||||
@@ -1117,7 +1117,7 @@ static int pmbtoken_exp1_hash_s(const EC_GROUP *group, EC_RAW_POINT *out,
|
||||
size_t len;
|
||||
if (!CBB_init(&cbb, 0) ||
|
||||
!point_to_cbb(&cbb, group, t) ||
|
||||
!CBB_add_bytes(&cbb, s, PMBTOKEN_NONCE_SIZE) ||
|
||||
!CBB_add_bytes(&cbb, s, TRUST_TOKEN_NONCE_SIZE) ||
|
||||
!CBB_finish(&cbb, &buf, &len) ||
|
||||
!ec_hash_to_curve_p384_xmd_sha512_sswu_draft07(
|
||||
group, out, kHashSLabel, sizeof(kHashSLabel), buf, len)) {
|
||||
@@ -1182,7 +1182,7 @@ int pmbtoken_exp1_generate_key(CBB *out_private, CBB *out_public) {
|
||||
return pmbtoken_generate_key(&pmbtoken_exp1_method, out_private, out_public);
|
||||
}
|
||||
|
||||
int pmbtoken_exp1_client_key_from_bytes(PMBTOKEN_CLIENT_KEY *key,
|
||||
int pmbtoken_exp1_client_key_from_bytes(TRUST_TOKEN_CLIENT_KEY *key,
|
||||
const uint8_t *in, size_t len) {
|
||||
if (!pmbtoken_exp1_init_method()) {
|
||||
return 0;
|
||||
@@ -1190,7 +1190,7 @@ int pmbtoken_exp1_client_key_from_bytes(PMBTOKEN_CLIENT_KEY *key,
|
||||
return pmbtoken_client_key_from_bytes(&pmbtoken_exp1_method, key, in, len);
|
||||
}
|
||||
|
||||
int pmbtoken_exp1_issuer_key_from_bytes(PMBTOKEN_ISSUER_KEY *key,
|
||||
int pmbtoken_exp1_issuer_key_from_bytes(TRUST_TOKEN_ISSUER_KEY *key,
|
||||
const uint8_t *in, size_t len) {
|
||||
if (!pmbtoken_exp1_init_method()) {
|
||||
return 0;
|
||||
@@ -1198,14 +1198,14 @@ int pmbtoken_exp1_issuer_key_from_bytes(PMBTOKEN_ISSUER_KEY *key,
|
||||
return pmbtoken_issuer_key_from_bytes(&pmbtoken_exp1_method, key, in, len);
|
||||
}
|
||||
|
||||
STACK_OF(PMBTOKEN_PRETOKEN) * pmbtoken_exp1_blind(CBB *cbb, size_t count) {
|
||||
STACK_OF(TRUST_TOKEN_PRETOKEN) * pmbtoken_exp1_blind(CBB *cbb, size_t count) {
|
||||
if (!pmbtoken_exp1_init_method()) {
|
||||
return NULL;
|
||||
}
|
||||
return pmbtoken_blind(&pmbtoken_exp1_method, cbb, count);
|
||||
}
|
||||
|
||||
int pmbtoken_exp1_sign(const PMBTOKEN_ISSUER_KEY *key, CBB *cbb, CBS *cbs,
|
||||
int pmbtoken_exp1_sign(const TRUST_TOKEN_ISSUER_KEY *key, CBB *cbb, CBS *cbs,
|
||||
size_t num_requested, size_t num_to_issue,
|
||||
uint8_t private_metadata) {
|
||||
if (!pmbtoken_exp1_init_method()) {
|
||||
@@ -1216,8 +1216,8 @@ int pmbtoken_exp1_sign(const PMBTOKEN_ISSUER_KEY *key, CBB *cbb, CBS *cbs,
|
||||
}
|
||||
|
||||
STACK_OF(TRUST_TOKEN) *
|
||||
pmbtoken_exp1_unblind(const PMBTOKEN_CLIENT_KEY *key,
|
||||
const STACK_OF(PMBTOKEN_PRETOKEN) * pretokens,
|
||||
pmbtoken_exp1_unblind(const TRUST_TOKEN_CLIENT_KEY *key,
|
||||
const STACK_OF(TRUST_TOKEN_PRETOKEN) * pretokens,
|
||||
CBS *cbs, size_t count, uint32_t key_id) {
|
||||
if (!pmbtoken_exp1_init_method()) {
|
||||
return NULL;
|
||||
@@ -1226,8 +1226,8 @@ STACK_OF(TRUST_TOKEN) *
|
||||
key_id);
|
||||
}
|
||||
|
||||
int pmbtoken_exp1_read(const PMBTOKEN_ISSUER_KEY *key,
|
||||
uint8_t out_nonce[PMBTOKEN_NONCE_SIZE],
|
||||
int pmbtoken_exp1_read(const TRUST_TOKEN_ISSUER_KEY *key,
|
||||
uint8_t out_nonce[TRUST_TOKEN_NONCE_SIZE],
|
||||
uint8_t *out_private_metadata, const uint8_t *token,
|
||||
size_t token_len) {
|
||||
if (!pmbtoken_exp1_init_method()) {
|
||||
@@ -1251,15 +1251,15 @@ int pmbtoken_exp1_get_h_for_testing(uint8_t out[97]) {
|
||||
// PMBTokens experiment v2.
|
||||
|
||||
static int pmbtoken_exp2_hash_t(const EC_GROUP *group, EC_RAW_POINT *out,
|
||||
const uint8_t t[PMBTOKEN_NONCE_SIZE]) {
|
||||
const uint8_t t[TRUST_TOKEN_NONCE_SIZE]) {
|
||||
const uint8_t kHashTLabel[] = "PMBTokens Experiment V2 HashT";
|
||||
return ec_hash_to_curve_p384_xmd_sha512_sswu_draft07(
|
||||
group, out, kHashTLabel, sizeof(kHashTLabel), t, PMBTOKEN_NONCE_SIZE);
|
||||
group, out, kHashTLabel, sizeof(kHashTLabel), t, TRUST_TOKEN_NONCE_SIZE);
|
||||
}
|
||||
|
||||
static int pmbtoken_exp2_hash_s(const EC_GROUP *group, EC_RAW_POINT *out,
|
||||
const EC_AFFINE *t,
|
||||
const uint8_t s[PMBTOKEN_NONCE_SIZE]) {
|
||||
const uint8_t s[TRUST_TOKEN_NONCE_SIZE]) {
|
||||
const uint8_t kHashSLabel[] = "PMBTokens Experiment V2 HashS";
|
||||
int ret = 0;
|
||||
CBB cbb;
|
||||
@@ -1267,7 +1267,7 @@ static int pmbtoken_exp2_hash_s(const EC_GROUP *group, EC_RAW_POINT *out,
|
||||
size_t len;
|
||||
if (!CBB_init(&cbb, 0) ||
|
||||
!point_to_cbb(&cbb, group, t) ||
|
||||
!CBB_add_bytes(&cbb, s, PMBTOKEN_NONCE_SIZE) ||
|
||||
!CBB_add_bytes(&cbb, s, TRUST_TOKEN_NONCE_SIZE) ||
|
||||
!CBB_finish(&cbb, &buf, &len) ||
|
||||
!ec_hash_to_curve_p384_xmd_sha512_sswu_draft07(
|
||||
group, out, kHashSLabel, sizeof(kHashSLabel), buf, len)) {
|
||||
@@ -1332,7 +1332,7 @@ int pmbtoken_exp2_generate_key(CBB *out_private, CBB *out_public) {
|
||||
return pmbtoken_generate_key(&pmbtoken_exp2_method, out_private, out_public);
|
||||
}
|
||||
|
||||
int pmbtoken_exp2_client_key_from_bytes(PMBTOKEN_CLIENT_KEY *key,
|
||||
int pmbtoken_exp2_client_key_from_bytes(TRUST_TOKEN_CLIENT_KEY *key,
|
||||
const uint8_t *in, size_t len) {
|
||||
if (!pmbtoken_exp2_init_method()) {
|
||||
return 0;
|
||||
@@ -1340,7 +1340,7 @@ int pmbtoken_exp2_client_key_from_bytes(PMBTOKEN_CLIENT_KEY *key,
|
||||
return pmbtoken_client_key_from_bytes(&pmbtoken_exp2_method, key, in, len);
|
||||
}
|
||||
|
||||
int pmbtoken_exp2_issuer_key_from_bytes(PMBTOKEN_ISSUER_KEY *key,
|
||||
int pmbtoken_exp2_issuer_key_from_bytes(TRUST_TOKEN_ISSUER_KEY *key,
|
||||
const uint8_t *in, size_t len) {
|
||||
if (!pmbtoken_exp2_init_method()) {
|
||||
return 0;
|
||||
@@ -1348,14 +1348,14 @@ int pmbtoken_exp2_issuer_key_from_bytes(PMBTOKEN_ISSUER_KEY *key,
|
||||
return pmbtoken_issuer_key_from_bytes(&pmbtoken_exp2_method, key, in, len);
|
||||
}
|
||||
|
||||
STACK_OF(PMBTOKEN_PRETOKEN) * pmbtoken_exp2_blind(CBB *cbb, size_t count) {
|
||||
STACK_OF(TRUST_TOKEN_PRETOKEN) * pmbtoken_exp2_blind(CBB *cbb, size_t count) {
|
||||
if (!pmbtoken_exp2_init_method()) {
|
||||
return NULL;
|
||||
}
|
||||
return pmbtoken_blind(&pmbtoken_exp2_method, cbb, count);
|
||||
}
|
||||
|
||||
int pmbtoken_exp2_sign(const PMBTOKEN_ISSUER_KEY *key, CBB *cbb, CBS *cbs,
|
||||
int pmbtoken_exp2_sign(const TRUST_TOKEN_ISSUER_KEY *key, CBB *cbb, CBS *cbs,
|
||||
size_t num_requested, size_t num_to_issue,
|
||||
uint8_t private_metadata) {
|
||||
if (!pmbtoken_exp2_init_method()) {
|
||||
@@ -1366,8 +1366,8 @@ int pmbtoken_exp2_sign(const PMBTOKEN_ISSUER_KEY *key, CBB *cbb, CBS *cbs,
|
||||
}
|
||||
|
||||
STACK_OF(TRUST_TOKEN) *
|
||||
pmbtoken_exp2_unblind(const PMBTOKEN_CLIENT_KEY *key,
|
||||
const STACK_OF(PMBTOKEN_PRETOKEN) * pretokens,
|
||||
pmbtoken_exp2_unblind(const TRUST_TOKEN_CLIENT_KEY *key,
|
||||
const STACK_OF(TRUST_TOKEN_PRETOKEN) * pretokens,
|
||||
CBS *cbs, size_t count, uint32_t key_id) {
|
||||
if (!pmbtoken_exp2_init_method()) {
|
||||
return NULL;
|
||||
@@ -1376,8 +1376,8 @@ STACK_OF(TRUST_TOKEN) *
|
||||
key_id);
|
||||
}
|
||||
|
||||
int pmbtoken_exp2_read(const PMBTOKEN_ISSUER_KEY *key,
|
||||
uint8_t out_nonce[PMBTOKEN_NONCE_SIZE],
|
||||
int pmbtoken_exp2_read(const TRUST_TOKEN_ISSUER_KEY *key,
|
||||
uint8_t out_nonce[TRUST_TOKEN_NONCE_SIZE],
|
||||
uint8_t *out_private_metadata, const uint8_t *token,
|
||||
size_t token_len) {
|
||||
if (!pmbtoken_exp2_init_method()) {
|
||||
|
||||
@@ -43,15 +43,15 @@ const TRUST_TOKEN_METHOD *TRUST_TOKEN_experiment_v1(void) {
|
||||
return &kMethod;
|
||||
}
|
||||
|
||||
const TRUST_TOKEN_METHOD *TRUST_TOKEN_experiment_v2_pp(void) {
|
||||
const TRUST_TOKEN_METHOD *TRUST_TOKEN_experiment_v2_voprf(void) {
|
||||
static const TRUST_TOKEN_METHOD kMethod = {
|
||||
pmbtoken_exp2_generate_key,
|
||||
pmbtoken_exp2_client_key_from_bytes,
|
||||
pmbtoken_exp2_issuer_key_from_bytes,
|
||||
pmbtoken_exp2_blind,
|
||||
pmbtoken_exp2_sign,
|
||||
pmbtoken_exp2_unblind,
|
||||
pmbtoken_exp2_read,
|
||||
voprf_exp2_generate_key,
|
||||
voprf_exp2_client_key_from_bytes,
|
||||
voprf_exp2_issuer_key_from_bytes,
|
||||
voprf_exp2_blind,
|
||||
voprf_exp2_sign,
|
||||
voprf_exp2_unblind,
|
||||
voprf_exp2_read,
|
||||
0, /* has_private_metadata */
|
||||
6, /* max_keys */
|
||||
0, /* has_srr */
|
||||
@@ -75,6 +75,10 @@ const TRUST_TOKEN_METHOD *TRUST_TOKEN_experiment_v2_pmb(void) {
|
||||
return &kMethod;
|
||||
}
|
||||
|
||||
void TRUST_TOKEN_PRETOKEN_free(TRUST_TOKEN_PRETOKEN *pretoken) {
|
||||
OPENSSL_free(pretoken);
|
||||
}
|
||||
|
||||
TRUST_TOKEN *TRUST_TOKEN_new(const uint8_t *data, size_t len) {
|
||||
TRUST_TOKEN *ret = OPENSSL_malloc(sizeof(TRUST_TOKEN));
|
||||
if (ret == NULL) {
|
||||
@@ -160,7 +164,7 @@ void TRUST_TOKEN_CLIENT_free(TRUST_TOKEN_CLIENT *ctx) {
|
||||
return;
|
||||
}
|
||||
EVP_PKEY_free(ctx->srr_key);
|
||||
sk_PMBTOKEN_PRETOKEN_pop_free(ctx->pretokens, PMBTOKEN_PRETOKEN_free);
|
||||
sk_TRUST_TOKEN_PRETOKEN_pop_free(ctx->pretokens, TRUST_TOKEN_PRETOKEN_free);
|
||||
OPENSSL_free(ctx);
|
||||
}
|
||||
|
||||
@@ -206,7 +210,7 @@ int TRUST_TOKEN_CLIENT_begin_issuance(TRUST_TOKEN_CLIENT *ctx, uint8_t **out,
|
||||
|
||||
int ret = 0;
|
||||
CBB request;
|
||||
STACK_OF(PMBTOKEN_PRETOKEN) *pretokens = NULL;
|
||||
STACK_OF(TRUST_TOKEN_PRETOKEN) *pretokens = NULL;
|
||||
if (!CBB_init(&request, 0) ||
|
||||
!CBB_add_u16(&request, count)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, ERR_R_MALLOC_FAILURE);
|
||||
@@ -223,14 +227,14 @@ int TRUST_TOKEN_CLIENT_begin_issuance(TRUST_TOKEN_CLIENT *ctx, uint8_t **out,
|
||||
goto err;
|
||||
}
|
||||
|
||||
sk_PMBTOKEN_PRETOKEN_pop_free(ctx->pretokens, PMBTOKEN_PRETOKEN_free);
|
||||
sk_TRUST_TOKEN_PRETOKEN_pop_free(ctx->pretokens, TRUST_TOKEN_PRETOKEN_free);
|
||||
ctx->pretokens = pretokens;
|
||||
pretokens = NULL;
|
||||
ret = 1;
|
||||
|
||||
err:
|
||||
CBB_cleanup(&request);
|
||||
sk_PMBTOKEN_PRETOKEN_pop_free(pretokens, PMBTOKEN_PRETOKEN_free);
|
||||
sk_TRUST_TOKEN_PRETOKEN_pop_free(pretokens, TRUST_TOKEN_PRETOKEN_free);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -264,7 +268,7 @@ STACK_OF(TRUST_TOKEN) *
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (count > sk_PMBTOKEN_PRETOKEN_num(ctx->pretokens)) {
|
||||
if (count > sk_TRUST_TOKEN_PRETOKEN_num(ctx->pretokens)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, TRUST_TOKEN_R_DECODE_FAILURE);
|
||||
return NULL;
|
||||
}
|
||||
@@ -281,7 +285,7 @@ STACK_OF(TRUST_TOKEN) *
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sk_PMBTOKEN_PRETOKEN_pop_free(ctx->pretokens, PMBTOKEN_PRETOKEN_free);
|
||||
sk_TRUST_TOKEN_PRETOKEN_pop_free(ctx->pretokens, TRUST_TOKEN_PRETOKEN_free);
|
||||
ctx->pretokens = NULL;
|
||||
|
||||
*out_key_index = key_index;
|
||||
@@ -299,7 +303,7 @@ int TRUST_TOKEN_CLIENT_begin_redemption(TRUST_TOKEN_CLIENT *ctx, uint8_t **out,
|
||||
!CBB_add_bytes(&token_inner, token->data, token->len) ||
|
||||
!CBB_add_u16_length_prefixed(&request, &inner) ||
|
||||
!CBB_add_bytes(&inner, data, data_len) ||
|
||||
!CBB_add_u64(&request, time) ||
|
||||
(ctx->method->has_srr && !CBB_add_u64(&request, time)) ||
|
||||
!CBB_finish(&request, out, out_len)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, ERR_R_MALLOC_FAILURE);
|
||||
CBB_cleanup(&request);
|
||||
@@ -315,30 +319,39 @@ int TRUST_TOKEN_CLIENT_finish_redemption(TRUST_TOKEN_CLIENT *ctx,
|
||||
size_t response_len) {
|
||||
CBS in, srr, sig;
|
||||
CBS_init(&in, response, response_len);
|
||||
if (!ctx->method->has_srr) {
|
||||
if (!CBS_stow(&in, out_rr, out_rr_len)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
*out_sig = NULL;
|
||||
*out_sig_len = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!CBS_get_u16_length_prefixed(&in, &srr) ||
|
||||
!CBS_get_u16_length_prefixed(&in, &sig)) {
|
||||
!CBS_get_u16_length_prefixed(&in, &sig) ||
|
||||
CBS_len(&in) != 0) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, TRUST_TOKEN_R_DECODE_ERROR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ctx->method->has_srr) {
|
||||
if (ctx->srr_key == NULL) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, TRUST_TOKEN_R_NO_SRR_KEY_CONFIGURED);
|
||||
return 0;
|
||||
}
|
||||
if (ctx->srr_key == NULL) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, TRUST_TOKEN_R_NO_SRR_KEY_CONFIGURED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
EVP_MD_CTX md_ctx;
|
||||
EVP_MD_CTX_init(&md_ctx);
|
||||
int sig_ok =
|
||||
EVP_DigestVerifyInit(&md_ctx, NULL, NULL, NULL, ctx->srr_key) &&
|
||||
EVP_DigestVerify(&md_ctx, CBS_data(&sig), CBS_len(&sig), CBS_data(&srr),
|
||||
CBS_len(&srr));
|
||||
EVP_MD_CTX_cleanup(&md_ctx);
|
||||
EVP_MD_CTX md_ctx;
|
||||
EVP_MD_CTX_init(&md_ctx);
|
||||
int sig_ok = EVP_DigestVerifyInit(&md_ctx, NULL, NULL, NULL, ctx->srr_key) &&
|
||||
EVP_DigestVerify(&md_ctx, CBS_data(&sig), CBS_len(&sig),
|
||||
CBS_data(&srr), CBS_len(&srr));
|
||||
EVP_MD_CTX_cleanup(&md_ctx);
|
||||
|
||||
if (!sig_ok) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, TRUST_TOKEN_R_SRR_SIGNATURE_ERROR);
|
||||
return 0;
|
||||
}
|
||||
if (!sig_ok) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, TRUST_TOKEN_R_SRR_SIGNATURE_ERROR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t *srr_buf = NULL, *sig_buf = NULL;
|
||||
@@ -505,6 +518,72 @@ err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int TRUST_TOKEN_ISSUER_redeem_raw(const TRUST_TOKEN_ISSUER *ctx,
|
||||
uint32_t *out_public, uint8_t *out_private,
|
||||
TRUST_TOKEN **out_token,
|
||||
uint8_t **out_client_data,
|
||||
size_t *out_client_data_len,
|
||||
const uint8_t *request, size_t request_len) {
|
||||
CBS request_cbs, token_cbs;
|
||||
CBS_init(&request_cbs, request, request_len);
|
||||
if (!CBS_get_u16_length_prefixed(&request_cbs, &token_cbs)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, TRUST_TOKEN_R_DECODE_ERROR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t public_metadata = 0;
|
||||
uint8_t private_metadata = 0;
|
||||
|
||||
// Parse the token. If there is an error, treat it as an invalid token.
|
||||
if (!CBS_get_u32(&token_cbs, &public_metadata)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, TRUST_TOKEN_R_INVALID_TOKEN);
|
||||
return 0;
|
||||
}
|
||||
|
||||
const struct trust_token_issuer_key_st *key =
|
||||
trust_token_issuer_get_key(ctx, public_metadata);
|
||||
uint8_t nonce[TRUST_TOKEN_NONCE_SIZE];
|
||||
if (key == NULL ||
|
||||
!ctx->method->read(&key->key, nonce, &private_metadata,
|
||||
CBS_data(&token_cbs), CBS_len(&token_cbs))) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, TRUST_TOKEN_R_INVALID_TOKEN);
|
||||
return 0;
|
||||
}
|
||||
|
||||
CBS client_data;
|
||||
if (!CBS_get_u16_length_prefixed(&request_cbs, &client_data) ||
|
||||
(ctx->method->has_srr && !CBS_skip(&request_cbs, 8)) ||
|
||||
CBS_len(&request_cbs) != 0) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, TRUST_TOKEN_R_DECODE_ERROR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t *client_data_buf = NULL;
|
||||
size_t client_data_len = 0;
|
||||
if (!CBS_stow(&client_data, &client_data_buf, &client_data_len)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
|
||||
TRUST_TOKEN *token = TRUST_TOKEN_new(nonce, TRUST_TOKEN_NONCE_SIZE);
|
||||
if (token == NULL) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
*out_public = public_metadata;
|
||||
*out_private = private_metadata;
|
||||
*out_token = token;
|
||||
*out_client_data = client_data_buf;
|
||||
*out_client_data_len = client_data_len;
|
||||
|
||||
return 1;
|
||||
|
||||
err:
|
||||
OPENSSL_free(client_data_buf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// https://tools.ietf.org/html/rfc7049#section-2.1
|
||||
static int add_cbor_int_with_type(CBB *cbb, uint8_t major_type,
|
||||
uint64_t value) {
|
||||
@@ -588,7 +667,7 @@ int TRUST_TOKEN_ISSUER_redeem(const TRUST_TOKEN_ISSUER *ctx, uint8_t **out,
|
||||
|
||||
const struct trust_token_issuer_key_st *key =
|
||||
trust_token_issuer_get_key(ctx, public_metadata);
|
||||
uint8_t nonce[PMBTOKEN_NONCE_SIZE];
|
||||
uint8_t nonce[TRUST_TOKEN_NONCE_SIZE];
|
||||
if (key == NULL ||
|
||||
!ctx->method->read(&key->key, nonce, &private_metadata,
|
||||
CBS_data(&token_cbs), CBS_len(&token_cbs))) {
|
||||
@@ -609,9 +688,9 @@ int TRUST_TOKEN_ISSUER_redeem(const TRUST_TOKEN_ISSUER *ctx, uint8_t **out,
|
||||
}
|
||||
|
||||
CBS client_data;
|
||||
uint64_t redemption_time;
|
||||
uint64_t redemption_time = 0;
|
||||
if (!CBS_get_u16_length_prefixed(&request_cbs, &client_data) ||
|
||||
!CBS_get_u64(&request_cbs, &redemption_time)) {
|
||||
(ctx->method->has_srr && !CBS_get_u64(&request_cbs, &redemption_time))) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, TRUST_TOKEN_R_DECODE_ERROR);
|
||||
goto err;
|
||||
}
|
||||
@@ -630,6 +709,19 @@ int TRUST_TOKEN_ISSUER_redeem(const TRUST_TOKEN_ISSUER *ctx, uint8_t **out,
|
||||
// The SRR is constructed as per the format described in
|
||||
// https://docs.google.com/document/d/1TNnya6B8pyomDK2F1R9CL3dY10OAmqWlnCxsWyOBDVQ/edit#heading=h.7mkzvhpqb8l5
|
||||
|
||||
// The V2 protocol is intended to be used with
|
||||
// |TRUST_TOKEN_ISSUER_redeem_raw|. However, we temporarily support it with
|
||||
// |TRUST_TOKEN_ISSUER_redeem| to ease the transition for existing issuer
|
||||
// callers. Those callers' consumers currently expect an expiry-timestamp
|
||||
// field, so we fill in a placeholder value.
|
||||
//
|
||||
// TODO(svaldez): After the existing issues have migrated to
|
||||
// |TRUST_TOKEN_ISSUER_redeem_raw| remove this logic.
|
||||
uint64_t expiry_time = 0;
|
||||
if (ctx->method->has_srr) {
|
||||
expiry_time = redemption_time + lifetime;
|
||||
}
|
||||
|
||||
static const char kClientDataLabel[] = "client-data";
|
||||
static const char kExpiryTimestampLabel[] = "expiry-timestamp";
|
||||
static const char kMetadataLabel[] = "metadata";
|
||||
@@ -660,7 +752,7 @@ int TRUST_TOKEN_ISSUER_redeem(const TRUST_TOKEN_ISSUER *ctx, uint8_t **out,
|
||||
!CBB_add_bytes(&srr, CBS_data(&client_data), CBS_len(&client_data)) ||
|
||||
!add_cbor_text(&srr, kExpiryTimestampLabel,
|
||||
strlen(kExpiryTimestampLabel)) ||
|
||||
!add_cbor_int(&srr, redemption_time + lifetime) ||
|
||||
!add_cbor_int(&srr, expiry_time) ||
|
||||
!CBB_finish(&srr, &srr_buf, &srr_len)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
@@ -672,16 +764,56 @@ int TRUST_TOKEN_ISSUER_redeem(const TRUST_TOKEN_ISSUER *ctx, uint8_t **out,
|
||||
goto err;
|
||||
}
|
||||
|
||||
CBB child;
|
||||
uint8_t *ptr;
|
||||
if (!CBB_add_u16_length_prefixed(&response, &child) ||
|
||||
!CBB_add_bytes(&child, srr_buf, srr_len) ||
|
||||
!CBB_add_u16_length_prefixed(&response, &child) ||
|
||||
!CBB_reserve(&child, &ptr, sig_len) ||
|
||||
!EVP_DigestSign(&md_ctx, ptr, &sig_len, srr_buf, srr_len) ||
|
||||
!CBB_did_write(&child, sig_len)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
// Merge SRR and Signature into single string.
|
||||
// TODO(svaldez): Expose API to construct this from the caller.
|
||||
if (!ctx->method->has_srr) {
|
||||
static const char kSRRHeader[] = "body=:";
|
||||
static const char kSRRSplit[] = ":, signature=:";
|
||||
static const char kSRREnd[] = ":";
|
||||
|
||||
size_t srr_b64_len, sig_b64_len;
|
||||
if (!EVP_EncodedLength(&srr_b64_len, srr_len) ||
|
||||
!EVP_EncodedLength(&sig_b64_len, sig_len)) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
sig_buf = OPENSSL_malloc(sig_len);
|
||||
uint8_t *srr_b64_buf = OPENSSL_malloc(srr_b64_len);
|
||||
uint8_t *sig_b64_buf = OPENSSL_malloc(sig_b64_len);
|
||||
if (!sig_buf ||
|
||||
!srr_b64_buf ||
|
||||
!sig_b64_buf ||
|
||||
!EVP_DigestSign(&md_ctx, sig_buf, &sig_len, srr_buf, srr_len) ||
|
||||
!CBB_add_bytes(&response, (const uint8_t *)kSRRHeader,
|
||||
strlen(kSRRHeader)) ||
|
||||
!CBB_add_bytes(&response, srr_b64_buf,
|
||||
EVP_EncodeBlock(srr_b64_buf, srr_buf, srr_len)) ||
|
||||
!CBB_add_bytes(&response, (const uint8_t *)kSRRSplit,
|
||||
strlen(kSRRSplit)) ||
|
||||
!CBB_add_bytes(&response, sig_b64_buf,
|
||||
EVP_EncodeBlock(sig_b64_buf, sig_buf, sig_len)) ||
|
||||
!CBB_add_bytes(&response, (const uint8_t *)kSRREnd, strlen(kSRREnd))) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, ERR_R_MALLOC_FAILURE);
|
||||
OPENSSL_free(srr_b64_buf);
|
||||
OPENSSL_free(sig_b64_buf);
|
||||
goto err;
|
||||
}
|
||||
|
||||
OPENSSL_free(srr_b64_buf);
|
||||
OPENSSL_free(sig_b64_buf);
|
||||
} else {
|
||||
CBB child;
|
||||
uint8_t *ptr;
|
||||
if (!CBB_add_u16_length_prefixed(&response, &child) ||
|
||||
!CBB_add_bytes(&child, srr_buf, srr_len) ||
|
||||
!CBB_add_u16_length_prefixed(&response, &child) ||
|
||||
!CBB_reserve(&child, &ptr, sig_len) ||
|
||||
!EVP_DigestSign(&md_ctx, ptr, &sig_len, srr_buf, srr_len) ||
|
||||
!CBB_did_write(&child, sig_len) ||
|
||||
!CBB_flush(&response)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
if (!CBS_stow(&client_data, &client_data_buf, &client_data_len) ||
|
||||
@@ -690,7 +822,7 @@ int TRUST_TOKEN_ISSUER_redeem(const TRUST_TOKEN_ISSUER *ctx, uint8_t **out,
|
||||
goto err;
|
||||
}
|
||||
|
||||
TRUST_TOKEN *token = TRUST_TOKEN_new(nonce, PMBTOKEN_NONCE_SIZE);
|
||||
TRUST_TOKEN *token = TRUST_TOKEN_new(nonce, TRUST_TOKEN_NONCE_SIZE);
|
||||
if (token == NULL) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
|
||||
@@ -0,0 +1,766 @@
|
||||
/* Copyright (c) 2020, Google Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
|
||||
|
||||
#include <CCryptoBoringSSL_trust_token.h>
|
||||
|
||||
#include <CCryptoBoringSSL_bn.h>
|
||||
#include <CCryptoBoringSSL_bytestring.h>
|
||||
#include <CCryptoBoringSSL_ec.h>
|
||||
#include <CCryptoBoringSSL_err.h>
|
||||
#include <CCryptoBoringSSL_mem.h>
|
||||
#include <CCryptoBoringSSL_nid.h>
|
||||
#include <CCryptoBoringSSL_rand.h>
|
||||
|
||||
#include "../ec_extra/internal.h"
|
||||
#include "../fipsmodule/ec/internal.h"
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
typedef int (*hash_to_group_func_t)(const EC_GROUP *group, EC_RAW_POINT *out,
|
||||
const uint8_t t[TRUST_TOKEN_NONCE_SIZE]);
|
||||
typedef int (*hash_to_scalar_func_t)(const EC_GROUP *group, EC_SCALAR *out,
|
||||
uint8_t *buf, size_t len);
|
||||
|
||||
typedef struct {
|
||||
const EC_GROUP *group;
|
||||
|
||||
// hash_to_group implements the HashToGroup operation for VOPRFs. It returns
|
||||
// one on success and zero on error.
|
||||
hash_to_group_func_t hash_to_group;
|
||||
// hash_to_scalar implements the HashToScalar operation for VOPRFs. It returns
|
||||
// one on success and zero on error.
|
||||
hash_to_scalar_func_t hash_to_scalar;
|
||||
} VOPRF_METHOD;
|
||||
|
||||
static const uint8_t kDefaultAdditionalData[32] = {0};
|
||||
|
||||
static int voprf_init_method(VOPRF_METHOD *method, int curve_nid,
|
||||
hash_to_group_func_t hash_to_group,
|
||||
hash_to_scalar_func_t hash_to_scalar) {
|
||||
method->group = EC_GROUP_new_by_curve_name(curve_nid);
|
||||
if (method->group == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
method->hash_to_group = hash_to_group;
|
||||
method->hash_to_scalar = hash_to_scalar;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int cbb_add_point(CBB *out, const EC_GROUP *group,
|
||||
const EC_AFFINE *point) {
|
||||
size_t len =
|
||||
ec_point_to_bytes(group, point, POINT_CONVERSION_UNCOMPRESSED, NULL, 0);
|
||||
if (len == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t *p;
|
||||
return CBB_add_space(out, &p, len) &&
|
||||
ec_point_to_bytes(group, point, POINT_CONVERSION_UNCOMPRESSED, p,
|
||||
len) == len &&
|
||||
CBB_flush(out);
|
||||
}
|
||||
|
||||
static int cbs_get_point(CBS *cbs, const EC_GROUP *group, EC_AFFINE *out) {
|
||||
CBS child;
|
||||
size_t plen = 1 + 2 * BN_num_bytes(&group->field);
|
||||
if (!CBS_get_bytes(cbs, &child, plen) ||
|
||||
!ec_point_from_uncompressed(group, out, CBS_data(&child),
|
||||
CBS_len(&child))) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int scalar_to_cbb(CBB *out, const EC_GROUP *group,
|
||||
const EC_SCALAR *scalar) {
|
||||
uint8_t *buf;
|
||||
size_t scalar_len = BN_num_bytes(&group->order);
|
||||
if (!CBB_add_space(out, &buf, scalar_len)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
ec_scalar_to_bytes(group, buf, &scalar_len, scalar);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int scalar_from_cbs(CBS *cbs, const EC_GROUP *group, EC_SCALAR *out) {
|
||||
size_t scalar_len = BN_num_bytes(&group->order);
|
||||
CBS tmp;
|
||||
if (!CBS_get_bytes(cbs, &tmp, scalar_len)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, TRUST_TOKEN_R_DECODE_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ec_scalar_from_bytes(group, out, CBS_data(&tmp), CBS_len(&tmp));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int voprf_generate_key(const VOPRF_METHOD *method, CBB *out_private,
|
||||
CBB *out_public) {
|
||||
const EC_GROUP *group = method->group;
|
||||
EC_RAW_POINT pub;
|
||||
EC_SCALAR priv;
|
||||
EC_AFFINE pub_affine;
|
||||
if (!ec_random_nonzero_scalar(group, &priv, kDefaultAdditionalData) ||
|
||||
!ec_point_mul_scalar_base(group, &pub, &priv) ||
|
||||
!ec_jacobian_to_affine(group, &pub_affine, &pub)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, TRUST_TOKEN_R_KEYGEN_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!scalar_to_cbb(out_private, group, &priv) ||
|
||||
!cbb_add_point(out_public, group, &pub_affine)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, TRUST_TOKEN_R_BUFFER_TOO_SMALL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int voprf_client_key_from_bytes(const VOPRF_METHOD *method,
|
||||
TRUST_TOKEN_CLIENT_KEY *key,
|
||||
const uint8_t *in, size_t len) {
|
||||
const EC_GROUP *group = method->group;
|
||||
if (!ec_point_from_uncompressed(group, &key->pubs, in, len)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, TRUST_TOKEN_R_DECODE_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int voprf_issuer_key_from_bytes(const VOPRF_METHOD *method,
|
||||
TRUST_TOKEN_ISSUER_KEY *key,
|
||||
const uint8_t *in, size_t len) {
|
||||
const EC_GROUP *group = method->group;
|
||||
if (!ec_scalar_from_bytes(group, &key->xs, in, len)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, TRUST_TOKEN_R_DECODE_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Recompute the public key.
|
||||
EC_RAW_POINT pub;
|
||||
if (!ec_point_mul_scalar_base(group, &pub, &key->xs) ||
|
||||
!ec_jacobian_to_affine(group, &key->pubs, &pub)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static STACK_OF(TRUST_TOKEN_PRETOKEN) *
|
||||
voprf_blind(const VOPRF_METHOD *method, CBB *cbb, size_t count) {
|
||||
const EC_GROUP *group = method->group;
|
||||
STACK_OF(TRUST_TOKEN_PRETOKEN) *pretokens =
|
||||
sk_TRUST_TOKEN_PRETOKEN_new_null();
|
||||
if (pretokens == NULL) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
// Insert |pretoken| into |pretokens| early to simplify error-handling.
|
||||
TRUST_TOKEN_PRETOKEN *pretoken =
|
||||
OPENSSL_malloc(sizeof(TRUST_TOKEN_PRETOKEN));
|
||||
if (pretoken == NULL ||
|
||||
!sk_TRUST_TOKEN_PRETOKEN_push(pretokens, pretoken)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, ERR_R_MALLOC_FAILURE);
|
||||
TRUST_TOKEN_PRETOKEN_free(pretoken);
|
||||
goto err;
|
||||
}
|
||||
|
||||
RAND_bytes(pretoken->t, sizeof(pretoken->t));
|
||||
|
||||
// We sample r in Montgomery form to simplify inverting.
|
||||
EC_SCALAR r;
|
||||
if (!ec_random_nonzero_scalar(group, &r,
|
||||
kDefaultAdditionalData)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
|
||||
// pretoken->r is rinv.
|
||||
ec_scalar_inv0_montgomery(group, &pretoken->r, &r);
|
||||
// Convert both out of Montgomery form.
|
||||
ec_scalar_from_montgomery(group, &r, &r);
|
||||
ec_scalar_from_montgomery(group, &pretoken->r, &pretoken->r);
|
||||
|
||||
// Tp is the blinded token in the VOPRF protocol.
|
||||
EC_RAW_POINT P, Tp;
|
||||
if (!method->hash_to_group(group, &P, pretoken->t) ||
|
||||
!ec_point_mul_scalar(group, &Tp, &P, &r) ||
|
||||
!ec_jacobian_to_affine(group, &pretoken->Tp, &Tp)) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (!cbb_add_point(cbb, group, &pretoken->Tp)) {
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
return pretokens;
|
||||
|
||||
err:
|
||||
sk_TRUST_TOKEN_PRETOKEN_pop_free(pretokens, TRUST_TOKEN_PRETOKEN_free);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int hash_to_scalar_dleq(const VOPRF_METHOD *method, EC_SCALAR *out,
|
||||
const EC_AFFINE *X, const EC_AFFINE *T,
|
||||
const EC_AFFINE *W, const EC_AFFINE *K0,
|
||||
const EC_AFFINE *K1) {
|
||||
static const uint8_t kDLEQLabel[] = "DLEQ";
|
||||
|
||||
int ok = 0;
|
||||
CBB cbb;
|
||||
CBB_zero(&cbb);
|
||||
uint8_t *buf = NULL;
|
||||
size_t len;
|
||||
if (!CBB_init(&cbb, 0) ||
|
||||
!CBB_add_bytes(&cbb, kDLEQLabel, sizeof(kDLEQLabel)) ||
|
||||
!cbb_add_point(&cbb, method->group, X) ||
|
||||
!cbb_add_point(&cbb, method->group, T) ||
|
||||
!cbb_add_point(&cbb, method->group, W) ||
|
||||
!cbb_add_point(&cbb, method->group, K0) ||
|
||||
!cbb_add_point(&cbb, method->group, K1) ||
|
||||
!CBB_finish(&cbb, &buf, &len) ||
|
||||
!method->hash_to_scalar(method->group, out, buf, len)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
|
||||
ok = 1;
|
||||
|
||||
err:
|
||||
CBB_cleanup(&cbb);
|
||||
OPENSSL_free(buf);
|
||||
return ok;
|
||||
}
|
||||
|
||||
static int hash_to_scalar_batch(const VOPRF_METHOD *method, EC_SCALAR *out,
|
||||
const CBB *points, size_t index) {
|
||||
static const uint8_t kDLEQBatchLabel[] = "DLEQ BATCH";
|
||||
if (index > 0xffff) {
|
||||
// The protocol supports only two-byte batches.
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, ERR_R_OVERFLOW);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ok = 0;
|
||||
CBB cbb;
|
||||
CBB_zero(&cbb);
|
||||
uint8_t *buf = NULL;
|
||||
size_t len;
|
||||
if (!CBB_init(&cbb, 0) ||
|
||||
!CBB_add_bytes(&cbb, kDLEQBatchLabel, sizeof(kDLEQBatchLabel)) ||
|
||||
!CBB_add_bytes(&cbb, CBB_data(points), CBB_len(points)) ||
|
||||
!CBB_add_u16(&cbb, (uint16_t)index) ||
|
||||
!CBB_finish(&cbb, &buf, &len) ||
|
||||
!method->hash_to_scalar(method->group, out, buf, len)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
|
||||
ok = 1;
|
||||
|
||||
err:
|
||||
CBB_cleanup(&cbb);
|
||||
OPENSSL_free(buf);
|
||||
return ok;
|
||||
}
|
||||
|
||||
static int dleq_generate(const VOPRF_METHOD *method, CBB *cbb,
|
||||
const TRUST_TOKEN_ISSUER_KEY *priv,
|
||||
const EC_RAW_POINT *T, const EC_RAW_POINT *W) {
|
||||
const EC_GROUP *group = method->group;
|
||||
|
||||
enum {
|
||||
idx_T,
|
||||
idx_W,
|
||||
idx_k0,
|
||||
idx_k1,
|
||||
num_idx,
|
||||
};
|
||||
EC_RAW_POINT jacobians[num_idx];
|
||||
|
||||
// Setup the DLEQ proof.
|
||||
EC_SCALAR r;
|
||||
if (// r <- Zp
|
||||
!ec_random_nonzero_scalar(group, &r, kDefaultAdditionalData) ||
|
||||
// k0;k1 = r*(G;T)
|
||||
!ec_point_mul_scalar_base(group, &jacobians[idx_k0], &r) ||
|
||||
!ec_point_mul_scalar(group, &jacobians[idx_k1], T, &r)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
EC_AFFINE affines[num_idx];
|
||||
jacobians[idx_T] = *T;
|
||||
jacobians[idx_W] = *W;
|
||||
if (!ec_jacobian_to_affine_batch(group, affines, jacobians, num_idx)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Compute c = Hc(...).
|
||||
EC_SCALAR c;
|
||||
if (!hash_to_scalar_dleq(method, &c, &priv->pubs, &affines[idx_T],
|
||||
&affines[idx_W], &affines[idx_k0],
|
||||
&affines[idx_k1])) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
EC_SCALAR c_mont;
|
||||
ec_scalar_to_montgomery(group, &c_mont, &c);
|
||||
|
||||
// u = r + c*xs
|
||||
EC_SCALAR u;
|
||||
ec_scalar_mul_montgomery(group, &u, &priv->xs, &c_mont);
|
||||
ec_scalar_add(group, &u, &r, &u);
|
||||
|
||||
// Store DLEQ proof in transcript.
|
||||
if (!scalar_to_cbb(cbb, group, &c) ||
|
||||
!scalar_to_cbb(cbb, group, &u)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int mul_public_2(const EC_GROUP *group, EC_RAW_POINT *out,
|
||||
const EC_RAW_POINT *p0, const EC_SCALAR *scalar0,
|
||||
const EC_RAW_POINT *p1, const EC_SCALAR *scalar1) {
|
||||
EC_RAW_POINT points[2] = {*p0, *p1};
|
||||
EC_SCALAR scalars[2] = {*scalar0, *scalar1};
|
||||
return ec_point_mul_scalar_public_batch(group, out, /*g_scalar=*/NULL, points,
|
||||
scalars, 2);
|
||||
}
|
||||
|
||||
static int dleq_verify(const VOPRF_METHOD *method, CBS *cbs,
|
||||
const TRUST_TOKEN_CLIENT_KEY *pub, const EC_RAW_POINT *T,
|
||||
const EC_RAW_POINT *W) {
|
||||
const EC_GROUP *group = method->group;
|
||||
|
||||
|
||||
enum {
|
||||
idx_T,
|
||||
idx_W,
|
||||
idx_k0,
|
||||
idx_k1,
|
||||
num_idx,
|
||||
};
|
||||
EC_RAW_POINT jacobians[num_idx];
|
||||
|
||||
// Decode the DLEQ proof.
|
||||
EC_SCALAR c, u;
|
||||
if (!scalar_from_cbs(cbs, group, &c) ||
|
||||
!scalar_from_cbs(cbs, group, &u)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, TRUST_TOKEN_R_DECODE_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// k0;k1 = u*(G;T) - c*(pub;W)
|
||||
EC_RAW_POINT pubs;
|
||||
ec_affine_to_jacobian(group, &pubs, &pub->pubs);
|
||||
EC_SCALAR minus_c;
|
||||
ec_scalar_neg(group, &minus_c, &c);
|
||||
if (!ec_point_mul_scalar_public(group, &jacobians[idx_k0], &u, &pubs,
|
||||
&minus_c) ||
|
||||
!mul_public_2(group, &jacobians[idx_k1], T, &u, W, &minus_c)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Check the DLEQ proof.
|
||||
EC_AFFINE affines[num_idx];
|
||||
jacobians[idx_T] = *T;
|
||||
jacobians[idx_W] = *W;
|
||||
if (!ec_jacobian_to_affine_batch(group, affines, jacobians, num_idx)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Compute c = Hc(...).
|
||||
EC_SCALAR calculated;
|
||||
if (!hash_to_scalar_dleq(method, &calculated, &pub->pubs, &affines[idx_T],
|
||||
&affines[idx_W], &affines[idx_k0],
|
||||
&affines[idx_k1])) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// c == calculated
|
||||
if (!ec_scalar_equal_vartime(group, &c, &calculated)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, TRUST_TOKEN_R_INVALID_PROOF);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int voprf_sign(const VOPRF_METHOD *method,
|
||||
const TRUST_TOKEN_ISSUER_KEY *key, CBB *cbb, CBS *cbs,
|
||||
size_t num_requested, size_t num_to_issue) {
|
||||
const EC_GROUP *group = method->group;
|
||||
if (num_requested < num_to_issue) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, ERR_R_INTERNAL_ERROR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (num_to_issue > ((size_t)-1) / sizeof(EC_RAW_POINT) ||
|
||||
num_to_issue > ((size_t)-1) / sizeof(EC_SCALAR)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, ERR_R_OVERFLOW);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ret = 0;
|
||||
EC_RAW_POINT *BTs = OPENSSL_malloc(num_to_issue * sizeof(EC_RAW_POINT));
|
||||
EC_RAW_POINT *Zs = OPENSSL_malloc(num_to_issue * sizeof(EC_RAW_POINT));
|
||||
EC_SCALAR *es = OPENSSL_malloc(num_to_issue * sizeof(EC_SCALAR));
|
||||
CBB batch_cbb;
|
||||
CBB_zero(&batch_cbb);
|
||||
if (!BTs ||
|
||||
!Zs ||
|
||||
!es ||
|
||||
!CBB_init(&batch_cbb, 0) ||
|
||||
!cbb_add_point(&batch_cbb, method->group, &key->pubs)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < num_to_issue; i++) {
|
||||
EC_AFFINE BT_affine, Z_affine;
|
||||
EC_RAW_POINT BT, Z;
|
||||
if (!cbs_get_point(cbs, group, &BT_affine)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, TRUST_TOKEN_R_DECODE_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
ec_affine_to_jacobian(group, &BT, &BT_affine);
|
||||
if (!ec_point_mul_scalar(group, &Z, &BT, &key->xs) ||
|
||||
!ec_jacobian_to_affine(group, &Z_affine, &Z) ||
|
||||
!cbb_add_point(cbb, group, &Z_affine)) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (!cbb_add_point(&batch_cbb, group, &BT_affine) ||
|
||||
!cbb_add_point(&batch_cbb, group, &Z_affine)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
BTs[i] = BT;
|
||||
Zs[i] = Z;
|
||||
|
||||
if (!CBB_flush(cbb)) {
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
// The DLEQ batching construction is described in appendix B of
|
||||
// https://eprint.iacr.org/2020/072/20200324:214215. Note the additional
|
||||
// computations all act on public inputs.
|
||||
for (size_t i = 0; i < num_to_issue; i++) {
|
||||
if (!hash_to_scalar_batch(method, &es[i], &batch_cbb, i)) {
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
EC_RAW_POINT BT_batch, Z_batch;
|
||||
if (!ec_point_mul_scalar_public_batch(group, &BT_batch,
|
||||
/*g_scalar=*/NULL, BTs, es,
|
||||
num_to_issue) ||
|
||||
!ec_point_mul_scalar_public_batch(group, &Z_batch,
|
||||
/*g_scalar=*/NULL, Zs, es,
|
||||
num_to_issue)) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
CBB proof;
|
||||
if (!CBB_add_u16_length_prefixed(cbb, &proof) ||
|
||||
!dleq_generate(method, &proof, key, &BT_batch, &Z_batch) ||
|
||||
!CBB_flush(cbb)) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
// Skip over any unused requests.
|
||||
size_t point_len = 1 + 2 * BN_num_bytes(&group->field);
|
||||
if (!CBS_skip(cbs, point_len * (num_requested - num_to_issue))) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, TRUST_TOKEN_R_DECODE_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = 1;
|
||||
|
||||
err:
|
||||
OPENSSL_free(BTs);
|
||||
OPENSSL_free(Zs);
|
||||
OPENSSL_free(es);
|
||||
CBB_cleanup(&batch_cbb);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static STACK_OF(TRUST_TOKEN) *
|
||||
voprf_unblind(const VOPRF_METHOD *method, const TRUST_TOKEN_CLIENT_KEY *key,
|
||||
const STACK_OF(TRUST_TOKEN_PRETOKEN) * pretokens, CBS *cbs,
|
||||
size_t count, uint32_t key_id) {
|
||||
const EC_GROUP *group = method->group;
|
||||
if (count > sk_TRUST_TOKEN_PRETOKEN_num(pretokens)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, TRUST_TOKEN_R_DECODE_FAILURE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int ok = 0;
|
||||
STACK_OF(TRUST_TOKEN) *ret = sk_TRUST_TOKEN_new_null();
|
||||
if (ret == NULL) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, ERR_R_MALLOC_FAILURE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (count > ((size_t)-1) / sizeof(EC_RAW_POINT) ||
|
||||
count > ((size_t)-1) / sizeof(EC_SCALAR)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, ERR_R_OVERFLOW);
|
||||
return 0;
|
||||
}
|
||||
EC_RAW_POINT *BTs = OPENSSL_malloc(count * sizeof(EC_RAW_POINT));
|
||||
EC_RAW_POINT *Zs = OPENSSL_malloc(count * sizeof(EC_RAW_POINT));
|
||||
EC_SCALAR *es = OPENSSL_malloc(count * sizeof(EC_SCALAR));
|
||||
CBB batch_cbb;
|
||||
CBB_zero(&batch_cbb);
|
||||
if (!BTs ||
|
||||
!Zs ||
|
||||
!es ||
|
||||
!CBB_init(&batch_cbb, 0) ||
|
||||
!cbb_add_point(&batch_cbb, method->group, &key->pubs)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
const TRUST_TOKEN_PRETOKEN *pretoken =
|
||||
sk_TRUST_TOKEN_PRETOKEN_value(pretokens, i);
|
||||
|
||||
EC_AFFINE Z_affine;
|
||||
if (!cbs_get_point(cbs, group, &Z_affine)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, TRUST_TOKEN_R_DECODE_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
|
||||
ec_affine_to_jacobian(group, &BTs[i], &pretoken->Tp);
|
||||
ec_affine_to_jacobian(group, &Zs[i], &Z_affine);
|
||||
|
||||
if (!cbb_add_point(&batch_cbb, group, &pretoken->Tp) ||
|
||||
!cbb_add_point(&batch_cbb, group, &Z_affine)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
|
||||
// Unblind the token.
|
||||
// pretoken->r is rinv.
|
||||
EC_RAW_POINT N;
|
||||
EC_AFFINE N_affine;
|
||||
if (!ec_point_mul_scalar(group, &N, &Zs[i], &pretoken->r) ||
|
||||
!ec_jacobian_to_affine(group, &N_affine, &N)) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
// Serialize the token. Include |key_id| to avoid an extra copy in the layer
|
||||
// above.
|
||||
CBB token_cbb;
|
||||
size_t point_len = 1 + 2 * BN_num_bytes(&group->field);
|
||||
if (!CBB_init(&token_cbb, 4 + TRUST_TOKEN_NONCE_SIZE + (2 + point_len)) ||
|
||||
!CBB_add_u32(&token_cbb, key_id) ||
|
||||
!CBB_add_bytes(&token_cbb, pretoken->t, TRUST_TOKEN_NONCE_SIZE) ||
|
||||
!cbb_add_point(&token_cbb, group, &N_affine) ||
|
||||
!CBB_flush(&token_cbb)) {
|
||||
CBB_cleanup(&token_cbb);
|
||||
goto err;
|
||||
}
|
||||
|
||||
TRUST_TOKEN *token =
|
||||
TRUST_TOKEN_new(CBB_data(&token_cbb), CBB_len(&token_cbb));
|
||||
CBB_cleanup(&token_cbb);
|
||||
if (token == NULL ||
|
||||
!sk_TRUST_TOKEN_push(ret, token)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, ERR_R_MALLOC_FAILURE);
|
||||
TRUST_TOKEN_free(token);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
// The DLEQ batching construction is described in appendix B of
|
||||
// https://eprint.iacr.org/2020/072/20200324:214215. Note the additional
|
||||
// computations all act on public inputs.
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
if (!hash_to_scalar_batch(method, &es[i], &batch_cbb, i)) {
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
EC_RAW_POINT BT_batch, Z_batch;
|
||||
if (!ec_point_mul_scalar_public_batch(group, &BT_batch,
|
||||
/*g_scalar=*/NULL, BTs, es, count) ||
|
||||
!ec_point_mul_scalar_public_batch(group, &Z_batch,
|
||||
/*g_scalar=*/NULL, Zs, es, count)) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
CBS proof;
|
||||
if (!CBS_get_u16_length_prefixed(cbs, &proof) ||
|
||||
!dleq_verify(method, &proof, key, &BT_batch, &Z_batch) ||
|
||||
CBS_len(&proof) != 0) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
ok = 1;
|
||||
|
||||
err:
|
||||
OPENSSL_free(BTs);
|
||||
OPENSSL_free(Zs);
|
||||
OPENSSL_free(es);
|
||||
CBB_cleanup(&batch_cbb);
|
||||
if (!ok) {
|
||||
sk_TRUST_TOKEN_pop_free(ret, TRUST_TOKEN_free);
|
||||
ret = NULL;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int voprf_read(const VOPRF_METHOD *method,
|
||||
const TRUST_TOKEN_ISSUER_KEY *key,
|
||||
uint8_t out_nonce[TRUST_TOKEN_NONCE_SIZE],
|
||||
const uint8_t *token, size_t token_len) {
|
||||
const EC_GROUP *group = method->group;
|
||||
CBS cbs;
|
||||
CBS_init(&cbs, token, token_len);
|
||||
EC_AFFINE Ws;
|
||||
if (!CBS_copy_bytes(&cbs, out_nonce, TRUST_TOKEN_NONCE_SIZE) ||
|
||||
!cbs_get_point(&cbs, group, &Ws) ||
|
||||
CBS_len(&cbs) != 0) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, TRUST_TOKEN_R_INVALID_TOKEN);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
EC_RAW_POINT T;
|
||||
if (!method->hash_to_group(group, &T, out_nonce)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
EC_RAW_POINT Ws_calculated;
|
||||
if (!ec_point_mul_scalar(group, &Ws_calculated, &T, &key->xs) ||
|
||||
!ec_affine_jacobian_equal(group, &Ws, &Ws_calculated)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, TRUST_TOKEN_R_BAD_VALIDITY_CHECK);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// VOPRF experiment v2.
|
||||
|
||||
static int voprf_exp2_hash_to_group(const EC_GROUP *group, EC_RAW_POINT *out,
|
||||
const uint8_t t[TRUST_TOKEN_NONCE_SIZE]) {
|
||||
const uint8_t kHashTLabel[] = "TrustToken VOPRF Experiment V2 HashToGroup";
|
||||
return ec_hash_to_curve_p384_xmd_sha512_sswu_draft07(
|
||||
group, out, kHashTLabel, sizeof(kHashTLabel), t, TRUST_TOKEN_NONCE_SIZE);
|
||||
}
|
||||
|
||||
static int voprf_exp2_hash_to_scalar(const EC_GROUP *group, EC_SCALAR *out,
|
||||
uint8_t *buf, size_t len) {
|
||||
const uint8_t kHashCLabel[] = "TrustToken VOPRF Experiment V2 HashToScalar";
|
||||
return ec_hash_to_scalar_p384_xmd_sha512_draft07(
|
||||
group, out, kHashCLabel, sizeof(kHashCLabel), buf, len);
|
||||
}
|
||||
|
||||
static int voprf_exp2_ok = 0;
|
||||
static VOPRF_METHOD voprf_exp2_method;
|
||||
static CRYPTO_once_t voprf_exp2_method_once = CRYPTO_ONCE_INIT;
|
||||
|
||||
static void voprf_exp2_init_method_impl(void) {
|
||||
voprf_exp2_ok =
|
||||
voprf_init_method(&voprf_exp2_method, NID_secp384r1,
|
||||
voprf_exp2_hash_to_group, voprf_exp2_hash_to_scalar);
|
||||
}
|
||||
|
||||
static int voprf_exp2_init_method(void) {
|
||||
CRYPTO_once(&voprf_exp2_method_once, voprf_exp2_init_method_impl);
|
||||
if (!voprf_exp2_ok) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, ERR_R_INTERNAL_ERROR);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int voprf_exp2_generate_key(CBB *out_private, CBB *out_public) {
|
||||
if (!voprf_exp2_init_method()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return voprf_generate_key(&voprf_exp2_method, out_private, out_public);
|
||||
}
|
||||
|
||||
int voprf_exp2_client_key_from_bytes(TRUST_TOKEN_CLIENT_KEY *key,
|
||||
const uint8_t *in, size_t len) {
|
||||
if (!voprf_exp2_init_method()) {
|
||||
return 0;
|
||||
}
|
||||
return voprf_client_key_from_bytes(&voprf_exp2_method, key, in, len);
|
||||
}
|
||||
|
||||
int voprf_exp2_issuer_key_from_bytes(TRUST_TOKEN_ISSUER_KEY *key,
|
||||
const uint8_t *in, size_t len) {
|
||||
if (!voprf_exp2_init_method()) {
|
||||
return 0;
|
||||
}
|
||||
return voprf_issuer_key_from_bytes(&voprf_exp2_method, key, in, len);
|
||||
}
|
||||
|
||||
STACK_OF(TRUST_TOKEN_PRETOKEN) * voprf_exp2_blind(CBB *cbb, size_t count) {
|
||||
if (!voprf_exp2_init_method()) {
|
||||
return NULL;
|
||||
}
|
||||
return voprf_blind(&voprf_exp2_method, cbb, count);
|
||||
}
|
||||
|
||||
int voprf_exp2_sign(const TRUST_TOKEN_ISSUER_KEY *key, CBB *cbb, CBS *cbs,
|
||||
size_t num_requested, size_t num_to_issue,
|
||||
uint8_t private_metadata) {
|
||||
if (!voprf_exp2_init_method() || private_metadata != 0) {
|
||||
return 0;
|
||||
}
|
||||
return voprf_sign(&voprf_exp2_method, key, cbb, cbs, num_requested,
|
||||
num_to_issue);
|
||||
}
|
||||
|
||||
STACK_OF(TRUST_TOKEN) *
|
||||
voprf_exp2_unblind(const TRUST_TOKEN_CLIENT_KEY *key,
|
||||
const STACK_OF(TRUST_TOKEN_PRETOKEN) * pretokens,
|
||||
CBS *cbs, size_t count, uint32_t key_id) {
|
||||
if (!voprf_exp2_init_method()) {
|
||||
return NULL;
|
||||
}
|
||||
return voprf_unblind(&voprf_exp2_method, key, pretokens, cbs, count,
|
||||
key_id);
|
||||
}
|
||||
|
||||
int voprf_exp2_read(const TRUST_TOKEN_ISSUER_KEY *key,
|
||||
uint8_t out_nonce[TRUST_TOKEN_NONCE_SIZE],
|
||||
uint8_t *out_private_metadata, const uint8_t *token,
|
||||
size_t token_len) {
|
||||
if (!voprf_exp2_init_method()) {
|
||||
return 0;
|
||||
}
|
||||
return voprf_read(&voprf_exp2_method, key, out_nonce, token, token_len);
|
||||
}
|
||||
@@ -142,6 +142,16 @@ int x509_digest_verify_init(EVP_MD_CTX *ctx, X509_ALGOR *sigalg,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* The parameter should be an explicit NULL for RSA and omitted for ECDSA. For
|
||||
* compatibility, we allow either for both algorithms. See b/167375496.
|
||||
*
|
||||
* TODO(davidben): Chromium's verifier allows both forms for RSA, but enforces
|
||||
* ECDSA more strictly. Align with Chromium and add a flag for b/167375496. */
|
||||
if (sigalg->parameter != NULL && sigalg->parameter->type != V_ASN1_NULL) {
|
||||
OPENSSL_PUT_ERROR(X509, X509_R_INVALID_PARAMETER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Otherwise, initialize with the digest from the OID. */
|
||||
const EVP_MD *digest = EVP_get_digestbynid(digest_nid);
|
||||
if (digest == NULL) {
|
||||
|
||||
@@ -199,11 +199,15 @@ int x509_rsa_ctx_to_pss(EVP_MD_CTX *ctx, X509_ALGOR *algor) {
|
||||
if (saltlen == -1) {
|
||||
saltlen = EVP_MD_size(sigmd);
|
||||
} else if (saltlen == -2) {
|
||||
// TODO(davidben): Forbid this mode. The world has largely standardized on
|
||||
// salt length matching hash length.
|
||||
saltlen = EVP_PKEY_size(pk) - EVP_MD_size(sigmd) - 2;
|
||||
if (((EVP_PKEY_bits(pk) - 1) & 0x7) == 0) {
|
||||
saltlen--;
|
||||
}
|
||||
} else {
|
||||
} else if (saltlen != (int)EVP_MD_size(sigmd)) {
|
||||
// We only allow salt length matching hash length and, for now, the -2 case.
|
||||
OPENSSL_PUT_ERROR(X509, X509_R_INVALID_PSS_PARAMETERS);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ int X509_issuer_and_serial_cmp(const X509 *a, const X509 *b)
|
||||
|
||||
ai = a->cert_info;
|
||||
bi = b->cert_info;
|
||||
i = M_ASN1_INTEGER_cmp(ai->serialNumber, bi->serialNumber);
|
||||
i = ASN1_INTEGER_cmp(ai->serialNumber, bi->serialNumber);
|
||||
if (i)
|
||||
return (i);
|
||||
return (X509_NAME_cmp(ai->issuer, bi->issuer));
|
||||
|
||||
@@ -93,9 +93,10 @@ X509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc)
|
||||
return (X509v3_delete_ext(x->crl->extensions, loc));
|
||||
}
|
||||
|
||||
void *X509_CRL_get_ext_d2i(const X509_CRL *x, int nid, int *crit, int *idx)
|
||||
void *X509_CRL_get_ext_d2i(const X509_CRL *crl, int nid, int *out_critical,
|
||||
int *out_idx)
|
||||
{
|
||||
return X509V3_get_d2i(x->crl->extensions, nid, crit, idx);
|
||||
return X509V3_get_d2i(crl->crl->extensions, nid, out_critical, out_idx);
|
||||
}
|
||||
|
||||
int X509_CRL_add1_ext_i2d(X509_CRL *x, int nid, void *value, int crit,
|
||||
@@ -145,9 +146,11 @@ int X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc)
|
||||
return (X509v3_add_ext(&(x->cert_info->extensions), ex, loc) != NULL);
|
||||
}
|
||||
|
||||
void *X509_get_ext_d2i(const X509 *x, int nid, int *crit, int *idx)
|
||||
void *X509_get_ext_d2i(const X509 *x509, int nid, int *out_critical,
|
||||
int *out_idx)
|
||||
{
|
||||
return X509V3_get_d2i(x->cert_info->extensions, nid, crit, idx);
|
||||
return X509V3_get_d2i(x509->cert_info->extensions, nid, out_critical,
|
||||
out_idx);
|
||||
}
|
||||
|
||||
int X509_add1_ext_i2d(X509 *x, int nid, void *value, int crit,
|
||||
@@ -194,10 +197,10 @@ int X509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex, int loc)
|
||||
return (X509v3_add_ext(&(x->extensions), ex, loc) != NULL);
|
||||
}
|
||||
|
||||
void *X509_REVOKED_get_ext_d2i(const X509_REVOKED *x, int nid, int *crit,
|
||||
int *idx)
|
||||
void *X509_REVOKED_get_ext_d2i(const X509_REVOKED *revoked, int nid,
|
||||
int *out_critical, int *out_idx)
|
||||
{
|
||||
return X509V3_get_d2i(x->extensions, nid, crit, idx);
|
||||
return X509V3_get_d2i(revoked->extensions, nid, out_critical, out_idx);
|
||||
}
|
||||
|
||||
int X509_REVOKED_add1_ext_i2d(X509_REVOKED *x, int nid, void *value, int crit,
|
||||
|
||||
@@ -79,7 +79,7 @@ X509 *X509_REQ_to_X509(X509_REQ *r, int days, EVP_PKEY *pkey)
|
||||
xi = ret->cert_info;
|
||||
|
||||
if (sk_X509_ATTRIBUTE_num(r->req_info->attributes) != 0) {
|
||||
if ((xi->version = M_ASN1_INTEGER_new()) == NULL)
|
||||
if ((xi->version = ASN1_INTEGER_new()) == NULL)
|
||||
goto err;
|
||||
if (!ASN1_INTEGER_set(xi->version, 2))
|
||||
goto err;
|
||||
|
||||
@@ -75,12 +75,12 @@ int X509_set_version(X509 *x, long version)
|
||||
if (x == NULL)
|
||||
return (0);
|
||||
if (version == 0) {
|
||||
M_ASN1_INTEGER_free(x->cert_info->version);
|
||||
ASN1_INTEGER_free(x->cert_info->version);
|
||||
x->cert_info->version = NULL;
|
||||
return (1);
|
||||
}
|
||||
if (x->cert_info->version == NULL) {
|
||||
if ((x->cert_info->version = M_ASN1_INTEGER_new()) == NULL)
|
||||
if ((x->cert_info->version = ASN1_INTEGER_new()) == NULL)
|
||||
return (0);
|
||||
}
|
||||
return (ASN1_INTEGER_set(x->cert_info->version, version));
|
||||
@@ -94,9 +94,9 @@ int X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial)
|
||||
return (0);
|
||||
in = x->cert_info->serialNumber;
|
||||
if (in != serial) {
|
||||
in = M_ASN1_INTEGER_dup(serial);
|
||||
in = ASN1_INTEGER_dup(serial);
|
||||
if (in != NULL) {
|
||||
M_ASN1_INTEGER_free(x->cert_info->serialNumber);
|
||||
ASN1_INTEGER_free(x->cert_info->serialNumber);
|
||||
x->cert_info->serialNumber = in;
|
||||
}
|
||||
}
|
||||
@@ -125,9 +125,9 @@ int X509_set1_notBefore(X509 *x, const ASN1_TIME *tm)
|
||||
return (0);
|
||||
in = x->cert_info->validity->notBefore;
|
||||
if (in != tm) {
|
||||
in = M_ASN1_TIME_dup(tm);
|
||||
in = ASN1_STRING_dup(tm);
|
||||
if (in != NULL) {
|
||||
M_ASN1_TIME_free(x->cert_info->validity->notBefore);
|
||||
ASN1_TIME_free(x->cert_info->validity->notBefore);
|
||||
x->cert_info->validity->notBefore = in;
|
||||
}
|
||||
}
|
||||
@@ -168,9 +168,9 @@ int X509_set1_notAfter(X509 *x, const ASN1_TIME *tm)
|
||||
return (0);
|
||||
in = x->cert_info->validity->notAfter;
|
||||
if (in != tm) {
|
||||
in = M_ASN1_TIME_dup(tm);
|
||||
in = ASN1_STRING_dup(tm);
|
||||
if (in != NULL) {
|
||||
M_ASN1_TIME_free(x->cert_info->validity->notAfter);
|
||||
ASN1_TIME_free(x->cert_info->validity->notAfter);
|
||||
x->cert_info->validity->notAfter = in;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ int X509_EXTENSION_set_data(X509_EXTENSION *ex, const ASN1_OCTET_STRING *data)
|
||||
|
||||
if (ex == NULL)
|
||||
return (0);
|
||||
i = M_ASN1_OCTET_STRING_set(ex->value, data->data, data->length);
|
||||
i = ASN1_OCTET_STRING_set(ex->value, data->data, data->length);
|
||||
if (!i)
|
||||
return (0);
|
||||
return (1);
|
||||
|
||||
@@ -66,7 +66,7 @@ int X509_CRL_set_version(X509_CRL *x, long version)
|
||||
if (x == NULL)
|
||||
return (0);
|
||||
if (x->crl->version == NULL) {
|
||||
if ((x->crl->version = M_ASN1_INTEGER_new()) == NULL)
|
||||
if ((x->crl->version = ASN1_INTEGER_new()) == NULL)
|
||||
return (0);
|
||||
}
|
||||
return (ASN1_INTEGER_set(x->crl->version, version));
|
||||
@@ -87,9 +87,9 @@ int X509_CRL_set1_lastUpdate(X509_CRL *x, const ASN1_TIME *tm)
|
||||
return (0);
|
||||
in = x->crl->lastUpdate;
|
||||
if (in != tm) {
|
||||
in = M_ASN1_TIME_dup(tm);
|
||||
in = ASN1_STRING_dup(tm);
|
||||
if (in != NULL) {
|
||||
M_ASN1_TIME_free(x->crl->lastUpdate);
|
||||
ASN1_TIME_free(x->crl->lastUpdate);
|
||||
x->crl->lastUpdate = in;
|
||||
}
|
||||
}
|
||||
@@ -104,9 +104,9 @@ int X509_CRL_set1_nextUpdate(X509_CRL *x, const ASN1_TIME *tm)
|
||||
return (0);
|
||||
in = x->crl->nextUpdate;
|
||||
if (in != tm) {
|
||||
in = M_ASN1_TIME_dup(tm);
|
||||
in = ASN1_STRING_dup(tm);
|
||||
if (in != NULL) {
|
||||
M_ASN1_TIME_free(x->crl->nextUpdate);
|
||||
ASN1_TIME_free(x->crl->nextUpdate);
|
||||
x->crl->nextUpdate = in;
|
||||
}
|
||||
}
|
||||
@@ -189,45 +189,46 @@ int X509_CRL_get_signature_nid(const X509_CRL *crl)
|
||||
return OBJ_obj2nid(crl->sig_alg->algorithm);
|
||||
}
|
||||
|
||||
const ASN1_TIME *X509_REVOKED_get0_revocationDate(const X509_REVOKED *x)
|
||||
const ASN1_TIME *X509_REVOKED_get0_revocationDate(const X509_REVOKED *revoked)
|
||||
{
|
||||
return x->revocationDate;
|
||||
return revoked->revocationDate;
|
||||
}
|
||||
|
||||
int X509_REVOKED_set_revocationDate(X509_REVOKED *x, ASN1_TIME *tm)
|
||||
int X509_REVOKED_set_revocationDate(X509_REVOKED *revoked, const ASN1_TIME *tm)
|
||||
{
|
||||
ASN1_TIME *in;
|
||||
|
||||
if (x == NULL)
|
||||
if (revoked == NULL)
|
||||
return (0);
|
||||
in = x->revocationDate;
|
||||
in = revoked->revocationDate;
|
||||
if (in != tm) {
|
||||
in = M_ASN1_TIME_dup(tm);
|
||||
in = ASN1_STRING_dup(tm);
|
||||
if (in != NULL) {
|
||||
M_ASN1_TIME_free(x->revocationDate);
|
||||
x->revocationDate = in;
|
||||
ASN1_TIME_free(revoked->revocationDate);
|
||||
revoked->revocationDate = in;
|
||||
}
|
||||
}
|
||||
return (in != NULL);
|
||||
}
|
||||
|
||||
const ASN1_INTEGER *X509_REVOKED_get0_serialNumber(const X509_REVOKED *x)
|
||||
const ASN1_INTEGER *X509_REVOKED_get0_serialNumber(const X509_REVOKED *revoked)
|
||||
{
|
||||
return x->serialNumber;
|
||||
return revoked->serialNumber;
|
||||
}
|
||||
|
||||
int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial)
|
||||
int X509_REVOKED_set_serialNumber(X509_REVOKED *revoked,
|
||||
const ASN1_INTEGER *serial)
|
||||
{
|
||||
ASN1_INTEGER *in;
|
||||
|
||||
if (x == NULL)
|
||||
if (revoked == NULL)
|
||||
return (0);
|
||||
in = x->serialNumber;
|
||||
in = revoked->serialNumber;
|
||||
if (in != serial) {
|
||||
in = M_ASN1_INTEGER_dup(serial);
|
||||
in = ASN1_INTEGER_dup(serial);
|
||||
if (in != NULL) {
|
||||
M_ASN1_INTEGER_free(x->serialNumber);
|
||||
x->serialNumber = in;
|
||||
ASN1_INTEGER_free(revoked->serialNumber);
|
||||
revoked->serialNumber = in;
|
||||
}
|
||||
}
|
||||
return (in != NULL);
|
||||
@@ -239,8 +240,13 @@ const STACK_OF(X509_EXTENSION) *
|
||||
return r->extensions;
|
||||
}
|
||||
|
||||
int i2d_re_X509_CRL_tbs(X509_CRL *crl, unsigned char **pp)
|
||||
int i2d_re_X509_CRL_tbs(X509_CRL *crl, unsigned char **outp)
|
||||
{
|
||||
crl->crl->enc.modified = 1;
|
||||
return i2d_X509_CRL_INFO(crl->crl, pp);
|
||||
return i2d_X509_CRL_INFO(crl->crl, outp);
|
||||
}
|
||||
|
||||
int i2d_X509_CRL_tbs(X509_CRL *crl, unsigned char **outp)
|
||||
{
|
||||
return i2d_X509_CRL_INFO(crl->crl, outp);
|
||||
}
|
||||
@@ -393,8 +393,7 @@ IMPLEMENT_ASN1_DUP_FUNCTION(X509_CRL)
|
||||
|
||||
static int X509_REVOKED_cmp(const X509_REVOKED **a, const X509_REVOKED **b)
|
||||
{
|
||||
return (ASN1_STRING_cmp((ASN1_STRING *)(*a)->serialNumber,
|
||||
(ASN1_STRING *)(*b)->serialNumber));
|
||||
return ASN1_STRING_cmp((*a)->serialNumber, (*b)->serialNumber);
|
||||
}
|
||||
|
||||
int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev)
|
||||
|
||||
@@ -78,7 +78,7 @@ X509_PKEY *X509_PKEY_new(void)
|
||||
ret->enc_algor = X509_ALGOR_new();
|
||||
if (ret->enc_algor == NULL)
|
||||
goto err;
|
||||
ret->enc_pkey = M_ASN1_OCTET_STRING_new();
|
||||
ret->enc_pkey = ASN1_OCTET_STRING_new();
|
||||
if (ret->enc_pkey == NULL)
|
||||
goto err;
|
||||
return ret;
|
||||
@@ -97,7 +97,7 @@ void X509_PKEY_free(X509_PKEY *x)
|
||||
if (x->enc_algor != NULL)
|
||||
X509_ALGOR_free(x->enc_algor);
|
||||
if (x->enc_pkey != NULL)
|
||||
M_ASN1_OCTET_STRING_free(x->enc_pkey);
|
||||
ASN1_OCTET_STRING_free(x->enc_pkey);
|
||||
if (x->dec_pkey != NULL)
|
||||
EVP_PKEY_free(x->dec_pkey);
|
||||
if ((x->key_data != NULL) && (x->key_free))
|
||||
|
||||
@@ -337,10 +337,45 @@ int i2d_X509_AUX(X509 *a, unsigned char **pp)
|
||||
return length;
|
||||
}
|
||||
|
||||
int i2d_re_X509_tbs(X509 *x, unsigned char **pp)
|
||||
int i2d_re_X509_tbs(X509 *x509, unsigned char **outp)
|
||||
{
|
||||
x->cert_info->enc.modified = 1;
|
||||
return i2d_X509_CINF(x->cert_info, pp);
|
||||
x509->cert_info->enc.modified = 1;
|
||||
return i2d_X509_CINF(x509->cert_info, outp);
|
||||
}
|
||||
|
||||
int i2d_X509_tbs(X509 *x509, unsigned char **outp)
|
||||
{
|
||||
return i2d_X509_CINF(x509->cert_info, outp);
|
||||
}
|
||||
|
||||
int X509_set1_signature_algo(X509 *x509, const X509_ALGOR *algo)
|
||||
{
|
||||
/* TODO(davidben): Const-correct generated ASN.1 dup functions.
|
||||
* Alternatively, when the types are hidden and we can embed required fields
|
||||
* directly in structs, import |X509_ALGOR_copy| from upstream. */
|
||||
X509_ALGOR *copy1 = X509_ALGOR_dup((X509_ALGOR *)algo);
|
||||
X509_ALGOR *copy2 = X509_ALGOR_dup((X509_ALGOR *)algo);
|
||||
if (copy1 == NULL || copy2 == NULL) {
|
||||
X509_ALGOR_free(copy1);
|
||||
X509_ALGOR_free(copy2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
X509_ALGOR_free(x509->sig_alg);
|
||||
x509->sig_alg = copy1;
|
||||
X509_ALGOR_free(x509->cert_info->signature);
|
||||
x509->cert_info->signature = copy2;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int X509_set1_signature_value(X509 *x509, const uint8_t *sig, size_t sig_len)
|
||||
{
|
||||
if (!ASN1_STRING_set(x509->signature, sig, sig_len)) {
|
||||
return 0;
|
||||
}
|
||||
x509->signature->flags &= ~(ASN1_STRING_FLAG_BITS_LEFT | 0x07);
|
||||
x509->signature->flags |= ASN1_STRING_FLAG_BITS_LEFT;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void X509_get0_signature(const ASN1_BIT_STRING **psig, const X509_ALGOR **palg,
|
||||
|
||||
@@ -89,7 +89,7 @@ static X509_CERT_AUX *aux_get(X509 *x)
|
||||
return x->aux;
|
||||
}
|
||||
|
||||
int X509_alias_set1(X509 *x, unsigned char *name, int len)
|
||||
int X509_alias_set1(X509 *x, const unsigned char *name, int len)
|
||||
{
|
||||
X509_CERT_AUX *aux;
|
||||
if (!name) {
|
||||
@@ -106,7 +106,7 @@ int X509_alias_set1(X509 *x, unsigned char *name, int len)
|
||||
return ASN1_STRING_set(aux->alias, name, len);
|
||||
}
|
||||
|
||||
int X509_keyid_set1(X509 *x, unsigned char *id, int len)
|
||||
int X509_keyid_set1(X509 *x, const unsigned char *id, int len)
|
||||
{
|
||||
X509_CERT_AUX *aux;
|
||||
if (!id) {
|
||||
|
||||
@@ -98,13 +98,15 @@ X509_POLICY_DATA *policy_data_new(POLICYINFO *policy,
|
||||
} else
|
||||
id = NULL;
|
||||
ret = OPENSSL_malloc(sizeof(X509_POLICY_DATA));
|
||||
if (!ret)
|
||||
if (!ret) {
|
||||
OPENSSL_PUT_ERROR(X509V3, ERR_R_MALLOC_FAILURE);
|
||||
ASN1_OBJECT_free(id);
|
||||
return NULL;
|
||||
}
|
||||
ret->expected_policy_set = sk_ASN1_OBJECT_new_null();
|
||||
if (!ret->expected_policy_set) {
|
||||
OPENSSL_free(ret);
|
||||
if (id)
|
||||
ASN1_OBJECT_free(id);
|
||||
ASN1_OBJECT_free(id);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ static AUTHORITY_KEYID *v2i_AUTHORITY_KEYID(X509V3_EXT_METHOD *method,
|
||||
|
||||
if ((issuer && !ikeyid) || (issuer == 2)) {
|
||||
isname = X509_NAME_dup(X509_get_issuer_name(cert));
|
||||
serial = M_ASN1_INTEGER_dup(X509_get_serialNumber(cert));
|
||||
serial = ASN1_INTEGER_dup(X509_get_serialNumber(cert));
|
||||
if (!isname || !serial) {
|
||||
OPENSSL_PUT_ERROR(X509V3, X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS);
|
||||
goto err;
|
||||
@@ -201,7 +201,7 @@ static AUTHORITY_KEYID *v2i_AUTHORITY_KEYID(X509V3_EXT_METHOD *method,
|
||||
|
||||
err:
|
||||
X509_NAME_free(isname);
|
||||
M_ASN1_INTEGER_free(serial);
|
||||
M_ASN1_OCTET_STRING_free(ikeyid);
|
||||
ASN1_INTEGER_free(serial);
|
||||
ASN1_OCTET_STRING_free(ikeyid);
|
||||
return NULL;
|
||||
}
|
||||
@@ -75,8 +75,8 @@ static GENERAL_NAMES *v2i_issuer_alt(X509V3_EXT_METHOD *method,
|
||||
STACK_OF(CONF_VALUE) *nval);
|
||||
static int copy_email(X509V3_CTX *ctx, GENERAL_NAMES *gens, int move_p);
|
||||
static int copy_issuer(X509V3_CTX *ctx, GENERAL_NAMES *gens);
|
||||
static int do_othername(GENERAL_NAME *gen, char *value, X509V3_CTX *ctx);
|
||||
static int do_dirname(GENERAL_NAME *gen, char *value, X509V3_CTX *ctx);
|
||||
static int do_othername(GENERAL_NAME *gen, const char *value, X509V3_CTX *ctx);
|
||||
static int do_dirname(GENERAL_NAME *gen, const char *value, X509V3_CTX *ctx);
|
||||
|
||||
const X509V3_EXT_METHOD v3_alt[] = {
|
||||
{NID_subject_alt_name, 0, ASN1_ITEM_ref(GENERAL_NAMES),
|
||||
@@ -288,40 +288,40 @@ static GENERAL_NAMES *v2i_issuer_alt(X509V3_EXT_METHOD *method,
|
||||
|
||||
static int copy_issuer(X509V3_CTX *ctx, GENERAL_NAMES *gens)
|
||||
{
|
||||
GENERAL_NAMES *ialt;
|
||||
GENERAL_NAME *gen;
|
||||
X509_EXTENSION *ext;
|
||||
int i;
|
||||
size_t j;
|
||||
if (ctx && (ctx->flags == CTX_TEST))
|
||||
return 1;
|
||||
if (!ctx || !ctx->issuer_cert) {
|
||||
OPENSSL_PUT_ERROR(X509V3, X509V3_R_NO_ISSUER_DETAILS);
|
||||
goto err;
|
||||
return 0;
|
||||
}
|
||||
i = X509_get_ext_by_NID(ctx->issuer_cert, NID_subject_alt_name, -1);
|
||||
int i = X509_get_ext_by_NID(ctx->issuer_cert, NID_subject_alt_name, -1);
|
||||
if (i < 0)
|
||||
return 1;
|
||||
|
||||
int ret = 0;
|
||||
GENERAL_NAMES *ialt = NULL;
|
||||
X509_EXTENSION *ext;
|
||||
if (!(ext = X509_get_ext(ctx->issuer_cert, i)) ||
|
||||
!(ialt = X509V3_EXT_d2i(ext))) {
|
||||
OPENSSL_PUT_ERROR(X509V3, X509V3_R_ISSUER_DECODE_ERROR);
|
||||
goto err;
|
||||
}
|
||||
|
||||
for (j = 0; j < sk_GENERAL_NAME_num(ialt); j++) {
|
||||
gen = sk_GENERAL_NAME_value(ialt, j);
|
||||
for (size_t j = 0; j < sk_GENERAL_NAME_num(ialt); j++) {
|
||||
GENERAL_NAME *gen = sk_GENERAL_NAME_value(ialt, j);
|
||||
if (!sk_GENERAL_NAME_push(gens, gen)) {
|
||||
OPENSSL_PUT_ERROR(X509V3, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
/* Ownership of |gen| has moved from |ialt| to |gens|. */
|
||||
sk_GENERAL_NAME_set(ialt, j, NULL);
|
||||
}
|
||||
sk_GENERAL_NAME_free(ialt);
|
||||
|
||||
return 1;
|
||||
|
||||
err:
|
||||
return 0;
|
||||
ret = 1;
|
||||
|
||||
err:
|
||||
GENERAL_NAMES_free(ialt);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static GENERAL_NAMES *v2i_subject_alt(X509V3_EXT_METHOD *method,
|
||||
@@ -386,7 +386,7 @@ static int copy_email(X509V3_CTX *ctx, GENERAL_NAMES *gens, int move_p)
|
||||
while ((i = X509_NAME_get_index_by_NID(nm,
|
||||
NID_pkcs9_emailAddress, i)) >= 0) {
|
||||
ne = X509_NAME_get_entry(nm, i);
|
||||
email = M_ASN1_IA5STRING_dup(X509_NAME_ENTRY_get_data(ne));
|
||||
email = ASN1_STRING_dup(X509_NAME_ENTRY_get_data(ne));
|
||||
if (move_p) {
|
||||
X509_NAME_delete_entry(nm, i);
|
||||
X509_NAME_ENTRY_free(ne);
|
||||
@@ -410,7 +410,7 @@ static int copy_email(X509V3_CTX *ctx, GENERAL_NAMES *gens, int move_p)
|
||||
|
||||
err:
|
||||
GENERAL_NAME_free(gen);
|
||||
M_ASN1_IA5STRING_free(email);
|
||||
ASN1_IA5STRING_free(email);
|
||||
return 0;
|
||||
|
||||
}
|
||||
@@ -446,8 +446,8 @@ GENERAL_NAME *v2i_GENERAL_NAME(const X509V3_EXT_METHOD *method,
|
||||
|
||||
GENERAL_NAME *a2i_GENERAL_NAME(GENERAL_NAME *out,
|
||||
const X509V3_EXT_METHOD *method,
|
||||
X509V3_CTX *ctx, int gen_type, char *value,
|
||||
int is_nc)
|
||||
X509V3_CTX *ctx, int gen_type,
|
||||
const char *value, int is_nc)
|
||||
{
|
||||
char is_string = 0;
|
||||
GENERAL_NAME *gen = NULL;
|
||||
@@ -517,7 +517,7 @@ GENERAL_NAME *a2i_GENERAL_NAME(GENERAL_NAME *out,
|
||||
}
|
||||
|
||||
if (is_string) {
|
||||
if (!(gen->d.ia5 = M_ASN1_IA5STRING_new()) ||
|
||||
if (!(gen->d.ia5 = ASN1_IA5STRING_new()) ||
|
||||
!ASN1_STRING_set(gen->d.ia5, (unsigned char *)value,
|
||||
strlen(value))) {
|
||||
OPENSSL_PUT_ERROR(X509V3, ERR_R_MALLOC_FAILURE);
|
||||
@@ -575,9 +575,10 @@ GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out,
|
||||
|
||||
}
|
||||
|
||||
static int do_othername(GENERAL_NAME *gen, char *value, X509V3_CTX *ctx)
|
||||
static int do_othername(GENERAL_NAME *gen, const char *value, X509V3_CTX *ctx)
|
||||
{
|
||||
char *objtmp = NULL, *p;
|
||||
char *objtmp = NULL;
|
||||
const char *p;
|
||||
int objlen;
|
||||
if (!(p = strchr(value, ';')))
|
||||
return 0;
|
||||
@@ -602,7 +603,7 @@ static int do_othername(GENERAL_NAME *gen, char *value, X509V3_CTX *ctx)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int do_dirname(GENERAL_NAME *gen, char *value, X509V3_CTX *ctx)
|
||||
static int do_dirname(GENERAL_NAME *gen, const char *value, X509V3_CTX *ctx)
|
||||
{
|
||||
int ret = 0;
|
||||
STACK_OF(CONF_VALUE) *sk = NULL;
|
||||
|
||||
@@ -113,7 +113,7 @@ ASN1_BIT_STRING *v2i_ASN1_BIT_STRING(X509V3_EXT_METHOD *method,
|
||||
ASN1_BIT_STRING *bs;
|
||||
size_t i;
|
||||
const BIT_STRING_BITNAME *bnam;
|
||||
if (!(bs = M_ASN1_BIT_STRING_new())) {
|
||||
if (!(bs = ASN1_BIT_STRING_new())) {
|
||||
OPENSSL_PUT_ERROR(X509V3, ERR_R_MALLOC_FAILURE);
|
||||
return NULL;
|
||||
}
|
||||
@@ -124,7 +124,7 @@ ASN1_BIT_STRING *v2i_ASN1_BIT_STRING(X509V3_EXT_METHOD *method,
|
||||
!strcmp(bnam->lname, val->name)) {
|
||||
if (!ASN1_BIT_STRING_set_bit(bs, bnam->bitnum, 1)) {
|
||||
OPENSSL_PUT_ERROR(X509V3, ERR_R_MALLOC_FAILURE);
|
||||
M_ASN1_BIT_STRING_free(bs);
|
||||
ASN1_BIT_STRING_free(bs);
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
@@ -133,7 +133,7 @@ ASN1_BIT_STRING *v2i_ASN1_BIT_STRING(X509V3_EXT_METHOD *method,
|
||||
if (!bnam->lname) {
|
||||
OPENSSL_PUT_ERROR(X509V3, X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT);
|
||||
X509V3_conf_err(val);
|
||||
M_ASN1_BIT_STRING_free(bs);
|
||||
ASN1_BIT_STRING_free(bs);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,22 +71,22 @@
|
||||
#include "../internal.h"
|
||||
#include "internal.h"
|
||||
|
||||
static int v3_check_critical(char **value);
|
||||
static int v3_check_generic(char **value);
|
||||
static int v3_check_critical(const char **value);
|
||||
static int v3_check_generic(const char **value);
|
||||
static X509_EXTENSION *do_ext_nconf(CONF *conf, X509V3_CTX *ctx, int ext_nid,
|
||||
int crit, char *value);
|
||||
static X509_EXTENSION *v3_generic_extension(const char *ext, char *value,
|
||||
int crit, const char *value);
|
||||
static X509_EXTENSION *v3_generic_extension(const char *ext, const char *value,
|
||||
int crit, int type,
|
||||
X509V3_CTX *ctx);
|
||||
static X509_EXTENSION *do_ext_i2d(const X509V3_EXT_METHOD *method,
|
||||
int ext_nid, int crit, void *ext_struc);
|
||||
static unsigned char *generic_asn1(char *value, X509V3_CTX *ctx,
|
||||
static unsigned char *generic_asn1(const char *value, X509V3_CTX *ctx,
|
||||
long *ext_len);
|
||||
/* CONF *conf: Config file */
|
||||
/* char *name: Name */
|
||||
/* char *value: Value */
|
||||
X509_EXTENSION *X509V3_EXT_nconf(CONF *conf, X509V3_CTX *ctx, char *name,
|
||||
char *value)
|
||||
X509_EXTENSION *X509V3_EXT_nconf(CONF *conf, X509V3_CTX *ctx, const char *name,
|
||||
const char *value)
|
||||
{
|
||||
int crit;
|
||||
int ext_type;
|
||||
@@ -105,7 +105,7 @@ X509_EXTENSION *X509V3_EXT_nconf(CONF *conf, X509V3_CTX *ctx, char *name,
|
||||
/* CONF *conf: Config file */
|
||||
/* char *value: Value */
|
||||
X509_EXTENSION *X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int ext_nid,
|
||||
char *value)
|
||||
const char *value)
|
||||
{
|
||||
int crit;
|
||||
int ext_type;
|
||||
@@ -119,7 +119,7 @@ X509_EXTENSION *X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int ext_nid,
|
||||
/* CONF *conf: Config file */
|
||||
/* char *value: Value */
|
||||
static X509_EXTENSION *do_ext_nconf(CONF *conf, X509V3_CTX *ctx, int ext_nid,
|
||||
int crit, char *value)
|
||||
int crit, const char *value)
|
||||
{
|
||||
const X509V3_EXT_METHOD *method;
|
||||
X509_EXTENSION *ext;
|
||||
@@ -199,7 +199,7 @@ static X509_EXTENSION *do_ext_i2d(const X509V3_EXT_METHOD *method,
|
||||
p = ext_der;
|
||||
method->i2d(ext_struc, &p);
|
||||
}
|
||||
if (!(ext_oct = M_ASN1_OCTET_STRING_new()))
|
||||
if (!(ext_oct = ASN1_OCTET_STRING_new()))
|
||||
goto merr;
|
||||
ext_oct->data = ext_der;
|
||||
ext_oct->length = ext_len;
|
||||
@@ -207,7 +207,7 @@ static X509_EXTENSION *do_ext_i2d(const X509V3_EXT_METHOD *method,
|
||||
ext = X509_EXTENSION_create_by_NID(NULL, ext_nid, crit, ext_oct);
|
||||
if (!ext)
|
||||
goto merr;
|
||||
M_ASN1_OCTET_STRING_free(ext_oct);
|
||||
ASN1_OCTET_STRING_free(ext_oct);
|
||||
|
||||
return ext;
|
||||
|
||||
@@ -230,9 +230,9 @@ X509_EXTENSION *X509V3_EXT_i2d(int ext_nid, int crit, void *ext_struc)
|
||||
}
|
||||
|
||||
/* Check the extension string for critical flag */
|
||||
static int v3_check_critical(char **value)
|
||||
static int v3_check_critical(const char **value)
|
||||
{
|
||||
char *p = *value;
|
||||
const char *p = *value;
|
||||
if ((strlen(p) < 9) || strncmp(p, "critical,", 9))
|
||||
return 0;
|
||||
p += 9;
|
||||
@@ -243,10 +243,10 @@ static int v3_check_critical(char **value)
|
||||
}
|
||||
|
||||
/* Check extension string for generic extension and return the type */
|
||||
static int v3_check_generic(char **value)
|
||||
static int v3_check_generic(const char **value)
|
||||
{
|
||||
int gen_type = 0;
|
||||
char *p = *value;
|
||||
const char *p = *value;
|
||||
if ((strlen(p) >= 4) && !strncmp(p, "DER:", 4)) {
|
||||
p += 4;
|
||||
gen_type = 1;
|
||||
@@ -263,7 +263,7 @@ static int v3_check_generic(char **value)
|
||||
}
|
||||
|
||||
/* Create a generic extension: for now just handle DER type */
|
||||
static X509_EXTENSION *v3_generic_extension(const char *ext, char *value,
|
||||
static X509_EXTENSION *v3_generic_extension(const char *ext, const char *value,
|
||||
int crit, int gen_type,
|
||||
X509V3_CTX *ctx)
|
||||
{
|
||||
@@ -289,7 +289,7 @@ static X509_EXTENSION *v3_generic_extension(const char *ext, char *value,
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (!(oct = M_ASN1_OCTET_STRING_new())) {
|
||||
if (!(oct = ASN1_OCTET_STRING_new())) {
|
||||
OPENSSL_PUT_ERROR(X509V3, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
@@ -302,14 +302,14 @@ static X509_EXTENSION *v3_generic_extension(const char *ext, char *value,
|
||||
|
||||
err:
|
||||
ASN1_OBJECT_free(obj);
|
||||
M_ASN1_OCTET_STRING_free(oct);
|
||||
ASN1_OCTET_STRING_free(oct);
|
||||
if (ext_der)
|
||||
OPENSSL_free(ext_der);
|
||||
return extension;
|
||||
|
||||
}
|
||||
|
||||
static unsigned char *generic_asn1(char *value, X509V3_CTX *ctx,
|
||||
static unsigned char *generic_asn1(const char *value, X509V3_CTX *ctx,
|
||||
long *ext_len)
|
||||
{
|
||||
ASN1_TYPE *typ;
|
||||
@@ -327,7 +327,7 @@ static unsigned char *generic_asn1(char *value, X509V3_CTX *ctx,
|
||||
* file section to an extension STACK.
|
||||
*/
|
||||
|
||||
int X509V3_EXT_add_nconf_sk(CONF *conf, X509V3_CTX *ctx, char *section,
|
||||
int X509V3_EXT_add_nconf_sk(CONF *conf, X509V3_CTX *ctx, const char *section,
|
||||
STACK_OF(X509_EXTENSION) **sk)
|
||||
{
|
||||
X509_EXTENSION *ext;
|
||||
@@ -351,7 +351,7 @@ int X509V3_EXT_add_nconf_sk(CONF *conf, X509V3_CTX *ctx, char *section,
|
||||
* Convenience functions to add extensions to a certificate, CRL and request
|
||||
*/
|
||||
|
||||
int X509V3_EXT_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section,
|
||||
int X509V3_EXT_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section,
|
||||
X509 *cert)
|
||||
{
|
||||
STACK_OF(X509_EXTENSION) **sk = NULL;
|
||||
@@ -362,7 +362,7 @@ int X509V3_EXT_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section,
|
||||
|
||||
/* Same as above but for a CRL */
|
||||
|
||||
int X509V3_EXT_CRL_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section,
|
||||
int X509V3_EXT_CRL_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section,
|
||||
X509_CRL *crl)
|
||||
{
|
||||
STACK_OF(X509_EXTENSION) **sk = NULL;
|
||||
@@ -373,7 +373,7 @@ int X509V3_EXT_CRL_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section,
|
||||
|
||||
/* Add extensions to certificate request */
|
||||
|
||||
int X509V3_EXT_REQ_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section,
|
||||
int X509V3_EXT_REQ_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section,
|
||||
X509_REQ *req)
|
||||
{
|
||||
STACK_OF(X509_EXTENSION) *extlist = NULL, **sk = NULL;
|
||||
@@ -390,7 +390,7 @@ int X509V3_EXT_REQ_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section,
|
||||
|
||||
/* Config database functions */
|
||||
|
||||
char *X509V3_get_string(X509V3_CTX *ctx, char *name, char *section)
|
||||
char *X509V3_get_string(X509V3_CTX *ctx, const char *name, const char *section)
|
||||
{
|
||||
if (!ctx->db || !ctx->db_meth || !ctx->db_meth->get_string) {
|
||||
OPENSSL_PUT_ERROR(X509V3, X509V3_R_OPERATION_NOT_DEFINED);
|
||||
@@ -401,7 +401,7 @@ char *X509V3_get_string(X509V3_CTX *ctx, char *name, char *section)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
STACK_OF(CONF_VALUE) *X509V3_get_section(X509V3_CTX *ctx, char *section)
|
||||
STACK_OF(CONF_VALUE) *X509V3_get_section(X509V3_CTX *ctx, const char *section)
|
||||
{
|
||||
if (!ctx->db || !ctx->db_meth || !ctx->db_meth->get_section) {
|
||||
OPENSSL_PUT_ERROR(X509V3, X509V3_R_OPERATION_NOT_DEFINED);
|
||||
|
||||
@@ -245,7 +245,7 @@ static POLICYINFO *policy_section(X509V3_CTX *ctx,
|
||||
OPENSSL_PUT_ERROR(X509V3, ERR_R_INTERNAL_ERROR);
|
||||
goto err;
|
||||
}
|
||||
qual->d.cpsuri = M_ASN1_IA5STRING_new();
|
||||
qual->d.cpsuri = ASN1_IA5STRING_new();
|
||||
if (qual->d.cpsuri == NULL) {
|
||||
goto err;
|
||||
}
|
||||
@@ -319,7 +319,7 @@ static POLICYQUALINFO *notice_section(X509V3_CTX *ctx,
|
||||
for (i = 0; i < sk_CONF_VALUE_num(unot); i++) {
|
||||
cnf = sk_CONF_VALUE_value(unot, i);
|
||||
if (!strcmp(cnf->name, "explicitText")) {
|
||||
not->exptext = M_ASN1_VISIBLESTRING_new();
|
||||
not->exptext = ASN1_VISIBLESTRING_new();
|
||||
if (not->exptext == NULL)
|
||||
goto merr;
|
||||
if (!ASN1_STRING_set(not->exptext, cnf->value,
|
||||
|
||||
@@ -87,7 +87,8 @@ const X509V3_EXT_METHOD v3_crl_reason = {
|
||||
(void *)crl_reasons
|
||||
};
|
||||
|
||||
char *i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD *method, ASN1_ENUMERATED *e)
|
||||
char *i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD *method,
|
||||
const ASN1_ENUMERATED *e)
|
||||
{
|
||||
const ENUMERATED_NAMES *enam;
|
||||
long strval;
|
||||
|
||||
@@ -108,11 +108,10 @@ static ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method,
|
||||
OPENSSL_PUT_ERROR(X509V3, X509V3_R_INVALID_NULL_ARGUMENT);
|
||||
return NULL;
|
||||
}
|
||||
if (!(ia5 = M_ASN1_IA5STRING_new()))
|
||||
if (!(ia5 = ASN1_IA5STRING_new()))
|
||||
goto err;
|
||||
if (!ASN1_STRING_set((ASN1_STRING *)ia5, (unsigned char *)str,
|
||||
strlen(str))) {
|
||||
M_ASN1_IA5STRING_free(ia5);
|
||||
if (!ASN1_STRING_set(ia5, str, strlen(str))) {
|
||||
ASN1_IA5STRING_free(ia5);
|
||||
goto err;
|
||||
}
|
||||
return ia5;
|
||||
|
||||
@@ -122,7 +122,7 @@ const X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid)
|
||||
return sk_X509V3_EXT_METHOD_value(ext_list, idx);
|
||||
}
|
||||
|
||||
const X509V3_EXT_METHOD *X509V3_EXT_get(X509_EXTENSION *ext)
|
||||
const X509V3_EXT_METHOD *X509V3_EXT_get(const X509_EXTENSION *ext)
|
||||
{
|
||||
int nid;
|
||||
if ((nid = OBJ_obj2nid(ext->object)) == NID_undef)
|
||||
@@ -203,7 +203,7 @@ int X509V3_add_standard_extensions(void)
|
||||
|
||||
/* Return an extension internal structure */
|
||||
|
||||
void *X509V3_EXT_d2i(X509_EXTENSION *ext)
|
||||
void *X509V3_EXT_d2i(const X509_EXTENSION *ext)
|
||||
{
|
||||
const X509V3_EXT_METHOD *method;
|
||||
const unsigned char *p;
|
||||
@@ -217,49 +217,38 @@ void *X509V3_EXT_d2i(X509_EXTENSION *ext)
|
||||
return method->d2i(NULL, &p, ext->value->length);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get critical flag and decoded version of extension from a NID. The "idx"
|
||||
* variable returns the last found extension and can be used to retrieve
|
||||
* multiple extensions of the same NID. However multiple extensions with the
|
||||
* same NID is usually due to a badly encoded certificate so if idx is NULL
|
||||
* we choke if multiple extensions exist. The "crit" variable is set to the
|
||||
* critical value. The return value is the decoded extension or NULL on
|
||||
* error. The actual error can have several different causes, the value of
|
||||
* *crit reflects the cause: >= 0, extension found but not decoded (reflects
|
||||
* critical value). -1 extension not found. -2 extension occurs more than
|
||||
* once.
|
||||
*/
|
||||
|
||||
void *X509V3_get_d2i(STACK_OF(X509_EXTENSION) *x, int nid, int *crit,
|
||||
int *idx)
|
||||
void *X509V3_get_d2i(const STACK_OF(X509_EXTENSION) *extensions, int nid,
|
||||
int *out_critical, int *out_idx)
|
||||
{
|
||||
int lastpos;
|
||||
size_t i;
|
||||
X509_EXTENSION *ex, *found_ex = NULL;
|
||||
if (!x) {
|
||||
if (idx)
|
||||
*idx = -1;
|
||||
if (crit)
|
||||
*crit = -1;
|
||||
if (!extensions) {
|
||||
if (out_idx)
|
||||
*out_idx = -1;
|
||||
if (out_critical)
|
||||
*out_critical = -1;
|
||||
return NULL;
|
||||
}
|
||||
if (idx)
|
||||
lastpos = *idx + 1;
|
||||
if (out_idx)
|
||||
lastpos = *out_idx + 1;
|
||||
else
|
||||
lastpos = 0;
|
||||
if (lastpos < 0)
|
||||
lastpos = 0;
|
||||
for (i = lastpos; i < sk_X509_EXTENSION_num(x); i++) {
|
||||
ex = sk_X509_EXTENSION_value(x, i);
|
||||
for (i = lastpos; i < sk_X509_EXTENSION_num(extensions); i++) {
|
||||
ex = sk_X509_EXTENSION_value(extensions, i);
|
||||
if (OBJ_obj2nid(ex->object) == nid) {
|
||||
if (idx) {
|
||||
*idx = i;
|
||||
if (out_idx) {
|
||||
/* TODO(https://crbug.com/boringssl/379): Consistently reject
|
||||
* duplicate extensions. */
|
||||
*out_idx = i;
|
||||
found_ex = ex;
|
||||
break;
|
||||
} else if (found_ex) {
|
||||
/* Found more than one */
|
||||
if (crit)
|
||||
*crit = -2;
|
||||
if (out_critical)
|
||||
*out_critical = -2;
|
||||
return NULL;
|
||||
}
|
||||
found_ex = ex;
|
||||
@@ -267,16 +256,16 @@ void *X509V3_get_d2i(STACK_OF(X509_EXTENSION) *x, int nid, int *crit,
|
||||
}
|
||||
if (found_ex) {
|
||||
/* Found it */
|
||||
if (crit)
|
||||
*crit = X509_EXTENSION_get_critical(found_ex);
|
||||
if (out_critical)
|
||||
*out_critical = X509_EXTENSION_get_critical(found_ex);
|
||||
return X509V3_EXT_d2i(found_ex);
|
||||
}
|
||||
|
||||
/* Extension not found */
|
||||
if (idx)
|
||||
*idx = -1;
|
||||
if (crit)
|
||||
*crit = -1;
|
||||
if (out_idx)
|
||||
*out_idx = -1;
|
||||
if (out_critical)
|
||||
*out_critical = -1;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag,
|
||||
}
|
||||
|
||||
int X509V3_extensions_print(BIO *bp, const char *title,
|
||||
STACK_OF(X509_EXTENSION) *exts,
|
||||
const STACK_OF(X509_EXTENSION) *exts,
|
||||
unsigned long flag, int indent)
|
||||
{
|
||||
size_t i;
|
||||
@@ -183,7 +183,7 @@ int X509V3_extensions_print(BIO *bp, const char *title,
|
||||
return 0;
|
||||
if (!X509V3_EXT_print(bp, ex, flag, indent + 4)) {
|
||||
BIO_printf(bp, "%*s", indent + 4, "");
|
||||
M_ASN1_OCTET_STRING_print(bp, ex->value);
|
||||
ASN1_STRING_print(bp, ex->value);
|
||||
}
|
||||
if (BIO_write(bp, "\n", 1) <= 0)
|
||||
return 0;
|
||||
|
||||
@@ -83,18 +83,18 @@ char *i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, const ASN1_OCTET_STRING *
|
||||
}
|
||||
|
||||
ASN1_OCTET_STRING *s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method,
|
||||
X509V3_CTX *ctx, char *str)
|
||||
X509V3_CTX *ctx, const char *str)
|
||||
{
|
||||
ASN1_OCTET_STRING *oct;
|
||||
long length;
|
||||
|
||||
if (!(oct = M_ASN1_OCTET_STRING_new())) {
|
||||
if (!(oct = ASN1_OCTET_STRING_new())) {
|
||||
OPENSSL_PUT_ERROR(X509V3, ERR_R_MALLOC_FAILURE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!(oct->data = x509v3_hex_to_bytes(str, &length))) {
|
||||
M_ASN1_OCTET_STRING_free(oct);
|
||||
ASN1_OCTET_STRING_free(oct);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ static ASN1_OCTET_STRING *s2i_skey_id(X509V3_EXT_METHOD *method,
|
||||
if (strcmp(str, "hash"))
|
||||
return s2i_ASN1_OCTET_STRING(method, ctx, str);
|
||||
|
||||
if (!(oct = M_ASN1_OCTET_STRING_new())) {
|
||||
if (!(oct = ASN1_OCTET_STRING_new())) {
|
||||
OPENSSL_PUT_ERROR(X509V3, ERR_R_MALLOC_FAILURE);
|
||||
return NULL;
|
||||
}
|
||||
@@ -142,7 +142,7 @@ static ASN1_OCTET_STRING *s2i_skey_id(X509V3_EXT_METHOD *method,
|
||||
(pk->data, pk->length, pkey_dig, &diglen, EVP_sha1(), NULL))
|
||||
goto err;
|
||||
|
||||
if (!M_ASN1_OCTET_STRING_set(oct, pkey_dig, diglen)) {
|
||||
if (!ASN1_OCTET_STRING_set(oct, pkey_dig, diglen)) {
|
||||
OPENSSL_PUT_ERROR(X509V3, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
@@ -150,6 +150,6 @@ static ASN1_OCTET_STRING *s2i_skey_id(X509V3_EXT_METHOD *method,
|
||||
return oct;
|
||||
|
||||
err:
|
||||
M_ASN1_OCTET_STRING_free(oct);
|
||||
ASN1_OCTET_STRING_free(oct);
|
||||
return NULL;
|
||||
}
|
||||
@@ -147,7 +147,7 @@ int X509V3_add_value_bool(const char *name, int asn1_bool,
|
||||
return X509V3_add_value(name, "FALSE", extlist);
|
||||
}
|
||||
|
||||
int X509V3_add_value_bool_nf(char *name, int asn1_bool,
|
||||
int X509V3_add_value_bool_nf(const char *name, int asn1_bool,
|
||||
STACK_OF(CONF_VALUE) **extlist)
|
||||
{
|
||||
if (asn1_bool)
|
||||
@@ -194,7 +194,7 @@ static char *bignum_to_string(const BIGNUM *bn)
|
||||
return ret;
|
||||
}
|
||||
|
||||
char *i2s_ASN1_ENUMERATED(X509V3_EXT_METHOD *method, ASN1_ENUMERATED *a)
|
||||
char *i2s_ASN1_ENUMERATED(X509V3_EXT_METHOD *method, const ASN1_ENUMERATED *a)
|
||||
{
|
||||
BIGNUM *bntmp = NULL;
|
||||
char *strtmp = NULL;
|
||||
@@ -207,7 +207,7 @@ char *i2s_ASN1_ENUMERATED(X509V3_EXT_METHOD *method, ASN1_ENUMERATED *a)
|
||||
return strtmp;
|
||||
}
|
||||
|
||||
char *i2s_ASN1_INTEGER(X509V3_EXT_METHOD *method, ASN1_INTEGER *a)
|
||||
char *i2s_ASN1_INTEGER(X509V3_EXT_METHOD *method, const ASN1_INTEGER *a)
|
||||
{
|
||||
BIGNUM *bntmp = NULL;
|
||||
char *strtmp = NULL;
|
||||
@@ -220,7 +220,7 @@ char *i2s_ASN1_INTEGER(X509V3_EXT_METHOD *method, ASN1_INTEGER *a)
|
||||
return strtmp;
|
||||
}
|
||||
|
||||
ASN1_INTEGER *s2i_ASN1_INTEGER(X509V3_EXT_METHOD *method, char *value)
|
||||
ASN1_INTEGER *s2i_ASN1_INTEGER(X509V3_EXT_METHOD *method, const char *value)
|
||||
{
|
||||
BIGNUM *bn = NULL;
|
||||
ASN1_INTEGER *aint;
|
||||
@@ -282,7 +282,7 @@ int X509V3_add_value_int(const char *name, ASN1_INTEGER *aint,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int X509V3_get_value_bool(CONF_VALUE *value, int *asn1_bool)
|
||||
int X509V3_get_value_bool(const CONF_VALUE *value, int *asn1_bool)
|
||||
{
|
||||
char *btmp;
|
||||
if (!(btmp = value->value))
|
||||
@@ -304,7 +304,7 @@ int X509V3_get_value_bool(CONF_VALUE *value, int *asn1_bool)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int X509V3_get_value_int(CONF_VALUE *value, ASN1_INTEGER **aint)
|
||||
int X509V3_get_value_int(const CONF_VALUE *value, ASN1_INTEGER **aint)
|
||||
{
|
||||
ASN1_INTEGER *itmp;
|
||||
if (!(itmp = s2i_ASN1_INTEGER(NULL, value->value))) {
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
This directory is derived from BoringSSL cloned from https://boringssl.googlesource.com/boringssl at revision 67818bea6690a230e2f42e8a588e0f54949bbbf1
|
||||
This directory is derived from BoringSSL cloned from https://boringssl.googlesource.com/boringssl at revision 9dae0ac4f0ae18ebed988d36bfb4c4e4023fc574
|
||||
@@ -146,6 +146,30 @@ OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_128_gcm_siv(void);
|
||||
// https://tools.ietf.org/html/draft-irtf-cfrg-gcmsiv-02
|
||||
OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_256_gcm_siv(void);
|
||||
|
||||
// EVP_aead_aes_128_gcm_randnonce is AES-128 in Galois Counter Mode with
|
||||
// internal nonce generation. The 12-byte nonce is appended to the tag
|
||||
// and is generated internally. The "tag", for the purpurses of the API, is thus
|
||||
// 12 bytes larger. The nonce parameter when using this AEAD must be
|
||||
// zero-length. Since the nonce is random, a single key should not be used for
|
||||
// more than 2^32 seal operations.
|
||||
//
|
||||
// Warning: this is for use for FIPS compliance only. It is probably not
|
||||
// suitable for other uses. Using standard AES-GCM AEADs allows one to achieve
|
||||
// the same effect, but gives more control over nonce storage.
|
||||
OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_128_gcm_randnonce(void);
|
||||
|
||||
// EVP_aead_aes_256_gcm_randnonce is AES-256 in Galois Counter Mode with
|
||||
// internal nonce generation. The 12-byte nonce is appended to the tag
|
||||
// and is generated internally. The "tag", for the purpurses of the API, is thus
|
||||
// 12 bytes larger. The nonce parameter when using this AEAD must be
|
||||
// zero-length. Since the nonce is random, a single key should not be used for
|
||||
// more than 2^32 seal operations.
|
||||
//
|
||||
// Warning: this is for use for FIPS compliance only. It is probably not
|
||||
// suitable for other uses. Using standard AES-GCM AEADs allows one to achieve
|
||||
// the same effect, but gives more control over nonce storage.
|
||||
OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_256_gcm_randnonce(void);
|
||||
|
||||
// EVP_aead_aes_128_ccm_bluetooth is AES-128-CCM with M=4 and L=2 (4-byte tags
|
||||
// and 13-byte nonces), as decribed in the Bluetooth Core Specification v5.0,
|
||||
// Volume 6, Part E, Section 1.
|
||||
|
||||
@@ -127,7 +127,7 @@
|
||||
// appropriate architecture-dependent feature bits set.
|
||||
// Read more: "ELF for the Arm® 64-bit Architecture"
|
||||
|
||||
#if (__ARM_FEATURE_BTI_DEFAULT == 1)
|
||||
#if defined(__ARM_FEATURE_BTI_DEFAULT) && __ARM_FEATURE_BTI_DEFAULT == 1
|
||||
#define GNU_PROPERTY_AARCH64_BTI (1 << 0) // Has Branch Target Identification
|
||||
#define AARCH64_VALID_CALL_TARGET hint #34 // BTI 'c'
|
||||
#else
|
||||
@@ -135,19 +135,21 @@
|
||||
#define AARCH64_VALID_CALL_TARGET
|
||||
#endif
|
||||
|
||||
#if ((__ARM_FEATURE_PAC_DEFAULT & 1) == 1) // Signed with A-key
|
||||
#if defined(__ARM_FEATURE_PAC_DEFAULT) && \
|
||||
(__ARM_FEATURE_PAC_DEFAULT & 1) == 1 // Signed with A-key
|
||||
#define GNU_PROPERTY_AARCH64_POINTER_AUTH \
|
||||
(1 << 1) // Has Pointer Authentication
|
||||
#define AARCH64_SIGN_LINK_REGISTER hint #25 // PACIASP
|
||||
#define AARCH64_VALIDATE_LINK_REGISTER hint #29 // AUTIASP
|
||||
#elif ((__ARM_FEATURE_PAC_DEFAULT & 2) == 2) // Signed with B-key
|
||||
#elif defined(__ARM_FEATURE_PAC_DEFAULT) && \
|
||||
(__ARM_FEATURE_PAC_DEFAULT & 2) == 2 // Signed with B-key
|
||||
#define GNU_PROPERTY_AARCH64_POINTER_AUTH \
|
||||
(1 << 1) // Has Pointer Authentication
|
||||
#define AARCH64_SIGN_LINK_REGISTER hint #27 // PACIBSP
|
||||
#define AARCH64_VALIDATE_LINK_REGISTER hint #31 // AUTIBSP
|
||||
#else
|
||||
#define GNU_PROPERTY_AARCH64_POINTER_AUTH 0 // No Pointer Authentication
|
||||
#if defined(__ARM_FEATURE_BTI_DEFAULT)
|
||||
#if GNU_PROPERTY_AARCH64_BTI != 0
|
||||
#define AARCH64_SIGN_LINK_REGISTER AARCH64_VALID_CALL_TARGET
|
||||
#else
|
||||
#define AARCH64_SIGN_LINK_REGISTER
|
||||
@@ -155,8 +157,8 @@
|
||||
#define AARCH64_VALIDATE_LINK_REGISTER
|
||||
#endif
|
||||
|
||||
#if (GNU_PROPERTY_AARCH64_POINTER_AUTH != 0) || (GNU_PROPERTY_AARCH64_BTI != 0)
|
||||
.pushsection note.gnu.property, "a";
|
||||
#if GNU_PROPERTY_AARCH64_POINTER_AUTH != 0 || GNU_PROPERTY_AARCH64_BTI != 0
|
||||
.pushsection .note.gnu.property, "a";
|
||||
.balign 8;
|
||||
.long 4;
|
||||
.long 0x10;
|
||||
@@ -165,8 +167,8 @@
|
||||
.long 0xc0000000; /* GNU_PROPERTY_AARCH64_FEATURE_1_AND */
|
||||
.long 4;
|
||||
.long (GNU_PROPERTY_AARCH64_POINTER_AUTH | GNU_PROPERTY_AARCH64_BTI);
|
||||
.long 0
|
||||
.popsection
|
||||
.long 0;
|
||||
.popsection;
|
||||
#endif
|
||||
|
||||
#endif /* defined __ASSEMBLER__ */
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -141,20 +141,10 @@ extern "C" {
|
||||
#stname \
|
||||
ASN1_ITEM_end(tname)
|
||||
|
||||
#define ASN1_NDEF_SEQUENCE(tname) \
|
||||
ASN1_SEQUENCE(tname)
|
||||
|
||||
#define ASN1_NDEF_SEQUENCE_cb(tname, cb) \
|
||||
ASN1_SEQUENCE_cb(tname, cb)
|
||||
|
||||
#define ASN1_SEQUENCE_cb(tname, cb) \
|
||||
static const ASN1_AUX tname##_aux = {NULL, 0, 0, cb, 0}; \
|
||||
ASN1_SEQUENCE(tname)
|
||||
|
||||
#define ASN1_BROKEN_SEQUENCE(tname) \
|
||||
static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_BROKEN, 0, 0, 0}; \
|
||||
ASN1_SEQUENCE(tname)
|
||||
|
||||
#define ASN1_SEQUENCE_ref(tname, cb) \
|
||||
static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), cb, 0}; \
|
||||
ASN1_SEQUENCE(tname)
|
||||
@@ -163,20 +153,6 @@ extern "C" {
|
||||
static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_ENCODING, 0, cb, offsetof(tname, enc)}; \
|
||||
ASN1_SEQUENCE(tname)
|
||||
|
||||
#define ASN1_NDEF_SEQUENCE_END(tname) \
|
||||
;\
|
||||
ASN1_ITEM_start(tname) \
|
||||
ASN1_ITYPE_NDEF_SEQUENCE,\
|
||||
V_ASN1_SEQUENCE,\
|
||||
tname##_seq_tt,\
|
||||
sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
|
||||
NULL,\
|
||||
sizeof(tname),\
|
||||
#tname \
|
||||
ASN1_ITEM_end(tname)
|
||||
|
||||
#define ASN1_BROKEN_SEQUENCE_END(stname) ASN1_SEQUENCE_END_ref(stname, stname)
|
||||
|
||||
#define ASN1_SEQUENCE_END_enc(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname)
|
||||
|
||||
#define ASN1_SEQUENCE_END_cb(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname)
|
||||
@@ -193,18 +169,6 @@ extern "C" {
|
||||
#stname \
|
||||
ASN1_ITEM_end(tname)
|
||||
|
||||
#define ASN1_NDEF_SEQUENCE_END_cb(stname, tname) \
|
||||
;\
|
||||
ASN1_ITEM_start(tname) \
|
||||
ASN1_ITYPE_NDEF_SEQUENCE,\
|
||||
V_ASN1_SEQUENCE,\
|
||||
tname##_seq_tt,\
|
||||
sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
|
||||
&tname##_aux,\
|
||||
sizeof(stname),\
|
||||
#stname \
|
||||
ASN1_ITEM_end(tname)
|
||||
|
||||
|
||||
/* This pair helps declare a CHOICE type. We can do:
|
||||
*
|
||||
@@ -353,14 +317,6 @@ extern "C" {
|
||||
#define ASN1_EXP_SEQUENCE_OF_OPT(stname, field, type, tag) \
|
||||
ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL)
|
||||
|
||||
/* EXPLICIT using indefinite length constructed form */
|
||||
#define ASN1_NDEF_EXP(stname, field, type, tag) \
|
||||
ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_NDEF)
|
||||
|
||||
/* EXPLICIT OPTIONAL using indefinite length constructed form */
|
||||
#define ASN1_NDEF_EXP_OPT(stname, field, type, tag) \
|
||||
ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_NDEF)
|
||||
|
||||
/* Macros for the ASN1_ADB structure */
|
||||
|
||||
#define ASN1_ADB(name) \
|
||||
@@ -393,9 +349,7 @@ struct ASN1_TEMPLATE_st {
|
||||
unsigned long flags; /* Various flags */
|
||||
long tag; /* tag, not used if no tagging */
|
||||
unsigned long offset; /* Offset of this field in structure */
|
||||
#ifndef NO_ASN1_FIELD_NAMES
|
||||
const char *field_name; /* Field name */
|
||||
#endif
|
||||
ASN1_ITEM_EXP *item; /* Relevant ASN1_ITEM or ASN1_ADB */
|
||||
};
|
||||
|
||||
@@ -504,13 +458,6 @@ struct ASN1_ADB_TABLE_st {
|
||||
|
||||
#define ASN1_TFLG_COMBINE (0x1<<10)
|
||||
|
||||
/* This flag when present in a SEQUENCE OF, SET OF
|
||||
* or EXPLICIT causes indefinite length constructed
|
||||
* encoding to be used if required.
|
||||
*/
|
||||
|
||||
#define ASN1_TFLG_NDEF (0x1<<11)
|
||||
|
||||
/* This is the actual ASN1 item itself */
|
||||
|
||||
struct ASN1_ITEM_st {
|
||||
@@ -520,9 +467,7 @@ const ASN1_TEMPLATE *templates; /* If SEQUENCE or CHOICE this contains the conte
|
||||
long tcount; /* Number of templates if SEQUENCE or CHOICE */
|
||||
const void *funcs; /* functions that handle this type */
|
||||
long size; /* Structure size (usually)*/
|
||||
#ifndef NO_ASN1_FIELD_NAMES
|
||||
const char *sname; /* Structure name */
|
||||
#endif
|
||||
};
|
||||
|
||||
/* These are values for the itype field and
|
||||
@@ -547,10 +492,6 @@ const char *sname; /* Structure name */
|
||||
* The 'funcs' field is used for application
|
||||
* specific functions.
|
||||
*
|
||||
* For COMPAT types the funcs field gives a
|
||||
* set of functions that handle this type, this
|
||||
* supports the old d2i, i2d convention.
|
||||
*
|
||||
* The EXTERN type uses a new style d2i/i2d.
|
||||
* The new style should be used where possible
|
||||
* because it avoids things like the d2i IMPLICIT
|
||||
@@ -563,10 +504,6 @@ const char *sname; /* Structure name */
|
||||
* has a special meaning, it is used as a mask
|
||||
* of acceptable types using the B_ASN1 constants.
|
||||
*
|
||||
* NDEF_SEQUENCE is the same as SEQUENCE except
|
||||
* that it will use indefinite length constructed
|
||||
* encoding if requested.
|
||||
*
|
||||
*/
|
||||
|
||||
#define ASN1_ITYPE_PRIMITIVE 0x0
|
||||
@@ -575,14 +512,10 @@ const char *sname; /* Structure name */
|
||||
|
||||
#define ASN1_ITYPE_CHOICE 0x2
|
||||
|
||||
#define ASN1_ITYPE_COMPAT 0x3
|
||||
|
||||
#define ASN1_ITYPE_EXTERN 0x4
|
||||
|
||||
#define ASN1_ITYPE_MSTRING 0x5
|
||||
|
||||
#define ASN1_ITYPE_NDEF_SEQUENCE 0x6
|
||||
|
||||
/* Cache for ASN1 tag and length, so we
|
||||
* don't keep re-reading it for things
|
||||
* like CHOICE
|
||||
@@ -615,17 +548,6 @@ typedef int ASN1_ex_print_func(BIO *out, ASN1_VALUE **pval,
|
||||
int indent, const char *fname,
|
||||
const ASN1_PCTX *pctx);
|
||||
|
||||
typedef int ASN1_primitive_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it);
|
||||
typedef int ASN1_primitive_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it);
|
||||
typedef int ASN1_primitive_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it, int indent, const ASN1_PCTX *pctx);
|
||||
|
||||
typedef struct ASN1_COMPAT_FUNCS_st {
|
||||
ASN1_new_func *asn1_new;
|
||||
ASN1_free_func *asn1_free;
|
||||
ASN1_d2i_func *asn1_d2i;
|
||||
ASN1_i2d_func *asn1_i2d;
|
||||
} ASN1_COMPAT_FUNCS;
|
||||
|
||||
typedef struct ASN1_EXTERN_FUNCS_st {
|
||||
void *app_data;
|
||||
ASN1_ex_new_func *asn1_ex_new;
|
||||
@@ -637,17 +559,6 @@ typedef struct ASN1_EXTERN_FUNCS_st {
|
||||
ASN1_ex_print_func *asn1_ex_print;
|
||||
} ASN1_EXTERN_FUNCS;
|
||||
|
||||
typedef struct ASN1_PRIMITIVE_FUNCS_st {
|
||||
void *app_data;
|
||||
unsigned long flags;
|
||||
ASN1_ex_new_func *prim_new;
|
||||
ASN1_ex_free_func *prim_free;
|
||||
ASN1_ex_free_func *prim_clear;
|
||||
ASN1_primitive_c2i *prim_c2i;
|
||||
ASN1_primitive_i2c *prim_i2c;
|
||||
ASN1_primitive_print *prim_print;
|
||||
} ASN1_PRIMITIVE_FUNCS;
|
||||
|
||||
/* This is the ASN1_AUX structure: it handles various
|
||||
* miscellaneous requirements. For example the use of
|
||||
* reference counts and an informational callback.
|
||||
@@ -676,31 +587,12 @@ typedef struct ASN1_AUX_st {
|
||||
int enc_offset; /* Offset of ASN1_ENCODING structure */
|
||||
} ASN1_AUX;
|
||||
|
||||
/* For print related callbacks exarg points to this structure */
|
||||
typedef struct ASN1_PRINT_ARG_st {
|
||||
BIO *out;
|
||||
int indent;
|
||||
const ASN1_PCTX *pctx;
|
||||
} ASN1_PRINT_ARG;
|
||||
|
||||
/* For streaming related callbacks exarg points to this structure */
|
||||
typedef struct ASN1_STREAM_ARG_st {
|
||||
/* BIO to stream through */
|
||||
BIO *out;
|
||||
/* BIO with filters appended */
|
||||
BIO *ndef_bio;
|
||||
/* Streaming I/O boundary */
|
||||
unsigned char **boundary;
|
||||
} ASN1_STREAM_ARG;
|
||||
|
||||
/* Flags in ASN1_AUX */
|
||||
|
||||
/* Use a reference count */
|
||||
#define ASN1_AFLG_REFCOUNT 1
|
||||
/* Save the encoding of structure (useful for signatures) */
|
||||
#define ASN1_AFLG_ENCODING 2
|
||||
/* The Sequence length is invalid */
|
||||
#define ASN1_AFLG_BROKEN 4
|
||||
|
||||
/* operation values for asn1_cb */
|
||||
|
||||
@@ -732,27 +624,6 @@ typedef struct ASN1_STREAM_ARG_st {
|
||||
ASN1_ITYPE_MSTRING, mask, NULL, 0, NULL, sizeof(ASN1_STRING), #itname \
|
||||
ASN1_ITEM_end(itname)
|
||||
|
||||
/* Macro to implement an ASN1_ITEM in terms of old style funcs */
|
||||
|
||||
#define IMPLEMENT_COMPAT_ASN1(sname) IMPLEMENT_COMPAT_ASN1_type(sname, V_ASN1_SEQUENCE)
|
||||
|
||||
#define IMPLEMENT_COMPAT_ASN1_type(sname, tag) \
|
||||
static const ASN1_COMPAT_FUNCS sname##_ff = { \
|
||||
(ASN1_new_func *)sname##_new, \
|
||||
(ASN1_free_func *)sname##_free, \
|
||||
(ASN1_d2i_func *)d2i_##sname, \
|
||||
(ASN1_i2d_func *)i2d_##sname, \
|
||||
}; \
|
||||
ASN1_ITEM_start(sname) \
|
||||
ASN1_ITYPE_COMPAT, \
|
||||
tag, \
|
||||
NULL, \
|
||||
0, \
|
||||
&sname##_ff, \
|
||||
0, \
|
||||
#sname \
|
||||
ASN1_ITEM_end(sname)
|
||||
|
||||
#define IMPLEMENT_EXTERN_ASN1(sname, tag, fptrs) \
|
||||
ASN1_ITEM_start(sname) \
|
||||
ASN1_ITYPE_EXTERN, \
|
||||
@@ -813,12 +684,6 @@ typedef struct ASN1_STREAM_ARG_st {
|
||||
return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
|
||||
}
|
||||
|
||||
#define IMPLEMENT_ASN1_NDEF_FUNCTION(stname) \
|
||||
int i2d_##stname##_NDEF(stname *a, unsigned char **out) \
|
||||
{ \
|
||||
return ASN1_item_ndef_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(stname));\
|
||||
}
|
||||
|
||||
/* This includes evil casts to remove const: they will go away when full
|
||||
* ASN1 constification is done.
|
||||
*/
|
||||
@@ -854,38 +719,6 @@ DECLARE_ASN1_ITEM(ASN1_SEQUENCE)
|
||||
|
||||
DEFINE_STACK_OF(ASN1_VALUE)
|
||||
|
||||
/* Functions used internally by the ASN1 code */
|
||||
|
||||
int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
int ASN1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);
|
||||
int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
|
||||
void ASN1_template_free(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);
|
||||
int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, const ASN1_ITEM *it,
|
||||
int tag, int aclass, char opt, ASN1_TLC *ctx);
|
||||
|
||||
int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass);
|
||||
void ASN1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
|
||||
int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it);
|
||||
int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it);
|
||||
|
||||
int asn1_get_choice_selector(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
int asn1_set_choice_selector(ASN1_VALUE **pval, int value, const ASN1_ITEM *it);
|
||||
|
||||
ASN1_VALUE ** asn1_get_field_ptr(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);
|
||||
|
||||
const ASN1_TEMPLATE *asn1_do_adb(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt, int nullerr);
|
||||
|
||||
void asn1_refcount_set_one(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
int asn1_refcount_dec_and_test_zero(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
|
||||
void asn1_enc_init(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
void asn1_enc_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
int asn1_enc_restore(int *len, unsigned char **out, ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
int asn1_enc_save(ASN1_VALUE **pval, const unsigned char *in, int inlen, const ASN1_ITEM *it);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -52,6 +52,9 @@
|
||||
|
||||
#ifndef OPENSSL_HEADER_BASE_H
|
||||
#define OPENSSL_HEADER_BASE_H
|
||||
#if defined(_WIN32) && !(defined(_M_IX86) || defined(__i386__))
|
||||
#define OPENSSL_NO_ASM
|
||||
#endif
|
||||
#if defined(__APPLE__) && defined(__i386__)
|
||||
#define OPENSSL_NO_ASM
|
||||
#endif
|
||||
@@ -143,7 +146,10 @@ extern "C" {
|
||||
#define OPENSSL_WINDOWS
|
||||
#endif
|
||||
|
||||
#if defined(__linux__)
|
||||
// Trusty isn't Linux but currently defines __linux__. As a workaround, we
|
||||
// exclude it here.
|
||||
// TODO(b/169780122): Remove this workaround once Trusty no longer defines it.
|
||||
#if defined(__linux__) && !defined(TRUSTY)
|
||||
#define OPENSSL_LINUX
|
||||
#endif
|
||||
|
||||
@@ -189,7 +195,7 @@ extern "C" {
|
||||
// A consumer may use this symbol in the preprocessor to temporarily build
|
||||
// against multiple revisions of BoringSSL at the same time. It is not
|
||||
// recommended to do so for longer than is necessary.
|
||||
#define BORINGSSL_API_VERSION 11
|
||||
#define BORINGSSL_API_VERSION 12
|
||||
|
||||
#if defined(BORINGSSL_SHARED_LIBRARY)
|
||||
|
||||
|
||||
@@ -199,6 +199,10 @@ OPENSSL_EXPORT int BIO_should_io_special(const BIO *bio);
|
||||
// retried. The return value is one of the |BIO_RR_*| values.
|
||||
OPENSSL_EXPORT int BIO_get_retry_reason(const BIO *bio);
|
||||
|
||||
// BIO_set_retry_reason sets the special I/O operation that needs to be retried
|
||||
// to |reason|, which should be one of the |BIO_RR_*| values.
|
||||
OPENSSL_EXPORT void BIO_set_retry_reason(BIO *bio, int reason);
|
||||
|
||||
// BIO_clear_flags ANDs |bio->flags| with the bitwise-complement of |flags|.
|
||||
OPENSSL_EXPORT void BIO_clear_flags(BIO *bio, int flags);
|
||||
|
||||
|
||||
@@ -83,7 +83,6 @@
|
||||
#define ASN1_OBJECT_free BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ASN1_OBJECT_free)
|
||||
#define ASN1_OBJECT_it BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ASN1_OBJECT_it)
|
||||
#define ASN1_OBJECT_new BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ASN1_OBJECT_new)
|
||||
#define ASN1_OCTET_STRING_NDEF_it BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ASN1_OCTET_STRING_NDEF_it)
|
||||
#define ASN1_OCTET_STRING_cmp BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ASN1_OCTET_STRING_cmp)
|
||||
#define ASN1_OCTET_STRING_dup BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ASN1_OCTET_STRING_dup)
|
||||
#define ASN1_OCTET_STRING_free BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ASN1_OCTET_STRING_free)
|
||||
@@ -178,7 +177,6 @@
|
||||
#define ASN1_item_i2d BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ASN1_item_i2d)
|
||||
#define ASN1_item_i2d_bio BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ASN1_item_i2d_bio)
|
||||
#define ASN1_item_i2d_fp BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ASN1_item_i2d_fp)
|
||||
#define ASN1_item_ndef_i2d BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ASN1_item_ndef_i2d)
|
||||
#define ASN1_item_new BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ASN1_item_new)
|
||||
#define ASN1_item_pack BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ASN1_item_pack)
|
||||
#define ASN1_item_sign BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ASN1_item_sign)
|
||||
@@ -189,13 +187,11 @@
|
||||
#define ASN1_mbstring_ncopy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ASN1_mbstring_ncopy)
|
||||
#define ASN1_object_size BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ASN1_object_size)
|
||||
#define ASN1_primitive_free BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ASN1_primitive_free)
|
||||
#define ASN1_primitive_new BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ASN1_primitive_new)
|
||||
#define ASN1_put_eoc BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ASN1_put_eoc)
|
||||
#define ASN1_put_object BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ASN1_put_object)
|
||||
#define ASN1_tag2bit BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ASN1_tag2bit)
|
||||
#define ASN1_tag2str BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ASN1_tag2str)
|
||||
#define ASN1_template_free BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ASN1_template_free)
|
||||
#define ASN1_template_new BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ASN1_template_new)
|
||||
#define AUTHORITY_INFO_ACCESS_free BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, AUTHORITY_INFO_ACCESS_free)
|
||||
#define AUTHORITY_INFO_ACCESS_it BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, AUTHORITY_INFO_ACCESS_it)
|
||||
#define AUTHORITY_INFO_ACCESS_new BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, AUTHORITY_INFO_ACCESS_new)
|
||||
@@ -285,6 +281,7 @@
|
||||
#define BIO_set_mem_eof_return BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, BIO_set_mem_eof_return)
|
||||
#define BIO_set_nbio BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, BIO_set_nbio)
|
||||
#define BIO_set_retry_read BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, BIO_set_retry_read)
|
||||
#define BIO_set_retry_reason BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, BIO_set_retry_reason)
|
||||
#define BIO_set_retry_special BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, BIO_set_retry_special)
|
||||
#define BIO_set_retry_write BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, BIO_set_retry_write)
|
||||
#define BIO_set_shutdown BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, BIO_set_shutdown)
|
||||
@@ -509,7 +506,9 @@
|
||||
#define CBS_get_u8 BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, CBS_get_u8)
|
||||
#define CBS_get_u8_length_prefixed BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, CBS_get_u8_length_prefixed)
|
||||
#define CBS_init BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, CBS_init)
|
||||
#define CBS_is_unsigned_asn1_integer BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, CBS_is_unsigned_asn1_integer)
|
||||
#define CBS_is_valid_asn1_bitstring BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, CBS_is_valid_asn1_bitstring)
|
||||
#define CBS_is_valid_asn1_integer BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, CBS_is_valid_asn1_integer)
|
||||
#define CBS_len BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, CBS_len)
|
||||
#define CBS_mem_equal BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, CBS_mem_equal)
|
||||
#define CBS_peek_asn1_tag BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, CBS_peek_asn1_tag)
|
||||
@@ -1072,6 +1071,7 @@
|
||||
#define EVP_aead_aes_128_ccm_bluetooth_8 BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, EVP_aead_aes_128_ccm_bluetooth_8)
|
||||
#define EVP_aead_aes_128_ctr_hmac_sha256 BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, EVP_aead_aes_128_ctr_hmac_sha256)
|
||||
#define EVP_aead_aes_128_gcm BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, EVP_aead_aes_128_gcm)
|
||||
#define EVP_aead_aes_128_gcm_randnonce BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, EVP_aead_aes_128_gcm_randnonce)
|
||||
#define EVP_aead_aes_128_gcm_siv BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, EVP_aead_aes_128_gcm_siv)
|
||||
#define EVP_aead_aes_128_gcm_tls12 BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, EVP_aead_aes_128_gcm_tls12)
|
||||
#define EVP_aead_aes_128_gcm_tls13 BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, EVP_aead_aes_128_gcm_tls13)
|
||||
@@ -1082,6 +1082,7 @@
|
||||
#define EVP_aead_aes_256_cbc_sha384_tls BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, EVP_aead_aes_256_cbc_sha384_tls)
|
||||
#define EVP_aead_aes_256_ctr_hmac_sha256 BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, EVP_aead_aes_256_ctr_hmac_sha256)
|
||||
#define EVP_aead_aes_256_gcm BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, EVP_aead_aes_256_gcm)
|
||||
#define EVP_aead_aes_256_gcm_randnonce BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, EVP_aead_aes_256_gcm_randnonce)
|
||||
#define EVP_aead_aes_256_gcm_siv BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, EVP_aead_aes_256_gcm_siv)
|
||||
#define EVP_aead_aes_256_gcm_tls12 BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, EVP_aead_aes_256_gcm_tls12)
|
||||
#define EVP_aead_aes_256_gcm_tls13 BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, EVP_aead_aes_256_gcm_tls13)
|
||||
@@ -1413,7 +1414,6 @@
|
||||
#define PKCS8_parse_encrypted_private_key BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, PKCS8_parse_encrypted_private_key)
|
||||
#define PKCS8_pkey_get0 BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, PKCS8_pkey_get0)
|
||||
#define PKCS8_pkey_set0 BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, PKCS8_pkey_set0)
|
||||
#define PMBTOKEN_PRETOKEN_free BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, PMBTOKEN_PRETOKEN_free)
|
||||
#define POLICYINFO_free BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, POLICYINFO_free)
|
||||
#define POLICYINFO_it BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, POLICYINFO_it)
|
||||
#define POLICYINFO_new BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, POLICYINFO_new)
|
||||
@@ -1567,12 +1567,14 @@
|
||||
#define TRUST_TOKEN_ISSUER_issue BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, TRUST_TOKEN_ISSUER_issue)
|
||||
#define TRUST_TOKEN_ISSUER_new BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, TRUST_TOKEN_ISSUER_new)
|
||||
#define TRUST_TOKEN_ISSUER_redeem BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, TRUST_TOKEN_ISSUER_redeem)
|
||||
#define TRUST_TOKEN_ISSUER_redeem_raw BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, TRUST_TOKEN_ISSUER_redeem_raw)
|
||||
#define TRUST_TOKEN_ISSUER_set_metadata_key BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, TRUST_TOKEN_ISSUER_set_metadata_key)
|
||||
#define TRUST_TOKEN_ISSUER_set_srr_key BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, TRUST_TOKEN_ISSUER_set_srr_key)
|
||||
#define TRUST_TOKEN_PRETOKEN_free BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, TRUST_TOKEN_PRETOKEN_free)
|
||||
#define TRUST_TOKEN_decode_private_metadata BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, TRUST_TOKEN_decode_private_metadata)
|
||||
#define TRUST_TOKEN_experiment_v1 BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, TRUST_TOKEN_experiment_v1)
|
||||
#define TRUST_TOKEN_experiment_v2_pmb BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, TRUST_TOKEN_experiment_v2_pmb)
|
||||
#define TRUST_TOKEN_experiment_v2_pp BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, TRUST_TOKEN_experiment_v2_pp)
|
||||
#define TRUST_TOKEN_experiment_v2_voprf BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, TRUST_TOKEN_experiment_v2_voprf)
|
||||
#define TRUST_TOKEN_free BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, TRUST_TOKEN_free)
|
||||
#define TRUST_TOKEN_generate_key BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, TRUST_TOKEN_generate_key)
|
||||
#define TRUST_TOKEN_new BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, TRUST_TOKEN_new)
|
||||
@@ -2087,6 +2089,8 @@
|
||||
#define X509_reject_clear BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, X509_reject_clear)
|
||||
#define X509_set1_notAfter BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, X509_set1_notAfter)
|
||||
#define X509_set1_notBefore BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, X509_set1_notBefore)
|
||||
#define X509_set1_signature_algo BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, X509_set1_signature_algo)
|
||||
#define X509_set1_signature_value BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, X509_set1_signature_value)
|
||||
#define X509_set_ex_data BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, X509_set_ex_data)
|
||||
#define X509_set_issuer_name BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, X509_set_issuer_name)
|
||||
#define X509_set_notAfter BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, X509_set_notAfter)
|
||||
@@ -2171,8 +2175,6 @@
|
||||
#define asn1_enc_init BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, asn1_enc_init)
|
||||
#define asn1_enc_restore BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, asn1_enc_restore)
|
||||
#define asn1_enc_save BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, asn1_enc_save)
|
||||
#define asn1_ex_c2i BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, asn1_ex_c2i)
|
||||
#define asn1_ex_i2c BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, asn1_ex_i2c)
|
||||
#define asn1_generalizedtime_to_tm BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, asn1_generalizedtime_to_tm)
|
||||
#define asn1_get_choice_selector BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, asn1_get_choice_selector)
|
||||
#define asn1_get_field_ptr BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, asn1_get_field_ptr)
|
||||
@@ -2626,6 +2628,7 @@
|
||||
#define i2d_X509_CRL_INFO BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, i2d_X509_CRL_INFO)
|
||||
#define i2d_X509_CRL_bio BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, i2d_X509_CRL_bio)
|
||||
#define i2d_X509_CRL_fp BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, i2d_X509_CRL_fp)
|
||||
#define i2d_X509_CRL_tbs BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, i2d_X509_CRL_tbs)
|
||||
#define i2d_X509_EXTENSION BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, i2d_X509_EXTENSION)
|
||||
#define i2d_X509_EXTENSIONS BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, i2d_X509_EXTENSIONS)
|
||||
#define i2d_X509_NAME BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, i2d_X509_NAME)
|
||||
@@ -2640,6 +2643,7 @@
|
||||
#define i2d_X509_VAL BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, i2d_X509_VAL)
|
||||
#define i2d_X509_bio BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, i2d_X509_bio)
|
||||
#define i2d_X509_fp BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, i2d_X509_fp)
|
||||
#define i2d_X509_tbs BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, i2d_X509_tbs)
|
||||
#define i2d_re_X509_CRL_tbs BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, i2d_re_X509_CRL_tbs)
|
||||
#define i2d_re_X509_REQ_tbs BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, i2d_re_X509_REQ_tbs)
|
||||
#define i2d_re_X509_tbs BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, i2d_re_X509_tbs)
|
||||
@@ -2773,6 +2777,13 @@
|
||||
#define v3_policy_mappings BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, v3_policy_mappings)
|
||||
#define v3_sinfo BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, v3_sinfo)
|
||||
#define v3_skey_id BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, v3_skey_id)
|
||||
#define voprf_exp2_blind BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, voprf_exp2_blind)
|
||||
#define voprf_exp2_client_key_from_bytes BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, voprf_exp2_client_key_from_bytes)
|
||||
#define voprf_exp2_generate_key BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, voprf_exp2_generate_key)
|
||||
#define voprf_exp2_issuer_key_from_bytes BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, voprf_exp2_issuer_key_from_bytes)
|
||||
#define voprf_exp2_read BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, voprf_exp2_read)
|
||||
#define voprf_exp2_sign BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, voprf_exp2_sign)
|
||||
#define voprf_exp2_unblind BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, voprf_exp2_unblind)
|
||||
#define vpaes_cbc_encrypt BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, vpaes_cbc_encrypt)
|
||||
#define vpaes_ctr32_encrypt_blocks BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, vpaes_ctr32_encrypt_blocks)
|
||||
#define vpaes_decrypt BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, vpaes_decrypt)
|
||||
@@ -2825,29 +2836,29 @@
|
||||
#define sk_ASN1_STRING_TABLE_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ASN1_STRING_TABLE_is_sorted)
|
||||
#define sk_ASN1_STRING_TABLE_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ASN1_STRING_TABLE_set_cmp_func)
|
||||
#define sk_ASN1_STRING_TABLE_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_ASN1_STRING_TABLE_deep_copy)
|
||||
#define sk_PMBTOKEN_PRETOKEN_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_PMBTOKEN_PRETOKEN_call_free_func)
|
||||
#define sk_PMBTOKEN_PRETOKEN_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_PMBTOKEN_PRETOKEN_call_copy_func)
|
||||
#define sk_PMBTOKEN_PRETOKEN_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_PMBTOKEN_PRETOKEN_call_cmp_func)
|
||||
#define sk_PMBTOKEN_PRETOKEN_new BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_PMBTOKEN_PRETOKEN_new)
|
||||
#define sk_PMBTOKEN_PRETOKEN_new_null BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_PMBTOKEN_PRETOKEN_new_null)
|
||||
#define sk_PMBTOKEN_PRETOKEN_num BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_PMBTOKEN_PRETOKEN_num)
|
||||
#define sk_PMBTOKEN_PRETOKEN_zero BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_PMBTOKEN_PRETOKEN_zero)
|
||||
#define sk_PMBTOKEN_PRETOKEN_value BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_PMBTOKEN_PRETOKEN_value)
|
||||
#define sk_PMBTOKEN_PRETOKEN_set BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_PMBTOKEN_PRETOKEN_set)
|
||||
#define sk_PMBTOKEN_PRETOKEN_free BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_PMBTOKEN_PRETOKEN_free)
|
||||
#define sk_PMBTOKEN_PRETOKEN_pop_free BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_PMBTOKEN_PRETOKEN_pop_free)
|
||||
#define sk_PMBTOKEN_PRETOKEN_insert BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_PMBTOKEN_PRETOKEN_insert)
|
||||
#define sk_PMBTOKEN_PRETOKEN_delete BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_PMBTOKEN_PRETOKEN_delete)
|
||||
#define sk_PMBTOKEN_PRETOKEN_delete_ptr BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_PMBTOKEN_PRETOKEN_delete_ptr)
|
||||
#define sk_PMBTOKEN_PRETOKEN_find BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_PMBTOKEN_PRETOKEN_find)
|
||||
#define sk_PMBTOKEN_PRETOKEN_shift BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_PMBTOKEN_PRETOKEN_shift)
|
||||
#define sk_PMBTOKEN_PRETOKEN_push BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_PMBTOKEN_PRETOKEN_push)
|
||||
#define sk_PMBTOKEN_PRETOKEN_pop BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_PMBTOKEN_PRETOKEN_pop)
|
||||
#define sk_PMBTOKEN_PRETOKEN_dup BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_PMBTOKEN_PRETOKEN_dup)
|
||||
#define sk_PMBTOKEN_PRETOKEN_sort BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_PMBTOKEN_PRETOKEN_sort)
|
||||
#define sk_PMBTOKEN_PRETOKEN_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_PMBTOKEN_PRETOKEN_is_sorted)
|
||||
#define sk_PMBTOKEN_PRETOKEN_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_PMBTOKEN_PRETOKEN_set_cmp_func)
|
||||
#define sk_PMBTOKEN_PRETOKEN_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_PMBTOKEN_PRETOKEN_deep_copy)
|
||||
#define sk_TRUST_TOKEN_PRETOKEN_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_TRUST_TOKEN_PRETOKEN_call_free_func)
|
||||
#define sk_TRUST_TOKEN_PRETOKEN_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_TRUST_TOKEN_PRETOKEN_call_copy_func)
|
||||
#define sk_TRUST_TOKEN_PRETOKEN_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_TRUST_TOKEN_PRETOKEN_call_cmp_func)
|
||||
#define sk_TRUST_TOKEN_PRETOKEN_new BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_TRUST_TOKEN_PRETOKEN_new)
|
||||
#define sk_TRUST_TOKEN_PRETOKEN_new_null BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_TRUST_TOKEN_PRETOKEN_new_null)
|
||||
#define sk_TRUST_TOKEN_PRETOKEN_num BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_TRUST_TOKEN_PRETOKEN_num)
|
||||
#define sk_TRUST_TOKEN_PRETOKEN_zero BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_TRUST_TOKEN_PRETOKEN_zero)
|
||||
#define sk_TRUST_TOKEN_PRETOKEN_value BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_TRUST_TOKEN_PRETOKEN_value)
|
||||
#define sk_TRUST_TOKEN_PRETOKEN_set BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_TRUST_TOKEN_PRETOKEN_set)
|
||||
#define sk_TRUST_TOKEN_PRETOKEN_free BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_TRUST_TOKEN_PRETOKEN_free)
|
||||
#define sk_TRUST_TOKEN_PRETOKEN_pop_free BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_TRUST_TOKEN_PRETOKEN_pop_free)
|
||||
#define sk_TRUST_TOKEN_PRETOKEN_insert BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_TRUST_TOKEN_PRETOKEN_insert)
|
||||
#define sk_TRUST_TOKEN_PRETOKEN_delete BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_TRUST_TOKEN_PRETOKEN_delete)
|
||||
#define sk_TRUST_TOKEN_PRETOKEN_delete_ptr BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_TRUST_TOKEN_PRETOKEN_delete_ptr)
|
||||
#define sk_TRUST_TOKEN_PRETOKEN_find BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_TRUST_TOKEN_PRETOKEN_find)
|
||||
#define sk_TRUST_TOKEN_PRETOKEN_shift BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_TRUST_TOKEN_PRETOKEN_shift)
|
||||
#define sk_TRUST_TOKEN_PRETOKEN_push BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_TRUST_TOKEN_PRETOKEN_push)
|
||||
#define sk_TRUST_TOKEN_PRETOKEN_pop BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_TRUST_TOKEN_PRETOKEN_pop)
|
||||
#define sk_TRUST_TOKEN_PRETOKEN_dup BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_TRUST_TOKEN_PRETOKEN_dup)
|
||||
#define sk_TRUST_TOKEN_PRETOKEN_sort BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_TRUST_TOKEN_PRETOKEN_sort)
|
||||
#define sk_TRUST_TOKEN_PRETOKEN_is_sorted BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_TRUST_TOKEN_PRETOKEN_is_sorted)
|
||||
#define sk_TRUST_TOKEN_PRETOKEN_set_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_TRUST_TOKEN_PRETOKEN_set_cmp_func)
|
||||
#define sk_TRUST_TOKEN_PRETOKEN_deep_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_TRUST_TOKEN_PRETOKEN_deep_copy)
|
||||
#define sk_CRYPTO_EX_DATA_FUNCS_call_free_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CRYPTO_EX_DATA_FUNCS_call_free_func)
|
||||
#define sk_CRYPTO_EX_DATA_FUNCS_call_copy_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CRYPTO_EX_DATA_FUNCS_call_copy_func)
|
||||
#define sk_CRYPTO_EX_DATA_FUNCS_call_cmp_func BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, sk_CRYPTO_EX_DATA_FUNCS_call_cmp_func)
|
||||
|
||||
@@ -88,7 +88,6 @@
|
||||
#define _ASN1_OBJECT_free BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ASN1_OBJECT_free)
|
||||
#define _ASN1_OBJECT_it BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ASN1_OBJECT_it)
|
||||
#define _ASN1_OBJECT_new BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ASN1_OBJECT_new)
|
||||
#define _ASN1_OCTET_STRING_NDEF_it BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ASN1_OCTET_STRING_NDEF_it)
|
||||
#define _ASN1_OCTET_STRING_cmp BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ASN1_OCTET_STRING_cmp)
|
||||
#define _ASN1_OCTET_STRING_dup BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ASN1_OCTET_STRING_dup)
|
||||
#define _ASN1_OCTET_STRING_free BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ASN1_OCTET_STRING_free)
|
||||
@@ -183,7 +182,6 @@
|
||||
#define _ASN1_item_i2d BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ASN1_item_i2d)
|
||||
#define _ASN1_item_i2d_bio BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ASN1_item_i2d_bio)
|
||||
#define _ASN1_item_i2d_fp BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ASN1_item_i2d_fp)
|
||||
#define _ASN1_item_ndef_i2d BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ASN1_item_ndef_i2d)
|
||||
#define _ASN1_item_new BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ASN1_item_new)
|
||||
#define _ASN1_item_pack BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ASN1_item_pack)
|
||||
#define _ASN1_item_sign BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ASN1_item_sign)
|
||||
@@ -194,13 +192,11 @@
|
||||
#define _ASN1_mbstring_ncopy BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ASN1_mbstring_ncopy)
|
||||
#define _ASN1_object_size BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ASN1_object_size)
|
||||
#define _ASN1_primitive_free BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ASN1_primitive_free)
|
||||
#define _ASN1_primitive_new BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ASN1_primitive_new)
|
||||
#define _ASN1_put_eoc BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ASN1_put_eoc)
|
||||
#define _ASN1_put_object BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ASN1_put_object)
|
||||
#define _ASN1_tag2bit BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ASN1_tag2bit)
|
||||
#define _ASN1_tag2str BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ASN1_tag2str)
|
||||
#define _ASN1_template_free BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ASN1_template_free)
|
||||
#define _ASN1_template_new BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ASN1_template_new)
|
||||
#define _AUTHORITY_INFO_ACCESS_free BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, AUTHORITY_INFO_ACCESS_free)
|
||||
#define _AUTHORITY_INFO_ACCESS_it BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, AUTHORITY_INFO_ACCESS_it)
|
||||
#define _AUTHORITY_INFO_ACCESS_new BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, AUTHORITY_INFO_ACCESS_new)
|
||||
@@ -290,6 +286,7 @@
|
||||
#define _BIO_set_mem_eof_return BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, BIO_set_mem_eof_return)
|
||||
#define _BIO_set_nbio BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, BIO_set_nbio)
|
||||
#define _BIO_set_retry_read BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, BIO_set_retry_read)
|
||||
#define _BIO_set_retry_reason BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, BIO_set_retry_reason)
|
||||
#define _BIO_set_retry_special BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, BIO_set_retry_special)
|
||||
#define _BIO_set_retry_write BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, BIO_set_retry_write)
|
||||
#define _BIO_set_shutdown BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, BIO_set_shutdown)
|
||||
@@ -514,7 +511,9 @@
|
||||
#define _CBS_get_u8 BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, CBS_get_u8)
|
||||
#define _CBS_get_u8_length_prefixed BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, CBS_get_u8_length_prefixed)
|
||||
#define _CBS_init BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, CBS_init)
|
||||
#define _CBS_is_unsigned_asn1_integer BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, CBS_is_unsigned_asn1_integer)
|
||||
#define _CBS_is_valid_asn1_bitstring BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, CBS_is_valid_asn1_bitstring)
|
||||
#define _CBS_is_valid_asn1_integer BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, CBS_is_valid_asn1_integer)
|
||||
#define _CBS_len BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, CBS_len)
|
||||
#define _CBS_mem_equal BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, CBS_mem_equal)
|
||||
#define _CBS_peek_asn1_tag BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, CBS_peek_asn1_tag)
|
||||
@@ -1077,6 +1076,7 @@
|
||||
#define _EVP_aead_aes_128_ccm_bluetooth_8 BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, EVP_aead_aes_128_ccm_bluetooth_8)
|
||||
#define _EVP_aead_aes_128_ctr_hmac_sha256 BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, EVP_aead_aes_128_ctr_hmac_sha256)
|
||||
#define _EVP_aead_aes_128_gcm BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, EVP_aead_aes_128_gcm)
|
||||
#define _EVP_aead_aes_128_gcm_randnonce BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, EVP_aead_aes_128_gcm_randnonce)
|
||||
#define _EVP_aead_aes_128_gcm_siv BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, EVP_aead_aes_128_gcm_siv)
|
||||
#define _EVP_aead_aes_128_gcm_tls12 BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, EVP_aead_aes_128_gcm_tls12)
|
||||
#define _EVP_aead_aes_128_gcm_tls13 BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, EVP_aead_aes_128_gcm_tls13)
|
||||
@@ -1087,6 +1087,7 @@
|
||||
#define _EVP_aead_aes_256_cbc_sha384_tls BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, EVP_aead_aes_256_cbc_sha384_tls)
|
||||
#define _EVP_aead_aes_256_ctr_hmac_sha256 BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, EVP_aead_aes_256_ctr_hmac_sha256)
|
||||
#define _EVP_aead_aes_256_gcm BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, EVP_aead_aes_256_gcm)
|
||||
#define _EVP_aead_aes_256_gcm_randnonce BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, EVP_aead_aes_256_gcm_randnonce)
|
||||
#define _EVP_aead_aes_256_gcm_siv BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, EVP_aead_aes_256_gcm_siv)
|
||||
#define _EVP_aead_aes_256_gcm_tls12 BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, EVP_aead_aes_256_gcm_tls12)
|
||||
#define _EVP_aead_aes_256_gcm_tls13 BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, EVP_aead_aes_256_gcm_tls13)
|
||||
@@ -1418,7 +1419,6 @@
|
||||
#define _PKCS8_parse_encrypted_private_key BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, PKCS8_parse_encrypted_private_key)
|
||||
#define _PKCS8_pkey_get0 BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, PKCS8_pkey_get0)
|
||||
#define _PKCS8_pkey_set0 BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, PKCS8_pkey_set0)
|
||||
#define _PMBTOKEN_PRETOKEN_free BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, PMBTOKEN_PRETOKEN_free)
|
||||
#define _POLICYINFO_free BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, POLICYINFO_free)
|
||||
#define _POLICYINFO_it BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, POLICYINFO_it)
|
||||
#define _POLICYINFO_new BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, POLICYINFO_new)
|
||||
@@ -1572,12 +1572,14 @@
|
||||
#define _TRUST_TOKEN_ISSUER_issue BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, TRUST_TOKEN_ISSUER_issue)
|
||||
#define _TRUST_TOKEN_ISSUER_new BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, TRUST_TOKEN_ISSUER_new)
|
||||
#define _TRUST_TOKEN_ISSUER_redeem BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, TRUST_TOKEN_ISSUER_redeem)
|
||||
#define _TRUST_TOKEN_ISSUER_redeem_raw BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, TRUST_TOKEN_ISSUER_redeem_raw)
|
||||
#define _TRUST_TOKEN_ISSUER_set_metadata_key BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, TRUST_TOKEN_ISSUER_set_metadata_key)
|
||||
#define _TRUST_TOKEN_ISSUER_set_srr_key BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, TRUST_TOKEN_ISSUER_set_srr_key)
|
||||
#define _TRUST_TOKEN_PRETOKEN_free BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, TRUST_TOKEN_PRETOKEN_free)
|
||||
#define _TRUST_TOKEN_decode_private_metadata BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, TRUST_TOKEN_decode_private_metadata)
|
||||
#define _TRUST_TOKEN_experiment_v1 BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, TRUST_TOKEN_experiment_v1)
|
||||
#define _TRUST_TOKEN_experiment_v2_pmb BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, TRUST_TOKEN_experiment_v2_pmb)
|
||||
#define _TRUST_TOKEN_experiment_v2_pp BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, TRUST_TOKEN_experiment_v2_pp)
|
||||
#define _TRUST_TOKEN_experiment_v2_voprf BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, TRUST_TOKEN_experiment_v2_voprf)
|
||||
#define _TRUST_TOKEN_free BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, TRUST_TOKEN_free)
|
||||
#define _TRUST_TOKEN_generate_key BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, TRUST_TOKEN_generate_key)
|
||||
#define _TRUST_TOKEN_new BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, TRUST_TOKEN_new)
|
||||
@@ -2092,6 +2094,8 @@
|
||||
#define _X509_reject_clear BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, X509_reject_clear)
|
||||
#define _X509_set1_notAfter BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, X509_set1_notAfter)
|
||||
#define _X509_set1_notBefore BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, X509_set1_notBefore)
|
||||
#define _X509_set1_signature_algo BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, X509_set1_signature_algo)
|
||||
#define _X509_set1_signature_value BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, X509_set1_signature_value)
|
||||
#define _X509_set_ex_data BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, X509_set_ex_data)
|
||||
#define _X509_set_issuer_name BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, X509_set_issuer_name)
|
||||
#define _X509_set_notAfter BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, X509_set_notAfter)
|
||||
@@ -2176,8 +2180,6 @@
|
||||
#define _asn1_enc_init BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, asn1_enc_init)
|
||||
#define _asn1_enc_restore BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, asn1_enc_restore)
|
||||
#define _asn1_enc_save BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, asn1_enc_save)
|
||||
#define _asn1_ex_c2i BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, asn1_ex_c2i)
|
||||
#define _asn1_ex_i2c BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, asn1_ex_i2c)
|
||||
#define _asn1_generalizedtime_to_tm BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, asn1_generalizedtime_to_tm)
|
||||
#define _asn1_get_choice_selector BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, asn1_get_choice_selector)
|
||||
#define _asn1_get_field_ptr BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, asn1_get_field_ptr)
|
||||
@@ -2631,6 +2633,7 @@
|
||||
#define _i2d_X509_CRL_INFO BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, i2d_X509_CRL_INFO)
|
||||
#define _i2d_X509_CRL_bio BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, i2d_X509_CRL_bio)
|
||||
#define _i2d_X509_CRL_fp BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, i2d_X509_CRL_fp)
|
||||
#define _i2d_X509_CRL_tbs BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, i2d_X509_CRL_tbs)
|
||||
#define _i2d_X509_EXTENSION BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, i2d_X509_EXTENSION)
|
||||
#define _i2d_X509_EXTENSIONS BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, i2d_X509_EXTENSIONS)
|
||||
#define _i2d_X509_NAME BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, i2d_X509_NAME)
|
||||
@@ -2645,6 +2648,7 @@
|
||||
#define _i2d_X509_VAL BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, i2d_X509_VAL)
|
||||
#define _i2d_X509_bio BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, i2d_X509_bio)
|
||||
#define _i2d_X509_fp BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, i2d_X509_fp)
|
||||
#define _i2d_X509_tbs BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, i2d_X509_tbs)
|
||||
#define _i2d_re_X509_CRL_tbs BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, i2d_re_X509_CRL_tbs)
|
||||
#define _i2d_re_X509_REQ_tbs BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, i2d_re_X509_REQ_tbs)
|
||||
#define _i2d_re_X509_tbs BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, i2d_re_X509_tbs)
|
||||
@@ -2778,6 +2782,13 @@
|
||||
#define _v3_policy_mappings BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, v3_policy_mappings)
|
||||
#define _v3_sinfo BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, v3_sinfo)
|
||||
#define _v3_skey_id BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, v3_skey_id)
|
||||
#define _voprf_exp2_blind BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, voprf_exp2_blind)
|
||||
#define _voprf_exp2_client_key_from_bytes BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, voprf_exp2_client_key_from_bytes)
|
||||
#define _voprf_exp2_generate_key BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, voprf_exp2_generate_key)
|
||||
#define _voprf_exp2_issuer_key_from_bytes BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, voprf_exp2_issuer_key_from_bytes)
|
||||
#define _voprf_exp2_read BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, voprf_exp2_read)
|
||||
#define _voprf_exp2_sign BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, voprf_exp2_sign)
|
||||
#define _voprf_exp2_unblind BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, voprf_exp2_unblind)
|
||||
#define _vpaes_cbc_encrypt BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, vpaes_cbc_encrypt)
|
||||
#define _vpaes_ctr32_encrypt_blocks BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, vpaes_ctr32_encrypt_blocks)
|
||||
#define _vpaes_decrypt BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, vpaes_decrypt)
|
||||
|
||||
@@ -310,14 +310,25 @@ OPENSSL_EXPORT int CBS_get_optional_asn1_bool(CBS *cbs, int *out, unsigned tag,
|
||||
int default_value);
|
||||
|
||||
// CBS_is_valid_asn1_bitstring returns one if |cbs| is a valid ASN.1 BIT STRING
|
||||
// and zero otherwise.
|
||||
// body and zero otherwise.
|
||||
OPENSSL_EXPORT int CBS_is_valid_asn1_bitstring(const CBS *cbs);
|
||||
|
||||
// CBS_asn1_bitstring_has_bit returns one if |cbs| is a valid ASN.1 BIT STRING
|
||||
// and the specified bit is present and set. Otherwise, it returns zero. |bit|
|
||||
// is indexed starting from zero.
|
||||
// body and the specified bit is present and set. Otherwise, it returns zero.
|
||||
// |bit| is indexed starting from zero.
|
||||
OPENSSL_EXPORT int CBS_asn1_bitstring_has_bit(const CBS *cbs, unsigned bit);
|
||||
|
||||
// CBS_is_valid_asn1_integer returns one if |cbs| is a valid ASN.1 INTEGER,
|
||||
// body and zero otherwise. On success, if |out_is_negative| is non-NULL,
|
||||
// |*out_is_negative| will be set to one if |cbs| is negative and zero
|
||||
// otherwise.
|
||||
OPENSSL_EXPORT int CBS_is_valid_asn1_integer(const CBS *cbs,
|
||||
int *out_is_negative);
|
||||
|
||||
// CBS_is_unsigned_asn1_integer returns one if |cbs| is a valid non-negative
|
||||
// ASN.1 INTEGER body and zero otherwise.
|
||||
OPENSSL_EXPORT int CBS_is_unsigned_asn1_integer(const CBS *cbs);
|
||||
|
||||
// CBS_asn1_oid_to_text interprets |cbs| as DER-encoded ASN.1 OBJECT IDENTIFIER
|
||||
// contents (not including the element framing) and returns the ASCII
|
||||
// representation (e.g., "1.2.840.113554.4.1.72585") in a newly-allocated
|
||||
|
||||
@@ -65,6 +65,12 @@ extern "C" {
|
||||
|
||||
|
||||
// DES.
|
||||
//
|
||||
// This module is deprecated and retained for legacy reasons only. It is slow
|
||||
// and may leak key material with timing or cache side channels. Moreover,
|
||||
// single-keyed DES is broken and can be brute-forced in under a day.
|
||||
//
|
||||
// Use a modern cipher, such as AES-GCM or ChaCha20-Poly1305, instead.
|
||||
|
||||
|
||||
typedef struct DES_cblock_st {
|
||||
|
||||
@@ -716,7 +716,8 @@ OPENSSL_EXPORT int EVP_PKEY_CTX_get_signature_md(EVP_PKEY_CTX *ctx,
|
||||
// RSA specific control functions.
|
||||
|
||||
// EVP_PKEY_CTX_set_rsa_padding sets the padding type to use. It should be one
|
||||
// of the |RSA_*_PADDING| values. Returns one on success or zero on error.
|
||||
// of the |RSA_*_PADDING| values. Returns one on success or zero on error. By
|
||||
// default, the padding is |RSA_PKCS1_PADDING|.
|
||||
OPENSSL_EXPORT int EVP_PKEY_CTX_set_rsa_padding(EVP_PKEY_CTX *ctx, int padding);
|
||||
|
||||
// EVP_PKEY_CTX_get_rsa_padding sets |*out_padding| to the current padding
|
||||
@@ -734,6 +735,8 @@ OPENSSL_EXPORT int EVP_PKEY_CTX_get_rsa_padding(EVP_PKEY_CTX *ctx,
|
||||
// If unsure, use -1.
|
||||
//
|
||||
// Returns one on success or zero on error.
|
||||
//
|
||||
// TODO(davidben): The default is currently -2. Switch it to -1.
|
||||
OPENSSL_EXPORT int EVP_PKEY_CTX_set_rsa_pss_saltlen(EVP_PKEY_CTX *ctx,
|
||||
int salt_len);
|
||||
|
||||
@@ -758,7 +761,10 @@ OPENSSL_EXPORT int EVP_PKEY_CTX_set_rsa_keygen_pubexp(EVP_PKEY_CTX *ctx,
|
||||
BIGNUM *e);
|
||||
|
||||
// EVP_PKEY_CTX_set_rsa_oaep_md sets |md| as the digest used in OAEP padding.
|
||||
// Returns one on success or zero on error.
|
||||
// Returns one on success or zero on error. If unset, the default is SHA-1.
|
||||
// Callers are recommended to overwrite this default.
|
||||
//
|
||||
// TODO(davidben): Remove the default and require callers specify this.
|
||||
OPENSSL_EXPORT int EVP_PKEY_CTX_set_rsa_oaep_md(EVP_PKEY_CTX *ctx,
|
||||
const EVP_MD *md);
|
||||
|
||||
@@ -769,6 +775,10 @@ OPENSSL_EXPORT int EVP_PKEY_CTX_get_rsa_oaep_md(EVP_PKEY_CTX *ctx,
|
||||
|
||||
// EVP_PKEY_CTX_set_rsa_mgf1_md sets |md| as the digest used in MGF1. Returns
|
||||
// one on success or zero on error.
|
||||
//
|
||||
// If unset, the default is the signing hash for |RSA_PKCS1_PSS_PADDING| and the
|
||||
// OAEP hash for |RSA_PKCS1_OAEP_PADDING|. Callers are recommended to use this
|
||||
// default and not call this function.
|
||||
OPENSSL_EXPORT int EVP_PKEY_CTX_set_rsa_mgf1_md(EVP_PKEY_CTX *ctx,
|
||||
const EVP_MD *md);
|
||||
|
||||
|
||||
@@ -62,64 +62,63 @@
|
||||
#include "CCryptoBoringSSL_cipher.h"
|
||||
#include "CCryptoBoringSSL_digest.h"
|
||||
#include "CCryptoBoringSSL_evp.h"
|
||||
#include "CCryptoBoringSSL_stack.h"
|
||||
#include "CCryptoBoringSSL_pkcs7.h"
|
||||
#include "CCryptoBoringSSL_stack.h"
|
||||
#include "CCryptoBoringSSL_x509.h"
|
||||
|
||||
/* For compatibility with open-iscsi, which assumes that it can get
|
||||
* |OPENSSL_malloc| from pem.h or err.h */
|
||||
// For compatibility with open-iscsi, which assumes that it can get
|
||||
// |OPENSSL_malloc| from pem.h or err.h
|
||||
#include "CCryptoBoringSSL_crypto.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#define PEM_BUFSIZE 1024
|
||||
#define PEM_BUFSIZE 1024
|
||||
|
||||
#define PEM_STRING_X509_OLD "X509 CERTIFICATE"
|
||||
#define PEM_STRING_X509 "CERTIFICATE"
|
||||
#define PEM_STRING_X509_PAIR "CERTIFICATE PAIR"
|
||||
#define PEM_STRING_X509_TRUSTED "TRUSTED CERTIFICATE"
|
||||
#define PEM_STRING_X509_REQ_OLD "NEW CERTIFICATE REQUEST"
|
||||
#define PEM_STRING_X509_REQ "CERTIFICATE REQUEST"
|
||||
#define PEM_STRING_X509_CRL "X509 CRL"
|
||||
#define PEM_STRING_EVP_PKEY "ANY PRIVATE KEY"
|
||||
#define PEM_STRING_PUBLIC "PUBLIC KEY"
|
||||
#define PEM_STRING_RSA "RSA PRIVATE KEY"
|
||||
#define PEM_STRING_RSA_PUBLIC "RSA PUBLIC KEY"
|
||||
#define PEM_STRING_DSA "DSA PRIVATE KEY"
|
||||
#define PEM_STRING_DSA_PUBLIC "DSA PUBLIC KEY"
|
||||
#define PEM_STRING_X509_OLD "X509 CERTIFICATE"
|
||||
#define PEM_STRING_X509 "CERTIFICATE"
|
||||
#define PEM_STRING_X509_PAIR "CERTIFICATE PAIR"
|
||||
#define PEM_STRING_X509_TRUSTED "TRUSTED CERTIFICATE"
|
||||
#define PEM_STRING_X509_REQ_OLD "NEW CERTIFICATE REQUEST"
|
||||
#define PEM_STRING_X509_REQ "CERTIFICATE REQUEST"
|
||||
#define PEM_STRING_X509_CRL "X509 CRL"
|
||||
#define PEM_STRING_EVP_PKEY "ANY PRIVATE KEY"
|
||||
#define PEM_STRING_PUBLIC "PUBLIC KEY"
|
||||
#define PEM_STRING_RSA "RSA PRIVATE KEY"
|
||||
#define PEM_STRING_RSA_PUBLIC "RSA PUBLIC KEY"
|
||||
#define PEM_STRING_DSA "DSA PRIVATE KEY"
|
||||
#define PEM_STRING_DSA_PUBLIC "DSA PUBLIC KEY"
|
||||
#define PEM_STRING_EC "EC PRIVATE KEY"
|
||||
#define PEM_STRING_PKCS7 "PKCS7"
|
||||
#define PEM_STRING_PKCS7_SIGNED "PKCS #7 SIGNED DATA"
|
||||
#define PEM_STRING_PKCS8 "ENCRYPTED PRIVATE KEY"
|
||||
#define PEM_STRING_PKCS8INF "PRIVATE KEY"
|
||||
#define PEM_STRING_DHPARAMS "DH PARAMETERS"
|
||||
#define PEM_STRING_SSL_SESSION "SSL SESSION PARAMETERS"
|
||||
#define PEM_STRING_DSAPARAMS "DSA PARAMETERS"
|
||||
#define PEM_STRING_PKCS7 "PKCS7"
|
||||
#define PEM_STRING_PKCS7_SIGNED "PKCS #7 SIGNED DATA"
|
||||
#define PEM_STRING_PKCS8 "ENCRYPTED PRIVATE KEY"
|
||||
#define PEM_STRING_PKCS8INF "PRIVATE KEY"
|
||||
#define PEM_STRING_DHPARAMS "DH PARAMETERS"
|
||||
#define PEM_STRING_SSL_SESSION "SSL SESSION PARAMETERS"
|
||||
#define PEM_STRING_DSAPARAMS "DSA PARAMETERS"
|
||||
#define PEM_STRING_ECDSA_PUBLIC "ECDSA PUBLIC KEY"
|
||||
#define PEM_STRING_ECPRIVATEKEY "EC PRIVATE KEY"
|
||||
#define PEM_STRING_CMS "CMS"
|
||||
#define PEM_STRING_ECPRIVATEKEY "EC PRIVATE KEY"
|
||||
#define PEM_STRING_CMS "CMS"
|
||||
|
||||
/* enc_type is one off */
|
||||
#define PEM_TYPE_ENCRYPTED 10
|
||||
#define PEM_TYPE_MIC_ONLY 20
|
||||
#define PEM_TYPE_MIC_CLEAR 30
|
||||
#define PEM_TYPE_CLEAR 40
|
||||
// enc_type is one off
|
||||
#define PEM_TYPE_ENCRYPTED 10
|
||||
#define PEM_TYPE_MIC_ONLY 20
|
||||
#define PEM_TYPE_MIC_CLEAR 30
|
||||
#define PEM_TYPE_CLEAR 40
|
||||
|
||||
/* These macros make the PEM_read/PEM_write functions easier to maintain and
|
||||
* write. Now they are all implemented with either:
|
||||
* IMPLEMENT_PEM_rw(...) or IMPLEMENT_PEM_rw_cb(...)
|
||||
*/
|
||||
// These macros make the PEM_read/PEM_write functions easier to maintain and
|
||||
// write. Now they are all implemented with either:
|
||||
// IMPLEMENT_PEM_rw(...) or IMPLEMENT_PEM_rw_cb(...)
|
||||
|
||||
#ifdef OPENSSL_NO_FP_API
|
||||
|
||||
#define IMPLEMENT_PEM_read_fp(name, type, str, asn1) /**/
|
||||
#define IMPLEMENT_PEM_write_fp(name, type, str, asn1) /**/
|
||||
#define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) /**/
|
||||
#define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) /**/
|
||||
#define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) /**/
|
||||
#define IMPLEMENT_PEM_read_fp(name, type, str, asn1) //
|
||||
#define IMPLEMENT_PEM_write_fp(name, type, str, asn1) //
|
||||
#define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) //
|
||||
#define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) //
|
||||
#define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) //
|
||||
|
||||
#else
|
||||
|
||||
@@ -228,133 +227,178 @@ extern "C" {
|
||||
}
|
||||
|
||||
#define IMPLEMENT_PEM_write(name, type, str, asn1) \
|
||||
IMPLEMENT_PEM_write_bio(name, type, str, asn1) \
|
||||
IMPLEMENT_PEM_write_fp(name, type, str, asn1)
|
||||
IMPLEMENT_PEM_write_bio(name, type, str, asn1) \
|
||||
IMPLEMENT_PEM_write_fp(name, type, str, asn1)
|
||||
|
||||
#define IMPLEMENT_PEM_write_const(name, type, str, asn1) \
|
||||
IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \
|
||||
IMPLEMENT_PEM_write_fp_const(name, type, str, asn1)
|
||||
IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \
|
||||
IMPLEMENT_PEM_write_fp_const(name, type, str, asn1)
|
||||
|
||||
#define IMPLEMENT_PEM_write_cb(name, type, str, asn1) \
|
||||
IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \
|
||||
IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1)
|
||||
IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \
|
||||
IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1)
|
||||
|
||||
#define IMPLEMENT_PEM_write_cb_const(name, type, str, asn1) \
|
||||
IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \
|
||||
IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1)
|
||||
IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \
|
||||
IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1)
|
||||
|
||||
#define IMPLEMENT_PEM_read(name, type, str, asn1) \
|
||||
IMPLEMENT_PEM_read_bio(name, type, str, asn1) \
|
||||
IMPLEMENT_PEM_read_fp(name, type, str, asn1)
|
||||
IMPLEMENT_PEM_read_bio(name, type, str, asn1) \
|
||||
IMPLEMENT_PEM_read_fp(name, type, str, asn1)
|
||||
|
||||
#define IMPLEMENT_PEM_rw(name, type, str, asn1) \
|
||||
IMPLEMENT_PEM_read(name, type, str, asn1) \
|
||||
IMPLEMENT_PEM_write(name, type, str, asn1)
|
||||
IMPLEMENT_PEM_read(name, type, str, asn1) \
|
||||
IMPLEMENT_PEM_write(name, type, str, asn1)
|
||||
|
||||
#define IMPLEMENT_PEM_rw_const(name, type, str, asn1) \
|
||||
IMPLEMENT_PEM_read(name, type, str, asn1) \
|
||||
IMPLEMENT_PEM_write_const(name, type, str, asn1)
|
||||
IMPLEMENT_PEM_read(name, type, str, asn1) \
|
||||
IMPLEMENT_PEM_write_const(name, type, str, asn1)
|
||||
|
||||
#define IMPLEMENT_PEM_rw_cb(name, type, str, asn1) \
|
||||
IMPLEMENT_PEM_read(name, type, str, asn1) \
|
||||
IMPLEMENT_PEM_write_cb(name, type, str, asn1)
|
||||
IMPLEMENT_PEM_read(name, type, str, asn1) \
|
||||
IMPLEMENT_PEM_write_cb(name, type, str, asn1)
|
||||
|
||||
/* These are the same except they are for the declarations */
|
||||
// These are the same except they are for the declarations
|
||||
|
||||
#if defined(OPENSSL_NO_FP_API)
|
||||
|
||||
#define DECLARE_PEM_read_fp(name, type) /**/
|
||||
#define DECLARE_PEM_write_fp(name, type) /**/
|
||||
#define DECLARE_PEM_write_cb_fp(name, type) /**/
|
||||
#define DECLARE_PEM_read_fp(name, type) //
|
||||
#define DECLARE_PEM_write_fp(name, type) //
|
||||
#define DECLARE_PEM_write_cb_fp(name, type) //
|
||||
|
||||
#else
|
||||
|
||||
#define DECLARE_PEM_read_fp(name, type) \
|
||||
OPENSSL_EXPORT type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u);
|
||||
#define DECLARE_PEM_read_fp(name, type) \
|
||||
OPENSSL_EXPORT type *PEM_read_##name(FILE *fp, type **x, \
|
||||
pem_password_cb *cb, void *u);
|
||||
|
||||
#define DECLARE_PEM_write_fp(name, type) \
|
||||
OPENSSL_EXPORT int PEM_write_##name(FILE *fp, type *x);
|
||||
OPENSSL_EXPORT int PEM_write_##name(FILE *fp, type *x);
|
||||
|
||||
#define DECLARE_PEM_write_fp_const(name, type) \
|
||||
OPENSSL_EXPORT int PEM_write_##name(FILE *fp, const type *x);
|
||||
OPENSSL_EXPORT int PEM_write_##name(FILE *fp, const type *x);
|
||||
|
||||
#define DECLARE_PEM_write_cb_fp(name, type) \
|
||||
OPENSSL_EXPORT int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \
|
||||
unsigned char *kstr, int klen, pem_password_cb *cb, void *u);
|
||||
#define DECLARE_PEM_write_cb_fp(name, type) \
|
||||
OPENSSL_EXPORT int PEM_write_##name( \
|
||||
FILE *fp, type *x, const EVP_CIPHER *enc, unsigned char *kstr, int klen, \
|
||||
pem_password_cb *cb, void *u);
|
||||
|
||||
#endif
|
||||
|
||||
#define DECLARE_PEM_read_bio(name, type) \
|
||||
OPENSSL_EXPORT type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u);
|
||||
#define DECLARE_PEM_read_bio(name, type) \
|
||||
OPENSSL_EXPORT type *PEM_read_bio_##name(BIO *bp, type **x, \
|
||||
pem_password_cb *cb, void *u);
|
||||
|
||||
#define DECLARE_PEM_write_bio(name, type) \
|
||||
OPENSSL_EXPORT int PEM_write_bio_##name(BIO *bp, type *x);
|
||||
OPENSSL_EXPORT int PEM_write_bio_##name(BIO *bp, type *x);
|
||||
|
||||
#define DECLARE_PEM_write_bio_const(name, type) \
|
||||
OPENSSL_EXPORT int PEM_write_bio_##name(BIO *bp, const type *x);
|
||||
OPENSSL_EXPORT int PEM_write_bio_##name(BIO *bp, const type *x);
|
||||
|
||||
#define DECLARE_PEM_write_cb_bio(name, type) \
|
||||
OPENSSL_EXPORT int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
|
||||
unsigned char *kstr, int klen, pem_password_cb *cb, void *u);
|
||||
#define DECLARE_PEM_write_cb_bio(name, type) \
|
||||
OPENSSL_EXPORT int PEM_write_bio_##name( \
|
||||
BIO *bp, type *x, const EVP_CIPHER *enc, unsigned char *kstr, int klen, \
|
||||
pem_password_cb *cb, void *u);
|
||||
|
||||
|
||||
#define DECLARE_PEM_write(name, type) \
|
||||
DECLARE_PEM_write_bio(name, type) \
|
||||
DECLARE_PEM_write_fp(name, type)
|
||||
DECLARE_PEM_write_bio(name, type) \
|
||||
DECLARE_PEM_write_fp(name, type)
|
||||
|
||||
#define DECLARE_PEM_write_const(name, type) \
|
||||
DECLARE_PEM_write_bio_const(name, type) \
|
||||
DECLARE_PEM_write_fp_const(name, type)
|
||||
DECLARE_PEM_write_bio_const(name, type) \
|
||||
DECLARE_PEM_write_fp_const(name, type)
|
||||
|
||||
#define DECLARE_PEM_write_cb(name, type) \
|
||||
DECLARE_PEM_write_cb_bio(name, type) \
|
||||
DECLARE_PEM_write_cb_fp(name, type)
|
||||
DECLARE_PEM_write_cb_bio(name, type) \
|
||||
DECLARE_PEM_write_cb_fp(name, type)
|
||||
|
||||
#define DECLARE_PEM_read(name, type) \
|
||||
DECLARE_PEM_read_bio(name, type) \
|
||||
DECLARE_PEM_read_fp(name, type)
|
||||
DECLARE_PEM_read_bio(name, type) \
|
||||
DECLARE_PEM_read_fp(name, type)
|
||||
|
||||
#define DECLARE_PEM_rw(name, type) \
|
||||
DECLARE_PEM_read(name, type) \
|
||||
DECLARE_PEM_write(name, type)
|
||||
DECLARE_PEM_read(name, type) \
|
||||
DECLARE_PEM_write(name, type)
|
||||
|
||||
#define DECLARE_PEM_rw_const(name, type) \
|
||||
DECLARE_PEM_read(name, type) \
|
||||
DECLARE_PEM_write_const(name, type)
|
||||
DECLARE_PEM_read(name, type) \
|
||||
DECLARE_PEM_write_const(name, type)
|
||||
|
||||
#define DECLARE_PEM_rw_cb(name, type) \
|
||||
DECLARE_PEM_read(name, type) \
|
||||
DECLARE_PEM_write_cb(name, type)
|
||||
DECLARE_PEM_read(name, type) \
|
||||
DECLARE_PEM_write_cb(name, type)
|
||||
|
||||
/* "userdata": new with OpenSSL 0.9.4 */
|
||||
// "userdata": new with OpenSSL 0.9.4
|
||||
typedef int pem_password_cb(char *buf, int size, int rwflag, void *userdata);
|
||||
|
||||
OPENSSL_EXPORT int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher);
|
||||
OPENSSL_EXPORT int PEM_do_header (EVP_CIPHER_INFO *cipher, unsigned char *data,long *len, pem_password_cb *callback,void *u);
|
||||
OPENSSL_EXPORT int PEM_get_EVP_CIPHER_INFO(char *header,
|
||||
EVP_CIPHER_INFO *cipher);
|
||||
OPENSSL_EXPORT int PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data,
|
||||
long *len, pem_password_cb *callback, void *u);
|
||||
|
||||
OPENSSL_EXPORT int PEM_read_bio(BIO *bp, char **name, char **header, unsigned char **data,long *len);
|
||||
OPENSSL_EXPORT int PEM_write_bio(BIO *bp,const char *name, const char *hdr, const unsigned char *data, long len);
|
||||
OPENSSL_EXPORT int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, const char *name, BIO *bp, pem_password_cb *cb, void *u);
|
||||
OPENSSL_EXPORT void * PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp, void **x, pem_password_cb *cb, void *u);
|
||||
OPENSSL_EXPORT int PEM_ASN1_write_bio(i2d_of_void *i2d,const char *name,BIO *bp, void *x, const EVP_CIPHER *enc,unsigned char *kstr,int klen, pem_password_cb *cb, void *u);
|
||||
// PEM_read_bio reads from |bp|, until the next PEM block. If one is found, it
|
||||
// returns one and sets |*name|, |*header|, and |*data| to newly-allocated
|
||||
// buffers containing the PEM type, the header block, and the decoded data,
|
||||
// respectively. |*name| and |*header| are NUL-terminated C strings, while
|
||||
// |*data| has |*len| bytes. The caller must release each of |*name|, |*header|,
|
||||
// and |*data| with |OPENSSL_free| when done. If no PEM block is found, this
|
||||
// function returns zero and pushes |PEM_R_NO_START_LINE| to the error queue. If
|
||||
// one is found, but there is an error decoding it, it returns zero and pushes
|
||||
// some other error to the error queue.
|
||||
OPENSSL_EXPORT int PEM_read_bio(BIO *bp, char **name, char **header,
|
||||
unsigned char **data, long *len);
|
||||
|
||||
OPENSSL_EXPORT STACK_OF(X509_INFO) * PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u);
|
||||
OPENSSL_EXPORT int PEM_X509_INFO_write_bio(BIO *bp,X509_INFO *xi, EVP_CIPHER *enc, unsigned char *kstr, int klen, pem_password_cb *cd, void *u);
|
||||
// PEM_write_bio writes a PEM block to |bp|, containing |len| bytes from |data|
|
||||
// as data. |name| and |hdr| are NUL-terminated C strings containing the PEM
|
||||
// type and header block, respectively. This function returns zero on error and
|
||||
// the number of bytes written on success.
|
||||
OPENSSL_EXPORT int PEM_write_bio(BIO *bp, const char *name, const char *hdr,
|
||||
const unsigned char *data, long len);
|
||||
|
||||
OPENSSL_EXPORT int PEM_read(FILE *fp, char **name, char **header, unsigned char **data,long *len);
|
||||
OPENSSL_EXPORT int PEM_write(FILE *fp, const char *name, const char *hdr, const unsigned char *data, long len);
|
||||
OPENSSL_EXPORT void * PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x, pem_password_cb *cb, void *u);
|
||||
OPENSSL_EXPORT int PEM_ASN1_write(i2d_of_void *i2d,const char *name,FILE *fp, void *x,const EVP_CIPHER *enc,unsigned char *kstr, int klen,pem_password_cb *callback, void *u);
|
||||
OPENSSL_EXPORT STACK_OF(X509_INFO) * PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u);
|
||||
OPENSSL_EXPORT int PEM_bytes_read_bio(unsigned char **pdata, long *plen,
|
||||
char **pnm, const char *name, BIO *bp,
|
||||
pem_password_cb *cb, void *u);
|
||||
OPENSSL_EXPORT void *PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name,
|
||||
BIO *bp, void **x, pem_password_cb *cb,
|
||||
void *u);
|
||||
OPENSSL_EXPORT int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name,
|
||||
BIO *bp, void *x, const EVP_CIPHER *enc,
|
||||
unsigned char *kstr, int klen,
|
||||
pem_password_cb *cb, void *u);
|
||||
|
||||
/* PEM_def_callback treats |userdata| as a string and copies it into |buf|,
|
||||
* assuming its |size| is sufficient. Returns the length of the string, or 0
|
||||
* if there is not enough room. If either |buf| or |userdata| is NULL, 0 is
|
||||
* returned. Note that this is different from OpenSSL, which prompts for a
|
||||
* password. */
|
||||
OPENSSL_EXPORT int PEM_def_callback(char *buf, int size, int rwflag, void *userdata);
|
||||
OPENSSL_EXPORT void PEM_proc_type(char *buf, int type);
|
||||
OPENSSL_EXPORT void PEM_dek_info(char *buf, const char *type, int len, char *str);
|
||||
OPENSSL_EXPORT STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(
|
||||
BIO *bp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u);
|
||||
OPENSSL_EXPORT int PEM_X509_INFO_write_bio(BIO *bp, X509_INFO *xi,
|
||||
EVP_CIPHER *enc, unsigned char *kstr,
|
||||
int klen, pem_password_cb *cd,
|
||||
void *u);
|
||||
|
||||
OPENSSL_EXPORT int PEM_read(FILE *fp, char **name, char **header,
|
||||
unsigned char **data, long *len);
|
||||
OPENSSL_EXPORT int PEM_write(FILE *fp, const char *name, const char *hdr,
|
||||
const unsigned char *data, long len);
|
||||
OPENSSL_EXPORT void *PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp,
|
||||
void **x, pem_password_cb *cb, void *u);
|
||||
OPENSSL_EXPORT int PEM_ASN1_write(i2d_of_void *i2d, const char *name, FILE *fp,
|
||||
void *x, const EVP_CIPHER *enc,
|
||||
unsigned char *kstr, int klen,
|
||||
pem_password_cb *callback, void *u);
|
||||
OPENSSL_EXPORT STACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp,
|
||||
STACK_OF(X509_INFO) *sk,
|
||||
pem_password_cb *cb,
|
||||
void *u);
|
||||
|
||||
// PEM_def_callback treats |userdata| as a string and copies it into |buf|,
|
||||
// assuming its |size| is sufficient. Returns the length of the string, or 0
|
||||
// if there is not enough room. If either |buf| or |userdata| is NULL, 0 is
|
||||
// returned. Note that this is different from OpenSSL, which prompts for a
|
||||
// password.
|
||||
OPENSSL_EXPORT int PEM_def_callback(char *buf, int size, int rwflag,
|
||||
void *userdata);
|
||||
OPENSSL_EXPORT void PEM_proc_type(char *buf, int type);
|
||||
OPENSSL_EXPORT void PEM_dek_info(char *buf, const char *type, int len,
|
||||
char *str);
|
||||
|
||||
|
||||
DECLARE_PEM_rw(X509, X509)
|
||||
@@ -397,22 +441,46 @@ DECLARE_PEM_rw_cb(PrivateKey, EVP_PKEY)
|
||||
|
||||
DECLARE_PEM_rw(PUBKEY, EVP_PKEY)
|
||||
|
||||
OPENSSL_EXPORT int PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, EVP_PKEY *x, int nid, char *kstr, int klen, pem_password_cb *cb, void *u);
|
||||
OPENSSL_EXPORT int PEM_write_bio_PKCS8PrivateKey(BIO *, EVP_PKEY *, const EVP_CIPHER *, char *, int, pem_password_cb *, void *);
|
||||
OPENSSL_EXPORT int i2d_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, char *kstr, int klen, pem_password_cb *cb, void *u);
|
||||
OPENSSL_EXPORT int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid, char *kstr, int klen, pem_password_cb *cb, void *u);
|
||||
OPENSSL_EXPORT EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u);
|
||||
OPENSSL_EXPORT int PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, EVP_PKEY *x,
|
||||
int nid, char *kstr,
|
||||
int klen,
|
||||
pem_password_cb *cb,
|
||||
void *u);
|
||||
OPENSSL_EXPORT int PEM_write_bio_PKCS8PrivateKey(BIO *, EVP_PKEY *,
|
||||
const EVP_CIPHER *, char *,
|
||||
int, pem_password_cb *,
|
||||
void *);
|
||||
OPENSSL_EXPORT int i2d_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY *x,
|
||||
const EVP_CIPHER *enc, char *kstr,
|
||||
int klen, pem_password_cb *cb,
|
||||
void *u);
|
||||
OPENSSL_EXPORT int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid,
|
||||
char *kstr, int klen,
|
||||
pem_password_cb *cb, void *u);
|
||||
OPENSSL_EXPORT EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x,
|
||||
pem_password_cb *cb, void *u);
|
||||
|
||||
OPENSSL_EXPORT int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, char *kstr, int klen, pem_password_cb *cb, void *u);
|
||||
OPENSSL_EXPORT int i2d_PKCS8PrivateKey_nid_fp(FILE *fp, EVP_PKEY *x, int nid, char *kstr, int klen, pem_password_cb *cb, void *u);
|
||||
OPENSSL_EXPORT int PEM_write_PKCS8PrivateKey_nid(FILE *fp, EVP_PKEY *x, int nid, char *kstr, int klen, pem_password_cb *cb, void *u);
|
||||
OPENSSL_EXPORT int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x,
|
||||
const EVP_CIPHER *enc, char *kstr,
|
||||
int klen, pem_password_cb *cb,
|
||||
void *u);
|
||||
OPENSSL_EXPORT int i2d_PKCS8PrivateKey_nid_fp(FILE *fp, EVP_PKEY *x, int nid,
|
||||
char *kstr, int klen,
|
||||
pem_password_cb *cb, void *u);
|
||||
OPENSSL_EXPORT int PEM_write_PKCS8PrivateKey_nid(FILE *fp, EVP_PKEY *x, int nid,
|
||||
char *kstr, int klen,
|
||||
pem_password_cb *cb, void *u);
|
||||
|
||||
OPENSSL_EXPORT EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, void *u);
|
||||
OPENSSL_EXPORT EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x,
|
||||
pem_password_cb *cb, void *u);
|
||||
|
||||
OPENSSL_EXPORT int PEM_write_PKCS8PrivateKey(FILE *fp,EVP_PKEY *x,const EVP_CIPHER *enc, char *kstr,int klen, pem_password_cb *cd, void *u);
|
||||
OPENSSL_EXPORT int PEM_write_PKCS8PrivateKey(FILE *fp, EVP_PKEY *x,
|
||||
const EVP_CIPHER *enc, char *kstr,
|
||||
int klen, pem_password_cb *cd,
|
||||
void *u);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -432,4 +500,4 @@ OPENSSL_EXPORT int PEM_write_PKCS8PrivateKey(FILE *fp,EVP_PKEY *x,const EVP_CIPH
|
||||
#define PEM_R_UNSUPPORTED_CIPHER 113
|
||||
#define PEM_R_UNSUPPORTED_ENCRYPTION 114
|
||||
|
||||
#endif /* OPENSSL_HEADER_PEM_H */
|
||||
#endif // OPENSSL_HEADER_PEM_H
|
||||
@@ -40,18 +40,12 @@ extern "C" {
|
||||
// PMBTokens and P-384.
|
||||
OPENSSL_EXPORT const TRUST_TOKEN_METHOD *TRUST_TOKEN_experiment_v1(void);
|
||||
|
||||
// TRUST_TOKEN_experiment_v2_pp is an experimental Trust Tokens protocol using
|
||||
// PMBTokens (with no private metadata) and P-384 with up to 6 keys, without RR
|
||||
// verification.
|
||||
//
|
||||
// This version is incomplete and should not be used.
|
||||
// TODO(svaldez): Update to use the PrivacyPass primitive
|
||||
OPENSSL_EXPORT const TRUST_TOKEN_METHOD *TRUST_TOKEN_experiment_v2_pp(void);
|
||||
// TRUST_TOKEN_experiment_v2_voprf is an experimental Trust Tokens protocol
|
||||
// using VOPRFs and P-384 with up to 6 keys, without RR verification.
|
||||
OPENSSL_EXPORT const TRUST_TOKEN_METHOD *TRUST_TOKEN_experiment_v2_voprf(void);
|
||||
|
||||
// TRUST_TOKEN_experiment_v2_pmb is an experimental Trust Tokens protocol using
|
||||
// PMBTokens and P-384 with up to 3 keys, without RR verification.
|
||||
//
|
||||
// This version is incomplete and should not be used.
|
||||
OPENSSL_EXPORT const TRUST_TOKEN_METHOD *TRUST_TOKEN_experiment_v2_pmb(void);
|
||||
|
||||
// trust_token_st represents a single-use token for the Trust Token protocol.
|
||||
@@ -152,9 +146,9 @@ OPENSSL_EXPORT STACK_OF(TRUST_TOKEN) *
|
||||
// |token| and receive a signature over |data| and serializes the request into
|
||||
// a newly-allocated buffer, setting |*out| to that buffer and |*out_len| to
|
||||
// its length. |time| is the number of seconds since the UNIX epoch and used to
|
||||
// verify the validity of the issuer's response. The caller takes ownership of
|
||||
// the buffer and must call |OPENSSL_free| when done. It returns one on success
|
||||
// or zero on error.
|
||||
// verify the validity of the issuer's response in TrustTokenV1 and ignored in
|
||||
// other versions. The caller takes ownership of the buffer and must call
|
||||
// |OPENSSL_free| when done. It returns one on success or zero on error.
|
||||
OPENSSL_EXPORT int TRUST_TOKEN_CLIENT_begin_redemption(
|
||||
TRUST_TOKEN_CLIENT *ctx, uint8_t **out, size_t *out_len,
|
||||
const TRUST_TOKEN *token, const uint8_t *data, size_t data_len,
|
||||
@@ -165,12 +159,8 @@ OPENSSL_EXPORT int TRUST_TOKEN_CLIENT_begin_redemption(
|
||||
// |*out_rr| and |*out_rr_len| (respectively, |*out_sig| and |*out_sig_len|)
|
||||
// to a newly-allocated buffer containing the SRR (respectively, the SRR
|
||||
// signature). In other versions, it sets |*out_rr| and |*out_rr_len|
|
||||
// (respectively, |*out_sig| and |*out_sig_len|) to a newly-allocated buffer
|
||||
// containing the SRR (respectively, the SRR signature). It returns one on
|
||||
// success or zero on failure.
|
||||
//
|
||||
// TODO(svaldez): Return the entire response in |*out_rr| and omit |*out_sig| in
|
||||
// non-|TRUST_TOKEN_experiment_v1| versions.
|
||||
// to a newly-allocated buffer containing |response| and leaves all validation
|
||||
// to the caller. It returns one on success or zero on failure.
|
||||
OPENSSL_EXPORT int TRUST_TOKEN_CLIENT_finish_redemption(
|
||||
TRUST_TOKEN_CLIENT *ctx, uint8_t **out_rr, size_t *out_rr_len,
|
||||
uint8_t **out_sig, size_t *out_sig_len, const uint8_t *response,
|
||||
@@ -234,16 +224,16 @@ OPENSSL_EXPORT int TRUST_TOKEN_ISSUER_issue(
|
||||
uint32_t public_metadata, uint8_t private_metadata, size_t max_issuance);
|
||||
|
||||
// TRUST_TOKEN_ISSUER_redeem ingests a |request| for token redemption and
|
||||
// verifies the token. If the token is valid, a SRR is produced with a lifetime
|
||||
// verifies the token. If the token is valid, a RR is produced with a lifetime
|
||||
// of |lifetime| (in seconds), signing over the requested data from the request
|
||||
// and the value of the token, storing the result into a newly-allocated buffer
|
||||
// and setting |*out| to that buffer and |*out_len| to its length. The extracted
|
||||
// |TRUST_TOKEN| is stored into a newly-allocated buffer and stored in
|
||||
// |*out_token|. The extracted client data is stored into a newly-allocated
|
||||
// buffer and stored in |*out_client_data|. The extracted redemption time is
|
||||
// stored in |*out_redemption_time|. The caller takes ownership of each output
|
||||
// buffer and must call |OPENSSL_free| when done. It returns one on success or
|
||||
// zero on error.
|
||||
// buffer and stored in |*out_client_data|. In TrustTokenV1, the extracted
|
||||
// redemption time is stored in |*out_redemption_time|. The caller takes
|
||||
// ownership of each output buffer and must call |OPENSSL_free| when done. It
|
||||
// returns one on success or zero on error.
|
||||
//
|
||||
// The caller must keep track of all values of |*out_token| seen globally before
|
||||
// returning the SRR to the client. If the value has been reused, the caller
|
||||
@@ -255,6 +245,24 @@ OPENSSL_EXPORT int TRUST_TOKEN_ISSUER_redeem(
|
||||
size_t *out_client_data_len, uint64_t *out_redemption_time,
|
||||
const uint8_t *request, size_t request_len, uint64_t lifetime);
|
||||
|
||||
// TRUST_TOKEN_ISSUER_redeem_raw ingests a |request| for token redemption and
|
||||
// verifies the token. The public metadata is stored in |*out_public|. The
|
||||
// private metadata (if any) is stored in |*out_private|. The extracted
|
||||
// |TRUST_TOKEN| is stored into a newly-allocated buffer and stored in
|
||||
// |*out_token|. The extracted client data is stored into a newly-allocated
|
||||
// buffer and stored in |*out_client_data|. The caller takes ownership of each
|
||||
// output buffer and must call |OPENSSL_free| when done. It returns one on
|
||||
// success or zero on error.
|
||||
//
|
||||
// The caller must keep track of all values of |*out_token| seen globally before
|
||||
// returning a response to the client. If the value has been reused, the caller
|
||||
// must report an error to the client. Returning a response with replayed values
|
||||
// allows an attacker to double-spend tokens.
|
||||
OPENSSL_EXPORT int TRUST_TOKEN_ISSUER_redeem_raw(
|
||||
const TRUST_TOKEN_ISSUER *ctx, uint32_t *out_public, uint8_t *out_private,
|
||||
TRUST_TOKEN **out_token, uint8_t **out_client_data,
|
||||
size_t *out_client_data_len, const uint8_t *request, size_t request_len);
|
||||
|
||||
// TRUST_TOKEN_decode_private_metadata decodes |encrypted_bit| using the
|
||||
// private metadata key specified by a |key| buffer of length |key_len| and the
|
||||
// nonce by a |nonce| buffer of length |nonce_len|. The nonce in
|
||||
|
||||
@@ -143,7 +143,7 @@ DECLARE_ASN1_SET_OF(X509_NAME_ENTRY)
|
||||
|
||||
// we always keep X509_NAMEs in 2 forms.
|
||||
struct X509_name_st {
|
||||
STACK_OF(X509_NAME_ENTRY) * entries;
|
||||
STACK_OF(X509_NAME_ENTRY) *entries;
|
||||
int modified; // true if 'bytes' needs to be built
|
||||
BUF_MEM *bytes;
|
||||
// unsigned long hash; Keep the hash around for lookups
|
||||
@@ -170,7 +170,7 @@ struct x509_attributes_st {
|
||||
int single; // 0 for a set, 1 for a single item (which is wrong)
|
||||
union {
|
||||
char *ptr;
|
||||
/* 0 */ STACK_OF(ASN1_TYPE) * set;
|
||||
/* 0 */ STACK_OF(ASN1_TYPE) *set;
|
||||
/* 1 */ ASN1_TYPE *single;
|
||||
} value;
|
||||
} /* X509_ATTRIBUTE */;
|
||||
@@ -185,7 +185,7 @@ struct X509_req_info_st {
|
||||
X509_NAME *subject;
|
||||
X509_PUBKEY *pubkey;
|
||||
// d=2 hl=2 l= 0 cons: cont: 00
|
||||
STACK_OF(X509_ATTRIBUTE) * attributes; // [ 0 ]
|
||||
STACK_OF(X509_ATTRIBUTE) *attributes; // [ 0 ]
|
||||
} /* X509_REQ_INFO */;
|
||||
|
||||
struct X509_req_st {
|
||||
@@ -203,9 +203,9 @@ struct x509_cinf_st {
|
||||
X509_VAL *validity;
|
||||
X509_NAME *subject;
|
||||
X509_PUBKEY *key;
|
||||
ASN1_BIT_STRING *issuerUID; // [ 1 ] optional in v2
|
||||
ASN1_BIT_STRING *subjectUID; // [ 2 ] optional in v2
|
||||
STACK_OF(X509_EXTENSION) * extensions; // [ 3 ] optional in v3
|
||||
ASN1_BIT_STRING *issuerUID; // [ 1 ] optional in v2
|
||||
ASN1_BIT_STRING *subjectUID; // [ 2 ] optional in v2
|
||||
STACK_OF(X509_EXTENSION) *extensions; // [ 3 ] optional in v3
|
||||
ASN1_ENCODING enc;
|
||||
} /* X509_CINF */;
|
||||
|
||||
@@ -215,11 +215,11 @@ struct x509_cinf_st {
|
||||
// the end of the certificate itself
|
||||
|
||||
struct x509_cert_aux_st {
|
||||
STACK_OF(ASN1_OBJECT) * trust; // trusted uses
|
||||
STACK_OF(ASN1_OBJECT) * reject; // rejected uses
|
||||
ASN1_UTF8STRING *alias; // "friendly name"
|
||||
ASN1_OCTET_STRING *keyid; // key id of private key
|
||||
STACK_OF(X509_ALGOR) * other; // other unspecified info
|
||||
STACK_OF(ASN1_OBJECT) *trust; // trusted uses
|
||||
STACK_OF(ASN1_OBJECT) *reject; // rejected uses
|
||||
ASN1_UTF8STRING *alias; // "friendly name"
|
||||
ASN1_OCTET_STRING *keyid; // key id of private key
|
||||
STACK_OF(X509_ALGOR) *other; // other unspecified info
|
||||
} /* X509_CERT_AUX */;
|
||||
|
||||
DECLARE_STACK_OF(DIST_POINT)
|
||||
@@ -241,8 +241,8 @@ struct x509_st {
|
||||
ASN1_OCTET_STRING *skid;
|
||||
AUTHORITY_KEYID *akid;
|
||||
X509_POLICY_CACHE *policy_cache;
|
||||
STACK_OF(DIST_POINT) * crldp;
|
||||
STACK_OF(GENERAL_NAME) * altname;
|
||||
STACK_OF(DIST_POINT) *crldp;
|
||||
STACK_OF(GENERAL_NAME) *altname;
|
||||
NAME_CONSTRAINTS *nc;
|
||||
unsigned char sha1_hash[SHA_DIGEST_LENGTH];
|
||||
X509_CERT_AUX *aux;
|
||||
@@ -364,9 +364,9 @@ DEFINE_STACK_OF(X509_TRUST)
|
||||
struct x509_revoked_st {
|
||||
ASN1_INTEGER *serialNumber;
|
||||
ASN1_TIME *revocationDate;
|
||||
STACK_OF(X509_EXTENSION) /* optional */ * extensions;
|
||||
STACK_OF(X509_EXTENSION) /* optional */ *extensions;
|
||||
// Set up if indirect CRL
|
||||
STACK_OF(GENERAL_NAME) * issuer;
|
||||
STACK_OF(GENERAL_NAME) *issuer;
|
||||
// Revocation reason
|
||||
int reason;
|
||||
int sequence; // load sequence
|
||||
@@ -381,8 +381,8 @@ struct X509_crl_info_st {
|
||||
X509_NAME *issuer;
|
||||
ASN1_TIME *lastUpdate;
|
||||
ASN1_TIME *nextUpdate;
|
||||
STACK_OF(X509_REVOKED) * revoked;
|
||||
STACK_OF(X509_EXTENSION) /* [0] */ * extensions;
|
||||
STACK_OF(X509_REVOKED) *revoked;
|
||||
STACK_OF(X509_EXTENSION) /* [0] */ *extensions;
|
||||
ASN1_ENCODING enc;
|
||||
} /* X509_CRL_INFO */;
|
||||
|
||||
@@ -405,7 +405,7 @@ struct X509_crl_st {
|
||||
ASN1_INTEGER *crl_number;
|
||||
ASN1_INTEGER *base_crl_number;
|
||||
unsigned char sha1_hash[SHA_DIGEST_LENGTH];
|
||||
STACK_OF(GENERAL_NAMES) * issuers;
|
||||
STACK_OF(GENERAL_NAMES) *issuers;
|
||||
const X509_CRL_METHOD *meth;
|
||||
void *meth_data;
|
||||
} /* X509_CRL */;
|
||||
@@ -610,8 +610,8 @@ OPENSSL_EXPORT X509_NAME *X509_CRL_get_issuer(const X509_CRL *crl);
|
||||
OPENSSL_EXPORT STACK_OF(X509_REVOKED) *X509_CRL_get_REVOKED(X509_CRL *crl);
|
||||
|
||||
// X509_CRL_get0_extensions returns |crl|'s extension list.
|
||||
OPENSSL_EXPORT const STACK_OF(X509_EXTENSION) *
|
||||
X509_CRL_get0_extensions(const X509_CRL *crl);
|
||||
OPENSSL_EXPORT const STACK_OF(X509_EXTENSION) *X509_CRL_get0_extensions(
|
||||
const X509_CRL *crl);
|
||||
|
||||
// X509_CINF_set_modified marks |cinf| as modified so that changes will be
|
||||
// reflected in serializing the structure.
|
||||
@@ -697,9 +697,8 @@ OPENSSL_EXPORT NETSCAPE_SPKI *NETSCAPE_SPKI_b64_decode(const char *str,
|
||||
OPENSSL_EXPORT char *NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *spki);
|
||||
|
||||
// NETSCAPE_SPKI_get_pubkey decodes and returns the public key in |spki| as an
|
||||
// |EVP_PKEY|, or NULL on error. The resulting pointer is non-owning and valid
|
||||
// until |spki| is released or mutated. The caller should take a reference with
|
||||
// |EVP_PKEY_up_ref| to extend the lifetime.
|
||||
// |EVP_PKEY|, or NULL on error. The caller takes ownership of the resulting
|
||||
// pointer and must call |EVP_PKEY_free| when done.
|
||||
OPENSSL_EXPORT EVP_PKEY *NETSCAPE_SPKI_get_pubkey(NETSCAPE_SPKI *spki);
|
||||
|
||||
// NETSCAPE_SPKI_set_pubkey sets |spki|'s public key to |pkey|. It returns one
|
||||
@@ -718,25 +717,95 @@ OPENSSL_EXPORT int X509_signature_dump(BIO *bio, const ASN1_STRING *sig,
|
||||
OPENSSL_EXPORT int X509_signature_print(BIO *bio, const X509_ALGOR *alg,
|
||||
const ASN1_STRING *sig);
|
||||
|
||||
OPENSSL_EXPORT int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md);
|
||||
OPENSSL_EXPORT int X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx);
|
||||
OPENSSL_EXPORT int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md);
|
||||
OPENSSL_EXPORT int X509_REQ_sign_ctx(X509_REQ *x, EVP_MD_CTX *ctx);
|
||||
OPENSSL_EXPORT int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md);
|
||||
OPENSSL_EXPORT int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx);
|
||||
OPENSSL_EXPORT int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey,
|
||||
// X509_sign signs |x509| with |pkey| and replaces the signature algorithm and
|
||||
// signature fields. It returns one on success and zero on error. This function
|
||||
// uses digest algorithm |md|, or |pkey|'s default if NULL. Other signing
|
||||
// parameters use |pkey|'s defaults. To customize them, use |X509_sign_ctx|.
|
||||
OPENSSL_EXPORT int X509_sign(X509 *x509, EVP_PKEY *pkey, const EVP_MD *md);
|
||||
|
||||
// X509_sign_ctx signs |x509| with |ctx| and replaces the signature algorithm
|
||||
// and signature fields. It returns one on success and zero on error. The
|
||||
// signature algorithm and parameters come from |ctx|, which must have been
|
||||
// initialized with |EVP_DigestSignInit|. The caller should configure the
|
||||
// corresponding |EVP_PKEY_CTX| before calling this function.
|
||||
OPENSSL_EXPORT int X509_sign_ctx(X509 *x509, EVP_MD_CTX *ctx);
|
||||
|
||||
// X509_REQ_sign signs |req| with |pkey| and replaces the signature algorithm
|
||||
// and signature fields. It returns one on success and zero on error. This
|
||||
// function uses digest algorithm |md|, or |pkey|'s default if NULL. Other
|
||||
// signing parameters use |pkey|'s defaults. To customize them, use
|
||||
// |X509_REQ_sign_ctx|.
|
||||
OPENSSL_EXPORT int X509_REQ_sign(X509_REQ *req, EVP_PKEY *pkey,
|
||||
const EVP_MD *md);
|
||||
|
||||
// X509_REQ_sign_ctx signs |req| with |ctx| and replaces the signature algorithm
|
||||
// and signature fields. It returns one on success and zero on error. The
|
||||
// signature algorithm and parameters come from |ctx|, which must have been
|
||||
// initialized with |EVP_DigestSignInit|. The caller should configure the
|
||||
// corresponding |EVP_PKEY_CTX| before calling this function.
|
||||
OPENSSL_EXPORT int X509_REQ_sign_ctx(X509_REQ *req, EVP_MD_CTX *ctx);
|
||||
|
||||
// X509_CRL_sign signs |crl| with |pkey| and replaces the signature algorithm
|
||||
// and signature fields. It returns one on success and zero on error. This
|
||||
// function uses digest algorithm |md|, or |pkey|'s default if NULL. Other
|
||||
// signing parameters use |pkey|'s defaults. To customize them, use
|
||||
// |X509_CRL_sign_ctx|.
|
||||
OPENSSL_EXPORT int X509_CRL_sign(X509_CRL *crl, EVP_PKEY *pkey,
|
||||
const EVP_MD *md);
|
||||
|
||||
// X509_CRL_sign_ctx signs |crl| with |ctx| and replaces the signature algorithm
|
||||
// and signature fields. It returns one on success and zero on error. The
|
||||
// signature algorithm and parameters come from |ctx|, which must have been
|
||||
// initialized with |EVP_DigestSignInit|. The caller should configure the
|
||||
// corresponding |EVP_PKEY_CTX| before calling this function.
|
||||
OPENSSL_EXPORT int X509_CRL_sign_ctx(X509_CRL *crl, EVP_MD_CTX *ctx);
|
||||
|
||||
// NETSCAPE_SPKI_sign signs |spki| with |pkey| and replaces the signature
|
||||
// algorithm and signature fields. It returns one on success and zero on error.
|
||||
// This function uses digest algorithm |md|, or |pkey|'s default if NULL. Other
|
||||
// signing parameters use |pkey|'s defaults.
|
||||
OPENSSL_EXPORT int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *spki, EVP_PKEY *pkey,
|
||||
const EVP_MD *md);
|
||||
|
||||
OPENSSL_EXPORT int X509_pubkey_digest(const X509 *data, const EVP_MD *type,
|
||||
unsigned char *md, unsigned int *len);
|
||||
OPENSSL_EXPORT int X509_digest(const X509 *data, const EVP_MD *type,
|
||||
unsigned char *md, unsigned int *len);
|
||||
OPENSSL_EXPORT int X509_CRL_digest(const X509_CRL *data, const EVP_MD *type,
|
||||
unsigned char *md, unsigned int *len);
|
||||
OPENSSL_EXPORT int X509_REQ_digest(const X509_REQ *data, const EVP_MD *type,
|
||||
unsigned char *md, unsigned int *len);
|
||||
OPENSSL_EXPORT int X509_NAME_digest(const X509_NAME *data, const EVP_MD *type,
|
||||
unsigned char *md, unsigned int *len);
|
||||
// X509_pubkey_digest hashes the DER encoding of |x509|'s subjectPublicKeyInfo
|
||||
// field with |md| and writes the result to |out|. |EVP_MD_CTX_size| bytes are
|
||||
// written, which is at most |EVP_MAX_MD_SIZE|. If |out_len| is not NULL,
|
||||
// |*out_len| is set to the number of bytes written. This function returns one
|
||||
// on success and zero on error.
|
||||
OPENSSL_EXPORT int X509_pubkey_digest(const X509 *x509, const EVP_MD *md,
|
||||
uint8_t *out, unsigned *out_len);
|
||||
|
||||
// X509_digest hashes |x509|'s DER encoding with |md| and writes the result to
|
||||
// |out|. |EVP_MD_CTX_size| bytes are written, which is at most
|
||||
// |EVP_MAX_MD_SIZE|. If |out_len| is not NULL, |*out_len| is set to the number
|
||||
// of bytes written. This function returns one on success and zero on error.
|
||||
// Note this digest covers the entire certificate, not just the signed portion.
|
||||
OPENSSL_EXPORT int X509_digest(const X509 *x509, const EVP_MD *md, uint8_t *out,
|
||||
unsigned *out_len);
|
||||
|
||||
// X509_CRL_digest hashes |crl|'s DER encoding with |md| and writes the result
|
||||
// to |out|. |EVP_MD_CTX_size| bytes are written, which is at most
|
||||
// |EVP_MAX_MD_SIZE|. If |out_len| is not NULL, |*out_len| is set to the number
|
||||
// of bytes written. This function returns one on success and zero on error.
|
||||
// Note this digest covers the entire CRL, not just the signed portion.
|
||||
OPENSSL_EXPORT int X509_CRL_digest(const X509_CRL *crl, const EVP_MD *md,
|
||||
uint8_t *out, unsigned *out_len);
|
||||
|
||||
// X509_REQ_digest hashes |req|'s DER encoding with |md| and writes the result
|
||||
// to |out|. |EVP_MD_CTX_size| bytes are written, which is at most
|
||||
// |EVP_MAX_MD_SIZE|. If |out_len| is not NULL, |*out_len| is set to the number
|
||||
// of bytes written. This function returns one on success and zero on error.
|
||||
// Note this digest covers the entire certificate request, not just the signed
|
||||
// portion.
|
||||
OPENSSL_EXPORT int X509_REQ_digest(const X509_REQ *req, const EVP_MD *md,
|
||||
uint8_t *out, unsigned *out_len);
|
||||
|
||||
// X509_NAME_digest hashes |name|'s DER encoding with |md| and writes the result
|
||||
// to |out|. |EVP_MD_CTX_size| bytes are written, which is at most
|
||||
// |EVP_MAX_MD_SIZE|. If |out_len| is not NULL, |*out_len| is set to the number
|
||||
// of bytes written. This function returns one on success and zero on error.
|
||||
OPENSSL_EXPORT int X509_NAME_digest(const X509_NAME *name, const EVP_MD *md,
|
||||
uint8_t *out, unsigned *out_len);
|
||||
|
||||
// X509_parse_from_buffer parses an X.509 structure from |buf| and returns a
|
||||
// fresh X509 or NULL on error. There must not be any trailing data in |buf|.
|
||||
@@ -899,14 +968,58 @@ OPENSSL_EXPORT int i2d_X509_AUX(X509 *a, unsigned char **pp);
|
||||
OPENSSL_EXPORT X509 *d2i_X509_AUX(X509 **a, const unsigned char **pp,
|
||||
long length);
|
||||
|
||||
OPENSSL_EXPORT int i2d_re_X509_tbs(X509 *x, unsigned char **pp);
|
||||
// i2d_re_X509_tbs serializes the TBSCertificate portion of |x509|. If |outp| is
|
||||
// NULL, nothing is written. Otherwise, if |*outp| is not NULL, the result is
|
||||
// written to |*outp|, which must have enough space available, and |*outp| is
|
||||
// advanced just past the output. If |outp| is non-NULL and |*outp| is NULL, it
|
||||
// sets |*outp| to a newly-allocated buffer containing the result. The caller is
|
||||
// responsible for releasing the buffer with |OPENSSL_free|. In all cases, this
|
||||
// function returns the number of bytes in the result, whether written or not,
|
||||
// or a negative value on error.
|
||||
//
|
||||
// This function re-encodes the TBSCertificate and may not reflect |x509|'s
|
||||
// original encoding. It may be used to manually generate a signature for a new
|
||||
// certificate. To verify certificates, use |i2d_X509_tbs| instead.
|
||||
OPENSSL_EXPORT int i2d_re_X509_tbs(X509 *x509, unsigned char **outp);
|
||||
|
||||
// i2d_X509_tbs serializes the TBSCertificate portion of |x509|. If |outp| is
|
||||
// NULL, nothing is written. Otherwise, if |*outp| is not NULL, the result is
|
||||
// written to |*outp|, which must have enough space available, and |*outp| is
|
||||
// advanced just past the output. If |outp| is non-NULL and |*outp| is NULL, it
|
||||
// sets |*outp| to a newly-allocated buffer containing the result. The caller is
|
||||
// responsible for releasing the buffer with |OPENSSL_free|. In all cases, this
|
||||
// function returns the number of bytes in the result, whether written or not,
|
||||
// or a negative value on error.
|
||||
//
|
||||
// This function preserves the original encoding of the TBSCertificate and may
|
||||
// not reflect modifications made to |x509|. It may be used to manually verify
|
||||
// the signature of an existing certificate. To generate certificates, use
|
||||
// |i2d_re_X509_tbs| instead.
|
||||
OPENSSL_EXPORT int i2d_X509_tbs(X509 *x509, unsigned char **outp);
|
||||
|
||||
// X509_set1_signature_algo sets |x509|'s signature algorithm to |algo| and
|
||||
// returns one on success or zero on error. It updates both the signature field
|
||||
// of the TBSCertificate structure, and the signatureAlgorithm field of the
|
||||
// Certificate.
|
||||
OPENSSL_EXPORT int X509_set1_signature_algo(X509 *x509, const X509_ALGOR *algo);
|
||||
|
||||
// X509_set1_signature_value sets |x509|'s signature to a copy of the |sig_len|
|
||||
// bytes pointed by |sig|. It returns one on success and zero on error.
|
||||
//
|
||||
// Due to a specification error, X.509 certificates store signatures in ASN.1
|
||||
// BIT STRINGs, but signature algorithms return byte strings rather than bit
|
||||
// strings. This function creates a BIT STRING containing a whole number of
|
||||
// bytes, with the bit order matching the DER encoding. This matches the
|
||||
// encoding used by all X.509 signature algorithms.
|
||||
OPENSSL_EXPORT int X509_set1_signature_value(X509 *x509, const uint8_t *sig,
|
||||
size_t sig_len);
|
||||
|
||||
OPENSSL_EXPORT void X509_get0_signature(const ASN1_BIT_STRING **psig,
|
||||
const X509_ALGOR **palg, const X509 *x);
|
||||
OPENSSL_EXPORT int X509_get_signature_nid(const X509 *x);
|
||||
|
||||
OPENSSL_EXPORT int X509_alias_set1(X509 *x, unsigned char *name, int len);
|
||||
OPENSSL_EXPORT int X509_keyid_set1(X509 *x, unsigned char *id, int len);
|
||||
OPENSSL_EXPORT int X509_alias_set1(X509 *x, const unsigned char *name, int len);
|
||||
OPENSSL_EXPORT int X509_keyid_set1(X509 *x, const unsigned char *id, int len);
|
||||
OPENSSL_EXPORT unsigned char *X509_alias_get0(X509 *x, int *len);
|
||||
OPENSSL_EXPORT unsigned char *X509_keyid_get0(X509 *x, int *len);
|
||||
OPENSSL_EXPORT int (*X509_TRUST_set_default(int (*trust)(int, X509 *,
|
||||
@@ -968,8 +1081,8 @@ OPENSSL_EXPORT X509_NAME *X509_get_subject_name(const X509 *a);
|
||||
OPENSSL_EXPORT int X509_set_pubkey(X509 *x, EVP_PKEY *pkey);
|
||||
OPENSSL_EXPORT EVP_PKEY *X509_get_pubkey(X509 *x);
|
||||
OPENSSL_EXPORT ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x);
|
||||
OPENSSL_EXPORT const STACK_OF(X509_EXTENSION) *
|
||||
X509_get0_extensions(const X509 *x);
|
||||
OPENSSL_EXPORT const STACK_OF(X509_EXTENSION) *X509_get0_extensions(
|
||||
const X509 *x);
|
||||
OPENSSL_EXPORT const X509_ALGOR *X509_get0_tbs_sigalg(const X509 *x);
|
||||
|
||||
OPENSSL_EXPORT int X509_REQ_set_version(X509_REQ *x, long version);
|
||||
@@ -984,13 +1097,12 @@ OPENSSL_EXPORT EVP_PKEY *X509_REQ_get_pubkey(X509_REQ *req);
|
||||
OPENSSL_EXPORT int X509_REQ_extension_nid(int nid);
|
||||
OPENSSL_EXPORT const int *X509_REQ_get_extension_nids(void);
|
||||
OPENSSL_EXPORT void X509_REQ_set_extension_nids(const int *nids);
|
||||
OPENSSL_EXPORT STACK_OF(X509_EXTENSION) *
|
||||
X509_REQ_get_extensions(X509_REQ *req);
|
||||
OPENSSL_EXPORT STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(X509_REQ *req);
|
||||
OPENSSL_EXPORT int X509_REQ_add_extensions_nid(X509_REQ *req,
|
||||
STACK_OF(X509_EXTENSION) * exts,
|
||||
STACK_OF(X509_EXTENSION) *exts,
|
||||
int nid);
|
||||
OPENSSL_EXPORT int X509_REQ_add_extensions(X509_REQ *req,
|
||||
STACK_OF(X509_EXTENSION) * exts);
|
||||
STACK_OF(X509_EXTENSION) *exts);
|
||||
OPENSSL_EXPORT int X509_REQ_get_attr_count(const X509_REQ *req);
|
||||
OPENSSL_EXPORT int X509_REQ_get_attr_by_NID(const X509_REQ *req, int nid,
|
||||
int lastpos);
|
||||
@@ -1020,20 +1132,59 @@ OPENSSL_EXPORT void X509_CRL_get0_signature(const X509_CRL *crl,
|
||||
const ASN1_BIT_STRING **psig,
|
||||
const X509_ALGOR **palg);
|
||||
OPENSSL_EXPORT int X509_CRL_get_signature_nid(const X509_CRL *crl);
|
||||
OPENSSL_EXPORT int i2d_re_X509_CRL_tbs(X509_CRL *req, unsigned char **pp);
|
||||
|
||||
// i2d_re_X509_CRL_tbs serializes the TBSCertList portion of |crl|. If |outp| is
|
||||
// NULL, nothing is written. Otherwise, if |*outp| is not NULL, the result is
|
||||
// written to |*outp|, which must have enough space available, and |*outp| is
|
||||
// advanced just past the output. If |outp| is non-NULL and |*outp| is NULL, it
|
||||
// sets |*outp| to a newly-allocated buffer containing the result. The caller is
|
||||
// responsible for releasing the buffer with |OPENSSL_free|. In all cases, this
|
||||
// function returns the number of bytes in the result, whether written or not,
|
||||
// or a negative value on error.
|
||||
//
|
||||
// This function re-encodes the TBSCertList and may not reflect |crl|'s original
|
||||
// encoding. It may be used to manually generate a signature for a new CRL. To
|
||||
// verify CRLs, use |i2d_X509_CRL_tbs| instead.
|
||||
OPENSSL_EXPORT int i2d_re_X509_CRL_tbs(X509_CRL *crl, unsigned char **outp);
|
||||
|
||||
// i2d_X509_CRL_tbs serializes the TBSCertList portion of |crl|. If |outp| is
|
||||
// NULL, nothing is written. Otherwise, if |*outp| is not NULL, the result is
|
||||
// written to |*outp|, which must have enough space available, and |*outp| is
|
||||
// advanced just past the output. If |outp| is non-NULL and |*outp| is NULL, it
|
||||
// sets |*outp| to a newly-allocated buffer containing the result. The caller is
|
||||
// responsible for releasing the buffer with |OPENSSL_free|. In all cases, this
|
||||
// function returns the number of bytes in the result, whether written or not,
|
||||
// or a negative value on error.
|
||||
//
|
||||
// This function preserves the original encoding of the TBSCertList and may not
|
||||
// reflect modifications made to |crl|. It may be used to manually verify the
|
||||
// signature of an existing CRL. To generate CRLs, use |i2d_re_X509_CRL_tbs|
|
||||
// instead.
|
||||
OPENSSL_EXPORT int i2d_X509_CRL_tbs(X509_CRL *crl, unsigned char **outp);
|
||||
|
||||
// X509_REVOKED_get0_serialNumber returns the serial number of the certificate
|
||||
// revoked by |revoked|.
|
||||
OPENSSL_EXPORT const ASN1_INTEGER *X509_REVOKED_get0_serialNumber(
|
||||
const X509_REVOKED *x);
|
||||
OPENSSL_EXPORT int X509_REVOKED_set_serialNumber(X509_REVOKED *x,
|
||||
ASN1_INTEGER *serial);
|
||||
const X509_REVOKED *revoked);
|
||||
|
||||
// X509_REVOKED_set_serialNumber sets |revoked|'s serial number to |serial|. It
|
||||
// returns one on success or zero on error.
|
||||
OPENSSL_EXPORT int X509_REVOKED_set_serialNumber(X509_REVOKED *revoked,
|
||||
const ASN1_INTEGER *serial);
|
||||
|
||||
// X509_REVOKED_get0_revocationDate returns the revocation time of the
|
||||
// certificate revoked by |revoked|.
|
||||
OPENSSL_EXPORT const ASN1_TIME *X509_REVOKED_get0_revocationDate(
|
||||
const X509_REVOKED *x);
|
||||
OPENSSL_EXPORT int X509_REVOKED_set_revocationDate(X509_REVOKED *r,
|
||||
ASN1_TIME *tm);
|
||||
const X509_REVOKED *revoked);
|
||||
|
||||
// X509_REVOKED_set_revocationDate sets |revoked|'s revocation time to |tm|. It
|
||||
// returns one on success or zero on error.
|
||||
OPENSSL_EXPORT int X509_REVOKED_set_revocationDate(X509_REVOKED *revoked,
|
||||
const ASN1_TIME *tm);
|
||||
|
||||
// X509_REVOKED_get0_extensions returns |r|'s extensions.
|
||||
OPENSSL_EXPORT const STACK_OF(X509_EXTENSION) *
|
||||
X509_REVOKED_get0_extensions(const X509_REVOKED *r);
|
||||
OPENSSL_EXPORT const STACK_OF(X509_EXTENSION) *X509_REVOKED_get0_extensions(
|
||||
const X509_REVOKED *r);
|
||||
|
||||
OPENSSL_EXPORT X509_CRL *X509_CRL_diff(X509_CRL *base, X509_CRL *newer,
|
||||
EVP_PKEY *skey, const EVP_MD *md,
|
||||
@@ -1043,11 +1194,11 @@ OPENSSL_EXPORT int X509_REQ_check_private_key(X509_REQ *x509, EVP_PKEY *pkey);
|
||||
|
||||
OPENSSL_EXPORT int X509_check_private_key(X509 *x509, const EVP_PKEY *pkey);
|
||||
OPENSSL_EXPORT int X509_chain_check_suiteb(int *perror_depth, X509 *x,
|
||||
STACK_OF(X509) * chain,
|
||||
STACK_OF(X509) *chain,
|
||||
unsigned long flags);
|
||||
OPENSSL_EXPORT int X509_CRL_check_suiteb(X509_CRL *crl, EVP_PKEY *pk,
|
||||
unsigned long flags);
|
||||
OPENSSL_EXPORT STACK_OF(X509) * X509_chain_up_ref(STACK_OF(X509) * chain);
|
||||
OPENSSL_EXPORT STACK_OF(X509) *X509_chain_up_ref(STACK_OF(X509) *chain);
|
||||
|
||||
OPENSSL_EXPORT int X509_issuer_and_serial_cmp(const X509 *a, const X509 *b);
|
||||
OPENSSL_EXPORT unsigned long X509_issuer_and_serial_hash(X509 *a);
|
||||
@@ -1141,21 +1292,19 @@ OPENSSL_EXPORT ASN1_OBJECT *X509_NAME_ENTRY_get_object(
|
||||
const X509_NAME_ENTRY *ne);
|
||||
OPENSSL_EXPORT ASN1_STRING *X509_NAME_ENTRY_get_data(const X509_NAME_ENTRY *ne);
|
||||
|
||||
OPENSSL_EXPORT int X509v3_get_ext_count(const STACK_OF(X509_EXTENSION) * x);
|
||||
OPENSSL_EXPORT int X509v3_get_ext_by_NID(const STACK_OF(X509_EXTENSION) * x,
|
||||
OPENSSL_EXPORT int X509v3_get_ext_count(const STACK_OF(X509_EXTENSION) *x);
|
||||
OPENSSL_EXPORT int X509v3_get_ext_by_NID(const STACK_OF(X509_EXTENSION) *x,
|
||||
int nid, int lastpos);
|
||||
OPENSSL_EXPORT int X509v3_get_ext_by_OBJ(const STACK_OF(X509_EXTENSION) * x,
|
||||
OPENSSL_EXPORT int X509v3_get_ext_by_OBJ(const STACK_OF(X509_EXTENSION) *x,
|
||||
const ASN1_OBJECT *obj, int lastpos);
|
||||
OPENSSL_EXPORT int X509v3_get_ext_by_critical(const STACK_OF(X509_EXTENSION) *
|
||||
x,
|
||||
OPENSSL_EXPORT int X509v3_get_ext_by_critical(const STACK_OF(X509_EXTENSION) *x,
|
||||
int crit, int lastpos);
|
||||
OPENSSL_EXPORT X509_EXTENSION *X509v3_get_ext(const STACK_OF(X509_EXTENSION) *
|
||||
x,
|
||||
OPENSSL_EXPORT X509_EXTENSION *X509v3_get_ext(const STACK_OF(X509_EXTENSION) *x,
|
||||
int loc);
|
||||
OPENSSL_EXPORT X509_EXTENSION *X509v3_delete_ext(STACK_OF(X509_EXTENSION) * x,
|
||||
OPENSSL_EXPORT X509_EXTENSION *X509v3_delete_ext(STACK_OF(X509_EXTENSION) *x,
|
||||
int loc);
|
||||
OPENSSL_EXPORT STACK_OF(X509_EXTENSION) *
|
||||
X509v3_add_ext(STACK_OF(X509_EXTENSION) * *x, X509_EXTENSION *ex, int loc);
|
||||
OPENSSL_EXPORT STACK_OF(X509_EXTENSION) *X509v3_add_ext(
|
||||
STACK_OF(X509_EXTENSION) **x, X509_EXTENSION *ex, int loc);
|
||||
|
||||
OPENSSL_EXPORT int X509_get_ext_count(const X509 *x);
|
||||
OPENSSL_EXPORT int X509_get_ext_by_NID(const X509 *x, int nid, int lastpos);
|
||||
@@ -1166,12 +1315,27 @@ OPENSSL_EXPORT int X509_get_ext_by_critical(const X509 *x, int crit,
|
||||
OPENSSL_EXPORT X509_EXTENSION *X509_get_ext(const X509 *x, int loc);
|
||||
OPENSSL_EXPORT X509_EXTENSION *X509_delete_ext(X509 *x, int loc);
|
||||
OPENSSL_EXPORT int X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc);
|
||||
OPENSSL_EXPORT void *X509_get_ext_d2i(const X509 *x, int nid, int *crit, int *idx);
|
||||
|
||||
// X509_get_ext_d2i behaves like |X509V3_get_d2i| but looks for the extension in
|
||||
// |x509|'s extension list.
|
||||
//
|
||||
// WARNING: This function is difficult to use correctly. See the documentation
|
||||
// for |X509V3_get_d2i| for details.
|
||||
OPENSSL_EXPORT void *X509_get_ext_d2i(const X509 *x509, int nid,
|
||||
int *out_critical, int *out_idx);
|
||||
|
||||
// X509_add1_ext_i2d behaves like |X509V3_add1_i2d| but adds the extension to
|
||||
// |x|'s extension list.
|
||||
//
|
||||
// WARNING: This function may return zero or -1 on error. The caller must also
|
||||
// ensure |value|'s type matches |nid|. See the documentation for
|
||||
// |X509V3_add1_i2d| for details.
|
||||
OPENSSL_EXPORT int X509_add1_ext_i2d(X509 *x, int nid, void *value, int crit,
|
||||
unsigned long flags);
|
||||
|
||||
OPENSSL_EXPORT int X509_CRL_get_ext_count(const X509_CRL *x);
|
||||
OPENSSL_EXPORT int X509_CRL_get_ext_by_NID(const X509_CRL *x, int nid, int lastpos);
|
||||
OPENSSL_EXPORT int X509_CRL_get_ext_by_NID(const X509_CRL *x, int nid,
|
||||
int lastpos);
|
||||
OPENSSL_EXPORT int X509_CRL_get_ext_by_OBJ(const X509_CRL *x,
|
||||
const ASN1_OBJECT *obj, int lastpos);
|
||||
OPENSSL_EXPORT int X509_CRL_get_ext_by_critical(const X509_CRL *x, int crit,
|
||||
@@ -1179,8 +1343,21 @@ OPENSSL_EXPORT int X509_CRL_get_ext_by_critical(const X509_CRL *x, int crit,
|
||||
OPENSSL_EXPORT X509_EXTENSION *X509_CRL_get_ext(const X509_CRL *x, int loc);
|
||||
OPENSSL_EXPORT X509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc);
|
||||
OPENSSL_EXPORT int X509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc);
|
||||
OPENSSL_EXPORT void *X509_CRL_get_ext_d2i(const X509_CRL *x, int nid, int *crit,
|
||||
int *idx);
|
||||
|
||||
// X509_CRL_get_ext_d2i behaves like |X509V3_get_d2i| but looks for the
|
||||
// extension in |crl|'s extension list.
|
||||
//
|
||||
// WARNING: This function is difficult to use correctly. See the documentation
|
||||
// for |X509V3_get_d2i| for details.
|
||||
OPENSSL_EXPORT void *X509_CRL_get_ext_d2i(const X509_CRL *crl, int nid,
|
||||
int *out_critical, int *out_idx);
|
||||
|
||||
// X509_CRL_add1_ext_i2d behaves like |X509V3_add1_i2d| but adds the extension
|
||||
// to |x|'s extension list.
|
||||
//
|
||||
// WARNING: This function may return zero or -1 on error. The caller must also
|
||||
// ensure |value|'s type matches |nid|. See the documentation for
|
||||
// |X509V3_add1_i2d| for details.
|
||||
OPENSSL_EXPORT int X509_CRL_add1_ext_i2d(X509_CRL *x, int nid, void *value,
|
||||
int crit, unsigned long flags);
|
||||
|
||||
@@ -1198,8 +1375,22 @@ OPENSSL_EXPORT X509_EXTENSION *X509_REVOKED_delete_ext(X509_REVOKED *x,
|
||||
int loc);
|
||||
OPENSSL_EXPORT int X509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex,
|
||||
int loc);
|
||||
OPENSSL_EXPORT void *X509_REVOKED_get_ext_d2i(const X509_REVOKED *x, int nid,
|
||||
int *crit, int *idx);
|
||||
|
||||
// X509_REVOKED_get_ext_d2i behaves like |X509V3_get_d2i| but looks for the
|
||||
// extension in |revoked|'s extension list.
|
||||
//
|
||||
// WARNING: This function is difficult to use correctly. See the documentation
|
||||
// for |X509V3_get_d2i| for details.
|
||||
OPENSSL_EXPORT void *X509_REVOKED_get_ext_d2i(const X509_REVOKED *revoked,
|
||||
int nid, int *out_critical,
|
||||
int *out_idx);
|
||||
|
||||
// X509_REVOKED_add1_ext_i2d behaves like |X509V3_add1_i2d| but adds the
|
||||
// extension to |x|'s extension list.
|
||||
//
|
||||
// WARNING: This function may return zero or -1 on error. The caller must also
|
||||
// ensure |value|'s type matches |nid|. See the documentation for
|
||||
// |X509V3_add1_i2d| for details.
|
||||
OPENSSL_EXPORT int X509_REVOKED_add1_ext_i2d(X509_REVOKED *x, int nid,
|
||||
void *value, int crit,
|
||||
unsigned long flags);
|
||||
@@ -1218,29 +1409,27 @@ OPENSSL_EXPORT ASN1_OBJECT *X509_EXTENSION_get_object(X509_EXTENSION *ex);
|
||||
OPENSSL_EXPORT ASN1_OCTET_STRING *X509_EXTENSION_get_data(X509_EXTENSION *ne);
|
||||
OPENSSL_EXPORT int X509_EXTENSION_get_critical(X509_EXTENSION *ex);
|
||||
|
||||
OPENSSL_EXPORT int X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) * x);
|
||||
OPENSSL_EXPORT int X509at_get_attr_by_NID(const STACK_OF(X509_ATTRIBUTE) * x,
|
||||
OPENSSL_EXPORT int X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) *x);
|
||||
OPENSSL_EXPORT int X509at_get_attr_by_NID(const STACK_OF(X509_ATTRIBUTE) *x,
|
||||
int nid, int lastpos);
|
||||
OPENSSL_EXPORT int X509at_get_attr_by_OBJ(const STACK_OF(X509_ATTRIBUTE) * sk,
|
||||
OPENSSL_EXPORT int X509at_get_attr_by_OBJ(const STACK_OF(X509_ATTRIBUTE) *sk,
|
||||
const ASN1_OBJECT *obj, int lastpos);
|
||||
OPENSSL_EXPORT X509_ATTRIBUTE *X509at_get_attr(const STACK_OF(X509_ATTRIBUTE) *
|
||||
x,
|
||||
int loc);
|
||||
OPENSSL_EXPORT X509_ATTRIBUTE *X509at_delete_attr(STACK_OF(X509_ATTRIBUTE) * x,
|
||||
OPENSSL_EXPORT X509_ATTRIBUTE *X509at_get_attr(
|
||||
const STACK_OF(X509_ATTRIBUTE) *x, int loc);
|
||||
OPENSSL_EXPORT X509_ATTRIBUTE *X509at_delete_attr(STACK_OF(X509_ATTRIBUTE) *x,
|
||||
int loc);
|
||||
OPENSSL_EXPORT STACK_OF(X509_ATTRIBUTE) *
|
||||
X509at_add1_attr(STACK_OF(X509_ATTRIBUTE) * *x, X509_ATTRIBUTE *attr);
|
||||
OPENSSL_EXPORT STACK_OF(X509_ATTRIBUTE) *
|
||||
X509at_add1_attr_by_OBJ(STACK_OF(X509_ATTRIBUTE) * *x,
|
||||
const ASN1_OBJECT *obj, int type,
|
||||
const unsigned char *bytes, int len);
|
||||
OPENSSL_EXPORT STACK_OF(X509_ATTRIBUTE) *
|
||||
X509at_add1_attr_by_NID(STACK_OF(X509_ATTRIBUTE) * *x, int nid, int type,
|
||||
const unsigned char *bytes, int len);
|
||||
OPENSSL_EXPORT STACK_OF(X509_ATTRIBUTE) *
|
||||
X509at_add1_attr_by_txt(STACK_OF(X509_ATTRIBUTE) * *x, const char *attrname,
|
||||
int type, const unsigned char *bytes, int len);
|
||||
OPENSSL_EXPORT void *X509at_get0_data_by_OBJ(STACK_OF(X509_ATTRIBUTE) * x,
|
||||
OPENSSL_EXPORT STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr(
|
||||
STACK_OF(X509_ATTRIBUTE) **x, X509_ATTRIBUTE *attr);
|
||||
OPENSSL_EXPORT STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_OBJ(
|
||||
STACK_OF(X509_ATTRIBUTE) **x, const ASN1_OBJECT *obj, int type,
|
||||
const unsigned char *bytes, int len);
|
||||
OPENSSL_EXPORT STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_NID(
|
||||
STACK_OF(X509_ATTRIBUTE) **x, int nid, int type, const unsigned char *bytes,
|
||||
int len);
|
||||
OPENSSL_EXPORT STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_txt(
|
||||
STACK_OF(X509_ATTRIBUTE) **x, const char *attrname, int type,
|
||||
const unsigned char *bytes, int len);
|
||||
OPENSSL_EXPORT void *X509at_get0_data_by_OBJ(STACK_OF(X509_ATTRIBUTE) *x,
|
||||
ASN1_OBJECT *obj, int lastpos,
|
||||
int type);
|
||||
OPENSSL_EXPORT X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_NID(
|
||||
@@ -1265,10 +1454,10 @@ OPENSSL_EXPORT ASN1_TYPE *X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr,
|
||||
OPENSSL_EXPORT int X509_verify_cert(X509_STORE_CTX *ctx);
|
||||
|
||||
// lookup a cert from a X509 STACK
|
||||
OPENSSL_EXPORT X509 *X509_find_by_issuer_and_serial(STACK_OF(X509) * sk,
|
||||
OPENSSL_EXPORT X509 *X509_find_by_issuer_and_serial(STACK_OF(X509) *sk,
|
||||
X509_NAME *name,
|
||||
ASN1_INTEGER *serial);
|
||||
OPENSSL_EXPORT X509 *X509_find_by_subject(STACK_OF(X509) * sk, X509_NAME *name);
|
||||
OPENSSL_EXPORT X509 *X509_find_by_subject(STACK_OF(X509) *sk, X509_NAME *name);
|
||||
|
||||
// PKCS#8 utilities
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -80,7 +80,6 @@
|
||||
%xdefine _ASN1_OBJECT_free _ %+ BORINGSSL_PREFIX %+ _ASN1_OBJECT_free
|
||||
%xdefine _ASN1_OBJECT_it _ %+ BORINGSSL_PREFIX %+ _ASN1_OBJECT_it
|
||||
%xdefine _ASN1_OBJECT_new _ %+ BORINGSSL_PREFIX %+ _ASN1_OBJECT_new
|
||||
%xdefine _ASN1_OCTET_STRING_NDEF_it _ %+ BORINGSSL_PREFIX %+ _ASN1_OCTET_STRING_NDEF_it
|
||||
%xdefine _ASN1_OCTET_STRING_cmp _ %+ BORINGSSL_PREFIX %+ _ASN1_OCTET_STRING_cmp
|
||||
%xdefine _ASN1_OCTET_STRING_dup _ %+ BORINGSSL_PREFIX %+ _ASN1_OCTET_STRING_dup
|
||||
%xdefine _ASN1_OCTET_STRING_free _ %+ BORINGSSL_PREFIX %+ _ASN1_OCTET_STRING_free
|
||||
@@ -175,7 +174,6 @@
|
||||
%xdefine _ASN1_item_i2d _ %+ BORINGSSL_PREFIX %+ _ASN1_item_i2d
|
||||
%xdefine _ASN1_item_i2d_bio _ %+ BORINGSSL_PREFIX %+ _ASN1_item_i2d_bio
|
||||
%xdefine _ASN1_item_i2d_fp _ %+ BORINGSSL_PREFIX %+ _ASN1_item_i2d_fp
|
||||
%xdefine _ASN1_item_ndef_i2d _ %+ BORINGSSL_PREFIX %+ _ASN1_item_ndef_i2d
|
||||
%xdefine _ASN1_item_new _ %+ BORINGSSL_PREFIX %+ _ASN1_item_new
|
||||
%xdefine _ASN1_item_pack _ %+ BORINGSSL_PREFIX %+ _ASN1_item_pack
|
||||
%xdefine _ASN1_item_sign _ %+ BORINGSSL_PREFIX %+ _ASN1_item_sign
|
||||
@@ -186,13 +184,11 @@
|
||||
%xdefine _ASN1_mbstring_ncopy _ %+ BORINGSSL_PREFIX %+ _ASN1_mbstring_ncopy
|
||||
%xdefine _ASN1_object_size _ %+ BORINGSSL_PREFIX %+ _ASN1_object_size
|
||||
%xdefine _ASN1_primitive_free _ %+ BORINGSSL_PREFIX %+ _ASN1_primitive_free
|
||||
%xdefine _ASN1_primitive_new _ %+ BORINGSSL_PREFIX %+ _ASN1_primitive_new
|
||||
%xdefine _ASN1_put_eoc _ %+ BORINGSSL_PREFIX %+ _ASN1_put_eoc
|
||||
%xdefine _ASN1_put_object _ %+ BORINGSSL_PREFIX %+ _ASN1_put_object
|
||||
%xdefine _ASN1_tag2bit _ %+ BORINGSSL_PREFIX %+ _ASN1_tag2bit
|
||||
%xdefine _ASN1_tag2str _ %+ BORINGSSL_PREFIX %+ _ASN1_tag2str
|
||||
%xdefine _ASN1_template_free _ %+ BORINGSSL_PREFIX %+ _ASN1_template_free
|
||||
%xdefine _ASN1_template_new _ %+ BORINGSSL_PREFIX %+ _ASN1_template_new
|
||||
%xdefine _AUTHORITY_INFO_ACCESS_free _ %+ BORINGSSL_PREFIX %+ _AUTHORITY_INFO_ACCESS_free
|
||||
%xdefine _AUTHORITY_INFO_ACCESS_it _ %+ BORINGSSL_PREFIX %+ _AUTHORITY_INFO_ACCESS_it
|
||||
%xdefine _AUTHORITY_INFO_ACCESS_new _ %+ BORINGSSL_PREFIX %+ _AUTHORITY_INFO_ACCESS_new
|
||||
@@ -282,6 +278,7 @@
|
||||
%xdefine _BIO_set_mem_eof_return _ %+ BORINGSSL_PREFIX %+ _BIO_set_mem_eof_return
|
||||
%xdefine _BIO_set_nbio _ %+ BORINGSSL_PREFIX %+ _BIO_set_nbio
|
||||
%xdefine _BIO_set_retry_read _ %+ BORINGSSL_PREFIX %+ _BIO_set_retry_read
|
||||
%xdefine _BIO_set_retry_reason _ %+ BORINGSSL_PREFIX %+ _BIO_set_retry_reason
|
||||
%xdefine _BIO_set_retry_special _ %+ BORINGSSL_PREFIX %+ _BIO_set_retry_special
|
||||
%xdefine _BIO_set_retry_write _ %+ BORINGSSL_PREFIX %+ _BIO_set_retry_write
|
||||
%xdefine _BIO_set_shutdown _ %+ BORINGSSL_PREFIX %+ _BIO_set_shutdown
|
||||
@@ -506,7 +503,9 @@
|
||||
%xdefine _CBS_get_u8 _ %+ BORINGSSL_PREFIX %+ _CBS_get_u8
|
||||
%xdefine _CBS_get_u8_length_prefixed _ %+ BORINGSSL_PREFIX %+ _CBS_get_u8_length_prefixed
|
||||
%xdefine _CBS_init _ %+ BORINGSSL_PREFIX %+ _CBS_init
|
||||
%xdefine _CBS_is_unsigned_asn1_integer _ %+ BORINGSSL_PREFIX %+ _CBS_is_unsigned_asn1_integer
|
||||
%xdefine _CBS_is_valid_asn1_bitstring _ %+ BORINGSSL_PREFIX %+ _CBS_is_valid_asn1_bitstring
|
||||
%xdefine _CBS_is_valid_asn1_integer _ %+ BORINGSSL_PREFIX %+ _CBS_is_valid_asn1_integer
|
||||
%xdefine _CBS_len _ %+ BORINGSSL_PREFIX %+ _CBS_len
|
||||
%xdefine _CBS_mem_equal _ %+ BORINGSSL_PREFIX %+ _CBS_mem_equal
|
||||
%xdefine _CBS_peek_asn1_tag _ %+ BORINGSSL_PREFIX %+ _CBS_peek_asn1_tag
|
||||
@@ -1069,6 +1068,7 @@
|
||||
%xdefine _EVP_aead_aes_128_ccm_bluetooth_8 _ %+ BORINGSSL_PREFIX %+ _EVP_aead_aes_128_ccm_bluetooth_8
|
||||
%xdefine _EVP_aead_aes_128_ctr_hmac_sha256 _ %+ BORINGSSL_PREFIX %+ _EVP_aead_aes_128_ctr_hmac_sha256
|
||||
%xdefine _EVP_aead_aes_128_gcm _ %+ BORINGSSL_PREFIX %+ _EVP_aead_aes_128_gcm
|
||||
%xdefine _EVP_aead_aes_128_gcm_randnonce _ %+ BORINGSSL_PREFIX %+ _EVP_aead_aes_128_gcm_randnonce
|
||||
%xdefine _EVP_aead_aes_128_gcm_siv _ %+ BORINGSSL_PREFIX %+ _EVP_aead_aes_128_gcm_siv
|
||||
%xdefine _EVP_aead_aes_128_gcm_tls12 _ %+ BORINGSSL_PREFIX %+ _EVP_aead_aes_128_gcm_tls12
|
||||
%xdefine _EVP_aead_aes_128_gcm_tls13 _ %+ BORINGSSL_PREFIX %+ _EVP_aead_aes_128_gcm_tls13
|
||||
@@ -1079,6 +1079,7 @@
|
||||
%xdefine _EVP_aead_aes_256_cbc_sha384_tls _ %+ BORINGSSL_PREFIX %+ _EVP_aead_aes_256_cbc_sha384_tls
|
||||
%xdefine _EVP_aead_aes_256_ctr_hmac_sha256 _ %+ BORINGSSL_PREFIX %+ _EVP_aead_aes_256_ctr_hmac_sha256
|
||||
%xdefine _EVP_aead_aes_256_gcm _ %+ BORINGSSL_PREFIX %+ _EVP_aead_aes_256_gcm
|
||||
%xdefine _EVP_aead_aes_256_gcm_randnonce _ %+ BORINGSSL_PREFIX %+ _EVP_aead_aes_256_gcm_randnonce
|
||||
%xdefine _EVP_aead_aes_256_gcm_siv _ %+ BORINGSSL_PREFIX %+ _EVP_aead_aes_256_gcm_siv
|
||||
%xdefine _EVP_aead_aes_256_gcm_tls12 _ %+ BORINGSSL_PREFIX %+ _EVP_aead_aes_256_gcm_tls12
|
||||
%xdefine _EVP_aead_aes_256_gcm_tls13 _ %+ BORINGSSL_PREFIX %+ _EVP_aead_aes_256_gcm_tls13
|
||||
@@ -1410,7 +1411,6 @@
|
||||
%xdefine _PKCS8_parse_encrypted_private_key _ %+ BORINGSSL_PREFIX %+ _PKCS8_parse_encrypted_private_key
|
||||
%xdefine _PKCS8_pkey_get0 _ %+ BORINGSSL_PREFIX %+ _PKCS8_pkey_get0
|
||||
%xdefine _PKCS8_pkey_set0 _ %+ BORINGSSL_PREFIX %+ _PKCS8_pkey_set0
|
||||
%xdefine _PMBTOKEN_PRETOKEN_free _ %+ BORINGSSL_PREFIX %+ _PMBTOKEN_PRETOKEN_free
|
||||
%xdefine _POLICYINFO_free _ %+ BORINGSSL_PREFIX %+ _POLICYINFO_free
|
||||
%xdefine _POLICYINFO_it _ %+ BORINGSSL_PREFIX %+ _POLICYINFO_it
|
||||
%xdefine _POLICYINFO_new _ %+ BORINGSSL_PREFIX %+ _POLICYINFO_new
|
||||
@@ -1564,12 +1564,14 @@
|
||||
%xdefine _TRUST_TOKEN_ISSUER_issue _ %+ BORINGSSL_PREFIX %+ _TRUST_TOKEN_ISSUER_issue
|
||||
%xdefine _TRUST_TOKEN_ISSUER_new _ %+ BORINGSSL_PREFIX %+ _TRUST_TOKEN_ISSUER_new
|
||||
%xdefine _TRUST_TOKEN_ISSUER_redeem _ %+ BORINGSSL_PREFIX %+ _TRUST_TOKEN_ISSUER_redeem
|
||||
%xdefine _TRUST_TOKEN_ISSUER_redeem_raw _ %+ BORINGSSL_PREFIX %+ _TRUST_TOKEN_ISSUER_redeem_raw
|
||||
%xdefine _TRUST_TOKEN_ISSUER_set_metadata_key _ %+ BORINGSSL_PREFIX %+ _TRUST_TOKEN_ISSUER_set_metadata_key
|
||||
%xdefine _TRUST_TOKEN_ISSUER_set_srr_key _ %+ BORINGSSL_PREFIX %+ _TRUST_TOKEN_ISSUER_set_srr_key
|
||||
%xdefine _TRUST_TOKEN_PRETOKEN_free _ %+ BORINGSSL_PREFIX %+ _TRUST_TOKEN_PRETOKEN_free
|
||||
%xdefine _TRUST_TOKEN_decode_private_metadata _ %+ BORINGSSL_PREFIX %+ _TRUST_TOKEN_decode_private_metadata
|
||||
%xdefine _TRUST_TOKEN_experiment_v1 _ %+ BORINGSSL_PREFIX %+ _TRUST_TOKEN_experiment_v1
|
||||
%xdefine _TRUST_TOKEN_experiment_v2_pmb _ %+ BORINGSSL_PREFIX %+ _TRUST_TOKEN_experiment_v2_pmb
|
||||
%xdefine _TRUST_TOKEN_experiment_v2_pp _ %+ BORINGSSL_PREFIX %+ _TRUST_TOKEN_experiment_v2_pp
|
||||
%xdefine _TRUST_TOKEN_experiment_v2_voprf _ %+ BORINGSSL_PREFIX %+ _TRUST_TOKEN_experiment_v2_voprf
|
||||
%xdefine _TRUST_TOKEN_free _ %+ BORINGSSL_PREFIX %+ _TRUST_TOKEN_free
|
||||
%xdefine _TRUST_TOKEN_generate_key _ %+ BORINGSSL_PREFIX %+ _TRUST_TOKEN_generate_key
|
||||
%xdefine _TRUST_TOKEN_new _ %+ BORINGSSL_PREFIX %+ _TRUST_TOKEN_new
|
||||
@@ -2084,6 +2086,8 @@
|
||||
%xdefine _X509_reject_clear _ %+ BORINGSSL_PREFIX %+ _X509_reject_clear
|
||||
%xdefine _X509_set1_notAfter _ %+ BORINGSSL_PREFIX %+ _X509_set1_notAfter
|
||||
%xdefine _X509_set1_notBefore _ %+ BORINGSSL_PREFIX %+ _X509_set1_notBefore
|
||||
%xdefine _X509_set1_signature_algo _ %+ BORINGSSL_PREFIX %+ _X509_set1_signature_algo
|
||||
%xdefine _X509_set1_signature_value _ %+ BORINGSSL_PREFIX %+ _X509_set1_signature_value
|
||||
%xdefine _X509_set_ex_data _ %+ BORINGSSL_PREFIX %+ _X509_set_ex_data
|
||||
%xdefine _X509_set_issuer_name _ %+ BORINGSSL_PREFIX %+ _X509_set_issuer_name
|
||||
%xdefine _X509_set_notAfter _ %+ BORINGSSL_PREFIX %+ _X509_set_notAfter
|
||||
@@ -2168,8 +2172,6 @@
|
||||
%xdefine _asn1_enc_init _ %+ BORINGSSL_PREFIX %+ _asn1_enc_init
|
||||
%xdefine _asn1_enc_restore _ %+ BORINGSSL_PREFIX %+ _asn1_enc_restore
|
||||
%xdefine _asn1_enc_save _ %+ BORINGSSL_PREFIX %+ _asn1_enc_save
|
||||
%xdefine _asn1_ex_c2i _ %+ BORINGSSL_PREFIX %+ _asn1_ex_c2i
|
||||
%xdefine _asn1_ex_i2c _ %+ BORINGSSL_PREFIX %+ _asn1_ex_i2c
|
||||
%xdefine _asn1_generalizedtime_to_tm _ %+ BORINGSSL_PREFIX %+ _asn1_generalizedtime_to_tm
|
||||
%xdefine _asn1_get_choice_selector _ %+ BORINGSSL_PREFIX %+ _asn1_get_choice_selector
|
||||
%xdefine _asn1_get_field_ptr _ %+ BORINGSSL_PREFIX %+ _asn1_get_field_ptr
|
||||
@@ -2623,6 +2625,7 @@
|
||||
%xdefine _i2d_X509_CRL_INFO _ %+ BORINGSSL_PREFIX %+ _i2d_X509_CRL_INFO
|
||||
%xdefine _i2d_X509_CRL_bio _ %+ BORINGSSL_PREFIX %+ _i2d_X509_CRL_bio
|
||||
%xdefine _i2d_X509_CRL_fp _ %+ BORINGSSL_PREFIX %+ _i2d_X509_CRL_fp
|
||||
%xdefine _i2d_X509_CRL_tbs _ %+ BORINGSSL_PREFIX %+ _i2d_X509_CRL_tbs
|
||||
%xdefine _i2d_X509_EXTENSION _ %+ BORINGSSL_PREFIX %+ _i2d_X509_EXTENSION
|
||||
%xdefine _i2d_X509_EXTENSIONS _ %+ BORINGSSL_PREFIX %+ _i2d_X509_EXTENSIONS
|
||||
%xdefine _i2d_X509_NAME _ %+ BORINGSSL_PREFIX %+ _i2d_X509_NAME
|
||||
@@ -2637,6 +2640,7 @@
|
||||
%xdefine _i2d_X509_VAL _ %+ BORINGSSL_PREFIX %+ _i2d_X509_VAL
|
||||
%xdefine _i2d_X509_bio _ %+ BORINGSSL_PREFIX %+ _i2d_X509_bio
|
||||
%xdefine _i2d_X509_fp _ %+ BORINGSSL_PREFIX %+ _i2d_X509_fp
|
||||
%xdefine _i2d_X509_tbs _ %+ BORINGSSL_PREFIX %+ _i2d_X509_tbs
|
||||
%xdefine _i2d_re_X509_CRL_tbs _ %+ BORINGSSL_PREFIX %+ _i2d_re_X509_CRL_tbs
|
||||
%xdefine _i2d_re_X509_REQ_tbs _ %+ BORINGSSL_PREFIX %+ _i2d_re_X509_REQ_tbs
|
||||
%xdefine _i2d_re_X509_tbs _ %+ BORINGSSL_PREFIX %+ _i2d_re_X509_tbs
|
||||
@@ -2770,6 +2774,13 @@
|
||||
%xdefine _v3_policy_mappings _ %+ BORINGSSL_PREFIX %+ _v3_policy_mappings
|
||||
%xdefine _v3_sinfo _ %+ BORINGSSL_PREFIX %+ _v3_sinfo
|
||||
%xdefine _v3_skey_id _ %+ BORINGSSL_PREFIX %+ _v3_skey_id
|
||||
%xdefine _voprf_exp2_blind _ %+ BORINGSSL_PREFIX %+ _voprf_exp2_blind
|
||||
%xdefine _voprf_exp2_client_key_from_bytes _ %+ BORINGSSL_PREFIX %+ _voprf_exp2_client_key_from_bytes
|
||||
%xdefine _voprf_exp2_generate_key _ %+ BORINGSSL_PREFIX %+ _voprf_exp2_generate_key
|
||||
%xdefine _voprf_exp2_issuer_key_from_bytes _ %+ BORINGSSL_PREFIX %+ _voprf_exp2_issuer_key_from_bytes
|
||||
%xdefine _voprf_exp2_read _ %+ BORINGSSL_PREFIX %+ _voprf_exp2_read
|
||||
%xdefine _voprf_exp2_sign _ %+ BORINGSSL_PREFIX %+ _voprf_exp2_sign
|
||||
%xdefine _voprf_exp2_unblind _ %+ BORINGSSL_PREFIX %+ _voprf_exp2_unblind
|
||||
%xdefine _vpaes_cbc_encrypt _ %+ BORINGSSL_PREFIX %+ _vpaes_cbc_encrypt
|
||||
%xdefine _vpaes_ctr32_encrypt_blocks _ %+ BORINGSSL_PREFIX %+ _vpaes_ctr32_encrypt_blocks
|
||||
%xdefine _vpaes_decrypt _ %+ BORINGSSL_PREFIX %+ _vpaes_decrypt
|
||||
@@ -2866,7 +2877,6 @@
|
||||
%xdefine ASN1_OBJECT_free BORINGSSL_PREFIX %+ _ASN1_OBJECT_free
|
||||
%xdefine ASN1_OBJECT_it BORINGSSL_PREFIX %+ _ASN1_OBJECT_it
|
||||
%xdefine ASN1_OBJECT_new BORINGSSL_PREFIX %+ _ASN1_OBJECT_new
|
||||
%xdefine ASN1_OCTET_STRING_NDEF_it BORINGSSL_PREFIX %+ _ASN1_OCTET_STRING_NDEF_it
|
||||
%xdefine ASN1_OCTET_STRING_cmp BORINGSSL_PREFIX %+ _ASN1_OCTET_STRING_cmp
|
||||
%xdefine ASN1_OCTET_STRING_dup BORINGSSL_PREFIX %+ _ASN1_OCTET_STRING_dup
|
||||
%xdefine ASN1_OCTET_STRING_free BORINGSSL_PREFIX %+ _ASN1_OCTET_STRING_free
|
||||
@@ -2961,7 +2971,6 @@
|
||||
%xdefine ASN1_item_i2d BORINGSSL_PREFIX %+ _ASN1_item_i2d
|
||||
%xdefine ASN1_item_i2d_bio BORINGSSL_PREFIX %+ _ASN1_item_i2d_bio
|
||||
%xdefine ASN1_item_i2d_fp BORINGSSL_PREFIX %+ _ASN1_item_i2d_fp
|
||||
%xdefine ASN1_item_ndef_i2d BORINGSSL_PREFIX %+ _ASN1_item_ndef_i2d
|
||||
%xdefine ASN1_item_new BORINGSSL_PREFIX %+ _ASN1_item_new
|
||||
%xdefine ASN1_item_pack BORINGSSL_PREFIX %+ _ASN1_item_pack
|
||||
%xdefine ASN1_item_sign BORINGSSL_PREFIX %+ _ASN1_item_sign
|
||||
@@ -2972,13 +2981,11 @@
|
||||
%xdefine ASN1_mbstring_ncopy BORINGSSL_PREFIX %+ _ASN1_mbstring_ncopy
|
||||
%xdefine ASN1_object_size BORINGSSL_PREFIX %+ _ASN1_object_size
|
||||
%xdefine ASN1_primitive_free BORINGSSL_PREFIX %+ _ASN1_primitive_free
|
||||
%xdefine ASN1_primitive_new BORINGSSL_PREFIX %+ _ASN1_primitive_new
|
||||
%xdefine ASN1_put_eoc BORINGSSL_PREFIX %+ _ASN1_put_eoc
|
||||
%xdefine ASN1_put_object BORINGSSL_PREFIX %+ _ASN1_put_object
|
||||
%xdefine ASN1_tag2bit BORINGSSL_PREFIX %+ _ASN1_tag2bit
|
||||
%xdefine ASN1_tag2str BORINGSSL_PREFIX %+ _ASN1_tag2str
|
||||
%xdefine ASN1_template_free BORINGSSL_PREFIX %+ _ASN1_template_free
|
||||
%xdefine ASN1_template_new BORINGSSL_PREFIX %+ _ASN1_template_new
|
||||
%xdefine AUTHORITY_INFO_ACCESS_free BORINGSSL_PREFIX %+ _AUTHORITY_INFO_ACCESS_free
|
||||
%xdefine AUTHORITY_INFO_ACCESS_it BORINGSSL_PREFIX %+ _AUTHORITY_INFO_ACCESS_it
|
||||
%xdefine AUTHORITY_INFO_ACCESS_new BORINGSSL_PREFIX %+ _AUTHORITY_INFO_ACCESS_new
|
||||
@@ -3068,6 +3075,7 @@
|
||||
%xdefine BIO_set_mem_eof_return BORINGSSL_PREFIX %+ _BIO_set_mem_eof_return
|
||||
%xdefine BIO_set_nbio BORINGSSL_PREFIX %+ _BIO_set_nbio
|
||||
%xdefine BIO_set_retry_read BORINGSSL_PREFIX %+ _BIO_set_retry_read
|
||||
%xdefine BIO_set_retry_reason BORINGSSL_PREFIX %+ _BIO_set_retry_reason
|
||||
%xdefine BIO_set_retry_special BORINGSSL_PREFIX %+ _BIO_set_retry_special
|
||||
%xdefine BIO_set_retry_write BORINGSSL_PREFIX %+ _BIO_set_retry_write
|
||||
%xdefine BIO_set_shutdown BORINGSSL_PREFIX %+ _BIO_set_shutdown
|
||||
@@ -3292,7 +3300,9 @@
|
||||
%xdefine CBS_get_u8 BORINGSSL_PREFIX %+ _CBS_get_u8
|
||||
%xdefine CBS_get_u8_length_prefixed BORINGSSL_PREFIX %+ _CBS_get_u8_length_prefixed
|
||||
%xdefine CBS_init BORINGSSL_PREFIX %+ _CBS_init
|
||||
%xdefine CBS_is_unsigned_asn1_integer BORINGSSL_PREFIX %+ _CBS_is_unsigned_asn1_integer
|
||||
%xdefine CBS_is_valid_asn1_bitstring BORINGSSL_PREFIX %+ _CBS_is_valid_asn1_bitstring
|
||||
%xdefine CBS_is_valid_asn1_integer BORINGSSL_PREFIX %+ _CBS_is_valid_asn1_integer
|
||||
%xdefine CBS_len BORINGSSL_PREFIX %+ _CBS_len
|
||||
%xdefine CBS_mem_equal BORINGSSL_PREFIX %+ _CBS_mem_equal
|
||||
%xdefine CBS_peek_asn1_tag BORINGSSL_PREFIX %+ _CBS_peek_asn1_tag
|
||||
@@ -3855,6 +3865,7 @@
|
||||
%xdefine EVP_aead_aes_128_ccm_bluetooth_8 BORINGSSL_PREFIX %+ _EVP_aead_aes_128_ccm_bluetooth_8
|
||||
%xdefine EVP_aead_aes_128_ctr_hmac_sha256 BORINGSSL_PREFIX %+ _EVP_aead_aes_128_ctr_hmac_sha256
|
||||
%xdefine EVP_aead_aes_128_gcm BORINGSSL_PREFIX %+ _EVP_aead_aes_128_gcm
|
||||
%xdefine EVP_aead_aes_128_gcm_randnonce BORINGSSL_PREFIX %+ _EVP_aead_aes_128_gcm_randnonce
|
||||
%xdefine EVP_aead_aes_128_gcm_siv BORINGSSL_PREFIX %+ _EVP_aead_aes_128_gcm_siv
|
||||
%xdefine EVP_aead_aes_128_gcm_tls12 BORINGSSL_PREFIX %+ _EVP_aead_aes_128_gcm_tls12
|
||||
%xdefine EVP_aead_aes_128_gcm_tls13 BORINGSSL_PREFIX %+ _EVP_aead_aes_128_gcm_tls13
|
||||
@@ -3865,6 +3876,7 @@
|
||||
%xdefine EVP_aead_aes_256_cbc_sha384_tls BORINGSSL_PREFIX %+ _EVP_aead_aes_256_cbc_sha384_tls
|
||||
%xdefine EVP_aead_aes_256_ctr_hmac_sha256 BORINGSSL_PREFIX %+ _EVP_aead_aes_256_ctr_hmac_sha256
|
||||
%xdefine EVP_aead_aes_256_gcm BORINGSSL_PREFIX %+ _EVP_aead_aes_256_gcm
|
||||
%xdefine EVP_aead_aes_256_gcm_randnonce BORINGSSL_PREFIX %+ _EVP_aead_aes_256_gcm_randnonce
|
||||
%xdefine EVP_aead_aes_256_gcm_siv BORINGSSL_PREFIX %+ _EVP_aead_aes_256_gcm_siv
|
||||
%xdefine EVP_aead_aes_256_gcm_tls12 BORINGSSL_PREFIX %+ _EVP_aead_aes_256_gcm_tls12
|
||||
%xdefine EVP_aead_aes_256_gcm_tls13 BORINGSSL_PREFIX %+ _EVP_aead_aes_256_gcm_tls13
|
||||
@@ -4196,7 +4208,6 @@
|
||||
%xdefine PKCS8_parse_encrypted_private_key BORINGSSL_PREFIX %+ _PKCS8_parse_encrypted_private_key
|
||||
%xdefine PKCS8_pkey_get0 BORINGSSL_PREFIX %+ _PKCS8_pkey_get0
|
||||
%xdefine PKCS8_pkey_set0 BORINGSSL_PREFIX %+ _PKCS8_pkey_set0
|
||||
%xdefine PMBTOKEN_PRETOKEN_free BORINGSSL_PREFIX %+ _PMBTOKEN_PRETOKEN_free
|
||||
%xdefine POLICYINFO_free BORINGSSL_PREFIX %+ _POLICYINFO_free
|
||||
%xdefine POLICYINFO_it BORINGSSL_PREFIX %+ _POLICYINFO_it
|
||||
%xdefine POLICYINFO_new BORINGSSL_PREFIX %+ _POLICYINFO_new
|
||||
@@ -4350,12 +4361,14 @@
|
||||
%xdefine TRUST_TOKEN_ISSUER_issue BORINGSSL_PREFIX %+ _TRUST_TOKEN_ISSUER_issue
|
||||
%xdefine TRUST_TOKEN_ISSUER_new BORINGSSL_PREFIX %+ _TRUST_TOKEN_ISSUER_new
|
||||
%xdefine TRUST_TOKEN_ISSUER_redeem BORINGSSL_PREFIX %+ _TRUST_TOKEN_ISSUER_redeem
|
||||
%xdefine TRUST_TOKEN_ISSUER_redeem_raw BORINGSSL_PREFIX %+ _TRUST_TOKEN_ISSUER_redeem_raw
|
||||
%xdefine TRUST_TOKEN_ISSUER_set_metadata_key BORINGSSL_PREFIX %+ _TRUST_TOKEN_ISSUER_set_metadata_key
|
||||
%xdefine TRUST_TOKEN_ISSUER_set_srr_key BORINGSSL_PREFIX %+ _TRUST_TOKEN_ISSUER_set_srr_key
|
||||
%xdefine TRUST_TOKEN_PRETOKEN_free BORINGSSL_PREFIX %+ _TRUST_TOKEN_PRETOKEN_free
|
||||
%xdefine TRUST_TOKEN_decode_private_metadata BORINGSSL_PREFIX %+ _TRUST_TOKEN_decode_private_metadata
|
||||
%xdefine TRUST_TOKEN_experiment_v1 BORINGSSL_PREFIX %+ _TRUST_TOKEN_experiment_v1
|
||||
%xdefine TRUST_TOKEN_experiment_v2_pmb BORINGSSL_PREFIX %+ _TRUST_TOKEN_experiment_v2_pmb
|
||||
%xdefine TRUST_TOKEN_experiment_v2_pp BORINGSSL_PREFIX %+ _TRUST_TOKEN_experiment_v2_pp
|
||||
%xdefine TRUST_TOKEN_experiment_v2_voprf BORINGSSL_PREFIX %+ _TRUST_TOKEN_experiment_v2_voprf
|
||||
%xdefine TRUST_TOKEN_free BORINGSSL_PREFIX %+ _TRUST_TOKEN_free
|
||||
%xdefine TRUST_TOKEN_generate_key BORINGSSL_PREFIX %+ _TRUST_TOKEN_generate_key
|
||||
%xdefine TRUST_TOKEN_new BORINGSSL_PREFIX %+ _TRUST_TOKEN_new
|
||||
@@ -4870,6 +4883,8 @@
|
||||
%xdefine X509_reject_clear BORINGSSL_PREFIX %+ _X509_reject_clear
|
||||
%xdefine X509_set1_notAfter BORINGSSL_PREFIX %+ _X509_set1_notAfter
|
||||
%xdefine X509_set1_notBefore BORINGSSL_PREFIX %+ _X509_set1_notBefore
|
||||
%xdefine X509_set1_signature_algo BORINGSSL_PREFIX %+ _X509_set1_signature_algo
|
||||
%xdefine X509_set1_signature_value BORINGSSL_PREFIX %+ _X509_set1_signature_value
|
||||
%xdefine X509_set_ex_data BORINGSSL_PREFIX %+ _X509_set_ex_data
|
||||
%xdefine X509_set_issuer_name BORINGSSL_PREFIX %+ _X509_set_issuer_name
|
||||
%xdefine X509_set_notAfter BORINGSSL_PREFIX %+ _X509_set_notAfter
|
||||
@@ -4954,8 +4969,6 @@
|
||||
%xdefine asn1_enc_init BORINGSSL_PREFIX %+ _asn1_enc_init
|
||||
%xdefine asn1_enc_restore BORINGSSL_PREFIX %+ _asn1_enc_restore
|
||||
%xdefine asn1_enc_save BORINGSSL_PREFIX %+ _asn1_enc_save
|
||||
%xdefine asn1_ex_c2i BORINGSSL_PREFIX %+ _asn1_ex_c2i
|
||||
%xdefine asn1_ex_i2c BORINGSSL_PREFIX %+ _asn1_ex_i2c
|
||||
%xdefine asn1_generalizedtime_to_tm BORINGSSL_PREFIX %+ _asn1_generalizedtime_to_tm
|
||||
%xdefine asn1_get_choice_selector BORINGSSL_PREFIX %+ _asn1_get_choice_selector
|
||||
%xdefine asn1_get_field_ptr BORINGSSL_PREFIX %+ _asn1_get_field_ptr
|
||||
@@ -5409,6 +5422,7 @@
|
||||
%xdefine i2d_X509_CRL_INFO BORINGSSL_PREFIX %+ _i2d_X509_CRL_INFO
|
||||
%xdefine i2d_X509_CRL_bio BORINGSSL_PREFIX %+ _i2d_X509_CRL_bio
|
||||
%xdefine i2d_X509_CRL_fp BORINGSSL_PREFIX %+ _i2d_X509_CRL_fp
|
||||
%xdefine i2d_X509_CRL_tbs BORINGSSL_PREFIX %+ _i2d_X509_CRL_tbs
|
||||
%xdefine i2d_X509_EXTENSION BORINGSSL_PREFIX %+ _i2d_X509_EXTENSION
|
||||
%xdefine i2d_X509_EXTENSIONS BORINGSSL_PREFIX %+ _i2d_X509_EXTENSIONS
|
||||
%xdefine i2d_X509_NAME BORINGSSL_PREFIX %+ _i2d_X509_NAME
|
||||
@@ -5423,6 +5437,7 @@
|
||||
%xdefine i2d_X509_VAL BORINGSSL_PREFIX %+ _i2d_X509_VAL
|
||||
%xdefine i2d_X509_bio BORINGSSL_PREFIX %+ _i2d_X509_bio
|
||||
%xdefine i2d_X509_fp BORINGSSL_PREFIX %+ _i2d_X509_fp
|
||||
%xdefine i2d_X509_tbs BORINGSSL_PREFIX %+ _i2d_X509_tbs
|
||||
%xdefine i2d_re_X509_CRL_tbs BORINGSSL_PREFIX %+ _i2d_re_X509_CRL_tbs
|
||||
%xdefine i2d_re_X509_REQ_tbs BORINGSSL_PREFIX %+ _i2d_re_X509_REQ_tbs
|
||||
%xdefine i2d_re_X509_tbs BORINGSSL_PREFIX %+ _i2d_re_X509_tbs
|
||||
@@ -5556,6 +5571,13 @@
|
||||
%xdefine v3_policy_mappings BORINGSSL_PREFIX %+ _v3_policy_mappings
|
||||
%xdefine v3_sinfo BORINGSSL_PREFIX %+ _v3_sinfo
|
||||
%xdefine v3_skey_id BORINGSSL_PREFIX %+ _v3_skey_id
|
||||
%xdefine voprf_exp2_blind BORINGSSL_PREFIX %+ _voprf_exp2_blind
|
||||
%xdefine voprf_exp2_client_key_from_bytes BORINGSSL_PREFIX %+ _voprf_exp2_client_key_from_bytes
|
||||
%xdefine voprf_exp2_generate_key BORINGSSL_PREFIX %+ _voprf_exp2_generate_key
|
||||
%xdefine voprf_exp2_issuer_key_from_bytes BORINGSSL_PREFIX %+ _voprf_exp2_issuer_key_from_bytes
|
||||
%xdefine voprf_exp2_read BORINGSSL_PREFIX %+ _voprf_exp2_read
|
||||
%xdefine voprf_exp2_sign BORINGSSL_PREFIX %+ _voprf_exp2_sign
|
||||
%xdefine voprf_exp2_unblind BORINGSSL_PREFIX %+ _voprf_exp2_unblind
|
||||
%xdefine vpaes_cbc_encrypt BORINGSSL_PREFIX %+ _vpaes_cbc_encrypt
|
||||
%xdefine vpaes_ctr32_encrypt_blocks BORINGSSL_PREFIX %+ _vpaes_ctr32_encrypt_blocks
|
||||
%xdefine vpaes_decrypt BORINGSSL_PREFIX %+ _vpaes_decrypt
|
||||
|
||||
@@ -14,11 +14,15 @@
|
||||
#if !(os(macOS) || os(iOS) || os(watchOS) || os(tvOS))
|
||||
@_implementationOnly import CCryptoBoringSSL
|
||||
|
||||
typealias errno_t = CInt
|
||||
|
||||
// This is a Swift wrapper for the libc function that does not exist on Linux. We shim it via a call to OPENSSL_cleanse.
|
||||
// We have the same syntax, but mostly ignore it.
|
||||
func memset_s(_ s: UnsafeMutableRawPointer!, _ smax: Int, _ byte: CInt, _ n: Int) {
|
||||
@discardableResult
|
||||
func memset_s(_ s: UnsafeMutableRawPointer!, _ smax: Int, _ byte: CInt, _ n: Int) -> errno_t {
|
||||
assert(smax == n, "memset_s invariant not met")
|
||||
assert(byte == 0, "memset_s used to not zero anything")
|
||||
CCryptoBoringSSL_OPENSSL_cleanse(s, smax)
|
||||
return 0
|
||||
}
|
||||
#endif
|
||||
@@ -28,6 +28,10 @@ OS_ARCH_COMBOS = [
|
||||
('linux', 'x86', 'elf', ['-fPIC', '-DOPENSSL_IA32_SSE2'], 'S'),
|
||||
('linux', 'x86_64', 'elf', [], 'S'),
|
||||
('mac', 'x86_64', 'macosx', [], 'S'),
|
||||
# ('windows', 'aarch64', 'coff', [], 'S'),
|
||||
# ('windows', 'arm', 'coff', [], 'S'),
|
||||
('windows', 'x86', 'coff', [], 'S'),
|
||||
# ('windows', 'x86_64', 'coff', [], 'S'),
|
||||
]
|
||||
|
||||
|
||||
@@ -167,6 +171,8 @@ def preprocessor_platform_for_os(osname):
|
||||
return '__APPLE__'
|
||||
elif osname == 'linux':
|
||||
return '__linux__'
|
||||
elif osname == 'windows':
|
||||
return '_WIN32'
|
||||
|
||||
|
||||
def asm_target(osname, arch, asm):
|
||||
|
||||
@@ -241,6 +241,10 @@ mangle_symbols
|
||||
echo "REMOVING assembly on 32-bit Apple platforms"
|
||||
gsed -i "/#define OPENSSL_HEADER_BASE_H/a#if defined(__APPLE__) && defined(__i386__)\n#define OPENSSL_NO_ASM\n#endif" "$DSTROOT/include/openssl/base.h"
|
||||
|
||||
# Remove assembly on non-x86 Windows
|
||||
echo "REMOVING assembly on non-x86 Windows"
|
||||
gsed -i "/#define OPENSSL_HEADER_BASE_H/a#if defined(_WIN32) && !(defined(_M_IX86) || defined(__i386__))\n#define OPENSSL_NO_ASM\n#endif" "$DSTROOT/include/openssl/base.h"
|
||||
|
||||
echo "RENAMING header files"
|
||||
(
|
||||
# We need to rearrange a coouple of things here, the end state will be:
|
||||
|
||||
Reference in new issue
Block a user