diff options
| author | torkve <[email protected]> | 2022-02-10 16:48:23 +0300 |
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:48:23 +0300 |
| commit | f9cfbeee51d5849127bb58793a2edcdfd7bb91bb (patch) | |
| tree | f7c863cfcc3f1cb6de7f77e11fec2ae60868c8fb /contrib/python/cryptography/_cffi_src/openssl/callbacks.py | |
| parent | 5eefa17021221fd267f1dd5f9d63d2493d131a8a (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'contrib/python/cryptography/_cffi_src/openssl/callbacks.py')
| -rw-r--r-- | contrib/python/cryptography/_cffi_src/openssl/callbacks.py | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/contrib/python/cryptography/_cffi_src/openssl/callbacks.py b/contrib/python/cryptography/_cffi_src/openssl/callbacks.py index 19301b973a2..f50a9b4e8e4 100644 --- a/contrib/python/cryptography/_cffi_src/openssl/callbacks.py +++ b/contrib/python/cryptography/_cffi_src/openssl/callbacks.py @@ -5,48 +5,48 @@ from __future__ import absolute_import, division, print_function INCLUDES = """ -#include <string.h> +#include <string.h> """ TYPES = """ -typedef struct { - char *password; - int length; - int called; - int error; - int maxsize; -} CRYPTOGRAPHY_PASSWORD_DATA; +typedef struct { + char *password; + int length; + int called; + int error; + int maxsize; +} CRYPTOGRAPHY_PASSWORD_DATA; """ FUNCTIONS = """ -int Cryptography_pem_password_cb(char *, int, int, void *); +int Cryptography_pem_password_cb(char *, int, int, void *); """ CUSTOMIZATIONS = """ -typedef struct { - char *password; - int length; - int called; - int error; - int maxsize; -} CRYPTOGRAPHY_PASSWORD_DATA; - -int Cryptography_pem_password_cb(char *buf, int size, - int rwflag, void *userdata) { - /* The password cb is only invoked if OpenSSL decides the private - key is encrypted. So this path only occurs if it needs a password */ - CRYPTOGRAPHY_PASSWORD_DATA *st = (CRYPTOGRAPHY_PASSWORD_DATA *)userdata; - st->called += 1; - st->maxsize = size; - if (st->length == 0) { - st->error = -1; - return 0; - } else if (st->length < size) { - memcpy(buf, st->password, st->length); - return st->length; - } else { - st->error = -2; - return 0; - } -} +typedef struct { + char *password; + int length; + int called; + int error; + int maxsize; +} CRYPTOGRAPHY_PASSWORD_DATA; + +int Cryptography_pem_password_cb(char *buf, int size, + int rwflag, void *userdata) { + /* The password cb is only invoked if OpenSSL decides the private + key is encrypted. So this path only occurs if it needs a password */ + CRYPTOGRAPHY_PASSWORD_DATA *st = (CRYPTOGRAPHY_PASSWORD_DATA *)userdata; + st->called += 1; + st->maxsize = size; + if (st->length == 0) { + st->error = -1; + return 0; + } else if (st->length < size) { + memcpy(buf, st->password, st->length); + return st->length; + } else { + st->error = -2; + return 0; + } +} """ |
