@@ -117,6 +117,11 @@ typedef int point_conversion_form_t;
117
117
// - 3: OpenSSL 3.0 or later
118
118
// - 111: OpenSSL 1.1.1 or later
119
119
120
+ // The noescape/nocallback attributes are performance optimizations.
121
+ // Only add functions that have been observed to benefit from these
122
+ // directives, not every function that is merely expected to meet
123
+ // the noescape/nocallback criteria.
124
+
120
125
// ERR API
121
126
void ERR_error_string_n (unsigned long e , char * buf , size_t len );
122
127
void ERR_clear_error (void ) __attribute__((tag ("" ),tag ("init_3" )));
@@ -150,7 +155,7 @@ _OSSL_PROVIDER_PTR OSSL_PROVIDER_try_load(_OSSL_LIB_CTX_PTR libctx, const char *
150
155
const char * OSSL_PROVIDER_get0_name (const _OSSL_PROVIDER_PTR prov ) __attribute__((tag ("3" ),noerror ));
151
156
152
157
// RAND API
153
- int RAND_bytes (unsigned char * arg0 , int arg1 );
158
+ int RAND_bytes (unsigned char * arg0 , int arg1 ) __attribute__(( noescape , nocallback )) ;
154
159
155
160
// EVP_MD API
156
161
_EVP_MD_PTR EVP_MD_fetch (_OSSL_LIB_CTX_PTR ctx , const char * algorithm , const char * properties ) __attribute__((tag ("3" ),tag ("init_3" )));
@@ -180,12 +185,12 @@ _EVP_MD_CTX_PTR EVP_MD_CTX_new(void);
180
185
void EVP_MD_CTX_free (_EVP_MD_CTX_PTR ctx );
181
186
int EVP_MD_CTX_copy (_EVP_MD_CTX_PTR out , const _EVP_MD_CTX_PTR in );
182
187
int EVP_MD_CTX_copy_ex (_EVP_MD_CTX_PTR out , const _EVP_MD_CTX_PTR in );
183
- int EVP_Digest (const void * data , size_t count , unsigned char * md , unsigned int * size , const _EVP_MD_PTR type , _ENGINE_PTR impl );
188
+ int EVP_Digest (const void * data , size_t count , unsigned char * md , unsigned int * size , const _EVP_MD_PTR type , _ENGINE_PTR impl ) __attribute__(( noescape , nocallback )) ;
184
189
int EVP_DigestInit_ex (_EVP_MD_CTX_PTR ctx , const _EVP_MD_PTR type , _ENGINE_PTR impl );
185
190
int EVP_DigestInit (_EVP_MD_CTX_PTR ctx , const _EVP_MD_PTR type );
186
- int EVP_DigestUpdate (_EVP_MD_CTX_PTR ctx , const void * d , size_t cnt );
191
+ int EVP_DigestUpdate (_EVP_MD_CTX_PTR ctx , const void * d , size_t cnt ) __attribute__(( noescape , nocallback )) ;
187
192
int EVP_DigestFinal_ex (_EVP_MD_CTX_PTR ctx , unsigned char * md , unsigned int * s );
188
- int EVP_DigestSign (_EVP_MD_CTX_PTR ctx , unsigned char * sigret , size_t * siglen , const unsigned char * tbs , size_t tbslen ) __attribute__((tag ("111" )));
193
+ int EVP_DigestSign (_EVP_MD_CTX_PTR ctx , unsigned char * sigret , size_t * siglen , const unsigned char * tbs , size_t tbslen ) __attribute__((tag ("111" ), noescape , nocallback ));
189
194
int EVP_DigestSignInit (_EVP_MD_CTX_PTR ctx , _EVP_PKEY_CTX_PTR * pctx , const _EVP_MD_PTR type , _ENGINE_PTR e , _EVP_PKEY_PTR pkey );
190
195
int EVP_DigestSignFinal (_EVP_MD_CTX_PTR ctx , unsigned char * sig , size_t * siglen );
191
196
int EVP_DigestVerifyInit (_EVP_MD_CTX_PTR ctx , _EVP_PKEY_CTX_PTR * pctx , const _EVP_MD_PTR type , _ENGINE_PTR e , _EVP_PKEY_PTR pkey );
@@ -229,13 +234,13 @@ int EVP_CIPHER_CTX_set_key_length(_EVP_CIPHER_CTX_PTR x, int keylen);
229
234
void EVP_CIPHER_CTX_free (_EVP_CIPHER_CTX_PTR arg0 );
230
235
int EVP_CIPHER_CTX_ctrl (_EVP_CIPHER_CTX_PTR ctx , int type , int arg , void * ptr );
231
236
int EVP_CipherInit_ex (_EVP_CIPHER_CTX_PTR ctx , const _EVP_CIPHER_PTR type , _ENGINE_PTR impl , const unsigned char * key , const unsigned char * iv , int enc );
232
- int EVP_CipherUpdate (_EVP_CIPHER_CTX_PTR ctx , unsigned char * out , int * outl , const unsigned char * in , int inl );
237
+ int EVP_CipherUpdate (_EVP_CIPHER_CTX_PTR ctx , unsigned char * out , int * outl , const unsigned char * in , int inl ) __attribute__(( noescape , nocallback )) ;
233
238
int EVP_EncryptInit_ex (_EVP_CIPHER_CTX_PTR ctx , const _EVP_CIPHER_PTR type , _ENGINE_PTR impl , const unsigned char * key , const unsigned char * iv );
234
- int EVP_EncryptUpdate (_EVP_CIPHER_CTX_PTR ctx , unsigned char * out , int * outl , const unsigned char * in , int inl );
235
- int EVP_EncryptFinal_ex (_EVP_CIPHER_CTX_PTR ctx , unsigned char * out , int * outl );
239
+ int EVP_EncryptUpdate (_EVP_CIPHER_CTX_PTR ctx , unsigned char * out , int * outl , const unsigned char * in , int inl ) __attribute__(( noescape , nocallback )) ;
240
+ int EVP_EncryptFinal_ex (_EVP_CIPHER_CTX_PTR ctx , unsigned char * out , int * outl ) __attribute__(( noescape , nocallback )) ;
236
241
int EVP_DecryptInit_ex (_EVP_CIPHER_CTX_PTR ctx , const _EVP_CIPHER_PTR type , _ENGINE_PTR impl , const unsigned char * key , const unsigned char * iv );
237
- int EVP_DecryptUpdate (_EVP_CIPHER_CTX_PTR ctx , unsigned char * out , int * outl , const unsigned char * in , int inl );
238
- int EVP_DecryptFinal_ex (_EVP_CIPHER_CTX_PTR ctx , unsigned char * outm , int * outl );
242
+ int EVP_DecryptUpdate (_EVP_CIPHER_CTX_PTR ctx , unsigned char * out , int * outl , const unsigned char * in , int inl ) __attribute__(( noescape , nocallback )) ;
243
+ int EVP_DecryptFinal_ex (_EVP_CIPHER_CTX_PTR ctx , unsigned char * outm , int * outl ) __attribute__(( noescape , nocallback )) ;
239
244
240
245
// EVP_PKEY API
241
246
_EVP_PKEY_PTR EVP_PKEY_new (void );
@@ -254,8 +259,8 @@ int EVP_PKEY_get_bn_param(const _EVP_PKEY_PTR pkey, const char *key_name, _BIGNU
254
259
int EVP_PKEY_up_ref (_EVP_PKEY_PTR key ) __attribute__((tag ("3" )));
255
260
int EVP_PKEY_set1_EC_KEY (_EVP_PKEY_PTR pkey , _EC_KEY_PTR key ) __attribute__((tag ("legacy_1" )));
256
261
int EVP_PKEY_CTX_set0_rsa_oaep_label (_EVP_PKEY_CTX_PTR ctx , void * label , int len ) __attribute__((tag ("3" )));
257
- int EVP_PKEY_get_raw_public_key (const _EVP_PKEY_PTR pkey , unsigned char * pub , size_t * len ) __attribute__((tag ("111" )));
258
- int EVP_PKEY_get_raw_private_key (const _EVP_PKEY_PTR pkey , unsigned char * priv , size_t * len ) __attribute__((tag ("111" )));
262
+ int EVP_PKEY_get_raw_public_key (const _EVP_PKEY_PTR pkey , unsigned char * pub , size_t * len ) __attribute__((tag ("111" ), noescape , nocallback ));
263
+ int EVP_PKEY_get_raw_private_key (const _EVP_PKEY_PTR pkey , unsigned char * priv , size_t * len ) __attribute__((tag ("111" ), noescape , nocallback ));
259
264
int EVP_PKEY_fromdata_init (_EVP_PKEY_CTX_PTR ctx ) __attribute__((tag ("3" )));
260
265
int EVP_PKEY_fromdata (_EVP_PKEY_CTX_PTR ctx , _EVP_PKEY_PTR * pkey , int selection , _OSSL_PARAM_PTR params ) __attribute__((tag ("3" )));
261
266
int EVP_PKEY_paramgen_init (_EVP_PKEY_CTX_PTR ctx );
@@ -272,7 +277,7 @@ int EVP_PKEY_sign(_EVP_PKEY_CTX_PTR arg0, unsigned char *arg1, size_t *arg2, con
272
277
int EVP_PKEY_verify (_EVP_PKEY_CTX_PTR ctx , const unsigned char * sig , size_t siglen , const unsigned char * tbs , size_t tbslen );
273
278
int EVP_PKEY_derive_init (_EVP_PKEY_CTX_PTR ctx );
274
279
int EVP_PKEY_derive_set_peer (_EVP_PKEY_CTX_PTR ctx , _EVP_PKEY_PTR peer );
275
- int EVP_PKEY_derive (_EVP_PKEY_CTX_PTR ctx , unsigned char * key , size_t * keylen );
280
+ int EVP_PKEY_derive (_EVP_PKEY_CTX_PTR ctx , unsigned char * key , size_t * keylen ) __attribute__(( noescape , nocallback )) ;
276
281
int EVP_PKEY_public_check_quick (_EVP_PKEY_CTX_PTR ctx ) __attribute__((tag ("3" )));
277
282
int EVP_PKEY_private_check (_EVP_PKEY_CTX_PTR ctx ) __attribute__((tag ("3" )));
278
283
_EVP_PKEY_PTR EVP_PKEY_Q_keygen (_OSSL_LIB_CTX_PTR ctx , const char * propq , const char * type , ...) __attribute__((tag ("3" )));
0 commit comments