View | Details | Raw Unified | Return to bug 282347
Collapse All | Expand All

(-)b/mail/thunderbird/files/patch-comm__third_party__rnp__lib__types.h (+12 lines)
Added Link Here
1
--- comm/third_party/rnp/src/lib/types.h.orig	2024-10-25 23:29:32 UTC
2
+++ comm/third_party/rnp/src/lib/types.h
3
@@ -95,9 +95,6 @@ class id_str_pair {
4
     static int         lookup(const id_str_pair           pair[],
5
                               const std::vector<uint8_t> &bytes,
6
                               int                         notfound = 0);
7
-    static int         lookup(const id_str_pair                 pair[],
8
-                              const std::basic_string<uint8_t> &bytes,
9
-                              int                               notfound = 0);
10
 };
11
 
12
 /** pgp_fingerprint_t */
(-)b/mail/thunderbird/files/patch-comm__third_party__rnp__lib__utils.cpp (+31 lines)
Added Link Here
1
--- comm/third_party/rnp/src/lib/utils.cpp.orig	2024-10-25 23:29:32 UTC
2
+++ comm/third_party/rnp/src/lib/utils.cpp
3
@@ -1,5 +1,5 @@
4
 /*
5
- * Copyright (c) 2021, [Ribose Inc](https://www.ribose.com).
6
+ * Copyright (c) 2021, 2024 [Ribose Inc](https://www.ribose.com).
7
  * All rights reserved.
8
  *
9
  * Redistribution and use in source and binary forms, with or without
10
@@ -53,21 +53,6 @@ id_str_pair::lookup(const id_str_pair pair[], const st
11
 
12
 int
13
 id_str_pair::lookup(const id_str_pair pair[], const std::vector<uint8_t> &bytes, int notfound)
14
-{
15
-    while (pair && pair->str) {
16
-        if ((strlen(pair->str) == bytes.size()) &&
17
-            !memcmp(pair->str, bytes.data(), bytes.size())) {
18
-            return pair->id;
19
-        }
20
-        pair++;
21
-    }
22
-    return notfound;
23
-}
24
-
25
-int
26
-id_str_pair::lookup(const id_str_pair                 pair[],
27
-                    const std::basic_string<uint8_t> &bytes,
28
-                    int                               notfound)
29
 {
30
     while (pair && pair->str) {
31
         if ((strlen(pair->str) == bytes.size()) &&
(-)b/mail/thunderbird/files/patch-comm__third_party__rnp__librekey__key_store_g10.cpp (+33 lines)
Added Link Here
1
--- comm/third_party/rnp/src/librekey/key_store_g10.cpp.orig	2024-10-25 23:29:32 UTC
2
+++ comm/third_party/rnp/src/librekey/key_store_g10.cpp
3
@@ -1,5 +1,5 @@
4
 /*
5
- * Copyright (c) 2017-2022, [Ribose Inc](https://www.ribose.com).
6
+ * Copyright (c) 2017-2024, [Ribose Inc](https://www.ribose.com).
7
  * All rights reserved.
8
  *
9
  * Redistribution and use in source and binary forms, with or without
10
@@ -312,12 +312,12 @@ read_curve(const sexp_list_t *list, const std::string 
11
 
12
     const auto &bytes = data->get_string();
13
     pgp_curve_t curve = static_cast<pgp_curve_t>(
14
-      id_str_pair::lookup(g10_curve_aliases, data->get_string(), PGP_CURVE_UNKNOWN));
15
+      id_str_pair::lookup(g10_curve_aliases, (const char *) bytes.data(), PGP_CURVE_UNKNOWN));
16
     if (curve != PGP_CURVE_UNKNOWN) {
17
         key.curve = curve;
18
         return true;
19
     }
20
-    RNP_LOG("Unknown curve: %.*s", (int) bytes.size(), (char *) bytes.data());
21
+    RNP_LOG("Unknown curve: %.*s", (int) bytes.size(), (const char *) bytes.data());
22
     return false;
23
 }
24
 
25
@@ -806,7 +806,7 @@ g23_parse_seckey(pgp_key_pkt_t &seckey,
26
 
27
     auto &           alg_bt = alg_s_exp->sexp_string_at(0)->get_string();
28
     pgp_pubkey_alg_t alg = static_cast<pgp_pubkey_alg_t>(
29
-      id_str_pair::lookup(g10_alg_aliases, alg_bt.c_str(), PGP_PKA_NOTHING));
30
+      id_str_pair::lookup(g10_alg_aliases, (const char *) alg_bt.data(), PGP_PKA_NOTHING));
31
     if (alg == PGP_PKA_NOTHING) {
32
         RNP_LOG(
33
           "Unsupported algorithm: '%.*s'", (int) alg_bt.size(), (const char *) alg_bt.data());
(-)b/mail/thunderbird/files/patch-comm__third_party__rnp__src__libsexpp__include__sexpp__sexp.h (+116 lines)
Added Link Here
1
--- comm/third_party/rnp/src/libsexpp/include/sexpp/sexp.h.orig	2024-10-25 23:29:32.000000000 +0000
2
+++ comm/third_party/rnp/src/libsexpp/include/sexpp/sexp.h	2024-10-27 06:14:59.238155000 +0000
3
@@ -44,8 +44,93 @@
4
 #include "sexp-public.h"
5
 #include "sexp-error.h"
6
 
7
+// We are implementing char traits for octet_t with trhe following restrictions
8
+//  -- limit visibility so that other traits for unsigned char are still possible
9
+//  -- create template specializatio in std workspace (use workspace specialization
10
+//     is not specified and causes issues at least with gcc 4.8
11
+
12
 namespace sexp {
13
+using octet_t = uint8_t;
14
+} // namespace sexp
15
 
16
+namespace std {
17
+
18
+template <> struct char_traits<sexp::octet_t> {
19
+    typedef sexp::octet_t  char_type;
20
+    typedef int            int_type;
21
+    typedef std::streampos pos_type;
22
+    typedef std::streamoff off_type;
23
+    typedef mbstate_t      state_type;
24
+
25
+    static void assign(char_type &__c1, const char_type &__c2) noexcept { __c1 = __c2; }
26
+
27
+    static constexpr bool eq(const char_type &__c1, const char_type &__c2) noexcept
28
+    {
29
+        return __c1 == __c2;
30
+    }
31
+
32
+    static constexpr bool lt(const char_type &__c1, const char_type &__c2) noexcept
33
+    {
34
+        return __c1 < __c2;
35
+    }
36
+
37
+    static int compare(const char_type *__s1, const char_type *__s2, size_t __n)
38
+    {
39
+        return memcmp(__s1, __s2, __n);
40
+    }
41
+
42
+    static size_t length(const char_type *__s)
43
+    {
44
+        return strlen(reinterpret_cast<const char *>(__s));
45
+    }
46
+
47
+    static const char_type *find(const char_type *__s, size_t __n, const char_type &__a)
48
+    {
49
+        return static_cast<const char_type *>(memchr(__s, __a, __n));
50
+    }
51
+
52
+    static char_type *move(char_type *__s1, const char_type *__s2, size_t __n)
53
+    {
54
+        return static_cast<char_type *>(memmove(__s1, __s2, __n));
55
+    }
56
+
57
+    static char_type *copy(char_type *__s1, const char_type *__s2, size_t __n)
58
+    {
59
+        return static_cast<char_type *>(memcpy(__s1, __s2, __n));
60
+    }
61
+
62
+    static char_type *assign(char_type *__s, size_t __n, char_type __a)
63
+    {
64
+        return static_cast<char_type *>(memset(__s, __a, __n));
65
+    }
66
+
67
+    static constexpr char_type to_char_type(const int_type &__c) noexcept
68
+    {
69
+        return static_cast<char_type>(__c);
70
+    }
71
+
72
+    // To keep both the byte 0xff and the eof symbol 0xffffffff
73
+    // from ending up as 0xffffffff.
74
+    static constexpr int_type to_int_type(const char_type &__c) noexcept
75
+    {
76
+        return static_cast<int_type>(static_cast<unsigned char>(__c));
77
+    }
78
+
79
+    static constexpr bool eq_int_type(const int_type &__c1, const int_type &__c2) noexcept
80
+    {
81
+        return __c1 == __c2;
82
+    }
83
+
84
+    static constexpr int_type eof() noexcept { return static_cast<int_type>(0xFFFFFFFF); }
85
+
86
+    static constexpr int_type not_eof(const int_type &__c) noexcept
87
+    {
88
+        return (__c == eof()) ? 0 : __c;
89
+    }
90
+};
91
+} // namespace std
92
+
93
+namespace sexp {
94
 /*
95
  * SEXP octet_t definitions
96
  * We maintain some presumable redundancy with ctype
97
@@ -99,14 +184,14 @@ class sexp_input_stream_t;
98
  * SEXP simple string
99
  */
100
 
101
-typedef uint8_t octet_t;
102
+using octet_traits = std::char_traits<octet_t>;
103
+using octet_string = std::basic_string<octet_t, octet_traits>;
104
 
105
-class SEXP_PUBLIC_SYMBOL sexp_simple_string_t : public std::basic_string<octet_t>,
106
-                                                private sexp_char_defs_t {
107
+class SEXP_PUBLIC_SYMBOL sexp_simple_string_t : public octet_string, private sexp_char_defs_t {
108
   public:
109
     sexp_simple_string_t(void) = default;
110
-    sexp_simple_string_t(const octet_t *dt) : std::basic_string<octet_t>{dt} {}
111
-    sexp_simple_string_t(const octet_t *bt, size_t ln) : std::basic_string<octet_t>{bt, ln} {}
112
+    sexp_simple_string_t(const octet_t *dt) : octet_string{dt} {}
113
+    sexp_simple_string_t(const octet_t *bt, size_t ln) : octet_string{bt, ln} {}
114
     sexp_simple_string_t &append(int c)
115
     {
116
         (*this) += (octet_t)(c & 0xFF);

Return to bug 282347